Boost logo

Proto :

Subject: Re: [proto] Precomputing common matrix products in an expression
From: Bart Janssens (bart.janssens_at_[hidden])
Date: 2012-07-15 04:25:39


On Sun, Jul 15, 2012 at 8:04 AM, Mathias Gaunard
<mathias.gaunard_at_[hidden]> wrote:
> Of course Proto expressions are not safely CopyConstructible by default, so
> you'd have to be careful to make it work.
>
> This is a global approach, so you'll end up committing to memory all your
> past results. This is probably not desirable so you might prefer storing the
> map in the state instead of a singleton.

OK, thanks for the comments. It's similar to what I had in mind, but
(unless I'm missing something) all product terms in our expressions
should have a distinct type if they represent different values, so I
could get away with just using a fusion map and avoid the copying and
even the map lookup.

Given the performance hit we're currently taking due to the many
evaluations, I'll definitely try to implement this. Another
alternative would be some sort of temporary values, but that places
the burden of isolating common terms on the user and I think it would
be almost as complicated to add support for this.

The main thing I'm still concerned about is how to recurse over the
expression in a way that can handle nested products. Ideally, the
"leaf" products should be evaluated and stored in the map first, so
subsequent higher level multiply expressions that use the result can
look it up, even while the map is still being constructed.

Cheers,

-- 
Bart

Proto list run by eric at boostpro.com