Re: [eigen] Setting diagonal of a sparse matrix

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Dear Brad,

while I'm not an expert on sparse Eigen,
the documentation clearly says <https://eigen.tuxfamily.org/dox-devel/classEigen_1_1SparseMatrix.html#ae928a8d31634ba1d62a3446772aae974>

	Warning
    	If the diagonal entries are written, then all diagonal entries must already exist, otherwise an assertion will be raised.


Putting a S.setIdentity() before assigning solves the problem.
Whether there is a better way, I don't know.


Best regards,
Peter




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/