[eigen] in-place transpose |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] in-place transpose
- From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 29 Oct 2008 03:00:34 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=lUp6u76asRv05Q1ZkRn2cEHc2HWAfwAScMBG9hRXy3A=; b=ICBkF25I1bAxdSXbqaZz2zWLrFBUU4QgZkLmm/rMkhf3eVxHYzbJEE/xNmbiBYL9sM X3tQSLCxjaI7p8+je0UMIIaSkMtAN+T28KTizAcM/YbSxCWMjwwn3holsSTYZ+aiPUwc HFW/eMysiiKRFYyR7YEG6rVe1pp7ubwR/IABk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=kLrsqBHilwgkjqaPPnaWc+ASuIY+pYnbbp3Kh5t4JriSs23TGL1xsCFhBzGitUszge reFKKjYXNAdtQTAE6nCJsnI9oYFc46lUX+HcfSZ/L3xEZ4Nzxuc/lEqOozylEZJoX8T7 T3lrOCnL87A6bHt6ORBsclTUU4Pk2wc1VOnKU=
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.
---