bridge/class-master/depend/pari/src/basemath/ellisog.c
/* Given an isogeny phi from ellisogeny() and a point P in the domain of phi,
 * return phi(P) */
Given an isogeny phi from ellisogeny() and a point P in the domain of phi,
return phi(P)
Given an isogeny phi from ellisogeny () and a point P in the domain of phi return phi ( P )
GEN
ellisogenyapply(GEN phi, GEN P)
{
  pari_sp ltop = avma;
  GEN f, g, h, img_f, img_g, img_h, img_h2, img_h3, img, tmp;
  long vx, vy;
  if (lg(P) == 4) return ellcompisog(phi,P);
  checkellisog(phi);
  checkellpt(P);
  if (ell_is_inf(P)) return ellinf();
  f = gel(phi, 1);
  g = gel(phi, 2);
  h = gel(phi, 3);
  get_isog_vars(phi, &vx, &vy);
  img_h = poleval(h, gel(P, 1));
  if (gequal0(img_h)) { avma = ltop; return ellinf(); }
  img_h2 = gsqr(img_h);
  img_h3 = gmul(img_h, img_h2);
  img_f = poleval(f, gel(P, 1));
  tmp = gsubst(g, vx, gel(P, 1));
  img_g = gsubst(tmp, vy, gel(P, 2));
  img = cgetg(3, t_VEC);
  gel(img, 1) = gdiv(img_f, img_h2);
  gel(img, 2) = gdiv(img_g, img_h3);
  return gerepileupto(ltop, img);
}
GEN ellisogenyapply ( GEN phi , GEN P ) { pari_sp ltop = avma ; GEN f , g , h , img_f , img_g , img_h , img_h2 , img_h3 , img , tmp ; long vx , vy ; if ( lg ( P ) == 4 ) return ellcompisog ( phi , P ) ; checkellisog ( phi ) ; checkellpt ( P ) ; if ( ell_is_inf ( P ) ) return ellinf ( ) ; f = gel ( phi , 1 ) ; g = gel ( phi , 2 ) ; h = gel ( phi , 3 ) ; get_isog_vars ( phi , & vx , & vy ) ; img_h = poleval ( h , gel ( P , 1 ) ) ; if ( gequal0 ( img_h ) ) { avma = ltop ; return ellinf ( ) ; } img_h2 = gsqr ( img_h ) ; img_h3 = gmul ( img_h , img_h2 ) ; img_f = poleval ( f , gel ( P , 1 ) ) ; tmp = gsubst ( g , vx , gel ( P , 1 ) ) ; img_g = gsubst ( tmp , vy , gel ( P , 2 ) ) ; img = cgetg ( 3 , t_VEC ) ; gel ( img , 1 ) = gdiv ( img_f , img_h2 ) ; gel ( img , 2 ) = gdiv ( img_g , img_h3 ) ; return gerepileupto ( ltop , img ) ; }
Given an isogeny phi from ellisogeny() and a point P in the domain of phi,
 return phi(P)
Given an isogeny phi from ellisogeny () and a point P in the domain of phi return phi ( P )
/* FIXME: This calculation of g is perhaps not as efficient as it could be */