[0e1846] | 1 | #ifndef RING_H |
---|
| 2 | #define RING_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
| 6 | /* |
---|
[6ae4f5] | 7 | * ABSTRACT - the interpreter related ring operations |
---|
[0e1846] | 8 | */ |
---|
[7df2ef] | 9 | /* $Id: ring.h,v 1.23 1999-03-19 14:18:06 obachman Exp $ */ |
---|
[0e1846] | 10 | |
---|
| 11 | /* includes */ |
---|
| 12 | #include "structs.h" |
---|
[51c163] | 13 | #include "polys-impl.h" |
---|
[0e1846] | 14 | |
---|
[311499] | 15 | #ifdef DRING |
---|
| 16 | void rChangeCurrRing(ring r, BOOLEAN complete = TRUE, idhdl h = NULL); |
---|
| 17 | #else |
---|
[47faf56] | 18 | void rChangeCurrRing(ring r, BOOLEAN complete = TRUE); |
---|
[311499] | 19 | #endif |
---|
[7df2ef] | 20 | void rSetHdl(idhdl h, BOOLEAN complete = TRUE); |
---|
[0e1846] | 21 | idhdl rInit(char *s, sleftv* pn, sleftv* rv, sleftv* ord, |
---|
| 22 | BOOLEAN isDRing); |
---|
| 23 | idhdl rDefault(char *s); |
---|
| 24 | int rIsRingVar(char *n); |
---|
| 25 | char * RingVar(short); |
---|
| 26 | void rWrite(ring r); |
---|
| 27 | void rKill(idhdl h); |
---|
| 28 | void rKill(ring r); |
---|
| 29 | ring rCopy(ring r); |
---|
[6d281ac] | 30 | idhdl rFindHdl(ring r, idhdl n, idhdl w); |
---|
[0e1846] | 31 | #ifdef DRING |
---|
| 32 | void rDSet(); |
---|
| 33 | #endif |
---|
| 34 | void rDInit(); |
---|
| 35 | int rOrderName(char * ordername); |
---|
| 36 | char * rOrdStr(ring r); |
---|
| 37 | char * rVarStr(ring r); |
---|
| 38 | char * rCharStr(ring r); |
---|
[8d1d137] | 39 | char * rString(ring r); |
---|
[0e1846] | 40 | int rChar(ring r=currRing); |
---|
| 41 | #define rPar(r) (r->P) |
---|
| 42 | char * rParStr(ring r); |
---|
| 43 | int rIsExtension(ring r); |
---|
| 44 | int rIsExtension(); |
---|
| 45 | int rSum(ring r1, ring r2, ring &sum); |
---|
[7df2ef] | 46 | BOOLEAN rComplete(ring r, int force = 0); |
---|
[8fefd9] | 47 | void rUnComplete(ring r); |
---|
[50abaf2] | 48 | int rBlocks(ring r); |
---|
[e78cce] | 49 | |
---|
[be0d84] | 50 | #define rInternalChar(r) ((r)->ch) |
---|
[2a10547] | 51 | #ifndef ABS |
---|
| 52 | #define ABS(x) ((x) < 0 ? (-(x)) : (x)) |
---|
| 53 | #endif |
---|
[be0d84] | 54 | inline BOOLEAN rField_is_Zp(ring r=currRing) |
---|
[2a10547] | 55 | { return (r->ch > 1) && (r->parameter==NULL); } |
---|
| 56 | inline BOOLEAN rField_is_Zp(ring r, int p) |
---|
| 57 | { return (r->ch > 1 && r->ch == ABS(p) && r->parameter==NULL); } |
---|
[be0d84] | 58 | inline BOOLEAN rField_is_Q(ring r=currRing) |
---|
[2a10547] | 59 | { return (r->ch == 0) && (r->parameter==NULL); } |
---|
[be0d84] | 60 | inline BOOLEAN rField_is_R(ring r=currRing) |
---|
[2a10547] | 61 | { return (r->ch == -1); } |
---|
[be0d84] | 62 | inline BOOLEAN rField_is_GF(ring r=currRing) |
---|
[2a10547] | 63 | { return (r->ch > 1) && (r->parameter!=NULL); } |
---|
[be0d84] | 64 | inline BOOLEAN rField_is_Zp_a(ring r=currRing) |
---|
[2a10547] | 65 | { return (r->ch < -1); } |
---|
| 66 | inline BOOLEAN rField_is_Zp_a(ring r, int p) |
---|
| 67 | { return (r->ch < -1 ) && (-(r->ch) == ABS(p)); } |
---|
[be0d84] | 68 | inline BOOLEAN rField_is_Q_a(ring r=currRing) |
---|
[2a10547] | 69 | { return (r->ch == 1); } |
---|
[be0d84] | 70 | inline BOOLEAN rField_has_simple_inverse(ring r=currRing) |
---|
| 71 | { return (r->ch>1); } /* Z/p and GF(p,n) */ |
---|
[0e1846] | 72 | |
---|
| 73 | enum |
---|
| 74 | { |
---|
| 75 | ringorder_no = 0, |
---|
| 76 | ringorder_a, |
---|
| 77 | ringorder_c, |
---|
| 78 | ringorder_C, |
---|
| 79 | ringorder_M, |
---|
| 80 | ringorder_lp, |
---|
| 81 | ringorder_dp, |
---|
| 82 | ringorder_Dp, |
---|
| 83 | ringorder_wp, |
---|
| 84 | ringorder_Wp, |
---|
| 85 | ringorder_ls, |
---|
| 86 | ringorder_ds, |
---|
| 87 | ringorder_Ds, |
---|
| 88 | ringorder_ws, |
---|
| 89 | ringorder_Ws, |
---|
| 90 | ringorder_unspec |
---|
| 91 | }; |
---|
| 92 | |
---|
[f92fa13] | 93 | typedef enum rOrderType_t |
---|
| 94 | { |
---|
| 95 | rOrderType_General = 0, // non-simple ordering as specified by currRing |
---|
[e9ad8a6] | 96 | rOrderType_CompExp, // simple ordering, component has priority |
---|
[f92fa13] | 97 | rOrderType_ExpComp, // simple ordering, exponent vector has priority |
---|
[18255d] | 98 | // component not compatible with exp-vector order |
---|
| 99 | rOrderType_Exp, // simple ordering, exponent vector has priority |
---|
| 100 | // component is compatible with exp-vector order |
---|
[f92fa13] | 101 | rOrderType_Syz, // syzygy ordering |
---|
| 102 | rOrderType_Schreyer // Schreyer ordering |
---|
| 103 | } rOrderType_t; |
---|
| 104 | |
---|
[f003a9] | 105 | BOOLEAN rHasSimpleOrder(ring r); |
---|
| 106 | // returns TRUE, if simple lp or ls ordering |
---|
| 107 | BOOLEAN rHasSimpleLexOrder(ring r); |
---|
| 108 | rOrderType_t rGetOrderType(ring r); |
---|
[f7ac05] | 109 | BOOLEAN rIsPolyVar(int i); /* returns TRUE if var(i) belongs to p-block */ |
---|
[f92fa13] | 110 | |
---|
[84db5bf] | 111 | void rOptimizeOrder(ring r); |
---|
| 112 | |
---|
[0e1846] | 113 | #ifdef RDEBUG |
---|
[fca547] | 114 | extern short rNumber; /* current ring id (r->no) */ |
---|
[e06ef94] | 115 | #define rTest(r) rDBTest(r, __FILE__, __LINE__) |
---|
| 116 | extern BOOLEAN rDBTest(ring r, char* fn, int l); |
---|
| 117 | #else |
---|
| 118 | #define rTest(r) |
---|
[0e1846] | 119 | #endif |
---|
| 120 | |
---|
| 121 | #endif |
---|
| 122 | |
---|