|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2004-07-06 10:37:20
Hi David,
On Jul 6, 2004, at 10:24 AM, David B. Held wrote:
> Actually, taking a look at mathworld.wolfram.com and a few other
> sites, I have reached the tentative conclusion that outer products
> can only be formed over vectors, not matrices. Matrix multiplication
> is well-defined and unambiguous, whereas vector multiplication
> comes in at least four varieties: dot product, cross product (also
> called the "outer product"), perpendicular dot product, and vector
> direct product.
Thanks for the concise summary!
> Hence, it would make sense that operator*(matrix, matrix) would
> mean "matrix multiplication".
yes.
> However, operator*(vector, vector) is the problem child.
Yes, there is no obvious "right choice" for vectors. There are basically
two options, both of which are fine by me.
1. Use names such as inner_product (or dot_product), outer_product, etc.
This approach is "true" to the mathematics and completely unambiguous.
2. Take the Matlab approach (which also appears in many textbooks),
and treat vectors as degenerate matrices:
as either row or column vectors. In this case, operator* on
these vectors just has the usual meaning it does for matrices.
Depending on whether the vectors are row or column vectors determines
whether operator* is equivalent to inner or outer product.
This approach is more concise and fits with existing practice.
Cheers,
Jeremy
_______________________________________________
Jeremy Siek <jsiek_at_[hidden]>
http://www.osl.iu.edu/~jsiek
Ph.D. Student, Indiana University Bloomington
C++ Booster (http://www.boost.org)
_______________________________________________
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk