Re: [eigen] How to resize a partially fixed matrix |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] How to resize a partially fixed matrix
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 24 Jun 2009 20:35:36 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=DuJvbPoPiEzYULP+cNhpNzA545PZv1DGmgN/j9iglsc=; b=tUZoDepXSE8JkX8rQJchXC522vZNtml2qVb1IjSn6vud4sRYzuuYSYPqrplyO6FFqq d5pFbIc95+jgBrjBvoNuwinEKlhUSRlczS0n71qAmfrrGv9losaYNivJnwWu1IgzE77+ FH+IgyfBV24fcMhaXP9tgvpY/FFH86aS1PF/4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=FsOa+rYRsGVJe1wf9JElAT6fwZXbx1FUaZdSk/qemBxCO0gbuvn9ybufDHHPvT1bX6 oiHUSaCFASG8zQSUQMlfH99SqQ6wO0c8aHhpakoDFazZSq1y9hscEbGmtP2pSoYvBguF akAtRi8QBswi8FB66d9BwzYjDc8jOG56KZEFA=
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
>>
>