This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Sparse matrix multiplication

Tags: None
(comma "," separated)
pamparana
Registered Member
Posts
18
Karma
0

Sparse matrix multiplication

Mon Apr 14, 2014 10:34 am
I am relatively new to Eigen and I am trying to perform an operation on sparse matrix as follows:

Code: Select all
Eigen::SparseMatrix<float> priors;
// Some code follows.
// Now, I want to do the following

prior = (prior.transpose() * prior).pruned();


Is this the right way to do this? I am hoping that there is no dense matrix being computed along the way and that it is reasonable efficient?

Thanks for your help.

Luca
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Sparse matrix multiplication  Topic is solved

Mon Apr 14, 2014 12:14 pm
yes that's the right way. .pruned() only remove explicit zeros that may appear during the computation. The implicit zeros are never created!
mehdim
Registered Member
Posts
1
Karma
0

Re: Sparse matrix multiplication

Sat Jun 27, 2015 9:24 pm
Hi

I'm also new to Eigen and used sparse matrix multiplication with ".pruned()".
However, the result is dense! I checked and zero values are not pruned.
I have no idea in which part, I wrote wrong.

Mehdi
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Sparse matrix multiplication

Wed Jul 01, 2015 7:47 pm
How did you look at the matrix entries ? What about mat.nonZeros() ??


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]