[eigen] in-place transpose

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


Hi all,

even though the transposition in eigen is in most cases a free
operation, sometime we really want to transpose the elements of a
matrix. In that case we have to carefully write:

m.set(m.transpose().eval());

and if the matrix is square, we can also do:

m = m.transpose().eval();

So the first remark is that I'm pretty sure that most people will
forget to add the .eval() leading to hard to find bugs.  Secondly this
is quite inefficient because it generates a useless copy to a
temporary. So what about adding a "transposeInPlace()" function ?
Currently we can simply define it using a temporary and optimize it
later with tricky algorithms for rectangular matrices:
http://en.wikipedia.org/wiki/In-place_matrix_transposition.

ok ? any better idea for the function name ?


gael.

---


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