Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-07-16 07:39:57


----- Original Message -----
From: "Martin Weiser" <weiser_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, July 16, 2002 8:32 AM
Subject: Re: [boost] Re: Re: ublas notation

> 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.

Agree.

> > 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.

Not to me, especially because matrix multiplication is matrix
multiplication in all these contexts. If you want some tricky notation
instead:

    a = b [elementwise]* c

-Dave


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