[35aab3] | 1 | #ifndef NUMBERS_H |
---|
| 2 | #define NUMBERS_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
[341696] | 6 | /* $Id$ */ |
---|
[35aab3] | 7 | /* |
---|
[0ef3f51] | 8 | * ABSTRACT: compatility interface to coeffs |
---|
[35aab3] | 9 | */ |
---|
[2d805a] | 10 | #include <coeffs/coeffs.h> |
---|
[7d90aa] | 11 | |
---|
[0ef3f51] | 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 nNeg(n) n_Neg(n, currRing->cf) |
---|
| 23 | #define nSub(n1, n2) n_Sub(n1, n2, currRing->cf) |
---|
| 24 | #define nGetChar() nInternalChar(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) |
---|
[6ed8c4] | 29 | #define nGreater(a, b) n_Greater (a,b,currRing->cf) |
---|
[0ef3f51] | 30 | #define nWrite(n) n_Write(n,currRing->cf) |
---|
| 31 | #define nNormalize(n) n_Normalize(n,currRing->cf) |
---|
[c6e80e] | 32 | |
---|
| 33 | inline number nGcd(number a, number b, const coeffs cf) { return n_Gcd(a, b, cf); } |
---|
| 34 | |
---|
[0ef3f51] | 35 | #define nIntDiv(a, b) n_IntDiv(a,b,currRing->cf) |
---|
| 36 | #define nDiv(a, b) n_Div(a,b,currRing->cf) |
---|
| 37 | #define nInvers(a) n_Invers(a,currRing->cf) |
---|
| 38 | #define nExactDiv(a, b) n_ExactDiv(a,b,currRing->cf) |
---|
| 39 | #define nTest(a) n_Test(a,currRing->cf) |
---|
| 40 | |
---|
| 41 | #define nInpMult(a, b) n_InpMult(a,b,currRing->cf) |
---|
| 42 | #define nPower(a, b, res) n_Power(a,b,res,currRing->cf) |
---|
| 43 | #define nSize(n) n_Size(n,currRing->cf) |
---|
| 44 | #define nGetDenom(N) n_GetDenom((N),currRing->cf) |
---|
| 45 | #define nGetNumerator(N) n_GetNumerator((N),currRing->cf) |
---|
| 46 | |
---|
| 47 | #define nSetMap(R) n_SetMap(R,currRing->cf) |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | // -------------------------------------------------------------- |
---|
| 51 | // internal to coeffs, but public for all realizations |
---|
| 52 | |
---|
[7d90aa] | 53 | #define SHORT_REAL_LENGTH 6 // use short reals for real <= 6 digits |
---|
| 54 | |
---|
[3bc01c7] | 55 | /* the dummy routines: */ |
---|
[35aab3] | 56 | void nDummy1(number* d); |
---|
[7d90aa] | 57 | void ndDelete(number* d, const coeffs r); |
---|
| 58 | number ndGcd(number a, number b, const coeffs); |
---|
| 59 | number ndCopy(number a, const coeffs r); |
---|
[dc093ce] | 60 | number ndCopyMap(number a, const coeffs src, const coeffs dst); |
---|
[8c484e] | 61 | int ndSize(number a, const coeffs r); |
---|
| 62 | char * ndName(number n, const coeffs r); |
---|
[3bc01c7] | 63 | number ndGetDenom(number &n, const coeffs r); |
---|
| 64 | number ndGetNumerator(number &a,const coeffs r); |
---|
| 65 | number ndReturn0(number n, const coeffs r); |
---|
| 66 | number ndIntMod(number a, number b, const coeffs r); |
---|
[3aae0e] | 67 | |
---|
[7d90aa] | 68 | void ndInpMult(number &a, number b, const coeffs r); |
---|
[35eaf8] | 69 | void ndInpAdd(number &a, number b, const coeffs r); |
---|
[35aab3] | 70 | |
---|
[577888] | 71 | void ndKillChar(coeffs); |
---|
| 72 | |
---|
[2544e7] | 73 | number ndInit_bigint(number i, const coeffs dummy, const coeffs dst); |
---|
| 74 | |
---|
[121fd9] | 75 | BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter); |
---|
| 76 | |
---|
[e5422d] | 77 | /// Test whether a is a zero divisor in r |
---|
| 78 | /// i.e. not coprime with char. of r |
---|
[f70f641] | 79 | /// very inefficient implementation: |
---|
| 80 | /// should ONLY be used for debug stuff /tests |
---|
[6c084af] | 81 | BOOLEAN n_IsZeroDivisor( number a, const coeffs r); |
---|
[e5422d] | 82 | |
---|
[35aab3] | 83 | #ifdef LDEBUG |
---|
| 84 | void nDBDummy1(number* d,char *f, int l); |
---|
[2b957a] | 85 | BOOLEAN ndDBTest(number a, const char *f, const int l, const coeffs r); |
---|
[35aab3] | 86 | #endif |
---|
| 87 | |
---|
[b7e838] | 88 | #define nDivBy0 "div by 0" |
---|
[424cd64] | 89 | |
---|
| 90 | // dummy routines |
---|
[3bc01c7] | 91 | void ndNormalize(number& d, const coeffs); // nNormalize... |
---|
[7d90aa] | 92 | |
---|
[1cce47] | 93 | /// initialize an object of type coeff, return FALSE in case of success |
---|
| 94 | typedef BOOLEAN (*cfInitCharProc)(coeffs, void *); |
---|
[8f8b75] | 95 | n_coeffType nRegister(n_coeffType n, cfInitCharProc p); |
---|
[dc093ce] | 96 | |
---|
[35aab3] | 97 | #endif |
---|