Re: [eigen] Serious conflict between Dynamic and -1 in Diagonal<>

[ Thread Index | Date Index | More Archives ]

On 07/10/2012 10:34:12 AM, Gael Guennebaud wrote:

as pointed out in this thread:

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

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)>


Diagonal<Expression, Offset<-1> >


Mail converted by MHonArc 2.6.19+