Registered Member
|
Hello,
I don't understand the use of the function .eval() in the case of both dense and sparse matrix. Is it use to avoid aliasing? When must I use it and when is it not required? Thanks |
Moderator
|
eval() permits to explicitly introduce a temporary in an expression. It's extremely rare to have to use it. With dense matrices, you can use to deal with an aliasing issues. Sometime it's also needed to send the result of an expression to a function expecting a raw pointer to the data, e.g. with OpenGL:
glVertex4fv((a+b).eval().data()); |
Registered Member
|
it is still not so clear to me.
I wrote this functions for summing sparse matrices:
and
in the first case I use .eval() while it is not required in the secondo case. Are they both correct? |
Moderator
|
even in the first case, it should not be needed. What's the type returned by getKdyn() ?
|
Registered Member
|
it is SparseMatrix<complex<double> >. It is simply a summing of sparse complex matrices |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]