Boost logo

Boost :

From: Markus Werle (numerical.simulation_at_[hidden])
Date: 2003-11-25 06:02:10


Hi!

This is a question to those of you who have written and used
Expression Templates within their own libs.
I need some premature feedback during the redesign phase of Daixtrose.
I consider some early design decisions debatable.

Daixtrose can represent two Operations, a binary operation
(binop) and an unary operation (unop), which both
have compile-time parameters describing their
detailed nature, like
binop<BinaryPlus, LHS, RHS>

This means, any expression within Daixtrose
has a tree structure with a maximum of 2 branches.
E.g. the information is somewhat redundant: binop<BinaryPlus, ...
states the nature as binary operator twice.
Also isn't an unop a binop with a dead branch?

Actually I was thinking about a generalized
representation, which allows for an arbitrary number
of arguments (though more than 2 are out of my current scope),
something like

template <typename Op, typename Args> struct op;

where Args is a mpl::typelist, tuple or similar structure.
Drawback:
This introduces one extra nesting level per node for the
template representing a normal expressions like a + b + c + d.
This may be a serious disadvantage, but OTOH a canonical
representation of any operation would allow easy introduction
for optimized extra features like reordering
op<SumOverAll, cons<Matrix, Matrix, Matrix, Matrix> >
instead of
op<BinaryPlus, cons<Matrix, op<BinaryPlus, Matrix, etc...

you get the point?

I think that this new representation may also allow
an easier reuse of boost::mpl features (like
mpl::transform<List, Simplify>), which is my
primary goal during the redesign phase.

Please comment and tell me what you think,

best regards,

Markus

-- 
Build your own Expression Template Library with Daixtrose!
Visit http://daixtrose.sourceforge.net/ 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk