At least this it how it appears. The following code behaved correctly for 3x3 and 6x6 matrices.
deter = mat.det('method':'berkowitz')
#self.resultFileHandler.writeLogStr(str(deter))
a = sy_polys.Poly(deter, k)
For 3x3 it takes ~0.8s to execute this code, for 6x6 it takes ~288s (with only 650ms for the det function, the rest for the Poly). For 10x10, either the complexity has ramped at a colossal rate or some other reason is preventing it returning from the Poly call (I waited a week). No exceptions are thrown.
The elements of the determinants consist of large symbolic polynomials.
I was on 0.7.1 and just upgraded to 1.0 (problem in both versions).
I added the logging to try and get the determinant to file but it sticks again in the str(deter) function call. If I break my debugger can't display the deter (prob too large for the debugger).
Here is a stack:
MainThread - pid_135368_id_42197520
_print [printer.py:262]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
parenthesize [str.py:29]
_print_Mul [str.py:290]
_print [printer.py:257]
_print_Add [str.py:56]
_print [printer.py:257]
doprint [printer.py:233]
sstr [str.py:748]
__str__ [basic.py:396]
_getRoots_sympy_Poly_nroots [__init__.py:91]
getRoots [__init__.py:68]
findPolyRoots [__init__.py:697]
_getNroots [polefinder.py:97]
_doForN [polefinder.py:60]
_incN [polefinder.py:52]
__init__ [polefinder.py:39]
_doPoleFind [polefinderwrap.py:33]
_polesForPos [polefinderwrap.py:47]
<module> [polefinderwrap.py:60]
run [pydevd.py:937]
<module> [pydevd.py:1530]
OK, I've got an exception from the str function. Seems likely that the polynomial has become too large.
Traceback (most recent call last):
File "E:\Peter's Documents\PhD\Code\Git\ProtoQScat\multichannel\qscat\ratsmat.\polefinder.py", line 60, in _doForN
roots = self._getNroots(N)
File "E:\Peter's Documents\PhD\Code\Git\ProtoQScat\multichannel\qscat\ratsmat.\polefinder.py", line 97, in _getNroots
roots = ratSmat.findPolyRoots(False)
File "E:\Peter's Documents\PhD\Code\Git\ProtoQScat\multichannel\qscat\numerical/..\ratsmat\__init__.py", line 697, in findPolyRoots
roots = self.polyRootSolve.getRoots(mat, k)
File "E:\Peter's Documents\PhD\Code\Git\ProtoQScat\multichannel\qscat\numerical/..\ratsmat\__init__.py", line 68, in getRoots
ret = self._getRoots_sympy_Poly_nroots(mat, k)
File "E:\Peter's Documents\PhD\Code\Git\ProtoQScat\multichannel\qscat\numerical/..\ratsmat\__init__.py", line 91, in _getRoots_sympy_Poly_nroots
self.resultFileHandler.writeLogStr(str(deter))
File "C:\Python27\lib\site-packages\sympy\core\basic.py", line 396, in __str__
return sstr(self, order=None)
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 748, in sstr
s = p.doprint(expr)
File "C:\Python27\lib\site-packages\sympy\printing\printer.py", line 233, in doprint
return self._str(self._print(expr))
File "C:\Python27\lib\site-packages\sympy\printing\printer.py", line 257, in _print
return getattr(self, printmethod)(expr, *args, **kwargs)
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 56, in _print_Add
t = self._print(term)
File "C:\Python27\lib\site-packages\sympy\printing\printer.py", line 257, in _print
return getattr(self, printmethod)(expr, *args, **kwargs)
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 290, in _print_Mul
a_str = [self.parenthesize(x, prec) for x in a]
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 29, in parenthesize
return "(%s)" % self._print(item)
File "C:\Python27\lib\site-packages\sympy\printing\printer.py", line 257, in _print
return getattr(self, printmethod)(expr, *args, **kwargs)
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 56, in _print_Add
t = self._print(term)
File "C:\Python27\lib\site-packages\sympy\printing\printer.py", line 257, in _print
return getattr(self, printmethod)(expr, *args, **kwargs)
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 290, in _print_Mul
a_str = [self.parenthesize(x, prec) for x in a]
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 29, in parenthesize
return "(%s)" % self._print(item)
File "C:\Python27\lib\site-packages\sympy\printing\printer.py", line 257, in _print
return getattr(self, printmethod)(expr, *args, **kwargs)
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 56, in _print_Add
t = self._print(term)
File "C:\Python27\lib\site-packages\sympy\printing\printer.py", line 257, in _print
return getattr(self, printmethod)(expr, *args, **kwargs)
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 290, in _print_Mul
a_str = [self.parenthesize(x, prec) for x in a]
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 29, in parenthesize
return "(%s)" % self._print(item)
File "C:\Python27\lib\site-packages\sympy\printing\printer.py", line 257, in _print
return getattr(self, printmethod)(expr, *args, **kwargs)
File "C:\Python27\lib\site-packages\sympy\printing\str.py", line 69, in _print_Add
return sign + ' '.join(l)
MemoryError
EDIT:
Following from answer below here is a profile plot with the determinant size (channel). Ignore N (on y axis) it is another parameter of the calculation (governs the size of the polys in the elements).