Does NumPy support indirect memory views?
PEP 3118 [1] allows exposing multi-dimensional data that is organized as array of pointers. It appears, however that NumPy cannot consume such memory views. Looking at _array_from_buffer_3118() function [2], I don't see any attempt to process suboffsets. The documentation [3] is also silent on this issue. What is the status of indirect memory views/buffers support in NumPy? [1] http://www.python.org/dev/peps/pep-3118/ [2] https://github.com/numpy/numpy/blob/4050ac73af79ae8cc513648ff02e9a22041501c4... [3] http://docs.scipy.org/doc/numpy/reference/arrays.interface.html
On Sat, Dec 14, 2013 at 7:39 PM, Alexander Belopolsky <ndarray@mac.com>wrote:
PEP 3118 [1] allows exposing multi-dimensional data that is organized as array of pointers. It appears, however that NumPy cannot consume such memory views.
Looking at _array_from_buffer_3118() function [2], I don't see any attempt to process suboffsets. The documentation [3] is also silent on this issue.
What is the status of indirect memory views/buffers support in NumPy?
There is indeed no support in NumPy for this. Unfortunately, fixing this would be a significant amount of work, as buffer management is not really abstracted in NumPy ATM. David
[1] http://www.python.org/dev/peps/pep-3118/ [2] https://github.com/numpy/numpy/blob/4050ac73af79ae8cc513648ff02e9a22041501c4... [3] http://docs.scipy.org/doc/numpy/reference/arrays.interface.html
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Sat, Dec 14, 2013 at 2:59 PM, David Cournapeau <cournape@gmail.com>wrote:
There is indeed no support in NumPy for this. Unfortunately, fixing this would be a significant amount of work, as buffer management is not really abstracted in NumPy ATM.
While providing a full support for indirect buffers as a storage for NumPy ndarrays does look like a daunting task, I think some partial support can be implemented rather easily. When an ndarray from object constructor encounters an object that can only expose its memory as an indirect buffer, the constructor can gather the data into a contiguous buffer. At the very least, _array_from_buffer_3118() should detect non-null suboffsets and bail out with a meaningful message rather than expose pointers as data.
participants (2)
-
Alexander Belopolsky
-
David Cournapeau