Re: [eigen] Feature request - Prevent dynamic resizing of a matrix

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


Ok thanks!

On Wed, Jan 28, 2009 at 8:45 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> It's added in trunk now (won't make it into 2.0).
>
> Commit msg:
> add EIGEN_NO_AUTOMATIC_RESIZING
> if defined, already initialized matrices won't be automatically
> resized in assignments
> uninitialized matrices may still be initialized
>
> Cheers,
> Benoit
>
> 2009/1/28 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
>> 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
>>>
>>>
>>>
>>
>
>
>



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