bridge/class-master/depend/pari/src/modules/algebras.c
/* return v(x) at all primes in listpr, replace x by cofactor */
return v(x) at all primes in listpr, replace x by cofactor
return v ( x ) at all primes in listpr replace x by cofactor
static GEN
nfmakecoprime(GEN nf, GEN *px, GEN listpr)
{
  long j, l = lg(listpr);
  GEN x1, x = *px, L = cgetg(l, t_COL);
  if (typ(x) != t_MAT)
  { 
    x1 = NULL;
    for (j=1; j<l; j++)
    {
      GEN pr = gel(listpr,j), e;
      long v = nfval(nf, x, pr);
      e = stoi(v); gel(L,j) = e;
      if (v) x1 = x1? idealmulpowprime(nf, x1, pr, e)
                    : idealpow(nf, pr, e);
    }
    if (x1) x = idealdivexact(nf, idealhnf(nf,x), x1);
  }
  else
  { 
    for (j=1; j<l; j++)
    {
      GEN pr = gel(listpr,j);
      long v = idealval(nf, x, pr);
      gel(L,j) = stoi(v);
      if (v) x = idealmulpowprime(nf, x, pr, stoi(-v));
    }
  }
  *px = x; return L;
}
static GEN nfmakecoprime ( GEN nf , GEN * px , GEN listpr ) { long j , l = lg ( listpr ) ; GEN x1 , x = * px , L = cgetg ( l , t_COL ) ; if ( typ ( x ) != t_MAT ) { x1 = NULL ; for ( j = 1 ; j < l ; j ++ ) { GEN pr = gel ( listpr , j ) , e ; long v = nfval ( nf , x , pr ) ; e = stoi ( v ) ; gel ( L , j ) = e ; if ( v ) x1 = x1 ? idealmulpowprime ( nf , x1 , pr , e ) : idealpow ( nf , pr , e ) ; } if ( x1 ) x = idealdivexact ( nf , idealhnf ( nf , x ) , x1 ) ; } else { for ( j = 1 ; j < l ; j ++ ) { GEN pr = gel ( listpr , j ) ; long v = idealval ( nf , x , pr ) ; gel ( L , j ) = stoi ( v ) ; if ( v ) x = idealmulpowprime ( nf , x , pr , stoi ( - v ) ) ; } } * px = x ; return L ; }
return v(x) at all primes in listpr, replace x by cofactor
return v ( x ) at all primes in listpr replace x by cofactor
/* scalar, divide at the end (fast valuation) */ /* HNF, divide as we proceed (reduce size) */