Changeset bf8b65 in git for libpolys


Ignore:
Timestamp:
Apr 23, 2021, 11:01:05 AM (3 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
1f547ed4cc617ebefd435098637414a0fabd2084
Parents:
5fd24e69d9cdfcd1040ca93af529563f039efd2c
Message:
fix: n_IsUnit, n_GetUnit (Tst/Manual/simplify.tst)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/numbers.cc

    r5fd24e6 rbf8b65  
    119119}
    120120
    121 static BOOLEAN ndIsUnit(number a, const coeffs r)
     121static BOOLEAN ndIsUnit_Ring(number a, const coeffs r)
    122122{ return r->cfIsOne(a,r)|| r->cfIsMOne(a,r); }
    123 static number ndGetUnit(number a, const coeffs r)
     123static BOOLEAN ndIsUnit_Field(number a, const coeffs r)
     124{ return !r->cfIsZero(a,r); }
     125static number ndGetUnit_Ring(number a, const coeffs r)
    124126{ return r->cfInit(1,r); }
    125127#ifdef LDEBUG
     
    407409    n->cfClearDenominators = ndClearDenominators;
    408410
    409     n->cfIsUnit = ndIsUnit;
     411    //n->cfIsUnit = ndIsUnit;
    410412#ifdef HAVE_RINGS
    411413    n->cfDivComp = ndDivComp;
    412414    n->cfDivBy = ndDivBy;
    413415    n->cfExtGcd = ndExtGcd;
    414     n->cfGetUnit = ndGetUnit;
     416    //n->cfGetUnit = ndGetUnit;
    415417#endif
    416418
     
    438440    if (n->cfExactDiv==NULL) n->cfExactDiv=n->cfDiv;
    439441    if (n->cfSubringGcd==NULL) n->cfSubringGcd=n->cfGcd;
    440 
     442    if (n->cfIsUnit==NULL)
     443    {
     444      if (n->is_field) n->cfIsUnit=ndIsUnit_Field;
     445      else             n->cfIsUnit=ndIsUnit_Ring;
     446    }
     447    #ifdef HAVE_RING
     448    if (n->cfGetUnit==NULL)
     449    {
     450      if (n->is_field) n->cfGetUnit=n->cfCopy;
     451      else             n->cfGetUnit=ndGetUnit_Ring;
     452    }
     453    #endif
    441454
    442455    if(n->cfWriteShort==NULL)
Note: See TracChangeset for help on using the changeset viewer.