Testing latest pari + WASM + node.js... and it works?! Wow.
License: GPL3
ubuntu2004
% Copyright (c) 2000 The PARI Group1%2% This file is part of the PARI/GP documentation3%4% Permission is granted to copy, distribute and/or modify this document5% under the terms of the GNU General Public License6\chapter{Elliptic curves and arithmetic geometry}78This chapter is quite short, but is added as a placeholder, since9we expect the library to expand in that direction.1011\section{Elliptic curves}12Elliptic curves are represented in the Weierstrass model13$$ (E): y^2z + a_1xyz + a_3 yz = x^3 + a_2 x^2z + a_4 xz^2 + a_6z^3, $$14by the $5$-tuple $[a_1,a_2,a_3,a_4,a_6]$. Points in the projective15plane are represented as follows: the point at infinity $(0:1:0)$ is coded16as \kbd{[0]}, a finite point $(x:y:1)$ outside the projective line at infinity17$z = 0$ is coded as $[x,y]$. Note that other points at infinity than $(0:1:0)$18cannot be represented; this is harmless, since they do not belong to any of19the elliptic curves $E$ above.2021\emph{Points on the curve} are just projective points as described above,22they are not tied to a curve in any way: the same point may be used in23conjunction with different curves, provided it satisfies their equations (if24it does not, the result is usually undefined). In particular, the point at25infinity belongs to all elliptic curves.2627As with \tet{factor} for polynomial factorization, the $5$-tuple28$[a_1,a_2,a_3,a_4,a_6]$ implicitly defines a base ring over which the curve29is defined. Point coordinates must be operation-compatible with this30base ring (\kbd{gadd}, \kbd{gmul}, \kbd{gdiv} involving them should not give31errors).3233\subsec{Types of elliptic curves}3435We call a $5$-tuble as above an \kbd{ell5}; most functions require an36\kbd{ell} structure, as returned by \tet{ellinit}, which contains additional37data (usually dynamically computed as needed), depending on the base field.3839\fun{GEN}{ellinit}{GEN E, GEN D, long prec}, returns an \tet{ell} structure,40attached to the elliptic curve $E$ : either an \kbd{ell5}, a pair $[a_4,a_6]$41or a \typ{STR} in Cremona's notation, e.g. \kbd{"11a1"}. The optional $D$42(\kbd{NULL} to omit) describes the domain over which the curve is defined.4344\subsec{Type checking}4546\fun{void}{checkell}{GEN e} raise an error unless $e$ is an \var{ell}.4748\fun{int}{checkell_i}{GEN e} return $1$ if $e$ is an \var{ell} and $0$49otherwise.5051\fun{void}{checkell5}{GEN e} raise an error unless $e$ is an \var{ell}52or an \var{ell5}.5354\fun{void}{checkellpt}{GEN z} raise an error unless $z$ is a point55(either finite or at infinity).5657\fun{long}{ell_get_type}{GEN e} returns the domain type over which the curve58is defined, one of5960\tet{t_ELL_Q} the field of rational numbers;6162\tet{t_ELL_NF} a number field;6364\tet{t_ELL_Qp} the field of $p$-adic numbers, for some prime $p$;6566\tet{t_ELL_Fp} a prime finite field, base field elements are represented as67\kbd{Fp}, i.e.~a \typ{INT} reduced modulo~$p$;6869\tet{t_ELL_Fq} a nonprime finite field (a prime finite field can also be70represented by this subtype, but this is inefficient), base field elements71are represented as \typ{FFELT};7273\tet{t_ELL_Rg} none of the above.7475\fun{void}{checkell_Fq}{GEN e} checks whether $e$ is an \kbd{ell}, defined76over a finite field (either prime or nonprime). Otherwise the function77raises a \tet{pari_err_TYPE} exception.7879\fun{void}{checkell_Q}{GEN e} checks whether $e$ is an \kbd{ell}, defined80over $\Q$. Otherwise the function raises a \tet{pari_err_TYPE} exception.8182\fun{void}{checkell_Qp}{GEN e} checks whether $e$ is an \kbd{ell}, defined83over some $\Q_p$. Otherwise the function raises a \tet{pari_err_TYPE}84exception.8586\fun{void}{checkellisog}{GEN v} raise an error unless $v$ is an isogeny,87from \tet{ellisogeny}.8889\subsec{Extracting info from an \kbd{ell} structure}9091These functions expect an \kbd{ell} argument. If the required data is not92part of the structure, it is computed then inserted, and the new value is93returned.9495\subsubsec{All domains}9697\fun{GEN}{ell_get_a1}{GEN e}9899\fun{GEN}{ell_get_a2}{GEN e}100101\fun{GEN}{ell_get_a3}{GEN e}102103\fun{GEN}{ell_get_a4}{GEN e}104105\fun{GEN}{ell_get_a6}{GEN e}106107\fun{GEN}{ell_get_b2}{GEN e}108109\fun{GEN}{ell_get_b4}{GEN e}110111\fun{GEN}{ell_get_b6}{GEN e}112113\fun{GEN}{ell_get_b8}{GEN e}114115\fun{GEN}{ell_get_c4}{GEN e}116117\fun{GEN}{ell_get_c6}{GEN e}118119\fun{GEN}{ell_get_disc}{GEN e}120121\fun{GEN}{ell_get_j}{GEN e}122123\subsubsec{Curves over $\Q$}124125\fun{GEN}{ellQ_get_N}{GEN e} returns the curve conductor126127\fun{void}{ellQ_get_Nfa}{GEN e, GEN *N, GEN *faN} sets $N$ to the conductor128and \kbd{faN} to its factorization129130\fun{int}{ell_is_integral}{GEN e} return $1$ if $e$ is given by an integral131model, and $0$ otherwise.132133\fun{long}{ellQ_get_CM}{GEN e} if $e$ has CM by a principal imaginary134quadratic order, return its discriminant. Else return $0$.135136\fun{long}{ellap_CM_fast}{GEN e, ulong p, long CM} assuming that $p$137does not divide the discriminant of $E$ (in particular, $E$ has good138reduction at $p$), and that \kbd{CM} is as given by \tet{ellQ_get_CM},139return the trace of Frobenius for $E/\F_p$. This is meant to quickly compute140lots of $a_p$, esp.~when $e$ has CM by a principal quadratic order.141142\fun{long}{ellrootno_global}{GEN e} returns the global root number143$c\in \{-1,1\}$.144145\fun{GEN}{ellheightoo}{GEN E, GEN P, long prec} given $P = [x,y]$ an affine146point on $E$, return147$$148\lambda_\infty(P) + \dfrac{1}{12}\log|\disc E| =149\dfrac{1}{2} \text{real}(z\eta(z)) - \log |\sigma(E,z)|150\in \R, $$151where $\lambda_\infty(P)$ is the canonical local height at infinity152and $z$ is \kbd{ellpointtoz}$(E,P)$. This153is computed using Mestre's (quadratically convergent) AGM algorithm.154155\fun{long}{ellorder_Q}{GEN E, GEN P} return the order of $P\in E(\Q)$, using156the impossible value $0$ for a point of infinite order. Ultimately called157by the generic \tet{ellorder} function.158159\fun{GEN}{point_to_a4a6}{GEN E, GEN P, GEN p, GEN *a4} given $E/\Q$,160$p\neq 2,3$ not dividing the discriminant of $E$ and $P\in E(\Q)$ outside the161kernel of reduction, return the image of $P$ on the short Weierstrass162model $y^2 = x^3 + a_4x + a_6$ isomorphic to the reduction $E_p$ of $E$ at $p$.163Also set \kbd{a4} to the $a_4$ coefficient in the above model. This function164allows quick computations modulo varying primes $p$, avoiding the overhead of165\kbd{ellinit}$(E,p)$, followed by a change of coordinates. It produces data166suitable for \kbd{FpE} routines.167168\fun{GEN}{point_to_a4a6_Fl}{GEN E, GEN P, ulong p, ulong *pa4} as169\tet{point_to_a4a6}, returning a \kbd{Fle}.170171\fun{GEN}{elldatagenerators}{GEN E} returns generators for $E(\Q)$172extracted from Cremona's table.173174\fun{GEN}{ellanal_globalred}{GEN e, GEN *v} takes an \var{ell} over $\Q$175and returns a global minimal model $E$ (in \kbd{ellinit} form, over $\Q$) for176$e$ suitable for analytic computations related to the curve $L$ series: it177contains \kbd{ellglobalred} data, as well as global and local root numbers. If178\kbd{v} is not \kbd{NULL}, set \kbd{*v} to the needed change of variable:179\kbd{NULL} if $e$ was already the standard minimal model, such that $E =180\kbd{ellchangecurve(e,v)}$ otherwise. Compared to the direct use of181\kbd{ellchangecurve} followed by \kbd{ellrootno}, this function avoids182converting unneeded dynamic data and avoids potential memory leaks183(the changed curve would have had to be deleted using \tet{obj_free}). The184original curve $e$ is updated as well with the same information.185186\fun{GEN}{ellanal_globalred_all}{GEN e, GEN *v, GEN *N, GEN *tam} as187\tet{ellanal_globalred}; further set \kbd{*N} to the curve conductor188and \kbd{*tam} to the product of the local Tamagawa numbers, including189the factor at infinity (multiply by the number of connected components190of $e(\R)$).191192\fun{GEN}{ellintegralmodel}{GEN e, GEN *pv} return an integral model193for $e$ (in \kbd{ellinit} form, over $\Q$). Set $v = \kbd{NULL}$ (already194integral, we returned $e$ itself), else to the variable change195$[u,0,0,0]$ making $e$ integral. We have $u = 1/t$, $t > 1$.196197\fun{GEN}{ellintegralmodel_i}{GEN e, GEN *pv} shallow version of198\kbd{ellintegralmodel}.199200\fun{GEN}{ellQtwist_bsdperiod}{GEN E, long s} let $E$ be a rational elliptic201curve given by a minimal model, $\Lambda_E$ its period lattice, and202$s\in\{-1,1\}$. Let $\Omega_E^\pm$ be the canonical periods in203$\sqrt{\pm 1}\R^+$ generating $\Lambda_E \cap \sqrt{\pm 1} \R$.204Return $\Omega_E^+$ if $s = 1$ and $\Omega_E^-$ if $s = -1$.205206\fun{GEN}{elltors_psylow}{GEN e, ulong p} as \kbd{elltors}, but return the207$p$-Sylow subgroup of the torsion group.208209\misctitle{Deprecated routines}210211\fun{GEN}{elltors0}{GEN e, long flag} this function is deprecated; use212\tet{elltors}213214\subsubsec{Curves over a number field \var{nf}}215216Let $K$ be the number field over which $E$ is defined, given by217a \var{nf} or \var{bnf} structure.218219\fun{GEN}{ellnf_get_nf}{GEN E} returns the underlying \kbd{nf}.220221\fun{GEN}{ellnf_get_bnf}{GEN x} returns \kbd{NULL} if $K$ does not contain222a \var{bnf} structure, else return the \var{bnf}.223224\fun{GEN}{ellnf_vecarea}{GEN E} returns the vector of the period lattices areas225of all the complex embeddings of \kbd{E} in the same order as \kbd{E.nf.roots}.226227\fun{GEN}{ellnf_veceta}{GEN E} returns the vector of the quasi-periods of228all the complex embeddings of \kbd{E} in the same order as \kbd{E.nf.roots}.229230\fun{GEN}{ellnf_vecomega}{GEN E} returns the vector of the periods of231all the complex embeddings of \kbd{E} in the same order as \kbd{E.nf.roots}.232233\subsubsec{Curves over $\Q_p$}234235\fun{GEN}{ellQp_get_p}{GEN E} returns $p$236237\fun{long}{ellQp_get_prec}{GEN E} returns the default $p$-adic accuracy to238which we must compute approximate results attached to $E$.239240\fun{GEN}{ellQp_get_zero}{GEN x} returns $O(p^n)$, where $n$ is the default241$p$-adic accuracy as above.242243The following functions are only defined when $E$ has multiplicative244reduction (Tate curves):245246\fun{GEN}{ellQp_Tate_uniformization}{GEN E, long prec} returns a247\typ{VEC} containing $u^2, u, q, [a,b]$, at $p$-adic precision \kbd{prec}.248249\fun{GEN}{ellQp_u}{GEN E, long prec} returns $u$.250251\fun{GEN}{ellQp_u2}{GEN E, long prec} returns $u^2$.252253\fun{GEN}{ellQp_q}{GEN E, long prec} returns the Tate period $q$.254255\fun{GEN}{ellQp_ab}{GEN E, long prec} returns $[a,b]$.256257\fun{GEN}{ellQp_AGM}{GEN E, long prec} returns $[a,b,R,v]$, where258$v$ is an integer, $a, b, R$ are vectors describing the sequence of259$2$-isogenous curves $E_i: y^2 = x(x+A_i)(x+A_i-B_i)$, $i \geq 1$260converging to the singular curve $E_\infty: y^2 = x^2(x+M)$. We have261$a[i] = A[i] p^v$, $b[i] = B[i] p^v$, $R[i] = A_i - B_i$. These are used in262\kbd{ellpointtoz} and \kbd{ellztopoint}.263264\fun{GEN}{ellQp_L}{GEN E, long prec} returns the ${\cal L}$-invariant $L$.265266\fun{GEN}{ellQp_root}{GEN E, long prec} returns $e_1$.267268\subsubsec{Curves over a finite field $\F_q$}269270\fun{GEN}{ellff_get_p}{GEN E} returns the characteristic271272\fun{GEN}{ellff_get_field}{GEN E} returns $p$ if $\F_q$ is a prime field, and273a \typ{FFELT} belonging to $\F_q$ otherwise.274275\fun{GEN}{ellff_get_card}{GEN E} returns $\#E(\F_q)$276277\fun{GEN}{ellff_get_gens}{GEN E} returns a minimal set of generators for278$E(\F_q)$.279280\fun{GEN}{ellff_get_group}{GEN E} returns \kbd{ellgroup}$(E)$.281282\fun{GEN}{ellff_get_m}{GEN E} returns the \typ{INT} $m$ as needed by the283\kbd{gen\_ellgroup} function (the order of the pairing required to verify a284generating set).285286\fun{GEN}{ellff_get_o}{GEN E} returns $[d, \kbd{factor{d}}]$, where $d$ is287the exponent of $E(\F_q)$.288289\fun{GEN}{ellff_get_D}{GEN E} returns the elementary divisors for $E(\F_q)$290in a form suitable for \tet{gen_ellgens}: either $[d_1]$ or $[d_1,d_2]$,291where $d_1$ is in \tet{elff_get_o} format.292293$[d, \kbd{factor{d}}]$, where $d$ is294the exponent of $E(\F_q)$.295296\fun{GEN}{ellff_get_a4a6}{GEN E} returns a canonical ``short model'' for $E$,297and the corresponding change of variable $[u,r,s,t]$. For $p\neq 2,3$,298this is $[A_4,A_6,[u,r,s,t]]$, corresponding to $y^2 = x^3 + A_4x + A_6$,299where $A_4 = -27c_4$, $A_6 = -54c_6$, $[u,r,s,t] = [6, 3b_2,3a_1,108a_3]$.300301\item If $p = 3$ and the curve is ordinary ($b_2\neq 0$), this is302$[[b_2], A_6, [1,v,-a_1,-a_3]]$, corresponding to303$$y^2 = x^3 + b_2 x^2 + A_6,$$304where $v = b_4/b_2$, $A_6 = b_6 - v(b_4+v^2)$.305306\item If $p = 3$ and the curve is supersingular ($b_2 = 0$), this is307$[-b_4, b_6, [1,0,-a_1,-a_3]]$, corresponding to308$$y^2 = x^3 + 2b_4 x + b_6.$$309310\item If $p = 2$ and the curve is ordinary ($a_1 \neq 0$), return311$[A_2,A_6,[a_1^{-1}, da_1^{-2}, 0, (a_4+d^2)a_1^{-1}]]$, corresponding to312$$ y^2 + xy = x^3 + A_2 x^2 + A_6,$$313where314$d = a_3/a_1$, $a_1^2 A_2 = (a_2 + d)$ and315$$ a_1^6 A_6 = d^3 + a_2 d^2 + a_4 d + a_6 + (a_4^2 + d^4)a_1^{-2}.$$316317\item If $p = 2$ and the curve is supersingular ($a_1 = 0$, $a_3\neq 0$), return318$[[a_3, A_4, 1/a_3], A_6, [1,a_2,0,0]]$, corresponding to319$$ y^2 + a_3 y = x^3 + A_4 x + A_6,$$320where $A_4 = a_2^2 + a_4$, $ A_6 = a_2a_4 + a_6$. The value $1/a_3$ is321included in the vector since it is frequently needed in computations.322323\subsubsec{Curves over $\C$} (This includes curves over $\Q$!)324325\fun{long}{ellR_get_prec}{GEN E} return the default accuracy to326which we must compute approximate results attached to $E$.327328\fun{GEN}{ellR_ab}{GEN E, long prec} return $[a,b]$329330\fun{GEN}{ellR_omega}{GEN x, long prec} return periods331$[\omega_1,\omega_2]$.332333\fun{GEN}{ellR_eta}{GEN E, long prec} return quasi-periods334$[\eta_1,\eta_2]$.335336\fun{GEN}{ellR_area}{GEN x, long prec} return the area337$(\Im(\omega_1\*\overline{\omega_2}))$.338339\fun{GEN}{ellR_roots}{GEN E, long prec} return $[e_1,e_2,e_3]$. If $E$ is340defined over $\R$, then $e_1$ is real. If furthermore $\disc E > 0$, then341$e_1 > e_2 > e_3$.342343\fun{long}{ellR_get_sign}{GEN E} if $E$ is defined over $\R$ returns the344signe of its discriminant, otherwise return $0$.345346\subsec{Points}347348\fun{int}{ell_is_inf}{GEN z} tests whether the point $z$ is the point at349infinity.350351\fun{GEN}{ellinf}{} returns the point at infinity \kbd{[0]}.352353\subsec{Change of variables}354355\fun{GEN}{ellchangeinvert}{GEN w} given a change of variables $w =356[u,r,s,t]$, returns the inverse change of variables $w'$, such that if $E' =357\kbd{ellchangecurve(E, w)}$, then $E = \kbd{ellchangecurve}(E, w')$.358359\subsec{Generic helper functions}360361The naming scheme assumes an affine equation362$F(x,y) = f(x) - (y^2 + h(x)y) = 0$363in standard Weierstrass form: $f = x^3+a_2x^2+a_4x+a_6$, $h = a_1x + a_3$.364Unless mentionned otherwise, these routine assume that all arguments are365compatible with generic functions of \kbd{gadd} or \kbd{gmul} type. In366particular they do not handle elements in number field in \kbd{nfalgtobasis}367format.368369\fun{GEN}{ellbasechar}{GEN E} returns the characteristic of the base ring over370which $E$ is defined.371372\fun{GEN}{ec_bmodel}{GEN E} returns the polynomial $4x^3 + b_2x^2 + 2b_4x +373b_6$.374375\fun{GEN}{ec_phi2}{GEN E} returns the polynomial $x^4 - b_4x^2 - 2b_6*X - b_8$.376377\fun{GEN}{ec_f_evalx}{GEN E, GEN x} returns $f(x)$.378379\fun{GEN}{ec_h_evalx}{GEN E, GEN x} returns $h(x)$.380381\fun{GEN}{ec_dFdx_evalQ}{GEN E, GEN Q} returns $3x^2 + 2a_2x + a_4 -a_1y$,382where $Q = [x,y]$.383384\fun{GEN}{ec_dFdy_evalQ}{GEN E, GEN Q} returns $-(2y + a_1 x + a_3)$,385where $Q = [x,y]$.386387\fun{GEN}{ec_dmFdy_evalQ}{GEN e, GEN Q} returns $2y + a_1 x + a_3$,388where $Q = [x,y]$.389390\fun{GEN}{ec_2divpol_evalx}{GEN E, GEN x} returns391$4x^3 + b_2\*x^2 + 2\*b_4x + b_6$. This function supports inputs392in \kbd{nfalgtobasis} format.393394\fun{GEN}{ec_half_deriv_2divpol_evalx}{GEN E, GEN x} returns395$6\*x^2 + b_2\*x + b_4$.396397\fun{GEN}{ec_3divpol_evalx}{GEN E, GEN x} returns398$3\*x^4 + b_2\*x^2 + 3\*b_4\*x^2 + 3\*b_6\*x + b_8$.399400\subsec{Functions to handle elliptic curves over finite fields}401402\subsubsec{Tolerant routines}403404\fun{GEN}{ellap}{GEN E, GEN p} given a prime number $p$ and an elliptic curve405defined over $\Q$ or $\Q_p$ (assumed integral and minimal at $p$), computes406the trace of Frobenius $a_p = p+1 - \#E(\F_p)$. If $E$ is defined over407a nonprime finite field $\F_q$, ignore $p$ and return $q+1 - \#E(\F_q)$.408When $p$ is implied ($E$ defined over $\Q_p$ or a finite field), $p$ can be409omitted (set to \kbd{NULL}).410411\subsubsec{Curves defined a nonprime finite field}412In this subsection, we assume that \tet{ell_get_type}$(E)$ is \tet{t_ELL_Fq}.413(As noted above, a curve defined over $\Z/p\Z$ can be represented as a414\tet{t_ELL_Fq}.)415416\fun{GEN}{FF_elltwist}{GEN E} returns the coefficients417$[a_1,a_2,a_3,a_4,a_6]$ of the quadratic twist of $E$.418419\fun{GEN}{FF_ellmul}{GEN E, GEN P, GEN n} returns $[n]P$ where $n$ is an420integer and $P$ is a point on the curve $E$.421422\fun{GEN}{FF_ellrandom}{GEN E} returns a random point in $E(\F_q)$.423This function never returns the point at infinity, unless this is the424only point on the curve.425426\fun{GEN}{FF_ellorder}{GEN E, GEN P, GEN o} returns the order of the point427$P$, where $o$ is a multiple of the order of $P$, or its factorization.428429\fun{GEN}{FF_ellcard}{GEN E} returns $\#E(\F_q)$.430431\fun{GEN}{FF_ellcard_SEA}{GEN E, long s}432This function returns $\#E(\F_q)$, using the Schoof-Elkies-Atkin433algorithm. Assume $p\neq 2,3$.434The parameter $s$ has the same meaning as in \kbd{Fp\_ellcard\_SEA}.435436\fun{GEN}{FF_ellgens}{GEN E} returns the generators of the group $E(\F_q)$.437438\fun{GEN}{FF_elllog}{GEN E, GEN P, GEN G, GEN o} Let \kbd{G} be a point of439order \kbd{o}, return $e$ such that $[e]P=G$. If $e$ does not exists, the440result is undefined.441442\fun{GEN}{FF_ellgroup}{GEN E, GEN *pm} returns the structure of the Abelian443group $E(\F_q)$ and set \kbd{*pm} to $m$ (see \kbd{gen\_ellgens}).444445\fun{GEN}{FF_ellweilpairing}{GEN E, GEN P, GEN Q, GEN m} returns the446Weil pairing of the points of $m$-torsion $P$ and $Q$.447448\fun{GEN}{FF_elltatepairing}{GEN E, GEN P, GEN Q, GEN m} returns the Tate449pairing of $P$ and $Q$, where $[m]P = 0$.450451\section{Arithmetic on elliptic curve over a finite field in simple form}452453The functions in this section no longer operate on elliptic curve structures,454as seen up to now. They are used to implement those higher-level functions455without using cached information and thus require suitable explicitly456enumerated data.457458\subsec{Helper functions}459460\fun{GEN}{elltrace_extension}{GEN t, long n, GEN q} Let $E$ some elliptic curve461over $\F_q$ such that the trace of the Frobenius is $t$, returns the trace of462the Frobenius over $\F_q^n$.463464\subsec{Elliptic curves over $\F_p$, $p>3$}465466Let $p$ a prime number and $E$ the elliptic curve given by the equation467$E:y^2=x^3+a_4\*x+a_6$, with $a_4$ and $a_6$ in $\F_p$. A \kbd{FpE} is a468point of $E(\F_p)$. Since an affine point and $a_4$ determine an unique469$a6$, most functions do not take $a_6$ as an argument. A \kbd{FpE} is either470the point at infinity (\kbd{ellinf()}) or a $FpV$ whith two components. The471parameters $a_4$ and $a_6$ are given as \typ{INT}s when required.472473\fun{GEN}{Fp_ellj}{GEN a4, GEN a6, GEN p}474returns the $j$-invariant of the curve $E$.475476\fun{int}{Fp_elljissupersingular}{GEN j, GEN p} returns $1$ if $j$ is the477$j$-invariant of a supersingular curve over $\F_p$, $0$ otherwise.478479\fun{GEN}{Fp_ellcard}{GEN a4, GEN a6, GEN p} returns the cardinality of the480group $E(\F_p)$.481482\fun{GEN}{Fp_ellcard_SEA}{GEN a4, GEN a6, GEN p, long s}483This function returns $\#E(\F_p)$, using the Schoof-Elkies-Atkin algorithm.484If the \kbd{seadata} package is installed, the function will be faster.485486The extra flag \kbd{s}, if set to a nonzero value, causes the computation to487return \kbd{gen\_0} (an impossible cardinality) if one of the small primes488$\ell$ divides the curve order but does not divide $s$.489For cryptographic applications, where one is usually interested in curves of490prime order, setting $s=1$ efficiently weeds out most uninteresting curves; if491curves of order a power of $2$ times a prime are acceptable, set $s=2$.492If moreover \kbd{s} is negative, similar checks are performed for the493twist of the curve.494495\fun{GEN}{Fp_ffellcard}{GEN a4, GEN a6, GEN q, long n, GEN p} returns the496cardinality of the group $E(\F_q)$ where $q=p^n$.497498\fun{GEN}{Fp_ellgroup}{GEN a4, GEN a6, GEN N, GEN p, GEN *pm} returns the499group structure $D$ of the group $E(\F_p)$, which is assumed to be of order $N$500and set \kbd{*pm} to $m$.501502\fun{GEN}{Fp_ellgens}{GEN a4, GEN a6, GEN ch, GEN D, GEN m, GEN p} returns503generators of the group $E(\F_p)$ with the base change \kbd{ch} (see504\kbd{FpE\_changepoint}), where $D$ and $m$ are as returned by505\kbd{Fp\_ellgroup}.506507\fun{GEN}{Fp_elldivpol}{GEN a4, GEN a6, long n, GEN p} returns the $n$-division508polynomial of the elliptic curve $E$.509510\fun{void}{Fp_elltwist}{GEN a4, GEN a6, GEN p, GEN *pA4, GEN *pA6}511sets \kbd{*pA4} and \kbd{*pA6} to the corresponding parameters for the512quadratic twist of $E$.513514\subsec{\kbd{FpE}}515516\fun{GEN}{FpE_add}{GEN P, GEN Q, GEN a4, GEN p} returns the sum $P+Q$517in the group $E(\F_p)$, where $E$ is defined by $E:y^2=x^3+a_4\*x+a_6$,518for any value of $a_6$ compatible with the points given.519520\fun{GEN}{FpE_sub}{GEN P, GEN Q, GEN a4, GEN p} returns $P-Q$.521522\fun{GEN}{FpE_dbl}{GEN P, GEN a4, GEN p} returns $2.P$.523524\fun{GEN}{FpE_neg}{GEN P, GEN p} returns $-P$.525526\fun{GEN}{FpE_mul}{GEN P, GEN n, GEN a4, GEN p} return $n.P$.527528\fun{GEN}{FpE_changepoint}{GEN P, GEN m, GEN a4, GEN p} returns the image529$Q$ of the point $P$ on the curve $E:y^2=x^3+a_4\*x+a_6$ by the coordinate530change $m$ (which is a \kbd{FpV}).531532\fun{GEN}{FpE_changepointinv}{GEN P, GEN m, GEN a4, GEN p} returns the image533$Q$ on the curve $E:y^2=x^3+a_4\*x+a_6$ of the point $P$ by the inverse of the534coordinate change $m$ (which is a \kbd{FpV}).535536\fun{GEN}{random_FpE}{GEN a4, GEN a6, GEN p} returns a random point on537$E(\F_p)$, where $E$ is defined by $E:y^2=x^3+a_4\*x+a_6$.538539\fun{GEN}{FpE_order}{GEN P, GEN o, GEN a4, GEN p} returns the order of $P$ in540the group $E(\F_p)$, where $o$ is a multiple of the order of $P$, or its541factorization.542543\fun{GEN}{FpE_log}{GEN P, GEN G, GEN o, GEN a4, GEN p} Let \kbd{G} be a544point of order \kbd{o}, return $e$ such that $e.P=G$. If $e$ does not exists,545the result is currently undefined.546547\fun{GEN}{FpE_tatepairing}{GEN P, GEN Q, GEN m, GEN a4, GEN p} returns the548Tate pairing of the point of $m$-torsion $P$ and the point $Q$.549550\fun{GEN}{FpE_weilpairing}{GEN P, GEN Q, GEN m, GEN a4, GEN p} returns the551Weil pairing of the points of $m$-torsion $P$ and $Q$.552553\fun{GEN}{FpE_to_mod}{GEN P, GEN p} returns $P$ as a vector of \typ{INTMOD}s.554555\fun{GEN}{RgE_to_FpE}{GEN P, GEN p} returns the \kbd{FpE} obtained by applying556\kbd{Rg\_to\_Fp} coefficientwise.557558\subsec{\kbd{Fle}}559Let $p$ be a prime \kbd{ulong}, and $E$ the elliptic curve given by the560equation $E:y^2=x^3+a_4\*x+a_6$, where $a_4$ and $a_6$ are \kbd{ulong}.561A \kbd{Fle} is either the point at infinity (\kbd{ellinf()}), or a \kbd{Flv}562with two components $[x,y]$.563564\fun{long}{Fl_elltrace}{ulong a4, ulong a6, ulong p} returns the trace $t$ of565the Frobenius of $E(\F_p)$. The cardinality of $E(\F_p)$ is thus $p+1-t$,566which might not fit in an \kbd{ulong}.567568\fun{long}{Fl_elltrace_CM}{long CM, ulong a4, ulong a6, ulong p} as569\tet{Fl_elltrace}. If \kbd{CM} is $0$, use the standard algorithm; otherwise570assume the curve has CM by a principal imaginary quadratic order of571discriminant \kbd{CM} and use a faster algorithm. Useful when the curve is572the reduction of $E/\Q$, which has CM by a principal order, and we need the573trace of Frobenius for many distinct $p$, see \tet{ellQ_get_CM}.574575\fun{ulong}{Fl_elldisc}{ulong a4, ulong a6, ulong p}576returns the discriminant of the curve $E$.577578\fun{ulong}{Fl_elldisc_pre}{ulong a4, ulong a6, ulong p, ulong pi}579returns the discriminant of the curve $E$, assuming $pi$ is the pseudo inverse580of $p$.581582\fun{ulong}{Fl_ellj}{ulong a4, ulong a6, ulong p}583returns the $j$-invariant of the curve $E$.584585\fun{ulong}{Fl_ellj_pre}{ulong a4, ulong a6, ulong p, ulong pi}586returns the $j$-invariant of the curve $E$, assuming $pi$ is the pseudo inverse587of $p$.588589\fun{void}{Fl_ellj_to_a4a6}{ulong j, ulong p, ulong *pa4, ulong *pa6}590sets \kbd{*pa4} to $a_4$ and \kbd{*pa6} to $a_6$ where $a_4$ and $a_6$591define a fixed elliptic curve with $j$-invariant $j$.592593\fun{void}{Fl_elltwist}{ulong a4, ulong a6, ulong p, ulong *pA4, ulong *pA6}594set \kbd{*pA4} to $A_4$ and \kbd{*pA6} to $A_6$ where $A_4$ and $A_6$595define the twist of $E$.596597\fun{void}{Fl_elltwist_disc}{ulong a4, ulong a6, ulong D, ulong p, ulong *pA4,598ulong *pA6}599sets \kbd{*pA4} to $A_4$ and \kbd{*pA6} to $A_6$ where $A_4$ and $A_6$600define the twist of $E$ by the discriminant $D$.601602\fun{GEN}{Fl_ellptors}{ulong l, ulong N, ulong a4, ulong a6, ulong p}603return a basis of the $l$-torsion subgroup of $E$.604605\fun{GEN}{Fle_add}{GEN P, GEN Q, ulong a4, ulong p}606607\fun{GEN}{Fle_dbl}{GEN P, ulong a4, ulong p}608609\fun{GEN}{Fle_sub}{GEN P, GEN Q, ulong a4, ulong p}610611\fun{GEN}{Fle_mul}{GEN P, GEN n, ulong a4, ulong p}612613\fun{GEN}{Fle_mulu}{GEN P, ulong n, ulong a4, ulong p}614615\fun{GEN}{Fle_order}{GEN P, GEN o, ulong a4, ulong p}616617\fun{GEN}{Fle_log}{GEN P, GEN G, GEN o, ulong a4, ulong p}618619\fun{GEN}{Fle_tatepairing}{GEN P, GEN Q, ulong m, ulong a4, ulong p}620621\fun{GEN}{Fle_weilpairing}{GEN P, GEN Q, ulong m, ulong a4, ulong p}622623\fun{GEN}{random_Fle}{ulong a4, ulong a6, ulong p}624625\fun{GEN}{random_Fle_pre}{ulong a4, ulong a6, ulong p, ulong pi}626627\fun{GEN}{Fle_changepoint}{GEN x, GEN ch, ulong p}, \kbd{ch} is assumed628to give the change of coordinates $[u,r,s,t]$ as a \typ{VECSMALL}.629630\fun{GEN}{Fle_changepointinv}{GEN x, GEN ch, ulong p}, as \tet{Fle_changepoint}631632\subsec{\kbd{FpJ}}633634Let $p$ be a prime \typ{INT}, and $E$ the elliptic curve given by the635equation $E:y^2=x^3+a_4\*x+a_6$, where $a_4$ and $a_6$ are \typ{INT}.636A \kbd{FpJ} is a \kbd{FpV} with three components $[x,y,z]$, representing637the affine point $[x/z^2,y/z^3]$ in Jacobian coordinates, the point at638infinity being represented by $[1, 1, 0]$. The following must holds:639$y^2=x^3+a_4\*x\*z^4+a_6\*z^6$. For all nonzero $u$, the points640$[u^2\*x,u^3\*y,u\*z]$ and $[x,y,z]$ are representing the same affine point.641642\fun{GEN}{FpJ_add}{GEN P, GEN Q, GEN a4, GEN p}643644\fun{GEN}{FpJ_dbl}{GEN P, GEN a4, GEN p}645646\fun{GEN}{FpJ_mul}{GEN P, GEN n, GEN a4, GEN p};647648\fun{GEN}{FpJ_neg}{GEN P, GEN p} return $-P$.649650\fun{GEN}{FpJ_to_FpE}{GEN P, GEN p} return the corresponding \kbd{FpE}.651652\fun{GEN}{FpE_to_FpJ}{GEN P} return the corresponding \kbd{FpJ}.653654\subsec{\kbd{Flj}}655656Below, \kbd{pi} is assumed to be the precomputed inverse of $p$.657658\fun{GEN}{Fle_to_Flj}{GEN P} convert a \kbd{Fle} to an equivalent \kbd{Flj}.659660\fun{GEN}{Flj_to_Fle}{GEN P, ulong p} convert a \kbd{Flj} to the equivalent661\kbd{Fle}.662663\fun{GEN}{Flj_to_Fle_pre}{GEN P, ulong p, ulong pi} convert a \kbd{Flj} to the664equivalent \kbd{Fle}.665666\fun{GEN}{Flj_add_pre}{GEN P, GEN Q, ulong a4, ulong p, ulong pi}667668\fun{GEN}{Flj_dbl_pre}{GEN P, ulong a4, ulong p, ulong pi}669670\fun{GEN}{Flj_neg}{GEN P, ulong p} return $-P$.671672\fun{GEN}{Flj_mulu_pre}{GEN P, ulong n, ulong a4, ulong p, ulong pi}673674\fun{GEN}{random_Flj_pre}{ulong a4, ulong a6, ulong p, ulong pi}675676\fun{GEN}{Flj_changepointinv_pre}{GEN P, GEN ch, ulong p, ulong pi}677where \kbd{ch} is the \kbd{Flv} $[u,r,s,t]$.678679\fun{GEN}{FljV_factorback_pre}{GEN P, GEN L, ulong p, ulong pi}680681\subsec{Elliptic curves over $\F_{2^n}$}682Let $T$ be an irreducible \kbd{F2x} and $E$ the683elliptic curve given by either the equation684$E:y^2+x*y=x^3+a_2\*x^2+a_6$, where $a_2, a_6$ are \kbd{F2x} in685$\F_2[X]/(T)$ (ordinary case) or $E:y^2+a_3*y=x^3+a_4\*x+a_6$, where686$a_3, a_4, a_6$ are \kbd{F2x} in $\F_2[X]/(T)$ (supersingular case).687688A \kbd{F2xqE} is a point of $E(\F_2[X]/(T))$. In the supersingular case, the689parameter \kbd{a2} is actually the \typ{VEC} $[a_3,a_4,a_3^{-1}]$.690691\fun{GEN}{F2xq_ellcard}{GEN a2, GEN a6, GEN T}692Return the order of the group $E(\F_2[X]/(T))$.693694\fun{GEN}{F2xq_ellgroup}{GEN a2, GEN a6, GEN N, GEN T, GEN *pm}695Return the group structure $D$ of the group $E(\F_2[X]/(T))$,696which is assumed to be of order $N$ and set \kbd{*pm} to $m$.697698\fun{GEN}{F2xq_ellgens}{GEN a2, GEN a6, GEN ch, GEN D, GEN m, GEN T}699Returns generators of the group $E(\F_2[X]/(T))$ with the base change \kbd{ch}700(see \kbd{F2xqE\_changepoint}), where $D$ and $m$ are as returned by701\kbd{F2xq\_ellgroup}.702703\fun{void}{F2xq_elltwist}{GEN a4, GEN a6, GEN T, GEN *a4t, GEN *a6t}704sets \kbd{*a4t} and \kbd{*a6t} to the parameters of the quadratic twist of $E$.705706\subsec{\kbd{F2xqE}}707708\fun{GEN}{F2xqE_changepoint}{GEN P, GEN m, GEN a2, GEN T} returns the image709$Q$ of the point $P$ on the curve $E:y^2+x*y=x^3+a_2\*x^2+a_6$ by the coordinate710change $m$ (which is a \kbd{F2xqV}).711712\fun{GEN}{F2xqE_changepointinv}{GEN P, GEN m, GEN a2, GEN T} returns the image713$Q$ on the curve $E:y^2=x^3+a_4\*x+a_6$ of the point $P$ by the inverse of the714coordinate change $m$ (which is a \kbd{F2xqV}).715716\fun{GEN}{F2xqE_add}{GEN P, GEN Q, GEN a2, GEN T}717718\fun{GEN}{F2xqE_sub}{GEN P, GEN Q, GEN a2, GEN T}719720\fun{GEN}{F2xqE_dbl}{GEN P, GEN a2, GEN T}721722\fun{GEN}{F2xqE_neg}{GEN P, GEN a2, GEN T}723724\fun{GEN}{F2xqE_mul}{GEN P, GEN n, GEN a2, GEN T}725726\fun{GEN}{random_F2xqE}{GEN a2, GEN a6, GEN T}727728\fun{GEN}{F2xqE_order}{GEN P, GEN o, GEN a2, GEN T} returns the order of $P$ in729the group $E(\F_2[X]/(T))$, where $o$ is a multiple of the order of $P$, or its730factorization.731732\fun{GEN}{F2xqE_log}{GEN P, GEN G, GEN o, GEN a2, GEN T} Let \kbd{G} be a733point of order \kbd{o}, return $e$ such that $e.P=G$. If $e$ does not exists,734the result is currently undefined.735736\fun{GEN}{F2xqE_tatepairing}{GEN P, GEN Q, GEN m, GEN a2, GEN T} returns the737Tate pairing of the point of $m$-torsion $P$ and the point $Q$.738739\fun{GEN}{F2xqE_weilpairing}{GEN Q, GEN Q, GEN m, GEN a2, GEN T} returns the740Weil pairing of the points of $m$-torsion $P$ and $Q$.741742\fun{GEN}{RgE_to_F2xqE}{GEN P, GEN T} returns the \kbd{F2xqE} obtained by743applying \kbd{Rg\_to\_F2xq} coefficientwise.744745\subsec{Elliptic curves over $\F_q$, small characteristic $p>2$ }746Let $p > 2$ be a prime \kbd{ulong}, $T$ an irreducible \kbd{Flx} mod $p$, and747$E$ the elliptic curve given by the equation $E:y^2=x^3+a_4\*x+a_6$, where $a_4$748and $a_6$ are \kbd{Flx} in $\F_p[X]/(T)$. A \kbd{FlxqE} is a point of749$E(\F_p[X]/(T))$.750751In the special case $p = 3$, ordinary elliptic curves ($j(E)\neq 0$) cannot752be represented as above, but admit a model $E:y^2 = x^3+a_2\*x^2+a_6$ with753$a_2$ and $a_6$ being \kbd{Flx} in $\F_3[X]/(T)$. In that case, the parameter754\kbd{a2} is actually stored as a \typ{VEC}, $[a_2]$, to avoid ambiguities.755756\fun{GEN}{Flxq_ellj}{GEN a4, GEN a6, GEN T, ulong p}757returns the $j$-invariant of the curve $E$.758759\fun{void}{Flxq_ellj_to_a4a6}{GEN j, GEN T, ulong p, GEN *pa4, GEN *pa6}760sets \kbd{*pa4} to $a_4$ and \kbd{*pa6} to $a_6$ where $a_4$ and $a_6$761define a fixed elliptic curve with $j$-invariant $j$.762763\fun{GEN}{Flxq_ellcard}{GEN a4, GEN a6, GEN T, ulong p}764returns the order of $E(\F_p[X]/(T))$.765766\fun{GEN}{Flxq_ellgroup}{GEN a4, GEN a6, GEN N, GEN T, ulong p, GEN *pm}767returns the group structure $D$ of the group $E(\F_p[X]/(T))$,768which is assumed to be of order $N$ and sets \kbd{*pm} to $m$.769770\fun{GEN}{Flxq_ellgens}{GEN a4, GEN a6, GEN ch, GEN D, GEN m, GEN T, ulong p}771returns generators of the group $E(\F_p[X]/(T))$ with the base change \kbd{ch}772(see \kbd{FlxqE\_changepoint}), where $D$ and $m$ are as returned by773\kbd{Flxq\_ellgroup}.774775\fun{void}{Flxq_elltwist}{GEN a4, GEN a6, GEN T, ulong p, GEN *pA4, GEN *pA6}776sets \kbd{*pA4} and \kbd{*pA6} to the corresponding parameters for the777quadratic twist of $E$.778779\subsec{\kbd{FlxqE}}780781Let $p > 2$ be a prime number.782783\fun{GEN}{FlxqE_changepoint}{GEN P, GEN m, GEN a4, GEN T, ulong p} returns784the image $Q$ of the point $P$ on the curve $E:y^2=x^3+a_4\*x+a_6$ by the785coordinate change $m$ (which is a \kbd{FlxqV}).786787\fun{GEN}{FlxqE_changepointinv}{GEN P, GEN m, GEN a4, GEN T, ulong p} returns788the image $Q$ on the curve $E:y^2=x^3+a_4\*x+a_6$ of the point $P$ by the789inverse of the coordinate change $m$ (which is a \kbd{FlxqV}).790791\fun{GEN}{FlxqE_add}{GEN P, GEN Q, GEN a4, GEN T, ulong p}792793\fun{GEN}{FlxqE_sub}{GEN P, GEN Q, GEN a4, GEN T, ulong p}794795\fun{GEN}{FlxqE_dbl}{GEN P, GEN a4, GEN T, ulong p}796797\fun{GEN}{FlxqE_neg}{GEN P, GEN T, ulong p}798799\fun{GEN}{FlxqE_mul}{GEN P, GEN n, GEN a4, GEN T, ulong p}800801\fun{GEN}{random_FlxqE}{GEN a4, GEN a6, GEN T, ulong p}802803\fun{GEN}{FlxqE_order}{GEN P, GEN o, GEN a4, GEN T, ulong p} returns the804order of $P$ in the group $E(\F_p[X]/(T))$, where $o$ is a multiple of the805order of $P$, or its factorization.806807\fun{GEN}{FlxqE_log}{GEN P, GEN G, GEN o, GEN a4, GEN T, ulong p} Let \kbd{G}808be a point of order \kbd{o}, return $e$ such that $e.P=G$. If $e$ does not809exists, the result is currently undefined.810811\fun{GEN}{FlxqE_tatepairing}{GEN P, GEN Q, GEN m, GEN a4, GEN T, ulong p}812returns the Tate pairing of the point of $m$-torsion $P$ and the point $Q$.813814\fun{GEN}{FlxqE_weilpairing}{GEN P, GEN Q, GEN m, GEN a4, GEN T, ulong p}815returns the Weil pairing of the points of $m$-torsion $P$ and $Q$.816817\fun{GEN}{RgE_to_FlxqE}{GEN P, GEN T, ulong p} returns the \kbd{FlxqE}818obtained by applying \kbd{Rg\_to\_Flxq} coefficientwise.819820\subsec{Elliptic curves over $\F_q$, large characteristic }821822Let $p > 3$ be a prime number, $T$ an irreducible polynomial mod $p$, and $E$823the elliptic curve given by the equation $E:y^2=x^3+a_4\*x+a_6$ with $a_4$ and824$a_6$ in $\F_p[X]/(T)$. A \kbd{FpXQE} is a point of $E(\F_p[X]/(T))$.825826\fun{GEN}{FpXQ_ellj}{GEN a4, GEN a6, GEN T, GEN p}827returns the $j$-invariant of the curve $E$.828829\fun{int}{FpXQ_elljissupersingular}{GEN j, GEN T, GEN p} returns $1$ if $j$ is830the $j$-invariant of a supersingular curve over $\F_p[X]/(T)$, $0$ otherwise.831832\fun{GEN}{FpXQ_ellcard}{GEN a4, GEN a6, GEN T, GEN p}833returns the order of $E(\F_p[X]/(T))$.834835\fun{GEN}{Fq_ellcard_SEA}{GEN a4, GEN a6, GEN q, GEN T, GEN p, long s}836This function returns $\#E(\F_p[X]/(T))$, using the Schoof-Elkies-Atkin837algorithm.838Assume $p\neq 2,3$, and $q$ is the cardinality of $\F_p[X]/(T)$.839The parameter $s$ has the same meaning as in \kbd{Fp\_ellcard\_SEA}.840If the \kbd{seadata} package is installed, the function will be faster.841842\fun{GEN}{FpXQ_ellgroup}{GEN a4, GEN a6, GEN N, GEN T, GEN p, GEN *pm}843Return the group structure $D$ of the group $E(\F_p[X]/(T))$,844which is assumed to be of order $N$ and set \kbd{*pm} to $m$.845846\fun{GEN}{FpXQ_ellgens}{GEN a4, GEN a6, GEN ch, GEN D, GEN m, GEN T, GEN p}847Returns generators of the group $E(\F_p[X]/(T))$ with the base change \kbd{ch}848(see \kbd{FpXQE\_changepoint}), where $D$ and $m$ are as returned by849\kbd{FpXQ\_ellgroup}.850851\fun{GEN}{FpXQ_elldivpol}{GEN a4, GEN a6, long n, GEN T, GEN p} returns the852$n$-division polynomial of the elliptic curve $E$.853854\fun{GEN}{Fq_elldivpolmod}{GEN a4,GEN a6, long n, GEN h, GEN T, GEN p}855returns the $n$-division polynomial of the elliptic curve $E$ modulo the856polynomial $h$.857858\fun{void}{FpXQ_elltwist}{GEN a4, GEN a6, GEN T, GEN p, GEN *pA4, GEN *pA6}859sets \kbd{*pA4} and \kbd{*pA6} to the corresponding parameters for the860quadratic twist of $E$.861862\subsec{\kbd{FpXQE}}863864\fun{GEN}{FpXQE_changepoint}{GEN P, GEN m, GEN a4, GEN T, GEN p} returns the865image $Q$ of the point $P$ on the curve $E:y^2=x^3+a_4\*x+a_6$ by the866coordinate change $m$ (which is a \kbd{FpXQV}).867868\fun{GEN}{FpXQE_changepointinv}{GEN P, GEN m, GEN a4, GEN T, GEN p} returns869the image $Q$ on the curve $E:y^2=x^3+a_4\*x+a_6$ of the point $P$ by the870inverse of the coordinate change $m$ (which is a \kbd{FpXQV}).871872\fun{GEN}{FpXQE_add}{GEN P, GEN Q, GEN a4, GEN T, GEN p}873874\fun{GEN}{FpXQE_sub}{GEN P, GEN Q, GEN a4, GEN T, GEN p}875876\fun{GEN}{FpXQE_dbl}{GEN P, GEN a4, GEN T, GEN p}877878\fun{GEN}{FpXQE_neg}{GEN P, GEN T, GEN p}879880\fun{GEN}{FpXQE_mul}{GEN P, GEN n, GEN a4, GEN T, GEN p}881882\fun{GEN}{random_FpXQE}{GEN a4, GEN a6, GEN T, GEN p}883884\fun{GEN}{FpXQE_log}{GEN P, GEN G, GEN o, GEN a4, GEN T, GEN p} Let \kbd{G} be a885point of order \kbd{o}, return $e$ such that $e.P=G$. If $e$ does not exists,886the result is currently undefined.887888\fun{GEN}{FpXQE_order}{GEN P, GEN o, GEN a4, GEN T, GEN p} returns the order889of $P$ in the group $E(\F_p[X]/(T))$, where $o$ is a multiple of the order of890$P$, or its factorization.891892\fun{GEN}{FpXQE_tatepairing}{GEN P,GEN Q, GEN m, GEN a4, GEN T, GEN p}893returns the Tate pairing of the point of $m$-torsion $P$ and the point $Q$.894895\fun{GEN}{FpXQE_weilpairing}{GEN P,GEN Q, GEN m, GEN a4, GEN T, GEN p}896returns the Weil pairing of the points of $m$-torsion $P$ and $Q$.897898\fun{GEN}{RgE_to_FpXQE}{GEN P, GEN T, GEN p} returns the \kbd{FpXQE} obtained899by applying \kbd{Rg\_to\_FpXQ} coefficientwise.900901\section{Functions related to modular polynomials}902903Variants of \tet{polmodular}, returning the modular polynomial of prime904level $L$ for the invariant coded by \kbd{inv} (0: $j$, 1: Weber-$f$, see905\tet{polclass} for the full list).906907\fun{GEN}{polmodular_ZXX}{long L, long inv, long xvar, long yvar}908returns a bivariate polynomial in variables \kbd{xvar} and909\kbd{yvar}.910911\fun{GEN}{polmodular_ZM}{long L, long inv} returns a matrix of912(integral) coefficients.913914\fun{GEN}{Fp_polmodular_evalx}{long L, long inv, GEN J, GEN p, long v,915int derivs} returns the modular polynomial evaluated916at $J$ modulo the prime $p$ in the variable $v$ (if \kbd{derivs} is nonzero,917returns a vector containing the modular polynomial and its first and second918derivatives, all evaluated at $J$ modulo~$p$).919920\subsec{Functions related to modular invariants}921922\fun{void}{check_modinv}{long inv} report an error if \kbd{inv} is not a923valid code for a mdular invariant.924925\fun{int}{modinv_good_disc}{long inv, long D} test whether the926invariant \kbd{inv} is defined for the discriminant \kbd{D}.927928\fun{int}{modinv_good_prime}{long inv, long D} test whether the929invariant \kbd{inv} is defined for the prime \kbd{p}.930931\fun{long}{modinv_height_factor}{long inv} return the height factor932of the modular invariant \kbd{inv} with respect to the $j$-invariant.933This is an integer $n$ such that the $j$-invariant is asymptotically934of the order of the $n$-th power of the invariant \kbd{inv}.935936\fun{long}{modinv_is_Weber}{long inv} test whether the invariant937\kbd{inv} is a power of Weber $f$.938939\fun{long}{modinv_is_double_eta}{long inv} test whether the invariant940\kbd{inv} is a double $\eta$ quotient.941942\fun{long}{disc_best_modinv}{long D} the integer $D$ being a negative discriminant,943return the modular invariant compatible with $D$ with the highest height944factor.945946\fun{GEN}{Fp_modinv_to_j}{GEN x, long inv, GEN p} Let $\Phi$ the modular equation947between $j$ and the modular invariant \kbd{inv}, return $y$ such that948$\Phi(y,x)=0\pmod{p}$.949950\section{Other curves}951952The following functions deal with hyperelliptic curves in weighted projective953space $\P_{(1,d,1)}$, with coordinates $(x,y,z)$ and a model of the form954$ y^2 = T(x,z)$, where $T$ is homogeneous of degree $2d$, and squarefree.955Thus the curve is nonsingular of genus $d-1$.956957\fun{long}{hyperell_locally_soluble}{GEN T, GEN p} assumes that $T\in\Z[X]$ is958integral. Returns $1$ if the curve is locally soluble over $\Q_p$, $0$959otherwise.960961\fun{long}{nf_hyperell_locally_soluble}{GEN nf, GEN T, GEN pr} let $K$962be a number field, attached to \kbd{nf}, \kbd{pr} a \var{prid} attached963to some maximal ideal $\goth{p}$; assumes that $T\in\Z_K[X]$ is integral.964Returns $1$ if the curve is locally soluble over $K_{\goth{p}}$.965966\newpage967968969