[Numpy-discussion] NumPy re-factoring project

Christopher Barker Chris.Barker@noaa....
Sat Jun 12 12:17:12 CDT 2010


David Cournapeau wrote:
>> In the core C numpy library there would be new  "numpy_array" struct
>> with attributes
>>
>>  numpy_array->buffer

> Anything non trivial will require memory allocation and object
> ownership conventions.

I totally agree -- I've been thinking for a while about a core array 
data structure that you could use from C/C++, and would interact well 
with numpy and Python -- it would be even better if it WAS numpy.

I was thinking that at the root of it would be a "data_block" object 
(the buffer in the above), that would have a reference counting system. 
It would be its own system, but hopefully be able to link to Python's 
easily when used with Python.

we're talking C here, so trying to have a full fledged memory management 
would be practically inventing another language, but if the just the 
data blocks of memory could be managed, that would allow things like 
sub-arrays, and slices, and views to work well.

I as partly inspired by how useless C++ std::valarrays appeared to be -- 
a slice of a valarray is not the same as a valarray, because the 
original valrray is managing the memory (and I may have that wrong) -- 
what this said to me is that there needs to be a central system managing 
the memory blocks, while the user code can manage the higher level objects.

If the C core were left with absolutely no memory management, then I 
think we'd have a next to useless system in raw C.


-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list