On Sat, Jun 6, 2009 at 9:29 AM, Alan G Isaac <ais...@american.edu> wrote:
> On 6/6/2009 12:41 AM Charles R Harris apparently wrote: > > Well, one could argue that. The x.T is a member of the dual, hence maps > > vectors to the reals. Usually the reals aren't represented by 1x1 > > matrices. Just my [.02] cents. > > Of course that same perspective could > lead you to argue that a M×N matrix > is for mapping N vectors to M vectors, > not for doing matrix multiplication. > > Matrix multiplication produces a > matrix result **by definition**. > Treating 1×1 matrices as equivalent > to scalars is just a convenient anomaly > in certain popular matrix-oriented > languages. > So is eye(3)*(v.T*v) valid? If (v.T*v) is 1x1 you have incompatible dimensions for the multiplication, whereas if it is a scalar you can multiply eye(3) by it. The usual matrix algebra gets a bit confused here because it isn't clear about the distinction between inner products and the expression v.T*v which is typically used in it's place. I think the only consistent way around this is to treat 1x1 matrices as scalars, which I believe matlab does, but then the expression eye(3)*(v.T*v) isn't associative and we lose some checks. I don't think we can change the current matrix class, to do so would break too much code. It would be nice to extend it with an explicit inner product, but I can't think of any simple notation for it that python would parse. Chuck
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion