Changeset 55e2df0 in git for libpolys/polys


Ignore:
Timestamp:
Mar 15, 2012, 7:33:40 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
90934a9f682716f4e6fe4afb6c7eb7b8f281b8bf
Parents:
2c0c30ddc4025dc3d9eac607c97a0e14d74e049e
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-03-15 19:33:40+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-03-16 19:36:35+01:00
Message:
added p_EqualPolys for elements over _equal_ rings
Location:
libpolys/polys/monomials
Files:
2 edited

Legend:

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

    r2c0c30 r55e2df0  
    38493849}
    38503850
     3851static inline BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
     3852{
     3853  assume( r1 == r2 || rSamePolyRep(r1, r2) );
     3854
     3855  p_LmCheckPolyRing1(p1, r1);
     3856  p_LmCheckPolyRing1(p2, r2);
     3857
     3858  int i = r1->ExpL_Size;
     3859
     3860  assume( r1->ExpL_Size == r2->ExpL_Size );
     3861
     3862  unsigned long *ep = p1->exp;
     3863  unsigned long *eq = p2->exp;
     3864
     3865  do
     3866  {
     3867    i--;
     3868    if (ep[i] != eq[i]) return FALSE;
     3869  }
     3870  while (i);
     3871
     3872  return TRUE;
     3873}
     3874
     3875BOOLEAN p_EqualPolys(poly p1,poly p2, const ring r1, const ring r2)
     3876{
     3877  assume( r1 == r2 || rSamePolyRep(r1, r2) ); // will be used in rEqual!
     3878  assume( r1->cf == r2->cf );
     3879 
     3880  while ((p1 != NULL) && (p2 != NULL))
     3881  {
     3882    // returns 1 if ExpVector(p)==ExpVector(q): does not compare numbers !!
     3883    // #define p_LmEqual(p1, p2, r) p_ExpVectorEqual(p1, p2, r)
     3884
     3885    if (! p_ExpVectorEqual(p1, p2, r1, r2))
     3886      return FALSE;
     3887   
     3888    if (! n_Equal(p_GetCoeff(p1,r1), p_GetCoeff(p2,r2), r1->cf ))
     3889      return FALSE;
     3890   
     3891    pIter(p1);
     3892    pIter(p2);
     3893  }
     3894  return (p1==p2);
     3895}
     3896
    38513897/*2
    38523898*returns TRUE if p1 is a skalar multiple of p2
  • libpolys/polys/monomials/p_polys.h

    r2c0c30 r55e2df0  
    408408long pLDeg1_WFirstTotalDegree(poly p,int *l, ring r);
    409409long pLDeg1c_WFirstTotalDegree(poly p,int *l, ring r);
     410
    410411BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r);
     412
     413/// same as the usual p_EqualPolys for polys belonging to *equal* rings
     414BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r1, const ring r2);
    411415
    412416long p_Deg(poly a, const ring r);
Note: See TracChangeset for help on using the changeset viewer.