summaryrefslogtreecommitdiff
path: root/numpy/core/defmatrix.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2007-03-24 23:14:07 +0000
committerCharles Harris <charlesr.harris@gmail.com>2007-03-24 23:14:07 +0000
commit7a2733cb463e519ce6773df6243ed77506483c7e (patch)
treef27361a76b1c917492e0f1da695fc1f84d8b32ef /numpy/core/defmatrix.py
parent352587d23b30aa7645b0d1b24052a8f1e4099050 (diff)
downloadnumpy-7a2733cb463e519ce6773df6243ed77506483c7e.tar.gz
Fix matrix multiply to return error when has is a 1-D vector. Fixes ticket #473
Diffstat (limited to 'numpy/core/defmatrix.py')
-rw-r--r--numpy/core/defmatrix.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py
index 3c8635ca8..72b0aa667 100644
--- a/numpy/core/defmatrix.py
+++ b/numpy/core/defmatrix.py
@@ -154,11 +154,12 @@ class matrix(N.ndarray):
def __mul__(self, other):
- if isinstance(other, N.ndarray) or N.isscalar(other) or \
- not hasattr(other, '__rmul__'):
- return N.dot(self, other)
- else:
+ try :
+ rhs = asmatrix(other)
+ except :
return NotImplemented
+ else :
+ return N.dot(self, rhs)
def __rmul__(self, other):
return N.dot(other, self)