[35aab3] | 1 | #ifndef NUMBERS_H |
---|
| 2 | #define NUMBERS_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
| 6 | /* |
---|
[0ef3f51] | 7 | * ABSTRACT: compatility interface to coeffs |
---|
[35aab3] | 8 | */ |
---|
[2d805a] | 9 | #include <coeffs/coeffs.h> |
---|
[7d90aa] | 10 | |
---|
[0ef3f51] | 11 | // the access methods |
---|
| 12 | // |
---|
| 13 | // the routines w.r.t. currRing: |
---|
| 14 | // (should only be used in the context of currRing, i.e. in t |
---|
| 15 | #define nCopy(n) n_Copy(n, currRing->cf) |
---|
| 16 | #define nDelete(n) n_Delete(n, currRing->cf) |
---|
| 17 | #define nMult(n1, n2) n_Mult(n1, n2, currRing->cf) |
---|
| 18 | #define nAdd(n1, n2) n_Add(n1, n2, currRing->cf) |
---|
| 19 | #define nIsZero(n) n_IsZero(n, currRing->cf) |
---|
| 20 | #define nEqual(n1, n2) n_Equal(n1, n2, currRing->cf) |
---|
| 21 | #define nNeg(n) n_Neg(n, currRing->cf) |
---|
| 22 | #define nSub(n1, n2) n_Sub(n1, n2, currRing->cf) |
---|
[4b38e3] | 23 | #define nGetChar() n_GetChar(currRing->cf) |
---|
[0ef3f51] | 24 | #define nInit(i) n_Init(i, currRing->cf) |
---|
| 25 | #define nIsOne(n) n_IsOne(n, currRing->cf) |
---|
| 26 | #define nIsMOne(n) n_IsMOne(n, currRing->cf) |
---|
| 27 | #define nGreaterZero(n) n_GreaterZero(n, currRing->cf) |
---|
[ce1f78] | 28 | #define nGreater(a, b) n_Greater (a,b,currRing->cf) |
---|
| 29 | #define nWrite(n) n_Write(n, currRing->cf, rShortOut(currRing)) |
---|
[0ef3f51] | 30 | #define nNormalize(n) n_Normalize(n,currRing->cf) |
---|
[c6e80e] | 31 | |
---|
| 32 | inline number nGcd(number a, number b, const coeffs cf) { return n_Gcd(a, b, cf); } |
---|
| 33 | |
---|
[0ef3f51] | 34 | #define nIntDiv(a, b) n_IntDiv(a,b,currRing->cf) |
---|
| 35 | #define nDiv(a, b) n_Div(a,b,currRing->cf) |
---|
| 36 | #define nInvers(a) n_Invers(a,currRing->cf) |
---|
| 37 | #define nExactDiv(a, b) n_ExactDiv(a,b,currRing->cf) |
---|
| 38 | #define nTest(a) n_Test(a,currRing->cf) |
---|
| 39 | |
---|
| 40 | #define nInpMult(a, b) n_InpMult(a,b,currRing->cf) |
---|
| 41 | #define nPower(a, b, res) n_Power(a,b,res,currRing->cf) |
---|
| 42 | #define nSize(n) n_Size(n,currRing->cf) |
---|
| 43 | #define nGetDenom(N) n_GetDenom((N),currRing->cf) |
---|
| 44 | #define nGetNumerator(N) n_GetNumerator((N),currRing->cf) |
---|
| 45 | |
---|
| 46 | #define nSetMap(R) n_SetMap(R,currRing->cf) |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | // -------------------------------------------------------------- |
---|
| 50 | // internal to coeffs, but public for all realizations |
---|
| 51 | |
---|
[7d90aa] | 52 | #define SHORT_REAL_LENGTH 6 // use short reals for real <= 6 digits |
---|
| 53 | |
---|
[3bc01c7] | 54 | /* the dummy routines: */ |
---|
[35aab3] | 55 | void nDummy1(number* d); |
---|
[7d90aa] | 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); |
---|
[dc093ce] | 59 | number ndCopyMap(number a, const coeffs src, const coeffs dst); |
---|
[8c484e] | 60 | int ndSize(number a, const coeffs r); |
---|
| 61 | char * ndName(number n, const coeffs r); |
---|
[3bc01c7] | 62 | number ndGetDenom(number &n, const coeffs r); |
---|
| 63 | number ndGetNumerator(number &a,const coeffs r); |
---|
| 64 | number ndReturn0(number n, const coeffs r); |
---|
| 65 | number ndIntMod(number a, number b, const coeffs r); |
---|
[3aae0e] | 66 | |
---|
[7d90aa] | 67 | void ndInpMult(number &a, number b, const coeffs r); |
---|
[35eaf8] | 68 | void ndInpAdd(number &a, number b, const coeffs r); |
---|
[35aab3] | 69 | |
---|
[577888] | 70 | void ndKillChar(coeffs); |
---|
| 71 | |
---|
[2544e7] | 72 | number ndInit_bigint(number i, const coeffs dummy, const coeffs dst); |
---|
| 73 | |
---|
[121fd9] | 74 | BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter); |
---|
| 75 | |
---|
[e5422d] | 76 | /// Test whether a is a zero divisor in r |
---|
| 77 | /// i.e. not coprime with char. of r |
---|
[f70f641] | 78 | /// very inefficient implementation: |
---|
| 79 | /// should ONLY be used for debug stuff /tests |
---|
[6c084af] | 80 | BOOLEAN n_IsZeroDivisor( number a, const coeffs r); |
---|
[e5422d] | 81 | |
---|
[35aab3] | 82 | #ifdef LDEBUG |
---|
| 83 | void nDBDummy1(number* d,char *f, int l); |
---|
[2b957a] | 84 | BOOLEAN ndDBTest(number a, const char *f, const int l, const coeffs r); |
---|
[35aab3] | 85 | #endif |
---|
| 86 | |
---|
[b7e838] | 87 | #define nDivBy0 "div by 0" |
---|
[424cd64] | 88 | |
---|
| 89 | // dummy routines |
---|
[3bc01c7] | 90 | void ndNormalize(number& d, const coeffs); // nNormalize... |
---|
[7d90aa] | 91 | |
---|
[1cce47] | 92 | /// initialize an object of type coeff, return FALSE in case of success |
---|
| 93 | typedef BOOLEAN (*cfInitCharProc)(coeffs, void *); |
---|
[8f8b75] | 94 | n_coeffType nRegister(n_coeffType n, cfInitCharProc p); |
---|
[dc093ce] | 95 | |
---|
[de88371] | 96 | /// divide by the first (leading) number and return it, i.e. make monic |
---|
| 97 | void ndClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r); |
---|
| 98 | |
---|
| 99 | /// does nothing (just returns a dummy one number) |
---|
| 100 | void ndClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r); |
---|
| 101 | |
---|
[35aab3] | 102 | #endif |
---|