Re: [eigen] FFT update

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


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
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>>
>
>
>



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