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

Russell E. Owen rowen at cesmail.net
Wed Sep 5 13:31:46 EDT 2007


In article <4CED078D-B8C7-4917-B0DE-4ED60BDFE015 at sandia.gov>,
 "Bill Spotz" <wfspotz at sandia.gov> wrote:

> I have been considering adding some C++ STL support to numpy/doc/swig/ 
> numpy.i.  Probably std::vector<TYPE> <=> PyArrayObject (and some  
> std::complex<TYPE> support as well).  Is this what you had in mind?

That sounds very useful, but how did you get it to work? std::vectors 
are resizable and numpy arrays are not. However, much of the time I want 
std::vectors of a particular size -- in which case numpy would be a 
great match.

(Speaking of which, do you happen to know of any good std::vector 
variant that has fixed length?)

-- Russell




More information about the NumPy-Discussion mailing list