Taking the second issue first, the Matrix object is more general than just a 2D array of numbers. It actually will handle arbitrary dimensions. For example, you can do a 3D matrix, or a 1D matrix (which is essentially a vector). Because of this, however, you do have to be a little careful about how you enter a matrix that has only one row.

The `Matrix()`

macro treats multiple inputs as though they were enclosed in brackets. So

Matrix([1,2,3],[4,5,6])is the same as

Matrix([[1,2,3],[4,5,6]])which is a 2x3 matrix. This is meant for convenience, and it works well most of the time, but there is one ambiguity:

Matrix([1,2,3])is not a 1x3 matrix, it is a 1-dimensional matrix of length 3 (i.e., essentially a vector). To get a 1x3 matrix, you must use the double brackets explicitly:

Matrix([[1,2,3]]);That is why when you added the brackets, your multiplications worked out OK.

[Note that this also means `Matrix(1,2,3)`

is the same as `Matrix([1,2,3])`

, so this is a 1D matrix of length 3).]

So that is the misunderstanding of what Matrix arguments mean. It is really best to include the extra brackets for a 2D matrix, but they are not necessary except for 1 x *n* matrices.

As for the bug, it turns out that there was a problem with `ans_array`

for 1 x *n* matrices which caused the dimension mismatch error that you were getting. I have submitted a patch for it, and that should take care of it in the future. If you want a work-around for now, I can give you one, but it's not pretty.

Davide