[Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?

Christopher Barker Chris.Barker@noaa....
Wed Sep 5 16:08:07 CDT 2007


Matthieu Brucher wrote:
> Blitz++ is more or less avandoned. It uses indexes than can be 
> not-portable between 32bits platforms and 64bits ones.

Oh well -- that seems remarkably short sited, but would I have done better?

> The Boost.Array is a fixed-size array, determined at compile-time,

Ah, I had gotten the wrong impression -- I thought it was fixed at 
construction time, not compile time.

> not  interesting there, I suppose.

I agree, I kind of wonder what the point is.

> Multiarrays are what you're looking for. 

Even if I just want 1-d? though I guess a 1-d multiarray is pretty simple.

> Besides, it is not needed to build Boost to use them 

I've seen that -- it does look like all we'd need is the header.

So, can one:

  - create a Multiarray from an existing data pointer?

  - get the data pointer for an existing Multiarray?

I think that's what I'd need to make the numpy array <-> Multiarray 
transition without any copying.

( I know those are really questions that are best asked on the boost 
list, and should be in the docs, but you folks are so helpful...)

Maybe this is the class to wrap with the array interface, though maybe 
that's exactly what Boost::python::array does (though, AFAICT, still not 
for numpy).

-CHB



-- 
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