Registered Member
|
I have an Eigen square matrix defined as follows:
Now, I want to compute the square of the matrix. In Matlab speak this could be done with
In Eigen, I guess I can do something like:
My question is whether this is the preferred way to do it and more importantly, would the resulting matrix also be sparse and if the full dense matrix is stored somewhere along the way? Many thanks, Luca |
Moderator
|
Yes, doing SpMat squared = m * m; is the best way. The result will still be sparse (usually a bit less) and of course the sparsity of m will be exploited. No dense matrix will be created along the way.
|
Registered Member
|
Thank you so much. I was using pruned() but it seemed that was really making it worst.
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]