Re: [eigen] How to resize a partially fixed matrix

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


Also I need to check if it's legal to overload a function with respect
to different enum types!
If yes we can define NoChange as a non-anonymous enum and get rid of
the (), making it work as you initially described.

Benoit

2009/6/24 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
> rrrrooooh but I'm good today:
>
> we could have NoChange of a separate type so that passing NoChange as
> parameter would select at compile time a different overload. Like
> this:
>
> struct NoChange {};
>
> void resize(NoChange, int size)
> {
>    // resize, changing only number of cols
> }
>
> void resize(int size, NoChange)
> {
>    // resize, changing only number of rows
> }
>
> use it like this:
>
> matrix.resize(NoChange(), size);
>
> Like it ??
>
> Benoit
>
> 2009/6/24 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
>> 2009/6/24 Robert Bocquier <robert.bocquier@xxxxxxxxxxx>:
>>> How about a new escape constant "NoChange" (or whatever name fits), use that
>>> way :
>>>
>>> A.resize(NoChange, 7);
>>
>> That would require more runtime if's in resize(), hence a constant
>> overhead, so i'm a bit reluctant.
>>
>> roooh but while writing this i had an idea:
>>
>> how about separate resizeHoriz(int) and resizeVert() functions ???
>> It seems to me that this adresses the original request and yours simultaneously!
>>
>> In fact this is a just modification of your idea:
>> NoChange as parameter ---> NoChange as template parameter ----> separate methods
>>
>> What do you think?
>> Also for the names I don't know... initially i thought resizeRows(int)
>> but that is ambiguous, it could mean either "change the number of
>> rows" or "resize the rows"... other possibility:
>> setRows()   // goes well with the accessor method rows()
>>
>> Opinions?
>>
>> Benoit
>>
>



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