Re: [Numpy-discussion] Initializing array from buffer

2014-11-17 Thread Stefan van der Walt
Hi Andrea On 2014-11-16 19:42:09, Andrea Arteaga andyspi...@gmail.com wrote: My use case is the following: we have a some 3D arrays in our C++ framework. The ordering of the elements in these arrays is neither C nor Fortran style: it might be IJK (i.e. C style, 3rd dimension contiguous in

Re: [Numpy-discussion] Initializing array from buffer

2014-11-17 Thread Edison Gustavo Muenz
Have you tried using the C-API to create the array? This link might be of help: http://docs.scipy.org/doc/numpy/reference/c-api.array.html#creating-arrays I know that Boost.Python can handle this. On Sun, Nov 16, 2014 at 3:42 PM, Andrea Arteaga andyspi...@gmail.com wrote: Hello. Using the

Re: [Numpy-discussion] Initializing array from buffer

2014-11-17 Thread Andrea Arteaga
Hi. Yesterday I tried to make use of the C API, but I did not manage to have anything useful. The reference is very well done, but I feel the lack for some tutorial that would guide with some examples. Do you know of any? The array interface looks sounds like a very good solution. In a sense it

Re: [Numpy-discussion] Initializing array from buffer

2014-11-17 Thread Nathaniel Smith
On Sun, Nov 16, 2014 at 5:42 PM, Andrea Arteaga andyspi...@gmail.com wrote: Hello. Using the numpy.frombuffer function [1] one can initialize a numpy array using an existing python object that implements the buffer protocol [2]. This is great, but currently this function supports only 1D

Re: [Numpy-discussion] Initializing array from buffer

2014-11-17 Thread Sturla Molden
Andrea Arteaga andyspi...@gmail.com wrote: My use case is the following: we have a some 3D arrays in our C++ framework. The ordering of the elements in these arrays is neither C nor Fortran style: it might be IJK (i.e. C style, 3rd dimension contiguous in memory), KJI (i.e. Fortran style,

Re: [Numpy-discussion] Initializing array from buffer

2014-11-17 Thread Robert McGibbon
The np.ndarray constructor http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html takes a strides argument argument, and a buffer. Is it not sufficiently flexible? -Robert On Sun, Nov 16, 2014 at 4:27 PM, Sturla Molden sturla.mol...@gmail.com wrote: Andrea Arteaga