blitz++ (matrix template library) as optional package

29 views
Skip to first unread message

Volker Braun

unread,
Feb 10, 2012, 4:00:56 AM2/10/12
to sage-...@googlegroups.com
I recently note that there is no C++ array template library shipped with Sage. I think this is an impediment for more serious numerical computations. The whole Cython thing is really nice to speed up Python code, but if you are serious about avoiding heap allocation of array entries then Cython becomes less elegant. So I would like to start some discussion about this ;-)

One possibility is blitz++ (http://www.oonumerics.org/blitz/). Others would be Eigen, boost::ublas, or boost::mtl, I made a tentative spkg here:


To really fit into Sage one would need a Cython wrapper to access it from Python. Right now, Cython doesn't support all the necessary C++ features so its not a straightforward task. But in the longer run either Cython will become better with C++ or we'll work around it, so its not impossible.

Advantages:
  * blitz++ has been around for a while and is essentially feature-complete
  * scipy.weave.blitz would benefit from it

Disadvantages:
  * Mystical compiler error messages

Comments? 

Thierry Dumont

unread,
Feb 10, 2012, 5:16:41 AM2/10/12
to sage-...@googlegroups.com
Le 10/02/2012 10:00, Volker Braun a �crit :

> I recently note that there is no C++ array template library shipped with
> Sage. I think this is an impediment for more serious numerical
> computations. The whole Cython thing is really nice to speed up Python
> code, but if you are serious about avoiding heap allocation of array
> entries then Cython becomes less elegant. So I would like to start some
> discussion about this ;-)
>
> One possibility is blitz++ (http://www.oonumerics.org/blitz/). Others
> would be Eigen, boost::ublas, or boost::mtl, I made a tentative spkg here:
>
> http://www.stp.dias.ie/~vbraun/Sage/spkg/blitz-20120201.spkg
>

1) blitz++ is *not* a matrix template library, but an *array* template
lib. There is the beginning of a class "matrix", but this is very few.

2) actually, blitz++ is already in Sage, included in scipy:
./sage-4.7.1/local/lib/python2.6/site-packages/scipy/weave/blitz

So, may be it would be better to make a binding with scipy's blitz++?

I have used blitz++ for a long time in my C++ codes: this is a very nice
an efficient library: the most spectacular is the implementation of the
"expression template" method, that Veldhuizen invented.

I have tried boost::ublas: this is *not* efficient.

Yours
t.

tdumont.vcf
Reply all
Reply to author
Forward
0 new messages