|Re: [eigen] new tutorial on writing functions taking Eigen types as paramters|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] new tutorial on writing functions taking Eigen types as paramters
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 17 Aug 2010 17:08:49 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=0pXfWrPkp9sZifi1Dx75TPW76oCLe7gJLwMgl2n4r9g=; b=YmhvDpw/INfIXbnJO86ntWW3HSgxnvM4i5X9GvJF0/TretXcJW2CI+U3goP06lk41v EH+UUs8yBoEf0s0s1fde7xl9KumJ9r1L6cDtbZG3ZmnPuMaHWjL01lKBs6HWuNJZSbro hx8mfTiVE5OIhPzG+82Sry5f+K+EWSyRMi1Vg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=MuMiQIsyhKc3e4/A84+lbzihyTD6EmbVGKmMYJg6Koi3QWvBYL9YpyJ+1KQzXhoxSp IvvRHSRLry3gmleDbdXFIW+L6qZCtl5H9aMQC4jDS6/qUIsO1W8KTFbyHIl1ri6sYMkT WcVPmq5sJyvJ1WL10TP1dJadOncTd495vlhlM=
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 ???