Boost logo

Ublas :

Subject: [ublas] prod(trans(M),M) performance?
From: W Eryk Wolski (wewolski_at_[hidden])
Date: 2009-10-26 04:54:06


Hello,
hope you can give me some advice.
I tried different types of matrices matrix, mapped_matrix etc.
The best performance for matrix matrix multiplication I am getting with
ublas::matrix type. However, even with this type the computation time in
release mode for a 1000x1000 band matrix, measured with boost::timer is
tremendous: 111.4 s.

I am new to ublas so I am wondering how I can improve to code/compiler
settings etc to speed up the computation.

Preporcessor settings: NDEBUG;_CONSOLE;BOOST_UBLAS_NDEBUG, VS2008, Boost
1.37

namespace bubla = boost::numeric::ublas;
typedef double value_type;
typedef bubla::matrix<value_type> SparseMatrix;
unsigned int m = 1000;
SparseMatrix D(m,m,3*m), X;

bubla::matrix_vector_range<SparseMatrix > mvr(
                    D, bubla::range (0, m ), bubla::range(0, m )
                    );
std::fill(mvr.begin(),mvr.end(),value_type(3.));
bubla::matrix_vector_range<SparseMatrix > mvr2
                    (
                    D, bubla::range (0, m-1 ), bubla::range(1, m )
                    );
std::fill(mvr2.begin(),mvr2.end(),value_type(1.));
bubla::matrix_vector_range<SparseMatrix > mvr3
                    (
                    D, bubla::range (1, m ), bubla::range(0, m )
                    );
std::fill(mvr2.begin(),mvr2.end(),value_type(1.));
boost::timer t1;
t1.restart();
X = bubla::trans( D );
X = bubla::prod( X , D ) ;
std::cout << t1.elapsed() << std::endl;

regards

-- 
Witold Eryk Wolski
Heidmark str 5
D-28329 Bremen
tel.: 04215261837