[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] FFT update
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Sat, 23 Jan 2010 11:45:53 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=biwlPdnEzemonZhvp8YzMQgA3ah8H//ulR58IPQ5D/c=; b=x8RvZ4YZ4v0mZU5wCXlMvG/uGEXDZhtGZ9lEdBpFM6MeHBUmSj84ivq5jiL466gnl3 scF4avNM7m24Wsv2SC38G6DHmnCM17QtXoCgo6LYJ+hAneFxWfrYG3r1ApmjK+PuViTF KVV4h9P+oxt1/lrjM8z1u4sZDmaStAEbe8YMM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=noHOCdaK1qqUQZgQEmYyIvqGEg9ZjZ+Cr9fozdXwSoipK3rKS/byWOePvDm0KWu9LU oLWsOnJ6Oi/iy9BDLlFVPCOj5nmre6zgM5+7+sWHVg90oF95Sclb7yOJGk9Liun8Aque 2pyxRF1jhb3yRmkXWCAeQT/20zHj6pj7AHplQ=
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).
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.
Finally, evalTo(Dest&) does not necessarily require a .resize() - if I
am not totally mistaken, this is already taken care of by the caller.
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
>>>>
>>>>
>>>>
>>>
>>
>
>
>