Changeset 4a822ba in git for Singular/iparith.cc


Ignore:
Timestamp:
Sep 12, 2016, 3:10:43 PM (8 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
0816f71425281ce41a6a64263309ea59a13ade6e
Parents:
395731e22e1afda9d31e802ed31db98790d11c52
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2016-09-12 15:10:43+02:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2016-09-12 15:11:11+02:00
Message:
adjust poly, matrix etc comparisons
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r395731e r4a822ba  
    431431  return FALSE;
    432432}
     433static BOOLEAN jjCOMPARE_MA(leftv res, leftv u, leftv v)
     434{
     435  //Print("in: >>%s<<\n",my_yylinebuf);
     436  matrix a=(matrix)u->Data();
     437  matrix b=(matrix)v->Data();
     438  int r=mp_Compare(a,b,currRing);
     439  switch  (iiOp)
     440  {
     441    case '<':
     442      res->data  = (char *) (long)(r < 0);
     443      break;
     444    case '>':
     445      res->data  = (char *) (long)(r > 0);
     446      break;
     447    case LE:
     448      res->data  = (char *) (long)(r <= 0);
     449      break;
     450    case GE:
     451      res->data  = (char *) (long)(r >= 0);
     452      break;
     453    case EQUAL_EQUAL:
     454    case NOTEQUAL: /* negation handled by jjEQUAL_REST */
     455      res->data  = (char *)(long) (r == 0);
     456      break;
     457  }
     458  jjEQUAL_REST(res,u,v);
     459  return FALSE;
     460}
    433461static BOOLEAN jjCOMPARE_P(leftv res, leftv u, leftv v)
    434462{
    435463  poly p=(poly)u->Data();
    436464  poly q=(poly)v->Data();
    437   int r=pCmp(p,q);
    438   if (r==0)
    439   {
    440     number h=nSub(pGetCoeff(p),pGetCoeff(q));
    441     /* compare lead coeffs */
    442     r = -1+nIsZero(h)+2*nGreaterZero(h); /* -1: <, 0:==, 1: > */
    443     nDelete(&h);
    444   }
    445   else if (p==NULL)
    446   {
    447     if (q==NULL)
    448     {
    449       /* compare 0, 0 */
    450       r=0;
    451     }
    452     else if(pIsConstant(q))
    453     {
    454       /* compare 0, const */
    455       r = 1-2*nGreaterZero(pGetCoeff(q)); /* -1: <, 1: > */
    456     }
    457   }
    458   else if (q==NULL)
    459   {
    460     if (pIsConstant(p))
    461     {
    462       /* compare const, 0 */
    463       r = -1+2*nGreaterZero(pGetCoeff(p)); /* -1: <, 1: > */
    464     }
    465   }
     465  int r=p_Compare(p,q,currRing);
    466466  switch  (iiOp)
    467467  {
Note: See TracChangeset for help on using the changeset viewer.