[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:33:44 CDT 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.


Christopher Barker, Ph.D.

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


More information about the Numpy-discussion mailing list