[Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?
Mon Sep 17 15:24:27 CDT 2007
David Cournapeau wrote:
> Christopher Barker wrote:
>> My real question is what compiler and library writers are doing -- has
>> anyone (OK, I guess MS and gcc are all I care about anyway) built
>> anything optimized for them? Are they going to dump them? Who knows?
> What do you mean by optimization ?
Well, I'm quite specifically not being precise about that. It appears
the POINT of valarray was to provide a way to do computation that
compiler(library) writers could optimize in various ways for the system
at hand. The one example I have seen is someone that wrote a version
that takes advantage of the PPC altivec instructions:
Anyway, at this point I'm far less concerned about optimization that
just a more robust and convenient way to deal with data that raw pointers.
> remember having used blitz at some point, and I thought it was terrible.
Darn -- it looks so promising.
> I think C++ is much more useful
> for the automatic memory management through RAII, which is what
> std::vector gives you.
and std::valarray not? I guess where I'm at now is deciding if there is
any advantage or disadvantage to using std::valarray vs. std::vector.
The other option is to go with something else: boost::multiarray,
blitz++, etc. However, at least in term of how well they might p;lay
with numpy arrays, I don't see a reason to do so.
> If your compiler supports restrict, use it
Thanks for that link -- I'll keep that in mind. And now I finally think
I understand what is meant by "aliased" pointer - which explains why,
quite deliberately, you can't create a valarray from an existing pointer
to a data block.
> The fact that, while C++ being a popular language, a standard class for
> matrix algebra does not exist yet shows me that this is not that useful,
> or too complicate to develop.
Could be. Personally, I'm not looking for matrix algebra, rather a
generic nd-array class - but the argument is the same.
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