bridge/class-master/depend/pari/src/basemath/F2xqE.c
/* Finds a random non-singular point on E */
Finds a random non-singular point on E
Finds a random non - singular point on E
GEN
random_F2xqE(GEN a, GEN a6, GEN T)
{
  pari_sp ltop = avma;
  GEN x, y, rhs, u;
  do
  {
    avma= ltop;
    x   = random_F2x(F2x_degree(T),T[1]);
    if (typ(a) == t_VECSMALL)
    {
      GEN a2 = a, x2;
      if (!lgpol(x))
        { avma=ltop; retmkvec2(pol0_Flx(T[1]), F2xq_sqrt(a6,T)); }
      u = x; x2  = F2xq_sqr(x, T);
      rhs = F2x_add(F2xq_mul(x2,F2x_add(x,a2),T),a6);
      rhs = F2xq_div(rhs,x2,T);
    }
    else
    {
      GEN a3 = gel(a,1), a4 = gel(a,2), a3i = gel(a,3), u2i;
      u = a3; u2i = F2xq_sqr(a3i,T);
      rhs = F2x_add(F2xq_mul(x,F2x_add(F2xq_sqr(x,T),a4),T),a6);
      rhs = F2xq_mul(rhs,u2i,T);
    }
  } while (F2xq_trace(rhs,T));
  y = F2xq_mul(F2xq_Artin_Schreier(rhs, T), u, T);
  return gerepilecopy(ltop, mkvec2(x, y));
}
GEN random_F2xqE ( GEN a , GEN a6 , GEN T ) { pari_sp ltop = avma ; GEN x , y , rhs , u ; do { avma = ltop ; x = random_F2x ( F2x_degree ( T ) , T [ 1 ] ) ; if ( typ ( a ) == t_VECSMALL ) { GEN a2 = a , x2 ; if ( ! lgpol ( x ) ) { avma = ltop ; retmkvec2 ( pol0_Flx ( T [ 1 ] ) , F2xq_sqrt ( a6 , T ) ) ; } u = x ; x2 = F2xq_sqr ( x , T ) ; rhs = F2x_add ( F2xq_mul ( x2 , F2x_add ( x , a2 ) , T ) , a6 ) ; rhs = F2xq_div ( rhs , x2 , T ) ; } else { GEN a3 = gel ( a , 1 ) , a4 = gel ( a , 2 ) , a3i = gel ( a , 3 ) , u2i ; u = a3 ; u2i = F2xq_sqr ( a3i , T ) ; rhs = F2x_add ( F2xq_mul ( x , F2x_add ( F2xq_sqr ( x , T ) , a4 ) , T ) , a6 ) ; rhs = F2xq_mul ( rhs , u2i , T ) ; } } while ( F2xq_trace ( rhs , T ) ) ; y = F2xq_mul ( F2xq_Artin_Schreier ( rhs , T ) , u , T ) ; return gerepilecopy ( ltop , mkvec2 ( x , y ) ) ; }
Finds a random non-singular point on E
Finds a random non - singular point on E