
Proto : 
Subject: [proto] Precomputing common matrix products in an expression
From: Bart Janssens (bart.janssens_at_[hidden])
Date: 20120713 15:51:40
Hi guys,
I've been thinking about a feature for our DSEL, where lots of matrix
products can occur in an expression. Part of an expression might be:
nu_eff * transpose(nabla(u)) * nabla(u) + transpose(N(u) +
coeffs.tau_su*u_adv*nabla(u)) * u_adv*nabla(u)
Here, u_adv*nabla(u) is a vectormatrix product that occurs twice, so
it would be beneficial to calculate it only once. I was wondering if
it would be doable to construct a fusion map, with as keys the type of
each product occurring in an expression, and evaluate each member of
the map before evaluating the actual expression. When the expression
is evaluated, matrix products would then be looked up in the map.
Does this sound like something that's doable? I'm assuming the fold
transform can help me in the construction of the fusion map. Note also
that each matrix has a compiletime size, so any stored temporary
would need to have its type computed.
Cheers,
 Bart
Proto list run by eric at boostpro.com