summaryrefslogtreecommitdiff
path: root/numpy/core/defmatrix.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/defmatrix.py')
-rw-r--r--numpy/core/defmatrix.py40
1 files changed, 3 insertions, 37 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py
index d90530fa4..d506220a2 100644
--- a/numpy/core/defmatrix.py
+++ b/numpy/core/defmatrix.py
@@ -135,44 +135,10 @@ class matrix(N.ndarray):
return truend
def __mul__(self, other):
- if (self.ndim != self._get_truendim()):
- myself = self.A.squeeze()
- else:
- myself = self
-
- myother = other
- if isinstance(other, matrix):
- if (other.ndim != other._get_truendim()):
- myother = other.A.squeeze()
-
- if isinstance(myother, N.ndarray) and myother.size == 1:
- res = N.multiply(myself, myother.item())
- else:
- res = N.dot(myself, myother)
-
- if not isinstance(res, matrix):
- res = res.view(matrix)
- return res
-
+ return N.dot(self, other)
+
def __rmul__(self, other):
- if (self.ndim != self._get_truendim()):
- myself = self.A.squeeze()
- else:
- myself = self
-
- myother = other
- if isinstance(other, matrix):
- if (other.ndim != other._get_truendim()):
- myother = other.A.squeeze()
-
- if isinstance(myother, N.ndarray) and myother.size == 1:
- res = N.multiply(myother.item(), myself)
- else:
- res = N.dot(myother, myself)
-
- if not isinstance(res, matrix):
- res = res.view(matrix)
- return res
+ return N.dot(other, self)
def __imul__(self, other):
self[:] = self * other