jackscott / python-statlib

Exported from google.code, needed to get this crusty code working in a modern world
https://archive.org/web/
Other
0 stars 0 forks source link

Inverting 1-d matrices does not work. #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
$ python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matfunc
>>> matfunc.Square([[1]]).inverse()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "matfunc.py", line 195, in inverse
    def inverse( self ):  return self.solve( eye(self.rows) )
  File "matfunc.py", line 159, in solve
    if b.dim==2: return Mat( map(self.solve, b.tr()) ).tr()
  File "matfunc.py", line 161, in solve
    x = self._solve( b )
  File "matfunc.py", line 155, in _solve
    Q, R = self.qr()
  File "matfunc.py", line 147, in qr
    Q = R.tr().solve(self.tr()).tr()       # Rt Qt = At    nn  nm  = nm
  File "matfunc.py", line 159, in solve
    if b.dim==2: return Mat( map(self.solve, b.tr()) ).tr()
  File "matfunc.py", line 161, in solve
    x = self._solve( b )
  File "matfunc.py", line 155, in _solve
    Q, R = self.qr()
  File "matfunc.py", line 147, in qr
    Q = R.tr().solve(self.tr()).tr()       # Rt Qt = At    nn  nm  = nm
  File "matfunc.py", line 159, in solve
    if b.dim==2: return Mat( map(self.solve, b.tr()) ).tr()
  File "matfunc.py", line 161, in solve
    x = self._solve( b )
...
  File "matfunc.py", line 155, in _solve
    Q, R = self.qr()
  File "matfunc.py", line 147, in qr
    Q = R.tr().solve(self.tr()).tr()       # Rt Qt = At    nn  nm  = nm
  File "matfunc.py", line 159, in solve
    if b.dim==2: return Mat( map(self.solve, b.tr()) ).tr()
  File "matfunc.py", line 161, in solve
    x = self._solve( b )
  File "matfunc.py", line 155, in _solve
    Q, R = self.qr()
  File "matfunc.py", line 142, in qr
    v, beta = R.tr()[i].house(i)
  File "matfunc.py", line 120, in tr
    return Mat(zip(*self))
  File "matfunc.py", line 247, in Mat
    if n <= 1: return Square(elems)
RuntimeError: maximum recursion depth exceeded
>>>

Original issue reported on code.google.com by TAT.Wri...@googlemail.com on 3 Dec 2008 at 2:31