Re: [eigen] part<SelfAdjoint> in Eigen3 |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] part<SelfAdjoint> in Eigen3
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 29 Jul 2010 09:07:45 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=SaaHScF8ZVT0H3UeGEBy701XN4Cw71Qyoe7nQ4Q5CUc=; b=sQ9qCt/OBbXA+11zcbjUvdp9XiSbu5e9b+duUMKYBM+4fkwKBgacVjVmBKMiCMMGB9 1asYOykpo/GsRKFTiecgtDIKrf2f9MpT1TQM5O1ohDLKlYgHlFG+povZuccrw2uHqkpJ c6THXKch7WfvbxJOSRxplMCo5avVN3fY3n2ps=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=MO79ihBaVmFL11PtTOrrPbEnUMo9+R2TeTsnLTmFuUogK/0lb2bPmCs6a49jk7XwFR B4f/S9hI5UPGJGb36jzMvVqIf0qJXr5TXyaLHnaf8LN2Fr9s3qL4dj+ygNfcNCUQxY2m hgvJbFOef+Kxqc90YxtOFPeofa3QYm8f/iwMA=
2010/7/29 ESCANDE Adrien 222264 <adrien.escande@xxxxxx>:
> Hello,
>
>
>
> Eigen2 documentation mentions the way to obtain an optimized computation for
> an expression evaluating to a selfadjoint matrix:
>
> n.part<SelfAdjoint>() = m+m.adjoint ; (1)
>
> n.part<SelfAdjoint>() = (m*m.adjoint()).lazy(); (2)
>
>
>
> I didn’t find the way to have that in Eigen3 (MatrixBase>Derived>::part is
> still there but flagged as deprecated). The Porting from Eigen2 to Eigen3
> page does not mention this case (it gives only the translation for
> part<SelfAdjoint|Upper> and part<SelfAdjoint|Lower>). Is there a new direct
> way to perform such computations?
The new method is selfadjointView().
n.selfadjointView<Lower>()
n.selfadjointView<Upper>()
>
> And what would be the best way to write (2) when m itself is selfadjoint?
>
Gael would know better, but I think that your best bet is rankUpdate() here..
n.setZero();
n.selfadjointView<Upper>().rankUpdate(m);
I can't see any way to do that using arithmetic operators, but that
seems OK as indeed the API for doing that should only take one operand
m.
What I am a bit more puzzled about is that this API forces the user to
pass Upper... I need an explanation as to why this is useful ?
Maybe it would be useful to add a productByAdjoint(), perhaps
abbreviated as .xxt(), method in MatrixBase so the user could do:
n = m.productByAdjoint();
?
Benoit
>
>
> Adrien
>
>
>
>