[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scalars and Matrices:
From: |
Johan Kullstam |
Subject: |
Re: Scalars and Matrices: |
Date: |
15 Oct 1999 07:32:53 -0400 |
User-agent: |
Gnus/5.070097 (Pterodactyl Gnus v0.97) Emacs/20.4 |
(Ted Harding) <address@hidden> writes:
> On 13-Oct-99 A. Scottedward Hodel wrote:
> >
> > Sorry; I forwarded the article without fixing mangled spacing. The
> > values are:
> > A = [1, 1 ]; # 1 x 2 row vector
> > B = [1 ; 1]; # 2 x 1 column vector
> > C = [1 ; 2 ; 3]; # 3 x 1 column vector; could be any length, as long
> > as its
> > # a column
> > this_works = (A*B)*C;
> > this_does_too = A*B*C;
> > this_fails = A*(B*C);
> >
> > With scalar = 1x1 matrix, (A*B)*C is defined, but A*(B*C) is not. It's
> > an annoying detail that the order of operations not only changes flop
> > counts, but even whether or not a result is defined.
>
> Sorry, I don't think I can sympathise with this. As a general convention
> for associativity,
>
> A*B*C = (A*B)*C
no. associativity says, by definition, that
(A*B)*C = A*(B*C) (A)
and one draws the conclusion that since (A) holds, we can write
A*B*C
with no risk of confusion. *order doesn't matter* if star (*)
is associative.
what you are promoting is implicit grouping. this is *not*
associativity. it is, in fact, nearly the *opposite* of
associativity, since order clearly *does* matter. you even go out of
your way to define a default order convention.
one could also take the point of view that the octave interpreter
should *require* parenthesis in cases of ambiguity.
we could still allow automatic rearrangement of the operations to
whichever uses fewer flops whenever we are in a non-ambiguous case.
--
J o h a n K u l l s t a m
address@hidden
Don't Fear the Penguin!
---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL. To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------