Boost logo

Boost Users :

From: Maik Beckmann (maikbeckmann_at_[hidden])
Date: 2007-11-20 14:52:53


Am Dienstag 20 November 2007 16:24:42 schrieb nisha kannookadan:
> I use matrices, vectors, matrix- and vector proxies. Do some
> solving and compute calculations with prod, element_div, etc..

So you implemented the solver yourself. Aside from other kind of
optimizations the algorithm is the effective one!

> Is boost in general slower than matlab,

One of my mayor tasks at work is using Matlab. The Matlab language itself is
about magnitudes slower thank C/C++/Fortran. Try this example to see how
slow a Matlab loop is
<Matlab example>
N=30000;

tic;
for idx=1:N
   vec(idx) = idx;
end
toc

tic
vec = [1:N];
toc
</Matlab example>

If you want fast Matlab code you have to replace a generally slow Matlab loop
with some fast vector syntax expression. The similar is valid for all script
languages, AFAIK.

> should I use something
> else?

If you want speed you have to ;)

> Id be real happy about any help.

First try use full optimization (-O3 for gcc) and define NDEBUG. If NDEBUG is
defined many performance consuming checks, which help you while developing
your code, are disabled.

Another thing that Matlab does to provide good performance is using highly
optimized numeric libraries (blas, lapack or even faster: ATLAS). uBlas is
able to use them as backend too. See "Bindings" at http://tinyurl.com/r1ee .

Like all interpreted languages (i.e. python), Matlab can always be
outperformed by C++, by the cost of the much more time consuming C++ coding.

If you want to write an application you have to use a standalone language like
C++ anyway.

If you want to use some environment for solving numerical problems (Matlab or
i.e. scipy for python) you can code otherwise slow script language loops in
C++ and use this compiled modules from inside your script language:
 - for Matlab search for "mex", mexfiles and mexFuntion at their help browser
 - for python see http://docs.python.org/ext/ext.html

Best Regards,
--Maik Beckmann
  


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net