bridge/class-master/depend/pari/src/basemath/mftrace.c
/* Append to v all dihedral weight 1 forms coming from D, if fundamental.
 * level in [l1, l2] */
Append to v all dihedral weight 1 forms coming from D, if fundamental.
Append to v all dihedral weight 1 forms coming from D if fundamental .
static void
append_dihedral(GEN v, long D, long l1, long l2)
{
  long Da = labs(D), no, N, i, numi, ct, min, max;
  GEN bnf, con, LI, resall, varch;
  pari_sp av;
  max = l2 / Da;
  if (l1 == l2)
  { 
    min = max;
    if (D > 0 && min < 3) return;
  }
  else 
    min = (l1 + Da-1)/Da;
  if (!sisfundamental(D)) return;
  av = avma;
  bnf = dihan_bnf(D);
  con = gel(galoisconj(bnf,gen_1), 2);
  LI = ideallist(bnf, max);
  numi = 0; for (i = min; i <= max; i++) numi += lg(gel(LI, i)) - 1;
  if (D > 0)
  {
    numi <<= 1;
    varch = mkvec2(mkvec2(gen_1,gen_0), mkvec2(gen_0,gen_1));
  }
  else
    varch = NULL;
  resall = cgetg(numi+1, t_VEC); ct = 1;
  for (no = min; no <= max; no++)
  {
    GEN LIs, znN, conreyN, kroconreyN;
    long flcond, lgc, lglis;
    if (D < 0)
      flcond = (no == 2 || no == 3 || (no == 4 && (D&7L)==1));
    else
      flcond = (no == 4 && (D&7L) != 1);
    if (flcond) continue;
    LIs = gel(LI, no);
    N = Da*no;
    znN = znstar0(utoi(N), 1);
    conreyN = znstar_get_conreygen(znN); lgc = lg(conreyN);
    kroconreyN = cgetg(lgc, t_VECSMALL);
    for (i = 1; i < lgc; i++) kroconreyN[i] = krosi(D, gel(conreyN, i));
    lglis = lg(LIs);
    for (i = 1; i < lglis; i++)
    {
      GEN id = gel(LIs, i), idcon, conk;
      long j, inf, maxinf;
      if (typ(id) == t_INT) continue;
      idcon = galoisapply(bnf, con, id);
      conk = (D < 0 && gequal(idcon, id)) ? con : NULL;
      for (j = i; j < lglis; j++)
        if (gequal(idcon, gel(LIs, j))) { gel(LIs, j) = gen_0; break; }
      maxinf = (D < 0 || gequal(idcon,id))? 1: 2;
      for (inf = 1; inf <= maxinf; inf++)
      {
        GEN ide = (D > 0)? mkvec2(id, gel(varch,inf)): id;
        GEN res = mfdihedralcommon(bnf, ide, znN, kroconreyN, N, D, conk);
        if (res) gel(resall, ct++) = res;
      }
    }
  }
  if (ct == 1) avma = av;
  else
  {
    setlg(resall, ct);
    vectrunc_append(v, gerepilecopy(av, shallowconcat1(resall)));
  }
}
static void append_dihedral ( GEN v , long D , long l1 , long l2 ) { long Da = labs ( D ) , no , N , i , numi , ct , min , max ; GEN bnf , con , LI , resall , varch ; pari_sp av ; max = l2 / Da ; if ( l1 == l2 ) { min = max ; if ( D > 0 && min < 3 ) return ; } else min = ( l1 + Da - 1 ) / Da ; if ( ! sisfundamental ( D ) ) return ; av = avma ; bnf = dihan_bnf ( D ) ; con = gel ( galoisconj ( bnf , gen_1 ) , 2 ) ; LI = ideallist ( bnf , max ) ; numi = 0 ; for ( i = min ; i <= max ; i ++ ) numi += lg ( gel ( LI , i ) ) - 1 ; if ( D > 0 ) { numi <<= 1 ; varch = mkvec2 ( mkvec2 ( gen_1 , gen_0 ) , mkvec2 ( gen_0 , gen_1 ) ) ; } else varch = NULL ; resall = cgetg ( numi + 1 , t_VEC ) ; ct = 1 ; for ( no = min ; no <= max ; no ++ ) { GEN LIs , znN , conreyN , kroconreyN ; long flcond , lgc , lglis ; if ( D < 0 ) flcond = ( no == 2 || no == 3 || ( no == 4 && ( D & 7L ) == 1 ) ) ; else flcond = ( no == 4 && ( D & 7L ) != 1 ) ; if ( flcond ) continue ; LIs = gel ( LI , no ) ; N = Da * no ; znN = znstar0 ( utoi ( N ) , 1 ) ; conreyN = znstar_get_conreygen ( znN ) ; lgc = lg ( conreyN ) ; kroconreyN = cgetg ( lgc , t_VECSMALL ) ; for ( i = 1 ; i < lgc ; i ++ ) kroconreyN [ i ] = krosi ( D , gel ( conreyN , i ) ) ; lglis = lg ( LIs ) ; for ( i = 1 ; i < lglis ; i ++ ) { GEN id = gel ( LIs , i ) , idcon , conk ; long j , inf , maxinf ; if ( typ ( id ) == t_INT ) continue ; idcon = galoisapply ( bnf , con , id ) ; conk = ( D < 0 && gequal ( idcon , id ) ) ? con : NULL ; for ( j = i ; j < lglis ; j ++ ) if ( gequal ( idcon , gel ( LIs , j ) ) ) { gel ( LIs , j ) = gen_0 ; break ; } maxinf = ( D < 0 || gequal ( idcon , id ) ) ? 1 : 2 ; for ( inf = 1 ; inf <= maxinf ; inf ++ ) { GEN ide = ( D > 0 ) ? mkvec2 ( id , gel ( varch , inf ) ) : id ; GEN res = mfdihedralcommon ( bnf , ide , znN , kroconreyN , N , D , conk ) ; if ( res ) gel ( resall , ct ++ ) = res ; } } } if ( ct == 1 ) avma = av ; else { setlg ( resall , ct ) ; vectrunc_append ( v , gerepilecopy ( av , shallowconcat1 ( resall ) ) ) ; } }
Append to v all dihedral weight 1 forms coming from D, if fundamental.
Append to v all dihedral weight 1 forms coming from D if fundamental .
/* min <= Nf <= max */ /* assume Da | l2 */ /* assume l1 < l2 */