Re: [eigen] Qt's container support |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Qt's container support
- From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 20 Jan 2009 17:42:51 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=3x8mO9JtRCQT8eZ11e+0Nl22nzsX6abUqlclZ3YKV30=; b=CqfUAvSx3HMeI37djcUVdW7BqyZE6K4otegWtCKVV2iGoSdaeZwvySXITESd5W9xJC pGi9PcPOyE+WwDRdHWlSg7hp3M00N2ukNu3bEDEMAihWEe7FDOeBKVYVuGFXyrbD1Sg9 iPQsLzPX21FSO2mT0elqCyNxfjR9UXMt0BOoU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=YJlprhxcxUUBAGl+5jqmZ/nshR2Iiaodmw+PioqGEh5Ih4XmXHaCf1hWLn/vLJv2U4 rwOZsDTqSGf2lxPrt43hIMq7z/CWSOrLQr6X3asc26cOK880NIb/6PeeZ0RGyCnvh1Dy LGxUR++21ZTig9eLaFL5Dq1DmPZtkkjMTzARE=
independently of the QVector::fill() issue I'm in favor to allow
operator= to resize an uninitialized matrix. I'm pretty sure the
unique argument was this if()....
To make it clear to everyone, after this change you 'll be able to do:
MatrixXf a;
a = MatrixXf::Random(100,100); // will be ok
but not the following:
MatrixXf a;
a = MatrixXf::Random(100,100); // will still be OK
a = MatrixXf::Random(50,50); // NOT OK => use .set()
Gael.
On Tue, Jan 20, 2009 at 5:09 PM, Keir Mierle <mierle@xxxxxxxxx> wrote:
> On Tue, Jan 20, 2009 at 8:03 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>> 2009/1/20 Keir Mierle <mierle@xxxxxxxxx>:
>>> What is wrong with (a)? I'd like to have this anyway.
>>
>> In my understanding the main problem with (a) was that it would
>> require operator= to start with an if() to check if the matrix is
>> already initialized (so runtime overhead).
>>
>> Perhaps this argument isn't convincing: dynamic-size matrices involve
>> runtime branching anyway eveytime you have to loop over their
>> coefficients, so this if() is going to be negligible.
>
> Exactly. Also, I believe that in some cases GCC can prove that a
> matrix is uninitialized even for dynamic sized matrices and skip the
> if, provided operator= is inlined. This will require some
> investigation, but my understanding is that the scalar promotion of
> aggregates optimization phase will expose this (scalar promotion of
> aggregates breaks structures up into individual basic types, exposing
> many optimization opportunities).
>
>> It's true that this aspect of our API is one of the things that's
>> causing the most trouble to users. I'm open to reconsidering it. But
>> first: is there another reason for the current behavior that i
>> forgot...?
>>
>> Benoit
>>
>>
>>
>
>
>