Re: [eigen] Serious conflict between Dynamic and -1 in Diagonal<> |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Serious conflict between Dynamic and -1 in Diagonal<>
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 10 Jul 2012 14:11:15 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=5dX24zE8xjsS5yH6K79LpA/E7kV815gG9GQGyGeXsHM=; b=NFnWXVUT9ncxxK+VxW6vt3S35KasfX/A2EW936rDV9uYiLIkUBJYFhKpGKiTuQZ4wq ehNBwQYYOZU8bfYj6F94B9Ny5TBPgow9VeaQk1aDgEz8XRLC7siOMmzfI0/J5srRR3O3 BNe9wDQJspiwV6N0cGJDVNQbJdPRcGUwIuiRU97SIbpXWPj0MkFOIiAXKtR3AwyW3IuG zeuMO3jU5m6P6HF7NKYh4UOdGgN0z6iS7spMpQfBi7kaD7IjK2QyQ49LGlU7uLpGGM5G Qg6oXmh4sy0iTOgLbm3ct+zAqkylaqGeJ/d02iy/wi/yF8jHYt1Z4lBLCWf53nAH3tJe VDxA==
Yes, I also though about a different encoding, but this would break
the consistency with the diagonal(int) diagonal<int>() methods. You
really want to keep:
mat.diagonal(-1);
mat.diagonal<-1>();
working. So introducing a new token seems to be less impacting
solution. Moreover, I just thought about another argument: I think
that except in Diagonal<>, Dynamic is only used to refer to a runtime
*size* (positive), while here we are talking about a runtime *index*
(positive or negative). If that's true, it's not chocking to introduce
a DynamicIndex token.
Does 'DynamicIndex' sound a good name to you?
Gael.
On Tue, Jul 10, 2012 at 12:23 PM, Helmut Jarausch
<jarausch@xxxxxxxxxxxxxxxxxxx> wrote:
> On 07/10/2012 10:34:12 AM, Gael Guennebaud wrote:
>>
>> Hi,
>>
>> as pointed out in this thread:
>>
>> http://forum.kde.org/viewtopic.php?f=74&t=106803
>>
>> there is a serious issue in the Diagonal<Expression, DiagIndex> class.
>> Recall that Diagonal<> represents an expression of the diagonal
>> (DiagIndex==0), a super-diagonal (DiagIndex>0) or a sub-diagonal
>> (DiagIndex<0).
>>
>> Of course, one can also set DiagIndex to Dynamic to pick a given
>> super/sub diagonal at runtime. The problem is that since Dynamic==-1,
>> we cannot distinguish between the first sub-diagonal (DiagIndex==-1)
>> and a runtime selected diagonal.
>>
>> Since changing the value of Dynamic is not an option, I propose to add
>> a special enum for this use case, like RuntimeDiagIndex or
>> DynamicDiagIndex that would be set to a very big value.
>>
>> Opinion? better solution?
>>
>
> For readability I'd prefer something like
> Diagonal<Expression, Offset(-1)>
>
> or
>
> Diagonal<Expression, Offset<-1> >
>
> Helmut.
>
>