Boost logo

Ublas :

From: Jesse Perla (jlp400_at_[hidden])
Date: 2008-08-06 15:09:51

I am trying to patch together a set of C++ libraries to provide a really
straightforward C++ development toolkit /set of libraries for economists to
use as an alternative to fortran/matlab. This is for a set of tool
proposals that a number of people might follow for separate projects.

I am sure this request has been repeated a million times, but I looked
through mailing lists, etc. and cannot seem to find definitive wisdom about
what is the best approach to take. Can anyone help out with ideas about
where the industry is going? As far as I can see, the basic choice is
between boost::ublas and blitz++.

My priorities (in order):

1. Notational convenience for all the matrix, vector, scalar
operations, array slicing, ranges, outer product, etc. Heavy operator
overloading with natural notation like matlab or fortran. Does Blitz++ win

2. Moving towards the (formal or informal) standard library for
matrices, and integration with other libraries. These are relatively
unsophisticated users and we need to make things easy to evolve and
integrate with different libraries. Am I correct to think that boost::ublas
is the likely winner here? Is it a probably stepping stone towards
integration into STL? Why hasn't there been STL additions for matrices and
will there ever be a baseline version?

3. Performance for small/medium matrices. I assume Blitz++ wins.

4. Support for simple tensor notation. Nothing fancy – not doing
physics here, just taking slices, contractions, kronecker, etc. Does
Blitz++ win here? One problem is that the blitz::ublas and its
multidimensional array libraries are different.

5. Performance for large matrices. A last consideration. Occasionally
big matrices will come up, but I think it is reasonable to ask people to use
a separate library if these are the exception and performance becomes an

The other related library choices which I would love to be compatible with
if possible – and am looking for further advice if you have any:

· I don't expect complete compatibility with these types of things,
but then some smart copy constructors and castings, etc. should make life
easier for interoperation.

· Foreach patterns in iterators, stl or otherwise, or macros like
boost_foreach. This is a pretty big one… if we use this for arrays, how to
do convert back and forth to have things work

· Option for fortran storage of matricies, or relatively easy way to

· Calculating eigenvalues (again, probably not the biggest matrices,
so bad performance is OK). And a few operations like cholesky.

· Solving linear systems, constrained linear systems

· Generic nonlinear equation solvers/minimization routines (this
might come in through simultaneous equation solving or vector valued

· Output to 'cout', and eventually serialization for MPI routines.

Have I asked the right questions here or stated the important principles? Both
boost and blitz++ seem like great libraries (is that what my choice is
between?), but it is really hard for outsiders to know where to go and where
the industry is moving. It looks like Blitz++ has the better notation (and
probably performance), but that Boost::ublas may be more likely to become a
"standard" (because it is in boost) and is where the main evolution is
happening. Is this correct?

Thanks for your help,