[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] nesting
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sun, 7 Feb 2010 21:50:24 -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=s4B7w7aSt1MmzWSma/fWecELWiJ8efobywy1s+/XNi4=; b=Ur44HpXeVeEIDZNNgWd7iKxUrAU/LWcy5YpBDUTvC1Gv824eYbn0bAnmuzV+MklXtF h2jQ8Mtz8SrjN9kqSkgTNgP92Bm6TMhXkszkgfbfQMjDoRRSSC443kUgUSDIKXQ0uamP LAd+vSdFV+546cVx3OjfEsrjUosV0f+gu9ZhI=
- 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=dNJRBlaP+bkX4zQTqYXVYt5wl3oJrHv5c9fvOL0yccTmedYp7+0fSruXokyBNt1p5j KNTddjVGg4JfRpNK3OqUQQOM1F/ZwCdhWKBP9OpVQp+acOyCKSSBU1hlvjNByKVTdRpm WpjKTJnBn1bPoTwppEcK8LyEEW8f1d+jE6rxw=
To summarize the little conversation that happened over irc:
1) Hauke: a very good reason why we want to evaluate intermediate
temporaries also in the fixed-size case, as mentioned by Gael, is when
the cost-model tells us that this reduces the complexity of the
operation. For example, evaluating b+c in "a*(b+c)".
2) On the other hand the idea of an "expression evaluator" seems
really doable (albeit complex) following this strategy:
a) At the time of the construction of the expression, we gather the
information of where temporaries must be introduced when evaluating
that expression. That could be a new typedef in ei_traits.
b) when evaluating an expression, we instantiate an object of a
template "Evaluator" type that uses that information to hold the
necessary temporary matrices as member data. We then traverse the
expression tree, evaluating the designated sub-expressions into these
I'm not saying that I'm finding this _easy_!! This has got to be the
most complicated templates exercise that we've had to solve. But it
can be done for sure, as templates allow to do everything. To think
about that, I'm finding it convenient to think purely in terms of
pseudo code, and translate this into templates at the last minute.
Templates are not human-readable code :(
2010/2/7 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> On Sun, Feb 7, 2010 at 4:51 PM, Gael Guennebaud
> <gael.guennebaud@xxxxxxxxx> wrote:
>>> Currently, I am also a little bit confused about the following code
>>> (from the forum):
>>> double p = (P.transpose * P).diagonal().sum();
>> in the devel branch Product::diagonal is overloaded to handle that case
>> without the need of an explicit lazy.
> Though it is crashing over here. I have to investigate but I think it
> is the same reason as before, a deleted temporary.