Can we fix reverse operator overloading (opSub_r et. al.)?
Daniel Keep
daniel.keep.lists at gmail.com
Mon Jul 13 00:50:58 PDT 2009
Lars T. Kyllingstad wrote:
> Robert Jacques wrote:
>> On Fri, 10 Jul 2009 06:24:04 -0400, Lars T. Kyllingstad
>> <public at kyllingen.nospamnet> wrote:
>>> There are actually three (four) basic types of vector/matrix
>>> multiplication, and the * operator would more or less be fitting for
>>> any of them:
>>> - element-by-element multiplication, which is what * means now
>>> - dot product
>>> - matrix multiplication
>>> (- cross product )
>>
>> Actually, matrix multiplication and the dot product are both cases of
>> the inner product and the cross product is specific to 3D vectors.
>
>
> Actually, the dot product is both a special case of matrix
> multiplication and an inner product. Matrix multiplication in general is
> not an inner product, since an inner product always associates two
> vectors with a scalar.
>
> That aside, my point was simply that there are several operations for
> which one may want to use the '*' operator, and there is only one '*'. :)
>
> -Lars
You could always convert to using downscode:
a /inner/ b
a /dot/ b
a /cross/ b
As evil as it is... there's something strangely alluring about being
able to define your own infix operators...
More information about the Digitalmars-d
mailing list