diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-07-07 08:18:02 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-07-07 08:18:02 +0000 |
commit | 80f1d7825004f8be40fa265eaaf165471467112d (patch) | |
tree | 77cac0aee76daab0016121de404830e9fd553dc2 /numpy/core/defmatrix.py | |
parent | ddfe20b98506f0e0eb5f27286dc515ccab4b44a8 (diff) | |
download | numpy-80f1d7825004f8be40fa265eaaf165471467112d.tar.gz |
Remove .M .A .H attribute. Keep .T attribute as .transpose for >=2d. Creates 2-d from 1-d and returns self for 0-d. Fix-up flag-checking when stride 0 is coupled with dim == 1
Diffstat (limited to 'numpy/core/defmatrix.py')
-rw-r--r-- | numpy/core/defmatrix.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py index 455926356..7942e6a93 100644 --- a/numpy/core/defmatrix.py +++ b/numpy/core/defmatrix.py @@ -1,5 +1,5 @@ -__all__ = ['matrix', 'bmat', 'mat', 'asmatrix'] +__all__ = ['matrix', 'bmat', 'mat', 'asmatrix', 'asmat'] import numeric as N from numeric import concatenate, isscalar, binary_repr @@ -282,10 +282,24 @@ class matrix(N.ndarray): 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") + return asmatrix(func(self)) + + 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() + + T = property(getT, None, doc="transpose") + A = property(getA, None, doc="base array") + H = property(getH, None, doc="hermitian (conjugate) transpose") + I = property(getI, None, doc="inverse") def _from_string(str,gdict,ldict): rows = str.split(';') @@ -349,3 +363,4 @@ def bmat(obj, ldict=None, gdict=None): return matrix(obj) mat = matrix +asmat = asmatrix |