Changeset ce912c in git


Ignore:
Timestamp:
Jul 15, 2019, 5:12:46 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
dcf353c04b0c8c5945b92c2d852b51473aea48a0
Parents:
d96888fdc2a0491751aa5c1f77cf5a3759e219ae
Message:
fix: pp_DivideM
File:
1 edited

Legend:

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

    rd96888 rce912c  
    16161616{
    16171617  if (a==NULL) { return NULL; }
    1618 
    1619   poly result=p_Copy(a,r);
    1620   a=result;
    1621   b=p_Head(b,r);
    1622   if(!p_IsConstant(b,r))
    1623   {
    1624     if (rIsLPRing(r))
    1625     {
    1626       WerrorS("not implemented for letterplace rings");
    1627       return NULL;
    1628     }
    1629     poly prev=NULL;
    1630     while (a!=NULL)
    1631     {
    1632       if (p_DivisibleBy(b,a,r))
    1633       {
    1634         p_ExpVectorSub(a,b,r);
    1635         prev=a;
    1636         pIter(a);
    1637       }
    1638       else
    1639       {
    1640         if (prev==NULL)
    1641         {
    1642           p_LmDelete(&result,r);
    1643           a=result;
    1644         }
    1645         else
    1646         {
    1647           p_LmDelete(&pNext(prev),r);
    1648           a=pNext(prev);
    1649         }
    1650       }
    1651     }
    1652   }
    1653   if (result!=NULL)
    1654   {
    1655     number inv=pGetCoeff(b);
    1656     //if ((!rField_is_Ring(r)) || n_IsUnit(inv,r->cf))
    1657     if (rField_is_Zp(r))
    1658     {
    1659       inv = n_Invers(inv,r->cf);
    1660       __p_Mult_nn(result,inv,r);
    1661     }
    1662     else
    1663     {
    1664       inv=n_Copy(inv,r->cf);
    1665       result = p_Div_nn(result,inv,r);
    1666       n_Delete(&inv, r->cf);
    1667     }
    1668   }
    1669   p_Delete(&b,r);
    1670   return result;
     1618  // TODO: better implementation without copying a,b
     1619  return p_DivideM(p_Copy(a,r),p_Head(b,r),r);
    16711620}
    16721621
Note: See TracChangeset for help on using the changeset viewer.