bridge/class-master/depend/pari/src/basemath/mftrace.c
/* n > 0; trace formula on new space */
n > 0; trace formula on new space
n > 0 ; trace formula on new space
static GEN
mfnewtrace_i(long N, long k, long n, cachenew_t *cache)
{
  GEN VCHIP, s, Dn, DN1, SN, S = cache->DATA;
  long FC, N1, N2, N1N2, g, i, j, lDN1;
  if (!S) return gen_0;
  SN = gel(S,N);
  if (mfnewchkzero(gel(SN,_NEWLZ), n)) return gen_0;
  if (k > 2 && trconj(gel(SN,_TRCONJ), N, n)) return gen_0;
  VCHIP = gel(SN, _VCHIP); FC = vchip_FC(VCHIP);
  N1 = N/FC; newt_params(N1, n, FC, &g, &N2);
  N1N2 = N1/N2;
  DN1 = mydivisorsu(N1N2); lDN1 = lg(DN1);
  N2 *= FC;
  Dn = mydivisorsu(n); 
  s = gmulsg(mubeta2(N1N2,n), mfcusptracecache(N2, k, n, Dn, gel(S,N2), cache));
  for (i = 2; i < lDN1; i++)
  { 
    long M1 = DN1[i], N1M1 = DN1[lDN1-i];
    GEN Dg = mydivisorsu(ugcd(M1, g));
    M1 *= N2;
    s = gadd(s, gmulsg(mubeta2(N1M1,n),
                       mfcusptracecache(M1, k, n, Dn, gel(S,M1), cache)));
    for (j = 2; j < lg(Dg); j++) 
    {
      long d = Dg[j], ndd = n/(d*d), M = M1/d;
      GEN z = mulsi(mubeta2(N1M1,ndd), powuu(d,k-1)), C = vchip_lift(VCHIP,d,z);
      GEN Dndd = div_restrict(Dn, ndd);
      s = gadd(s, gmul(C, mfcusptracecache(M, k, ndd, Dndd, gel(S,M), cache)));
    }
    s = vchip_mod(VCHIP, s);
  }
  return vchip_polmod(VCHIP, s);
}
static GEN mfnewtrace_i ( long N , long k , long n , cachenew_t * cache ) { GEN VCHIP , s , Dn , DN1 , SN , S = cache -> DATA ; long FC , N1 , N2 , N1N2 , g , i , j , lDN1 ; if ( ! S ) return gen_0 ; SN = gel ( S , N ) ; if ( mfnewchkzero ( gel ( SN , _NEWLZ ) , n ) ) return gen_0 ; if ( k > 2 && trconj ( gel ( SN , _TRCONJ ) , N , n ) ) return gen_0 ; VCHIP = gel ( SN , _VCHIP ) ; FC = vchip_FC ( VCHIP ) ; N1 = N / FC ; newt_params ( N1 , n , FC , & g , & N2 ) ; N1N2 = N1 / N2 ; DN1 = mydivisorsu ( N1N2 ) ; lDN1 = lg ( DN1 ) ; N2 *= FC ; Dn = mydivisorsu ( n ) ; s = gmulsg ( mubeta2 ( N1N2 , n ) , mfcusptracecache ( N2 , k , n , Dn , gel ( S , N2 ) , cache ) ) ; for ( i = 2 ; i < lDN1 ; i ++ ) { long M1 = DN1 [ i ] , N1M1 = DN1 [ lDN1 - i ] ; GEN Dg = mydivisorsu ( ugcd ( M1 , g ) ) ; M1 *= N2 ; s = gadd ( s , gmulsg ( mubeta2 ( N1M1 , n ) , mfcusptracecache ( M1 , k , n , Dn , gel ( S , M1 ) , cache ) ) ) ; for ( j = 2 ; j < lg ( Dg ) ; j ++ ) { long d = Dg [ j ] , ndd = n / ( d * d ) , M = M1 / d ; GEN z = mulsi ( mubeta2 ( N1M1 , ndd ) , powuu ( d , k - 1 ) ) , C = vchip_lift ( VCHIP , d , z ) ; GEN Dndd = div_restrict ( Dn , ndd ) ; s = gadd ( s , gmul ( C , mfcusptracecache ( M , k , ndd , Dndd , gel ( S , M ) , cache ) ) ) ; } s = vchip_mod ( VCHIP , s ) ; } return vchip_polmod ( VCHIP , s ) ; }
n > 0; trace formula on new space
n > 0 ; trace formula on new space
/* this one is probably out of cache */ /* skip M1 = 1, done above */ /* skip d = 1, done above */