diff options
author | edschofield <edschofield@localhost> | 2006-02-27 22:47:42 +0000 |
---|---|---|
committer | edschofield <edschofield@localhost> | 2006-02-27 22:47:42 +0000 |
commit | 5ffd88a782e28c9a6af60e61a4064389d0b80d93 (patch) | |
tree | 26cbbe2bea5772c93322cd1e1b7c344e0ab3a5ab /numpy/core/defmatrix.py | |
parent | b8ba26230f5290093351e4ebad676ed9b6471d8a (diff) | |
download | numpy-5ffd88a782e28c9a6af60e61a4064389d0b80d93.tar.gz |
More judicious calling of dot() from matrix.__mul__
Diffstat (limited to 'numpy/core/defmatrix.py')
-rw-r--r-- | numpy/core/defmatrix.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py index 61d23eac9..b22efc108 100644 --- a/numpy/core/defmatrix.py +++ b/numpy/core/defmatrix.py @@ -145,7 +145,11 @@ class matrix(N.ndarray): return truend def __mul__(self, other): - return N.dot(self, other) + if isinstance(other, N.ndarray) or N.isscalar(other) \ + or not hasattr(other, '__rmul__'): + return N.dot(self, other) + else: + return NotImplemented def __rmul__(self, other): return N.dot(other, self) @@ -190,7 +194,7 @@ class matrix(N.ndarray): raise TypeError, "exponent must be an integer" def __rpow__(self, other): - raise NotImplementedError + return NotImplemented def __repr__(self): return repr(self.__array__()).replace('array','matrix') |