Re: [eigen] Way to obtain AdjointReturnType?

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


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



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