3D Math Data structures/SIMD

Janice Caron caron800 at googlemail.com
Sat Dec 22 05:09:24 PST 2007


On 12/22/07, Lukas Pinkowski <Lukas.Pinkowski at web.de> wrote:
> Well, but why do you call the component-wise multiplication nonsense? As a
> mathematician you should know that an operator/function is exactly that,
> what you define it to be. If I define vector/vector-multiplication to be
> component-wise multiplication, then it is component-wise multiplication.

Well, yes and no. Obviously you are correct in that one can define any
function to do anything (...just as you can in any programming
language). However, whether or not it is meaningful to call such a
function "multiplication" is another matter. Elementwise
multiplication is not normally considered to be "multiplication" in
vector algebra.

Googling "vector multiplication" mostly yeilds the expected results of
dot product and cross product, although Wolfram Mathworld also lists
the "vector direct product" which yields a tensor. I couldn't find
anything, anywhere, which considers elementwise multiplication to be
valid vector multiplication. If such a usage exists, I must assume it
to be rare, or limited to some particular field of expertise (e.g. 3D
graphic programming, which you touch on next).


> It's just that 3D-programmers agreed to define vector/vector-multiplication
> (with the * operator) like this.

Ah - that would be my problem. I'm not a 3D programmer. (I /am/ three
dimension, and I /am/ a programmer, but ... well, you get the drift!).
To me, there's really nothing special about three dimensions. Vector
arithmetic must work, regardless of the number of elements, be that 3,
4, 5, or 87403461.

Perhaps there is merit in such a function, of which I am unaware,
which has benefit to programmers of 3D graphics. That's cool! Not a
problem. But I still wouldn't call it multiplication. To me,
multiplication of a vector by a vector is undefined. (Multiplication
of a vector by a scalar is defined).

So sure - why not have an elementwise multiplication function? If it's
useful, it should be implemented. I just don't think it's a good idea
to overload opMul() and opMulAssign() with that function. Maybe just
call it something else?



More information about the Digitalmars-d mailing list