Changeset cec9624 in git for libpolys


Ignore:
Timestamp:
Jul 11, 2019, 2:59:38 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
dffcf06de72c5d8f3347abee6740a159f6cabd41
Parents:
18296cd9190bb2f8c652446aa5cf3a783ad2cb66
Message:
add: pp_DivideM, pp_Divide
Location:
libpolys/polys/monomials
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/p_polys.cc

    r18296c rcec9624  
    16101610  }
    16111611  p_Delete(&b, r);
     1612  return result;
     1613}
     1614
     1615poly pp_DivideM(poly a, poly b, const ring r)
     1616{
     1617  if (a==NULL) { return NULL; }
     1618  poly result=a;
     1619
     1620  if(!p_IsConstant(b,r))
     1621  {
     1622    if (rIsLPRing(r))
     1623    {
     1624      WerrorS("not implemented for letterplace rings");
     1625      return NULL;
     1626    }
     1627    poly prev=NULL;
     1628    a=p_Copy(a,r);
     1629    while (a!=NULL)
     1630    {
     1631      if (p_DivisibleBy(b,a,r))
     1632      {
     1633        p_ExpVectorSub(a,b,r);
     1634        prev=a;
     1635        pIter(a);
     1636      }
     1637      else
     1638      {
     1639        if (prev==NULL)
     1640        {
     1641          p_LmDelete(&result,r);
     1642          a=result;
     1643        }
     1644        else
     1645        {
     1646          p_LmDelete(&pNext(prev),r);
     1647          a=pNext(prev);
     1648        }
     1649      }
     1650    }
     1651  }
     1652  if (result!=NULL)
     1653  {
     1654    number inv=pGetCoeff(b);
     1655    //if ((!rField_is_Ring(r)) || n_IsUnit(inv,r->cf))
     1656    if (rField_is_Zp(r))
     1657    {
     1658      inv = n_Invers(inv,r->cf);
     1659      __p_Mult_nn(result,inv,r);
     1660      n_Delete(&inv, r->cf);
     1661    }
     1662    else
     1663    {
     1664      result = p_Div_nn(result,inv,r);
     1665    }
     1666  }
    16121667  return result;
    16131668}
  • libpolys/polys/monomials/p_polys.h

    r18296c rcec9624  
    19901990poly      p_MDivide(poly a, poly b, const ring r);
    19911991poly      p_DivideM(poly a, poly b, const ring r);
     1992poly      pp_DivideM(poly a, poly b, const ring r);
    19921993poly      p_Div_nn(poly p, const number n, const ring r);
    19931994
Note: See TracChangeset for help on using the changeset viewer.