diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-07-06 09:17:02 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-07-06 09:17:02 +0000 |
commit | 2a37179758d8c8db59b0e35c5355c8fd6f9b21dc (patch) | |
tree | 0bf459bd9fbf5a5f39430b274d26305a7c440d1d /numpy/core/defmatrix.py | |
parent | 0f17838356834ecf848140cc931cba1a162fe6c6 (diff) | |
download | numpy-2a37179758d8c8db59b0e35c5355c8fd6f9b21dc.tar.gz |
Add .A, .H, .T, .M attributes to the ndarray.
Diffstat (limited to 'numpy/core/defmatrix.py')
-rw-r--r-- | numpy/core/defmatrix.py | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py index 839c4f058..455926356 100644 --- a/numpy/core/defmatrix.py +++ b/numpy/core/defmatrix.py @@ -276,25 +276,14 @@ class matrix(N.ndarray): def tolist(self): return self.__array__().tolist() - def getA(self): - return self.__array__() - - def getT(self): - return self.transpose() - - def getH(self): - if issubclass(self.dtype.type, N.complexfloating): - return self.transpose().conjugate() - else: - return self.transpose() - def getI(self): - from numpy.dual import inv - return matrix(inv(self)) - - A = property(getA, None, doc="base array") - T = property(getT, None, doc="transpose") - H = property(getH, None, doc="hermitian (conjugate) transpose") + M,N = self.shape + if M == N: + from numpy.dual import inv as func + else: + from numpy.dual import pinv as func + return func(self).M + I = property(getI, None, doc="inverse") |