Re: [eigen] new tutorial on writing functions taking Eigen types as paramters

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


On Tue, Aug 17, 2010 at 3:26 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> Note that since the only values that will ever be used are 1,2,Dynamic, we
> could also make typedefs for them, so that in 99.9% of cases one wouldn't
> need the template keyword.

good point. Moreover, with the current cost model, it is enough to
expose only the cases where N==1 and N==Dynamic. Even for the simplest
expression 2*m, if N=2, then it gets evaluated.

Of course, to be future proof it would still make sense to expose the
N=2 case but others are really useless, so what about defining only
the following three types (without the generic template one):

typedef typename ei_nested<Derived,1>::type            Nested;
typedef typename ei_nested<Derived,2>::type            NestedForTwoAccess;
typedef typename ei_nested<Derived,Dynamic>::type NestedForMultipleAccess;


alternative names: NestedOnce, NestedTwice, NestedManyTimes ???

gael



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