[Numpy-discussion] ?Loading double and cdouble in an PyArrayObject?

Francesc Alted falted at openlc.org
Tue Oct 7 09:19:10 CDT 2003


A Dimarts 07 Octubre 2003 17:58, Norman Shelley va escriure:
> How do I take data from a double array or a complex array as defined below
> and initialize a Numeric array and load it appropriately?
>
> struct complex {
>   double real;
>   double imag;
> } complex;
>
> complex cdata[100];
> double *data[100];
> PyArrayObject *array;

By reading the manual (page 65), I guess the best would be something like:

  arr = PyArray_FromDimsAndData(1, 100, PyArray_CDOUBLE, cdata)

Cheers,

-- 
Francesc Alted





More information about the Numpy-discussion mailing list