C-API: How is data filling done in PyArray_SimpleNewFromData ?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I’m using numpy v1.2.0, and I have the following codes that provide
different results :
- ---------------------
cal = (PyArrayObject *)PyArray_SimpleNew(2,dims,NPY_FLOAT);
for(i=0;i
On Oct 27, 2009, at 7:43 AM, Raspaud Martin wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello,
I’m using numpy v1.2.0, and I have the following codes that provide different results :
- --------------------- cal = (PyArrayObject *)PyArray_SimpleNew(2,dims,NPY_FLOAT); for(i=0;i
As you probably guessed, "in" is a 2D array of floats of dimensions "dims".
My questions are thus: - - Why do the two methods provide different results ? - - How do I get the second to behave like the first ?
In the second case, "in" should be a pointer to a place in memory with space for dims[0]*dims[1] floats. In particular, it should not be a 2-d array of floats. FromData expects to get a single pointer to float (not a 2D array). I can't think of a way to get the second case to work other than have "in" be a 1-D array. -Travis
participants (2)
-
Raspaud Martin
-
Travis Oliphant