Confusion with 1 x 1 matrices



"Andrej Vodopivec" <andrej.vodopivec at gmail.com> writes:
>
> scalarmatrixp=false changes the behaviour of "." as a product of vectors:
>
> (%i2) v : columnvector([1,2,3])$
> (%i3) v.v;
> (%o3) 14
> (%i4) v.v, scalarmatrixp=false;
> (%o4) matrix([14])
>

I think this is a bug, at least at the mathematical level.  It seems
that "." in maxima stands for two distinct operations, the inner
product (aka scalar product, aka dot product) of vectors and matrix
multiplication.  The result of these two operations is different:
the result of inner product is *always* a number and the result of
matrix multiplication is *always* a matrix.  Now for a row vector v,
v . v makes sense only when interpreted as inner product; for the
matrix multiplication the dimensions do not match.  Therefore for
two 1 x n ( n > 1 ) matrices v, w  the result of v.w should always
be a number independent of the value of scalarmatrixp.  OTOH, for
two 1 x 1 matrices both intrepretaions of "." are valid and we need 
the scalarmatrixp flag to decide.

Best,
Nikos