numeric library help

R

Rex_chaos

Hi all,
I am looking for a high-performance container(matrix and vector) for
numerical computation. Someone recommended the boost::multi_array. After
having looked at the documentation, I know several more candidates from it. They
are : MTL, blitz++, boost::ublas. I have no idea which one is the best.
The documentation of these packages are trying to convince me that they
are free from drawback :)) I need someone to tell me the experience in
using these packages. I must pick one of them before I begin my
development of a special numerical library based on it.
 
M

Michael Lehn

Rex_chaos said:
Hi all,
I am looking for a high-performance container(matrix and vector) for
numerical computation. Someone recommended the boost::multi_array. After
having looked at the documentation, I know several more candidates from
it. They are : MTL, blitz++, boost::ublas. I have no idea which one is the
best. The documentation of these packages are trying to convince me that
they are free from drawback :)) I need someone to tell me the experience
in using these packages. I must pick one of them before I begin my
development of a special numerical library based on it.

there's one more:

FLENS - Flexible Library for Efficient Numerical Solutions

http://sourceforge.net/projects/flens/

I am working in the department of numerical analysis at the University of
Ulm and we started about half a year ago with the implementation of FLENS.

First of all some reasons why we started with an own implementation might be
interesting for you:

MTL: It doesn't compile with iso standard conform compilers. It seams the
MTL-project is no longer active or at least has become a little sleepy.
It's also hard to maintain or to extend the MTL-code. And IMO to use MTL
is not always intuitive and the code just looks ugly (ok, matter of taste).

Blitz: Very nice and we copied some usability-features. But it's not ment
to be a numerical analysis library. It defines array-containers, provides
functionality to fill those ellegant, avoids unnecessary temoprary objects.
But if you need a matrix-vector multiplication or you need solvers for
linear equatiuons you have to implement this on your own (well, one thing
the developers of Blitz write themselves is that it's hard to extend,
partly due to the usage of expression templates)

boost::ublas I think from the above boost::ublas is best suited for
numerical analysis. It provides dense and sparse matrices, operations for
slicing (like in MatLab A(3:5, 7:8) just a less convenient notation). For
our purpose it was still not flexible enough regarding creation of own
matrix types. Another reason was, thst it also has some inconvenient
notations (not well suited for teaching purpose and some of our master
students are great mathematicians but poor programmers, they need a
interface as close to something like MatLab as possible.)

So I would say if you have to choose from the above 3 libs and if you really
need numerical functionality I would go with boost::ublas. However it
depends on what exactly your project is about (You said "special" numerical
library we experienced that "our special" required a more flexible
matrix-/vector concept)

So now some words about our library. Our master students use it for their
master thesis and in our lectures it's used for the exercises. But of
course it's only about 6 months old, so I don't want to claim that it is as
mature (and documented) as one of the lib's above. I only know that it
works fine for OUR teaching and research, but we steadily find and fix
bugs. If you plan to use our library you can tell me more about what your
project is about and I can tell you if it's reasonable IMO to really use
it. Of course, we would support by fixing flens-lib problems as soon as
possible over that time (like we do for our students).

cheers
Michael

P.S. a little example of what we call a usable interface:


DoubleDenseMatrix A(2, 2);
A = 1, 1,
1, 3
1, 5;

DoubleDenseVector b(3);
b = 4,
8,
11;

// SLICING
cout << "A(1:2,1:2) = " << A(_(1,2), _(1,2)) << endl;
cout << "b(1:2) = " << b(_(1,2)) << endl;

// SOLVE for x: A(1:2,1:2)*x = b(1:2)
cout << "x = A(1:2,1:2)/b(1:2) = "
<< A(_(1,2), _(1,2))/b(_(1,2)) << endl;
 
P

Patrick Kowalzick

Hi Rex,
You know, ublas is part of boost project and it's
implementation depends on several package of boost. So far, boost is
only a third-party library or loosely speaking it is a quasi-standard
library(isn't it?). From the user's view point, boost is very powerful
but most of the functionality make no sense to me. So if I choose
ublas as a foundation of my numerical library, the dependency to boost
is quite a issue. What's your opinion?

uBlas uses other parts of the boost library. If I take a quick look in
config.hpp of boost I get:
#include <boost/config.hpp>
#include <boost/static_assert.hpp>
#include <boost/limits.hpp>
#include <boost/utility.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/find.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_reference.hpp>

Maybe there are some more includes in other files. There are no libs and no
*.cpp to add to your project, just include the necessary header files out of
your boost tree. I did no installation nor any regression. I just put the
boost tree on my harddisk.

There is a yahoo group for ublas (ublas-dev ?), where you can find the
bindings to LAPACK, ATLAS, BLAS and UMFPACK. I use the LAPACK-Bindings which
work fine for me. Here I found these includes to other parts of boost
(perhaps not complete as well):
# include <boost/static_assert.hpp>
# include <boost/type_traits.hpp>

Regards,
Patrick
 
R

Rex_chaos

uBlas uses other parts of the boost library. If I take a quick look in
config.hpp of boost I get:
#include <boost/config.hpp>
#include <boost/static_assert.hpp>
#include <boost/limits.hpp>
#include <boost/utility.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/find.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_reference.hpp>

Maybe there are some more includes in other files. There are no libs and no
*.cpp to add to your project, just include the necessary header files out of
your boost tree. I did no installation nor any regression. I just put the
boost tree on my harddisk.

I have tested both the ublas and blitz. From the user's point of view,
blitz provide a more friendly interface as well as higher effeciency.
However, blitz is a little bit difficult to extend. I am hesitating
which one is better for my developement of a numerical library
including a PDE solver, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,372
Latest member
LucretiaFo

Latest Threads

Top