[Numpy-discussion] float** arrays and Numarray
perry at stsci.edu
Thu Dec 20 10:37:01 EST 2001
> I use Numeric to transfer images between various image processing
> systems. Numarray includes most of the image data memory layouts that I
> have seen except for:
> Some C types need to be added (as several people have already commented).
> Some systems define an array as a "pointer to an array of pointers to
> ...". "Numerical Recipes in C" explains this approach clearly. Could
> this perhaps be implemented in Numarray as a buffer interface with
> multiple data segments?
> Ed Jones
That's an interesting question. I don't think that such a representation
makes much sense for numarray internally (for example, it makes it
difficult to reshape the object without creating new pointer arrays--
or data segments as mentioned above). I doubt that we would take
On the other hand, I don't see why the C-API could not create such
a representation (i.e., creating the necessary pointer arrays).
I guess the main question is whether how memory mangement is
done for these pointer arrays since they are not part of the
numarray object (one may have to explicitly deallocate them
in the C code). The main usefulness of this approach is that
it allows a simple indexing notation multidimensional arrays in
C. (On the other hand, perhaps the same could be largely accomplished
with C macros.) A drawback is that it can imply significant memory
overheads if the shape of the array is skinny in the wrong dimension.
But no, we haven't really thought much about it yet.
More information about the NumPy-Discussion