bridge/class-master/depend/pari/src/basemath/base3.c
/* Compute z^n in nf, left-shift binary powering */
Compute z^n in nf, left-shift binary powering
Compute z^n in nf left - shift binary powering
GEN
nfpow_u(GEN nf, GEN z, ulong n)
{
  pari_sp av = avma;
  GEN x, cx;
  nf = checknf(nf);
  if (!n) return gen_1;
  x = nf_to_scalar_or_basis(nf, z);
  if (typ(x) != t_COL) return gpowgs(x,n);
  x = primitive_part(x, &cx);
  x = gen_powu(x, n, (void*)nf, _sqr, _mul);
  if (cx) x = gmul(x, powgi(cx, utoipos(n)));
  return av==avma? gcopy(x): gerepileupto(av,x);
}
GEN nfpow_u ( GEN nf , GEN z , ulong n ) { pari_sp av = avma ; GEN x , cx ; nf = checknf ( nf ) ; if ( ! n ) return gen_1 ; x = nf_to_scalar_or_basis ( nf , z ) ; if ( typ ( x ) != t_COL ) return gpowgs ( x , n ) ; x = primitive_part ( x , & cx ) ; x = gen_powu ( x , n , ( void * ) nf , _sqr , _mul ) ; if ( cx ) x = gmul ( x , powgi ( cx , utoipos ( n ) ) ) ; return av == avma ? gcopy ( x ) : gerepileupto ( av , x ) ; }
Compute z^n in nf, left-shift binary powering
Compute z^n in nf left - shift binary powering