Witold,
In gcc with -DNDEBUG (and -O2), it runs on 5.7 secs on my laptop.
I would suggest putting
#define NDEBUG
before including any ublas headers in your cpp files (just in case the compiler is not doing its job) and make sure that you are compiling in RELEASE mode.
my timings:
(qtcreator as ide under linux:)
5.7 secs with -DNDEBUG, RELEASE mode
65 secs with -DNDEBUG, DEBUG mode
30 secs without -DNDEBUG, RELEASE mode
76 without -DNDEBUG, DEBUG mode
Best
Nasos
Date: Mon, 26 Oct 2009 09:54:06 +0100
From: wewolski@gmail.com
To: ublas@lists.boost.org
Subject: [ublas] prod(trans(M),M) performance?
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
Windows 7: I wanted simpler, now it's simpler. I'm a rock star.