Re: [eigen] Feature request - Prevent dynamic resizing of a matrix |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Feature request - Prevent dynamic resizing of a matrix
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Thu, 29 Jan 2009 07:59:52 +0100
- 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=NhO7iPnzixh44M/fdQX+/AR2pLYTKvipmuKmHqnpASE=; b=QsOMjsktIK2gP5S0b5NJCTJtqiK9NHsRsIJiDQnlkQY76644cDcLauSC4mge8LP0vy HR+wbJZ8r4Bh4zqkIYDY2KwmFhMGeG4VmSZkfsiV3zxH5+pGjKb/4EgmY0dIJSatQB9B T8g/UtAS/ceEautRFz9HluyqX79CF5UgOlnxY=
- 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=kQMnqxRZC+BrpjsZksSiZ9u66zA1aedmkRXYZX7iQi5/c1yeaQ56XwzxwotbNfbPed KE5PDhpjbPmpAV4MqrV44RacP5fZbNXQu82hlFOcGvkQNNy8xvq7wUTPffxlzbN9jYo8 qW3vc5ekqRgObJXWhn9Om5Aly3oRlwa6NPQso=
if we really want to be able to locally choose between the 2 behavior
(that is not possible with the #define, and only partly possible with
the Flag), then I would rather suggest to do:
mat.strict() = <expression>;
or
mat.roresize() = <expression>;
or whatever other name. Votes are open!
As said Benoit, adding a new matrix flag unnecessarily create new
types with all the bad consequences (compilation overhead, object code
size, etc.), and that for what ? only to slightly change the behavior
of a single function ! no way !
Gael
On Thu, Jan 29, 2009 at 1:10 AM, Schleimer, Ben <bensch128@xxxxxxxxx> wrote:
> The template flag seems very reasonable... IMHO
>
>
>
>
> --- On Wed, 1/28/09, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>
>> From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
>> Subject: Re: [eigen] Feature request - Prevent dynamic resizing of a matrix
>> To: eigen@xxxxxxxxxxxxxxxxxxx
>> Date: Wednesday, January 28, 2009, 6:45 AM
>> OK, this has been a tough decision. Let's recall the
>> arguments on both sides.
>> In favor of automatic resizing:
>> 1) This is more practical for the majority
>> 2) This is the usual behavior of objects in C++ and in the
>> C++ STL
>> 3) Because this is what STL containers assume, it's
>> almost required in
>> order to allow convenient usage of STL containers with
>> Eigen types
>> Against automatic resizing:
>> 1) Exactly what you say. Indeed automatic resizing can hide
>> nasty bugs.
>>
>> So the default behavior will stay as it is right now, but
>> what you
>> propose, with a #define, sounds like a good solution to me.
>> I
>> implement it now. I'd rather call it
>> EIGEN_NO_AUTOMATIC_RESIZING
>> because i think we still want to allow explicitly calling
>> resize().
>>
>> Notice that one could also consider implementing this
>> behavior as a
>> matrix type option. So you would do
>> typedef Eigen::Matrix<float, Eigen::Dynamic,
>> Eigen::Dynamic,
>> Eigen::NonResizable> MyMat;
>> and then objects of type MyMat have this behavior. Stuff to
>> consider for 2.1...
>>
>> Cheers,
>> Benoit
>>
>> 2009/1/28 Timothy Hunter <tjhunter@xxxxxxxxxxxx>:
>> > Hello all,
>> > I has been decided that the operator=(A,B) would
>> resize A if it does
>> > not fit the size of B, right?
>> > I had a bug in my code I had problems to detect
>> because of this
>> > feature. It would be nice to have an assert that fails
>> if the matrices
>> > are of different size, and let the user decide to use
>> this assert with
>> > some flag definitions like
>> EIGEN_DO_NOT_RESIZE_DYNAMIC_MATRICES.
>> > Is it possible to do it with the current code?
>> >
>> > -- Timothy Hunter
>> >
>> >
>> >
>
>
>