Re: [eigen] Way to obtain AdjointReturnType? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Way to obtain AdjointReturnType?
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Mon, 7 Sep 2009 08:23:20 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=hvHHUK2/a4LE9S+DjBAceS6Op5FWFkf6uXuDpSB20hI=; b=sFsktdC7JrVfG3aS+6sZfx4tsQf25N+pCAUILozEDOq9E6CX3j9P/OQhPNkholS7pL tdzbYzH+XAvjauYlDwE1CnbZsnvYPrc05jLAN8F4wANcMWzauN6JU8XogSMkrbqB1nu1 JVpXG/cEqvTJoIpve8hqpoCrQH4qxa9VUXhpo=
- 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=CXy16wCplXSMxSoAL1HZFuP5sjRzvdXwfr1u/KN2QDV0HtzZzBsLdiI3sSjlqRPtfk ThpB7UWmsRiLQqduzCVxXUBonSRelAMdPrN4rvcsP7EQZ5H8lJVb3uZ50yJG5/MoS4vo reXxBMFJnd+SbCA55MnbdUrQ1xp25IbvzYX6k=
hi,
On Sun, Sep 6, 2009 at 9:53 PM, Rhys Ulerich<rhys.ulerich@xxxxxxxxx> wrote:
> I've got a templated function with a signature like
> ReturnType foo(AnEigenMatrixType bar)
> where AnEigenMatrixType can be an instantiation of Eigen::Matrix<...>. I'd
> like ReturnType to be AnEigenMatrixType with its SelfAdjointBit set because
> I know the computation in foo() guarentees me a self-adjoint result.
I guess you are using the 2.0 branch then you probably want to return a:
Flagged<AnEigenMatrixType,SelfAdjointBit,0>
or
Part<AnEigenMatrixType,SelfAdjoint | UpperTriangular> // or: | LowerTriangular
according to want you want to achieve. Basically the former as no
effect in Eigen while the other tells only the upper or lower
triangular part is meaningful.
However the support for selfadjoint matrices in the 2.0 branch is not
very good, and in the devel branch the self adjoint bit flag, .part()
and Flagged are now deprecated in favor of a SelfAdjointView wrapper
class. Then your return type would be:
SelfAdjointView<AnEigenMatrixType,UpperTriangular> // or: | LowerTriangular
if you want more information please be more specific about your use case.
cheers,
gael.
> I noticed that MatrixBase<Derived> has AdjointReturnType used in adjoint(),
> but my attempts like Eigen::MatrixBase<Eigen::Matrix<Scalar,3,1>
>>::AdjointReturnType haven't worked (public-vs-private, but it could be me
> being dumb with templates). Functionality like part<Eigen::SelfAdjoint>
> doesn't quite do what I'd like because I want to propagate the
> self-adjointedness of ReturnType back out to other routines.
>
> What am I missing?
>
> Thanks,
> Rhys
>
>
>
--
Gaël Guennebaud
Iparla - INRIA Bordeaux
(+33)5 40 00 37 95