**diff options**

author | Erik M. Bray <erik.bray@lri.fr> | 2016-08-29 12:28:00 +0200 |
---|---|---|

committer | Jeroen Demeyer <jdemeyer@cage.ugent.be> | 2016-09-02 11:01:42 +0200 |

commit | 10ff2ec9ca61fb39187b9ab2fe0fb1965251ca24 (patch) | |

tree | a35fe5381acf6d13f401b09e5ced4a6496eab518 | |

parent | Updated SageMath version to 7.4.beta2 (diff) |

Workaround to prevent this calculation to blow the stack

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.

-rw-r--r-- | src/sage/schemes/elliptic_curves/isogeny_small_degree.py | 3 |

1 files changed, 1 insertions, 2 deletions

diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py index 63e6ef7..3c22008 100644 --- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py @@ -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): |