3D Math Data structures/SIMD
"Jérôme M. Berger"
jeberger at free.fr
Sat Dec 22 23:50:23 PST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Janice Caron wrote:
> On 12/22/07, "Jérôme M. Berger" <jeberger at free.fr> wrote:
>> Of the four, component-wise is the only one that makes sense for a
>> multiplication *operator* because it's the only one that is defined
>> as taking exactly two input operands in vector space and returning a
>> value in the same vector space.
>
> By which you mean, you'd like the product of a Vector!(N,T) and a
> Vector!(N,T) to be a Vector!(N,T)?
>
> That seems an artificial restriction to me.
However, it is the mathematically accepted definition for a binary
operator:
http://en.wikipedia.org/wiki/Binary_operation
> After all, the product of
> a Matrix!(N,M,T) and a Matrix!(N,M,T) is not a Matrix!(N,M,T), unless
> N==M. (In general, it's undefined). But you wouldn't want to say "Aha
> - in general, it's undefined, so let's define it" (especially not with
> componentwise multiplication, because that would conflict with regular
> matrix multiplication when N==M).
>
> As I'm sure you know, the product of a Matrix!(N,M,T) and
> Matrix!(M,L,T) is a Matrix!(N,L,T). So there is no requirement that
> the product be of the same type as either of the originals.
>
I wasn't talking about a "product" or a "multiplication", but about
a "multiplication *operator*" which, being an *operator* should
follow the definition for one (cf Wikipedia link above).
> Anyway, for reasons of all the arguments listed in this thread, I am
> now convinced that opMul() and opMulAssign() should not be overloaded
> at all for the type Vector!. It seems far better to be explicit about
> what kind of multiply you actually want.
>
I'd tend to agree on that one. Except that now, we need to find a
reasonably short and meaningful name for "element-wise
multiplication" ("dot", "cross" and "outer" work fine for the other
types of multiplication).
Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
| mailto:jeberger at free.fr | ICQ: 238062172 |
| http://jeberger.free.fr/ | Jabber: jeberger at jabber.fr |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFHbhM/d0kWM4JG3k8RAn0sAKC49tOu4Bi+9Q2GqNfBRSWinY1ySwCdFCkP
xIAEMgJG2zsBDBxxwacd7Y0=
=9NTw
-----END PGP SIGNATURE-----
More information about the Digitalmars-d
mailing list