Comment #10 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
I encountered the problem only when I was adding or subtracting 1x1
matrices and scalars. So, maybe you could use some workaround like this in
matrices.matrices.py:
417 def __add__(self,a):
418 if not hasattr(a, 'shape'):
419 a = Matrix([a])
420 return matrix_add(self,a)
421
422 def __radd__(self,a):
423 if not hasattr(a, 'shape'):
424 a = Matrix([a])
425 return matrix_add(a,self)
Such a way is not as clear as always recasting 1x1 matrix as a scalar but
it would leave the possibility to handle 1x1 matrices as matrices. It also
solves the problem with adding and subtracting.
However, I am quite new to sympy and I don't know if it wouldn't cause any
other problems.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.