472,958 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

numeric library help

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.
Jul 19 '05 #1
4 5449
Rex_chaos wrote:
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;



Jul 19 '05 #2
> 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).
Maybe. But from the website of MTL, it seems that the developers are
going to have a further develope the package. Anyway, I don't really
like the interface of MTL. BTW, from the FAQ of MTL, it seems that the
highest efficiency must be actived by some compilers not all. :(
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) Actually, I have been writing my own package since one year ago. But I
give up recently because of the powerful Blitz. Some comments are
trying to convince me that Blitz are free from drawbacks !? Your
opinion on the library show me something more important than the
effeciency - the second development. Maybe blitz is not really
suitable for my purpose.

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.) It sounds that you are doing something more abstract and fexible. I
have no idea about it. I think boost::ublas is good because of it's
consideration of different type of matrix. But I am worrying about the
following issue. 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?
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).


It sounds great. I would like to know more about it but the site you
give above is blocked. Would you please tell me something more about
flens? Is it a elegant library just like blitz? What is the aim of
this project (just provide a friendly interface)?

Finally, I would like to have your opinion about the effeciency of the
libraies talking above. I am a very beginner of cpp programming. For
comparing with the OOP(eg. inheritance mechanism, operator-based
mechanism), template technique, which leads to generic programming,
is a good choice for providing high effeciency code, just like MTL do.
For further lower the cost, blitz take expression template as the core
of the library. The author of the blitz claims that some code of the
library is more efficient than that of Fortran ?! I don't know the
effeciency of ublas and flens.

p.s. What I am doing is to develope a library for some numerical
routines and solver of PDE. Solving nonlinear PDE is also a essential
part of my library.
Jul 19 '05 #3
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
Jul 19 '05 #4
> 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.
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: GujuBoy | last post by:
I have made a program in "Python" which imports Numeric and calls the function ones_array = Numeric.ones(blah,blah) i see that C++ has a <numeric> library and i was wondering where the "ones"...
7
by: BBFrost | last post by:
I'm receiving decimal values from database queries and placing them on a report page. The users want to see the following .... Db Value Display Value 123.3400 123.34...
9
by: Agnes | last post by:
Where I can find the tutorial about numeric function.. e.g x = 15/6, i need to get the result (2) but not (2.5) also get the reminder y = 15/6 , i can get the result (3) Thanks
4
by: Dimitrios Charitatos | last post by:
Hello, I suspect that there is a quite straight forward answer to this, but I can't find it... I want to import an image and extract a matrix (or array) from it with elements showing the RGB...
11
by: Pieter | last post by:
Hi, I'm having some troubles with my numeric-types in my VB.NET 2005 application, together with a SQL Server 2000. - I first used Single in my application, and Decimal in my database. But a...
7
by: Sheldon | last post by:
Hi, I have the following loop that I think can be written to run faster in Numeric. I am currently using Numeric. range_va = main.xsize= 600 main.ysize= 600 #msgva is an (600x600) Numeric...
5
by: Andreas Beyer | last post by:
There has been quite some traffic about mutable and immutable data types on this list. I understand the issues related to mutable numeric data types. However, in my special case I don't see a...
11
by: ZMY | last post by:
Dear all, I am a real newbie for both python and QNX, but I am still trying to compile Numeric-24.2 under QNX4.25 with python 2.2. I got following error message: $ sudo python setup.py...
13
by: nishit.gupta | last post by:
Is their any fuction available in C++ that can determine that a string contains a numeric value. The value cabn be in hex, int, float. i.e. "1256" , "123.566" , "0xffff" Thnx
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.