|Re: [eigen] in-place transpose|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] in-place transpose
- From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 29 Oct 2008 16:26:22 +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:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=dnL96j8aNRHgaHo862rwJkIRZobYXQ3/Kzn1UIOrCBc=; b=sKnH4krrU1VAN4Lb58Ml8oBj1sunJtO3ik9PgkityuFr0mHkg4dBhV+/YbRP+OE9VH 0UL33ujnN89ybqlQAEtMsbGFgY4r0M8OoYpp50GnvhlCu396nCT96up9I71AQiEz2+PL W0SOQnOheZwTEPhNKL5hTvFMhIXUXO4Jyg0so=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=WdW1wQR/vEmfxEmZeGBkG8LXFndQJb4gMWwRmfwV28AjVot5Eh4wwKSlcbVll4Eu9i VcYG2hJjBgKhZ3Onf/1IOdu4v7K/GZX/JEZTMCfXy2wGIlRhvTM3DgZ+Fgb7bhSxQRcF HY4sF5XUj9C5bPhcROEZrVDx06Ho5WV8McrXc=
On Wed, Oct 29, 2008 at 12:28 PM, <jacob@xxxxxxxxxxxxxxx> wrote:
> OK for the idea, and the name sounds good to me.
> For now, in the case of a square matrix, I think we can already do quickly
> an implementation that avoids the temporary and that will leverage whatever
> optimizations we implement for triangular matrices:
> m.template part<StrictlyUpper>()
> m.transpose().template part<StrictlyUpper>()
thanks for the trick, but it did not work right away. For the record,
I had to overload Part::swap to "swap" the nested expressions and then
update Part to use copyCoeff.
all done in rev 877452.
> Gael Guennebaud <gael.guennebaud@xxxxxxxxx> a écrit :
>> 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:
>> 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:
>> ok ? any better idea for the function name ?
> This message was sent using IMP, the Internet Messaging Program.