bridge/class-master/depend/pari/src/basemath/mftrace.c
/**************************************************************/
/*         Alternative method for 1/2-integral weight         */
/**************************************************************/
Alternative method for 1/2-integral weight
Alternative method for 1 / 2 - integral weight
static GEN
mf2basis(long N, long r, GEN CHI, long space)
{
  GEN CHI1, CHI2, mf1, mf2, B1, B2, BT1, BT2, M1, M2, M, T1, T2;
  GEN M2I, K, POLCYC, v, den;
  long sb, k1, N2, ordchi;
  k1 = r + 1;
  if (odd(k1))
  {
    CHI1 = mfcharmul(CHI, get_mfchar(stoi(-4)));
    CHI2 = mfcharmul(CHI, get_mfchar(stoi(-8)));
  }
  else
  {
    CHI1 = CHI;
    CHI2 = mfcharmul(CHI, get_mfchar(utoi(8)));
  }
  mf1 = mfinit_Nkchi(N, k1, CHI1, space, 1);
  B1 = MF_get_basis(mf1); if (lg(B1) == 1) return cgetg(1,t_VEC);
  N2 = ulcm(8, N);
  mf2 = mfinit_Nkchi(N2, k1, CHI2, space, 1);
  B2 = MF_get_basis(mf2); if (lg(B2) == 1) return cgetg(1,t_VEC);
  sb = mfsturmNgk(N2, gaddsg(k1, ghalf));
  M1 = mfcoefs_mf(mf1, sb, 1);
  M2 = mfcoefs_mf(mf2, sb, 1);
  T1 = mfTheta(NULL); BT1 = RgV_to_RgX(mfcoefs_i(T1, sb, 1), 0);
  T2 = mfbd_i(T1, 2); BT2 = RgV_to_RgX(mfcoefs_i(T2, sb, 1), 0);
  M1 = mfmatsermul(M1, BT2);
  M2 = mfmatsermul(M2, BT1);
  ordchi = mfcharorder_canon(CHI);
  POLCYC = (ordchi == 1)? NULL: mfcharpol(CHI);
  M2I = QabM_pseudoinv(M2, POLCYC, ordchi, &v, &den);
  M = RgM_mul(M2, RgM_mul(M2I, rowpermute(M1, gel(v,1))));
  M = gsub(RgM_Rg_mul(M1, den), M);
  K = QabM_ker(M, POLCYC, ordchi);
  return vecmflineardiv0(B1, K, T1);
}
static GEN mf2basis ( long N , long r , GEN CHI , long space ) { GEN CHI1 , CHI2 , mf1 , mf2 , B1 , B2 , BT1 , BT2 , M1 , M2 , M , T1 , T2 ; GEN M2I , K , POLCYC , v , den ; long sb , k1 , N2 , ordchi ; k1 = r + 1 ; if ( odd ( k1 ) ) { CHI1 = mfcharmul ( CHI , get_mfchar ( stoi ( -4 ) ) ) ; CHI2 = mfcharmul ( CHI , get_mfchar ( stoi ( -8 ) ) ) ; } else { CHI1 = CHI ; CHI2 = mfcharmul ( CHI , get_mfchar ( utoi ( 8 ) ) ) ; } mf1 = mfinit_Nkchi ( N , k1 , CHI1 , space , 1 ) ; B1 = MF_get_basis ( mf1 ) ; if ( lg ( B1 ) == 1 ) return cgetg ( 1 , t_VEC ) ; N2 = ulcm ( 8 , N ) ; mf2 = mfinit_Nkchi ( N2 , k1 , CHI2 , space , 1 ) ; B2 = MF_get_basis ( mf2 ) ; if ( lg ( B2 ) == 1 ) return cgetg ( 1 , t_VEC ) ; sb = mfsturmNgk ( N2 , gaddsg ( k1 , ghalf ) ) ; M1 = mfcoefs_mf ( mf1 , sb , 1 ) ; M2 = mfcoefs_mf ( mf2 , sb , 1 ) ; T1 = mfTheta ( NULL ) ; BT1 = RgV_to_RgX ( mfcoefs_i ( T1 , sb , 1 ) , 0 ) ; T2 = mfbd_i ( T1 , 2 ) ; BT2 = RgV_to_RgX ( mfcoefs_i ( T2 , sb , 1 ) , 0 ) ; M1 = mfmatsermul ( M1 , BT2 ) ; M2 = mfmatsermul ( M2 , BT1 ) ; ordchi = mfcharorder_canon ( CHI ) ; POLCYC = ( ordchi == 1 ) ? NULL : mfcharpol ( CHI ) ; M2I = QabM_pseudoinv ( M2 , POLCYC , ordchi , & v , & den ) ; M = RgM_mul ( M2 , RgM_mul ( M2I , rowpermute ( M1 , gel ( v , 1 ) ) ) ) ; M = gsub ( RgM_Rg_mul ( M1 , den ) , M ) ; K = QabM_ker ( M , POLCYC , ordchi ) ; return vecmflineardiv0 ( B1 , K , T1 ) ; }
Alternative method for 1/2-integral weight
Alternative method for 1 / 2 - integral weight