Changeset 8d5f05 in git


Ignore:
Timestamp:
Jun 11, 2014, 7:47:46 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
38a53c048e362151c5c6f95afd4ff65bb32f577c
Parents:
8ddc7cdebf2fd739ad88aa6464fcf904707cd2f1
Message:
removed n_IntDiv/cfIntDiv etc.
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • kernel/fast_mult.cc

    r8ddc7cd r8d5f05  
    546546        number i_number=n_Init(i,r->cf);
    547547        old=new_coef;
    548         new_coef=n_IntDiv(new_coef,i_number,r->cf);
     548        new_coef=n_Div(new_coef,i_number,r->cf);
     549        n_Normalize(new_coef,r->cf);
    549550        n_Delete(&old,r->cf);
    550551        n_Delete(&i_number,r->cf);
  • libpolys/coeffs/OPAE.cc

    r8ddc7cd r8d5f05  
    7070
    7171
    72 number  nAEIntDiv(number a, number b, const coeffs)
    73 {
    74 
    75     int_poly* f=reinterpret_cast<int_poly*> (a);
    76     mpz_t* i= reinterpret_cast<mpz_t*> (b);
    77     int_poly *res=new int_poly;
    78     res->poly_set(*f);
    79     res->poly_scalar_div_to(*i);
    80     return (number) res;
    81 }
    82 
    8372number  nAEIntMod(number a, number, const coeffs)
    8473{
     
    317306    r->cfAdd   = nAEAdd;
    318307    r->cfDiv   = nAEDiv;
    319     r->cfIntDiv= nAEIntDiv;
    320308    r->cfIntMod= nAEIntMod;
    321309    r->cfExactDiv= nAEExactDiv;
  • libpolys/coeffs/OPAE.h

    r8ddc7cd r8d5f05  
    1414number  nAEAdd         (number a, number b, const coeffs r);
    1515number  nAEDiv         (number a, number b, const coeffs r);
    16 number  nAEIntDiv      (number a, number b, const coeffs r); //Hir wollte wir was gucken
    1716number  nAEIntMod      (number a, number b, const coeffs r);// Hir wollte wir was gucken
    1817number  nAEExactDiv    (number a, number b, const coeffs r);
  • libpolys/coeffs/OPAEQ.cc

    r8ddc7cd r8d5f05  
    7272
    7373
    74 number  nAEQIntDiv(number a, number b, const coeffs)
    75 {
    76 
    77     Q_poly* f=reinterpret_cast<Q_poly*> (a);
    78     mpz_t* i= reinterpret_cast<mpz_t*> (b);
    79     Q_poly *res=new Q_poly;
    80     res->Q_poly_set(*f);
    81     res->Q_poly_scalar_div_to(*i);
    82     return (number) res;
    83 }
    84 
    8574number  nAEQIntMod(number a, number, const coeffs)
    8675{
     
    310299    r->cfAdd   = nAEQAdd;
    311300    r->cfDiv   = nAEQDiv;
    312     r->cfIntDiv= nAEQIntDiv;
    313301    r->cfIntMod= nAEQIntMod;
    314302    r->cfExactDiv= nAEQExactDiv;
  • libpolys/coeffs/OPAEQ.h

    r8ddc7cd r8d5f05  
    1414number  nAEQAdd         (number a, number b, const coeffs r);
    1515number  nAEQDiv         (number a, number b, const coeffs r);
    16 number  nAEQIntDiv      (number a, number b, const coeffs r); //Hir wollte wir was gucken
    1716number  nAEQIntMod      (number a, number b, const coeffs r);// Hir wollte wir was gucken
    1817number  nAEQExactDiv    (number a, number b, const coeffs r);
  • libpolys/coeffs/OPAEp.cc

    r8ddc7cd r8d5f05  
    7272
    7373
    74 number  nAEpIntDiv(number a, number b, const coeffs)
    75 {
    76 
    77     p_poly* f=reinterpret_cast<p_poly*> (a);
    78     mpz_t* i= reinterpret_cast<mpz_t*> (b);
    79     p_poly *res=new p_poly;
    80     res->p_poly_set(*f);
    81     res->p_poly_scalar_div_to(*i);
    82     return (number) res;
    83 }
    84 
    8574number  nAEpIntMod(number a, number, const coeffs)
    8675{
     
    339328    r->cfAdd   = nAEpAdd;
    340329    r->cfDiv   = nAEpDiv;
    341     r->cfIntDiv= nAEpIntDiv;
    342330    r->cfIntMod= nAEpIntMod;
    343331    r->cfExactDiv= nAEpExactDiv;
  • libpolys/coeffs/OPAEp.h

    r8ddc7cd r8d5f05  
    1414number  nAEpAdd         (number a, number b, const coeffs r);
    1515number  nAEpDiv         (number a, number b, const coeffs r);
    16 number  nAEpIntDiv      (number a, number b, const coeffs r); //Hir wollte wir was gucken
    1716number  nAEpIntMod      (number a, number b, const coeffs r);// Hir wollte wir was gucken
    1817number  nAEpExactDiv    (number a, number b, const coeffs r);
  • libpolys/coeffs/README.coeffs

    r8ddc7cd r8d5f05  
    3737-cfKillChar: if additional initializations have to be undone (data, etc)
    3838-cfSetChar: if additional initializations to use numbers from this coeffs is needed (should not be needed)
    39 -cfIntDiv, cfIntMod: if the ring has a meaningful Euclidean structure
     39-cfIntMod: if the ring has a meaningful Euclidean structure
    4040-cfGcd, cfExtGcd,cfXExtGcd,cfEucNorm: if the ring (or a subring)  has a meaningful Euclidean structure
    4141-cfAnn: in a principal ideal ring (with zero divisors)
  • libpolys/coeffs/coeffs.h

    r8ddc7cd r8d5f05  
    2323{
    2424  n_unknown=0,
    25   n_Zp, /**< \F{p < ?} */
     25  n_Zp, /**< \F{p < 2^31} */
    2626  n_Q,  /**< rational (GMP) numbers */
    2727  n_R,  /**< single prescision (6,6) real numbers */
    28   n_GF, /**< \GF{p^n < 32001?} */
    29   n_long_R, /**< real (GMP) numbers */
     28  n_GF, /**< \GF{p^n < 2^16} */
     29  n_long_R, /**< real floating point (GMP) numbers */
    3030  n_algExt,  /**< used for all algebraic extensions, i.e.,
    3131                the top-most extension in an extension tower
     
    3434                  the top-most extension in an extension tower
    3535                  is transcendental */
    36   n_long_C, /**< complex (GMP) numbers */
     36  n_long_C, /**< complex floating point (GMP) numbers */
    3737  n_Z, /**< only used if HAVE_RINGS is defined: ? */
    3838  n_Zn, /**< only used if HAVE_RINGS is defined: ? */
     
    140140   //   cfExactDiv does an exact division, but no error checking
    141141   //   (I'm not sure I understant and even less that this makes sense)
    142    numberfunc cfMult, cfSub ,cfAdd ,cfDiv, cfIntDiv, cfIntMod, cfExactDiv;
     142   numberfunc cfMult, cfSub ,cfAdd ,cfDiv, cfIntMod, cfExactDiv;
    143143
    144144   /// init with an integer
     
    619619{ assume(r != NULL); assume(r->cfDiv!=NULL); return r->cfDiv(a,b,r); }
    620620
    621 static inline number n_IntDiv(number a, number b, const coeffs r)
    622 { assume(r != NULL); assume(r->cfIntDiv!=NULL); return r->cfIntDiv(a,b,r); }
    623 
    624621/// for r a field, return n_Init(0,r)
    625622/// otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
  • libpolys/coeffs/ffields.cc

    r8ddc7cd r8d5f05  
    841841  r->cfAdd   = nfAdd;
    842842  r->cfDiv   = nfDiv;
    843   r->cfIntDiv= nfDiv;
    844843  //r->cfIntMod= ndIntMod;
    845844  r->cfExactDiv= nfDiv;
  • libpolys/coeffs/gnumpc.cc

    r8ddc7cd r8d5f05  
    530530  r->cfAdd   = nlAdd;
    531531  r->cfDiv   = nlDiv;
    532   r->cfIntDiv= nlIntDiv;
    533532  r->cfIntMod= nlIntMod;
    534533  r->cfExactDiv= nlExactDiv;
  • libpolys/coeffs/longrat.cc

    r8ddc7cd r8d5f05  
    8585#define MPZ_EXACTDIV(A,B,C) mpz_divexact((A),(B),(C))
    8686
    87 /// Our Type!
    88 static const n_coeffType ID = n_Q;
    89 
    9087void    _nlDelete_NoImm(number *a);
    9188
     
    120117static number nlMapP(number from, const coeffs src, const coeffs dst)
    121118{
    122   assume( getCoeffType(dst) == ID );
    123119  assume( getCoeffType(src) == n_Zp );
    124120
     
    339335static number nlMapR(number from, const coeffs src, const coeffs dst)
    340336{
    341   assume( getCoeffType(dst) == ID );
    342337  assume( getCoeffType(src) == n_R );
    343338
     
    370365static number nlMapLongR(number from, const coeffs src, const coeffs dst)
    371366{
    372   assume( getCoeffType(dst) == ID );
    373367  assume( getCoeffType(src) == n_long_R );
    374368
     
    12381232number nlModP(number q, const coeffs Q, const coeffs Zp)
    12391233{
    1240   assume( getCoeffType(Q) == ID );
    1241 
    12421234  const int p = n_GetChar(Zp);
    12431235  assume( p > 0 );
     
    12511243  {
    12521244    long i = SR_TO_INT(q);
    1253     if (i<0L)
    1254       return n_Init( static_cast<int>( P - ((-i)%P) ), Zp);
    1255     else
    1256       return n_Init( static_cast<int>( i % P ), Zp );
     1245    return n_Init( i, Zp );
    12571246  }
    12581247
     
    12601249
    12611250  // numerator modulo char. should fit into int
    1262   number z = n_Init( static_cast<int>(mpz_fdiv_ui(q->z, PP)), Zp );
     1251  number z = n_Init( static_cast<long>(mpz_fdiv_ui(q->z, PP)), Zp );
    12631252
    12641253  // denominator != 1?
     
    12661255  {
    12671256    // denominator modulo char. should fit into int
    1268     number n = n_Init( static_cast<int>(mpz_fdiv_ui(q->n, PP)), Zp );
     1257    number n = n_Init( static_cast<long>(mpz_fdiv_ui(q->n, PP)), Zp );
    12691258
    12701259    number res = n_Div( z, n, Zp );
     
    21102099number nlCopyMap(number a, const coeffs src, const coeffs dst)
    21112100{
    2112   assume( getCoeffType(dst) == ID );
    2113   assume( getCoeffType(src) == ID );
    21142101  if ((SR_HDL(a) & SR_INT)||(a==NULL))
    21152102  {
     
    21212108nMapFunc nlSetMap(const coeffs src, const coeffs dst)
    21222109{
    2123   assume( getCoeffType(dst) == ID );
    2124 //  assume( getCoeffType(src) == ID );
    2125 
    21262110  if (nCoeff_is_Q(src))
    21272111  {
     
    24412425static void nlMPZ(mpz_t m, number &n, const coeffs r)
    24422426{
    2443   assume( getCoeffType(r) == ID );
    2444 
    24452427  nlTest(n, r);
    24462428  nlNormalize(n, r);
     
    26612643{
    26622644  assume(cf != NULL);
    2663   assume(getCoeffType(cf) == ID);
    26642645
    26652646  numberCollectionEnumerator.Reset();
     
    26672648  if( !numberCollectionEnumerator.MoveNext() ) // empty zero polynomial?
    26682649  {
    2669     c = n_Init(1, cf);
     2650    c = nlInit(1, cf);
    26702651    return;
    26712652  }
     
    27532734{
    27542735  assume(cf != NULL);
    2755   assume(getCoeffType(cf) == ID);
    27562736
    27572737  numberCollectionEnumerator.Reset();
     
    27592739  if( !numberCollectionEnumerator.MoveNext() ) // empty zero polynomial?
    27602740  {
    2761     c = n_Init(1, cf);
     2741    c = nlInit(1, cf);
    27622742//    assume( n_GreaterZero(c, cf) );
    27632743    return;
     
    28402820  {
    28412821    number &n = numberCollectionEnumerator.Current();
    2842     n_InpMult(n, cand, cf);
     2822    nlInpMult(n, cand, cf);
    28432823  }
    28442824
     
    29792959  r->is_domain=TRUE;
    29802960
    2981   assume( getCoeffType(r) == ID );
    29822961  //const int ch = (int)(long)(p);
    29832962
     
    29942973  if (p==NULL) r->cfDiv   = nlDiv;
    29952974  else         r->cfDiv   = nlIntDiv;
    2996   r->cfIntDiv= nlIntDiv;
    29972975  r->cfIntMod= nlIntMod;
    29982976  r->cfExactDiv= nlExactDiv;
  • libpolys/coeffs/numbers.cc

    r8ddc7cd r8d5f05  
    382382    // post init settings:
    383383    if (n->cfRePart==NULL) n->cfRePart=n->cfCopy;
    384     if (n->cfIntDiv==NULL) n->cfIntDiv=n->cfDiv;
    385384    if (n->cfExactDiv==NULL) n->cfExactDiv=n->cfDiv;
    386385   
     
    399398    assume(n->cfAdd!=NULL);
    400399    assume(n->cfDiv!=NULL);
    401     assume(n->cfIntDiv!=NULL);
    402400    assume(n->cfIntMod!=NULL);
    403401    assume(n->cfExactDiv!=NULL);
  • libpolys/coeffs/rintegers.cc

    r8ddc7cd r8d5f05  
    224224}
    225225
    226 number nrzIntDiv (number a,number b, const coeffs)
     226number nrzExactDiv (number a,number b, const coeffs)
    227227{
    228228  int_number erg = (int_number) omAllocBin(gmp_nrz_bin);
     
    416416  r->cfAdd   = nrzAdd;
    417417  r->cfDiv   = nrzDiv;
    418   r->cfIntDiv= nrzDiv;
    419418  r->cfIntMod= nrzIntMod;
    420   r->cfExactDiv= nrzDiv;
     419  r->cfExactDiv= nrzExactDiv;
    421420  r->cfInit = nrzInit;
    422421  r->cfSize  = nrzSize;
  • libpolys/coeffs/rintegers.h

    r8ddc7cd r8d5f05  
    3030number  nrzGetUnit     (number a, const coeffs r);
    3131number  nrzDiv         (number a, number b, const coeffs r);
    32 number  nrzIntDiv      (number a, number b, const coeffs r);
     32number  nrzExactDiv    (number a, number b, const coeffs r);
    3333number  nrzIntMod      (number a, number b, const coeffs r);
    3434number  nrzNeg         (number c, const coeffs r);
  • libpolys/coeffs/rmodulo2m.cc

    r8ddc7cd r8d5f05  
    126126  r->cfMult        = nr2mMult;
    127127  r->cfDiv         = nr2mDiv;
    128   r->cfIntDiv      = nr2mIntDiv;
    129128  r->cfAnn         = nr2mAnn;
    130129  r->cfIntMod      = nr2mMod;
  • libpolys/coeffs/rmodulon.cc

    r8ddc7cd r8d5f05  
    133133  r->cfMult        = nrnMult;
    134134  r->cfDiv         = nrnDiv;
    135   r->cfIntDiv      = nrnIntDiv;
    136135  r->cfAnn         = nrnAnn;
    137136  r->cfIntMod      = nrnMod;
  • libpolys/polys/coeffrings.h

    r8ddc7cd r8d5f05  
    3636static inline number n_Add(number a, number b, const ring r){ return n_Add(a, b, r->cf);}
    3737static inline number n_Div(number a, number b, const ring r){ return n_Div(a,b, r->cf);}
    38 static inline number n_IntDiv(number a, number b, const ring r){ return n_IntDiv(a,b, r->cf);}
    3938static inline number n_ExactDiv(number a, number b, const ring r){ return n_ExactDiv(a,b, r->cf);}
    4039static inline number n_Gcd(number a, number b, const ring r){ return n_Gcd(a,b, r->cf);}
  • libpolys/polys/ext_fields/algext.cc

    r8ddc7cd r8d5f05  
    14741474  cf->nCoeffIsEqual  = naCoeffIsEqual;
    14751475  cf->cfInvers       = naInvers;
    1476   cf->cfIntDiv       = naDiv; // ???
    14771476  cf->convFactoryNSingN=naConvFactoryNSingN;
    14781477  cf->convSingNFactoryN=naConvSingNFactoryN;
     
    15201519}
    15211520
     1521void npolyPower(number a, int exp, number *b, const coeffs cf)
     1522{
     1523  naTest(a);
     1524
     1525  /* special cases first */
     1526  if (a == NULL)
     1527  {
     1528    if (exp >= 0) *b = NULL;
     1529    else          WerrorS(nDivBy0);
     1530    return;
     1531  }
     1532  else if (exp ==  0) { *b = naInit(1, cf); return; }
     1533  else if (exp ==  1) { *b = naCopy(a, cf); return; }
     1534  else if (exp == -1) { *b = naInvers(a, cf); return; }
     1535
     1536  int expAbs = exp; if (expAbs < 0) expAbs = -expAbs;
     1537
     1538  /* now compute a^expAbs */
     1539  poly pow; poly aAsPoly = (poly)a;
     1540  if (expAbs <= 7)
     1541  {
     1542    pow = p_Copy(aAsPoly, naRing);
     1543    for (int i = 2; i <= expAbs; i++)
     1544    {
     1545      pow = p_Mult_q(pow, p_Copy(aAsPoly, naRing), naRing);
     1546    }
     1547  }
     1548  else
     1549  {
     1550    pow = p_ISet(1, naRing);
     1551    poly factor = p_Copy(aAsPoly, naRing);
     1552    while (expAbs != 0)
     1553    {
     1554      if (expAbs & 1)
     1555      {
     1556        pow = p_Mult_q(pow, p_Copy(factor, naRing), naRing);
     1557      }
     1558      expAbs = expAbs / 2;
     1559      if (expAbs != 0)
     1560      {
     1561        factor = p_Mult_q(factor, p_Copy(factor, naRing), naRing);
     1562      }
     1563    }
     1564    p_Delete(&factor, naRing);
     1565  }
     1566
     1567  /* invert if original exponent was negative */
     1568  number n = (number)pow;
     1569  if (exp < 0)
     1570  {
     1571    number m = npolyInvers(n, cf);
     1572    naDelete(&n, cf);
     1573    n = m;
     1574  }
     1575  *b = n;
     1576}
     1577
    15221578number npolyDiv(number a, number b, const coeffs cf)
    15231579{
     
    15491605     directly accessible in cf: */
    15501606  cf->ch = R->cf->ch;
     1607  cf->is_field=FALSE;
     1608  cf->is_domain=TRUE;
    15511609
    15521610  cf->cfCoeffString = naCoeffString;
     
    15951653  cf->nCoeffIsEqual  = naCoeffIsEqual;
    15961654  cf->cfInvers       = npolyInvers;
    1597   cf->cfIntDiv       = npolyDiv;
    15981655  cf->convFactoryNSingN=naConvFactoryNSingN;
    15991656  cf->convSingNFactoryN=naConvSingNFactoryN;
  • libpolys/polys/ext_fields/transext.cc

    r8ddc7cd r8d5f05  
    130130void     ntDelete(number * a, const coeffs cf);
    131131void     ntCoeffWrite(const coeffs cf, BOOLEAN details);
    132 number   ntIntDiv(number a, number b, const coeffs cf);
    133132const char * ntRead(const char *s, number *a, const coeffs cf);
    134133static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
     
    11971196      {
    11981197        c = p_GetCoeff(p, ntRing);
    1199         tmp = n_Gcd(c, gcdOfCoefficients, ntCoeffs);
     1198        tmp = nlGcd(c, gcdOfCoefficients, ntCoeffs);
    12001199        n_Delete(&gcdOfCoefficients, ntCoeffs);
    12011200        gcdOfCoefficients = tmp;
     
    12061205      {
    12071206        c = p_GetCoeff(p, ntRing);
    1208         tmp = n_Gcd(c, gcdOfCoefficients, ntCoeffs);
     1207        tmp = nlGcd(c, gcdOfCoefficients, ntCoeffs);
    12091208        n_Delete(&gcdOfCoefficients, ntCoeffs);
    12101209        gcdOfCoefficients = tmp;
     
    24682467  cf->nCoeffIsEqual  = ntCoeffIsEqual;
    24692468  cf->cfInvers       = ntInvers;
    2470   cf->cfIntDiv       = ntDiv;
    24712469  cf->cfKillChar     = ntKillChar;
    24722470
  • libpolys/polys/ext_fields/transext.h

    r8ddc7cd r8d5f05  
    127127void     ntDelete(number * a, const coeffs cf);
    128128void     ntCoeffWrite(const coeffs cf, BOOLEAN details);
    129 number   ntIntDiv(number a, number b, const coeffs cf);
    130129const char * ntRead(const char *s, number *a, const coeffs cf);
    131130static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
Note: See TracChangeset for help on using the changeset viewer.