[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] FFT update
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sat, 23 Jan 2010 14:34:40 -0500
- 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=a4ECYuwSP25dxqN+BOXV/owsp0rtiVgxWt3aOJusPkE=; b=PY1dCZUcWXfmG85VEi6LeuThDY5WSLRZ3Ac9b//JoITceYGUIW55l033spA8kSVUD8 y+L704Ic9Fs9E+uVdFP47my0VYtoPdDio4QkW2+KIJtg6tKxfcUXufQ+HbV/jcBn/GSb IgBWSR0vfJmNqYr9yzEjcM3pLGr2pT2j78mdc=
- 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=BkkL0a+cji63rH+XDbbcZGKAWTFUuF9w7Ke+1FOCcrEu7UVQ6EUMf5MKg1LQQFr4Sq Fcx72ffXcmNAxq/uPz71fXy113C530RyaozXx1otMIz+eEg4QOGUPZIY3FVGxRqreX/s u8v85iVntEHoSApwcTrQQCAMlV0U9VeYMv5p8=
2010/1/23 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> Hi Benoit,
>
> what I just did recently is this:
>
> template<typename Derived> struct rotate_retval
> : public ReturnByValue<rotate_retval<Derived> >
> {
> rotate_retval(const DenseBase<Derived>& src) : m_src(src) {}
> private:
> const DenseBase<Derived>& m_src;
> }
>
> So, I am not storing Derived but a reference to DenseBase<Derived>
> (might be ArrayBase<Derived> or MatrixBase<Derived>, depending on the
> application).
Why not!
>
> Another thing which is really important (just telling it, since I did
> it wrong and also lost like 30 minutes). Never return a ReturnByValue
> object, but something being derived from it. Otherwise, you derived
> class with all the data gets sliced away when just the base class is
> copied - that was a really stupid idea of mine.
Indeed, that is an important rule.
>
> Finally, evalTo(Dest&) does not necessarily require a .resize() - if I
> am not totally mistaken, this is already taken care of by the caller.
Oh right! This is actually the reason by the rotate_retval class must
provide rows() and cols() methods.
Benoit
>
> Regards,
> Hauke
>
> On Sat, Jan 23, 2010 at 7:29 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>> By the way, this "ReturnByValue::coeff() crashes by infinite
>> recursion" thing is really ugly, I wonder how to fix it!!
>>
>> C++0x at last brings the ability to remove a base class function from
>> a derived class... I wonder how to implement that idea in C++98. Is
>> that enable_if?
>>
>> Benoit
>>
>> 2010/1/23 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
>>> Hi,
>>>
>>> Here's an example: see attached file.
>>> Enjoy!!
>>> Benoit
>>>
>>> 2010/1/22 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
>>>> ok let me write an example...
>>>>
>>>> 2010/1/22 Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx>:
>>>>> On Fri, 22 Jan 2010, Benoit Jacob wrote:
>>>>>
>>>>>> Our "policy" is now:
>>>>>> - try to return by value, optimizing with the ReturnByValue class,
>>>>>> wherever possible;
>>>>>> - otherwise you can just use references.
>>>>>
>>>>> Can somebody please explain how to use the ReturnByValue class?
>>>>> Or should I just extrapolate from the source code?
>>>>> I could not find any documentation.
>>>>>
>>>>> Jitse
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>>
>
>
>