Open GoogleCodeExporter opened 9 years ago
Test script to demonstrate new functionality.
Original comment by Vinzent.Steinberg@gmail.com
on 19 Aug 2009 at 2:45
Attachments:
+1 if the infinite recursion can be fixed
Original comment by fredrik....@gmail.com
on 22 Aug 2009 at 8:40
The error occurs in test_exp_pade, I managed to recover the stacktrace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mpmath/__init__.py", line 96, in runtests
tests.testit(importdir, testdir)
File "mpmath/tests/runtests.py", line 118, in testit
module.__dict__[f]()
File "/home/one/src/mpmath/mpmath/tests/test_linalg.py", line 226, in test_exp_pade
e1 = exp_pade(a1)
File "mpmath/linalg.py", line 521, in exp_pade
cx = c*x
File "<string>", line 28, in __mul__
File "<string>", line 28, in __mul__
[...]
File "<string>", line 28, in __mul__
File "mpmath/mptypes.py", line 377, in convert
return matrix(x)
File "mpmath/matrices.py", line 324, in __init__
A = args[0].copy()
File "mpmath/matrices.py", line 584, in copy
new = matrix(self.__rows, self.__cols, force_type=self.force_type)
File "mpmath/matrices.py", line 299, in __init__
if isinstance(args[0], (list, tuple)):
RuntimeError: maximum recursion depth exceeded while calling a Python object
This is quite strange, how can a commit related to nstr() affect matrix
multiplication?
Original comment by Vinzent.Steinberg@gmail.com
on 7 Nov 2009 at 11:24
To reproduce, run:
>>> import sys
>>> sys.setrecursionlimit(100)
>>> from mpmath import randmatrix
>>> from mpmath.linalg import exp_pade
>>> exp_pade(randmatrix(2))
Original comment by Vinzent.Steinberg@gmail.com
on 7 Nov 2009 at 11:37
This is quite annoying, I also ran into this issue when trying to fix
mpmathify(matrix).
Original comment by Vinzent.Steinberg@gmail.com
on 15 Jan 2010 at 3:25
I tested this patch (with trivial changes) just now and it seems to work, so I
committed it. Can you verify?
Would you like to add a test or two?
Original comment by fredrik....@gmail.com
on 15 Jan 2010 at 6:58
I also changed min_fixed in to_str to always go down to 0.0001 by default before
switching to floating-point. Judging from the doctests that needed fixing,
nothing of
value was lost.
Original comment by fredrik....@gmail.com
on 15 Jan 2010 at 8:09
Thank you! However, if I try to add matrix to ctx.types, I get an infinite
recursion
in exp_pade again.
Original comment by Vinzent.Steinberg@gmail.com
on 15 Jan 2010 at 9:28
Attachments:
I added a very simple test for nstr applied to matrices.
Original comment by Vinzent.Steinberg@gmail.com
on 15 Jan 2010 at 9:44
Strange. On a related note, maybe there should be separate functions for
converting
anything (including matrices) and converting just scalars? (It might not be
relevant
to fixing this... but maybe it would provide clearer semantics in some places.)
Original comment by fredrik....@gmail.com
on 16 Jan 2010 at 9:53
Original issue reported on code.google.com by
Vinzent.Steinberg@gmail.com
on 19 Aug 2009 at 2:44Attachments: