Registered Member
|
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:
I don't understand if the code is ok and how eigen can understand that M is only upper stored. |
Moderator
|
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 >(); |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]