Boost logo

Ublas :

Subject: [ublas] Product of two matrices is very slow
From: zdespot (zdespot_at_[hidden])
Date: 2009-06-15 07:07:38

Hi there,

I am starting to use ublas package. Although I have studied the FAQs the
product of two matrices is still slow.
To execute the following code (on standard latop DELL inspirion 510m) it
took about 12 seconds (Debug and Release almost the same). I also have
tried the "naked" C-array and it took only few seconds to execute.

Could You give me a hint please how to propery use ublas for
performance? I am using MS Visual-Studio 2003.

#include <boost/numeric/ublas/matrix.hpp>
using namespace boost;
using namespace boost::numeric;

#define NDEBUG
int main(int,char*[])
    ublas::matrix<double> m1(600,100);
    ublas::matrix<double> m2(100,100);
    ublas::matrix<double> r(600,100);
    noalias(r) = prod(m1,m2);

Zoran Despot