[35aab3] | 1 | #ifndef RING_H |
---|
| 2 | #define RING_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
| 6 | /* |
---|
| 7 | * ABSTRACT - the interpreter related ring operations |
---|
| 8 | */ |
---|
[341696] | 9 | /* $Id$ */ |
---|
[35aab3] | 10 | |
---|
| 11 | /* includes */ |
---|
[599326] | 12 | #include <kernel/structs.h> |
---|
| 13 | #include <kernel/polys-impl.h> |
---|
[35aab3] | 14 | |
---|
| 15 | #define SHORT_REAL_LENGTH 6 // use short reals for real <= 6 digits |
---|
| 16 | |
---|
[b07ba77] | 17 | #if 0 |
---|
| 18 | enum n_coeffType |
---|
| 19 | { |
---|
| 20 | n_unknown=0, |
---|
| 21 | n_Zp, |
---|
| 22 | n_Q, |
---|
| 23 | n_R, |
---|
| 24 | n_GF, |
---|
| 25 | n_long_R, |
---|
| 26 | n_Zp_a, |
---|
| 27 | n_Q_a, |
---|
| 28 | n_long_C |
---|
| 29 | }; |
---|
| 30 | #endif |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | // #ifdef HAVE_PLURAL |
---|
| 34 | #if 0 |
---|
| 35 | enum nc_type |
---|
| 36 | { |
---|
| 37 | nc_error = -1, // Something's gone wrong! |
---|
| 38 | nc_general = 0, /* yx=q xy+... */ |
---|
| 39 | nc_skew, /*1*/ /* yx=q xy */ |
---|
| 40 | nc_comm, /*2*/ /* yx= xy */ |
---|
| 41 | nc_lie, /*3*/ /* yx=xy+... */ |
---|
| 42 | nc_undef, /*4*/ /* for internal reasons */ |
---|
| 43 | |
---|
| 44 | nc_exterior /*5*/ // Exterior Algebra(SCA): yx= -xy & (!:) x^2 = 0 |
---|
| 45 | }; |
---|
| 46 | #endif |
---|
| 47 | // #endif |
---|
| 48 | |
---|
[56bd6a] | 49 | enum tHomog |
---|
| 50 | { |
---|
| 51 | isNotHomog = FALSE, |
---|
| 52 | isHomog = TRUE, |
---|
| 53 | testHomog |
---|
| 54 | }; |
---|
[b07ba77] | 55 | |
---|
[835d83] | 56 | extern ring currRing; |
---|
| 57 | extern ideal currQuotient; |
---|
| 58 | extern idhdl currRingHdl; |
---|
| 59 | |
---|
[35aab3] | 60 | |
---|
| 61 | void rChangeCurrRing(ring r); |
---|
| 62 | void rSetHdl(idhdl h); |
---|
| 63 | ring rInit(sleftv* pn, sleftv* rv, sleftv* ord); |
---|
[85e68dd] | 64 | idhdl rDefault(const char *s); |
---|
[35aab3] | 65 | ring rDefault(int ch, int N, char **n); |
---|
[301c033] | 66 | ring rDefault(int ch, int N, char **n,int ord_size, int *ord, int *block0, int *block1); |
---|
| 67 | |
---|
[35aab3] | 68 | #define rIsRingVar(A) r_IsRingVar(A,currRing) |
---|
[8837a0] | 69 | int r_IsRingVar(const char *n, ring r); |
---|
[35aab3] | 70 | void rWrite(ring r); |
---|
| 71 | void rKill(idhdl h); |
---|
| 72 | void rKill(ring r); |
---|
| 73 | ring rCopy(ring r); |
---|
[645a19] | 74 | ring rCopy0(const ring r, BOOLEAN copy_qideal = TRUE, BOOLEAN copy_ordering = TRUE); |
---|
[6b5dd2] | 75 | ring rOpposite(ring r); |
---|
| 76 | ring rEnvelope(ring r); |
---|
[35aab3] | 77 | |
---|
[645a19] | 78 | /// we must always have this test! |
---|
[24cece] | 79 | static inline bool rIsPluralRing(const ring r) |
---|
[d312f6] | 80 | { |
---|
[86016d] | 81 | #ifdef HAVE_PLURAL |
---|
[7ff04a] | 82 | nc_struct *n; |
---|
[a794e7] | 83 | return (r != NULL) && ((n=r->GetNC()) != NULL) /*&& (n->type != nc_error)*/; |
---|
[d312f6] | 84 | #else |
---|
[86016d] | 85 | return false; |
---|
[d312f6] | 86 | #endif |
---|
[86016d] | 87 | } |
---|
[d312f6] | 88 | |
---|
[24cece] | 89 | static inline bool rIsRatGRing(const ring r) |
---|
[454cb0] | 90 | { |
---|
| 91 | #ifdef HAVE_PLURAL |
---|
[9be65c] | 92 | /* nc_struct *n; */ |
---|
[0b4ec2] | 93 | return (r != NULL) /* && ((n=r->GetNC()) != NULL) */ |
---|
[454cb0] | 94 | && (r->real_var_start>1); |
---|
| 95 | #else |
---|
| 96 | return false; |
---|
| 97 | #endif |
---|
| 98 | } |
---|
| 99 | |
---|
[35aab3] | 100 | |
---|
| 101 | |
---|
[4c7d73] | 102 | |
---|
[1ed346] | 103 | // The following are for LaScala3 only! |
---|
[35aab3] | 104 | #ifdef PDEBUG |
---|
| 105 | #define rChangeSComps(c,s,l) rDBChangeSComps(c,s,l) |
---|
| 106 | #define rGetSComps(c,s,l) rDBGetSComps(c,s,l) |
---|
| 107 | void rDBChangeSComps(int* currComponents, |
---|
| 108 | long* currShiftedComponents, |
---|
| 109 | int length, |
---|
| 110 | ring r = currRing); |
---|
| 111 | void rDBGetSComps(int** currComponents, |
---|
| 112 | long** currShiftedComponents, |
---|
| 113 | int *length, |
---|
| 114 | ring r = currRing); |
---|
| 115 | #else |
---|
| 116 | #define rChangeSComps(c,s,l) rNChangeSComps(c,s) |
---|
| 117 | #define rGetSComps(c,s,l) rNGetSComps(c,s) |
---|
| 118 | #endif |
---|
| 119 | |
---|
| 120 | void rNChangeSComps(int* currComponents, long* currShiftedComponents, ring r = currRing); |
---|
| 121 | void rNGetSComps(int** currComponents, long** currShiftedComponents, ring r = currRing); |
---|
| 122 | |
---|
| 123 | idhdl rFindHdl(ring r, idhdl n, idhdl w); |
---|
| 124 | idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n); |
---|
| 125 | const char * rSimpleOrdStr(int ord); |
---|
| 126 | int rOrderName(char * ordername); |
---|
| 127 | char * rOrdStr(ring r); |
---|
| 128 | char * rVarStr(ring r); |
---|
| 129 | char * rCharStr(ring r); |
---|
| 130 | char * rString(ring r); |
---|
| 131 | int rChar(ring r=currRing); |
---|
| 132 | #define rPar(r) (r->P) |
---|
[98a77e] | 133 | #define rVar(r) (r->N) |
---|
[35aab3] | 134 | char * rParStr(ring r); |
---|
[df2551] | 135 | int rIsExtension(const ring r=currRing); |
---|
[35aab3] | 136 | int rSum(ring r1, ring r2, ring &sum); |
---|
[83bde7] | 137 | int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp); |
---|
[35aab3] | 138 | |
---|
| 139 | BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr = 1); |
---|
[f62996] | 140 | BOOLEAN rSamePolyRep(ring r1, ring r2); |
---|
[35aab3] | 141 | void rUnComplete(ring r); |
---|
| 142 | |
---|
| 143 | #define rInternalChar(r) ((r)->ch) |
---|
| 144 | |
---|
| 145 | BOOLEAN rRing_is_Homog(ring r=currRing); |
---|
| 146 | BOOLEAN rRing_has_CompLastBlock(ring r=currRing); |
---|
| 147 | |
---|
[c90b43] | 148 | #ifdef HAVE_RINGS |
---|
[24cece] | 149 | static inline BOOLEAN rField_is_Ring_2toM(ring r=currRing) |
---|
[009d80] | 150 | { return (r->ringtype == 1); } |
---|
[994445] | 151 | |
---|
[24cece] | 152 | static inline BOOLEAN rField_is_Ring_ModN(ring r=currRing) |
---|
[009d80] | 153 | { return (r->ringtype == 2); } |
---|
[585bbcb] | 154 | |
---|
[24cece] | 155 | static inline BOOLEAN rField_is_Ring_PtoM(ring r=currRing) |
---|
[1e579c6] | 156 | { return (r->ringtype == 3); } |
---|
| 157 | |
---|
[24cece] | 158 | static inline BOOLEAN rField_is_Ring_Z(ring r=currRing) |
---|
[1e579c6] | 159 | { return (r->ringtype == 4); } |
---|
| 160 | |
---|
[24cece] | 161 | static inline BOOLEAN rField_is_Ring(ring r=currRing) |
---|
[206e158] | 162 | { return (r->ringtype != 0); } |
---|
| 163 | |
---|
[24cece] | 164 | static inline BOOLEAN rField_is_Domain(ring r=currRing) |
---|
[1e579c6] | 165 | { return (r->ringtype == 4 || r->ringtype == 0); } |
---|
| 166 | |
---|
[24cece] | 167 | static inline BOOLEAN rField_has_Units(ring r=currRing) |
---|
[1e579c6] | 168 | { return ((r->ringtype == 1) || (r->ringtype == 2) || (r->ringtype == 3)); } |
---|
[9d249b] | 169 | #else |
---|
| 170 | #define rField_is_Ring(A) (0) |
---|
[9dd6a25] | 171 | #define rField_is_Ring_2toM(A) (0) |
---|
| 172 | #define rField_is_Ring_ModN(A) (0) |
---|
| 173 | #define rField_is_Ring_PtoM(A) (0) |
---|
| 174 | #define rField_is_Ring_Z(A) (0) |
---|
| 175 | #define rField_is_Domain(A) (1) |
---|
| 176 | #define rField_has_Units(A) (1) |
---|
[009d80] | 177 | #endif |
---|
| 178 | |
---|
| 179 | #ifdef HAVE_RINGS |
---|
[24cece] | 180 | static inline BOOLEAN rField_is_Zp(ring r=currRing) |
---|
[009d80] | 181 | { return (r->ringtype == 0) && (r->ch > 1) && (r->parameter==NULL); } |
---|
[585bbcb] | 182 | |
---|
[24cece] | 183 | static inline BOOLEAN rField_is_Zp(ring r, int p) |
---|
[009d80] | 184 | { return (r->ringtype == 0) && (r->ch > 1 && r->ch == ABS(p) && r->parameter==NULL); } |
---|
[585bbcb] | 185 | |
---|
[24cece] | 186 | static inline BOOLEAN rField_is_Q(ring r=currRing) |
---|
[009d80] | 187 | { return (r->ringtype == 0) && (r->ch == 0) && (r->parameter==NULL); } |
---|
[585bbcb] | 188 | |
---|
[24cece] | 189 | static inline BOOLEAN rField_is_numeric(ring r=currRing) /* R, long R, long C */ |
---|
[009d80] | 190 | { return (r->ringtype == 0) && (r->ch == -1); } |
---|
[585bbcb] | 191 | |
---|
[24cece] | 192 | static inline BOOLEAN rField_is_R(ring r=currRing) |
---|
[585bbcb] | 193 | { |
---|
| 194 | if (rField_is_numeric(r) && (r->float_len <= (short)SHORT_REAL_LENGTH)) |
---|
[009d80] | 195 | return (r->ringtype == 0) && (r->parameter==NULL); |
---|
[585bbcb] | 196 | return FALSE; |
---|
| 197 | } |
---|
| 198 | |
---|
[24cece] | 199 | static inline BOOLEAN rField_is_GF(ring r=currRing) |
---|
[009d80] | 200 | { return (r->ringtype == 0) && (r->ch > 1) && (r->parameter!=NULL); } |
---|
[585bbcb] | 201 | |
---|
[24cece] | 202 | static inline BOOLEAN rField_is_GF(ring r, int q) |
---|
[009d80] | 203 | { return (r->ringtype == 0) && (r->ch == q); } |
---|
[585bbcb] | 204 | |
---|
[24cece] | 205 | static inline BOOLEAN rField_is_Zp_a(ring r=currRing) |
---|
[009d80] | 206 | { return (r->ringtype == 0) && (r->ch < -1); } |
---|
[585bbcb] | 207 | |
---|
[24cece] | 208 | static inline BOOLEAN rField_is_Zp_a(ring r, int p) |
---|
[009d80] | 209 | { return (r->ringtype == 0) && (r->ch < -1 ) && (-(r->ch) == ABS(p)); } |
---|
[585bbcb] | 210 | |
---|
[24cece] | 211 | static inline BOOLEAN rField_is_Q_a(ring r=currRing) |
---|
[009d80] | 212 | { return (r->ringtype == 0) && (r->ch == 1); } |
---|
[585bbcb] | 213 | |
---|
[24cece] | 214 | static inline BOOLEAN rField_is_long_R(ring r=currRing) |
---|
[585bbcb] | 215 | { |
---|
| 216 | if (rField_is_numeric(r) && (r->float_len >(short)SHORT_REAL_LENGTH)) |
---|
[009d80] | 217 | return (r->ringtype == 0) && (r->parameter==NULL); |
---|
[585bbcb] | 218 | return FALSE; |
---|
| 219 | } |
---|
| 220 | |
---|
[24cece] | 221 | static inline BOOLEAN rField_is_long_C(ring r=currRing) |
---|
[585bbcb] | 222 | { |
---|
| 223 | if (rField_is_numeric(r)) |
---|
[009d80] | 224 | return (r->ringtype == 0) && (r->parameter!=NULL); |
---|
[585bbcb] | 225 | return FALSE; |
---|
| 226 | } |
---|
| 227 | #else |
---|
[24cece] | 228 | static inline BOOLEAN rField_is_Zp(ring r=currRing) |
---|
[35aab3] | 229 | { return (r->ch > 1) && (r->parameter==NULL); } |
---|
| 230 | |
---|
[24cece] | 231 | static inline BOOLEAN rField_is_Zp(ring r, int p) |
---|
[35aab3] | 232 | { return (r->ch > 1 && r->ch == ABS(p) && r->parameter==NULL); } |
---|
| 233 | |
---|
[24cece] | 234 | static inline BOOLEAN rField_is_Q(ring r=currRing) |
---|
[35aab3] | 235 | { return (r->ch == 0) && (r->parameter==NULL); } |
---|
| 236 | |
---|
[24cece] | 237 | static inline BOOLEAN rField_is_numeric(ring r=currRing) /* R, long R, long C */ |
---|
[35aab3] | 238 | { return (r->ch == -1); } |
---|
| 239 | |
---|
[24cece] | 240 | static inline BOOLEAN rField_is_R(ring r=currRing) |
---|
[35aab3] | 241 | { |
---|
| 242 | if (rField_is_numeric(r) && (r->float_len <= (short)SHORT_REAL_LENGTH)) |
---|
| 243 | return (r->parameter==NULL); |
---|
| 244 | return FALSE; |
---|
| 245 | } |
---|
| 246 | |
---|
[24cece] | 247 | static inline BOOLEAN rField_is_GF(ring r=currRing) |
---|
[35aab3] | 248 | { return (r->ch > 1) && (r->parameter!=NULL); } |
---|
| 249 | |
---|
[24cece] | 250 | static inline BOOLEAN rField_is_GF(ring r, int q) |
---|
[35aab3] | 251 | { return (r->ch == q); } |
---|
| 252 | |
---|
[24cece] | 253 | static inline BOOLEAN rField_is_Zp_a(ring r=currRing) |
---|
[35aab3] | 254 | { return (r->ch < -1); } |
---|
| 255 | |
---|
[24cece] | 256 | static inline BOOLEAN rField_is_Zp_a(ring r, int p) |
---|
[35aab3] | 257 | { return (r->ch < -1 ) && (-(r->ch) == ABS(p)); } |
---|
| 258 | |
---|
[24cece] | 259 | static inline BOOLEAN rField_is_Q_a(ring r=currRing) |
---|
[35aab3] | 260 | { return (r->ch == 1); } |
---|
| 261 | |
---|
[24cece] | 262 | static inline BOOLEAN rField_is_long_R(ring r=currRing) |
---|
[35aab3] | 263 | { |
---|
| 264 | if (rField_is_numeric(r) && (r->float_len >(short)SHORT_REAL_LENGTH)) |
---|
| 265 | return (r->parameter==NULL); |
---|
| 266 | return FALSE; |
---|
| 267 | } |
---|
| 268 | |
---|
[24cece] | 269 | static inline BOOLEAN rField_is_long_C(ring r=currRing) |
---|
[35aab3] | 270 | { |
---|
| 271 | if (rField_is_numeric(r)) |
---|
| 272 | return (r->parameter!=NULL); |
---|
| 273 | return FALSE; |
---|
| 274 | } |
---|
[585bbcb] | 275 | #endif |
---|
[35aab3] | 276 | |
---|
[24cece] | 277 | static inline BOOLEAN rField_has_simple_inverse(ring r=currRing) |
---|
[35aab3] | 278 | /* { return (r->ch>1) || (r->ch== -1); } *//* Z/p, GF(p,n), R, long_R, long_C*/ |
---|
[009d80] | 279 | #ifdef HAVE_RINGS |
---|
| 280 | { return (r->ringtype > 0) || (r->ch>1) || ((r->ch== -1) && (r->float_len < 10)); } /* Z/2^n, Z/p, GF(p,n), R, long_R, long_C*/ |
---|
[585bbcb] | 281 | #else |
---|
[35aab3] | 282 | { return (r->ch>1) || ((r->ch== -1) && (r->float_len < 10)); } /* Z/p, GF(p,n), R, long_R, long_C*/ |
---|
[585bbcb] | 283 | #endif |
---|
[35aab3] | 284 | |
---|
[24cece] | 285 | static inline BOOLEAN rField_has_simple_Alloc(ring r=currRing) |
---|
[009d80] | 286 | { return (rField_is_Zp(r) |
---|
| 287 | || rField_is_GF(r) |
---|
[c90b43] | 288 | #ifdef HAVE_RINGS |
---|
[009d80] | 289 | || rField_is_Ring_2toM(r) |
---|
[585bbcb] | 290 | #endif |
---|
[009d80] | 291 | || rField_is_R(r)); } |
---|
[35aab3] | 292 | |
---|
| 293 | /* Z/p, GF(p,n), R: nCopy, nNew, nDelete are dummies*/ |
---|
[24cece] | 294 | static inline BOOLEAN rField_is_Extension(ring r=currRing) |
---|
[35aab3] | 295 | { return (rField_is_Q_a(r)) || (rField_is_Zp_a(r)); } /* Z/p(a) and Q(a)*/ |
---|
| 296 | |
---|
| 297 | n_coeffType rFieldType(ring r); |
---|
| 298 | |
---|
[645a19] | 299 | /// this needs to be called whenever a new ring is created: new fields |
---|
| 300 | /// in ring are created (like VarOffset), unless they already exist |
---|
| 301 | /// with force == 1, new fields are _always_ created (overwritten), |
---|
| 302 | /// even if they exist |
---|
[35aab3] | 303 | BOOLEAN rComplete(ring r, int force = 0); |
---|
[645a19] | 304 | // use this to free fields created by rComplete //? |
---|
[ea68ed] | 305 | |
---|
[24cece] | 306 | static inline int rBlocks(ring r) |
---|
[35aab3] | 307 | { |
---|
| 308 | int i=0; |
---|
| 309 | while (r->order[i]!=0) i++; |
---|
| 310 | return i+1; |
---|
| 311 | } |
---|
| 312 | |
---|
| 313 | // misc things |
---|
[24cece] | 314 | static inline char* rRingVar(short i) |
---|
[35aab3] | 315 | { |
---|
| 316 | return currRing->names[i]; |
---|
| 317 | } |
---|
[24cece] | 318 | static inline char* rRingVar(short i, ring r) |
---|
[35aab3] | 319 | { |
---|
| 320 | return r->names[i]; |
---|
| 321 | } |
---|
[24cece] | 322 | static inline BOOLEAN rShortOut(ring r) |
---|
[35aab3] | 323 | { |
---|
| 324 | return (r->ShortOut); |
---|
| 325 | } |
---|
| 326 | |
---|
[645a19] | 327 | /// order stuff |
---|
[35aab3] | 328 | typedef enum rRingOrder_t |
---|
| 329 | { |
---|
| 330 | ringorder_no = 0, |
---|
| 331 | ringorder_a, |
---|
[645a19] | 332 | ringorder_a64, ///< for int64 weights |
---|
[35aab3] | 333 | ringorder_c, |
---|
| 334 | ringorder_C, |
---|
| 335 | ringorder_M, |
---|
[645a19] | 336 | ringorder_S, ///< S? |
---|
| 337 | ringorder_s, ///< s? |
---|
[35aab3] | 338 | ringorder_lp, |
---|
| 339 | ringorder_dp, |
---|
| 340 | ringorder_rp, |
---|
| 341 | ringorder_Dp, |
---|
| 342 | ringorder_wp, |
---|
| 343 | ringorder_Wp, |
---|
| 344 | ringorder_ls, |
---|
| 345 | ringorder_ds, |
---|
| 346 | ringorder_Ds, |
---|
| 347 | ringorder_ws, |
---|
| 348 | ringorder_Ws, |
---|
| 349 | ringorder_L, |
---|
| 350 | // the following are only used internally |
---|
[645a19] | 351 | ringorder_aa, ///< for idElimination, like a, except pFDeg, pWeigths ignore it |
---|
| 352 | ringorder_rs, ///< ??? |
---|
| 353 | ringorder_IS, ///< Induced (Schreyer) ordering |
---|
[35aab3] | 354 | ringorder_unspec |
---|
| 355 | } rRingOrder_t; |
---|
| 356 | |
---|
| 357 | typedef enum rOrderType_t |
---|
| 358 | { |
---|
[645a19] | 359 | rOrderType_General = 0, ///< non-simple ordering as specified by currRing |
---|
| 360 | rOrderType_CompExp, ///< simple ordering, component has priority |
---|
| 361 | rOrderType_ExpComp, ///< simple ordering, exponent vector has priority |
---|
| 362 | ///< component not compatible with exp-vector order |
---|
| 363 | rOrderType_Exp, ///< simple ordering, exponent vector has priority |
---|
| 364 | ///< component is compatible with exp-vector order |
---|
| 365 | rOrderType_Syz, ///< syzygy ordering |
---|
| 366 | rOrderType_Schreyer, ///< Schreyer ordering |
---|
| 367 | rOrderType_Syz2dpc, ///< syzcomp2dpc |
---|
| 368 | rOrderType_ExpNoComp ///< simple ordering, differences in component are |
---|
| 369 | ///< not considered |
---|
[35aab3] | 370 | } rOrderType_t; |
---|
| 371 | |
---|
[24cece] | 372 | static inline BOOLEAN rIsSyzIndexRing(const ring r) |
---|
[35aab3] | 373 | { return r->order[0] == ringorder_s;} |
---|
| 374 | |
---|
[24cece] | 375 | static inline int rGetCurrSyzLimit(const ring r = currRing) |
---|
[645a19] | 376 | { return (rIsSyzIndexRing(r)? r->typ[0].data.syz.limit : 0);} |
---|
[35aab3] | 377 | |
---|
| 378 | // Ring Manipulations |
---|
[935bb1b] | 379 | ring rAssure_HasComp(ring r); |
---|
[35aab3] | 380 | ring rCurrRingAssure_SyzComp(); |
---|
| 381 | void rSetSyzComp(int k); |
---|
| 382 | ring rCurrRingAssure_dp_S(); |
---|
| 383 | ring rCurrRingAssure_dp_C(); |
---|
| 384 | ring rCurrRingAssure_C_dp(); |
---|
[645a19] | 385 | |
---|
| 386 | /// makes sure that c/C ordering is last ordering |
---|
[35aab3] | 387 | ring rCurrRingAssure_CompLastBlock(); |
---|
[645a19] | 388 | |
---|
| 389 | /// makes sure that c/C ordering is last ordering and SyzIndex is first |
---|
[35aab3] | 390 | ring rCurrRingAssure_SyzComp_CompLastBlock(); |
---|
[afd7439] | 391 | ring rAssure_TDeg(ring r, int start_var, int end_var, int &pos); |
---|
[35aab3] | 392 | |
---|
[645a19] | 393 | /// return the max-comonent wchich has syzIndex i |
---|
| 394 | /// Assume: i<= syzIndex_limit |
---|
[35aab3] | 395 | int rGetMaxSyzComp(int i); |
---|
| 396 | |
---|
[b9642b1] | 397 | BOOLEAN rHasSimpleOrder(const ring r); |
---|
[645a19] | 398 | |
---|
| 399 | /// returns TRUE, if simple lp or ls ordering |
---|
[b9642b1] | 400 | BOOLEAN rHasSimpleLexOrder(const ring r); |
---|
[645a19] | 401 | |
---|
[35aab3] | 402 | // return TRUE if p->exp[r->pOrdIndex] holds total degree of p */ |
---|
[0ec631] | 403 | //inline BOOLEAN rHasGlobalOrdering(const ring r=currRing) |
---|
| 404 | //{ return (r->OrdSgn==1); } |
---|
| 405 | #define rHasGlobalOrdering(R) ((R)->OrdSgn==1) |
---|
[f20117] | 406 | #define rHasGlobalOrdering_currRing() (pOrdSgn==1) |
---|
[0ec631] | 407 | //inline BOOLEAN rHasLocalOrMixedOrdering(const ring r=currRing) |
---|
| 408 | //{ return (r->OrdSgn==-1); } |
---|
| 409 | #define rHasLocalOrMixedOrdering(R) ((R)->OrdSgn==-1) |
---|
[753f9d2] | 410 | #define rHasLocalOrMixedOrdering_currRing() (pOrdSgn==-1) |
---|
[35aab3] | 411 | BOOLEAN rOrd_is_Totaldegree_Ordering(ring r =currRing); |
---|
[645a19] | 412 | |
---|
| 413 | /// return TRUE if p_SetComp requires p_Setm |
---|
[35aab3] | 414 | BOOLEAN rOrd_SetCompRequiresSetm(ring r); |
---|
| 415 | rOrderType_t rGetOrderType(ring r); |
---|
[645a19] | 416 | |
---|
| 417 | /// returns TRUE if var(i) belongs to p-block |
---|
[35aab3] | 418 | BOOLEAN rIsPolyVar(int i, ring r = currRing); |
---|
| 419 | |
---|
[24cece] | 420 | static inline BOOLEAN rOrd_is_Comp_dp(ring r) |
---|
[35aab3] | 421 | { |
---|
| 422 | return ((r->order[0] == ringorder_c || r->order[0] == ringorder_C) && |
---|
| 423 | r->order[1] == ringorder_dp && |
---|
| 424 | r->order[2] == 0); |
---|
| 425 | } |
---|
| 426 | |
---|
| 427 | #ifdef RDEBUG |
---|
| 428 | #define rTest(r) rDBTest(r, __FILE__, __LINE__) |
---|
[85e68dd] | 429 | extern BOOLEAN rDBTest(ring r, const char* fn, const int l); |
---|
[35aab3] | 430 | #else |
---|
| 431 | #define rTest(r) |
---|
| 432 | #endif |
---|
| 433 | |
---|
| 434 | ring rModifyRing(ring r, BOOLEAN omit_degree, |
---|
| 435 | BOOLEAN omit_comp, |
---|
| 436 | unsigned long exp_limit); |
---|
[645a19] | 437 | |
---|
| 438 | /// construct Wp, C ring |
---|
[35aab3] | 439 | ring rModifyRing_Wp(ring r, int* weights); |
---|
[4c7d73] | 440 | void rModify_a_to_A(ring r); |
---|
[35aab3] | 441 | |
---|
| 442 | void rKillModifiedRing(ring r); |
---|
| 443 | // also frees weights |
---|
| 444 | void rKillModified_Wp_Ring(ring r); |
---|
| 445 | |
---|
| 446 | ring rModifyRing_Simple(ring r, BOOLEAN omit_degree, BOOLEAN omit_comp, unsigned long exp_limit, BOOLEAN &simple); |
---|
| 447 | void rKillModifiedRing_Simple(ring r); |
---|
| 448 | |
---|
[645a19] | 449 | #ifdef RDEBUG |
---|
[35aab3] | 450 | void rDebugPrint(ring r); |
---|
| 451 | void pDebugPrint(poly p); |
---|
[3664c9a] | 452 | void p_DebugPrint(poly p, const ring r); |
---|
[645a19] | 453 | #endif |
---|
| 454 | |
---|
[af3d2a] | 455 | #ifndef NDEBUG |
---|
[645a19] | 456 | /// debug-print at most nTerms (2 by default) terms from poly/vector p, |
---|
| 457 | /// assuming that lt(p) lives in lmRing and tail(p) lives in tailRing. |
---|
| 458 | void p_DebugPrint(const poly p, const ring lmRing, const ring tailRing, const int nTerms = 2); |
---|
[af3d2a] | 459 | #endif |
---|
[35aab3] | 460 | |
---|
[4c7d73] | 461 | int64 * rGetWeightVec(ring r); |
---|
| 462 | void rSetWeightVec(ring r, int64 *wv); |
---|
[35aab3] | 463 | |
---|
[9b9c0b] | 464 | lists rDecompose(const ring r); |
---|
| 465 | ring rCompose(const lists L); |
---|
[a830d2b] | 466 | ///////////////////////////// |
---|
| 467 | // Auxillary functions |
---|
| 468 | // |
---|
| 469 | |
---|
| 470 | BOOLEAN rCheckIV(intvec *iv); |
---|
| 471 | int rTypeOfMatrixOrder(intvec * order); |
---|
| 472 | void rDelete(ring r); |
---|
| 473 | |
---|
[c5e0e1] | 474 | extern omBin sip_sring_bin; |
---|
[35aab3] | 475 | #endif |
---|