Getting double* from NumPy array?

Paul F. Dubois pauldubois at home.com
Sun Jul 2 22:40:03 EDT 2000


Please see the appropriate chapter in the Numerical Documentation (Chapter
12, I believe). There is quite a bit to know and just telling you to access
x->data would not be doing you any favors. Please read the entire chapter
before proceeding.

The process is not very complicated but it must be done correctly. Don't
overlook the import_array statement.

Ted Drain <ted.drain at jpl.nasa.gov> wrote in message
news:ted.drain-2606001323500001 at mjordan.jpl.nasa.gov...
> I have some existing C/C++ code that can accept a double array ( int len,
> and double* ptr) to do some processing.  I want to allow users to create
> arrays in python using NumPy and then provide an interface to pass these
> arrays to my C/C++ code.
>
> Assuming a 1-dimensional NumPy array, is there an easy way to extract a
> pointer to a double and length from the python object?  The C/C++ isn't
> going to change the object so I'd prefer not to make a copy of it.
>
> Thanks
> Ted
>
> --
> Ted Drain   Jet Propulsion Laboratory    Ted.Drain at jpl.nasa.gov





More information about the Python-list mailing list