bridge/class-master/depend/pari/src/basemath/trans3.c
/* compute the first N coefficients of the Mahler expansion
   of phi^m_s skipping the first one (which is zero) */
compute the first N coefficients of the Mahler expansion
of phi^m_s skipping the first one (which is zero)
compute the first N coefficients of the Mahler expansion of phi^m_s skipping the first one ( which is zero )
GEN
coeff_of_phi_ms(ulong p, GEN q, long m, GEN s, long N, GEN vz)
{
  GEN qs2 = shifti(q, -1), cff = zerovec(N);
  pari_sp av;
  long k, j;
  av = avma;
  for (k = 1; k <= N; k++)
  {
    gel(cff, k) = phi_ms(p, q, m, s, k, vz);
    if (gc_needed(av, 2))
    {
      if(DEBUGMEM>1)
        pari_warn(warnmem, "coeff_of_phi_ms (1), k = %ld/%ld", N-k, N);
      cff = gerepileupto(av, gcopy(cff));
    }
  }
  for (j = N; j > 1; j--)
  {
    GEN b = subii(gel(cff, j), gel(cff, j-1));
    gel(cff, j) = centermodii(b, q, qs2);
    if (gc_needed(av, 2))
    {
      if(DEBUGMEM>1)
        pari_warn(warnmem, "coeff_of_phi_ms (2), j = %ld/%ld", N-j, N);
      cff = gerepileupto(av, gcopy(cff));
    }
  }
  for (k = 1; k < N; k++)
    for (j = N; j > k; j--)
    {
      GEN b = subii(gel(cff, j), gel(cff, j-1));
      gel(cff, j) = centermodii(b, q, qs2);
      if (gc_needed(av, 2))
      {
        if(DEBUGMEM>1)
          pari_warn(warnmem, "coeff_of_phi_ms (3), (k,j) = (%ld,%ld)/%ld",
              k, N-j, N);
        cff = gerepileupto(av, gcopy(cff));
      }
    }
  k = N; while(gequal0(gel(cff, k))) k--;
  setlg(cff, k+1);
  if (DEBUGLEVEL > 2)
    err_printf("  coeff_of_phi_ms: %ld coefficients kept out of %ld\n",
               k, N);
  return gerepileupto(av, cff);
}
GEN coeff_of_phi_ms ( ulong p , GEN q , long m , GEN s , long N , GEN vz ) { GEN qs2 = shifti ( q , -1 ) , cff = zerovec ( N ) ; pari_sp av ; long k , j ; av = avma ; for ( k = 1 ; k <= N ; k ++ ) { gel ( cff , k ) = phi_ms ( p , q , m , s , k , vz ) ; if ( gc_needed ( av , 2 ) ) { if ( DEBUGMEM > 1 ) pari_warn ( warnmem , " " , N - k , N ) ; cff = gerepileupto ( av , gcopy ( cff ) ) ; } } for ( j = N ; j > 1 ; j -- ) { GEN b = subii ( gel ( cff , j ) , gel ( cff , j - 1 ) ) ; gel ( cff , j ) = centermodii ( b , q , qs2 ) ; if ( gc_needed ( av , 2 ) ) { if ( DEBUGMEM > 1 ) pari_warn ( warnmem , " " , N - j , N ) ; cff = gerepileupto ( av , gcopy ( cff ) ) ; } } for ( k = 1 ; k < N ; k ++ ) for ( j = N ; j > k ; j -- ) { GEN b = subii ( gel ( cff , j ) , gel ( cff , j - 1 ) ) ; gel ( cff , j ) = centermodii ( b , q , qs2 ) ; if ( gc_needed ( av , 2 ) ) { if ( DEBUGMEM > 1 ) pari_warn ( warnmem , " " , k , N - j , N ) ; cff = gerepileupto ( av , gcopy ( cff ) ) ; } } k = N ; while ( gequal0 ( gel ( cff , k ) ) ) k -- ; setlg ( cff , k + 1 ) ; if ( DEBUGLEVEL > 2 ) err_printf ( " \n " , k , N ) ; return gerepileupto ( av , cff ) ; }
compute the first N coefficients of the Mahler expansion
of phi^m_s skipping the first one (which is zero)
compute the first N coefficients of the Mahler expansion of phi^m_s skipping the first one ( which is zero )