Possible Duplicate:
BOOST uBLAS matrix product extremely slow
I am trying to use uBlas library (in boost).
I wrote a simple code to multiple two large matrices. The result is too slow, when I compared the performance with Matlab and Octave, it was extremely slower. Would you please help me to solve the problem
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/operation.hpp>
int main () {
using namespace boost::numeric::ublas;
const int D = 1000;
matrix<double> a (D, D);
matrix<double> b (D, D);
matrix<double> c (D, D);
for (unsigned i = 0; i < a.size1 (); ++ i)
for (unsigned j = 0; j < a.size2 (); ++ j){
a (i, j) = ((i-j)<150)?1:0;
b (i, j) = 3 * i + j;
}
std::cout <<"Hi\n";
axpy_prod(a, b,c, false); // C = A * B
//noalias(c) = prod(a,b);
return 0;
}