Macaulay2 Engine
Loading...
Searching...
No Matches
ring.cpp
Go to the documentation of this file.
1// Copyright 2002 Michael E. Stillman
2
3#include "interface/ring.h"
4
5#include "monoid.hpp"
6#include "monomial.hpp"
7#include "relem.hpp"
8#include "ZZp.hpp"
9#include "ZZ.hpp"
10#include "GF.hpp"
11#include "polyring.hpp"
12#include "schur.hpp"
13#include "schur2.hpp"
14#include "schurSn.hpp"
15#include "frac.hpp"
16#include "localring.hpp"
17#include "weylalg.hpp"
18#include "skewpoly.hpp"
19#include "solvable.hpp"
20#include "matrix.hpp"
21#include "exceptions.hpp"
22#include "finalize.hpp"
23#include "tower.hpp"
24
25#include "Polynomial.hpp"
26#include "M2FreeAlgebra.hpp"
28#include "polyquotient.hpp"
29
30#include "aring.hpp"
31#include "aring-glue.hpp"
32#include "aring-RRi.hpp"
33#include "aring-CCi.hpp"
34#include "aring-RR.hpp"
35#include "aring-CC.hpp"
36#include "aring-RRR.hpp"
37#include "aring-CCC.hpp"
38
39// The following needs to be included before any flint files are included.
40#include <M2/gc-include.h>
41
42#pragma GCC diagnostic push
43#pragma GCC diagnostic ignored "-Wconversion"
44#include <flint/fmpz.h> // for fmpz_t, fmpz_init, fmpz_set_si
45#include <flint/fq_nmod.h> // for _fq_nmod_ctx_init_conway, fq_nm...
46#pragma GCC diagnostic pop
47
48unsigned int rawRingHash(const Ring *R) { return R->hash(); }
49
50M2_string IM2_Ring_to_string(const Ring *R)
51{
52 buffer o;
53 R->text_out(o);
54 return o.to_string();
55}
56
57long rawRingCharacteristic(const Ring *R) { return R->characteristic(); }
58
60// Ring creation //
62
63const Ring *IM2_Ring_ZZ(void) { return globalZZ; }
64const Ring *IM2_Ring_QQ(void) { return globalQQ; }
65const Ring /* or null */ *IM2_Ring_ZZp(int p)
66/* p must be a prime number <= 32767 */
67{
68 if (p <= 1 || p >= 32750)
69 {
70 ERROR("ZZP: expected a prime number p in range 2 <= p <= 32749");
71 return nullptr;
72 }
73 return Z_mod::create(p);
74}
75
76const Ring /* or null */ *rawGaloisField(const RingElement *f)
77{
78 // Check that the ring R of f is a polynomial ring in one var over a ZZ/p
79 // Check that f has degree >= 2
80 // Check that f is monic
81 // If any of these fail, then return 0.
82 try
83 {
84 return GF::create(f);
85 } catch (const exc::engine_error& e)
86 {
87 ERROR(e.what());
88 return nullptr;
89 }
90}
91
92const Ring /* or null */ *IM2_Ring_RRi(unsigned long prec)
93{
95}
96
97const Ring /* or null */ *IM2_Ring_CCi(unsigned long prec)
98{
100}
101
102const Ring /* or null */ *IM2_Ring_RRR(unsigned long prec)
103{
104 if (prec <= 53) return M2::ConcreteRing<M2::ARingRR>::create();
106}
107
108const Ring /* or null */ *IM2_Ring_CCC(unsigned long prec)
109{
110 if (prec <= 53) return M2::ConcreteRing<M2::ARingCC>::create();
112}
113
118
119const Ring /* or null */ *IM2_Ring_polyring(const Ring *K, const Monoid *M)
120{
121 try
122 {
123 const PolyRing *result = PolyRing::create(K, M);
125 return result;
126 } catch (const exc::engine_error& e)
127 {
128 ERROR(e.what());
129 return nullptr;
130 }
131}
132
133const Ring * /* or null */ rawDividedPowerRing(const Ring *K, const Monoid *M)
134{
135 (void) K;
136 (void) M;
137#if 0
138 //TODO: MES, this function has not yet been implemented, or even placed in ring.h
139 try {
140 const DividedPowerRing * result = 0; // DividedPowerRing::create(K,M);
142 return result;
143 }
144 catch (const exc::engine_error& e) {
145 ERROR(e.what());
146 return NULL;
147 }
148#endif
149 ERROR("not yet implemented");
150 return nullptr;
151}
152
153const Ring /* or null */ *IM2_Ring_skew_polyring(const Ring *R,
154 M2_arrayint skewvars)
155{
156 try
157 {
159 if (P == nullptr)
160 {
161 ERROR("expected a polynomial ring");
162 return nullptr;
163 }
165 P->getCoefficients(), P->getMonoid(), skewvars);
167 return result;
168 } catch (const exc::engine_error& e)
169 {
170 ERROR(e.what());
171 return nullptr;
172 }
173}
174
175const Ring /* or null */ *IM2_Ring_weyl_algebra(const Ring *R,
176 M2_arrayint comm_vars,
177 M2_arrayint diff_vars,
178 int homog_var)
179{
180 try
181 {
183 if (P == nullptr)
184 {
185 ERROR("expected a polynomial ring");
186 return nullptr;
187 }
189 P->getMonoid(),
190 diff_vars,
191 comm_vars,
192 homog_var);
194 return result;
195 } catch (const exc::engine_error& e)
196 {
197 ERROR(e.what());
198 return nullptr;
199 }
200}
201
202const Ring /* or null */ *IM2_Ring_solvable_algebra(const Ring *R,
203 const Matrix *Q)
204{
205 try
206 {
208 if (P == nullptr)
209 {
210 ERROR("expected a polynomial ring");
211 return nullptr;
212 }
215 return result;
216 } catch (const exc::engine_error& e)
217 {
218 ERROR(e.what());
219 return nullptr;
220 }
221}
222
223const Ring* /* or null */ rawRingM2FreeAlgebra(const Ring* coefficientRing,
224 M2_ArrayString names,
225 const Ring* degreeRing,
226 M2_arrayint degrees,
227 M2_arrayint wtvecs,
228 M2_arrayint heftVector)
229{
230 try {
231 if (coefficientRing == nullptr)
232 {
233 ERROR("internal error: expected non-null Ring!");
234 return nullptr;
235 }
236 const PolynomialRing *P = degreeRing->cast_to_PolynomialRing();
237 if (P == nullptr)
238 {
239 ERROR("expected polynomial ring");
240 return nullptr;
241 }
242 const M2FreeAlgebra* result = M2FreeAlgebra::create(coefficientRing,
244 P,
248 //intern_polyring(result); // we might want to intern our rings (to register a finalizer with the gc)
249 return result;
250 }
251 catch (exc::engine_error& e) {
252 ERROR(e.what());
253 return nullptr;
254 }
255}
256
257/* WIP
258const M2FreeMonoid* rawM2FreeMonoid(M2_ArrayString names,
259 const Ring* degreeRing,
260 M2_arrayint degrees,
261 M2_arrayint wtvecs,
262 M2_arrayint heftVector)
263{
264 try {
265 const PolynomialRing *P = degreeRing->cast_to_PolynomialRing();
266 if (P == nullptr)
267 {
268 ERROR("expected polynomial ring");
269 return nullptr;
270 }
271 const M2FreeMonoid* result = M2FreeMonoid::create(M2_ArrayString_to_stdvector(names),
272 P,
273 M2_arrayint_to_stdvector<int>(degrees),
274 M2_arrayint_to_stdvector<int>(wtvecs),
275 M2_arrayint_to_stdvector<int>(heftVector));
276 return result;
277 }
278 catch (exc::engine_error& e) {
279 ERROR(e.what());
280 return NULL;
281 }
282}
283*/
284
285const Ring* /* or null */ rawRingM2FreeAlgebraQuotient(const Matrix* GB, int maxdeg)
286{
287 const Ring* A = GB->get_ring();
288 try {
289 if (A == nullptr)
290 {
291 ERROR("internal error: expected non-null Ring!");
292 return nullptr;
293 }
294 const M2FreeAlgebra* P = A->cast_to_M2FreeAlgebra();
295 if (P == nullptr)
296 {
297 ERROR("expected a free algebra");
298 return nullptr;
299 }
300
302 return result;
303 }
304 catch (exc::engine_error& e) {
305 ERROR(e.what());
306 return nullptr;
307 }
308}
309
310const Ring /* or null */ *IM2_Ring_frac(const Ring *R)
311{
312 try
313 {
314 if (R == globalZZ) return globalQQ;
315 const PolyRingFlat *P = R->cast_to_PolyRingFlat();
316 if (P == nullptr)
317 {
318 ERROR("expected polynomial ring");
319 return nullptr;
320 }
321 if (P->getMonoid()->numNonTermOrderVariables() > 0)
322 {
323 ERROR(
324 "cannot currently make fraction field over a polynomial ring "
325 "with a non-global monomial order");
326 return nullptr;
327 }
328 if (P->getMonoid()->numInvertibleVariables() > 0)
329 {
330 ERROR(
331 "cannot currently make fraction field over a polynomial ring "
332 "with Laurent variables, i.e. Inverses=>true set");
333 return nullptr;
334 }
335 if (R->get_precision() > 0)
336 {
337 ERROR("cannot make fraction field over approximate field base");
338 return nullptr;
339 }
340 if (P->getCoefficients()->cast_to_FractionField() != nullptr)
341 {
342 ERROR(
343 "fraction fields over other fraction fields not yet implemented");
344 return nullptr;
345 }
346 if (P->getCoefficients()->cast_to_LocalRing() != nullptr)
347 {
348 ERROR("fraction fields over other local rings not yet implemented");
349 return nullptr;
350 }
351 return FractionField::create(P);
352 } catch (const exc::engine_error& e)
353 {
354 ERROR(e.what());
355 return nullptr;
356 }
357}
358
359const Ring /* or null */ *IM2_Ring_localization(const Ring *R, Computation *C)
360{
361 try
362 {
363 const PolyRing *PR = R->cast_to_PolyRing(); // FIXME should this get a PolyRing or Ring?
365 if (PR == nullptr)
366 {
367 ERROR("expected a polynomial ring");
368 return nullptr;
369 }
370 if (P == nullptr)
371 {
372 ERROR("expected a Grobner basis computation");
373 return nullptr;
374 }
375 if (P->get_ring() != PR)
376 {
377 ERROR("expected matrix to be over the same ring");
378 return nullptr;
379 }
380 return LocalRing::create(PR, P);
381 } catch (const exc::engine_error& e)
382 {
383 ERROR(e.what());
384 return nullptr;
385 }
386}
387
388const Ring /* or null */ *IM2_Ring_quotient(const Ring *R, const Matrix *I)
389{
390 try
391 {
392 if (I->get_ring() != R)
393 {
394 ERROR("expected matrix to be over the same ring");
395 }
396 if (I->n_rows() != 1)
397 {
398 ERROR("expected a one row matrix of quotient elements");
399 return nullptr;
400 }
402 if (P != nullptr)
403 {
406 return result;
407 }
408 const M2FreeAlgebra *A = R->cast_to_M2FreeAlgebra();
409 if (A != nullptr)
410 {
411 auto result = M2FreeAlgebraQuotient::create(*A, I, -1);
412 return result;
413 }
414 ERROR("expected a polynomial ring or free algebra");
415 return nullptr;
416 } catch (const exc::engine_error& e)
417 {
418 ERROR(e.what());
419 return nullptr;
420 }
421}
422
423const Ring /* or null */ *IM2_Ring_quotient1(const Ring *R, const Ring *B)
424/* R is a poly ring of the form A[x], B = A/I, constructs A[x]/I */
425/* if R is a polynomial ring of the form A[x]/J, and B = A/I (where A is a poly
426 ring)
427 then form the quotient ring B[x]/J. */
428{
429 try
430 {
431 const PolynomialRing *R1 = R->cast_to_PolynomialRing();
432 const PolynomialRing *B1 = B->cast_to_PolynomialRing();
433 if (R1 == nullptr || B1 == nullptr)
434 {
435 ERROR("expected a polynomial ring");
436 return nullptr;
437 }
438 if (R1->n_quotients() > 0)
439 {
440 ERROR("encountered quotient polynomial ring");
441 return nullptr;
442 }
445 return result;
446 } catch (const exc::engine_error& e)
447 {
448 ERROR(e.what());
449 return nullptr;
450 }
451}
452
453const Ring /* or null */ *IM2_Ring_schur(const Ring *R)
454{
455 try
456 {
458 if (P == nullptr)
459 {
460 ERROR("Schur ring construction: expected a polynomial ring");
461 return nullptr;
462 }
465 return result;
466 } catch (const exc::engine_error& e)
467 {
468 ERROR(e.what());
469 return nullptr;
470 }
471}
472
473const Ring *rawSchurRing1(const Ring *A)
474{
475 try
476 {
478 return result;
479 } catch (const exc::engine_error& e)
480 {
481 ERROR(e.what());
482 return nullptr;
483 }
484}
485
486const Ring *rawSchurRing2(const Ring *A, int n)
487{
488 try
489 {
491 return result;
492 } catch (const exc::engine_error& e)
493 {
494 ERROR(e.what());
495 return nullptr;
496 }
497}
498
499const Ring *rawSchurSnRing(const Ring *A, int n)
500{
501 try
502 {
504 return result;
505 } catch (const exc::engine_error& e)
506 {
507 ERROR(e.what());
508 return nullptr;
509 }
510}
511
512const Ring /* or null */ *rawTowerRing1(long charac, M2_ArrayString names)
513{
514 return Tower::create(static_cast<int>(charac), names);
515}
516
517const Ring /* or null */ *rawTowerRing2(const Ring *R1,
518 M2_ArrayString new_names)
519{
520 try
521 {
522 const Tower *R = R1->cast_to_Tower();
523 if (R == nullptr)
524 {
525 ERROR("expected a tower coefficient ring");
526 return nullptr;
527 }
528 return Tower::create(R, new_names);
529 } catch (const exc::engine_error& e)
530 {
531 ERROR(e.what());
532 return nullptr;
533 }
534}
535
536const Ring /* or null */ *rawTowerRing3(const Ring *R1,
537 engine_RawRingElementArray eqns)
538{
539 try
540 {
541 const Tower *R = R1->cast_to_Tower();
542 if (R == nullptr)
543 {
544 ERROR("expected a tower coefficient ring");
545 return nullptr;
546 }
547 VECTOR(ring_elem) extensions;
548 for (int i = 0; i < eqns->len; i++)
549 {
550 const RingElement *f = eqns->array[i];
551 if (f->get_ring() != R1)
552 {
553 ERROR("extension element has incorrect base ring");
554 return nullptr;
555 }
556 extensions.push_back(f->get_value());
557 }
558 return Tower::create(R, extensions);
559 } catch (const exc::engine_error& e)
560 {
561 ERROR(e.what());
562 return nullptr;
563 }
564}
565
567/* Returns true if K is a field, or has been declared to be one.
568 In the latter case, if an operation shows that K cannot be a field,
569 then this function will thereafter return false, and
570 rawGetNonUnit(K) can be used to obtain a non-unit, if one
571 has been found. */
572{
573 return K->is_field();
574}
575
577/* Declare that K is a field. The ring K can then be used as the coefficient
578 ring for computing Groebner bases,etc. */
579{
580 return const_cast<Ring *>(K)->declare_field();
581}
582
584{
585 return RingElement::make_raw(K, K->get_non_unit());
586}
587
588const Ring /* or null */ *rawAmbientRing(const Ring *R)
589/* If R is a quotient of a polynomial ring, or is a fraction ring, return the
590 polynomial ring over a basic ring of which this is a quotient (or fraction
591 ring) of.
592 For example, if R = frac(ZZ[s,t]/(s^2-1))[x,y,z]/(s*x+t*y+z^2), then the
593 returned
594 ring is ZZ[s,t][x,y,z]. This routine is provided only for debugging the
595 engine. */
596{
598 if (P == nullptr)
599 {
600 ERROR("expected polynomial ring");
601 return nullptr;
602 }
603 return P->getAmbientRing();
604}
605
606const Ring /* or null */ *rawDenominatorRing(const Ring *R)
607/* If elements of R may have denominators, then this routine returns true, and
608 the ambient ring for denominators is placed into resultRing. Otherwise, false
609 is returned. This routine is provided only for debugging the engine. */
610{
612 if (P == nullptr)
613 {
614 ERROR("expected polynomial ring");
615 return nullptr;
616 }
617 return P->getDenominatorRing();
618}
619
621// GaloisField routines /////
623
624bool findConwayPolynomial(long charac,
625 long deg,
626 bool find_random_if_no_conway_poly_available,
627 std::vector<long> &result_poly)
628{
629 // returns true if result_poly is actually set
630 int ret = 1;
631 fq_nmod_ctx_t ctx;
632 fmpz_t p;
633 fmpz_init(p);
634 fmpz_set_si(p, charac);
635 if (!find_random_if_no_conway_poly_available)
636 ret = _fq_nmod_ctx_init_conway(ctx, p, deg, "a");
637 else
638 fq_nmod_ctx_init(ctx, p, deg, "a");
639
640 if (ret == 0) return false;
641
642 result_poly.resize(deg + 1);
643 for (long i = 0; i <= deg; i++) result_poly[i] = 0;
644 for (long i = 0; i < ctx->len; i++)
645 {
646 if (ctx->j[i] < 0 or ctx->j[i] > deg)
647 printf("error: encountered bad degree\n");
648 // power is ctx->j[i]
649 // coeff is ctx->a[i]
650 result_poly[ctx->j[i]] = ctx->a[i];
651 }
652
653 // printf("flint GF information:\n");
654 // fq_nmod_ctx_print(ctx);
655
656 fq_nmod_ctx_clear(ctx);
657 return true;
658}
659
661 long deg,
662 M2_bool find_random_if_no_conway_poly_available)
663{
664 std::vector<long> poly;
666 charac, deg, find_random_if_no_conway_poly_available, poly);
667 return stdvector_to_M2_arrayint(poly);
668}
669
670// Local Variables:
671// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
672// indent-tabs-mode: nil
673// End:
Legacy Ring-based Galois field with explicit Zech-style lookup tables.
Ring-shaped wrapper that exposes a non-commutative FreeAlgebra to the rest of the engine.
Ring-shaped façade around a non-commutative quotient algebra.
Modern Monom / Polynomial value types shared by NC algebras and the refactored F4.
Legacy RingZZ — a Ring-derived integer ring backed by GMP mpz_t.
Legacy Z_mod — a Ring-derived Z/p with log / exp tables.
M2::ARingCC — machine-precision complex numbers (pair of doubles).
M2::ARingCCC — arbitrary-precision complex numbers (pair of MPFR floats).
M2::ARingCCi — certified complex intervals as Cartesian rectangles of MPFI intervals.
M2::ARingRR — machine-precision real numbers (IEEE 754 double).
M2::ARingRRR — arbitrary-precision real numbers backed by MPFR.
M2::ARingRRi — certified real intervals [a, b] with MPFR endpoints, MPFI arithmetic.
const RingQQ * globalQQ
Definition aring.cpp:24
ConcreteRing<RingType> — the templated bridge between aring and the legacy Ring API.
Shared base of the aring framework (namespace M2) that unifies the engine's coefficient rings.
virtual GBComputation * cast_to_GBComputation()
Definition comp.hpp:111
Abstract base for long-running, resumable engine computations (GBComputation, ResolutionComputation,...
Definition comp.hpp:70
static FractionField * create(const PolyRingFlat *R)
Definition frac.cpp:55
virtual const Ring * get_ring() const =0
base class for Groebner basis computations.
Definition comp-gb.hpp:69
static GF * create(const RingElement *prim)
Definition GF.cpp:127
static LocalRing * create(const PolyRing *R, GBComputation *P)
Definition localring.cpp:18
static ConcreteRing< RingType > * create(std::unique_ptr< RingType > R)
static M2FreeAlgebra * create(const Ring *K, const std::vector< std::string > &names, const PolynomialRing *degreeRing, const std::vector< int > &degrees, const std::vector< int > &wtvecs, const std::vector< int > &heftVector)
Concrete Ring wrapper around an owned FreeAlgebra (no quotient).
static M2FreeAlgebraQuotient * create(const M2FreeAlgebra &F, const Matrix *GB, int maxdeg)
Concrete Ring wrapper around an owned FreeAlgebraQuotient (the quotient counterpart of M2FreeAlgebra)...
const Ring * get_ring() const
Definition matrix.hpp:134
int n_rows() const
Definition matrix.hpp:146
int numNonTermOrderVariables() const
Definition monoid.hpp:190
int numInvertibleVariables() const
Definition monoid.hpp:189
Engine-side commutative monomial monoid: variable names, ordering, multidegree machinery,...
Definition monoid.hpp:89
unsigned int hash() const
Definition hash.hpp:106
static const PolyRing * get_trivial_poly_ring()
Definition poly.cpp:35
static const PolyRing * create(const Ring *K, const Monoid *M)
Definition poly.cpp:101
PolynomialRing subclass whose elements are represented as a single flat Nterm* linked list (no fracti...
Definition polyring.hpp:466
Concrete PolyRingFlat subclass implementing ordinary commutative polynomial rings K[x_1,...
Definition poly.hpp:64
int n_quotients() const
Definition polyring.hpp:219
virtual const PolynomialRing * getAmbientRing() const
Definition polyring.hpp:260
static PolynomialRing * create_quotient(const PolynomialRing *R, VECTOR(Nterm *) &elems)
Definition polyring.cpp:79
virtual const Monoid * getMonoid() const
Definition polyring.hpp:282
virtual const Ring * getCoefficients() const
Definition polyring.hpp:277
virtual const Ring * getDenominatorRing() const
Definition polyring.hpp:266
Abstract base for the engine's polynomial-ring hierarchy.
Definition polyring.hpp:96
virtual const PolyRingFlat * cast_to_PolyRingFlat() const
Definition ring.hpp:249
virtual void text_out(buffer &o) const =0
bool is_field() const
Definition ring.cpp:68
virtual const PolyRing * cast_to_PolyRing() const
Definition ring.hpp:245
virtual unsigned long get_precision() const
Definition ring.cpp:438
virtual const PolynomialRing * cast_to_PolynomialRing() const
Definition ring.hpp:243
long characteristic() const
Definition ring.hpp:159
virtual const LocalRing * cast_to_LocalRing() const
Definition ring.hpp:253
ring_elem get_non_unit() const
Definition ring.cpp:82
virtual const M2FreeAlgebra * cast_to_M2FreeAlgebra() const
Definition ring.hpp:256
virtual const FractionField * cast_to_FractionField() const
Definition ring.hpp:251
virtual const Tower * cast_to_Tower() const
Definition ring.hpp:241
ring_elem get_value() const
Definition relem.hpp:79
static RingElement * make_raw(const Ring *R, ring_elem f)
Definition relem.cpp:20
const Ring * get_ring() const
Definition relem.hpp:81
Front-end-visible "ring element" value: an engine ring_elem paired with the Ring* that gives it meani...
Definition relem.hpp:67
xxx xxx xxx
Definition ring.hpp:102
static SchurRing2 * createInfinite(const Ring *A)
Definition schur2.cpp:137
static SchurRing2 * create(const Ring *A, int n=-1)
Definition schur2.cpp:130
Refactored Schur (symmetric-function) ring whose elements are schur_poly sums of partitions over a co...
Definition schur2.hpp:152
static SchurRing * create(const PolynomialRing *R)
Definition schur.cpp:87
PolyRing subclass implementing the Schur (symmetric-function) ring whose monomials are partitions and...
Definition schur.hpp:82
static SchurSnRing * create(const Ring *A, int n=-1)
Definition schurSn.cpp:6
SchurRing2 subclass implementing the symmetric-group character ring (the "Schur ring of `S_n`"),...
Definition schurSn.hpp:51
static SkewPolynomialRing * create(const Ring *K, const Monoid *M, M2_arrayint skewvars)
Definition skewpoly.cpp:15
PolyRing subclass for skew-commutative (exterior-style) polynomial rings: the listed skewvars anticom...
Definition skewpoly.hpp:61
static SolvableAlgebra * create(const Ring *K, const Monoid *M, const Matrix *Q)
Definition solvable.cpp:16
PolyRing subclass for solvable polynomial algebras (PBW-type non-commutative rings where each pair of...
Definition solvable.hpp:57
static Tower * create(int charac, M2_ArrayString names)
Definition tower.cpp:46
Ring subclass for tower polynomial rings (Z/p)[x_0][x_1]...[x_{n-1}] modulo a chain of algebraic exte...
Definition tower.hpp:59
static WeylAlgebra * create(const Ring *K, const Monoid *M, M2_arrayint derivs, M2_arrayint comms, int homog_var)
Definition weylalg.cpp:99
PolyRing subclass for Weyl algebras: polynomial rings with the [d_i, x_i] = 1 derivative-variable com...
Definition weylalg.hpp:61
static Z_mod * create(int p)
Definition ZZp.cpp:64
M2_string to_string()
Definition buffer.cpp:20
namespace exc — internal C++ exception types and the TRY / CATCH macro pair.
#define Matrix
Definition factory.cpp:14
void intern_polyring(const PolynomialRing *G)
Definition finalize.cpp:81
intern_* helpers that register long-lived engine objects with bdwgc finalisers.
FractionField — field of fractions of an integral domain, with on-the-fly normalisation.
RingZZ * globalZZ
Definition relem.cpp:13
int p
const Ring * IM2_Ring_QQ(void)
Definition ring.cpp:64
const Ring * rawGaloisField(const RingElement *f)
Definition ring.cpp:76
const Ring * rawDenominatorRing(const Ring *R)
Definition ring.cpp:606
const Ring * rawSchurRing2(const Ring *A, int n)
Definition ring.cpp:486
const Ring * IM2_Ring_polyring(const Ring *K, const Monoid *M)
Definition ring.cpp:119
const Ring * rawDividedPowerRing(const Ring *K, const Monoid *M)
Definition ring.cpp:133
const Ring * IM2_Ring_ZZ(void)
Definition ring.cpp:63
const Ring * rawRingM2FreeAlgebra(const Ring *coefficientRing, M2_ArrayString names, const Ring *degreeRing, M2_arrayint degrees, M2_arrayint wtvecs, M2_arrayint heftVector)
Definition ring.cpp:223
const Ring * rawSchurSnRing(const Ring *A, int n)
Definition ring.cpp:499
const Ring * IM2_Ring_weyl_algebra(const Ring *R, M2_arrayint comm_vars, M2_arrayint diff_vars, int homog_var)
Definition ring.cpp:175
const Ring * rawRingM2FreeAlgebraQuotient(const Matrix *GB, int maxdeg)
Definition ring.cpp:285
const Ring * IM2_Ring_RRi(unsigned long prec)
Definition ring.cpp:92
const Ring * IM2_Ring_CCC(unsigned long prec)
Definition ring.cpp:108
bool findConwayPolynomial(long charac, long deg, bool find_random_if_no_conway_poly_available, std::vector< long > &result_poly)
Definition ring.cpp:624
const Ring * IM2_Ring_RRR(unsigned long prec)
Definition ring.cpp:102
const Ring * rawTowerRing3(const Ring *R1, engine_RawRingElementArray eqns)
Definition ring.cpp:536
const Ring * rawSchurRing1(const Ring *A)
Definition ring.cpp:473
const Ring * IM2_Ring_ZZp(int p)
Definition ring.cpp:65
const RingElement * rawGetNonUnit(const Ring *K)
Definition ring.cpp:583
const Ring * IM2_Ring_solvable_algebra(const Ring *R, const Matrix *Q)
Definition ring.cpp:202
unsigned int rawRingHash(const Ring *R)
Definition ring.cpp:48
const Ring * rawAmbientRing(const Ring *R)
Definition ring.cpp:588
const Ring * IM2_Ring_localization(const Ring *R, Computation *C)
Definition ring.cpp:359
M2_bool IM2_Ring_declare_field(const Ring *K)
Definition ring.cpp:576
const Ring * IM2_Ring_skew_polyring(const Ring *R, M2_arrayint skewvars)
Definition ring.cpp:153
long rawRingCharacteristic(const Ring *R)
Definition ring.cpp:57
M2_bool IM2_Ring_is_field(const Ring *K)
Definition ring.cpp:566
M2_arrayint rawConwayPolynomial(long charac, long deg, M2_bool find_random_if_no_conway_poly_available)
Definition ring.cpp:660
const Ring * IM2_Ring_quotient1(const Ring *R, const Ring *B)
Definition ring.cpp:423
const Ring * IM2_Ring_trivial_polyring()
Definition ring.cpp:114
const Ring * rawTowerRing1(long charac, M2_ArrayString names)
Definition ring.cpp:512
const Ring * IM2_Ring_quotient(const Ring *R, const Matrix *I)
Definition ring.cpp:388
const Ring * IM2_Ring_CCi(unsigned long prec)
Definition ring.cpp:97
M2_string IM2_Ring_to_string(const Ring *R)
Definition ring.cpp:50
const Ring * IM2_Ring_frac(const Ring *R)
Definition ring.cpp:310
const Ring * rawTowerRing2(const Ring *R1, M2_ArrayString new_names)
Definition ring.cpp:517
const Ring * IM2_Ring_schur(const Ring *R)
Definition ring.cpp:453
LocalRing — localisation of a polynomial ring at a prime ideal P.
const int ERROR
Definition m2-mem.cpp:55
VALGRIND_MAKE_MEM_DEFINED & result(result)
char M2_bool
Definition m2-types.h:82
Matrix — the engine's immutable homomorphism F -> G between free modules.
Monoid — variable count, naming, grading, and monomial order of a polynomial ring.
EngineMonomial — opaque single-monomial value type used at the engine boundary.
#define VECTOR(T)
Definition newdelete.hpp:78
PolyRingQuotient — polynomial ring modulo an ideal whose Groebner basis is known.
PolynomialRing — abstract polynomial-ring base, the engine's most-reused class.
RingElement — tagged (Ring*, ring_elem) pair, the engine's universal element type.
Engine-boundary C API for the legacy Ring hierarchy — coefficient, polynomial, and composite rings.
SchurRing2 — refactored Schur ring with length-prefixed partitions and an explicit Ring base.
SchurRing — symmetric-function ring with Schur-basis multiplication via Littlewood-Richardson.
SchurSnRing — SchurRing2 subclass intended for symmetric-group representation rings (Kronecker produc...
SkewPolynomialRing — polynomial ring with a designated set of anticommuting variables.
SolvableAlgebra — scaffolding for a PBW algebra x_j x_i = x_i x_j + q_{ij} (multiplication unimplemen...
Legacy Tower — Ring-derived iterated extension of Z/p (pre-aring).
const PolynomialRing * degreeRing(const std::vector< std::string > &names)
M2_arrayint stdvector_to_M2_arrayint(const std::vector< T > &v)
Definition util.hpp:79
void M2_ArrayString_to_stdvector(M2_ArrayString strs, std::vector< std::string > &result)
Definition util.hpp:52
std::vector< T > M2_arrayint_to_stdvector(M2_arrayint arr)
Definition util.hpp:96
WeylAlgebra — ring of polynomial differential operators with [d_i, x_i] = 1.