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

Xavier Gnata gnata at obs.univ-lyon1.fr
Sat Sep 8 15:33:58 EDT 2007


Bryan Van de Ven wrote:
> Christopher Barker wrote:
>
>   
>> Does anyone know the status of support for valarrays now?
>>     
>
> I used std::valarray to implement a variant of the example Matrix class in 
> Stroustrup's book (2D only) about two years ago. I was aware that is in disuse, 
> by and large, but it worked well enough for my purposes and I was happy with it. 
>   I'm sure it could have been done differently/better.
>
> Bryan
>   
Hi,

std:valarray are quite strange containers because they are not well 
integrated in the STL.
For instance, you cannot play with maps of valarrays : 
http://gcc.gnu.org/ml/gcc-bugs/2006-05/msg02397.html
Note that it is *not* a gcc bug but a design choice. As a result and 
beacuse I'm an STL happy user,  I always use vector when I have to deal 
with arrays (of course matrix lib are great as log as you have to do 
some more complicated maths or as long as you have matrix and not only 
arrays).

Hum...we are on a python list ;) so I would be very happy to see some 
support of std:vector <--> numpy.

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

-- 
############################################
Xavier Gnata
CRAL - Observatoire de Lyon
9, avenue Charles André
69561 Saint Genis Laval cedex
Phone: +33 4 78 86 85 28
Fax: +33 4 78 86 83 86
E-mail: gnata at obs.univ-lyon1.fr
############################################ 




More information about the NumPy-Discussion mailing list