This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 611 - Multiplying sparse matrix with vector as diagonal matrix from the left
Multiplying sparse matrix with vector as diagonal matrix from the left
 Status: RESOLVED FIXED None Eigen Unclassified Sparse (show other bugs) 3.2 All All Normal Unknown Nobody 3.2 Show dependency tree / graph

 Reported: 2013-06-11 10:34 UTC by Sabrina 2019-12-04 12:22 UTC (History) 3 users (show) brix chtz gael.guennebaud

Attachments
Test for multiplying a vector as diagonal with a sparse matrix. (190 bytes, text/x-c++src)
2013-06-11 10:34 UTC, Sabrina
no flags Details

 Sabrina 2013-06-11 10:34:09 UTC ```Created attachment 344 [details] Test for multiplying a vector as diagonal with a sparse matrix. Dear Eigen developers, when trying to multiply a vector as diagonal matrix with a sparse matrix from the left the code does not compile, while multiplying it from the right works. The same code works when a dense matrix is considered.``` Gael Guennebaud 2013-06-28 16:23:07 UTC ```Works with a DiagonalMatrix: DiagonalMatrix(d.asDiagonal()) * A I'm investigating why it doesn't with a DiagonalWrapper.``` Gael Guennebaud 2013-06-28 17:11:26 UTC ```https://bitbucket.org/eigen/eigen/commits/2b1e3e6f9e2b/ Changeset: 2b1e3e6f9e2b User: ggael Date: 2013-06-28 17:10:53 Summary: Fix bug 611: fix const qualifier in cwiseProduct(sparse,dense) and SparseDiagonalProduct::InnerIterator``` Kolja Brix 2013-07-01 09:16:14 UTC ```Dear Gael, thank you for your patch! I can confirm that both SparseMatrix A2=DiagonalMatrix(d.asDiagonal()) * A; and the short version SparseMatrix A2=d.asDiagonal()*A; are working now. Unfortunately, this does not yet fix the problem, because SparseMatrix A3=d.asDiagonal()*A*d.asDiagonal(); and SparseMatrix A3=DiagonalMatrix(d.asDiagonal()) * A * DiagonalMatrix(d.asDiagonal()); still do not compile. The error message in both cases is Eigen/src/SparseCore/SparseCwiseUnaryOp.h:30:62: error: no type named 'ReverseInnerIterator' in 'Eigen::CwiseUnaryOpImpl, const Eigen::SparseDiagonalProduct, Eigen::SparseMatrix >, Eigen::Sparse>::_MatrixTypeNested {aka const class Eigen::SparseDiagonalProduct, Eigen::SparseMatrix >}' Could you please have a look at the problem again? Thank you in advance!``` Christoph Hertzberg 2013-07-01 14:08:43 UTC ```re-opened because original bug still exists. (Inefficient) work-around is to add an (...).eval() around one of the products.``` Gael Guennebaud 2013-07-01 14:37:46 UTC `Another workaround: A.cwiseProduct(d*d.transpose())` Gael Guennebaud 2013-07-05 23:23:55 UTC ```https://bitbucket.org/eigen/eigen/commits/742a401329e6/ Changeset: 742a401329e6 User: ggael Date: 2013-07-05 22:42:46 Summary: Fix bug 611: diag * sparse * diag``` Nobody 2019-12-04 12:22:42 UTC ```-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/611.```

 Note You need to log in before you can comment on or make changes to this bug.