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:30:28 +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=aBeCl+Rw8RQbjOqURRtT3a4SsLjHNpRjVKDqyJCnAyk=; b=ItmtFU8zzH4ypYvVIjh3zDhLUse4Sa/6ViiYtLosYIwUENM5zH67UWvYfx0/O3Hacj 0qqhMqx7W8xIhw1DodZHV1uhhdXyd4V05KKbXyYMgekqadO8LHndf+Hne67S3vxPVtMA guj31CIN7tpKWIZIO2f2j3YMu6orbXYsHbGB8=
- 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=ARoetmLiTHu1oT62XOPYwbahy8aKcWtCMJUZxeU2H9keG8uozs4HLuF2juZ0G6BakS cJJyFCE2QpWcmgeJpZLuBon6pEFy4PsIZyrrUw9Wv+yIOLL0WCcrc+XPcS/9rPsbGT71 f7i75l2wAGecMr8sWO4tIdqlZmtzPkJFKRe0w=
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
>