bridge/class-master/depend/pari/src/basemath/ellisog.c
/* deg h =3; full 2-torsion contribution. NB: assume h is monic; base field
 * characteristic is odd or zero (cannot happen in char 2).*/
deg h =3; full 2-torsion contribution. NB: assume h is monic; base field
characteristic is odd or zero (cannot happen in char 2).
deg h = 3 ; full 2 - torsion contribution . NB : assume h is monic ; base field characteristic is odd or zero ( cannot happen in char 2 ) .
static GEN
contrib_full_tors(GEN E, GEN h, long only_image, long vx, long vy)
{
  GEN p1, p2, p3, half_b2, half_b4, t, w, f, g;
  first_three_power_sums(h, &p1,&p2,&p3);
  half_b2 = gmul2n(ell_get_b2(E), -1);
  half_b4 = gmul2n(ell_get_b4(E), -1);
  t = gadd(gmulsg(3L, gadd(p2, half_b4)), gmul(p1, half_b2));
  w = gadd(gmulsg(3L, p3), gadd(gmul(p2, half_b2),
                                gmul(p1, half_b4)));
  if (only_image) return mkvec2(t,w);
  {
    GEN a1 = ell_get_a1(E), a3 = ell_get_a3(E), t1, t2;
    GEN s1 = gneg(RgX_coeff(h, 2));
    GEN dh = RgX_deriv(h);
    GEN psi2xy = gadd(deg1pol_shallow(a1, a3, vx),
                      deg1pol_shallow(gen_2, gen_0, vy));
    t1 = RgX_mul(h, gmulsg(-3, deg1pol(stoi(3), gadd(half_b2, s1), vx)));
    t2 = mkpoln(3, stoi(3), half_b2, half_b4);
    setvarn(t2, vx);
    t2 = RgX_mul(dh, t2);
    f = RgX_add(t1, t2);
    t1 = RgX_sub(RgX_mul(RgX_deriv(f), h), RgX_mul(f, dh));
    t2 = RgX_mul(h, RgX_add(RgX_Rg_mul(f, a1), RgX_Rg_mul(h, a3)));
    g = RgX_divs(gsub(gmul(psi2xy, t1), t2), 2L);
    f = RgX_mul(f, h);
    g = RgX_mul(g, h);
  }
  return mkvec5(t, w, f, g, h);
}
static GEN contrib_full_tors ( GEN E , GEN h , long only_image , long vx , long vy ) { GEN p1 , p2 , p3 , half_b2 , half_b4 , t , w , f , g ; first_three_power_sums ( h , & p1 , & p2 , & p3 ) ; half_b2 = gmul2n ( ell_get_b2 ( E ) , -1 ) ; half_b4 = gmul2n ( ell_get_b4 ( E ) , -1 ) ; t = gadd ( gmulsg ( 3L , gadd ( p2 , half_b4 ) ) , gmul ( p1 , half_b2 ) ) ; w = gadd ( gmulsg ( 3L , p3 ) , gadd ( gmul ( p2 , half_b2 ) , gmul ( p1 , half_b4 ) ) ) ; if ( only_image ) return mkvec2 ( t , w ) ; { GEN a1 = ell_get_a1 ( E ) , a3 = ell_get_a3 ( E ) , t1 , t2 ; GEN s1 = gneg ( RgX_coeff ( h , 2 ) ) ; GEN dh = RgX_deriv ( h ) ; GEN psi2xy = gadd ( deg1pol_shallow ( a1 , a3 , vx ) , deg1pol_shallow ( gen_2 , gen_0 , vy ) ) ; t1 = RgX_mul ( h , gmulsg ( -3 , deg1pol ( stoi ( 3 ) , gadd ( half_b2 , s1 ) , vx ) ) ) ; t2 = mkpoln ( 3 , stoi ( 3 ) , half_b2 , half_b4 ) ; setvarn ( t2 , vx ) ; t2 = RgX_mul ( dh , t2 ) ; f = RgX_add ( t1 , t2 ) ; t1 = RgX_sub ( RgX_mul ( RgX_deriv ( f ) , h ) , RgX_mul ( f , dh ) ) ; t2 = RgX_mul ( h , RgX_add ( RgX_Rg_mul ( f , a1 ) , RgX_Rg_mul ( h , a3 ) ) ) ; g = RgX_divs ( gsub ( gmul ( psi2xy , t1 ) , t2 ) , 2L ) ; f = RgX_mul ( f , h ) ; g = RgX_mul ( g , h ) ; } return mkvec5 ( t , w , f , g , h ) ; }
deg h =3; full 2-torsion contribution.
deg h = 3 ; full 2 - torsion contribution .
/* t = 3*(p2 + b4/2) + p1 * b2/2 */ /* w = 3 * p3 + p2 * b2/2 + p1 * b4/2 */ /* Compute isogeny */ /* f = -3 (3 x + b2/2 + s1) h + (3 x^2 + (b2/2) x + (b4/2)) h'*/ /* 2g = psi2xy * (f'*h - f*h') - (a1*f + a3*h) * h; */