Registered Member
|
Hi, I think I have found a bug.
This simple code will show it:
Which produces the following error:
|
Moderator
|
This is on purpose, MatrixBase is a base class for *dense* matrices, whereas asDiagonal() returns a diagonal matrix which has a special structure. If your function can properly deal with both dense and diagonal matrices, then use EigenBase (ok EigenBase is even more general...), or you need to explicitly convert the argument to a dense one: test(MatrixXd(t.asDiagonal()))
|
Registered Member
|
That seems a bit strange?
How can I then hint to the underlying expression templates that only the diagonal of the dense matrix has values, the rest are zeros? |
Moderator
|
You can use a DiagonalMatrix instead of a dense one, and if you already have a dense one then:
|
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]