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

Dense * Sparse SelfAdjoint bug

Tags: None
(comma "," separated)
xerion
Registered Member
Posts
20
Karma
0

Dense * Sparse SelfAdjoint bug

Thu Apr 20, 2017 5:43 pm
I would have expected this to work but it does not seem to.
Is there something wrong with the code below ?

Code: Select all
         // init stuff
         Eigen::MatrixXd sym_dense = Eigen::MatrixXd::Constant(3, 3, 0.0);
         sym_dense.triangularView<Eigen::Lower>() = Eigen::MatrixXd::Constant(3, 3, 3.0);

         Eigen::SparseMatrix<double> sym = sym_dense.sparseView();
         Eigen::MatrixXd other = Eigen::MatrixXd::Constant(3, 3, 1.0); // just for simplicity
         
         // not calculated correctly
         Eigen::MatrixXd res_from_sparse = other * sym.selfadjointView<Eigen::Lower>();
         // I would have expected to be equal to this one
         Eigen::MatrixXd res_dense = other * sym_dense.selfadjointView<Eigen::Lower>();


It seems that res_sparse is set to sym.selfadjointView<Eigen::Lower>().

Also while I am at it, even though I dont want to do this, the assignment below makes the sparse matrix have 0 elements.
sym = sym.selfadjointView<Eigen::Lower>();
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Dense * Sparse SelfAdjoint bug

Tue Apr 25, 2017 12:03 pm
Thank you for spotting this issue. This path (the dense matrix of the left-hand-side was not covered, and gcov did not spotted the issue: http://manao.inria.fr/CDash/viewCoverag ... eid=499456, line 371).

Anyway, that's fixed now: https://bitbucket.org/eigen/eigen/commits/2b969e50885e/ and backported to the 3.3 branch.


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]