
Boost : 
From: jhrwalter (walter_at_[hidden])
Date: 20020118 17:42:04
 In boost_at_y..., Toon Knapen <toon.knapen_at_s...> wrote:
> jhrwalter wrote:
>
> >  In boost_at_y..., Toon Knapen <toon.knapen_at_s...> wrote:
> >
> >>I noticed that in ublas 'a = 2 * b' works but 'a = b * 2' does
> >>
> > not ?!
> >
> > Meanwhile we've found two reasons for this restriction. First, as
far
> > as I know multiplication with a scalar is mathematically always
> > defined as left multiplication for vectors and matrices.
>
>
> theoretically scalarmatrix multiplication is commutative and thus
a * M
> == M * a.
Hm. I'm not sure, if the rhs is defined at all.
> > Next,
> > multiplication is left associative in C++ (as Mathias told me ;
), so
> > if we compare a = 2 * 2 * b to a = 2 * b * 2, the former is
always
> > guaranteed to need fewer operations.
>
>
> I can understand your implementation issues
I believe, this is more an interface than an implementation issue.
> and it's good to know now
> that Matrix * scalar can not be done but one needs to do scalar *
matrix
> instead. I just took me fifteen minutes to find out and maybe it's
a
> good idea to put it in the docs.
Certainly. Sorry for the inconvenience.
> e.g. in the mean time again I had the same trouble with division, I
> tried M /a but to make it compile I redefined it as (1/a) * M : one
just
> needs to know.
Division is another topic. We once discussed to introduce such a
division operator for accuracy reasons, although it's usually not
defined mathematically, too.
> Although I think in the long term, all mathematical correct
expressions
> should be supported but it is not highest priority.
Regards
Joerg
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk