473,508 Members | 2,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5482
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
1828
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
3910
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
4137
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
7186
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
2218
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
1639
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
1592
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
2542
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
14945
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
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.