Exemplo n.º 1
0
unipoly UnipolyLenOnePoincare(TermList theTList)
{
  eterm    SPL = SPList(theTList), myTerm = (MTList(theTList))[1];
  ints     OccInd = Indets(SPL);
  int   TDeg =eterm_degree(myTerm), i =IntsGetLen(OccInd), exp;
  unipoly p1, p2;

  if ( eterm_coprime(myTerm, SPL) )
  {
    if ( i==eterm_degree(SPL) )   p1 = PowerExtDup(i, i+TDeg);
    else
    {
      p1 = UnipolyOne(eterm_degree(SPL)+TDeg);
      for ( ; i>0 ; --i )  MultByOneMinusXExp(p1, SPL[OccInd[i]]);
    }
    MultByOneMinusXExp(p1, TDeg);
    EraseAndFreeTList(theTList);
    return p1;
  }
  else 
  {
    p1 = UnipolyOne(eterm_degree(SPL)+TDeg);
    p2 = UnipolyOne(eterm_degree(SPL));
    for ( ; i>0 ; --i )
    {
      exp = SPL[OccInd[i]];
      MultByOneMinusXExp(p1, exp);
      MultByOneMinusXExp(p2, exp-myTerm[OccInd[i]]);
    }   
    EraseAndFreeTList(theTList);
    return P1MinusXExpP2(p1, TDeg, p2);
  }
}
Exemplo n.º 2
0
unipoly SplitPoincare(TermList theTList, TermList SplitterTList)
{
  unipoly   res;
  int SplTLLen =MTListLen(SplitterTList), n, NewMTLLen =0, DegSum =0;
  eterm   SPL =SPList(theTList);
  TermList NewTL =NewTList(MTListLen(theTList),TListIndetsNo(theTList)),
           *auxTLs =(TermList*)mymalloc((SplTLLen+1)*sizeof(TermList), "*TermList");
  MixedTermList   SMTL =MTList(SplitterTList), NewMTL =MTList(NewTL);
  
  res = NULL;
  for ( n =MTListLen(SplitterTList) ; n>0 ; --n )
  {
    auxTLs[n] = NewTList(MTListLen(theTList),TListIndetsNo(theTList));
    MoveNotCoprime(theTList, auxTLs[n], SMTL[n]);
    eterm_free(SMTL[n]);
  }
  SetMTListLen(SplitterTList, 0);
  for ( n =SplTLLen ; n>0 ; --n )
    if ((MTListLen(auxTLs[n])!=1) ||(IntsGetLen(Indets(SPList(auxTLs[n])))!=0) )
      if ( res == NULL )
        res = BigRecPoincare(auxTLs[n]);
      else
        res = P1TimesP2(res, BigRecPoincare(auxTLs[n]));
    else
    {
      DegSum += eterm_degree((MTList(auxTLs[n]))[1]);
      MTLPutLast(NewMTL, NewMTLLen,(MTList(auxTLs[n]))[1]);
      SetMTListLen(auxTLs[n],0);
      EraseAndFreeTList(auxTLs[n]);
    }
  myfree((SplTLLen+1)*sizeof(TermList), auxTLs, "*TermList");
  if ( UPSize(res) < UPDeg(res) + eterm_degree(SPL) + DegSum )
    res = UnipolyChangeSize(res, UPDeg(res) + eterm_degree(SPL) + DegSum);
  for ( n = IntsGetLen(Indets(SPL)) ; n>0 ; --n )
    MultByOneMinusXExp(res, SPL[(Indets(SPL))[n]]);
  EraseAndFreeTList(theTList);
  for ( n=NewMTLLen ; n>0 ; --n)
    MultByOneMinusXExp(res, eterm_degree((NewMTL)[n]));
  SetMTListLen(NewTL,NewMTLLen);
  EraseAndFreeTList(NewTL);
 
  return res;
}
Exemplo n.º 3
0
unipoly UnipolySPPoincare(TermList theTList)
{
  eterm   SPL = SPList(theTList);
  ints OccInd = Indets(SPL);
  int i = IntsGetLen(OccInd);
  unipoly res;

  if ( i==eterm_degree(SPL) )    res = PowerExtDup(i, i);
  else
  {
    res = UnipolyOne(eterm_degree(SPL));
    for ( ; i>0 ; --i )   MultByOneMinusXExp(res, SPL[OccInd[i]]);
  }
  EraseAndFreeTList(theTList);
  return res;
}
Exemplo n.º 4
0
unipoly TotalSplitPoincare(TermList theTList)
{
  unipoly   res = NULL;
  eterm  myTerm, SPL =SPList(theTList), mySPL;
  MixedTermList  MTL =MTList(theTList);
  int MTLLen =MTListLen(theTList), n =MTLLen, DegSum =0;
 
  for ( ; n>0 ; --n)
  {
    MoveNotCoprimeSP(SPL,
                     ( mySPL  =eterm_init(TListIndetsNo(theTList)) ),
                     ( myTerm =MTL[n] ) );
    if ( eterm_get_OccIndNo(mySPL)!=0 )
    {
      MTLMoveLastToNth(MTL, MTLLen, n);
      if ( res == NULL )   res = UnipolyOneTermAndSPPoincare(myTerm,mySPL);
      else  res = P1TimesP2(res, UnipolyOneTermAndSPPoincare(myTerm,mySPL));
    }
    else
    {
      DegSum += eterm_degree(myTerm);
      eterm_free(mySPL);
    }
  }
  n = IntsGetLen(Indets(SPL));
  if ((n==eterm_degree(SPL)) && res == NULL )
    res = PowerExtDup(n, n + DegSum);
  else
  {
    if ( res != NULL )
    {
      if ( UPSize(res) < UPDeg(res) + eterm_degree(SPL) + DegSum )
        res = UnipolyChangeSize(res, UPDeg(res) + eterm_degree(SPL) + DegSum);
    }
    else
      res = UnipolyOne(eterm_degree(SPL) + DegSum);
    for ( ; n>0 ; --n )  MultByOneMinusXExp(res, SPL[(Indets(SPL))[n]]);
  }
  SetMTListLen(theTList,MTLLen);
  for ( n=MTLLen ; n>0 ; --n)   MultByOneMinusXExp(res, eterm_degree( MTL[n]));
  EraseAndFreeTList(theTList);
 
  return res;
}
Exemplo n.º 5
0
			MLSGrid(GridConfig grid_config, MLSConfig mls_config = MLSConfig()) 
				: Grid<SPList>(SPList(mls_config), grid_config),
				mls_config(mls_config)
			{}