On 6/25/07, Barton Willis <willisb at unk.edu> wrote:
> Sigh...I'm giving myself grade of 'D-' on the dotproduct function.
> I suppose it did what I needed at the time; after that, I forgot about it.
Oh, I wouldn't worry about it. When you are trying to complete
some project, there is always some central problem which gets
a lot of attention, and a bunch of other stuff which goes along
for the ride ... We'll get it all straightened out eventually.
> dotproduct(a,0) --> 0 (OK)
> dotproduct(a > b, 0) --> 0 (OK, but goofy)
> dotproduct([1,2],0]) --> (OK, I suppose)
> dotproduct(1 x n matrix, n x 1 matrix) --> conjugate(1 x n matrix) . (n x
> 1 matrix) (OK)
> dotproduct(1 x n matrix, 1 x n matrix) --> dotproduct(1 x n matrix,
> transpose(1 x n matrix)) --> ... (OK)
> dotproduct(n x 1 matrix, n x 1 matrix) --> dotproduct(transpose(1 x n
> matrix), 1 x n matrix) --> ... (OK)
> dotproduct(1 x n matrix, n element list) --> (treat n element list as a
> matrix row,
I'm hesitant to carry out computations for anything but
literal or declared vector expressions.
(That leaves the door open for extending the dot product to
other kinds of expressions (e.g. functions), and, just as
important, makes it easier to predict the result.)
Anything else would yield a partially-evaluated expression.
e.g. dotproduct(a > b, 0) => dotproduct(a > b, 0)
dotproduct([1,2],0]) => dotproduct([1,2],0])
While we're at it, I'm inclined to invent a vector operator,
and a bilinear declaration. Also we should consider names
other than "dotproduct" which seems a little clumsy.
All the best,
Robert