[Numpy-discussion] access ndarray in C++

Thomas Hrabe thrabe@burnham....
Tue Apr 22 16:38:16 CDT 2008

Hi all!

I am currently developing a python module in C/C++ which is supposed to access nd arrays as defined by the following command in python

a = numpy.array([1,1,1])

I want to access the array the following way and use the nd array data for further processing in C.


The example code on 

 (!PyArg_ParseTuple(args, "O!",&PyArray_Type, &array))

does not work for nd arrays. I always get 
TypeError: argument 1 must be array, not numpy.ndarray

I assume the error is the constant provided as the third parameter, saying that the imput is of PyArray_Type and no nd array.

So here are my questions:
1. is there any good tutorial / example code for acessing nd arrays in C?
2. what is the difference between both (arrays and nd arrays? - I am new to python and heard there were different approaches to arrays and that nd arrays work better for multi dimensional applications. Is this right?)
3. which one of both will be used in the future?

Thank you in advance for your help,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080422/0fbedb13/attachment.html 

More information about the Numpy-discussion mailing list