[Numpy-discussion] Returning a 2-D PyArrayObject

Konrad Hinsen hinsen at cnrs-orleans.fr
Thu Mar 28 08:28:09 CST 2002


Amitha P <amitha_linux at yahoo.com> writes:

> irrevelent values. I could successfully return single
> dimension Python array object but I am not able to
> return 2D python array object. I am attaching the
> code. Please look at it and point out the errors. 

> product = (PyArrayObject *)PyArray_FromDimsAndData(2,
> dimensions,
> PyArray_FLOAT,c);

The variable c in this call must point to a storage area which holds
the elements of the matrix, i.e. a one-dimensional float array. What
you pass in your code is a list of pointers to the rows of the matrix.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------




More information about the Numpy-discussion mailing list