|
Boost : |
From: Dave Steffen (dgsteffen_at_[hidden])
Date: 2007-12-13 11:12:54
On Wednesday 12 December 2007, Larry Evans wrote:
> On 12/12/07 11:08, Dave Steffen wrote:
> > On Monday 10 December 2007, Andreas Harnack wrote:
>
> [snip]
>
> >> As far as I'm aware there's only one product to matrices; we're
> >> not talking about vectors here ;-). Of course, you can use row-
> >> or column-matrices to represent vectors, in which case the
> >> result (i.e. scalar or matrix) depends on the order of operands.
> >
> > You're kidding, right? There are many ways to multiply two matrices
> > together. I listed three above. Cross products are a fourth.
> > The correct interface depends *heavily* on the intended uses.
>
> I also thought outer and cross product dealt with vectors.
> The following page on outer product:
Yes, I was typing fast and didn't clearly make my point.
Yes, generally cross products are only done with vectors. They can
IIRC be generalized (vectors are really just Nx1 or 1xN matrices,
right?) but I don't think this is commonly used.
However, outer and direct matrix products *are* used; generally not
as often as inner products, true, but they exist. Not supporting
them in a matrix library is fine for many (most?) users, and a deal
breaker for others.
> also supports that interpretation for cross product. I guess
> we're both (i.e. me and Andreas) thinking too narrowly. Could
> you provide some web page supporting your interpretation that
> outer and cross args are matrices instead of vectors?
>
> OOPS, wait. Looking at:
>
> http://planetmath.org/encyclopedia/OuterMultiplication.html
>
> maybe supports your interpretation, although I can't yet
> understand all the notation.
Yeah, notation can be hard. Consider vector multiplication for a
minute:
row vector * column vector = inner product (results in a scalar)
column vector * row vector = outer product (results in a matrix)
row vector * row vector = error in some applications, but can be
interpreted as a direct product in others (same for column vectors).
All can be extended in fairly obvious ways to matrix multiplication.
Which again supports my argument that building a matrix library
*suitable for standardization* is extremely difficult (read:
nobody's figured out what it should look like yet).
> Anyway, even if I and Andreas are thinking too narrowly, the first
> two web pages referenced suggest that thinking is understandable and
> maybe common for those not real familiar with the field.
Exactly. See point above.
And again, this is not a reason not to roll your own library
that does what you want, nor is it a reason not to use other
available libraries, or even to have multiple matrix/linear algebra
libraries in Boost.
But these are all reasons why there is no *standard* matrix library,
and why there isn't likely to be one for a while.
BTW: the more common discussion that happens here every now and
then, and happens on the news groups with regularity, is about why
there's no standard GUI library for C++ (as there is, or at least as
there appears to be, for Java). Same problem, only much harder to
solve.
-- Dave Steffen - Software Engineer 4 Numerica Corporation (www.numerica.us <http://www.numerica.us/> )
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk