diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2007-03-24 23:46:03 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2007-03-24 23:46:03 +0000 |
commit | e3a18285c362ebe8bdab2bcdefa8b94557f7b93b (patch) | |
tree | f5cc1d321fe380a4a428c5a531dc410dbcea373e /numpy/core/defmatrix.py | |
parent | 7a2733cb463e519ce6773df6243ed77506483c7e (diff) | |
download | numpy-e3a18285c362ebe8bdab2bcdefa8b94557f7b93b.tar.gz |
Fix matrix-scalar multiplication. Add test for case Matrix*1d-vector
Diffstat (limited to 'numpy/core/defmatrix.py')
-rw-r--r-- | numpy/core/defmatrix.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py index 72b0aa667..f6ecbcaad 100644 --- a/numpy/core/defmatrix.py +++ b/numpy/core/defmatrix.py @@ -154,12 +154,12 @@ class matrix(N.ndarray): def __mul__(self, other): - try : - rhs = asmatrix(other) - except : - return NotImplemented - else : - return N.dot(self, rhs) + if not isscalar(other) : + try : + other = asmatrix(other) + except : + return NotImplemented + return N.dot(self, other) def __rmul__(self, other): return N.dot(other, self) |