Changeset b4d1cea in git for libpolys


Ignore:
Timestamp:
Feb 28, 2022, 5:29:34 PM (2 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
70075debc39875c9ffdec250a52ca8c90a7f366c
Parents:
ecc9b0300bad1712cd9abf9a2927e0ac71d49bc5
Message:
coeffs: set/test all function pointers
Location:
libpolys/coeffs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/coeffs.h

    recc9b0 rb4d1cea  
    228228           (*cfIsZero)(number a, const coeffs r),
    229229           (*cfIsOne)(number a, const coeffs r),
    230        // IsMOne is used for printing os polynomials:
     230       // IsMOne is used for printing of polynomials:
    231231       // -1 is only printed for constant monomials
    232232           (*cfIsMOne)(number a, const coeffs r),
  • libpolys/coeffs/numbers.cc

    recc9b0 rb4d1cea  
    121121static number ndGetUnit_Ring(number, const coeffs r)
    122122{ return r->cfInit(1,r); }
     123static number ndRandom(siRandProc p, number p1, number p2, const coeffs cf)
     124{ return cf->cfInit(p(),cf); }
     125static number ndEucNorm(number a, const coeffs cf)
     126{ return cf->cfInit(cf->cfSize(a,cf),cf); }
    123127#ifdef LDEBUG
    124128// static void   nDBDummy1(number* d,char *, int) { *d=NULL; }
     
    131135  return NULL;
    132136}
     137static number ndXExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
     138{
     139  Werror("XExtGcd not implemented for %s (c=%d)",r->cfCoeffName(r),getCoeffType(r));
     140  return NULL;
     141}
    133142static number ndChineseRemainder(number *,number *,int,BOOLEAN,CFArray&,const coeffs r)
    134143{
    135144  Werror("ChineseRemainder not implemented for %s (c=%d)",r->cfCoeffName(r),getCoeffType(r));
    136145  return r->cfInit(0,r);
     146}
     147number ndReadFd( const ssiInfo *f, const coeffs r)
     148{
     149  Warn("ReadFd not implemented for %s (c=%d)",r->cfCoeffName(r),getCoeffType(r));
     150  return NULL;
     151}
     152
     153static void ndWriteFd(number a, const ssiInfo *f, const coeffs r)
     154{
     155  Warn("WriteFd not implemented for %s (c=%d)",r->cfCoeffName(r),getCoeffType(r));
    137156}
    138157
     
    378397    n->cfCoeffWrite = ndCoeffWrite;
    379398    n->cfCoeffName = ndCoeffName; // should alway be changed!
     399    n->cfInpAdd=ndInpAdd;
    380400    n->cfInpMult=ndInpMult;
    381     n->cfInpAdd=ndInpAdd;
    382401    n->cfCopy = ndCopy;
    383402    n->cfIntMod=ndIntMod; /* dummy !! */
     
    391410    n->cfQuotRem = ndQuotRem;
    392411    n->cfInvers = ndInvers;
     412    n->cfRandom = ndRandom;
    393413
    394414    n->cfKillChar = ndKillChar; /* dummy */
     
    396416    // temp. removed to catch all the coeffs which miss to implement this!
    397417
    398     n->cfChineseRemainder = ndChineseRemainder;
    399     n->cfFarey = ndFarey;
    400     n->cfParDeg = ndParDeg;
     418    n->cfChineseRemainder = ndChineseRemainder; /* not implemented */
     419    n->cfFarey = ndFarey; /* not implemented */
     420    n->cfParDeg = ndParDeg; /* not implemented */
     421    n->cfReadFd = ndReadFd; /* not implemented */
     422    n->cfWriteFd = ndWriteFd; /* not implemented */
    401423
    402424    n->cfParameter = ndParameter;
     
    405427    n->cfClearDenominators = ndClearDenominators;
    406428
    407     //n->cfIsUnit = ndIsUnit;
     429    n->cfEucNorm = ndEucNorm;
    408430#ifdef HAVE_RINGS
    409431    n->cfDivComp = ndDivComp;
    410432    n->cfDivBy = ndDivBy;
    411433    n->cfExtGcd = ndExtGcd;
     434    n->cfXExtGcd = ndXExtGcd;
    412435    //n->cfGetUnit = ndGetUnit_Ring;// set afterwards
    413436#endif
     
    436459    if (n->cfExactDiv==NULL) n->cfExactDiv=n->cfDiv;
    437460    if (n->cfSubringGcd==NULL) n->cfSubringGcd=n->cfGcd;
     461    if (n->cfWriteShort==NULL) n->cfWriteShort = n->cfWriteLong;
    438462    if (n->cfIsUnit==NULL)
    439463    {
     
    449473    #endif
    450474
    451     if(n->cfWriteShort==NULL)
    452       n->cfWriteShort = n->cfWriteLong;
    453 
    454     assume(n->nCoeffIsEqual!=NULL);
    455     assume(n->cfSetChar!=NULL);
    456     assume(n->cfCoeffName!=ndCoeffName);
    457     assume(n->cfMult!=NULL);
    458     assume(n->cfSub!=NULL);
    459     assume(n->cfAdd!=NULL);
    460     assume(n->cfDiv!=NULL);
    461     assume(n->cfIntMod!=NULL);
    462     assume(n->cfExactDiv!=NULL);
    463     assume(n->cfInit!=NULL);
    464     assume(n->cfInitMPZ!=NULL);
    465     assume(n->cfSize!=NULL);
    466     assume(n->cfInt!=NULL);
    467     assume(n->cfMPZ!=NULL);
    468     //assume(n->n->cfDivComp!=NULL);
    469     //assume(n->cfIsUnit!=NULL);
    470     //assume(n->cfGetUnit!=NULL);
    471     //assume(n->cfExtGcd!=NULL);
    472     assume(n->cfInpNeg!=NULL);
    473     assume(n->cfCopy!=NULL);
    474 
    475     assume(n->cfWriteLong!=NULL);
    476     assume(n->cfWriteShort!=NULL);
     475
     476    if(n->cfMult==NULL)  PrintS("cfMult missing\n");
     477    if(n->cfSub==NULL)  PrintS("cfSub missing\n");
     478    if(n->cfAdd==NULL) PrintS("cfAdd missing\n");
     479    if(n->cfDiv==NULL) PrintS("cfDiv missing\n");
     480    if(n->cfExactDiv==NULL) PrintS("cfExactDiv missing\n");
     481    if(n->cfInit==NULL) PrintS("cfInit missing\n");
     482    if(n->cfInt==NULL) PrintS("cfInt missing\n");
     483    if(n->cfIsUnit==NULL) PrintS("cfIsUnit missing\n");
     484    if(n->cfGetUnit==NULL) PrintS("cfGetUnit missing\n");
     485    if(n->cfInpNeg==NULL)  PrintS("cfInpNeg missing\n");
     486    if(n->cfXExtGcd==NULL)  PrintS("cfXExtGcd missing\n");
     487    if(n->cfAnn==NULL)  PrintS("cfAnn missing\n");
     488    if(n->cfWriteLong==NULL) PrintS("cfWriteLong missing\n");
    477489
    478490    assume(n->iNumberOfParameters>= 0);
     
    481493            (n->iNumberOfParameters >  0 && n->pParameterNames != NULL) );
    482494
    483     assume(n->cfParameter!=NULL);
    484     assume(n->cfParDeg!=NULL);
    485 
    486     assume(n->cfRead!=NULL);
    487     assume(n->cfNormalize!=NULL);
    488     assume(n->cfGreater!=NULL);
    489     //assume(n->cfDivBy!=NULL);
    490     assume(n->cfEqual!=NULL);
    491     assume(n->cfIsZero!=NULL);
    492     assume(n->cfIsOne!=NULL);
    493     assume(n->cfIsMOne!=NULL);
    494     assume(n->cfGreaterZero!=NULL);
    495     assume(n->cfGetDenom!=NULL);
    496     assume(n->cfGetNumerator!=NULL);
    497     assume(n->cfGcd!=NULL);
    498     assume(n->cfNormalizeHelper!=NULL);
    499     assume(n->cfDelete!=NULL);
    500     assume(n->cfSetMap!=NULL);
    501     assume(n->cfInpMult!=NULL);
    502 //    assume(n->cfInit_bigint!=NULL);
    503     assume(n->cfCoeffWrite != NULL);
    504 
    505     assume(n->cfClearContent != NULL);
    506     assume(n->cfClearDenominators != NULL);
     495
     496    if(n->cfRead==NULL) PrintS("cfRead missing\n");
     497    if(n->cfGreater==NULL) PrintS("cfGreater missing\n");
     498    if(n->cfEqual==NULL) PrintS("cfEqual missing\n");
     499    if(n->cfIsZero==NULL) PrintS("cfIsZero missing\n");
     500    if(n->cfIsOne==NULL) PrintS("cfIsOne missing\n");
     501    if(n->cfIsMOne==NULL) PrintS("cfIsMOne missing\n");
     502    if(n->cfGreaterZero==NULL) PrintS("cfGreaterZero missing\n");
     503    if(n->cfSetMap==NULL) PrintS("cfSetMap missing\n");
    507504
    508505    assume(n->type==t);
    509506
    510507#ifndef SING_NDEBUG
    511     if(n->cfKillChar==NULL) Warn("cfKillChar is NULL for coeff %d",t);
    512508    if(n->cfWriteLong==NULL) Warn("cfWrite is NULL for coeff %d",t);
    513509    if(n->cfWriteShort==NULL) Warn("cfWriteShort is NULL for coeff %d",t);
  • libpolys/coeffs/numbers.h

    recc9b0 rb4d1cea  
    7979CanonicalForm ndConvSingNFactoryN( number, BOOLEAN /*setChar*/, const coeffs);
    8080
     81number ndReadFd( const ssiInfo *f, const coeffs r);
    8182/// Test whether a is a zero divisor in r
    8283/// i.e. not coprime with char. of r
Note: See TracChangeset for help on using the changeset viewer.