
Boost : 
From: Jeremy Siek (jsiek_at_[hidden])
Date: 20020126 12:25:09
On Fri, 25 Jan 2002, jhrwalter wrote:
>
> Sure, we could eliminate x * A and force the user to always write
> (A^t * x^t)^t instead ;). But if we would not, we could get code
> like the following for right and left multiplication with a vector:
I wasn't suggesting that you eliminate x * A. I was suggesting that you
/implement/ it by doing trans(trans(A) * trans(x)). In the MTL 3
prototype, the trans() function creates a transposed view wrapper. By
taking this implementation approach, you don't have to mess with multiple
the implementations of matrixvector multiplication that you show below.
Also, the trans() wrappers are useful in their own right.
> Right multiplication:
>
> for (i = 0; i < A.range_size (); ++ i) {
> r [i] = 0;
> for (j = 0; j < A.domain_size (); ++ j)
> r [i] += A [i] [j] * x [j];
> }
>
> Left multiplication:
>
> for (j = 0; j < A.domain_size (); ++ j) {
> r [j] = 0;
> for (i = 0; i < A.range_size (); ++ i)
> r [j] += x [i] * A [i] [j];
> }
>
Cheers,
Jeremy

Jeremy Siek http://www.osl.iu.edu/~jsiek/
Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
C++ Booster (http://www.boost.org) office phone: (812) 8553608

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