Changeset 2206753 in git


Ignore:
Timestamp:
Nov 29, 2014, 8:49:14 PM (9 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'd1b01e9d51ade4b46b745d3bada5c5f3696be3a8')
Children:
8104914d2d708e24127bd8e7c8155a42a11e2ee4
Parents:
80b6d366c7d9906d194bdb7023d476a11e90d957
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-11-29 20:49:14+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-12-15 18:48:27+01:00
Message:
Hiding all the implementation details (or adding the counting) mostly by
moving internal declarations from private headers into corresponding source files

rm: Remove internal includes (hiding privates) + cleanup
chg: cleanup internal headers
fix the usage of internal implementation functions of coeffs from outside of libpolys/coeffs (or libpolys/polys/ext_fiels)
fix header includes for coeffs/AE*.{h,cc}
add: FIXME&TODO mark reused privates

also starting to fix bigint handling
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/Order/lattice.cc

    r80b6d36 r2206753  
    10691069            for(int j=1;j<=size_elementarray;j++){
    10701070                complexmat->set(r1+2*i,j,n_Mult(complexmat->view(r1+2*i,j),sqrt2,comp),comp);
    1071                 complexmat->set(r1+2*i-1,j,ngcRePart(complexmat->view(r1+2*i,j),comp),comp);
    1072                 complexmat->set(r1+2*i,j,ngcImPart(complexmat->view(r1+2*i,j),comp),comp);
     1071                complexmat->set(r1+2*i-1,j,n_RePart(complexmat->view(r1+2*i,j),comp),comp);
     1072                complexmat->set(r1+2*i,j,n_ImPart(complexmat->view(r1+2*i,j),comp),comp);
    10731073            }
    10741074        }
     
    10971097
    10981098bool IsReal(number a, coeffs coef){ //Im(a)==0
    1099     number imag = ngcImPart(a, coef);
     1099    number imag = n_ImPart(a, coef);
    11001100    bool out = n_IsZero(imag,coef);
    11011101    n_Delete(&imag,coef);
     
    11041104
    11051105bool ImagGreaterZero(number a, coeffs coef){ //Im(a)>0
    1106     number imag = ngcImPart(a, coef);
     1106    number imag = n_ImPart(a, coef);
    11071107    bool out = n_GreaterZero(imag,coef);
    11081108    n_Delete(&imag,coef);
  • Singular/dyn_modules/gfanlib/bbfan.cc

    r80b6d36 r2206753  
    122122    for (int c = 1; c <= cc; c++)
    123123    {
    124       number temp1 = nlInit(1,NULL);
    125       number temp2 = nlSub(IMATELEM(*iv, r, c),temp1,coeffs_BIGINT);
     124      number temp1 = n_Init(1,coeffs_BIGINT);
     125      number temp2 = n_Sub(IMATELEM(*iv, r, c),temp1,coeffs_BIGINT);
    126126      ivCopy->set(r,c,temp2);
    127       nlDelete(&temp1,NULL);
    128       nlDelete(&temp2,NULL);
     127      n_Delete(&temp1,coeffs_BIGINT);
     128      n_Delete(&temp2,coeffs_BIGINT);
    129129    }
    130130  gfan::ZMatrix* zm = bigintmatToZMatrix(ivCopy);
  • Singular/misc_ip.cc

    r80b6d36 r2206753  
    4040#include "mod_lib.h"
    4141
    42 // the following 2 inline functions are just convenience shortcuts for Frank's code:
    43 static inline void number2mpz(number n, mpz_t m){ n_MPZ(m, n, coeffs_BIGINT); }
    44 static inline number mpz2number(mpz_t m){ return n_InitMPZ(m, coeffs_BIGINT); }
     42static FORCE_INLINE void number2mpz(number n, mpz_t m){ number2mpz(n, coeffs_BIGINT, m); }
     43static FORCE_INLINE number mpz2number(mpz_t m){ return mpz2number(m, coeffs_BIGINT); }
    4544
    4645
  • kernel/linear_algebra/interpolation.cc

    r80b6d36 r2206753  
    17541754             mpz_init_set(n->z,temp->polycoef[a]);
    17551755             n->s=3;
    1756              nlNormalize(n, currRing->cf);
     1756             n_Normalize(n, currRing->cf);
    17571757             p=pNSet(n); //a monomial
    17581758             for (j=0;j<variables;j++) pSetExp(p,j+1,temp->polyexp[a][j]);
  • libpolys/coeffs/OPAE.cc

    r80b6d36 r2206753  
    88
    99#include <misc/auxiliary.h>
     10#include <omalloc/omalloc.h>
     11#include <factory/factory.h>
     12#include <misc/mylimits.h>
     13#include <reporter/reporter.h>
     14
     15#include "coeffs.h"
     16#include "numbers.h"
     17#include "mpr_complex.h"
     18
     19#include "OPAE.h"
     20#include "AE.h"
     21
     22#include <string.h>
    1023
    1124#ifdef SINGULAR_4_1
    1225
    13 #include <factory/factory.h>
    14 
    15 #include <string.h>
    16 #include <omalloc/omalloc.h>
    17 #include <coeffs/coeffs.h>
    18 #include <reporter/reporter.h>
    19 #include <coeffs/numbers.h>
    20 #include <coeffs/longrat.h>
    21 #include <coeffs/modulop.h>
    22 #include <coeffs/mpr_complex.h>
    23 #include <misc/mylimits.h>
    24 #include <coeffs/OPAE.h>
    25 #include <coeffs/AE.h>
     26BOOLEAN nAECoeffIsEqual     (number a, number b, const coeffs r);
     27number  nAEMult        (number a, number b, const coeffs r);
     28number  nAESub         (number a, number b, const coeffs r);
     29number  nAEAdd         (number a, number b, const coeffs r);
     30number  nAEDiv         (number a, number b, const coeffs r);
     31number  nAEIntMod      (number a, number b, const coeffs r);// Hir wollte wir was gucken
     32number  nAEExactDiv    (number a, number b, const coeffs r);
     33number  nAEInit        (long i, const coeffs r);
     34number  nAEInitMPZ     (mpz_t m, const coeffs r); //nachgucken/fragen
     35int     nAESize        (number a, const coeffs r);///
     36int     nAEInt         (number &a, const coeffs r);
     37number  nAEMPZ         (number a, const coeffs r); //nachgucken/fragen
     38number  nAENeg         (number c, const coeffs r);
     39number  nAECopy        (number a, number b, const coeffs r); // nachgicken
     40number  nAERePart      (number a, number b, const coeffs r); // nachgicken
     41number  nAEImPart      (number a, number b, const coeffs r); // nachgicken
     42
     43void    nAEWriteLong   (number &a, const coeffs r);//
     44void    nAEWriteShort  (number &a, const coeffs r);//
     45
     46
     47const char *  nAERead  (const char *s, number *a, const coeffs r);
     48number nAENormalize    (number a, number b, const coeffs r);//
     49BOOLEAN nAEGreater     (number a, number b, const coeffs r);//
     50BOOLEAN nAEEqual       (number a, number b, const coeffs r);
     51BOOLEAN nAEIsZero      (number a, const coeffs r);
     52BOOLEAN nAEIsOne       (number a, const coeffs r);
     53BOOLEAN nAEIsMOne      (number a, const coeffs r);
     54BOOLEAN nAEGreaterZero (number a, number b, const coeffs r);
     55void    nAEPower       (number a, int i, number * result, const coeffs r);
     56number nAEGetDenom     (number &a, const coeffs r);//
     57number nAEGetNumerator (number &a, const coeffs r);//
     58number nAEGcd          (number a, number b, const coeffs r);
     59number nAELcm          (number a, number b, const coeffs r);
     60
     61void    nAEDelete       (number *a, const coeffs r);//
     62number    nAESetMap      (number a, const coeffs r);//
     63void    nAEInpMult      (number &a ,number b, const coeffs r);//
     64void    nAECoeffWrite   (const coeffs r, BOOLEAN details);//
     65
     66BOOLEAN nAEClearContent  (number a, const coeffs r);//
     67BOOLEAN nAEClearDenominators  (number a, const coeffs r);//
    2668
    2769
  • libpolys/coeffs/OPAE.h

    r80b6d36 r2206753  
    55****************************************/
    66
    7 #include <coeffs/coeffs.h>
    87#include <misc/auxiliary.h>
    98
     9struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
     10struct snumber; typedef struct snumber *   number;
     11
    1012#ifdef SINGULAR_4_1
    11 
    12 
    1313BOOLEAN n_AEInitChar(coeffs , void *);
    14 BOOLEAN nAECoeffIsEqual     (number a, number b, const coeffs r);
    15 number  nAEMult        (number a, number b, const coeffs r);
    16 number  nAESub         (number a, number b, const coeffs r);
    17 number  nAEAdd         (number a, number b, const coeffs r);
    18 number  nAEDiv         (number a, number b, const coeffs r);
    19 number  nAEIntMod      (number a, number b, const coeffs r);// Hir wollte wir was gucken
    20 number  nAEExactDiv    (number a, number b, const coeffs r);
    21 number  nAEInit        (long i, const coeffs r);
    22 number  nAEInitMPZ     (mpz_t m, const coeffs r); //nachgucken/fragen
    23 int     nAESize        (number a, const coeffs r);///
    24 int     nAEInt         (number &a, const coeffs r);
    25 number  nAEMPZ         (number a, const coeffs r); //nachgucken/fragen
    26 number  nAENeg         (number c, const coeffs r);
    27 number  nAECopy        (number a, number b, const coeffs r); // nachgicken
    28 number  nAERePart      (number a, number b, const coeffs r); // nachgicken
    29 number  nAEImPart      (number a, number b, const coeffs r); // nachgicken
    30 
    31 void    nAEWriteLong   (number &a, const coeffs r);//
    32 void    nAEWriteShort  (number &a, const coeffs r);//
    33 
    34 
    35 const char *  nAERead  (const char *s, number *a, const coeffs r);
    36 number nAENormalize    (number a, number b, const coeffs r);//
    37 BOOLEAN nAEGreater     (number a, number b, const coeffs r);//
    38 BOOLEAN nAEEqual       (number a, number b, const coeffs r);
    39 BOOLEAN nAEIsZero      (number a, const coeffs r);
    40 BOOLEAN nAEIsOne       (number a, const coeffs r);
    41 BOOLEAN nAEIsMOne      (number a, const coeffs r);
    42 BOOLEAN nAEGreaterZero (number a, number b, const coeffs r);
    43 void    nAEPower       (number a, int i, number * result, const coeffs r);
    44 number nAEGetDenom     (number &a, const coeffs r);//
    45 number nAEGetNumerator (number &a, const coeffs r);//
    46 number nAEGcd          (number a, number b, const coeffs r);
    47 number nAELcm          (number a, number b, const coeffs r);
    48 
    49 void    nAEDelete       (number *a, const coeffs r);//
    50 number    nAESetMap      (number a, const coeffs r);//
    51 void    nAEInpMult      (number &a ,number b, const coeffs r);//
    52 void    nAECoeffWrite   (const coeffs r, BOOLEAN details);//
    53 
    54 BOOLEAN nAEClearContent  (number a, const coeffs r);//
    55 BOOLEAN nAEClearDenominators  (number a, const coeffs r);//
     14#endif
    5615
    5716#endif
    58 #endif
  • libpolys/coeffs/OPAEQ.cc

    r80b6d36 r2206753  
    1818#include <reporter/reporter.h>
    1919#include <coeffs/numbers.h>
    20 #include <coeffs/longrat.h>
    21 #include <coeffs/modulop.h>
    2220#include <coeffs/mpr_complex.h>
    2321#include <misc/mylimits.h>
    24 #include <coeffs/OPAEQ.h>
    2522#include <coeffs/AEQ.h>
    2623
     24
     25BOOLEAN nAEQCoeffIsEqual     (number a, number b, const coeffs r);
     26number  nAEQMult        (number a, number b, const coeffs r);
     27number  nAEQSub         (number a, number b, const coeffs r);
     28number  nAEQAdd         (number a, number b, const coeffs r);
     29number  nAEQDiv         (number a, number b, const coeffs r);
     30number  nAEQIntMod      (number a, number b, const coeffs r);// Hir wollte wir was gucken
     31number  nAEQExactDiv    (number a, number b, const coeffs r);
     32number  nAEQInit        (long i, const coeffs r);
     33number  nAEQInitMPZ     (mpz_t m, const coeffs r); //nachgucken/fragen
     34int     nAEQSize        (number a, const coeffs r);///
     35int     nAEQInt         (number &a, const coeffs r);
     36number  nAEQMPZ         (number a, const coeffs r); //nachgucken/fragen
     37number  nAEQNeg         (number c, const coeffs r);
     38number  nAEQCopy        (number a, number b, const coeffs r); // nachgicken
     39number  nAEQRePart      (number a, number b, const coeffs r); // nachgicken
     40number  nAEQImPart      (number a, number b, const coeffs r); // nachgicken
     41
     42void    nAEQWriteLong   (number &a, const coeffs r);//
     43void    nAEQWriteShort  (number &a, const coeffs r);//
     44
     45
     46const char *  nAEQRead  (const char *s, number *a, const coeffs r);
     47number nAEQNormalize    (number a, number b, const coeffs r);//
     48BOOLEAN nAEQGreater     (number a, number b, const coeffs r);//
     49BOOLEAN nAEQEqual       (number a, number b, const coeffs r);
     50BOOLEAN nAEQIsZero      (number a, const coeffs r);
     51BOOLEAN nAEQIsOne       (number a, const coeffs r);
     52BOOLEAN nAEQIsMOne      (number a, const coeffs r);
     53BOOLEAN nAEQGreaterZero (number a, number b, const coeffs r);
     54void    nAEQPower       (number a, int i, number * result, const coeffs r);
     55number nAEQGetDenom     (number &a, const coeffs r);//
     56number nAEQGetNumerator (number &a, const coeffs r);//
     57number nAEQGcd          (number a, number b, const coeffs r);
     58number nAEQLcm          (number a, number b, const coeffs r);
     59
     60void    nAEQDelete       (number *a, const coeffs r);//
     61number    nAEQSetMap      (number a, const coeffs r);//
     62void    nAEQInpMult      (number &a ,number b, const coeffs r);//
     63void    nAEQCoeffWrite   (const coeffs r, BOOLEAN details);//
     64
     65BOOLEAN nAEQClearContent  (number a, const coeffs r);//
     66BOOLEAN nAEQClearDenominators  (number a, const coeffs r);//
    2767
    2868
  • libpolys/coeffs/OPAEQ.h

    r80b6d36 r2206753  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
     6#include <misc/auxiliary.h>
    67
    7 #include <coeffs/coeffs.h>
     8struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
     9struct snumber; typedef struct snumber *   number;
    810
    911#ifdef SINGULAR_4_1
    10 
    11 
    1212BOOLEAN n_QAEInitChar(coeffs , void *);
    13 BOOLEAN nAEQCoeffIsEqual     (number a, number b, const coeffs r);
    14 number  nAEQMult        (number a, number b, const coeffs r);
    15 number  nAEQSub         (number a, number b, const coeffs r);
    16 number  nAEQAdd         (number a, number b, const coeffs r);
    17 number  nAEQDiv         (number a, number b, const coeffs r);
    18 number  nAEQIntMod      (number a, number b, const coeffs r);// Hir wollte wir was gucken
    19 number  nAEQExactDiv    (number a, number b, const coeffs r);
    20 number  nAEQInit        (long i, const coeffs r);
    21 number  nAEQInitMPZ     (mpz_t m, const coeffs r); //nachgucken/fragen
    22 int     nAEQSize        (number a, const coeffs r);///
    23 int     nAEQInt         (number &a, const coeffs r);
    24 number  nAEQMPZ         (number a, const coeffs r); //nachgucken/fragen
    25 number  nAEQNeg         (number c, const coeffs r);
    26 number  nAEQCopy        (number a, number b, const coeffs r); // nachgicken
    27 number  nAEQRePart      (number a, number b, const coeffs r); // nachgicken
    28 number  nAEQImPart      (number a, number b, const coeffs r); // nachgicken
    29 
    30 void    nAEQWriteLong   (number &a, const coeffs r);//
    31 void    nAEQWriteShort  (number &a, const coeffs r);//
    32 
    33 
    34 const char *  nAEQRead  (const char *s, number *a, const coeffs r);
    35 number nAEQNormalize    (number a, number b, const coeffs r);//
    36 BOOLEAN nAEQGreater     (number a, number b, const coeffs r);//
    37 BOOLEAN nAEQEqual       (number a, number b, const coeffs r);
    38 BOOLEAN nAEQIsZero      (number a, const coeffs r);
    39 BOOLEAN nAEQIsOne       (number a, const coeffs r);
    40 BOOLEAN nAEQIsMOne      (number a, const coeffs r);
    41 BOOLEAN nAEQGreaterZero (number a, number b, const coeffs r);
    42 void    nAEQPower       (number a, int i, number * result, const coeffs r);
    43 number nAEQGetDenom     (number &a, const coeffs r);//
    44 number nAEQGetNumerator (number &a, const coeffs r);//
    45 number nAEQGcd          (number a, number b, const coeffs r);
    46 number nAEQLcm          (number a, number b, const coeffs r);
    47 
    48 void    nAEQDelete       (number *a, const coeffs r);//
    49 number    nAEQSetMap      (number a, const coeffs r);//
    50 void    nAEQInpMult      (number &a ,number b, const coeffs r);//
    51 void    nAEQCoeffWrite   (const coeffs r, BOOLEAN details);//
    52 
    53 BOOLEAN nAEQClearContent  (number a, const coeffs r);//
    54 BOOLEAN nAEQClearDenominators  (number a, const coeffs r);//
     13#endif
    5514
    5615#endif
    57 #endif
  • libpolys/coeffs/OPAEp.cc

    r80b6d36 r2206753  
    88
    99#include <misc/auxiliary.h>
     10#include <omalloc/omalloc.h>
    1011
    1112#ifdef SINGULAR_4_1
     
    1314#include <factory/factory.h>
    1415
     16#include <misc/mylimits.h>
     17
     18#include <reporter/reporter.h>
     19
     20#include "coeffs.h"
     21#include "numbers.h"
     22#include "mpr_complex.h"
     23#include "OPAEp.h"
     24#include "AEp.h"
     25
    1526#include <string.h>
    16 #include <omalloc/omalloc.h>
    17 #include <coeffs/coeffs.h>
    18 #include <reporter/reporter.h>
    19 #include <coeffs/numbers.h>
    20 #include <coeffs/longrat.h>
    21 #include <coeffs/modulop.h>
    22 #include <coeffs/mpr_complex.h>
    23 #include <misc/mylimits.h>
    24 #include <coeffs/OPAEp.h>
    25 #include <coeffs/AEp.h>
    26 
    27 
    28 
     27
     28BOOLEAN nAEpCoeffIsEqual     (number a, number b, const coeffs r);
     29number  nAEpMult        (number a, number b, const coeffs r);
     30number  nAEpSub         (number a, number b, const coeffs r);
     31number  nAEpAdd         (number a, number b, const coeffs r);
     32number  nAEpDiv         (number a, number b, const coeffs r);
     33number  nAEpIntMod      (number a, number b, const coeffs r);// Hir wollte wir was gucken
     34number  nAEpExactDiv    (number a, number b, const coeffs r);
     35number  nAEpInit        (long i, const coeffs r);
     36number  nAEpInitMPZ     (mpz_t m, const coeffs r); //nachgucken/fragen
     37int     nAEpSize        (number a, const coeffs r);///
     38int     nAEpInt         (number &a, const coeffs r);
     39number  nAEpMPZ         (number a, const coeffs r); //nachgucken/fragen
     40number  nAEpNeg         (number c, const coeffs r);
     41number  nAEpCopy        (number a, number b, const coeffs r); // nachgicken
     42number  nAEpRePart      (number a, number b, const coeffs r); // nachgicken
     43number  nAEpImPart      (number a, number b, const coeffs r); // nachgicken
     44
     45void    nAEpWriteLong   (number &a, const coeffs r);//
     46void    nAEpWriteShort  (number &a, const coeffs r);//
     47
     48
     49const char *  nAEpRead  (const char *s, number *a, const coeffs r);
     50number nAEpNormalize    (number a, number b, const coeffs r);//
     51BOOLEAN nAEpGreater     (number a, number b, const coeffs r);//
     52BOOLEAN nAEpEqual       (number a, number b, const coeffs r);
     53BOOLEAN nAEpIsZero      (number a, const coeffs r);
     54BOOLEAN nAEpIsOne       (number a, const coeffs r);
     55BOOLEAN nAEpIsMOne      (number a, const coeffs r);
     56BOOLEAN nAEpGreaterZero (number a, number b, const coeffs r);
     57void    nAEpPower       (number a, int i, number * result, const coeffs r);
     58number nAEpGetDenom     (number &a, const coeffs r);//
     59number nAEpGetNumerator (number &a, const coeffs r);//
     60number nAEpGcd          (number a, number b, const coeffs r);
     61number nAEpLcm          (number a, number b, const coeffs r);
     62
     63void    nAEpDelete       (number *a, const coeffs r);//
     64number    nAEpSetMap      (number a, const coeffs r);//
     65void    nAEpInpMult      (number &a ,number b, const coeffs r);//
     66void    nAEpCoeffWrite   (const coeffs r, BOOLEAN details);//
     67
     68BOOLEAN nAEpClearContent  (number a, const coeffs r);//
     69BOOLEAN nAEpClearDenominators  (number a, const coeffs r);//
    2970
    3071
  • libpolys/coeffs/OPAEp.h

    r80b6d36 r2206753  
    55****************************************/
    66
    7 #include <coeffs/coeffs.h>
     7#include <misc/auxiliary.h>
     8
     9struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
     10struct snumber; typedef struct snumber *   number;
    811
    912#ifdef SINGULAR_4_1
    10 
    1113BOOLEAN n_pAEInitChar(coeffs , void *);
    12 BOOLEAN nAEpCoeffIsEqual     (number a, number b, const coeffs r);
    13 number  nAEpMult        (number a, number b, const coeffs r);
    14 number  nAEpSub         (number a, number b, const coeffs r);
    15 number  nAEpAdd         (number a, number b, const coeffs r);
    16 number  nAEpDiv         (number a, number b, const coeffs r);
    17 number  nAEpIntMod      (number a, number b, const coeffs r);// Hir wollte wir was gucken
    18 number  nAEpExactDiv    (number a, number b, const coeffs r);
    19 number  nAEpInit        (long i, const coeffs r);
    20 number  nAEpInitMPZ     (mpz_t m, const coeffs r); //nachgucken/fragen
    21 int     nAEpSize        (number a, const coeffs r);///
    22 int     nAEpInt         (number &a, const coeffs r);
    23 number  nAEpMPZ         (number a, const coeffs r); //nachgucken/fragen
    24 number  nAEpNeg         (number c, const coeffs r);
    25 number  nAEpCopy        (number a, number b, const coeffs r); // nachgicken
    26 number  nAEpRePart      (number a, number b, const coeffs r); // nachgicken
    27 number  nAEpImPart      (number a, number b, const coeffs r); // nachgicken
    28 
    29 void    nAEpWriteLong   (number &a, const coeffs r);//
    30 void    nAEpWriteShort  (number &a, const coeffs r);//
    31 
    32 
    33 const char *  nAEpRead  (const char *s, number *a, const coeffs r);
    34 number nAEpNormalize    (number a, number b, const coeffs r);//
    35 BOOLEAN nAEpGreater     (number a, number b, const coeffs r);//
    36 BOOLEAN nAEpEqual       (number a, number b, const coeffs r);
    37 BOOLEAN nAEpIsZero      (number a, const coeffs r);
    38 BOOLEAN nAEpIsOne       (number a, const coeffs r);
    39 BOOLEAN nAEpIsMOne      (number a, const coeffs r);
    40 BOOLEAN nAEpGreaterZero (number a, number b, const coeffs r);
    41 void    nAEpPower       (number a, int i, number * result, const coeffs r);
    42 number nAEpGetDenom     (number &a, const coeffs r);//
    43 number nAEpGetNumerator (number &a, const coeffs r);//
    44 number nAEpGcd          (number a, number b, const coeffs r);
    45 number nAEpLcm          (number a, number b, const coeffs r);
    46 
    47 void    nAEpDelete       (number *a, const coeffs r);//
    48 number    nAEpSetMap      (number a, const coeffs r);//
    49 void    nAEpInpMult      (number &a ,number b, const coeffs r);//
    50 void    nAEpCoeffWrite   (const coeffs r, BOOLEAN details);//
    51 
    52 BOOLEAN nAEpClearContent  (number a, const coeffs r);//
    53 BOOLEAN nAEpClearDenominators  (number a, const coeffs r);//
     14#endif
    5415
    5516#endif
    56 #endif
  • libpolys/coeffs/bigintmat.cc

    r80b6d36 r2206753  
    1010#include <misc/auxiliary.h>
    1111
    12 
    13 
    1412#include "bigintmat.h"
    1513#include <misc/intvec.h>
    16 #include <coeffs/longrat.h>
    17 
     14
     15#include "rmodulon.h"
    1816
    1917#include <math.h>
    2018#include <string.h>
    2119
     20///create Z/nA of type n_Zn
     21static coeffs numbercoeffs(number n, coeffs c)
     22{
     23  mpz_t p;
     24  number2mpz(n, c, p);
     25  ZnmInfo *pp = new ZnmInfo;
     26  pp->base = p;
     27  pp->exp = 1;
     28  coeffs nc = nInitChar(n_Zn, (void*)pp);
     29  mpz_clear(p);
     30  delete pp;
     31  return nc;
     32}
    2233
    2334//#define BIMATELEM(M,I,J) (M)[ (M).index(I,J) ]
     
    484495    else  // Mit Leerzeichen auffÃŒllen und zahl reinschreiben
    485496    {
    486       for (int j=0; j<colwid[cj]-_nl; j++)
     497      for (int j=0; j<(colwid[cj]-_nl); j++)
    487498        ps[pos+j] = ' ';
    488499      for (int j=0; j<_nl; j++)
     
    19251936      }
    19261937
    1927       number d = nlGetDenom(q, Q),
    1928              n = nlGetNumerator(q, Q);
     1938      number d = n_GetDenom(q, Q),
     1939             n = n_GetNumerator(q, Q);
    19291940
    19301941      n_Delete(&q, Q);
     
    24362447
    24372448
    2438 ///create Z/nA of type n_Zn
    2439 coeffs numbercoeffs(number n, coeffs c) {
    2440   mpz_t p;
    2441   number2mpz(n, c, p);
    2442   ZnmInfo *pp = new ZnmInfo;
    2443   pp->base = p;
    2444   pp->exp = 1;
    2445   coeffs nc = nInitChar(n_Zn, (void*)pp);
    2446   mpz_clear(p);
    2447   delete pp;
    2448   return nc;
    2449 }
    2450 
    24512449bool nCoeffs_are_equal(coeffs r, coeffs s) {
    24522450  if ((r == NULL) || (s == NULL))
  • libpolys/coeffs/bigintmat.h

    r80b6d36 r2206753  
    66
    77#include <omalloc/omalloc.h>
    8 #include <resources/feFopen.h>
    98#include <coeffs/coeffs.h>
    10 #include <coeffs/rmodulon.h>
    119
    1210/**
     
    329327/// Don't use it.
    330328int kernbase (bigintmat *a, bigintmat *c, number p, coeffs q);
    331 coeffs numbercoeffs(number n, coeffs c);
    332329bool nCoeffs_are_equal(coeffs r, coeffs s);
    333 // Geklaut aus anderer Datei:
    334 static inline void number2mpz(number n, coeffs c, mpz_t m){ n_MPZ(m, n, c); }
    335 static inline number mpz2number(mpz_t m, coeffs c){ return n_InitMPZ(m, c); }
    336330// enden wieder
    337331void diagonalForm(bigintmat *a, bigintmat **b, bigintmat **c);
  • libpolys/coeffs/coeffs.h

    r80b6d36 r2206753  
    1111
    1212#include <misc/auxiliary.h>
     13#include <omalloc/omalloc.h>
     14
    1315#include <misc/sirandom.h>
    1416/* for assume: */
     
    7779/// Additionally returns a number;
    7880typedef void (*nCoeffsEnumeratorFunc)(ICoeffsEnumerator& numberCollectionEnumerator, number& output, const coeffs r);
     81
     82extern omBin rnumber_bin;
     83
     84#define FREE_RNUMBER(x) omFreeBin((void *)x, rnumber_bin)
     85#define ALLOC_RNUMBER() (number)omAllocBin(rnumber_bin)
     86#define ALLOC0_RNUMBER() (number)omAlloc0Bin(rnumber_bin)
    7987
    8088
     
    972980CanonicalForm n_convSingNFactoryN( number n, BOOLEAN setChar, const coeffs r );
    973981
     982
     983// TODO: remove the following functions...
     984// the following 2 inline functions are just convenience shortcuts for Frank's code:
     985static FORCE_INLINE void number2mpz(number n, coeffs c, mpz_t m){ n_MPZ(m, n, c); }
     986static FORCE_INLINE number mpz2number(mpz_t m, coeffs c){ return n_InitMPZ(m, c); }
     987
    974988#endif
    975989
  • libpolys/coeffs/ffields.cc

    r80b6d36 r2206753  
    55* ABSTRACT: finite fields with a none-prime number of elements (via tables)
    66*/
    7 
    8 
    9 
    10 
    11 
     7#include <misc/auxiliary.h>
    128#include <omalloc/omalloc.h>
    139
    14 #include <misc/auxiliary.h>
    1510#include <misc/mylimits.h>
    1611#include <misc/sirandom.h>
     
    1813#include <reporter/reporter.h>
    1914
    20 #include <coeffs/coeffs.h>
    21 #include <coeffs/numbers.h>
    22 #include <coeffs/ffields.h>
    23 #include <coeffs/longrat.h>
     15#include "coeffs.h"
     16#include "numbers.h"
     17#include "longrat.h"
    2418
    2519#include <string.h>
     
    803797    return nfMapP;    /* Z/p -> GF(p,n) */
    804798  }
     799   
    805800  if (src->rep==n_rep_gap_rat) /*Q, Z */
    806     return nlModP;
     801  {
     802    return nlModP; // FIXME? TODO? // extern number nlModP(number q, const coeffs Q, const coeffs Zp); // Map q \in QQ \to Zp // FIXME!
     803  }
     804   
    807805  return NULL;     /* default */
    808806}
  • libpolys/coeffs/ffields.h

    r80b6d36 r2206753  
    99#include <misc/auxiliary.h>
    1010
    11 struct n_Procs_s;
    12 typedef struct  n_Procs_s  *coeffs;
     11struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
    1312
    1413//// Initialize r (n_GF)
     
    1716/// Show the mininimal polynom....
    1817/// NOTE: this is used by char *  sleftv::String(void *d, BOOLEAN typed, int dim) (from Singular/subexpr.cc)
    19 /// TODO: rewrite this UGLYNESS!!!
     18/// for printing minpoly
    2019void    nfShowMipo(const coeffs r);
    2120
  • libpolys/coeffs/gnumpc.cc

    r80b6d36 r2206753  
    77* ngc == number gnu complex
    88*/
    9 
    10 
    11 
    12 
    13 
     9#include <misc/auxiliary.h>
    1410#include <omalloc/omalloc.h>
    1511
    16 #include <misc/auxiliary.h>
    1712#include <misc/mylimits.h>
    18 
    1913#include <reporter/reporter.h>
    2014
    21 #include <coeffs/coeffs.h>
    22 #include <coeffs/numbers.h>
    23 
    24 #include <coeffs/longrat.h>
    25 #include <coeffs/modulop.h>
    26 
    27 #include <coeffs/gnumpc.h>
    28 #include <coeffs/gnumpfl.h>
    29 #include <coeffs/shortfl.h>
    30 
    31 #include <coeffs/mpr_complex.h>
    32 
     15#include "coeffs.h"
     16#include "numbers.h"
     17
     18#include "mpr_complex.h"
     19
     20#include "gnumpc.h"
     21#include "longrat.h"
     22#include "gnumpfl.h"
     23#include "modulop.h"
     24#include "shortfl.h"
    3325
    3426/// Get a mapping function from src into the domain of this type: long_C!
     
    388380  {
    389381    gmp_float *re=NULL;
    390     s=ngfRead(s,(number *)&re, r);
     382    s=ngfRead(s,(number *)&re, r); // FIXME? TODO? // extern const char *   ngfRead (const char *s, number *a, const coeffs r);
    391383    gmp_complex *aa=new gmp_complex(*re);
    392384    *a=(number)aa;
     
    675667  if ( from != NULL )
    676668  {
    677     gmp_complex *res=new gmp_complex((double)nrFloat(from));
     669    gmp_complex *res=new gmp_complex((double)nrFloat(from)); // FIXME? TODO? // extern float   nrFloat(number n);
    678670    return (number)res;
    679671  }
     
    688680
    689681  if ( from != NULL )
    690     return ngcInit(npInt(from, aRing), r);
     682    return ngcInit(npInt(from, aRing), r); // FIXME? TODO? // extern int     npInt         (number &n, const coeffs r);
    691683  else
    692684    return NULL;
  • libpolys/coeffs/gnumpc.h

    r80b6d36 r2206753  
    99#include <misc/auxiliary.h>
    1010
    11 struct n_Procs_s;
    12 typedef struct  n_Procs_s  *coeffs;
     11struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
    1312
    1413/// Initialize r (n_long_C)
  • libpolys/coeffs/gnumpfl.cc

    r80b6d36 r2206753  
    88*/
    99
    10 
    1110#include <misc/auxiliary.h>
    12 
    13 #include <coeffs/coeffs.h>
    1411#include <omalloc/omalloc.h>
     12
    1513#include <reporter/reporter.h>
    16 #include <coeffs/numbers.h>
    17 #include <coeffs/modulop.h>
    18 #include <coeffs/longrat.h>
    19 #include <coeffs/shortfl.h>
    20 
    21 #include <coeffs/gnumpfl.h>
    22 #include <coeffs/mpr_complex.h>
     14
     15#include "coeffs.h"
     16#include "numbers.h"
     17#include "mpr_complex.h"
     18
     19#include "longrat.h"
     20#include "shortfl.h"
     21#include "gnumpfl.h"
     22#include "modulop.h"
    2323
    2424//ring ngfMapRing; // to be used also in gnumpc.cc
     
    2626/// Our Type!
    2727static const n_coeffType ID = n_long_R;
     28
     29/// Get a mapping function from src into the domain of this type:
     30nMapFunc  ngfSetMap(const coeffs src, const coeffs dst);
     31
     32const char *   ngfRead (const char *s, number *a, const coeffs r);
     33
     34 // Private interface should be hidden!!!
     35/// Note: MAY NOT WORK AS EXPECTED!
     36BOOLEAN  ngfGreaterZero(number za, const coeffs r);
     37BOOLEAN  ngfGreater(number a, number b, const coeffs r);
     38BOOLEAN  ngfEqual(number a, number b, const coeffs r);
     39BOOLEAN  ngfIsOne(number a, const coeffs r);
     40BOOLEAN  ngfIsMOne(number a, const coeffs r);
     41BOOLEAN  ngfIsZero(number za, const coeffs r);
     42number   ngfInit(long i, const coeffs r);
     43int      ngfInt(number &n, const coeffs r);
     44number   ngfNeg(number za, const coeffs r);
     45number   ngfInvers(number a, const coeffs r);
     46number   ngfAdd(number la, number li, const coeffs r);
     47number   ngfSub(number la, number li, const coeffs r);
     48number   ngfMult(number a, number b, const coeffs r);
     49number   ngfDiv(number a, number b, const coeffs r);
     50void     ngfPower(number x, int exp, number *lu, const coeffs r);
     51number   ngfCopy(number a, const coeffs r);
     52number   ngf_Copy(number a, coeffs r);
     53void     ngfWrite(number &a, const coeffs r);
     54void     ngfCoeffWrite(const coeffs r, BOOLEAN details);
     55
     56void     ngfDelete(number *a, const coeffs r);
     57
     58number ngfMapQ(number from, const coeffs src, const coeffs r);
    2859
    2960union nf
     
    516547  assume( getCoeffType(dst) == ID );
    517548  assume( getCoeffType(src) ==  n_Zp );
    518 
    519   return ngfInit(npInt(from,src), dst);
     549 
     550  return ngfInit(npInt(from,src), dst); // FIXME? TODO? // extern int     npInt         (number &n, const coeffs r);
    520551}
    521552
  • libpolys/coeffs/gnumpfl.h

    r80b6d36 r2206753  
    77* ABSTRACT: computations with GMP floating-point numbers
    88*/
    9 #include <coeffs/coeffs.h>
    109
    11 /// Get a mapping function from src into the domain of this type:
    12 nMapFunc  ngfSetMap(const coeffs src, const coeffs dst);
     10#include <misc/auxiliary.h>
     11
     12struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
     13struct snumber; typedef struct snumber *   number;
    1314
    1415/// Initialize r
    1516BOOLEAN ngfInitChar(coeffs r, void *);
    1617
     18// will be reused by gnumpc.cc
    1719const char *   ngfRead (const char *s, number *a, const coeffs r);
    1820
    19  // Private interface should be hidden!!!
    20 /// Note: MAY NOT WORK AS EXPECTED!
    21 BOOLEAN  ngfGreaterZero(number za, const coeffs r);
    22 BOOLEAN  ngfGreater(number a, number b, const coeffs r);
    23 BOOLEAN  ngfEqual(number a, number b, const coeffs r);
    24 BOOLEAN  ngfIsOne(number a, const coeffs r);
    25 BOOLEAN  ngfIsMOne(number a, const coeffs r);
    26 BOOLEAN  ngfIsZero(number za, const coeffs r);
    27 number   ngfInit(long i, const coeffs r);
    28 int      ngfInt(number &n, const coeffs r);
    29 number   ngfNeg(number za, const coeffs r);
    30 number   ngfInvers(number a, const coeffs r);
    31 number   ngfAdd(number la, number li, const coeffs r);
    32 number   ngfSub(number la, number li, const coeffs r);
    33 number   ngfMult(number a, number b, const coeffs r);
    34 number   ngfDiv(number a, number b, const coeffs r);
    35 void     ngfPower(number x, int exp, number *lu, const coeffs r);
    36 number   ngfCopy(number a, const coeffs r);
    37 number   ngf_Copy(number a, coeffs r);
    38 void     ngfWrite(number &a, const coeffs r);
    39 void     ngfCoeffWrite(const coeffs r, BOOLEAN details);
    40 
    41 void     ngfDelete(number *a, const coeffs r);
    42 
    43 number ngfMapQ(number from, const coeffs src, const coeffs r);
    44 
    4521#endif
  • libpolys/coeffs/longrat.cc

    r80b6d36 r2206753  
    66*/
    77
    8 
    9 
    10 
    118#include <misc/auxiliary.h>
     9#include <omalloc/omalloc.h>
     10
     11#include <factory/factory.h>
     12
    1213#include <misc/sirandom.h>
    13 
    14 #include <factory/factory.h>
    15 
    16 #include <coeffs/rmodulon.h>
    17 #include <coeffs/longrat.h>
     14#include <reporter/reporter.h>
     15
     16#include "rmodulon.h" // ZnmInfo
     17#include "longrat.h"
     18#include "shortfl.h"
     19#include "modulop.h"
     20
     21// allow inlining only from p_Numbers.h and if ! LDEBUG
     22#if defined(DO_LINLINE) && defined(P_NUMBERS_H) && !defined(LDEBUG)
     23#define LINLINE static FORCE_INLINE
     24#else
     25#define LINLINE
     26#undef DO_LINLINE
     27#endif // DO_LINLINE
     28
     29LINLINE BOOLEAN  nlEqual(number a, number b, const coeffs r);
     30LINLINE number   nlInit(long i, const coeffs r);
     31LINLINE BOOLEAN  nlIsOne(number a, const coeffs r);
     32LINLINE BOOLEAN  nlIsZero(number za, const coeffs r);
     33LINLINE number   nlCopy(number a, const coeffs r);
     34LINLINE number   nl_Copy(number a, const coeffs r);
     35LINLINE void     nlDelete(number *a, const coeffs r);
     36LINLINE number   nlNeg(number za, const coeffs r);
     37LINLINE number   nlAdd(number la, number li, const coeffs r);
     38LINLINE number   nlSub(number la, number li, const coeffs r);
     39LINLINE number   nlMult(number a, number b, const coeffs r);
     40LINLINE void nlInpAdd(number &a, number b, const coeffs r);
     41LINLINE void nlInpMult(number &a, number b, const coeffs r);
     42
     43number nlRInit (long i);
     44
     45
     46number   nlInit2 (int i, int j, const coeffs r);
     47number   nlInit2gmp (mpz_t i, mpz_t j, const coeffs r);
     48
     49// number nlInitMPZ(mpz_t m, const coeffs r);
     50// void nlMPZ(mpz_t m, number &n, const coeffs r);
     51
     52void     nlNormalize(number &x, const coeffs r);
     53
     54number   nlGcd(number a, number b, const coeffs r);
     55number nlExtGcd(number a, number b, number *s, number *t, const coeffs);
     56number   nlNormalizeHelper(number a, number b, const coeffs r);   /*special routine !*/
     57BOOLEAN  nlGreater(number a, number b, const coeffs r);
     58BOOLEAN  nlIsMOne(number a, const coeffs r);
     59int      nlInt(number &n, const coeffs r);
     60number   nlBigInt(number &n);
     61
     62#ifdef HAVE_RINGS
     63number nlMapGMP(number from, const coeffs src, const coeffs dst);
     64#endif
     65
     66BOOLEAN  nlGreaterZero(number za, const coeffs r);
     67number   nlInvers(number a, const coeffs r);
     68number   nlDiv(number a, number b, const coeffs r);
     69number   nlExactDiv(number a, number b, const coeffs r);
     70number   nlIntDiv(number a, number b, const coeffs r);
     71number   nlIntMod(number a, number b, const coeffs r);
     72void     nlPower(number x, int exp, number *lu, const coeffs r);
     73const char *   nlRead (const char *s, number *a, const coeffs r);
     74void     nlWrite(number &a, const coeffs r);
     75
     76number   nlGetDenom(number &n, const coeffs r);
     77number   nlGetNumerator(number &n, const coeffs r);
     78void     nlCoeffWrite(const coeffs r, BOOLEAN details);
     79number   nlChineseRemainder(number *x, number *q,int rl, const coeffs C);
     80number   nlFarey(number nN, number nP, const coeffs CF);
     81
     82#ifdef LDEBUG
     83BOOLEAN  nlDBTest(number a, const char *f, const int l);
     84#endif
     85
     86extern number nlOne; // FIXME? TODO? //  move into coeffs?
     87
     88nMapFunc nlSetMap(const coeffs src, const coeffs dst);
     89
     90// in-place operations
     91void nlInpIntDiv(number &a, number b, const coeffs r);
     92
     93#ifdef LDEBUG
     94#define nlTest(a, r) nlDBTest(a,__FILE__,__LINE__, r)
     95BOOLEAN nlDBTest(number a, char *f,int l, const coeffs r);
     96#else
     97#define nlTest(a, r) do {} while (0)
     98#endif
    1899
    19100
     
    66147
    67148#include <coeffs/numbers.h>
    68 #include <coeffs/modulop.h>
    69 #include <coeffs/shortfl.h>
    70149#include <coeffs/mpr_complex.h>
    71150
     
    121200  assume( getCoeffType(src) == n_Zp );
    122201
    123   number to;
    124   to = nlInit(npInt(from,src), dst);
     202  number to = nlInit(npInt(from,src), dst); // FIXME? TODO? // extern int     npInt         (number &n, const coeffs r);
     203   
    125204  return to;
    126205}
     
    348427  assume( getCoeffType(src) == n_R );
    349428
    350   double f=nrFloat(from);
     429  double f=nrFloat(from); // FIXME? TODO? // extern float   nrFloat(number n);
    351430  if (f==0.0) return INT_TO_SR(0);
    352431  int f_sign=1;
  • libpolys/coeffs/longrat.h

    r80b6d36 r2206753  
    88*/
    99#include <misc/auxiliary.h>
    10 #include <omalloc/omalloc.h>
    11 #include <reporter/reporter.h>
    1210
    1311#include <coeffs/si_gmp.h>
    1412#include <coeffs/coeffs.h>
    1513
    16 struct snumber;
    17 typedef struct snumber  *number;
     14struct snumber; typedef struct snumber  *number;
    1815
    1916/*-----------------------------------------------------------------*/
     
    7269#define MP_SMALL 1
    7370
     71BOOLEAN nlInitChar(coeffs, void*);
    7472
    75 
    76 // allow inlining only from p_Numbers.h and if ! LDEBUG
    77 
    78 #if defined(DO_LINLINE) && defined(P_NUMBERS_H) && !defined(LDEBUG)
    79 #define LINLINE static inline
    80 #else
    81 #define LINLINE
    82 #undef DO_LINLINE
    83 #endif // DO_LINLINE
    84 
    85 LINLINE BOOLEAN  nlEqual(number a, number b, const coeffs r);
    86 LINLINE number   nlInit(long i, const coeffs r);
    87 number nlRInit (long i);
    88 LINLINE BOOLEAN  nlIsOne(number a, const coeffs r);
    89 LINLINE BOOLEAN  nlIsZero(number za, const coeffs r);
    90 LINLINE number   nlCopy(number a, const coeffs r);
    91 LINLINE number   nl_Copy(number a, const coeffs r);
    92 LINLINE void     nlDelete(number *a, const coeffs r);
    93 LINLINE number   nlNeg(number za, const coeffs r);
    94 LINLINE number   nlAdd(number la, number li, const coeffs r);
    95 LINLINE number   nlSub(number la, number li, const coeffs r);
    96 LINLINE number   nlMult(number a, number b, const coeffs r);
    97 
    98 BOOLEAN nlInitChar(coeffs r, void*);
    99 
    100 number   nlInit2 (int i, int j, const coeffs r);
    101 number   nlInit2gmp (mpz_t i, mpz_t j, const coeffs r);
    102 
    103 // number nlInitMPZ(mpz_t m, const coeffs r);
    104 // void nlMPZ(mpz_t m, number &n, const coeffs r);
    105 
    106 number   nlGcd(number a, number b, const coeffs r);
    107 number nlExtGcd(number a, number b, number *s, number *t, const coeffs);
    108 number   nlNormalizeHelper(number a, number b, const coeffs r);   /*special routine !*/
    109 BOOLEAN  nlGreater(number a, number b, const coeffs r);
    110 BOOLEAN  nlIsMOne(number a, const coeffs r);
    111 int      nlInt(number &n, const coeffs r);
    112 number   nlBigInt(number &n);
    113 
    114 #ifdef HAVE_RINGS
    115 number nlMapGMP(number from, const coeffs src, const coeffs dst);
    116 void     nlGMP(number &i, number n, const coeffs r);
    117 #endif
    118 
    119 BOOLEAN  nlGreaterZero(number za, const coeffs r);
    120 number   nlInvers(number a, const coeffs r);
    121 void     nlNormalize(number &x, const coeffs r);
    122 number   nlDiv(number a, number b, const coeffs r);
    123 number   nlExactDiv(number a, number b, const coeffs r);
    124 number   nlIntDiv(number a, number b, const coeffs r);
    125 number   nlIntMod(number a, number b, const coeffs r);
    126 void     nlPower(number x, int exp, number *lu, const coeffs r);
    127 const char *   nlRead (const char *s, number *a, const coeffs r);
    128 void     nlWrite(number &a, const coeffs r);
    129 
    130 /// Map q \in QQ \to Zp
    131 number nlModP(number q, const coeffs Q, const coeffs Zp);
    132 
    133 int      nlSize(number n, const coeffs r);
    134 
     73/// only used by slimgb (tgb.cc)
    13574static inline int nlQlogSize (number n, const coeffs r)
    13675{
    13776  assume( nCoeff_is_Q (r) );
    13877
    139   long nl=nlSize(n,r);
     78  long nl=n_Size(n,r);
    14079  if (nl==0L) return 0;
    14180  if (nl==1L)
     
    15796}
    15897
    159 number   nlGetDenom(number &n, const coeffs r);
    160 number   nlGetNumerator(number &n, const coeffs r);
    161 void     nlCoeffWrite(const coeffs r, BOOLEAN details);
    162 number   nlChineseRemainder(number *x, number *q,int rl, const coeffs C);
    163 number   nlFarey(number nN, number nP, const coeffs CF);
    16498
    165 #ifdef LDEBUG
    166 BOOLEAN  nlDBTest(number a, const char *f, const int l);
    167 #endif
    168 extern number nlOne;
     99number nlModP(number q, const coeffs Q, const coeffs Zp);
     100void   nlNormalize(number &x, const coeffs r);
     101void   nlInpGcd(number &a, number b, const coeffs r);
     102void   nlDelete(number *a, const coeffs r);
    169103
    170 nMapFunc nlSetMap(const coeffs src, const coeffs dst);
    171 
    172 extern omBin rnumber_bin;
    173 
    174 #define FREE_RNUMBER(x) omFreeBin((void *)x, rnumber_bin)
    175 #define ALLOC_RNUMBER() (number)omAllocBin(rnumber_bin)
    176 #define ALLOC0_RNUMBER() (number)omAlloc0Bin(rnumber_bin)
    177 
    178 // in-place operations
    179 void nlInpGcd(number &a, number b, const coeffs r);
    180 void nlInpIntDiv(number &a, number b, const coeffs r);
    181 
    182 LINLINE void nlInpAdd(number &a, number b, const coeffs r);
    183 LINLINE void nlInpMult(number &a, number b, const coeffs r);
    184 
    185 #ifdef LDEBUG
    186 #define nlTest(a, r) nlDBTest(a,__FILE__,__LINE__, r)
    187 BOOLEAN nlDBTest(number a, char *f,int l, const coeffs r);
    188 #else
    189 #define nlTest(a, r) do {} while (0)
    190 #endif
     104// FIXME: TODO:  why only if HAVE_RINGS? bug?
     105#  ifdef HAVE_RINGS
     106void   nlGMP(number &i, number n, const coeffs r); // to be replaced with n_MPZ(number n, number &i,const coeffs r)???
     107number nlMapGMP(number from, const coeffs src, const coeffs dst);
     108#  endif
    191109
    192110#endif
  • libpolys/coeffs/longrat0.cc

    r80b6d36 r2206753  
    1010#include <string.h>
    1111
    12 
    13 
    14 
    1512#include <misc/auxiliary.h>
    16 
    1713#include <omalloc/omalloc.h>
    1814#include <reporter/reporter.h>
     
    2016#include "coeffs.h"
    2117#include "numbers.h"
    22 
    2318#include "longrat.h"
    2419
     
    110105    {
    111106      number aa=*a;
    112       nlNormalize(aa,r);
     107      nlNormalize(aa,r); // FIXME? TODO? // extern void     nlNormalize(number &x, const coeffs r);
    113108      *a=aa;
    114109    }
     
    135130    if (a->s==0)
    136131    {
    137       nlNormalize(a,r);
     132      nlNormalize(a,r); // FIXME? TODO? // extern void     nlNormalize(number &x, const coeffs r);
    138133      nlWrite(a,r);
    139134      return;
  • libpolys/coeffs/modulop.cc

    r80b6d36 r2206753  
    66*/
    77
    8 
    9 
    10 
    118#include <misc/auxiliary.h>
     9#include <omalloc/omalloc.h>
    1210
    1311#include <factory/factory.h>
    1412
    15 #include <string.h>
    16 #include <omalloc/omalloc.h>
    17 #include <coeffs/coeffs.h>
    18 #include <reporter/reporter.h>
    19 #include <coeffs/numbers.h>
    20 #include <coeffs/longrat.h>
    21 #include <coeffs/mpr_complex.h>
    2213#include <misc/mylimits.h>
    2314#include <misc/sirandom.h>
    24 #include <coeffs/modulop.h>
    25 
    26 // int npGen=0;
     15
     16#include <reporter/reporter.h>
     17
     18#include <coeffs/coeffs.h>
     19#include <coeffs/numbers.h>
     20#include <coeffs/mpr_complex.h>
     21
     22#include "longrat.h"
     23#include "modulop.h"
     24
     25#include <string.h>
     26
     27// enable large primes (32003 < p < 2^31-)
     28#define NV_OPS
     29#define NV_MAX_PRIME 32003
    2730
    2831/// Our Type!
    2932static const n_coeffType ID = n_Zp;
     33
     34BOOLEAN npGreaterZero (number k, const coeffs r);
     35number  npMult        (number a, number b, const coeffs r);
     36number  npInit        (long i, const coeffs r);
     37int     npInt         (number &n, const coeffs r);
     38number  npAdd         (number a, number b,const coeffs r);
     39number  npSub         (number a, number b,const coeffs r);
     40void    npPower       (number a, int i, number * result,const coeffs r);
     41BOOLEAN npIsZero      (number a,const coeffs r);
     42BOOLEAN npIsOne       (number a,const coeffs r);
     43BOOLEAN npIsMOne       (number a,const coeffs r);
     44number  npDiv         (number a, number b,const coeffs r);
     45number  npNeg         (number c,const coeffs r);
     46number  npInvers      (number c,const coeffs r);
     47BOOLEAN npGreater     (number a, number b,const coeffs r);
     48BOOLEAN npEqual       (number a, number b,const coeffs r);
     49void    npWrite       (number &a, const coeffs r);
     50void    npCoeffWrite  (const coeffs r, BOOLEAN details);
     51const char *  npRead  (const char *s, number *a,const coeffs r);
     52#ifdef LDEBUG
     53BOOLEAN npDBTest      (number a, const char *f, const int l, const coeffs r);
     54#define npTest(A,r)     npDBTest(A,__FILE__,__LINE__, r)
     55#else
     56#define npTest(A,r)     (0)
     57#endif
     58
     59//int     npGetChar();
     60
     61nMapFunc npSetMap(const coeffs src, const coeffs dst);
     62number  npMapP(number from, const coeffs src, const coeffs r);
     63
     64// extern int npGen; // obsolete
     65
     66// int npGen=0;
     67
     68/*-------specials for spolys, do NOT use otherwise--------------------------*/
     69/* for npMultM, npSubM, npNegM, npEqualM : */
     70#ifdef HAVE_DIV_MOD
     71extern unsigned short *npInvTable;
     72#else
     73#ifndef HAVE_MULT_MOD
     74extern long npPminus1M;
     75extern unsigned short *npExpTable;
     76extern unsigned short *npLogTable;
     77#endif
     78#endif
    3079
    3180#ifdef NV_OPS
     
    743792#endif
    744793  if (src->rep==n_rep_gap_rat)  /* Q, Z */
    745   {
    746     return nlModP; // npMap0;
     794  {   
     795    return nlModP; // npMap0; // FIXME? TODO? // extern number nlModP(number q, const coeffs Q, const coeffs Zp); // Map q \in QQ \to Zp // FIXME!
    747796  }
    748797  if ((src->rep==n_rep_int) &&  nCoeff_is_Zp(src) )
  • libpolys/coeffs/modulop.h

    r80b6d36 r2206753  
    77* ABSTRACT: numbers modulo p (<=32003)
    88*/
    9 #include <coeffs/coeffs.h>
     9#include <misc/auxiliary.h>
    1010
    1111// defines are in struct.h
     
    1616// define if an if should be used
    1717//#define HAVE_GENERIC_ADD
    18 
    19 // enable large primes (32003 < p < 2^31-)
    20 #define NV_OPS
    21 #define NV_MAX_PRIME 32003
    22 
    23 // extern int npGen; // obsolete
     18struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
     19struct snumber; typedef struct snumber *   number;
    2420
    2521BOOLEAN npInitChar(coeffs r, void* p);
    26 
    27 BOOLEAN npGreaterZero (number k, const coeffs r);
    28 number  npMult        (number a, number b, const coeffs r);
    29 number  npInit        (long i, const coeffs r);
    30 int     npInt         (number &n, const coeffs r);
    31 number  npAdd         (number a, number b,const coeffs r);
    32 number  npSub         (number a, number b,const coeffs r);
    33 void    npPower       (number a, int i, number * result,const coeffs r);
    34 BOOLEAN npIsZero      (number a,const coeffs r);
    35 BOOLEAN npIsOne       (number a,const coeffs r);
    36 BOOLEAN npIsMOne       (number a,const coeffs r);
    37 number  npDiv         (number a, number b,const coeffs r);
    38 number  npNeg         (number c,const coeffs r);
    39 number  npInvers      (number c,const coeffs r);
    40 BOOLEAN npGreater     (number a, number b,const coeffs r);
    41 BOOLEAN npEqual       (number a, number b,const coeffs r);
    42 void    npWrite       (number &a, const coeffs r);
    43 void    npCoeffWrite  (const coeffs r, BOOLEAN details);
    44 const char *  npRead  (const char *s, number *a,const coeffs r);
    45 #ifdef LDEBUG
    46 BOOLEAN npDBTest      (number a, const char *f, const int l, const coeffs r);
    47 #define npTest(A,r)     npDBTest(A,__FILE__,__LINE__, r)
    48 #else
    49 #define npTest(A,r)     (0)
    50 #endif
    51 
    52 //int     npGetChar();
    53 
    54 nMapFunc npSetMap(const coeffs src, const coeffs dst);
    55 number  npMapP(number from, const coeffs src, const coeffs r);
    56 /*-------specials for spolys, do NOT use otherwise--------------------------*/
    57 /* for npMultM, npSubM, npNegM, npEqualM : */
    58 #ifdef HAVE_DIV_MOD
    59 extern unsigned short *npInvTable;
    60 #else
    61 #ifndef HAVE_MULT_MOD
    62 extern long npPminus1M;
    63 extern unsigned short *npExpTable;
    64 extern unsigned short *npLogTable;
    65 #endif
    66 #endif
    6722
    6823// inline number npMultM(number a, number b, int npPrimeM)
     
    164119// }
    165120
     121// The folloing is reused inside gnumpc.cc, gnumpfl.cc and longrat.cc
     122int     npInt         (number &n, const coeffs r);
    166123
    167 
    168 
     124// The following is currently used in OPAE.cc, OPAEQ.cc and OPAEp.cc for setting their SetMap...
     125nMapFunc npSetMap(const coeffs src, const coeffs dst); // FIXME! BUG?
    169126
    170127#define npEqualM(A,B,r)  ((A)==(B))
  • libpolys/coeffs/mpr_complex.cc

    r80b6d36 r2206753  
    1313
    1414#include <misc/auxiliary.h>
     15#include <omalloc/omalloc.h>
     16
     17#include <reporter/reporter.h>
    1518
    1619//#ifdef HAVE_MPR
    1720#include <coeffs/coeffs.h>
    18 #include <reporter/reporter.h>
    19 #include <omalloc/omalloc.h>
    2021#include <coeffs/numbers.h>
    21 #include <coeffs/longrat.h>
     22
     23#include <coeffs/mpr_complex.h>
     24
     25#include "longrat.h"
     26
    2227#include <math.h>
    23 #include <coeffs/mpr_complex.h>
     28
    2429
    2530//%s
     
    391396        if ( num->s == 0 )
    392397        {
    393           nlNormalize( num, src );
     398          nlNormalize( num, src ); // FIXME? TODO? // extern void     nlNormalize(number &x, const coeffs r); // FIXME
    394399        }
    395400        if (SR_HDL(num) & SR_INT)
     
    450455        if ( num->s == 0 )
    451456        {
    452           nlNormalize( num, src );
     457          nlNormalize( num, src ); // FIXME? TODO? // extern void     nlNormalize(number &x, const coeffs r); // FIXME
    453458        }
    454459        if (SR_HDL(num) & SR_INT)
  • libpolys/coeffs/rintegers.cc

    r80b6d36 r2206753  
    66*/
    77
    8 
    9 
    108#include <misc/auxiliary.h>
     9#include <omalloc/omalloc.h>
     10
     11#include <factory/factory.h>
     12
     13#include <misc/mylimits.h>
     14#include <reporter/reporter.h>
     15
     16#include "coeffs.h"
     17#include "numbers.h"
     18
     19#include "si_gmp.h"
     20
     21#include "mpr_complex.h"
     22#include "rintegers.h"
     23#include "rmodulon.h"
     24
     25#include <string.h>
    1126
    1227#ifdef HAVE_RINGS
    1328
    14 #include <string.h>
    15 #include <misc/mylimits.h>
    16 #include <coeffs/coeffs.h>
    17 #include <reporter/reporter.h>
    18 #include <omalloc/omalloc.h>
    19 #include <coeffs/numbers.h>
    20 #include <coeffs/longrat.h>
    21 #include <coeffs/mpr_complex.h>
    22 #include <coeffs/rintegers.h>
    23 #include <coeffs/rmodulon.h>
    24 #include "si_gmp.h"
    25 #include "factory/factory.h"
    26 
    27 #include <factory/factory.h>
    2829
    2930/// Our Type!
    3031static const n_coeffType ID = n_Z;
     32
     33number  nrzCopy        (number a, const coeffs r);
     34int     nrzSize        (number a, const coeffs r);
     35void    nrzDelete      (number *a, const coeffs r);
     36BOOLEAN nrzGreaterZero (number k, const coeffs r);
     37number  nrzMult        (number a, number b, const coeffs r);
     38number  nrzInit        (long i, const coeffs r);
     39int     nrzInt         (number &n, const coeffs r);
     40number  nrzAdd         (number a, number b, const coeffs r);
     41number  nrzSub         (number a, number b, const coeffs r);
     42void    nrzPower       (number a, int i, number * result, const coeffs r);
     43BOOLEAN nrzIsZero      (number a, const coeffs r);
     44BOOLEAN nrzIsOne       (number a, const coeffs r);
     45BOOLEAN nrzIsMOne      (number a, const coeffs r);
     46BOOLEAN nrzIsUnit      (number a, const coeffs r);
     47number  nrzGetUnit     (number a, const coeffs r);
     48number  nrzDiv         (number a, number b, const coeffs r);
     49number  nrzExactDiv    (number a, number b, const coeffs r);
     50number  nrzIntMod      (number a, number b, const coeffs r);
     51number  nrzNeg         (number c, const coeffs r);
     52number  nrzInvers      (number c, const coeffs r);
     53BOOLEAN nrzGreater     (number a, number b, const coeffs r);
     54BOOLEAN nrzDivBy       (number a, number b, const coeffs r);
     55int     nrzDivComp     (number a, number b, const coeffs r);
     56BOOLEAN nrzEqual       (number a, number b, const coeffs r);
     57number  nrzLcm         (number a,number b, const coeffs r);
     58number  nrzGcd         (number a,number b, const coeffs r);
     59number  nrzExtGcd      (number a, number b, number *s, number *t, const coeffs r);
     60nMapFunc nrzSetMap     (const coeffs src, const coeffs dst);
     61void    nrzWrite       (number &a, const coeffs r);
     62const char *  nrzRead  (const char *s, number *a, const coeffs r);
     63char *  nrzName        (number n, const coeffs r);
     64void    nrzCoeffWrite  (const coeffs r, BOOLEAN details);
     65#ifdef LDEBUG
     66BOOLEAN nrzDBTest      (number a, const char *f, const int l, const coeffs r);
     67#endif
     68void    nrzSetExp(int c, coeffs r);
     69void    nrzInitExp(int c, coeffs r);
     70void    nrzDelete(number *a, const coeffs r);
     71coeffs  nrzQuot1(number c, const coeffs r);
     72
     73//CanonicalForm nrzConvSingNFactoryN(number n, BOOLEAN setChar, const coeffs /*r*/);
     74//number nrzConvFactoryNSingN(const CanonicalForm n, const coeffs r);
     75
     76number nrzMapQ(number from, const coeffs src, const coeffs dst);
     77
    3178
    3279omBin gmp_nrz_bin = omGetSpecBin(sizeof(mpz_t));
  • libpolys/coeffs/rintegers.h

    r80b6d36 r2206753  
    77* ABSTRACT: numbers modulo n
    88*/
     9#include <misc/auxiliary.h>
     10#include <coeffs/coeffs.h>
     11
    912#ifdef HAVE_RINGS
    10 #include <coeffs/coeffs.h>
    1113
    1214#if SI_INTEGER_VARIANT == 3
     
    2325
    2426BOOLEAN nrzInitChar    (coeffs r,  void * parameter);
    25 number  nrzCopy        (number a, const coeffs r);
    26 int     nrzSize        (number a, const coeffs r);
    27 void    nrzDelete      (number *a, const coeffs r);
    28 BOOLEAN nrzGreaterZero (number k, const coeffs r);
    29 number  nrzMult        (number a, number b, const coeffs r);
    30 number  nrzInit        (long i, const coeffs r);
    31 int     nrzInt         (number &n, const coeffs r);
    32 number  nrzAdd         (number a, number b, const coeffs r);
    33 number  nrzSub         (number a, number b, const coeffs r);
    34 void    nrzPower       (number a, int i, number * result, const coeffs r);
    35 BOOLEAN nrzIsZero      (number a, const coeffs r);
    36 BOOLEAN nrzIsOne       (number a, const coeffs r);
    37 BOOLEAN nrzIsMOne      (number a, const coeffs r);
    38 BOOLEAN nrzIsUnit      (number a, const coeffs r);
    39 number  nrzGetUnit     (number a, const coeffs r);
    40 number  nrzDiv         (number a, number b, const coeffs r);
    41 number  nrzExactDiv    (number a, number b, const coeffs r);
    42 number  nrzIntMod      (number a, number b, const coeffs r);
    43 number  nrzNeg         (number c, const coeffs r);
    44 number  nrzInvers      (number c, const coeffs r);
    45 BOOLEAN nrzGreater     (number a, number b, const coeffs r);
    46 BOOLEAN nrzDivBy       (number a, number b, const coeffs r);
    47 int     nrzDivComp     (number a, number b, const coeffs r);
    48 BOOLEAN nrzEqual       (number a, number b, const coeffs r);
    49 number  nrzLcm         (number a,number b, const coeffs r);
    50 number  nrzGcd         (number a,number b, const coeffs r);
    51 number  nrzExtGcd      (number a, number b, number *s, number *t, const coeffs r);
    52 nMapFunc nrzSetMap     (const coeffs src, const coeffs dst);
     27
     28// will be reused by rmodulon.cc
    5329void    nrzWrite       (number &a, const coeffs r);
    54 const char *  nrzRead  (const char *s, number *a, const coeffs r);
    55 char *  nrzName        (number n, const coeffs r);
    56 void    nrzCoeffWrite  (const coeffs r, BOOLEAN details);
    57 #ifdef LDEBUG
    58 BOOLEAN nrzDBTest      (number a, const char *f, const int l, const coeffs r);
     30
    5931#endif
    60 void    nrzSetExp(int c, coeffs r);
    61 void    nrzInitExp(int c, coeffs r);
    62 void    nrzDelete(number *a, const coeffs r);
    63 coeffs  nrzQuot1(number c, const coeffs r);
    6432
    65 //CanonicalForm nrzConvSingNFactoryN(number n, BOOLEAN setChar, const coeffs /*r*/);
    66 //number nrzConvFactoryNSingN(const CanonicalForm n, const coeffs r);
    67 
    68 number nrzMapQ(number from, const coeffs src, const coeffs dst);
    6933#endif
    70 #endif
  • libpolys/coeffs/rmodulo2m.cc

    r80b6d36 r2206753  
    55* ABSTRACT: numbers modulo 2^m
    66*/
    7 
    8 
    9 
    10 
    117#include <misc/auxiliary.h>
    128
     9#include <omalloc/omalloc.h>
     10
     11#include <misc/mylimits.h>
     12#include <reporter/reporter.h>
     13
     14#include "si_gmp.h"
     15#include "coeffs.h"
     16#include "numbers.h"
     17#include "longrat.h"
     18#include "mpr_complex.h"
     19
     20#include "rmodulo2m.h"
     21#include "rmodulon.h"
     22
     23#include <string.h>
     24
    1325#ifdef HAVE_RINGS
    14 
    15 #include <misc/mylimits.h>
    16 #include <coeffs/coeffs.h>
    17 #include <reporter/reporter.h>
    18 #include <omalloc/omalloc.h>
    19 #include <coeffs/numbers.h>
    20 #include <coeffs/longrat.h>
    21 #include <coeffs/mpr_complex.h>
    22 #include <coeffs/rmodulo2m.h>
    23 #include <coeffs/rmodulon.h>
    24 #include "si_gmp.h"
    25 
    26 #include <string.h>
    2726
    2827/// Our Type!
    2928static const n_coeffType ID = n_Z2m;
     29
     30number  nr2mCopy        (number a, const coeffs r);
     31BOOLEAN nr2mGreaterZero (number k, const coeffs r);
     32number  nr2mMult        (number a, number b, const coeffs r);
     33number  nr2mInit        (long i, const coeffs r);
     34int     nr2mInt         (number &n, const coeffs r);
     35number  nr2mAdd         (number a, number b, const coeffs r);
     36number  nr2mSub         (number a, number b, const coeffs r);
     37void    nr2mPower       (number a, int i, number * result, const coeffs r);
     38BOOLEAN nr2mIsZero      (number a, const coeffs r);
     39BOOLEAN nr2mIsOne       (number a, const coeffs r);
     40BOOLEAN nr2mIsMOne      (number a, const coeffs r);
     41BOOLEAN nr2mIsUnit      (number a, const coeffs r);
     42number  nr2mGetUnit     (number a, const coeffs r);
     43number  nr2mDiv         (number a, number b, const coeffs r);
     44number  nr2mIntDiv      (number a,number b, const coeffs r);
     45number  nr2mMod         (number a,number b, const coeffs r);
     46number  nr2mNeg         (number c, const coeffs r);
     47number  nr2mInvers      (number c, const coeffs r);
     48BOOLEAN nr2mGreater     (number a, number b, const coeffs r);
     49BOOLEAN nr2mDivBy       (number a, number b, const coeffs r);
     50int     nr2mDivComp     (number a, number b, const coeffs r);
     51BOOLEAN nr2mEqual       (number a, number b, const coeffs r);
     52number  nr2mLcm         (number a, number b, const coeffs r);
     53number  nr2mGcd         (number a, number b, const coeffs r);
     54number  nr2mExtGcd      (number a, number b, number *s, number *t, const coeffs r);
     55nMapFunc nr2mSetMap     (const coeffs src, const coeffs dst);
     56void    nr2mWrite       (number &a, const coeffs r);
     57const char *  nr2mRead  (const char *s, number *a, const coeffs r);
     58char *  nr2mName        (number n, const coeffs r);
     59void    nr2mCoeffWrite  (const coeffs r, BOOLEAN details);
     60coeffs  nr2mQuot1(number c, const coeffs r);
     61#ifdef LDEBUG
     62BOOLEAN nr2mDBTest      (number a, const char *f, const int l, const coeffs r);
     63#endif
     64void    nr2mSetExp(int c, const coeffs r);
     65void    nr2mInitExp(int c, const coeffs r);
     66
     67number nr2mMapQ(number from, const coeffs src, const coeffs dst);
     68
     69static inline number nr2mMultM(number a, number b, const coeffs r)
     70{
     71  return (number)
     72    ((((unsigned long) a) * ((unsigned long) b)) & ((unsigned long)r->mod2mMask));
     73}
     74
     75static inline number nr2mAddM(number a, number b, const coeffs r)
     76{
     77  return (number)
     78    ((((unsigned long) a) + ((unsigned long) b)) & ((unsigned long)r->mod2mMask));
     79}
     80
     81static inline number nr2mSubM(number a, number b, const coeffs r)
     82{
     83  return (number)((unsigned long)a < (unsigned long)b ?
     84                       r->mod2mMask - (unsigned long)b + (unsigned long)a + 1:
     85                       (unsigned long)a - (unsigned long)b);
     86}
     87
     88#define nr2mNegM(A,r) (number)((r->mod2mMask - (unsigned long)(A) + 1) & r->mod2mMask)
     89#define nr2mEqualM(A,B)  ((A)==(B))
    3090
    3191extern omBin gmp_nrz_bin; /* init in rintegers*/
  • libpolys/coeffs/rmodulo2m.h

    r80b6d36 r2206753  
    88*           fits in an unsigned long
    99*/
     10
     11#include <misc/auxiliary.h>
     12
     13struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
     14struct snumber; typedef struct snumber *   number;
     15
    1016#ifdef HAVE_RINGS
    11 #include <coeffs/coeffs.h>
    12 #include <coeffs/rintegers.h>
    1317
    1418BOOLEAN nr2mInitChar    (coeffs r, void*);
    1519
    16 number  nr2mCopy        (number a, const coeffs r);
    17 BOOLEAN nr2mGreaterZero (number k, const coeffs r);
    18 number  nr2mMult        (number a, number b, const coeffs r);
    19 number  nr2mInit        (long i, const coeffs r);
    20 int     nr2mInt         (number &n, const coeffs r);
    21 number  nr2mAdd         (number a, number b, const coeffs r);
    22 number  nr2mSub         (number a, number b, const coeffs r);
    23 void    nr2mPower       (number a, int i, number * result, const coeffs r);
    24 BOOLEAN nr2mIsZero      (number a, const coeffs r);
    25 BOOLEAN nr2mIsOne       (number a, const coeffs r);
    26 BOOLEAN nr2mIsMOne      (number a, const coeffs r);
    27 BOOLEAN nr2mIsUnit      (number a, const coeffs r);
    28 number  nr2mGetUnit     (number a, const coeffs r);
    29 number  nr2mDiv         (number a, number b, const coeffs r);
    30 number  nr2mIntDiv      (number a,number b, const coeffs r);
    31 number  nr2mMod         (number a,number b, const coeffs r);
    32 number  nr2mNeg         (number c, const coeffs r);
    33 number  nr2mInvers      (number c, const coeffs r);
    34 BOOLEAN nr2mGreater     (number a, number b, const coeffs r);
    35 BOOLEAN nr2mDivBy       (number a, number b, const coeffs r);
    36 int     nr2mDivComp     (number a, number b, const coeffs r);
    37 BOOLEAN nr2mEqual       (number a, number b, const coeffs r);
    38 number  nr2mLcm         (number a, number b, const coeffs r);
    39 number  nr2mGcd         (number a, number b, const coeffs r);
    40 number  nr2mExtGcd      (number a, number b, number *s, number *t, const coeffs r);
    41 nMapFunc nr2mSetMap     (const coeffs src, const coeffs dst);
    42 void    nr2mWrite       (number &a, const coeffs r);
    43 const char *  nr2mRead  (const char *s, number *a, const coeffs r);
    44 char *  nr2mName        (number n, const coeffs r);
    45 void    nr2mCoeffWrite  (const coeffs r, BOOLEAN details);
    46 coeffs  nr2mQuot1(number c, const coeffs r);
    47 #ifdef LDEBUG
    48 BOOLEAN nr2mDBTest      (number a, const char *f, const int l, const coeffs r);
    49 #endif
    50 void    nr2mSetExp(int c, const coeffs r);
    51 void    nr2mInitExp(int c, const coeffs r);
    52 
    53 number nr2mMapQ(number from, const coeffs src, const coeffs dst);
    54 
    55 static inline number nr2mMultM(number a, number b, const coeffs r)
    56 {
    57   return (number)
    58     ((((unsigned long) a) * ((unsigned long) b)) & ((unsigned long)r->mod2mMask));
    59 }
    60 
    61 static inline number nr2mAddM(number a, number b, const coeffs r)
    62 {
    63   return (number)
    64     ((((unsigned long) a) + ((unsigned long) b)) & ((unsigned long)r->mod2mMask));
    65 }
    66 
    67 static inline number nr2mSubM(number a, number b, const coeffs r)
    68 {
    69   return (number)((unsigned long)a < (unsigned long)b ?
    70                        r->mod2mMask - (unsigned long)b + (unsigned long)a + 1:
    71                        (unsigned long)a - (unsigned long)b);
    72 }
    73 
    74 #define nr2mNegM(A,r) (number)((r->mod2mMask - (unsigned long)(A) + 1) & r->mod2mMask)
    75 #define nr2mEqualM(A,B)  ((A)==(B))
    76 
    77 
    7820#endif
    7921#endif
  • libpolys/coeffs/rmodulon.cc

    r80b6d36 r2206753  
    55* ABSTRACT: numbers modulo n
    66*/
    7 
    8 
    9 
    10 
    117#include <misc/auxiliary.h>
     8#include <omalloc/omalloc.h>
     9
     10#include <misc/mylimits.h>
     11#include <reporter/reporter.h>
     12
     13#include "si_gmp.h"
     14#include "coeffs.h"
     15#include "numbers.h"
     16
     17#include "mpr_complex.h"
     18
     19#include "longrat.h"
     20#include "rmodulon.h"
     21
     22#include <string.h>
    1223
    1324#ifdef HAVE_RINGS
    14 
    15 #include <misc/mylimits.h>
    16 #include <coeffs/coeffs.h>
    17 #include <reporter/reporter.h>
    18 #include <omalloc/omalloc.h>
    19 #include <coeffs/numbers.h>
    20 #include <coeffs/longrat.h>
    21 #include <coeffs/mpr_complex.h>
    22 #include <coeffs/rmodulon.h>
    23 #include "si_gmp.h"
    24 
    25 #include <string.h>
    2625
    2726/// Our Type!
    2827static const n_coeffType ID = n_Zn;
    2928static const n_coeffType ID2 = n_Znm;
     29
     30number  nrnCopy        (number a, const coeffs r);
     31int     nrnSize        (number a, const coeffs r);
     32void    nrnDelete      (number *a, const coeffs r);
     33BOOLEAN nrnGreaterZero (number k, const coeffs r);
     34number  nrnMult        (number a, number b, const coeffs r);
     35number  nrnInit        (long i, const coeffs r);
     36int     nrnInt         (number &n, const coeffs r);
     37number  nrnAdd         (number a, number b, const coeffs r);
     38number  nrnSub         (number a, number b, const coeffs r);
     39void    nrnPower       (number a, int i, number * result, const coeffs r);
     40BOOLEAN nrnIsZero      (number a, const coeffs r);
     41BOOLEAN nrnIsOne       (number a, const coeffs r);
     42BOOLEAN nrnIsMOne      (number a, const coeffs r);
     43BOOLEAN nrnIsUnit      (number a, const coeffs r);
     44number  nrnGetUnit     (number a, const coeffs r);
     45number  nrnAnn         (number a, const coeffs r);
     46number  nrnDiv         (number a, number b, const coeffs r);
     47number  nrnMod         (number a,number b, const coeffs r);
     48number  nrnIntDiv      (number a,number b, const coeffs r);
     49number  nrnNeg         (number c, const coeffs r);
     50number  nrnInvers      (number c, const coeffs r);
     51BOOLEAN nrnGreater     (number a, number b, const coeffs r);
     52BOOLEAN nrnDivBy       (number a, number b, const coeffs r);
     53int     nrnDivComp     (number a, number b, const coeffs r);
     54BOOLEAN nrnEqual       (number a, number b, const coeffs r);
     55number  nrnLcm         (number a,number b, const coeffs r);
     56number  nrnGcd         (number a,number b, const coeffs r);
     57number  nrnExtGcd      (number a, number b, number *s, number *t, const coeffs r);
     58number  nrnXExtGcd      (number a, number b, number *s, number *t, number *u, number *v, const coeffs r);
     59number  nrnQuotRem      (number a, number b, number *s, const coeffs r);
     60nMapFunc nrnSetMap     (const coeffs src, const coeffs dst);
     61#if SI_INTEGER_VARIANT==2
     62extern void    nrzWrite       (number &a, const coeffs r); // FIXME
     63# define  nrnWrite      nrzWrite
     64#else
     65void nrnWrite (number &a, const coeffs);
     66#endif
     67const char *  nrnRead  (const char *s, number *a, const coeffs r);
     68void     nrnCoeffWrite (const coeffs r, BOOLEAN details);
     69#ifdef LDEBUG
     70BOOLEAN nrnDBTest      (number a, const char *f, const int l, const coeffs r);
     71#endif
     72void    nrnSetExp(unsigned long c, const coeffs r);
     73void    nrnInitExp(unsigned long c, const coeffs r);
     74coeffs  nrnQuot1(number c, const coeffs r);
     75
     76number nrnMapQ(number from, const coeffs src, const coeffs dst);
     77
    3078
    3179extern omBin gmp_nrz_bin;
  • libpolys/coeffs/rmodulon.h

    r80b6d36 r2206753  
    77* ABSTRACT: numbers modulo n
    88*/
     9#include <misc/auxiliary.h>
     10
     11struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
     12struct snumber; typedef struct snumber *   number;
     13
     14#include <coeffs/rintegers.h>
     15
    916#ifdef HAVE_RINGS
    10 #include <coeffs/coeffs.h>
    11 #include <coeffs/rintegers.h>
    1217
    1318typedef struct { mpz_ptr base;  unsigned long exp; } ZnmInfo;
    1419
    1520BOOLEAN nrnInitChar    (coeffs r, void*);
    16 number  nrnCopy        (number a, const coeffs r);
    17 int     nrnSize        (number a, const coeffs r);
    18 void    nrnDelete      (number *a, const coeffs r);
    19 BOOLEAN nrnGreaterZero (number k, const coeffs r);
    20 number  nrnMult        (number a, number b, const coeffs r);
    21 number  nrnInit        (long i, const coeffs r);
    22 int     nrnInt         (number &n, const coeffs r);
    23 number  nrnAdd         (number a, number b, const coeffs r);
    24 number  nrnSub         (number a, number b, const coeffs r);
    25 void    nrnPower       (number a, int i, number * result, const coeffs r);
    26 BOOLEAN nrnIsZero      (number a, const coeffs r);
    27 BOOLEAN nrnIsOne       (number a, const coeffs r);
    28 BOOLEAN nrnIsMOne      (number a, const coeffs r);
    29 BOOLEAN nrnIsUnit      (number a, const coeffs r);
    30 number  nrnGetUnit     (number a, const coeffs r);
    31 number  nrnAnn         (number a, const coeffs r);
    32 number  nrnDiv         (number a, number b, const coeffs r);
    33 number  nrnMod         (number a,number b, const coeffs r);
    34 number  nrnIntDiv      (number a,number b, const coeffs r);
    35 number  nrnNeg         (number c, const coeffs r);
    36 number  nrnInvers      (number c, const coeffs r);
    37 BOOLEAN nrnGreater     (number a, number b, const coeffs r);
    38 BOOLEAN nrnDivBy       (number a, number b, const coeffs r);
    39 int     nrnDivComp     (number a, number b, const coeffs r);
    40 BOOLEAN nrnEqual       (number a, number b, const coeffs r);
    41 number  nrnLcm         (number a,number b, const coeffs r);
    42 number  nrnGcd         (number a,number b, const coeffs r);
    43 number  nrnExtGcd      (number a, number b, number *s, number *t, const coeffs r);
    44 number  nrnXExtGcd      (number a, number b, number *s, number *t, number *u, number *v, const coeffs r);
    45 number  nrnQuotRem      (number a, number b, number *s, const coeffs r);
    46 nMapFunc nrnSetMap     (const coeffs src, const coeffs dst);
    47 #if SI_INTEGER_VARIANT==2
    48 #define  nrnWrite      nrzWrite
    49 #else
    50 void nrnWrite (number &a, const coeffs);
     21
    5122#endif
    52 const char *  nrnRead  (const char *s, number *a, const coeffs r);
    53 void     nrnCoeffWrite (const coeffs r, BOOLEAN details);
    54 #ifdef LDEBUG
    55 BOOLEAN nrnDBTest      (number a, const char *f, const int l, const coeffs r);
     23
    5624#endif
    57 void    nrnSetExp(unsigned long c, const coeffs r);
    58 void    nrnInitExp(unsigned long c, const coeffs r);
    59 coeffs  nrnQuot1(number c, const coeffs r);
    60 
    61 number nrnMapQ(number from, const coeffs src, const coeffs dst);
    62 #endif
    63 #endif
  • libpolys/coeffs/shortfl.cc

    r80b6d36 r2206753  
    1010
    1111#include <misc/auxiliary.h>
    12 #include <coeffs/shortfl.h>
     12#include <misc/mylimits.h>
     13
     14#include <reporter/reporter.h>
     15
     16#include "numbers.h"
     17#include "coeffs.h"
     18#include "mpr_complex.h"
     19
     20#include "shortfl.h"
     21#include "longrat.h"
    1322
    1423#include <string.h>
    1524#include <math.h>
    16 #include <coeffs/coeffs.h>
    17 #include <coeffs/numbers.h>
    18 #include <reporter/reporter.h>
    19 #include <coeffs/numbers.h>
    20 #include <coeffs/longrat.h>
    21 #include <coeffs/mpr_complex.h>
    22 
    23 #include <misc/mylimits.h>
    2425
    2526/// Our Type!
    2627static const n_coeffType ID = n_R;
     28
     29// Private interface should be hidden!!!
     30
     31BOOLEAN nrGreaterZero (number k, const coeffs r);
     32number  nrMult        (number a, number b, const coeffs r);
     33number  nrInit        (long i, const coeffs r);
     34int     nrInt         (number &n, const coeffs r);
     35number  nrAdd         (number a, number b, const coeffs r);
     36number  nrSub         (number a, number b, const coeffs r);
     37void    nrPower       (number a, int i, number * result, const coeffs r);
     38BOOLEAN nrIsZero      (number a, const coeffs r);
     39BOOLEAN nrIsOne       (number a, const coeffs r);
     40BOOLEAN nrIsMOne      (number a, const coeffs r);
     41number  nrDiv         (number a, number b, const coeffs r);
     42number  nrNeg         (number c, const coeffs r);
     43number  nrInvers      (number c, const coeffs r);
     44BOOLEAN nrGreater     (number a, number b, const coeffs r);
     45BOOLEAN nrEqual       (number a, number b, const coeffs r);
     46void    nrWrite       (number &a, const coeffs r);
     47const char *  nrRead  (const char *s, number *a, const coeffs r);
     48
     49#ifdef LDEBUG
     50BOOLEAN nrDBTest(number a, const coeffs r, const char *f, const int l);
     51#endif
     52
     53/// Get a mapping function from src into the domain of this type: n_R
     54nMapFunc nrSetMap(const coeffs src, const coeffs dst);
     55
     56// Where are the following used?
     57// int     nrGetChar();
     58number nrMapQ(number from, const coeffs r, const coeffs aRing);
    2759
    2860static const float nrEps = 1.0e-3;
  • libpolys/coeffs/shortfl.h

    r80b6d36 r2206753  
    77* ABSTRACT
    88*/
    9 #include <coeffs/coeffs.h>
     9#include <misc/auxiliary.h>
    1010
    11 
    12 /// Get a mapping function from src into the domain of this type: n_R
    13 nMapFunc nrSetMap(const coeffs src, const coeffs dst);
     11struct n_Procs_s; typedef struct  n_Procs_s  *coeffs;
     12struct snumber; typedef struct snumber *   number;
    1413
    1514/// Initialize r
    1615BOOLEAN nrInitChar(coeffs r, void*);
    1716
    18 // Private interface should be hidden!!!
    19 
    20 BOOLEAN nrGreaterZero (number k, const coeffs r);
    21 number  nrMult        (number a, number b, const coeffs r);
    22 number  nrInit        (long i, const coeffs r);
    23 int     nrInt         (number &n, const coeffs r);
    24 number  nrAdd         (number a, number b, const coeffs r);
    25 number  nrSub         (number a, number b, const coeffs r);
    26 void    nrPower       (number a, int i, number * result, const coeffs r);
    27 BOOLEAN nrIsZero      (number a, const coeffs r);
    28 BOOLEAN nrIsOne       (number a, const coeffs r);
    29 BOOLEAN nrIsMOne      (number a, const coeffs r);
    30 number  nrDiv         (number a, number b, const coeffs r);
    31 number  nrNeg         (number c, const coeffs r);
    32 number  nrInvers      (number c, const coeffs r);
    33 BOOLEAN nrGreater     (number a, number b, const coeffs r);
    34 BOOLEAN nrEqual       (number a, number b, const coeffs r);
    35 void    nrWrite       (number &a, const coeffs r);
    36 const char *  nrRead  (const char *s, number *a, const coeffs r);
    37 #ifdef LDEBUG
    38 BOOLEAN nrDBTest(number a, const coeffs r, const char *f, const int l);
    39 #endif
    40 
    41 
    42 
    43 // Where are the following used?
    44 // int     nrGetChar();
    45 number nrMapQ(number from, const coeffs r, const coeffs aRing);
    46 
    47 
     17// will be reused by gnumpc.cc and longrat.cc
    4818/// Converts a n_R number into a float. Needed by Maps
    4919float   nrFloat(number n);
    5020
    51 
    5221#endif
    5322
  • libpolys/polys/ext_fields/algext.cc

    r80b6d36 r2206753  
    4242#include <coeffs/longrat.h>
    4343
     44#include <coeffs/longrat.h>
     45
    4446#include <polys/monomials/ring.h>
    4547#include <polys/monomials/p_polys.h>
     
    959961  // int p = rChar(dst->extRing);
    960962
    961   number q = nlModP(a, src, dst->extRing->cf);
     963  number q = nlModP(a, src, dst->extRing->cf); // FIXME? TODO? // extern number nlModP(number q, const coeffs Q, const coeffs Zp); // Map q \in QQ \to pZ
    962964
    963965  poly result = p_NSet(q, dst->extRing);
  • libpolys/polys/ext_fields/algext.h

    r80b6d36 r2206753  
    6363poly      p_ExtGcd(poly p, poly &pFactor, poly q, poly &qFactor, ring r);
    6464
    65 
     65char* naCoeffString(const coeffs r); // will be reused in tranext.cc...
    6666#endif
    6767/* ALGEXT_H */
  • libpolys/polys/ext_fields/transext.cc

    r80b6d36 r2206753  
    11491149      {
    11501150        c = p_GetCoeff(p, ntRing);
    1151         tmp = nlGcd(c, gcdOfCoefficients, ntCoeffs);
     1151        tmp = n_Gcd(c, gcdOfCoefficients, ntCoeffs);
    11521152        n_Delete(&gcdOfCoefficients, ntCoeffs);
    11531153        gcdOfCoefficients = tmp;
     
    11581158      {
    11591159        c = p_GetCoeff(p, ntRing);
    1160         tmp = nlGcd(c, gcdOfCoefficients, ntCoeffs);
     1160        tmp = n_Gcd(c, gcdOfCoefficients, ntCoeffs);
    11611161        n_Delete(&gcdOfCoefficients, ntCoeffs);
    11621162        gcdOfCoefficients = tmp;
     
    15141514    {
    15151515      pGcd = pa;
    1516       p_SetCoeff (pGcd, nlGcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing);
     1516      p_SetCoeff (pGcd, n_Gcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing);
    15171517    }
    15181518    else
     
    17691769    return res;
    17701770  }
    1771   number nn=nlGetDenom(a,src);
    1772   number zz=nlGetNumerator(a,src);
     1771  number nn=n_GetDenom(a,src);
     1772  number zz=n_GetNumerator(a,src);
    17731773  number res=ntInit(p_NSet(zz,dst->extRing), dst);
    17741774  fraction ff=(fraction)res;
     
    18881888  if (n_IsZero(a, src)) return NULL;
    18891889  // int p = rChar(dst->extRing);
    1890   number q = nlModP(a, src, dst->extRing->cf);
     1890
     1891  number q = nlModP(a, src, dst->extRing->cf); // FIXME? TODO? // extern number nlModP(number q, const coeffs Q, const coeffs Zp); // Map q \in QQ \to Zp
    18911892
    18921893  if (n_IsZero(q, dst->extRing->cf))
     
    24022403
    24032404  cf->factoryVarOffset = R->cf->factoryVarOffset + rVar(R);
    2404   extern char* naCoeffString(const coeffs r);
    2405   cf->cfCoeffString = naCoeffString;
     2405   
     2406  cf->cfCoeffString = naCoeffString; // FIXME? TODO? // extern char* naCoeffString(const coeffs r);
    24062407
    24072408  cf->cfGreaterZero  = ntGreaterZero;
  • libpolys/polys/monomials/p_polys.cc

    r80b6d36 r2206753  
    133133    for(j=rl-1;j>=0;j--)
    134134    {
    135       x[j]=NULL; // nlInit(0...) takes no memory
     135      x[j]=NULL; // n_Init(0...) takes no memory
    136136    }
    137137    if (n_IsZero(n,R)) p_Delete(&h,R);
     
    24212421  {
    24222422#if 0
    2423     d=nlGcd(h,pGetCoeff(p),r->cf);
    2424     nlDelete(&h,r->cf);
     2423    d=n_Gcd(h,pGetCoeff(p),r->cf);
     2424    n_Delete(&h,r->cf);
    24252425    h = d;
    2426 #else
    2427     nlInpGcd(h,pGetCoeff(p),r->cf);
    2428 #endif
    2429     if(nlSize(h,r->cf)<smax)
     2426#else   
     2427    STATISTIC(n_Gcd); nlInpGcd(h,pGetCoeff(p),r->cf); // FIXME? TODO? // extern void nlInpGcd(number &a, number b, const coeffs r);
     2428#endif
     2429    if(n_Size(h,r->cf)<smax)
    24302430    {
    24312431      //if (TEST_OPT_PROT) PrintS("g");
     
    24352435  }
    24362436  p = ph;
    2437   if (!nlGreaterZero(pGetCoeff(p),r->cf)) h=nlNeg(h,r->cf);
    2438   if(nlIsOne(h,r->cf)) return;
     2437  if (!n_GreaterZero(pGetCoeff(p),r->cf)) h=n_InpNeg(h,r->cf);
     2438  if(n_IsOne(h,r->cf)) return;
    24392439  //if (TEST_OPT_PROT) PrintS("c");
    24402440  while (p!=NULL)
    24412441  {
    24422442#if 1
    2443     d = nlExactDiv(pGetCoeff(p),h,r->cf);
     2443    d = n_ExactDiv(pGetCoeff(p),h,r->cf);
    24442444    p_SetCoeff(p,d,r);
    24452445#else
    2446     nlInpExactDiv(pGetCoeff(p),h,r->cf);
     2446    STATISTIC(n_ExactDiv); nlInpExactDiv(pGetCoeff(p),h,r->cf); // no such function... ?
    24472447#endif
    24482448    pIter(p);
    24492449  }
    2450   nlDelete(&h,r->cf);
     2450  n_Delete(&h,r->cf);
    24512451}
    24522452#endif
     
    24622462  if (pNext(pNext(ph))==NULL)
    24632463  {
    2464     return nlGetNom(pGetCoeff(pNext(ph)),r->cf);
     2464    return n_GetNumerator(pGetCoeff(pNext(ph)),r->cf);
    24652465  }
    24662466  poly p=ph;
    2467   number n1=nlGetNom(pGetCoeff(p),r->cf);
     2467  number n1=n_GetNumerator(pGetCoeff(p),r->cf);
    24682468  pIter(p);
    2469   number n2=nlGetNom(pGetCoeff(p),r->cf);
     2469  number n2=n_GetNumerator(pGetCoeff(p),r->cf);
    24702470  pIter(p);
    24712471  number d;
     
    24742474  {
    24752475    nlNormalize(pGetCoeff(p),r->cf);
    2476     t=nlGetNom(pGetCoeff(p),r->cf);
     2476    t=n_GetNumerator(pGetCoeff(p),r->cf);
    24772477    if (nlGreaterZero(t,r->cf))
    24782478      d=nlAdd(n1,t,r->cf);
     
    24852485    if (p==NULL) break;
    24862486    nlNormalize(pGetCoeff(p),r->cf);
    2487     t=nlGetNom(pGetCoeff(p),r->cf);
     2487    t=n_GetNumerator(pGetCoeff(p),r->cf);
    24882488    if (nlGreaterZero(t,r->cf))
    24892489      d=nlAdd(n2,t,r->cf);
     
    25132513    if(ph==NULL)
    25142514    {
    2515       if (s2==-1) return nlCopy(d,r->cf);
     2515      if (s2==-1) return n_Copy(d,r->cf);
    25162516      break;
    25172517    }
     
    25332533    }
    25342534  }
    2535   return nlGcd(d,d2,r->cf);
     2535  return n_Gcd(d,d2,r->cf);
    25362536}
    25372537#endif
Note: See TracChangeset for help on using the changeset viewer.