
Ublas : 
From: liu chang (liuchangjohn_at_[hidden])
Date: 20061103 02:45:26
Hi all,
I am using ublas for a research project, in which a very common
operation is to multiply a dense matrix with a very sparse vector. So
I did a little experiment:
#define NDEBUG
compressed_matrix sm(1000, 1000);
matrix dm(1000, 1000);
compressed_vector sv(1000)
vector dv(1000);
sm.clear(); dm.clear(); sv.clear(); dv.clear();
dv = prod(sm, sv); // operation 1
dv = prod(dm, sv); // operation 2
To my surprise, the first operation is about 50 times faster than the
second, with g++ O3. It seems that ublas isn't able to take full
advantage of the sparseness in sv (dv is empty regardless of dm).
So is this a limitation of ublas or am I doing something wrong? If
ublas isn't able to handle such situation, can I code a routine myself
to specifically take care of multiplication of dense matrix with
sparse vector?
Any help is greatly appreciated!
Liu Chang