bridge/class-master/depend/pari/src/basemath/mftrace.c
/* L is the mftobasis of a form on CUSP space. We allow mf_FULL or mf_CUSP */
L is the mftobasis of a form on CUSP space.
L is the mftobasis of a form on CUSP space .
static GEN
mftonew_i(GEN mf, GEN L, long *plevel)
{
  GEN S, listMjd, CHI, res, Aclos, Acoef, D, perm;
  long N1, LC, lD, i, l, t, level, N = MF_get_N(mf);
  if (MF_get_k(mf) == 1) pari_err_IMPL("mftonew in weight 1");
  listMjd = MFcusp_get_vMjd(mf);
  CHI = MF_get_CHI(mf); LC = mfcharconductor(CHI);
  S = MF_get_S(mf);
  N1 = N/LC;
  D = mydivisorsu(N1); lD = lg(D);
  perm = cgetg(N1+1, t_VECSMALL);
  for (i = 1; i < lD; i++) perm[D[i]] = i;
  Aclos = const_mat(lD-1, cgetg(1,t_VEC));
  Acoef = const_mat(lD-1, cgetg(1,t_VEC));
  l = lg(listMjd);
  for (i = 1; i < l; i++)
  {
    long M, d;
    GEN v;
    if (gequal0(gel(L,i))) continue;
    v = gel(listMjd, i);
    M = perm[ v[1]/LC ];
    d = perm[ v[3] ];
    gcoeff(Aclos,M,d) = vec_append(gcoeff(Aclos,M,d), gel(S,i));
    gcoeff(Acoef,M,d) = shallowconcat(gcoeff(Acoef,M,d), gel(L,i));
  }
  res = cgetg(l, t_VEC); level = 1;
  for (i = t = 1; i < lD; i++)
  {
    long j, M = D[i]*LC;
    GEN gM = utoipos(M);
    for (j = 1; j < lD; j++)
    {
      GEN f = gcoeff(Aclos,i,j), C, NK;
      long d;
      if (lg(f) == 1) continue;
      NK = mf_get_NK(gel(f,1));
      d = D[j];
      C = gcoeff(Acoef,i,j);
      level = ulcm(level, M*d);
      gel(res,t++) = mkvec3(gM, utoipos(d), mflinear_i(NK,f,C));
    }
  }
  if (plevel) *plevel = level;
  setlg(res, t); return res;
}
static GEN mftonew_i ( GEN mf , GEN L , long * plevel ) { GEN S , listMjd , CHI , res , Aclos , Acoef , D , perm ; long N1 , LC , lD , i , l , t , level , N = MF_get_N ( mf ) ; if ( MF_get_k ( mf ) == 1 ) pari_err_IMPL ( " " ) ; listMjd = MFcusp_get_vMjd ( mf ) ; CHI = MF_get_CHI ( mf ) ; LC = mfcharconductor ( CHI ) ; S = MF_get_S ( mf ) ; N1 = N / LC ; D = mydivisorsu ( N1 ) ; lD = lg ( D ) ; perm = cgetg ( N1 + 1 , t_VECSMALL ) ; for ( i = 1 ; i < lD ; i ++ ) perm [ D [ i ] ] = i ; Aclos = const_mat ( lD - 1 , cgetg ( 1 , t_VEC ) ) ; Acoef = const_mat ( lD - 1 , cgetg ( 1 , t_VEC ) ) ; l = lg ( listMjd ) ; for ( i = 1 ; i < l ; i ++ ) { long M , d ; GEN v ; if ( gequal0 ( gel ( L , i ) ) ) continue ; v = gel ( listMjd , i ) ; M = perm [ v [ 1 ] / LC ] ; d = perm [ v [ 3 ] ] ; gcoeff ( Aclos , M , d ) = vec_append ( gcoeff ( Aclos , M , d ) , gel ( S , i ) ) ; gcoeff ( Acoef , M , d ) = shallowconcat ( gcoeff ( Acoef , M , d ) , gel ( L , i ) ) ; } res = cgetg ( l , t_VEC ) ; level = 1 ; for ( i = t = 1 ; i < lD ; i ++ ) { long j , M = D [ i ] * LC ; GEN gM = utoipos ( M ) ; for ( j = 1 ; j < lD ; j ++ ) { GEN f = gcoeff ( Aclos , i , j ) , C , NK ; long d ; if ( lg ( f ) == 1 ) continue ; NK = mf_get_NK ( gel ( f , 1 ) ) ; d = D [ j ] ; C = gcoeff ( Acoef , i , j ) ; level = ulcm ( level , M * d ) ; gel ( res , t ++ ) = mkvec3 ( gM , utoipos ( d ) , mflinear_i ( NK , f , C ) ) ; } } if ( plevel ) * plevel = level ; setlg ( res , t ) ; return res ; }
L is the mftobasis of a form on CUSP space.
L is the mftobasis of a form on CUSP space .