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

Christopher Barker Chris.Barker@noaa....
Mon Sep 10 11:30:05 CDT 2007


Thanks for you input Xavier.

Xavier Gnata wrote:
> std:valarray are quite strange containers because they are not well 
> integrated in the STL.

> I always use vector when I have to deal with arrays.

> ps : There are no real performance differences between vector and 
> valarray (in my use cases...)

Probably not for our use cases either. However, we're not doing a lot of 
STL either, so I'm not sure there is any downside to valarray. It looks 
like neither one supports any kind of "view" semantics, so for the 
purposes of numpy array wrapping, they really aren't any different.

On the other hand, I don't know if any of the other common array 
implementations do either -- boost::multiarray, blitz++, etc.

So I guess we just need to copy data s we move back and forth (which may 
not even be a problem -- we haven't gotten it working yet, so have no 
idea if there are any performance issues for us)

A nice numpy-array compatible array for C++ would be nice -- but I know 
I'm not going to write it!

-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