[SciPy-dev] Which matrix library in C++ for scipy

Fernando Perez fperez.net at gmail.com
Thu Apr 26 09:36:27 EDT 2007


On 4/26/07, Neal Becker <ndbecker2 at gmail.com> wrote:

> So my approach is:
>
> 1. Write c++ algorithms with generic interfaces (where feasible).
> 2. When it is not feasible to use generic container types, I use
> boost::ublas::{vector/matrix} explicitly.
> 3. The above c++ code is parametrized (templated) on the container types.
> 4. Explicit instantiations of (3) are then exposed to python, normally
> specifying ublas::{vector/matrix} as the input/output types.
>
> This doesn't, of course, directly interoperate with numpy.  I can, however,
> convert between numpy arrays and ublas::matrix (which currently requires
> copying the data, unfortunately).

I'm curious (being a rather primitive C++ user) as to why you don't
like/use/prefer Blitz++ for this particular use?  Blitz arrays are
fairly numpy-like in much of their behavior, and one can be
instantiated out of a numpy array with minimal cost (copying only the
striding info, not the actual data).  That's what weave uses both for
weave.blitz and for weave.inline when type_converters=blitz is passed.

Thanks,

f



More information about the SciPy-Dev mailing list