On Sunday, 14 November 2010 03:03:18 UTC+8, Carson wrote:
Curious if anyone else is annoyed with mmult returning a double when
the result of the matrix multiplication is a 1x1 matrix? It happens
to me in some "edge cases", then the rest of my code that relies on
the result of mmult being a matrix screws up (eg, (first (mmult mat1
mat2)) usually gives me the first row, unless mat2 ends up being one
column and mat1 with one row, then you end up asking for "first" of a
double).
This is annoying and a really bad design IMHO. It means you can't easily write higher order matrix functions with matrices, since you always have to write code to handle special cases.
The result of multiplying a (i*j) matrix with a (j*k) matrix should always be a (i*k) matrix for any i,j,k
I'd suggest fixing this to return a 1x1 matrix, even if it causes some breakage. It would also be a requirement for core.matrix compatibility where we are quite strict on matrix dimensionality.