Changeset 0ef3f51 in git
- Timestamp:
- Apr 7, 2011, 1:55:38 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 812138aea0983e6d8c8bdcc626d47b9b77fb2a5c
- Parents:
- 94557c930d61d112d8269c547c07396570970a4c
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-04-07 13:55:38+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:04:19+01:00
- Location:
- libpolys/coeffs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/coeffs.h
r94557c9 r0ef3f51 362 362 } 363 363 364 // Tests: 365 static inline BOOLEAN nCoeff_is_Ring_2toM(const coeffs r) 366 { return (r->ringtype == 1); } 367 368 static inline BOOLEAN nCoeff_is_Ring_ModN(const coeffs r) 369 { return (r->ringtype == 2); } 370 371 static inline BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r) 372 { return (r->ringtype == 3); } 373 374 static inline BOOLEAN nCoeff_is_Ring_Z(const coeffs r) 375 { return (r->ringtype == 4); } 376 377 static inline BOOLEAN nCoeff_is_Ring(const coeffs r) 378 { return (r->ringtype != 0); } 379 380 static inline BOOLEAN nCoeff_is_Domain(const coeffs r) 381 { return (r->ringtype == 4 || r->ringtype == 0); } 382 383 static inline BOOLEAN nCoeff_has_Units(const coeffs r) 384 { return ((r->ringtype == 1) || (r->ringtype == 2) || (r->ringtype == 3)); } 385 386 static inline BOOLEAN nCoeff_is_Zp(const coeffs r) 387 { return getCoeffType(r)==n_Zp; } 388 389 static inline BOOLEAN nCoeff_is_Zp(const coeffs r, int p) 390 { return (getCoeffType(r) && (r->ch == ABS(p))); } 391 392 static inline BOOLEAN nCoeff_is_Q(const coeffs r) 393 { return getCoeffType(r)==n_Q; } 394 395 static inline BOOLEAN nCoeff_is_numeric(const coeffs r) /* R, long R, long C */ 396 { return (getCoeffType(r)==n_R) || (getCoeffType(r)==n_long_R) || (getCoeffType(r)==n_long_C); } 397 398 static inline BOOLEAN nCoeff_is_R(const coeffs r) 399 { return getCoeffType(r)==n_R; } 400 401 static inline BOOLEAN nCoeff_is_GF(const coeffs r) 402 { return getCoeffType(r)==n_GF; } 403 404 static inline BOOLEAN nCoeff_is_GF(const coeffs r, int q) 405 { return (getCoeffType(r)==n_GF) && (r->ch == q); } 406 407 static inline BOOLEAN nCoeff_is_Zp_a(const coeffs r) 408 { return (r->ringtype == 0) && (r->ch < -1); } 409 410 static inline BOOLEAN nCoeff_is_Zp_a(const coeffs r, int p) 411 { return (r->ringtype == 0) && (r->ch < -1 ) && (-(r->ch) == ABS(p)); } 412 413 static inline BOOLEAN nCoeff_is_Q_a(const coeffs r) 414 { return (r->ringtype == 0) && (r->ch == 1); } 415 416 static inline BOOLEAN nCoeff_is_long_R(const coeffs r) 417 { return getCoeffType(r)==n_long_R; } 418 419 static inline BOOLEAN nCoeff_is_long_C(const coeffs r) 420 { return getCoeffType(r)==n_long_C; } 421 422 static inline BOOLEAN nCoeff_is_CF(const coeffs r) 423 { return getCoeffType(r)==n_CF; } 424 425 static inline BOOLEAN nCoeff_has_simple_inverse(const coeffs r) 426 { return r->has_simple_Inverse; } 427 /* Z/2^n, Z/p, GF(p,n), R, long_R, long_C*/ 428 429 static inline BOOLEAN nCoeff_has_simple_Alloc(const coeffs r) 430 { return r->has_simple_Alloc; } 431 /* Z/p, GF(p,n), R, Ring_2toM: nCopy, nNew, nDelete are dummies*/ 432 433 static inline BOOLEAN nCoeff_is_Extension(const coeffs r) 434 { return (nCoeff_is_Q_a(r)) || (nCoeff_is_Zp_a(r)); } /* Z/p(a) and Q(a)*/ 435 364 436 /// BOOLEAN n_Test(number a, const coeffs r) 365 437 #define n_Test(a,r) n_DBTest(a, __FILE__, __LINE__, r) … … 376 448 377 449 378 /* 379 // the access methods (part 1) (see also part2 below): 380 // 381 // the routines w.r.t. currRing: 382 // (should only be used in the context of currRing, i.e. in the interpreter) 383 #define nCopy(n) n_Copy(n, currRing->cf) 384 #define nDelete(n) n_Delete(n, currRing->cf) 385 #define nMult(n1, n2) n_Mult(n1, n2, currRing->cf) 386 #define nAdd(n1, n2) n_Add(n1, n2, currRing->cf) 387 #define nIsZero(n) n_IsZero(n, currRing->cf) 388 #define nEqual(n1, n2) n_Equal(n1, n2, currRing->cf) 389 #define nNeg(n) n_Neg(n, currRing->cf) 390 #define nSub(n1, n2) n_Sub(n1, n2, currRing->cf) 391 #define nGetChar() nInternalChar(currRing->cf) 392 #define nInit(i) n_Init(i, currRing->cf) 393 #define nIsOne(n) n_IsOne(n, currRing->cf) 394 #define nIsMOne(n) n_IsMOne(n, currRing->cf) 395 #define nGreaterZero(n) n_GreaterZero(n, currRing->cf) 396 #define nWrite(n) n_Write(n,currRing->cf) 397 #define nNormalize(n) n_Normalize(n,currRing->cf) 398 #define nGcd(a, b) n_Gcd(a,b,currRing->cf) 399 #define nIntDiv(a, b) n_IntDiv(a,b,currRing->cf) 400 #define nDiv(a, b) n_Div(a,b,currRing->cf) 401 #define nInvers(a) n_Invers(a,currRing->cf) 402 #define nExactDiv(a, b) n_ExactDiv(a,b,currRing->cf) 403 #define nTest(a) n_Test(a,currRing->cf) 404 405 #define nInpMult(a, b) n_InpMult(a,b,currRing->cf) 406 #define nPower(a, b, res) n_Power(a,b,res,currRing->cf) 407 #define nSize(n) n_Size(n,currRing->cf) 408 #define nGetDenom(N) n_GetDenom((N),currRing->cf) 409 #define nGetNumerator(N) n_GetNumerator((N),currRing->cf) 410 411 #define nSetMap(R) n_SetMap(R,currRing->cf) 412 */ 413 414 #endif 415 450 #endif 451 -
libpolys/coeffs/numbers.h
r94557c9 r0ef3f51 6 6 /* $Id$ */ 7 7 /* 8 * ABSTRACT: interface to coefficient aritmetics8 * ABSTRACT: compatility interface to coeffs 9 9 */ 10 10 #include <coeffs/coeffs.h> 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 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) 29 #define nWrite(n) n_Write(n,currRing->cf) 30 #define nNormalize(n) n_Normalize(n,currRing->cf) 31 #define nGcd(a, b) n_Gcd(a,b,currRing->cf) 32 #define nIntDiv(a, b) n_IntDiv(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 47 // -------------------------------------------------------------- 48 // internal to coeffs, but public for all realizations 11 49 12 50 #define SHORT_REAL_LENGTH 6 // use short reals for real <= 6 digits … … 40 78 void ndNormalize(number& d, const coeffs); // nNormalize... 41 79 42 // Tests:43 static inline BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)44 { return (r->ringtype == 1); }45 46 static inline BOOLEAN nCoeff_is_Ring_ModN(const coeffs r)47 { return (r->ringtype == 2); }48 49 static inline BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)50 { return (r->ringtype == 3); }51 52 static inline BOOLEAN nCoeff_is_Ring_Z(const coeffs r)53 { return (r->ringtype == 4); }54 55 static inline BOOLEAN nCoeff_is_Ring(const coeffs r)56 { return (r->ringtype != 0); }57 58 static inline BOOLEAN nCoeff_is_Domain(const coeffs r)59 { return (r->ringtype == 4 || r->ringtype == 0); }60 61 static inline BOOLEAN nCoeff_has_Units(const coeffs r)62 { return ((r->ringtype == 1) || (r->ringtype == 2) || (r->ringtype == 3)); }63 64 static inline BOOLEAN nCoeff_is_Zp(const coeffs r)65 { return getCoeffType(r)==n_Zp; }66 67 static inline BOOLEAN nCoeff_is_Zp(const coeffs r, int p)68 { return (getCoeffType(r) && (r->ch == ABS(p))); }69 70 static inline BOOLEAN nCoeff_is_Q(const coeffs r)71 { return getCoeffType(r)==n_Q; }72 73 static inline BOOLEAN nCoeff_is_numeric(const coeffs r) /* R, long R, long C */74 { return (getCoeffType(r)==n_R) || (getCoeffType(r)==n_long_R) || (getCoeffType(r)==n_long_C); }75 76 static inline BOOLEAN nCoeff_is_R(const coeffs r)77 { return getCoeffType(r)==n_R; }78 79 static inline BOOLEAN nCoeff_is_GF(const coeffs r)80 { return getCoeffType(r)==n_GF; }81 82 static inline BOOLEAN nCoeff_is_GF(const coeffs r, int q)83 { return (getCoeffType(r)==n_GF) && (r->ch == q); }84 85 static inline BOOLEAN nCoeff_is_Zp_a(const coeffs r)86 { return (r->ringtype == 0) && (r->ch < -1); }87 88 static inline BOOLEAN nCoeff_is_Zp_a(const coeffs r, int p)89 { return (r->ringtype == 0) && (r->ch < -1 ) && (-(r->ch) == ABS(p)); }90 91 static inline BOOLEAN nCoeff_is_Q_a(const coeffs r)92 { return (r->ringtype == 0) && (r->ch == 1); }93 94 static inline BOOLEAN nCoeff_is_long_R(const coeffs r)95 { return getCoeffType(r)==n_long_R; }96 97 static inline BOOLEAN nCoeff_is_long_C(const coeffs r)98 { return getCoeffType(r)==n_long_C; }99 100 static inline BOOLEAN nCoeff_is_CF(const coeffs r)101 { return getCoeffType(r)==n_CF; }102 103 static inline BOOLEAN nCoeff_has_simple_inverse(const coeffs r)104 { return r->has_simple_Inverse; }105 /* Z/2^n, Z/p, GF(p,n), R, long_R, long_C*/106 107 static inline BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)108 { return r->has_simple_Alloc; }109 /* Z/p, GF(p,n), R, Ring_2toM: nCopy, nNew, nDelete are dummies*/110 111 static inline BOOLEAN nCoeff_is_Extension(const coeffs r)112 { return (nCoeff_is_Q_a(r)) || (nCoeff_is_Zp_a(r)); } /* Z/p(a) and Q(a)*/113 114 80 /// initialize an object of type coeff, return FALSE in case of success 115 81 typedef BOOLEAN (*cfInitCharProc)(coeffs, void *);
Note: See TracChangeset
for help on using the changeset viewer.