[Numpy-discussion] Pass 2d ndarray into C **double using ctypes

Nathaniel Smith njs at pobox.com
Thu Jan 1 13:56:36 EST 2015


On Thu, Jan 1, 2015 at 6:00 PM, Yuxiang Wang <yw5aj at virginia.edu> wrote:
> Dear all,
>
> I am currently using a piece of C code, where one of the input
> argument of a function is **double.

As you discovered, Numpy's ctypes utilities are helpful for getting a
*double out of an ndarray, but they don't really have anything to do
with **double's -- for that you should refer to the plain-old-ctypes
documentation: https://docs.python.org/2/library/ctypes.html#ctypes.pointer

However, I suspect that this question can't really be answered in a
useful way without more information about why exactly the C code wants
a **double (instead of a *double) and what it expects to do with it.
E.g., is it going to throw away the passed in array and return a new
one?

-n

-- 
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org



More information about the NumPy-Discussion mailing list