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

Symmetric -non sym complex sparse matrix product

Tags: None
(comma "," separated)
Akkawe
Registered Member
Posts
35
Karma
0
OS
Hi,
I have a sparse matrix: SparseMatrix<complex<double > > M and a SparseMatrix<complex<double > > A.
I manually stored only the upper part for the matrix M because it's symmetric whereas I store all the coefficients of A.
I want to perform:
A.transpose()*M*A;
I wrote:
Code: Select all
SparseMatrix<complex<double > > Ad = A.transpose();
SparseMatrix<complex<double > >  Res = (Ad*M*A).pruned().triangularView< Eigen::Upper >();

I don't understand if the code is ok and how eigen can understand that M is only upper stored.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
No need to evaluate A.transpose(), on the other hand you have to copy M into a full sparse matrix, otherwise it not possible to efficiently perform a sparse matrix-matrix product:

SparseMatrix<complex<double > > M1 = M.selfadjointView<Upper>();

(A.transpose() * M1 * A).pruned().triangularView< Eigen::Upper >();


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]