My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 158: nstr should pass kwargs to low-level conversion methods
1 person starred this issue and may be notified of changes. Back to list
Status:  Started
Owner:  Vinzent.Steinberg
Type-Enhancement
Priority-Medium


Sign in to add a comment
 
Reported by Vinzent.Steinberg, Aug 19, 2009
This patch implementes this, however I get an infinite recursion when
running the linalg.py tests.
nstr-pass-args.patch
2.0 KB   Download
Comment 1 by Vinzent.Steinberg, Aug 19, 2009
Test script to demonstrate new functionality.
matstr.py
276 bytes   Download
Comment 2 by fredrik.johansson, Aug 22, 2009
+1 if the infinite recursion can be fixed
Comment 3 by Vinzent.Steinberg, Nov 07, 2009
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?

Comment 4 by Vinzent.Steinberg, Nov 07, 2009
To reproduce, run:

>>> import sys
>>> sys.setrecursionlimit(100)
>>> from mpmath import randmatrix
>>> from mpmath.linalg import exp_pade
>>> exp_pade(randmatrix(2))
Sign in to add a comment

Hosted by Google Code