Boost logo

Glas :

Re: [glas] multi-dimensional arrays?

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2007-11-28 13:57:39


On Wednesday 28 November 2007, Evgenii Rudnyi wrote:
> >I'm enthusiastically following mtl4 and glas developments.
> >One thing that
> >neither seems to address is arrays of dimension >2. Is this true?
>
> NumPy supports multidimensional arrays:
>
> http://www.scipy.org/NumPy
>

Yes it does. Unfortunately, it doesn't have a nice c++ interface, AFAIK.

What I'd like is to be able to write generic algorithms in c++ that can use
various multi-dimensional containers, and then expose them to python.

So far, what I've done is expose various container types to python (ublas,
blitz++) using boost::python. Then, instantiate algorithms using these
containers to expose to python.

Each lib has it's own issues. ublas, for example, doesn't conform to all of
container concept (lacks constructor taking a pair of iterators), but that's
pretty easy to work around.

blitz takes a little work, because it lacks proper iterators. I have built
boost::iterator adapters that handle that (perhaps not efficiently, though).

I don't know how to use numpy to get a nice generic interface on the c++ side.