bridge/class-master/depend/pari/src/basemath/mftrace.c
/* contribution of elliptic matrices of order 3 in dimension formula
 * Only depends on CHIP the primitive char attached to CHI */
contribution of elliptic matrices of order 3 in dimension formula
Only depends on CHIP the primitive char attached to CHI
contribution of elliptic matrices of order 3 in dimension formula Only depends on CHIP the primitive char attached to CHI
static GEN
A21(long N, long k, GEN CHI)
{
  GEN res, G, chi, o;
  long a21, i, limx, S;
  if ((N&1L) == 0) return gen_0;
  a21 = k%3 - 1;
  if (!a21) return gen_0;
  if (N <= 3) return sstoQ(a21, 3);
  if (!CHI) return sstoQ(nu3(N) * a21, 3);
  res = sqrtm3modN(N); limx = (N - 1) >> 1;
  G = gel(CHI,1); chi = gel(CHI,2);
  o = gmfcharorder(CHI);
  for (S = 0, i = 1; i < lg(res); i++)
  { 
    long x = res[i];
    if (x <= limx)
    { 
      GEN c = znchareval(G, chi, utoi(x), o);
      if (!signe(c)) S += 2; else S--;
    }
  }
  return sstoQ(a21 * S, 3);
}
static GEN A21 ( long N , long k , GEN CHI ) { GEN res , G , chi , o ; long a21 , i , limx , S ; if ( ( N & 1L ) == 0 ) return gen_0 ; a21 = k % 3 - 1 ; if ( ! a21 ) return gen_0 ; if ( N <= 3 ) return sstoQ ( a21 , 3 ) ; if ( ! CHI ) return sstoQ ( nu3 ( N ) * a21 , 3 ) ; res = sqrtm3modN ( N ) ; limx = ( N - 1 ) >> 1 ; G = gel ( CHI , 1 ) ; chi = gel ( CHI , 2 ) ; o = gmfcharorder ( CHI ) ; for ( S = 0 , i = 1 ; i < lg ( res ) ; i ++ ) { long x = res [ i ] ; if ( x <= limx ) { GEN c = znchareval ( G , chi , utoi ( x ) , o ) ; if ( ! signe ( c ) ) S += 2 ; else S -- ; } } return sstoQ ( a21 * S , 3 ) ; }
contribution of elliptic matrices of order 3 in dimension formula
 Only depends on CHIP the primitive char attached to CHI
contribution of elliptic matrices of order 3 in dimension formula Only depends on CHIP the primitive char attached to CHI
/* (x,N) = 1; S += chi(x) + chi(x^2) */ /* CHI(x)=e(c/o), 3rd-root of 1 */