bridge/class-master/depend/pari/src/basemath/ecpp.c
/* Convert the disc. factorisation of a genus field to the
 * disc. factorisation of its real part. */
Convert the disc. factorisation of a genus field to the
disc. factorisation of its real part.
Convert the disc . factorisation of a genus field to the disc . factorisation of its real part .
static GEN
realgenusfield(GEN Dfac, GEN sq, GEN p)
{
  long i, j, l = lg(Dfac), dn, n = 0;
  GEN sn, s = gen_0, R = cgetg(l-1, t_VECSMALL);
  for (i = 1; i < l; i++)
    if (Dfac[i] < 0) { n = i; break; }
  if (n == 0) pari_err_BUG("realgenusfield");
  dn = Dfac[n]; sn = gel(sq, n);
  for (j = i = 1; i < l; i++)
    if (i != n)
    {
      long d = Dfac[i];
      GEN si = gel(sq,i);
      R[j++] = d > 0 ? d : d * dn;
      s = Fp_add(s, d > 0? si: Fp_mul(si, sn, p), p);
    }
  return mkvec2(R, s);
}
static GEN realgenusfield ( GEN Dfac , GEN sq , GEN p ) { long i , j , l = lg ( Dfac ) , dn , n = 0 ; GEN sn , s = gen_0 , R = cgetg ( l - 1 , t_VECSMALL ) ; for ( i = 1 ; i < l ; i ++ ) if ( Dfac [ i ] < 0 ) { n = i ; break ; } if ( n == 0 ) pari_err_BUG ( " " ) ; dn = Dfac [ n ] ; sn = gel ( sq , n ) ; for ( j = i = 1 ; i < l ; i ++ ) if ( i != n ) { long d = Dfac [ i ] ; GEN si = gel ( sq , i ) ; R [ j ++ ] = d > 0 ? d : d * dn ; s = Fp_add ( s , d > 0 ? si : Fp_mul ( si , sn , p ) , p ) ; } return mkvec2 ( R , s ) ; }
Convert the disc.
Convert the disc .