Boost logo

Boost :

Subject: Re: [boost] different matrix library?
From: DE (satan66613_at_[hidden])
Date: 2009-08-19 14:48:46


i think i've figured out how to provide extesibility for back ends
consider 2 ways

1. let operations recognize supported expressions

    C = a*A*B + b*C; //C = a * prod (A, B) + b * C //from uBLAS docs

when parsing we encounter (a*A)*B and an operation yells
"i know it! i know it! that's a <some particular operation>! i can do
it!"
and then introduces compatible templates if needed and fall to back
end

2. let evaluating function decide
evaluating function recieves an expression which is an AST
then it recognizes (or not) particular patterns, introduces templates
where appropriate and fall to back end
hower this technique is better i suppose because it allows to
recognize patterns descently
consider

    C = a*A*B + b*C*D;

a pattern is recognized (<a>*<A>*<B> + <1.>*<b*C*D>)
and now we need to introduce a temporary for 'b*C*D' and a new pattern
appears (scaled product of matrices in this case)

either of cases need some templates specializations but in a slightly
different manner (i didn't think so for which is harder to implement)

-- 
Pavel

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