aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ08nY2025-03-26 12:12:54 +0100
committerJ08nY2025-03-26 12:12:54 +0100
commitf1aa1423b4c1bd138f836a4817cf6f1f53cf7fd5 (patch)
tree6b731e54dded8dbe3cfad5b1237276d446f52ecc
parentdd168eb38724072bd2178f6a251ca2e1486d7be5 (diff)
downloadecgen-f1aa1423b4c1bd138f836a4817cf6f1f53cf7fd5.tar.gz
ecgen-f1aa1423b4c1bd138f836a4817cf6f1f53cf7fd5.tar.zst
ecgen-f1aa1423b4c1bd138f836a4817cf6f1f53cf7fd5.zip
Avoid 0 j invariant in cm_construct_curve.
The selecction between quadratic twist and the curve may not be enough (there are more twists).
-rw-r--r--src/cm/cm_any.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cm/cm_any.c b/src/cm/cm_any.c
index 6a65571..df50b3a 100644
--- a/src/cm/cm_any.c
+++ b/src/cm/cm_any.c
@@ -182,12 +182,17 @@ GEN cm_construct_curve(GEN order, GEN d, GEN p, cm_any_roots_t *roots,
for (long i = roots->used; i < roots->total; ++i) {
roots->used = i + 1;
GEN root = gel(roots->roots, i + 1);
+ if (gequal(root, gen_0)) {
+ debug_log("skipping root = 0");
+ continue;
+ }
debug_log("trying root[%i] = %Pi", i + 1, root);
GEN e = ellinit(ellfromj(mkintmod(root, p)), p, 0);
pari_CATCH(e_TYPE) { continue; }
pari_TRY { checkell(e); };
pari_ENDCATCH{};
+ debug_log("ellinit done");
if (ord_prime) {
// Easy part, the requested order is prime so