Function: elltors
Section: elliptic_curves
C-Name: elltors0
Prototype: GD0,L,
Help: elltors(E,{flag=0}): torsion subgroup of elliptic curve E: order,
 structure, generators. If flag = 0, use division polynomials; if flag = 1, use
 Lutz-Nagell; if flag = 2, use Doud's algorithm.
Doc:
 if $E$ is an elliptic curve \emph{defined over $\Q$}, outputs the torsion
 subgroup of $E$ as a 3-component vector \kbd{[t,v1,v2]}, where \kbd{t} is the
 order of the torsion group, \kbd{v1} gives the structure of the torsion group
 as a product of cyclic groups (sorted by decreasing order), and \kbd{v2}
 gives generators for these cyclic groups. $E$ must be an \var{ell} structure
 as output by \kbd{ellinit}, defined over $\Q$.

 \bprog
 ?  E = ellinit([-1,0]);
 ?  elltors(E)
 %1 = [4, [2, 2], [[0, 0], [1, 0]]]
 @eprog
 Here, the torsion subgroup is isomorphic to $\Z/2\Z \times \Z/2\Z$, with
 generators $[0,0]$ and $[1,0]$.

 If $\fl = 0$, find rational roots of division polynomials.

 If $\fl = 1$, use Lutz-Nagell (\emph{much} slower).

 If $\fl = 2$, use Doud's algorithm: bound torsion by computing $\#E(\F_p)$
 for small primes of good reduction, then look for torsion points using
 Weierstrass $\wp$ function (and Mazur's classification). For this variant,
 $E$ must be an \var{ell}.
Variant: Also available is \fun{GEN}{elltors}{GEN E} for \kbd{elltors(E, 0)}.
