bridge/class-master/depend/pari/src/basemath/nffactor.c
/* return a minimal lift of elt modulo id, as a ZC */
return a minimal lift of elt modulo id, as a ZC
return a minimal lift of elt modulo id as a ZC
static GEN
nf_bestlift(GEN elt, GEN bound, nflift_t *L)
{
  GEN u;
  long i,l = lg(L->prk), t = typ(elt);
  if (t != t_INT)
  {
    if (t == t_POL) elt = ZM_ZX_mul(L->tozk, elt);
    u = ZM_ZC_mul(L->iprk,elt);
    for (i=1; i<l; i++) gel(u,i) = diviiround(gel(u,i), L->pk);
  }
  else
  {
    u = ZC_Z_mul(gel(L->iprk,1), elt);
    for (i=1; i<l; i++) gel(u,i) = diviiround(gel(u,i), L->pk);
    elt = scalarcol(elt, l-1);
  }
  u = ZC_sub(elt, ZM_ZC_mul(L->prk, u));
  if (bound && gcmp(_norml2(u), bound) > 0) u = NULL;
  return u;
}
static GEN nf_bestlift ( GEN elt , GEN bound , nflift_t * L ) { GEN u ; long i , l = lg ( L -> prk ) , t = typ ( elt ) ; if ( t != t_INT ) { if ( t == t_POL ) elt = ZM_ZX_mul ( L -> tozk , elt ) ; u = ZM_ZC_mul ( L -> iprk , elt ) ; for ( i = 1 ; i < l ; i ++ ) gel ( u , i ) = diviiround ( gel ( u , i ) , L -> pk ) ; } else { u = ZC_Z_mul ( gel ( L -> iprk , 1 ) , elt ) ; for ( i = 1 ; i < l ; i ++ ) gel ( u , i ) = diviiround ( gel ( u , i ) , L -> pk ) ; elt = scalarcol ( elt , l - 1 ) ; } u = ZC_sub ( elt , ZM_ZC_mul ( L -> prk , u ) ) ; if ( bound && gcmp ( _norml2 ( u ) , bound ) > 0 ) u = NULL ; return u ; }
return a minimal lift of elt modulo id, as a ZC
return a minimal lift of elt modulo id as a ZC