1 | #ifndef NUMBERS_H |
---|
2 | #define NUMBERS_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id$ */ |
---|
7 | /* |
---|
8 | * ABSTRACT: compatility interface to coeffs |
---|
9 | */ |
---|
10 | #include <coeffs/coeffs.h> |
---|
11 | |
---|
12 | /* |
---|
13 | // the access methods |
---|
14 | // |
---|
15 | // the routines w.r.t. currRing: |
---|
16 | // (should only be used in the context of currRing, i.e. in t |
---|
17 | #define nCopy(n) n_Copy(n, currRing->cf) |
---|
18 | #define nDelete(n) n_Delete(n, currRing->cf) |
---|
19 | #define nMult(n1, n2) n_Mult(n1, n2, currRing->cf) |
---|
20 | #define nAdd(n1, n2) n_Add(n1, n2, currRing->cf) |
---|
21 | #define nIsZero(n) n_IsZero(n, currRing->cf) |
---|
22 | #define nEqual(n1, n2) n_Equal(n1, n2, currRing->cf) |
---|
23 | #define nNeg(n) n_Neg(n, currRing->cf) |
---|
24 | #define nSub(n1, n2) n_Sub(n1, n2, currRing->cf) |
---|
25 | #define nGetChar() nInternalChar(currRing->cf) |
---|
26 | #define nInit(i) n_Init(i, currRing->cf) |
---|
27 | #define nIsOne(n) n_IsOne(n, currRing->cf) |
---|
28 | #define nIsMOne(n) n_IsMOne(n, currRing->cf) |
---|
29 | #define nGreaterZero(n) n_GreaterZero(n, currRing->cf) |
---|
30 | #define nWrite(n) n_Write(n,currRing->cf) |
---|
31 | #define nNormalize(n) n_Normalize(n,currRing->cf) |
---|
32 | #define nGcd(a, b) n_Gcd(a,b,currRing->cf) |
---|
33 | #define nIntDiv(a, b) n_IntDiv(a,b,currRing->cf) |
---|
34 | #define nDiv(a, b) n_Div(a,b,currRing->cf) |
---|
35 | #define nInvers(a) n_Invers(a,currRing->cf) |
---|
36 | #define nExactDiv(a, b) n_ExactDiv(a,b,currRing->cf) |
---|
37 | #define nTest(a) n_Test(a,currRing->cf) |
---|
38 | |
---|
39 | #define nInpMult(a, b) n_InpMult(a,b,currRing->cf) |
---|
40 | #define nPower(a, b, res) n_Power(a,b,res,currRing->cf) |
---|
41 | #define nSize(n) n_Size(n,currRing->cf) |
---|
42 | #define nGetDenom(N) n_GetDenom((N),currRing->cf) |
---|
43 | #define nGetNumerator(N) n_GetNumerator((N),currRing->cf) |
---|
44 | |
---|
45 | #define nSetMap(R) n_SetMap(R,currRing->cf) |
---|
46 | */ |
---|
47 | |
---|
48 | |
---|
49 | // -------------------------------------------------------------- |
---|
50 | // internal to coeffs, but public for all realizations |
---|
51 | |
---|
52 | #define SHORT_REAL_LENGTH 6 // use short reals for real <= 6 digits |
---|
53 | |
---|
54 | /* the dummy routines: */ |
---|
55 | void nDummy1(number* d); |
---|
56 | void ndDelete(number* d, const coeffs r); |
---|
57 | number ndGcd(number a, number b, const coeffs); |
---|
58 | number ndCopy(number a, const coeffs r); |
---|
59 | number ndCopyMap(number a, const coeffs src, const coeffs dst); |
---|
60 | int ndSize(number a, const coeffs r); |
---|
61 | char * ndName(number n, const coeffs r); |
---|
62 | number ndPar(int i, const coeffs r); |
---|
63 | int ndParDeg(number n, const coeffs r); |
---|
64 | number ndGetDenom(number &n, const coeffs r); |
---|
65 | number ndGetNumerator(number &a,const coeffs r); |
---|
66 | number ndReturn0(number n, const coeffs r); |
---|
67 | number ndIntMod(number a, number b, const coeffs r); |
---|
68 | |
---|
69 | void ndInpMult(number &a, number b, const coeffs r); |
---|
70 | void ndInpAdd(number &a, number b, const coeffs r); |
---|
71 | |
---|
72 | void ndKillChar(coeffs); |
---|
73 | |
---|
74 | number ndInit_bigint(number i, const coeffs dummy, const coeffs dst); |
---|
75 | |
---|
76 | /// Test whether a is a zero divisor in r |
---|
77 | /// i.e. not coprime with char. of r |
---|
78 | /// very inefficient implementation: |
---|
79 | /// should ONLY be used for debug stuff /tests |
---|
80 | BOOLEAN n_IsZeroDivisor( number a, const coeffs r); |
---|
81 | |
---|
82 | #ifdef LDEBUG |
---|
83 | void nDBDummy1(number* d,char *f, int l); |
---|
84 | BOOLEAN ndDBTest(number a, const char *f, const int l, const coeffs r); |
---|
85 | #endif |
---|
86 | |
---|
87 | #define nDivBy0 "div by 0" |
---|
88 | |
---|
89 | // dummy routines |
---|
90 | void ndNormalize(number& d, const coeffs); // nNormalize... |
---|
91 | |
---|
92 | /// initialize an object of type coeff, return FALSE in case of success |
---|
93 | typedef BOOLEAN (*cfInitCharProc)(coeffs, void *); |
---|
94 | n_coeffType nRegister(n_coeffType n, cfInitCharProc p); |
---|
95 | |
---|
96 | #endif |
---|