1 | #ifndef RING_H |
---|
2 | #define RING_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* |
---|
7 | * ABSTRACT - the interpreter related ring operations |
---|
8 | */ |
---|
9 | /* $Id: ring.h,v 1.22 1999-03-09 12:22:18 obachman Exp $ */ |
---|
10 | |
---|
11 | /* includes */ |
---|
12 | #include "structs.h" |
---|
13 | #include "polys-impl.h" |
---|
14 | |
---|
15 | #ifdef DRING |
---|
16 | void rChangeCurrRing(ring r, BOOLEAN complete = TRUE, idhdl h = NULL); |
---|
17 | #else |
---|
18 | void rChangeCurrRing(ring r, BOOLEAN complete = TRUE); |
---|
19 | #endif |
---|
20 | void rSetHdl(idhdl h, BOOLEAN complete); |
---|
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); |
---|
30 | idhdl rFindHdl(ring r, idhdl n, idhdl w); |
---|
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); |
---|
39 | char * rString(ring r); |
---|
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); |
---|
46 | void rComplete(ring r, int force = 0); |
---|
47 | void rUnComplete(ring r); |
---|
48 | int rBlocks(ring r); |
---|
49 | |
---|
50 | #define rInternalChar(r) ((r)->ch) |
---|
51 | #ifndef ABS |
---|
52 | #define ABS(x) ((x) < 0 ? (-(x)) : (x)) |
---|
53 | #endif |
---|
54 | inline BOOLEAN rField_is_Zp(ring r=currRing) |
---|
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); } |
---|
58 | inline BOOLEAN rField_is_Q(ring r=currRing) |
---|
59 | { return (r->ch == 0) && (r->parameter==NULL); } |
---|
60 | inline BOOLEAN rField_is_R(ring r=currRing) |
---|
61 | { return (r->ch == -1); } |
---|
62 | inline BOOLEAN rField_is_GF(ring r=currRing) |
---|
63 | { return (r->ch > 1) && (r->parameter!=NULL); } |
---|
64 | inline BOOLEAN rField_is_Zp_a(ring r=currRing) |
---|
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)); } |
---|
68 | inline BOOLEAN rField_is_Q_a(ring r=currRing) |
---|
69 | { return (r->ch == 1); } |
---|
70 | inline BOOLEAN rField_has_simple_inverse(ring r=currRing) |
---|
71 | { return (r->ch>1); } /* Z/p and GF(p,n) */ |
---|
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 | |
---|
93 | typedef enum rOrderType_t |
---|
94 | { |
---|
95 | rOrderType_General = 0, // non-simple ordering as specified by currRing |
---|
96 | rOrderType_CompExp, // simple ordering, component has priority |
---|
97 | rOrderType_ExpComp, // simple ordering, exponent vector has priority |
---|
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 |
---|
101 | rOrderType_Syz, // syzygy ordering |
---|
102 | rOrderType_Schreyer // Schreyer ordering |
---|
103 | } rOrderType_t; |
---|
104 | |
---|
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); |
---|
109 | BOOLEAN rIsPolyVar(int i); /* returns TRUE if var(i) belongs to p-block */ |
---|
110 | |
---|
111 | void rOptimizeOrder(ring r); |
---|
112 | |
---|
113 | #ifdef RDEBUG |
---|
114 | extern short rNumber; /* current ring id (r->no) */ |
---|
115 | #define rTest(r) rDBTest(r, __FILE__, __LINE__) |
---|
116 | extern BOOLEAN rDBTest(ring r, char* fn, int l); |
---|
117 | #else |
---|
118 | #define rTest(r) |
---|
119 | #endif |
---|
120 | |
---|
121 | #endif |
---|
122 | |
---|