Boost logo

Boost :

From: Martin Weiser (weiser_at_[hidden])
Date: 2002-07-16 07:32:08


On Dienstag, 16. Juli 2002 03:05, Toon Knapen wrote:
> On Monday 15 July 2002 14:22, Benedikt Weber wrote:
> > I think, also operator* would help to make make expressions more
> > readable. What was the reason, it is not used?
>
> The problem lies in the meaning we associate with operator*. This could
> for instance mean a gemm operation or an element-wise multiply (as in
> matlab IIRC).

No, Matlab uses * for matrix multiplication and .* for elementwise
multiplication. The meaning of * depends on the context: Using a linear
algebra or matrix package I'd assume * means matrix multiplication,
whereas using an array package I'd assume * to mean elementwise
multiplication (what else). I've the feeling ublas is more a linear
algebra/matrix package and thus would prefer the meaning of matrix
multiplication.

> There was a suggestion to make the meaning of operator* depend on a
> namespace. This would indeed improve readability and leave all options
> open to everybody : you can configure your own namespace with the
> operators you like e.g.
>
> {
> using namespace simulate_matlab_behaviour
> a = b * c ; // element-wise multiply
> }

Well, that seems to be a sensible approach.

Martin

-- 
Dr. Martin Weiser            Zuse Institute Berlin
weiser_at_[hidden]                Scientific Computing
http://www.zib.de/weiser     Numerical Analysis and Modelling

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