1 | #ifndef NUMBERS_H |
---|
2 | #define NUMBERS_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* |
---|
7 | * ABSTRACT: compatility interface to coeffs |
---|
8 | */ |
---|
9 | #include "coeffs/coeffs.h" |
---|
10 | #include "omalloc/omalloc.h" /* for SIZEOF_DOUBLE, SIZEOF_LONG*/ |
---|
11 | |
---|
12 | // the access methods |
---|
13 | // |
---|
14 | // the routines w.r.t. currRing: |
---|
15 | // (should only be used in the context of currRing, i.e. in t |
---|
16 | #define nCopy(n) n_Copy(n, currRing->cf) |
---|
17 | #define nDelete(n) n_Delete(n, currRing->cf) |
---|
18 | #define nMult(n1, n2) n_Mult(n1, n2, currRing->cf) |
---|
19 | #define nAdd(n1, n2) n_Add(n1, n2, currRing->cf) |
---|
20 | #define nIsZero(n) n_IsZero(n, currRing->cf) |
---|
21 | #define nEqual(n1, n2) n_Equal(n1, n2, currRing->cf) |
---|
22 | #define nInpNeg(n) n_InpNeg(n, currRing->cf) |
---|
23 | #define nSub(n1, n2) n_Sub(n1, n2, currRing->cf) |
---|
24 | #define nGetChar() n_GetChar(currRing->cf) |
---|
25 | #define nInit(i) n_Init(i, currRing->cf) |
---|
26 | #define nIsOne(n) n_IsOne(n, currRing->cf) |
---|
27 | #define nIsMOne(n) n_IsMOne(n, currRing->cf) |
---|
28 | #define nGreaterZero(n) n_GreaterZero(n, currRing->cf) |
---|
29 | #define nGreater(a, b) n_Greater (a,b,currRing->cf) |
---|
30 | #define nWrite(n) n_Write(n, currRing->cf, rShortOut(currRing)) |
---|
31 | #define nNormalize(n) n_Normalize(n,currRing->cf) |
---|
32 | #define nGcd(a,b) n_Gcd(a,b,currRing->cf) |
---|
33 | #define nDiv(a, b) n_Div(a,b,currRing->cf) |
---|
34 | #define nInvers(a) n_Invers(a,currRing->cf) |
---|
35 | #define nExactDiv(a, b) n_ExactDiv(a,b,currRing->cf) |
---|
36 | #define nTest(a) n_Test(a,currRing->cf) |
---|
37 | |
---|
38 | #define nInpMult(a, b) n_InpMult(a,b,currRing->cf) |
---|
39 | #define nPower(a, b, res) n_Power(a,b,res,currRing->cf) |
---|
40 | #define nSize(n) n_Size(n,currRing->cf) |
---|
41 | #define nGetDenom(N) n_GetDenom((N),currRing->cf) |
---|
42 | #define nGetNumerator(N) n_GetNumerator((N),currRing->cf) |
---|
43 | |
---|
44 | #define nSetMap(R) n_SetMap(R,currRing->cf) |
---|
45 | |
---|
46 | /// only for debug, over any initalized currRing |
---|
47 | #define nPrint(a) n_Print(a,currRing->cf) |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | // -------------------------------------------------------------- |
---|
53 | // internal to coeffs, but public for all realizations |
---|
54 | |
---|
55 | #if SIZEOF_DOUBE == SIZEOF_LONG |
---|
56 | #define SHORT_REAL_LENGTH 16 // use double for real <= 15 digits |
---|
57 | #else |
---|
58 | #define SHORT_REAL_LENGTH 6 // use float for real <= 6 digits |
---|
59 | #endif |
---|
60 | |
---|
61 | /* the dummy routines: */ |
---|
62 | // void nDummy1(number* d); |
---|
63 | // void ndDelete(number* d, const coeffs r); |
---|
64 | number ndGcd(number a, number b, const coeffs); |
---|
65 | // number ndCopy(number a, const coeffs r); |
---|
66 | number ndCopyMap(number a, const coeffs src, const coeffs dst); |
---|
67 | // int ndSize(number a, const coeffs r); |
---|
68 | // number ndGetDenom(number &n, const coeffs r); |
---|
69 | // number ndGetNumerator(number &a,const coeffs r); |
---|
70 | // number ndReturn0(number n, const coeffs r); |
---|
71 | // number ndIntMod(number a, number b, const coeffs r); |
---|
72 | |
---|
73 | // void ndInpMult(number &a, number b, const coeffs r); |
---|
74 | // void ndInpAdd(number &a, number b, const coeffs r); |
---|
75 | |
---|
76 | // void ndKillChar(coeffs); |
---|
77 | |
---|
78 | // number ndInit_bigint(number i, const coeffs dummy, const coeffs dst); |
---|
79 | |
---|
80 | // BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter); |
---|
81 | CanonicalForm ndConvSingNFactoryN( number, BOOLEAN /*setChar*/, const coeffs); |
---|
82 | |
---|
83 | /// Test whether a is a zero divisor in r |
---|
84 | /// i.e. not coprime with char. of r |
---|
85 | /// very inefficient implementation: |
---|
86 | /// should ONLY be used for debug stuff /tests |
---|
87 | BOOLEAN n_IsZeroDivisor( number a, const coeffs r); |
---|
88 | |
---|
89 | const char* const nDivBy0 = "div by 0"; |
---|
90 | |
---|
91 | // dummy routines |
---|
92 | // void ndNormalize(number& d, const coeffs); // nNormalize... |
---|
93 | |
---|
94 | /// initialize an object of type coeff, return FALSE in case of success |
---|
95 | typedef BOOLEAN (*cfInitCharProc)(coeffs, void *); |
---|
96 | n_coeffType nRegister(n_coeffType n, cfInitCharProc p); |
---|
97 | |
---|
98 | /// find an existing coeff by its "CoeffName" |
---|
99 | coeffs nFindCoeffByName(const char *n); |
---|
100 | |
---|
101 | /// divide by the first (leading) number and return it, i.e. make monic |
---|
102 | // void ndClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r); |
---|
103 | |
---|
104 | /// does nothing (just returns a dummy one number) |
---|
105 | // void ndClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r); |
---|
106 | |
---|
107 | #endif |
---|