[eigen] memory savings in Tridiagonalization::decomposeInPlace

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


Hi again,
  the change MatrixType->SquareMatrixType in SelfAdjointEigenSolver
needs Gael approval. Tridiagonal support will require both this and
the change to exclusive flags in Part.h. Since this will require some
time, in the meanwhile I went serching for other low hanging fruits.

I think that Tridiagonalization::decomposeInPlace unnecessarily
creates a new matrix instead of reusing the one it is given. Reusing
the old one reduces the space required to 2/3 for large matrices (can
be aroung 200Mb in my simple examples). I attach the patch, again
quite simple. For the sake of symmetry the matrixT() method could be
changed as well like diagonal(), subDiagonal() and matrixQ() but it is
not strictly necessary.

There is a difference in the behaviour of decomposeInPlace(...). In my
patch, if eigenvectors are not required, the given matrix is still
overwritten, instead of staying unchanged. I think it is however
preferrable to save memory in the general case. If the caller needs
the original matrix it can simply store it... after all it is an
"InPlace" method. What do you think?

Cheers and happy holydays to everyone,

mauro

Attachment: decomposeinplace.patch
Description: Binary data



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