diff options
author | Robert Kern <robert.kern@gmail.com> | 2005-10-12 02:51:09 +0000 |
---|---|---|
committer | Robert Kern <robert.kern@gmail.com> | 2005-10-12 02:51:09 +0000 |
commit | 3d0634c3381ecdf2717b574ffd0e3dbb872a4e5e (patch) | |
tree | ffa895dc7915474d527e7dbde84db4b006a8d4a3 /scipy/base/matrix.py | |
parent | c9833ef726fd000fa0634f8a5850c75413aa6471 (diff) | |
download | numpy-3d0634c3381ecdf2717b574ffd0e3dbb872a4e5e.tar.gz |
r328@Blasphemy: kern | 2005-10-11 19:50:41 -0700
matrix.py fixes and tests.
Diffstat (limited to 'scipy/base/matrix.py')
-rw-r--r-- | scipy/base/matrix.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scipy/base/matrix.py b/scipy/base/matrix.py index 40ea6823a..6fc717cb7 100644 --- a/scipy/base/matrix.py +++ b/scipy/base/matrix.py @@ -128,8 +128,13 @@ class matrix(N.ndarray): else: return N.dot(other, self) + def __imul__(self, other): + self[:] = self * other + return self + def __pow__(self, other): - if len(shape)!=2 or shape[0]!=shape[1]: + shape = self.shape + if len(shape) != 2 or shape[0] != shape[1]: raise TypeError, "matrix is not square" if type(other) in (type(1), type(1L)): if other==0: @@ -184,14 +189,13 @@ class matrix(N.ndarray): def getH(self): if issubclass(self.dtype, N.complexfloating): - return self.transpose(self.conjugate()) + return self.transpose().conjugate() else: return self.transpose() def getI(self): - import scipy - inv = scipy.linalg.inv - return matrix(inv(self)) + from scipy import linalg + return matrix(linalg.inv(self)) A = property(getA, None, doc="base array") T = property(getT, None, doc="transpose") |