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

David Cournapeau david@ar.media.kyoto-u.ac...
Thu Sep 20 04:46:46 CDT 2007


Charles R Harris wrote:
>
>
> Templates are a godsend for containers and such using multiple types. 
> I think that much of Numpy could be naturally written up that way.
Using template makes wrapping the API by another language almost 
impossible. This alone is a pretty good argument against using C++ at 
all (this is actually one of the reason I stopped using it for most of 
my projects). The numpy approach is in my opinion much better: provides 
a good and complete C API. You can always put a C++ api on top of it, 
which is much easier than the contrary (putting a C api around a C++ API).

>
> I found the performance of ublas to be pretty good for small arrays 
> when it was compiled with the -NODEBUG option, the assembly code 
> looked pretty good too. The default with all the bounds checking and 
> such is terrible and the assembly code practically unreadable (180 
> character function identifiers, etc), but for debugging it did its job.
I am sure I tested with the -NODEBUG, because I remembered having looked 
for an array container which does bound checking using a compilation 
option. It is quit likely that the library was much improved since I 
looked the last time.

cheers,

David


More information about the Numpy-discussion mailing list