Changeset 8222d6 in git


Ignore:
Timestamp:
Sep 9, 2016, 2:42:40 PM (8 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
dd930e594c1cd299f2e2b78fe5444de64aede28a
Parents:
bebd5a0361ed499fa0769cad9424e1bb193acd7c
Message:
add: p_Compare
Location:
libpolys/polys/monomials
Files:
2 edited

Legend:

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

    rbebd5a0 r8222d6  
    47084708#include <polys/templates/p_Delete__T.cc>
    47094709
     4710/***************************************************************/
     4711/*
     4712* compare the leading terms of a and b
     4713*/
     4714static int tCompare(const poly a, const poly b, const ring R)
     4715{
     4716  if (b == NULL) return(a != NULL);
     4717  if (a == NULL) return(-1);
     4718
     4719  /* a != NULL && b != NULL */
     4720  int r = p_LmCmp(a, b,R);
     4721  if (r != 0) return(r);
     4722  number h = n_Sub(pGetCoeff(a), pGetCoeff(b),R->cf);
     4723  r = -1 + n_IsZero(h,R->cf) + 2*n_GreaterZero(h,R->cf);   /* -1: <, 0:==, 1: > */
     4724  n_Delete(&h,R->cf);
     4725  return(r);
     4726}
     4727
     4728/*
     4729* compare a and b
     4730*/
     4731int p_Compare(const poly a, const poly b, const ring R)
     4732{
     4733  int r = tCompare(a, b,R);
     4734  if (r != 0) return(r);
     4735
     4736  poly aa = a;
     4737  poly bb = b;
     4738  while (r == 0 && aa != NULL && bb != NULL)
     4739  {
     4740    pIter(aa);
     4741    pIter(bb);
     4742    r = tCompare(aa, bb,R);
     4743  }
     4744  return(r);
     4745}
     4746
  • libpolys/polys/monomials/p_polys.h

    rbebd5a0 r8222d6  
    20212021/// shifts components of the vector p by i
    20222022void p_Shift (poly * p,int i, const ring r);
     2023/*----------------------------------------------------*/
     2024
     2025int p_Compare(const poly a, const poly b, const ring R);
    20232026#endif // P_POLYS_H
    20242027
Note: See TracChangeset for help on using the changeset viewer.