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

Christopher Barker Chris.Barker at noaa.gov
Mon Sep 10 12:33:44 EDT 2007


Xavier Gnata wrote:
> Here it is :) 

Thanks, that's helpful. Am I reading it right? Are you running the 
python process embedded in your C++ app? (rather than extending?)

>   valarray < double >Data (NbData);

>   array = PyArray_SimpleNewFromData (NbDims, Dims, PyArray_DOUBLE, 
> &Data[0]);

OK, so you've now got a view of the data from the valarray. Nice to know 
this works, but, of course, fragile if the valarray is re-sized or 
anything, so it probably won't work for us.

-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 at noaa.gov



More information about the NumPy-Discussion mailing list