Macaulay2 Engine
Loading...
Searching...
No Matches
ring.h
Go to the documentation of this file.
1#ifndef _ring_h_
2# define _ring_h_
3
51
52# include "engine-includes.hpp"
53
54// TODO: fix this
55# if defined(__cplusplus)
56class Computation;
57class Matrix;
58class Monoid;
59class Ring;
60class RingElement;
61# else
62typedef struct Computation Computation;
63typedef struct Matrix Matrix;
64typedef struct Monoid Monoid;
65typedef struct Ring Ring;
66typedef struct RingElement RingElement;
67# endif
68
72
73# if defined(__cplusplus)
74extern "C" {
75# endif
76
77unsigned int rawRingHash(const Ring *R); /* drg: connected hash */
78/* assigned sequentially */
79
80M2_string IM2_Ring_to_string(const Ring *M); /* drg: connected */
81
82long rawRingCharacteristic(const Ring *R); /* connected: rawCharacteristic */
83
85// Ring creation //
87
88const Ring *IM2_Ring_ZZ(void); /* drg: connected rawZZ*/
89/* always returns the same object */
90
91const Ring *IM2_Ring_QQ(void); /* drg: connected rawQQ */
92/* always returns the same object */
93
94const Ring /* or null */ *IM2_Ring_ZZp(int p); /* drg: connected rawZZp*/
95/* Expects a prime number p in range 2 <= p <= 32749 */
96
97const Ring /* or null */ *rawGaloisField(const RingElement *f);
98/* drg: connected to rawGaloisField */
99/* f should be a primitive element in a ring
100 R = ZZ/p[x]/(g(x)), some p, some variable x, g irreducible,
101 monic, deg >= 2.
102 However, currently, not all of this is checked...
103*/
104
105const Ring /* or null */ *IM2_Ring_RRi(unsigned long prec);
106/* drg: connected rawRRi */
107
108const Ring /* or null */ *IM2_Ring_CCi(unsigned long prec);
109/* drg: connected rawCCi */
110
111const Ring /* or null */ *IM2_Ring_RRR(unsigned long prec);
112/* drg: connected rawRRR */
113
114const Ring /* or null */ *IM2_Ring_CCC(unsigned long prec);
115/* drg: connected rawCCC */
116
117const Ring /* or null */ *IM2_Ring_polyring(const Ring *K, const Monoid *M);
118/* drg: connected rawPolynomialRing(,) */
119/* K can be either commutative or not. If K is a quotient ring, the relations
120 are ignored. Use rawQuotientRing to then make the desired quotient ring. */
121
123/* drg: connected rawPolynomialRing() */
124/* This returns the polynomial ring ZZ[], whose degree ring is itself */
125
126const Ring /* or null */ *IM2_Ring_skew_polyring(const Ring *R,
127 M2_arrayint skewvars);
128/* drg: reconnected rawSkewPolynomialRing */
129/* R should be a polynomial ring K[M], where K is commutative.
130 skewvars should be a list of variable indices (for the monoid M) indicating
131 which ones are skew-commutative with each other. Further quotients (using
132 IM2_Ring_quotient) are allowed */
133
134const Ring /* or null */ *IM2_Ring_weyl_algebra(const Ring *R,
135 M2_arrayint comm_vars,
136 M2_arrayint diff_vars,
137 int homog_var);
138/* drg: reconnected rawWeylAlgebra*/
139/* R should be a polynomial ring K[M], where K is commutative.
140 comm_vars and diff_vars should be arrays of the same length. diff_vars[i] is
141 the differential operator corresponding to comm_vars[i]. If homog_var is
142 non-negative, then the multiplication is taken to be the homogeneous Weyl
143 algebra (that is Dx*x = x*Dx + h^2, where h is the variable of R with index
144 'homog_var'). Further quotients (using IM2_Ring_quotient) are allowed,
145 however, one must make sure that the quotient is only by elements in the
146 center of the ring.
147*/
148
149const Ring /* or null */ *IM2_Ring_solvable_algebra(const Ring *R,
150 const Matrix *Q);
151/* drg: connected rawSolvableAlgebra */
152/* R should be a polynomial ring K[M], where K is commutative.
153 Q is a square matrix of size #gens(M). If the variables are X_1, ..., X_r,
154 then multiplication is defined to be X_j X_i = Q_(j,i), for j > i.
155 The initial term of Q_(j,i) MUST be c * X_i * X_j, for some constant
156 c (depending on i and j), or at least less than that in the monomial
157 ordering.
158*/
159
160const Ring * /* or null */ rawRingM2FreeAlgebra(const Ring *coefficientRing,
161 M2_ArrayString names,
162 const Ring *degreeRing,
163 M2_arrayint degrees,
164 M2_arrayint wtvecs,
165 M2_arrayint heftVector);
166/* coefficientRing will be the allowed coefficients of our non-comm polynomials.
167 wtvecs is a flattened array of all of the weight vectors for the monomial
168 order, where contains the first weightvector, then second weightvector, etc.
169*/
170
171/* WIP
172const M2FreeMonoid* rawM2FreeMonoid(M2_ArrayString names,
173 const Ring* degreeRing,
174 M2_arrayint degrees,
175 M2_arrayint wtvecs,
176 M2_arrayint heftVector)
177*/
178
179const Ring * /* or null */ rawRingM2FreeAlgebraQuotient(const Matrix *GB,
180 int maxdeg);
181/* Given a non-commutative Groebner basis GB, create the quotient ring of it.
182 maxdeg is either -1 (the GB is complete), or the maximum degree that the GB
183 has been computed to */
184
185const Ring /* or null */ *IM2_Ring_frac(const Ring *R);
186/* drg: connected rawFractionRing*/
187
188const Ring /* or null */ *IM2_Ring_localization(const Ring *R, Computation *P);
189/* drg: connected rawLocalRing */
190/* Create the localization of R.
191 R should be a COMMUTATIVE ring. P should be a one row matrix
192 whose entries generate a prime ideal of R.
193*/
194
195const Ring /* or null */ *IM2_Ring_quotient(const Ring *R, const Matrix *I);
196/*drg: connected rawQuotientRing */
197/* Given a quotient of an ambient poly ring R = A/J, and a GB I in R, form
198 the quotient ring A/(I+J). */
199
200const Ring /* or null */ *IM2_Ring_quotient1(const Ring *R, const Ring *B);
201/*drg: connected rawQuotientRing */
202/* if R is a polynomial ring of the form A[x], and B = A/I (where A is a poly
203 ring) then form the quotient ring B[x]. */
204
205const Ring /* or null */ *IM2_Ring_schur(const Ring *R);
206/* drg: reconnected rawSchurRing */
207
208const Ring *rawSchurRing1(const Ring *A);
209
210const Ring *rawSchurRing2(const Ring *A, int n);
211
212const Ring *rawSchurSnRing(const Ring *A, int n);
213
214const Ring /* or null */ *rawTowerRing1(long charac, M2_ArrayString names);
215/* Create a tower ring with the given variable names and characteristic */
216
217const Ring /* or null */ *rawTowerRing2(const Ring *R1,
218 M2_ArrayString new_names);
219const Ring /* or null */ *rawTowerRing3(const Ring *R1,
220 engine_RawRingElementArray eqns);
221
222// FIXME: these three aren't defined in ring.cpp
223const Ring /* or null */ *rawARingTower1(const Ring *R1, M2_ArrayString names);
224/* Create a tower ring with the given variable names and base ring */
225
226const Ring /* or null */ *rawARingTower2(const Ring *R1,
227 M2_ArrayString new_names);
228const Ring /* or null */ *rawARingTower3(const Ring *R1,
229 engine_RawRingElementArray eqns);
230
231M2_bool IM2_Ring_is_field(const Ring *K); /* drg: connected rawIsField*/
232/* Returns true if K is a field, or has been declared to be one.
233 In the latter case, if an operation shows that K cannot be a field,
234 then this function will thereafter return false, and
235 rawGetNonUnit(K) can be used to obtain a non-unit, if one
236 has been found. */
237
239/* drg: connected rawDeclareField*/
240/* Declare that K is a field. The ring K can then be used as the coefficient
241 ring for computing Groebner bases,etc. If false is returned, then
242 the ring K has known non-units, and an error has been issued */
243
244const RingElement *rawGetNonUnit(const Ring *K);
245/* drg: connected rawGetNonUnit */
246/* Return a non-unit for the ring K, if one has been found, or the zero
247 element, if not. Perhaps we should name this 'get_non_unit'. This
248 function currently never seems to return a non-zero value, but I plan
249 on fixing that (MES, June 2002). */
250
251const Ring /* or null */ *rawAmbientRing(const Ring *R);
252/* drg: connected rawAmbientRing */
253/* If R is a quotient of a polynomial ring, or is a fraction ring, return the
254 polynomial ring over a basic ring of which this is a quotient (or fraction
255 ring) of. For example, if R = frac(ZZ[s,t]/(s^2-1))[x,y,z]/(s*x+t*y+z^2),
256 then the returned ring is ZZ[s,t][x,y,z]. This routine is provided only for
257 debugging the engine. */
258
259const Ring /* or null */ *rawDenominatorRing(const Ring *R);
260/* drg: connected rawDenominatorRing */
261/* If elements of R may have denominators, then this routine returns true, and
262 the ambient ring for denominators returned. Otherwise, NULL
263 is returned, which is not to be considered an error. This routine is
264 provided only for debugging the engine. */
265
267// GaloisField routines /////
269
270// FIXME: should these be moved elsewhere?
271
272/* FIXME
273bool findConwayPolynomial(long charac,
274 long deg,
275 bool find_random_if_no_conway_poly_available,
276 std::vector<long> &result_poly);
277*/
278
279/* returns an array of non-negative integers, which represents the given Conway
280 polynomial If there is none, a list of length 0 is returned. if the boolean
281 argument is set to true, returns a random poly that flint finds
282*/
284 long charac,
285 long deg,
286 M2_bool find_random_if_no_conway_poly_available);
287
288# if defined(__cplusplus)
289}
290# endif
291
292#endif /* _ring_h_ */
293
294// Local Variables:
295// indent-tabs-mode: nil
296// End:
Abstract base for long-running, resumable engine computations (GBComputation, ResolutionComputation,...
Definition comp.hpp:70
Engine-side commutative monomial monoid: variable names, ordering, multidegree machinery,...
Definition monoid.hpp:89
const Ring * R
Definition relem.hpp:68
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
Engine-wide include prelude — a single point of truth for portability shims.
#define Matrix
Definition factory.cpp:14
int p
M2_arrayint M2_arrayintOrNull
Definition m2-types.h:99
char M2_bool
Definition m2-types.h:82
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 * 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 * rawARingTower1(const Ring *R1, M2_ArrayString names)
Definition aring.cpp:296
const Ring * IM2_Ring_RRi(unsigned long prec)
Definition ring.cpp:92
const Ring * IM2_Ring_CCC(unsigned long prec)
Definition ring.cpp:108
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 * rawARingTower3(const Ring *R1, engine_RawRingElementArray eqns)
Definition aring.cpp:346
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
M2_arrayintOrNull rawConwayPolynomial(long charac, long deg, M2_bool find_random_if_no_conway_poly_available)
Definition ring.cpp:660
const Ring * IM2_Ring_localization(const Ring *R, Computation *P)
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
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 * rawARingTower2(const Ring *R1, M2_ArrayString new_names)
Definition aring.cpp:321
const Ring * IM2_Ring_CCi(unsigned long prec)
Definition ring.cpp:97
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
M2_string IM2_Ring_to_string(const Ring *M)
Definition ring.cpp:50
const PolynomialRing * degreeRing(const std::vector< std::string > &names)