Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Workaround to prevent this calculation to blow the stack
Browse files Browse the repository at this point in the history
Specifically, the CPython interpreter's symbol visibility analysis makes
recursive calls into a function called `symtable_visit_expr`, and can
overflow the stack when analyzing a very large expression of binary
operators (this also came up in this ticket:
https://trac.sagemath.org/ticket/16014).  While I seek a more general
fix to that problem, we need to work around it.  In this case the
polynomial `psi` is converted one term at a time, and then summed,
rather than summed first and then converted (resulting in evaluating a
very large Singular polynomial).  The result is the same either way
though might be slightly slower with this workaround, though I haven't
tested.
  • Loading branch information
embray authored and jdemeyer committed Sep 2, 2016
1 parent 5cd62cb commit 10ff2ec
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/sage/schemes/elliptic_curves/isogeny_small_degree.py
Expand Up @@ -1493,9 +1493,8 @@ def Psi2(l):
t += [(c[n]-(4*n-2)*A*t[n-1]-(4*n-4)*B*t[n-2])*(1/QQ(4*n+2))]
for n in range(1,d+1):
s += [(-1/QQ(n))*sum((-1)**i*t[i]*s[n-i] for i in range(1,n+1))]
psi = sum((-1)**i*s[i]*x**(d-i) for i in range(0,d+1))
R = PolynomialRing(QQ,['x','u','v'])
return R(psi)
return sum(R((-1)**i*s[i]*x**(d-i)) for i in range(0,d+1))


def isogenies_prime_degree_genus_plus_0(E, l=None):
Expand Down

0 comments on commit 10ff2ec

Please sign in to comment.