Comment #19 on issue 2106 by mipavelka: Matrix of shape (1,1) and a number can't be added
http://code.google.com/p/sympy/issues/detail?id=2106

reply to comment 14:
You can also put it differently:
If 1x1 matrices were the same as scalars, it would make sense.
I think that you mean that the matrix multiplication would not make sense and I agree. But it depeds how the * operator is defined.

It would make sense to define the A*B operation (where A and B are Matrix instances) as "If dimensions of neighbouring indeces of A and B match, do the dot product. Tensor product otherwise."
I think that the * would not be defined precisely otherwise.
It also works in SymPy like that:
(1)             (1 1 1)               (1)          (1)           (1 1)
(1) * (1 1 1) = (1 1 1) but (1 1 1) * (1) = (3) or (1) * (1 1) = (1 1)
(1)             (1 1 1)               (1)          (1)           (1 1)

Then, if the SymPy * operator should have such behavior it should return the dot product in the case row vector * column vector, i.e. a scalar. But it gives a 1x1 matrix as a result of matrix multiplication. I think that it would be nice to have 1x1 matrices compatible with scalars. At least the + and * operators could be able to handle 1x1 matrix <-> scalar conversion implicitely.


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to