bridge/class-master/depend/pari/src/basemath/mftrace.c
/* given form F, find coeffs of F on mfbasis(mf). If power series, not
 * guaranteed correct if precision less than Sturm bound */
given form F, find coeffs of F on mfbasis(mf). If power series, not
guaranteed correct if precision less than Sturm bound
given form F find coeffs of F on mfbasis ( mf ) . If power series not guaranteed correct if precision less than Sturm bound
static GEN
mftobasis_i(GEN mf, GEN F)
{
  GEN v, Mindex, Minv;
  if (!MF_get_dim(mf)) return cgetg(1, t_COL);
  Mindex = MF_get_Mindex(mf);
  Minv = MF_get_Minv(mf);
  if (checkmf_i(F))
  {
    long n = Mindex[lg(Mindex)-1];
    v = vecpermute(mfcoefs_i(F, n, 1), Mindex);
    return Minv_RgC_mul(Minv, v);
  }
  else
  {
    GEN A = gel(Minv,1), d = gel(Minv,2);
    long r;
    v = F;
    switch(typ(F))
    {
      case t_SER: v = sertocol(v);
      case t_VEC: case t_COL: break;
      default: pari_err_TYPE("mftobasis", F);
    }
    if (lg(v) == 1) pari_err_TYPE("mftobasis",v);
    v = vecpermute_partial(v, Mindex, &r);
    if (!r) return Minv_RgC_mul(Minv, v); 
    v = RgM_RgC_mul(vecslice(A, 1, lg(v)-1), v);
    if (!equali1(d)) v = RgC_Rg_div(v,d);
    return mkvec2(v, vecslice(A, lg(A)-r, lg(A)-1));
  }
}
static GEN mftobasis_i ( GEN mf , GEN F ) { GEN v , Mindex , Minv ; if ( ! MF_get_dim ( mf ) ) return cgetg ( 1 , t_COL ) ; Mindex = MF_get_Mindex ( mf ) ; Minv = MF_get_Minv ( mf ) ; if ( checkmf_i ( F ) ) { long n = Mindex [ lg ( Mindex ) - 1 ] ; v = vecpermute ( mfcoefs_i ( F , n , 1 ) , Mindex ) ; return Minv_RgC_mul ( Minv , v ) ; } else { GEN A = gel ( Minv , 1 ) , d = gel ( Minv , 2 ) ; long r ; v = F ; switch ( typ ( F ) ) { case t_SER : v = sertocol ( v ) ; case t_VEC : case t_COL : break ; default : pari_err_TYPE ( " " , F ) ; } if ( lg ( v ) == 1 ) pari_err_TYPE ( " " , v ) ; v = vecpermute_partial ( v , Mindex , & r ) ; if ( ! r ) return Minv_RgC_mul ( Minv , v ) ; v = RgM_RgC_mul ( vecslice ( A , 1 , lg ( v ) - 1 ) , v ) ; if ( ! equali1 ( d ) ) v = RgC_Rg_div ( v , d ) ; return mkvec2 ( v , vecslice ( A , lg ( A ) - r , lg ( A ) - 1 ) ) ; } }
given form F, find coeffs of F on mfbasis(mf).
given form F find coeffs of F on mfbasis ( mf ) .
/* single solution */ /* affine space of dimension r */