My Project
Loading...
Searching...
No Matches
coeffs.h
Go to the documentation of this file.
1/*! \file coeffs/coeffs.h Coefficient rings, fields and other domains suitable for Singular polynomials
2
3 The main interface for Singular coefficients: \ref coeffs is the main handler for Singular numbers
4*/
5/****************************************
6* Computer Algebra System SINGULAR *
7****************************************/
8
9#ifndef COEFFS_H
10#define COEFFS_H
11
12#include "misc/auxiliary.h"
13#include "omalloc/omalloc.h"
14
15#include "misc/sirandom.h"
16/* for assume: */
17#include "reporter/reporter.h"
18#include "reporter/s_buff.h"
19#include "factory/factory.h"
20
21#include "coeffs/si_gmp.h"
22#include "coeffs/Enumerator.h"
23
24class CanonicalForm;
25
27{
29 n_Zp=1, /**< \F{p < 2^31} */
30 n_Q=2, /**< rational (GMP) numbers */
31 n_R=3, /**< single prescision (6,6) real numbers */
32 n_GF=4, /**< \GF{p^n < 2^16} */
33 n_long_R=5, /**< real floating point (GMP) numbers */
34 n_polyExt=6, /**< used to represent polys as coefficients */
35 n_algExt=7, /**< used for all algebraic extensions, i.e.,
36 the top-most extension in an extension tower
37 is algebraic */
38 n_transExt=8, /**< used for all transcendental extensions, i.e.,
39 the top-most extension in an extension tower
40 is transcendental */
41 n_long_C=9, /**< complex floating point (GMP) numbers */
42 n_nTupel=10, /**< n-tupel of cf: ZZ/p1,... ZZ/pn, R, long_R */
43 n_Z=11, /**< only used if HAVE_RINGS is defined */
44 n_Zn=12, /**< only used if HAVE_RINGS is defined */
45 n_Znm=13, /**< only used if HAVE_RINGS is defined */
46 n_Z2m=14, /**< only used if HAVE_RINGS is defined */
47 n_FlintQrat=15, /**< rational function field over Q */
48 n_CF=16, /**< ? */
50 n_Nemo_QQField=18, /*18 */
51 n_Nemo_ZZRing=19, /*19*/
54 n_Nemo_Field=22, /*22 */
55 n_Nemo_Ring=23 /*23 */
56};
57
58extern const unsigned short fftable[];
59
60struct snumber;
61typedef struct snumber * number;
62
63/* standard types */
64//struct ip_sring;
65//typedef struct ip_sring * ring; /* already needed in s_buff.h*/
66
67/// @class coeffs coeffs.h coeffs/coeffs.h
68///
69/// The main handler for Singular numbers which are suitable for Singular polynomials.
70///
71/// With it one may implement a ring, a field, a domain etc.
72///
73struct n_Procs_s;
74typedef struct n_Procs_s *coeffs;
75typedef struct n_Procs_s const * const_coeffs;
76
77typedef number (*numberfunc)(number a, number b, const coeffs r);
78
79/// maps "a", which lives in src, into dst
80typedef number (*nMapFunc)(number a, const coeffs src, const coeffs dst);
81
82
83/// Abstract interface for an enumerator of number coefficients for an
84/// object, e.g. a polynomial
86
87/// goes over coeffs given by the ICoeffsEnumerator and changes them.
88/// Additionally returns a number;
89typedef void (*nCoeffsEnumeratorFunc)(ICoeffsEnumerator& numberCollectionEnumerator, number& output, const coeffs r);
90
92
93#define FREE_RNUMBER(x) omFreeBin((void *)x, rnumber_bin)
94#define ALLOC_RNUMBER() (number)omAllocBin(rnumber_bin)
95#define ALLOC0_RNUMBER() (number)omAlloc0Bin(rnumber_bin)
96
97
98/// Creation data needed for finite fields
99typedef struct
100{
103 const char* GFPar_name;
104} GFInfo;
105
106typedef struct
107{
108 short float_len; /**< additional char-flags, rInit */
109 short float_len2; /**< additional char-flags, rInit */
110 const char* par_name; /**< parameter name */
112
113
115{
117 n_rep_int, /**< (int), see modulop.h */
118 n_rep_gap_rat, /**< (number), see longrat.h */
119 n_rep_gap_gmp, /**< (), see rinteger.h, new impl. */
120 n_rep_poly, /**< (poly), see algext.h */
121 n_rep_rat_fct, /**< (fraction), see transext.h */
122 n_rep_gmp, /**< (mpz_ptr), see rmodulon,h */
123 n_rep_float, /**< (float), see shortfl.h */
124 n_rep_gmp_float, /**< (gmp_float), see */
125 n_rep_gmp_complex,/**< (gmp_complex), see gnumpc.h */
126 n_rep_gf /**< (int), see ffields.h */
127};
128
130{
131 // administration of coeffs:
133 int ref;
136 /// how many variables of factory are already used by this coeff
138
139 // general properties:
140 /// TRUE, if nDelete/nCopy are dummies
142 /// TRUE, if std should make polynomials monic (if nInvers is cheap)
143 /// if false, then a gcd routine is used for a content computation
145
146 /// TRUE, if cf is a field
148 /// TRUE, if cf is a domain
150
151 // tests for numbers.cc:
152 BOOLEAN (*nCoeffIsEqual)(const coeffs r, n_coeffType n, void * parameter);
153
154 /// output of coeff description via Print
155 void (*cfCoeffWrite)(const coeffs r, BOOLEAN details);
156
157 /// string output of coeff description
158 char* (*cfCoeffString)(const coeffs r);
159
160 /// default name of cf, should substitute cfCoeffWrite, cfCoeffString
161 char* (*cfCoeffName)(const coeffs r);
162
163 // ?
164 // initialisation:
165 //void (*cfInitChar)(coeffs r, int parameter); // do one-time initialisations
166 void (*cfKillChar)(coeffs r); // undo all initialisations
167 // or NULL
168 void (*cfSetChar)(const coeffs r); // initialisations after each ring change
169 // or NULL
170 // general stuff
171 // if the ring has a meaningful Euclidean structure, hopefully
172 // supported by cfQuotRem, then
173 // IntMod, Div should give the same result
174 // Div(a,b) = QuotRem(a,b, &IntMod(a,b))
175 // if the ring is not Euclidean or a field, then IntMod should return 0
176 // and Div the exact quotient. It is assumed that the function is
177 // ONLY called on Euclidean rings or in the case of an exact division.
178 //
179 // cfDiv does an exact division, but has to handle illegal input
180 // cfExactDiv does an exact division, but no error checking
181 // (I'm not sure I understand and even less that this makes sense)
183
184 /// init with an integer
185 number (*cfInit)(long i,const coeffs r);
186
187 /// init with a GMP integer
188 number (*cfInitMPZ)(mpz_t i, const coeffs r);
189
190 /// how complicated, (0) => 0, or positive
191 int (*cfSize)(number n, const coeffs r);
192
193 /// conversion to long, 0 if impossible
194 long (*cfInt)(number &n, const coeffs r);
195
196 /// Converts a (integer) number n into a GMP number, 0 if impossible
197 void (*cfMPZ)(mpz_t result, number &n, const coeffs r);
198
199 /// changes argument inline: a:= -a
200 /// return -a! (no copy is returned)
201 /// the result should be assigned to the original argument: e.g. a = n_InpNeg(a,r)
202 number (*cfInpNeg)(number a, const coeffs r);
203 /// return 1/a
204 number (*cfInvers)(number a, const coeffs r);
205 /// return a copy of a
206 number (*cfCopy)(number a, const coeffs r);
207 number (*cfRePart)(number a, const coeffs r);
208 number (*cfImPart)(number a, const coeffs r);
209
210 /// print a given number (long format)
211 void (*cfWriteLong)(number a, const coeffs r);
212
213 /// print a given number in a shorter way, if possible
214 /// e.g. in K(a): a2 instead of a^2
215 void (*cfWriteShort)(number a, const coeffs r);
216
217 // it is legal, but not always useful to have cfRead(s, a, r)
218 // just return s again.
219 // Useful application (read constants which are not an projection
220 // from int/bigint:
221 // Let ring r = R,x,dp;
222 // where R is a coeffs having "special" "named" elements (ie.
223 // the primitive element in some algebraic extension).
224 // If there is no interpreter variable of the same name, it is
225 // difficult to create non-trivial elements in R.
226 // Hence one can use the string to allow creation of R-elts using the
227 // unbound name of the special element.
228 const char * (*cfRead)(const char * s, number * a, const coeffs r);
229
230 void (*cfNormalize)(number &a, const coeffs r);
231
232 BOOLEAN (*cfGreater)(number a,number b, const coeffs r),
233 /// tests
234 (*cfEqual)(number a,number b, const coeffs r),
235 (*cfIsZero)(number a, const coeffs r),
236 (*cfIsOne)(number a, const coeffs r),
237 // IsMOne is used for printing of polynomials:
238 // -1 is only printed for constant monomials
239 (*cfIsMOne)(number a, const coeffs r),
240 //GreaterZero is used for printing of polynomials:
241 // a "+" is only printed in front of a coefficient
242 // if the element is >0. It is assumed that any element
243 // failing this will start printing with a leading "-"
244 (*cfGreaterZero)(number a, const coeffs r);
245
246 void (*cfPower)(number a, int i, number * result, const coeffs r);
247 number (*cfGetDenom)(number &n, const coeffs r);
248 number (*cfGetNumerator)(number &n, const coeffs r);
249 //CF: a Euclidean ring is a commutative, unitary ring with an Euclidean
250 // function f s.th. for all a,b in R, b ne 0, we can find q, r s.th.
251 // a = qb+r and either r=0 or f(r) < f(b)
252 // Note that neither q nor r nor f(r) are unique.
253 number (*cfGcd)(number a, number b, const coeffs r);
254 number (*cfSubringGcd)(number a, number b, const coeffs r);
255 number (*cfExtGcd)(number a, number b, number *s, number *t,const coeffs r);
256 //given a and b in a Euclidean setting, return s,t,u,v sth.
257 // sa + tb = gcd
258 // ua + vb = 0
259 // sv + tu = 1
260 // ie. the 2x2 matrix (s t | u v) is unimodular and maps (a,b) to (g, 0)
261 //CF: note, in general, this cannot be derived from ExtGcd due to
262 // zero divisors
263 number (*cfXExtGcd)(number a, number b, number *s, number *t, number *u, number *v, const coeffs r);
264 //in a Euclidean ring, return the Euclidean norm as a bigint (of type number)
265 number (*cfEucNorm)(number a, const coeffs r);
266 //in a principal ideal ring (with zero divisors): the annihilator
267 // NULL otherwise
268 number (*cfAnn)(number a, const coeffs r);
269 //find a "canonical representative of a modulo the units of r
270 //return NULL if a is already normalized
271 //otherwise, the factor.
272 //(for Z: make positive, for z/nZ make the gcd with n
273 //apparently it is GetUnit!
274 //in a Euclidean ring, return the quotient and compute the remainder
275 //rem can be NULL
276 number (*cfQuotRem)(number a, number b, number *rem, const coeffs r);
277 number (*cfLcm)(number a, number b, const coeffs r);
278 number (*cfNormalizeHelper)(number a, number b, const coeffs r);
279 void (*cfDelete)(number * a, const coeffs r);
280
281 //CF: tries to find a canonical map from src -> dst
282 nMapFunc (*cfSetMap)(const coeffs src, const coeffs dst);
283
284 void (*cfWriteFd)(number a, const ssiInfo *f, const coeffs r);
285 number (*cfReadFd)( const ssiInfo *f, const coeffs r);
286
287 /// Inplace: a *= b
288 void (*cfInpMult)(number &a, number b, const coeffs r);
289
290 /// Inplace: a += b
291 void (*cfInpAdd)(number &a, number b, const coeffs r);
292
293 /// rational reconstruction: "best" rational a/b with a/b = p mod n
294 // or a = bp mod n
295 // CF: no idea what this would be in general
296 // it seems to be extended to operate coefficient wise in extensions.
297 // I presume then n in coeffs_BIGINT while p in coeffs
298 number (*cfFarey)(number p, number n, const coeffs);
299
300 /// chinese remainder
301 /// returns X with X mod q[i]=x[i], i=0..rl-1
302 //CF: by the looks of it: q[i] in Z (coeffs_BIGINT)
303 // strange things happen in naChineseRemainder for example.
304 number (*cfChineseRemainder)(number *x, number *q,int rl, BOOLEAN sym,CFArray &inv_cache,const coeffs);
305
306 /// degree for coefficients: -1 for 0, 0 for "constants", ...
307 int (*cfParDeg)(number x,const coeffs r);
308
309 /// create i^th parameter or NULL if not possible
310 number (*cfParameter)(const int i, const coeffs r);
311
312 /// a function returning random elements
313 number (*cfRandom)(siRandProc p, number p1, number p2, const coeffs cf);
314
315 /// function pointer behind n_ClearContent
317
318 /// function pointer behind n_ClearDenominators
320
321 /// conversion to CanonicalForm(factory) to number
322 number (*convFactoryNSingN)( const CanonicalForm n, const coeffs r);
323 CanonicalForm (*convSingNFactoryN)( number n, BOOLEAN setChar, const coeffs r );
324
325 /// Number of Parameters in the coeffs (default 0)
327
328 /// array containing the names of Parameters (default NULL)
329 char const ** pParameterNames;
330 // NOTE that it replaces the following:
331// char* complex_parameter; //< the name of sqrt(-1) in n_long_C , i.e. 'i' or 'j' etc...?
332// char * m_nfParameter; //< the name of parameter in n_GF
333
334 /////////////////////////////////////////////
335 // the union stuff
336
337 //-------------------------------------------
338
339 /* for extension fields we need to be able to represent polynomials,
340 so here is the polynomial ring: */
342
343 //number minpoly; //< no longer needed: replaced by
344 // //< extRing->qideal->[0]
345
346
347 int ch; /* characteristic, set by the local *InitChar methods;
348 In field extensions or extensions towers, the
349 characteristic can be accessed from any of the
350 intermediate extension fields, i.e., in this case
351 it is redundant along the chain of field extensions;
352 CONTRARY to SINGULAR as it was, we do NO LONGER use
353 negative values for ch;
354 for rings, ch will also be set and is - per def -
355 the smallest number of 1's that sum up to zero;
356 however, in this case ch may not fit in an int,
357 thus ch may contain a faulty value */
358
359 short float_len; /* additional char-flags, rInit */
360 short float_len2; /* additional char-flags, rInit */
361
362// BOOLEAN CanShortOut; //< if the elements can be printed in short format
363// // this is set to FALSE if a parameter name has >2 chars
364// BOOLEAN ShortOut; //< if the elements should print in short format
365
366// ---------------------------------------------------
367 // for n_GF
368
369 int m_nfCharQ; ///< the number of elements: q
370 int m_nfM1; ///< representation of -1
371 int m_nfCharP; ///< the characteristic: p
372 int m_nfCharQ1; ///< q-1
373 unsigned short *m_nfPlus1Table;
375
376// ---------------------------------------------------
377// for Zp:
378 unsigned short *npInvTable;
379 unsigned short *npExpTable;
380 unsigned short *npLogTable;
381 // int npPrimeM; // NOTE: npPrimeM is deprecated, please use ch instead!
382 int npPminus1M; ///< characteristic - 1
383//-------------------------------------------
384 int (*cfDivComp)(number a,number b,const coeffs r);
385 BOOLEAN (*cfIsUnit)(number a,const coeffs r);
386 number (*cfGetUnit)(number a,const coeffs r);
387 /// test if b divides a
388 /// cfDivBy(zero,b,r) is true, if b is a zero divisor
389 BOOLEAN (*cfDivBy)(number a, number b, const coeffs r);
390 /* The following members are for representing the ring Z/n,
391 where n is not a prime. We distinguish four cases:
392 1.) n has at least two distinct prime factors. Then
393 modBase stores n, modExponent stores 1, modNumber
394 stores n, and mod2mMask is not used;
395 2.) n = p^k for some odd prime p and k > 1. Then
396 modBase stores p, modExponent stores k, modNumber
397 stores n, and mod2mMask is not used;
398 3.) n = 2^k for some k > 1; moreover, 2^k - 1 fits in
399 an unsigned long. Then modBase stores 2, modExponent
400 stores k, modNumber is not used, and mod2mMask stores
401 2^k - 1, i.e., the bit mask '111..1' of length k.
402 4.) n = 2^k for some k > 1; but 2^k - 1 does not fit in
403 an unsigned long. Then modBase stores 2, modExponent
404 stores k, modNumber stores n, and mod2mMask is not
405 used;
406 Cases 1.), 2.), and 4.) are covered by the implementation
407 in the files rmodulon.h and rmodulon.cc, whereas case 3.)
408 is implemented in the files rmodulo2m.h and rmodulo2m.cc. */
409 mpz_ptr modBase;
410 unsigned long modExponent;
411 mpz_ptr modNumber;
412 unsigned long mod2mMask;
413 //returns coeffs with updated ch, modNumber and modExp
414 coeffs (*cfQuot1)(number c, const coeffs r);
415
416 /*CF: for blackbox rings, contains data needed to define the ring.
417 * contents depends on the actual example.*/
418 void * data;
419 number (*cfReadFd_S)(char**s, const coeffs r);
420 void (*cfWriteFd_S)(number a, const coeffs r);
421#ifdef LDEBUG
422 // must be last entry:
423 /// Test: is "a" a correct number?
424 // DB as in debug, not data base.
425 BOOLEAN (*cfDBTest)(number a, const char *f, const int l, const coeffs r);
426#endif
427};
428
429// test properties and type
430/// Returns the type of coeffs domain
432{ assume(r != NULL); return r->type; }
433
434/// one-time initialisations for new coeffs
435/// in case of an error return NULL
436coeffs nInitChar(n_coeffType t, void * parameter);
437
438/// "copy" coeffs, i.e. increment ref
440{ assume(r!=NULL); r->ref++; return r;}
441
442/// undo all initialisations
443void nKillChar(coeffs r);
444
445/// initialisations after each ring change
446static FORCE_INLINE void nSetChar(const coeffs r)
447{ assume(r!=NULL); assume(r->cfSetChar != NULL); r->cfSetChar(r); }
448
449/// Return the characteristic of the coeff. domain.
450static FORCE_INLINE int n_GetChar(const coeffs r)
451{ assume(r != NULL); return r->ch; }
452
453
454// the access methods (part 2):
455
456/// return a copy of 'n'
457static FORCE_INLINE number n_Copy(number n, const coeffs r)
458{ assume(r != NULL); assume(r->cfCopy!=NULL); return r->cfCopy(n, r); }
459
460/// delete 'p'
461static FORCE_INLINE void n_Delete(number* p, const coeffs r)
462{ assume(r != NULL); assume(r->cfDelete!= NULL); r->cfDelete(p, r); }
463
464/// TRUE iff 'a' and 'b' represent the same number;
465/// they may have different representations
466static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
467{ assume(r != NULL); assume(r->cfEqual!=NULL); return r->cfEqual(a, b, r); }
468
469/// TRUE iff 'n' represents the zero element
470static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
471{ assume(r != NULL); assume(r->cfIsZero!=NULL); return r->cfIsZero(n,r); }
472
473/// TRUE iff 'n' represents the one element
474static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
475{ assume(r != NULL); assume(r->cfIsOne!=NULL); return r->cfIsOne(n,r); }
476
477/// TRUE iff 'n' represents the additive inverse of the one element, i.e. -1
478static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
479{ assume(r != NULL); assume(r->cfIsMOne!=NULL); return r->cfIsMOne(n,r); }
480
481/// ordered fields: TRUE iff 'n' is positive;
482/// in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long
483/// representing n
484/// in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or
485/// (Im(n) == 0 and Re(n) >= 0)
486/// in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0))
487/// in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0)
488/// or (LC(numerator(n) is not a constant)
489/// in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1)
490/// in Z/mZ: TRUE iff the internal mpz is greater than zero
491/// in Z: TRUE iff n > 0
492///
493/// !!! Recommendation: remove implementations for unordered fields
494/// !!! and raise errors instead, in these cases
495/// !!! Do not follow this recommendation: while writing polys,
496/// !!! between 2 monomials will be an additional + iff !n_GreaterZero(next coeff)
497/// Then change definition to include n_GreaterZero => printing does NOT
498/// start with -
499///
500static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
501{ assume(r != NULL); assume(r->cfGreaterZero!=NULL); return r->cfGreaterZero(n,r); }
502
503/// ordered fields: TRUE iff 'a' is larger than 'b';
504/// in Z/pZ: TRUE iff la > lb, where la and lb are the long's representing
505// a and b, respectively
506/// in C: TRUE iff (Im(a) > Im(b))
507/// in K(a)/<p(a)>: TRUE iff (a != 0 and (b == 0 or deg(a) > deg(b))
508/// in K(t_1, ..., t_n): TRUE only if one or both numerator polynomials are
509/// zero or if their degrees are equal. In this case,
510/// TRUE if LC(numerator(a)) > LC(numerator(b))
511/// in Z/2^kZ: TRUE if n_DivBy(a, b)
512/// in Z/mZ: TRUE iff the internal mpz's fulfill the relation '>'
513/// in Z: TRUE iff a > b
514///
515/// !!! Recommendation: remove implementations for unordered fields
516/// !!! and raise errors instead, in these cases
517static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
518{ assume(r != NULL); assume(r->cfGreater!=NULL); return r->cfGreater(a,b,r); }
519
520/// TRUE iff n has a multiplicative inverse in the given coeff field/ring r
521static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
522{ assume(r != NULL); assume(r->cfIsUnit!=NULL); return r->cfIsUnit(n,r); }
523
525{ assume(r != NULL); assume(r->cfQuot1 != NULL); return r->cfQuot1(c, r); }
526
527static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
528{ assume(r != NULL); assume(r->cfDivComp!=NULL); return r->cfDivComp (a,b,r); }
529
530/// in Z: 1
531/// in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that
532/// is co-prime with k
533/// in Z/2^kZ: largest odd divisor of n (taken in Z)
534/// other cases: not implemented
535// CF: should imply that n/GetUnit(n) is normalized in Z/kZ
536// it would make more sense to return the inverse...
537static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
538{ assume(r != NULL); assume(r->cfGetUnit!=NULL); return r->cfGetUnit(n,r); }
539
540/// a number representing i in the given coeff field/ring r
541static FORCE_INLINE number n_Init(long i, const coeffs r)
542{ assume(r != NULL); assume(r->cfInit!=NULL); return r->cfInit(i,r); }
543
544/// conversion of a GMP integer to number
545static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
546{ assume(r != NULL); assume(r->cfInitMPZ != NULL); return r->cfInitMPZ(n,r); }
547
548/// conversion of n to an int; 0 if not possible
549/// in Z/pZ: the representing int lying in (-p/2 .. p/2]
550static FORCE_INLINE long n_Int(number &n, const coeffs r)
551{ assume(r != NULL); assume(r->cfInt!=NULL); return r->cfInt(n,r); }
552
553/// conversion of n to a GMP integer; 0 if not possible
554static FORCE_INLINE void n_MPZ(mpz_t result, number &n, const coeffs r)
555{ assume(r != NULL); assume(r->cfMPZ!=NULL); r->cfMPZ(result, n, r); }
556
557
558/// in-place negation of n
559/// MUST BE USED: n = n_InpNeg(n) (no copy is returned)
560static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
561{ assume(r != NULL); assume(r->cfInpNeg!=NULL); return r->cfInpNeg(n,r); }
562
563/// return the multiplicative inverse of 'a';
564/// raise an error if 'a' is not invertible
565///
566/// !!! Recommendation: rename to 'n_Inverse'
567static FORCE_INLINE number n_Invers(number a, const coeffs r)
568{ assume(r != NULL); assume(r->cfInvers!=NULL); return r->cfInvers(a,r); }
569
570/// return a non-negative measure for the complexity of n;
571/// return 0 only when n represents zero;
572/// (used for pivot strategies in matrix computations with entries from r)
573static FORCE_INLINE int n_Size(number n, const coeffs r)
574{ assume(r != NULL); assume(r->cfSize!=NULL); return r->cfSize(n,r); }
575
576/// inplace-normalization of n;
577/// produces some canonical representation of n;
578///
579/// !!! Recommendation: remove this method from the user-interface, i.e.,
580/// !!! this should be hidden
581static FORCE_INLINE void n_Normalize(number& n, const coeffs r)
582{ assume(r != NULL); assume(r->cfNormalize!=NULL); r->cfNormalize(n,r); }
583
584/// write to the output buffer of the currently used reporter
585//CF: the "&" should be removed, as one wants to write constants as well
586static FORCE_INLINE void n_WriteLong(number n, const coeffs r)
587{ assume(r != NULL); assume(r->cfWriteLong!=NULL); r->cfWriteLong(n,r); }
588
589/// write to the output buffer of the currently used reporter
590/// in a shortest possible way, e.g. in K(a): a2 instead of a^2
591static FORCE_INLINE void n_WriteShort(number n, const coeffs r)
592{ assume(r != NULL); assume(r->cfWriteShort!=NULL); r->cfWriteShort(n,r); }
593
594static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut = TRUE)
595{ if (bShortOut) n_WriteShort(n, r); else n_WriteLong(n, r); }
596
597
598/// !!! Recommendation: This method is too cryptic to be part of the user-
599/// !!! interface. As defined here, it is merely a helper
600/// !!! method for parsing number input strings.
601static FORCE_INLINE const char *n_Read(const char * s, number * a, const coeffs r)
602{ assume(r != NULL); assume(r->cfRead!=NULL); return r->cfRead(s, a, r); }
603
604/// return the denominator of n
605/// (if elements of r are by nature not fractional, result is 1)
606static FORCE_INLINE number n_GetDenom(number& n, const coeffs r)
607{ assume(r != NULL); assume(r->cfGetDenom!=NULL); return r->cfGetDenom(n, r); }
608
609/// return the numerator of n
610/// (if elements of r are by nature not fractional, result is n)
611static FORCE_INLINE number n_GetNumerator(number& n, const coeffs r)
612{ assume(r != NULL); assume(r->cfGetNumerator!=NULL); return r->cfGetNumerator(n, r); }
613
614/// return the quotient of 'a' and 'b', i.e., a/b;
615/// raises an error if 'b' is not invertible in r
616/// exception in Z: raises an error if 'a' is not divisible by 'b'
617/// always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
618static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
619{ assume(r != NULL); assume(r->cfDiv!=NULL); return r->cfDiv(a,b,r); }
620
621/// assume that there is a canonical subring in cf and we know
622/// that division is possible for these a and b in the subring,
623/// n_ExactDiv performs it, may skip additional tests.
624/// Can always be substituted by n_Div at the cost of larger computing time.
625static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
626{ assume(r != NULL); assume(r->cfExactDiv!=NULL); return r->cfExactDiv(a,b,r); }
627
628/// for r a field, return n_Init(0,r)
629/// always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
630/// n_IntMod(a,b,r) >=0
631static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
632{ assume(r != NULL); return r->cfIntMod(a,b,r); }
633
634/// fill res with the power a^b
635static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
636{ assume(r != NULL); assume(r->cfPower!=NULL); r->cfPower(a,b,res,r); }
637
638/// return the product of 'a' and 'b', i.e., a*b
639static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
640{ assume(r != NULL); assume(r->cfMult!=NULL); return r->cfMult(a, b, r); }
641
642/// multiplication of 'a' and 'b';
643/// replacement of 'a' by the product a*b
644static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
645{ assume(r != NULL); assume(r->cfInpMult!=NULL); r->cfInpMult(a,b,r); }
646
647/// addition of 'a' and 'b';
648/// replacement of 'a' by the sum a+b
649static FORCE_INLINE void n_InpAdd(number &a, number b, const coeffs r)
650{ assume(r != NULL); assume(r->cfInpAdd!=NULL); r->cfInpAdd(a,b,r); }
651
652/// return the sum of 'a' and 'b', i.e., a+b
653static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
654{ assume(r != NULL); assume(r->cfAdd!=NULL); return r->cfAdd(a, b, r); }
655
656
657/// return the difference of 'a' and 'b', i.e., a-b
658static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
659{ assume(r != NULL); assume(r->cfSub!=NULL); return r->cfSub(a, b, r); }
660
661/// in Z: return the gcd of 'a' and 'b'
662/// in Z/nZ, Z/2^kZ: computed as in the case Z
663/// in Z/pZ, C, R: not implemented
664/// in Q: return the gcd of the numerators of 'a' and 'b'
665/// in K(a)/<p(a)>: not implemented
666/// in K(t_1, ..., t_n): not implemented
667static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
668{ assume(r != NULL); assume(r->cfGcd!=NULL); return r->cfGcd(a,b,r); }
669static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
670{ assume(r != NULL); assume(r->cfSubringGcd!=NULL); return r->cfSubringGcd(a,b,r); }
671
672/// beware that ExtGCD is only relevant for a few chosen coeff. domains
673/// and may perform something unexpected in some cases...
674static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
675{ assume(r != NULL); assume(r->cfExtGcd!=NULL); return r->cfExtGcd (a,b,s,t,r); }
676static FORCE_INLINE number n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
677{ assume(r != NULL); assume(r->cfXExtGcd!=NULL); return r->cfXExtGcd (a,b,s,t,u,v,r); }
678static FORCE_INLINE number n_EucNorm(number a, const coeffs r)
679{ assume(r != NULL); assume(r->cfEucNorm!=NULL); return r->cfEucNorm (a,r); }
680/// if r is a ring with zero divisors, return an annihilator!=0 of b
681/// otherwise return NULL
682static FORCE_INLINE number n_Ann(number a, const coeffs r)
683{ assume(r != NULL); return r->cfAnn (a,r); }
684static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
685{ assume(r != NULL); assume(r->cfQuotRem!=NULL); return r->cfQuotRem (a,b,q,r); }
686
687
688/// in Z: return the lcm of 'a' and 'b'
689/// in Z/nZ, Z/2^kZ: computed as in the case Z
690/// in Z/pZ, C, R: not implemented
691/// in K(a)/<p(a)>: not implemented
692/// in K(t_1, ..., t_n): not implemented
693static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
694{ assume(r != NULL); assume(r->cfLcm!=NULL); return r->cfLcm(a,b,r); }
695
696/// assume that r is a quotient field (otherwise, return 1)
697/// for arguments (a1/a2,b1/b2) return (lcm(a1,b2)/1)
698static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
699{ assume(r != NULL); assume(r->cfNormalizeHelper!=NULL); return r->cfNormalizeHelper(a,b,r); }
700
701number ndCopyMap(number a, const coeffs src, const coeffs dst);
702/// set the mapping function pointers for translating numbers from src to dst
703static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
704{ assume(src != NULL && dst != NULL); assume(dst->cfSetMap!=NULL);
705 if (src==dst) return ndCopyMap;
706 return dst->cfSetMap(src,dst);
707}
708
709#ifdef LDEBUG
710/// test whether n is a correct number;
711/// only used if LDEBUG is defined
712static FORCE_INLINE BOOLEAN n_DBTest(number n, const char *filename, const int linenumber, const coeffs r)
713{ assume(r != NULL); assume(r->cfDBTest != NULL); return r->cfDBTest(n, filename, linenumber, r); }
714/// BOOLEAN n_Test(number a, const coeffs r)
715#define n_Test(a,r) n_DBTest(a, __FILE__, __LINE__, r)
716#else
717#define n_Test(a,r) 1
718#endif
719
720
721/// output the coeff description
722static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details = TRUE)
723{ assume(r != NULL); assume(r->cfCoeffWrite != NULL); r->cfCoeffWrite(r, details); }
724
725// Tests:
727{ assume(r != NULL); return (getCoeffType(r)==n_Z2m); }
728
730{ assume(r != NULL); return (getCoeffType(r)==n_Znm)&&(!r->is_field); }
731
733{ assume(r != NULL); return (r->is_field==0); }
734
735/// returns TRUE, if r is a field or r has no zero divisors (i.e is a domain)
737{ assume(r != NULL); return (r->is_domain); }
738
739/// test whether 'a' is divisible 'b';
740/// for r encoding a field: TRUE iff 'b' does not represent zero
741/// in Z: TRUE iff 'b' divides 'a' (with remainder = zero)
742/// in Z/nZ: TRUE iff (a = 0 and b divides n in Z) or
743/// (a != 0 and b/gcd(a, b) is co-prime with n, i.e.
744/// a unit in Z/nZ)
745/// in Z/2^kZ: TRUE iff ((a = 0 mod 2^k) and (b = 0 or b is a power of 2))
746/// or ((a, b <> 0) and (b/gcd(a, b) is odd))
747static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
748{ assume(r != NULL);
749 if( nCoeff_is_Ring(r) )
750 {
751 assume(r->cfDivBy!=NULL); return r->cfDivBy(a,b,r);
752 }
753 return !n_IsZero(b, r);
754}
755
756static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym,CFArray &inv_cache,const coeffs r)
757{ assume(r != NULL); assume(r->cfChineseRemainder != NULL); return r->cfChineseRemainder(a,b,rl,sym,inv_cache,r); }
758
759static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
760{ assume(r != NULL); assume(r->cfFarey != NULL); return r->cfFarey(a,b,r); }
761
762static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
763{ assume(r != NULL); assume(r->cfParDeg != NULL); return r->cfParDeg(n,r); }
764
765/// Returns the number of parameters
767{ assume(r != NULL); return r->iNumberOfParameters; }
768
769/// Returns a (const!) pointer to (const char*) names of parameters
770static FORCE_INLINE char const * * n_ParameterNames(const coeffs r)
771{ assume(r != NULL); return r->pParameterNames; }
772
773/// return the (iParameter^th) parameter as a NEW number
774/// NOTE: parameter numbering: 1..n_NumberOfParameters(...)
775static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
776{ assume(r != NULL);
777 assume((iParameter >= 1) || (iParameter <= n_NumberOfParameters(r)));
778 assume(r->cfParameter != NULL);
779 return r->cfParameter(iParameter, r);
780}
781
782static FORCE_INLINE number n_RePart(number i, const coeffs cf)
783{ assume(cf != NULL); assume(cf->cfRePart!=NULL); return cf->cfRePart(i,cf); }
784
785static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
786{ assume(cf != NULL); assume(cf->cfImPart!=NULL); return cf->cfImPart(i,cf); }
787
788/// returns TRUE, if r is not a field and r has non-trivial units
790{ assume(r != NULL);
791 return (((getCoeffType(r)==n_Zn) || (getCoeffType(r)==n_Z2m) || (getCoeffType(r)==n_Znm))
792 &&(!r->is_field)); }
793
795{ assume(r != NULL); return getCoeffType(r)==n_Zp; }
796
798{ assume(r != NULL);
799 return (r->is_field && getCoeffType(r)==n_Zn); }
800
802{ assume(r != NULL); return ((getCoeffType(r)==n_Zp) && (r->ch == p)); }
803
805{
806 assume(r != NULL);
807 #if SI_INTEGER_VARIANT==1
808 return getCoeffType(r)==n_Q && (r->is_field);
809 #else
810 return getCoeffType(r)==n_Q;
811 #endif
812}
813
815{
816 assume(r != NULL);
817 #if SI_INTEGER_VARIANT==1
818 return ((getCoeffType(r)==n_Q) && (!r->is_field));
819 #else
820 return getCoeffType(r)==n_Z;
821 #endif
822}
823
825{ assume(r != NULL); return (getCoeffType(r)==n_Zn)&& (r->is_field==0); }
826
828{ assume(r != NULL); return getCoeffType(r)==n_Q; }
829
830static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r) /* R, long R, long C */
831{ assume(r != NULL); return (getCoeffType(r)==n_R) || (getCoeffType(r)==n_long_R) || (getCoeffType(r)==n_long_C); }
832// (r->ringtype == 0) && (r->ch == -1); ??
833
835{ assume(r != NULL); return getCoeffType(r)==n_R; }
836
838{ assume(r != NULL); return getCoeffType(r)==n_GF; }
839
841{ assume(r != NULL); return (getCoeffType(r)==n_GF) && (r->ch == q); }
842
843/* TRUE iff r represents an algebraic or transcendental extension field */
845{
846 assume(r != NULL);
847 return (getCoeffType(r)==n_algExt) || (getCoeffType(r)==n_transExt);
848}
849
850/* DO NOT USE (only kept for compatibility reasons towards the SINGULAR
851 svn trunk);
852 intention: should be TRUE iff the given r is an extension field above
853 some Z/pZ;
854 actually: TRUE iff the given r is an extension tower of arbitrary
855 height above some field of characteristic p (may be Z/pZ or some
856 Galois field of characteristic p) */
858{
859 assume(r != NULL);
860 return ((!nCoeff_is_Ring(r)) && (n_GetChar(r) != 0) && nCoeff_is_Extension(r));
861}
862
863/* DO NOT USE (only kept for compatibility reasons towards the SINGULAR
864 svn trunk);
865 intention: should be TRUE iff the given r is an extension field above
866 Z/pZ (with p as provided);
867 actually: TRUE iff the given r is an extension tower of arbitrary
868 height above some field of characteristic p (may be Z/pZ or some
869 Galois field of characteristic p) */
871{
872 assume(r != NULL);
873 assume(p != 0);
874 return ((!nCoeff_is_Ring(r)) && (n_GetChar(r) == p) && nCoeff_is_Extension(r));
875}
876
877/* DO NOT USE (only kept for compatibility reasons towards the SINGULAR
878 svn trunk);
879 intention: should be TRUE iff the given r is an extension field
880 above Q;
881 actually: TRUE iff the given r is an extension tower of arbitrary
882 height above some field of characteristic 0 (may be Q, R, or C) */
884{
885 assume(r != NULL);
886 return ((n_GetChar(r) == 0) && nCoeff_is_Extension(r));
887}
888
890{ assume(r != NULL); return getCoeffType(r)==n_long_R; }
891
893{ assume(r != NULL); return getCoeffType(r)==n_long_C; }
894
896{ assume(r != NULL); return getCoeffType(r)==n_CF; }
897
898/// TRUE, if the computation of the inverse is fast,
899/// i.e. prefer leading coeff. 1 over content
901{ assume(r != NULL); return r->has_simple_Inverse; }
902
903/// TRUE if n_Delete is empty operation
905{ assume(r != NULL); return r->has_simple_Alloc; }
906
907/// TRUE iff r represents an algebraic extension field
909{ assume(r != NULL); return (getCoeffType(r)==n_algExt); }
910
911/// is it an alg. ext. of Q?
913{ assume(r != NULL); return ((n_GetChar(r) == 0) && nCoeff_is_algExt(r)); }
914
915/// TRUE iff r represents a transcendental extension field
918
919/// is it an trans. ext. of Q?
921{ assume(r != NULL); return ((n_GetChar(r) == 0) && nCoeff_is_transExt(r)); }
922
923/// Computes the content and (inplace) divides it out on a collection
924/// of numbers
925/// number @em c is the content (i.e. the GCD of all the coeffs, which
926/// we divide out inplace)
927/// NOTE: it assumes all coefficient numbers to be integer!!!
928/// NOTE/TODO: see also the description by Hans
929/// TODO: rename into n_ClearIntegerContent
930static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r)
931{ assume(r != NULL); r->cfClearContent(numberCollectionEnumerator, c, r); }
932
933/// (inplace) Clears denominators on a collection of numbers
934/// number @em d is the LCM of all the coefficient denominators (i.e. the number
935/// with which all the number coeffs. were multiplied)
936/// NOTE/TODO: see also the description by Hans
937static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r)
938{ assume(r != NULL); r->cfClearDenominators(numberCollectionEnumerator, d, r); }
939
940// convenience helpers (no number returned - but the input enumeration
941// is to be changed
942// TODO: do we need separate hooks for these as our existing code does
943// *different things* there: compare p_Cleardenom (which calls
944// *p_Content) and p_Cleardenom_n (which doesn't)!!!
945
946static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)
947{ number c; n_ClearContent(numberCollectionEnumerator, c, r); n_Delete(&c, r); }
948
949static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)
950{ assume(r != NULL); number d; n_ClearDenominators(numberCollectionEnumerator, d, r); n_Delete(&d, r); }
951
952
953/// print a number (BEWARE of string buffers!)
954/// mostly for debugging
955void n_Print(number& a, const coeffs r);
956
957
958
959/// TODO: make it a virtual method of coeffs, together with:
960/// Decompose & Compose, rParameter & rPar
961static FORCE_INLINE char * nCoeffString(const coeffs cf)
962{ assume( cf != NULL ); return cf->cfCoeffString(cf); }
963
964
965static FORCE_INLINE char * nCoeffName (const coeffs cf)
966{ assume( cf != NULL ); return cf->cfCoeffName(cf); }
967
968static FORCE_INLINE number n_Random(siRandProc p, number p1, number p2, const coeffs cf)
969{ assume( cf != NULL ); assume( cf->cfRandom != NULL ); return cf->cfRandom(p, p1, p2, cf); }
970
971/// io via ssi:
972static FORCE_INLINE void n_WriteFd(number a, const ssiInfo *f, const coeffs r)
973{ assume(r != NULL); assume(r->cfWriteFd != NULL); return r->cfWriteFd(a, f, r); }
974static FORCE_INLINE void n_WriteFd_S(number a, const coeffs r)
975{ assume(r != NULL); assume(r->cfWriteFd_S != NULL); return r->cfWriteFd_S(a, r); }
976
977/// io via ssi:
978static FORCE_INLINE number n_ReadFd( const ssiInfo *f, const coeffs r)
979{ assume(r != NULL); assume(r->cfReadFd != NULL); return r->cfReadFd(f, r); }
980static FORCE_INLINE number n_ReadFd_S(char**s, const coeffs r)
981{ assume(r != NULL); assume(r->cfReadFd_S != NULL); return r->cfReadFd_S(s, r); }
982
983
984static FORCE_INLINE number n_convFactoryNSingN( const CanonicalForm n, const coeffs r)
985{ assume(r != NULL); assume(r->convFactoryNSingN != NULL); return r->convFactoryNSingN(n, r); }
986
987static FORCE_INLINE CanonicalForm n_convSingNFactoryN( number n, BOOLEAN setChar, const coeffs r )
988{ assume(r != NULL); assume(r->convSingNFactoryN != NULL); return r->convSingNFactoryN(n, setChar, r); }
989
990
991// TODO: remove the following functions...
992// the following 2 inline functions are just convenience shortcuts for Frank's code:
993static FORCE_INLINE void number2mpz(number n, coeffs c, mpz_t m){ n_MPZ(m, n, c); }
994static FORCE_INLINE number mpz2number(mpz_t m, coeffs c){ return n_InitMPZ(m, c); }
995#endif
996
Abstract API for enumerators.
All the auxiliary stuff.
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
#define FORCE_INLINE
Definition auxiliary.h:330
Array< CanonicalForm > CFArray
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
int i
Definition cfEzgcd.cc:132
Variable x
Definition cfModGcd.cc:4090
int p
Definition cfModGcd.cc:4086
CanonicalForm cf
Definition cfModGcd.cc:4091
CanonicalForm b
Definition cfModGcd.cc:4111
FILE * f
Definition checklibs.c:9
factory's main class
Templated enumerator interface for simple iteration over a generic collection of T's.
Definition Enumerator.h:125
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
Definition coeffs.h:762
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition coeffs.h:639
IEnumerator< number > ICoeffsEnumerator
Abstract interface for an enumerator of number coefficients for an object, e.g. a polynomial.
Definition coeffs.h:85
static FORCE_INLINE void number2mpz(number n, coeffs c, mpz_t m)
Definition coeffs.h:993
static FORCE_INLINE coeffs n_CoeffRingQuot1(number c, const coeffs r)
Definition coeffs.h:524
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1....
Definition coeffs.h:775
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition coeffs.h:550
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:457
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1,...
Definition coeffs.h:698
static FORCE_INLINE number n_ReadFd_S(char **s, const coeffs r)
Definition coeffs.h:980
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
Definition coeffs.h:653
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1)
Definition coeffs.h:606
static FORCE_INLINE number n_ReadFd(const ssiInfo *f, const coeffs r)
io via ssi:
Definition coeffs.h:978
static FORCE_INLINE BOOLEAN nCoeff_has_Units(const coeffs r)
returns TRUE, if r is not a field and r has non-trivial units
Definition coeffs.h:789
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
Definition coeffs.h:722
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition coeffs.h:837
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition coeffs.h:814
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition coeffs.h:844
number ndCopyMap(number a, const coeffs src, const coeffs dst)
Definition numbers.cc:293
static FORCE_INLINE number n_Random(siRandProc p, number p1, number p2, const coeffs cf)
Definition coeffs.h:968
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
Definition coeffs.h:889
int GFDegree
Definition coeffs.h:102
static FORCE_INLINE number mpz2number(mpz_t m, coeffs c)
Definition coeffs.h:994
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)
Definition coeffs.h:729
static FORCE_INLINE void n_WriteFd(number a, const ssiInfo *f, const coeffs r)
io via ssi:
Definition coeffs.h:972
n_coeffType
Definition coeffs.h:27
@ n_R
single prescision (6,6) real numbers
Definition coeffs.h:31
@ n_GF
\GF{p^n < 2^16}
Definition coeffs.h:32
@ n_Nemo_Field
Definition coeffs.h:54
@ n_FlintQrat
rational function field over Q
Definition coeffs.h:47
@ n_Nemo_AnticNumberField
Definition coeffs.h:49
@ n_polyExt
used to represent polys as coefficients
Definition coeffs.h:34
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
@ n_Nemo_QQField
Definition coeffs.h:50
@ n_Znm
only used if HAVE_RINGS is defined
Definition coeffs.h:45
@ n_Nemo_ZZRing
Definition coeffs.h:51
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition coeffs.h:35
@ n_Zn
only used if HAVE_RINGS is defined
Definition coeffs.h:44
@ n_long_R
real floating point (GMP) numbers
Definition coeffs.h:33
@ n_Z2m
only used if HAVE_RINGS is defined
Definition coeffs.h:46
@ n_Nemo_Ring
Definition coeffs.h:55
@ n_Zp
\F{p < 2^31}
Definition coeffs.h:29
@ n_CF
?
Definition coeffs.h:48
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition coeffs.h:38
@ n_unknown
Definition coeffs.h:28
@ n_Z
only used if HAVE_RINGS is defined
Definition coeffs.h:43
@ n_nTupel
n-tupel of cf: ZZ/p1,... ZZ/pn, R, long_R
Definition coeffs.h:42
@ n_Nemo_fqPolyRepField
Definition coeffs.h:53
@ n_long_C
complex floating point (GMP) numbers
Definition coeffs.h:41
@ n_Nemo_FqPolyRepField
Definition coeffs.h:52
static FORCE_INLINE number n_convFactoryNSingN(const CanonicalForm n, const coeffs r)
Definition coeffs.h:984
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition coeffs.h:667
static FORCE_INLINE BOOLEAN nCoeff_is_CF(const coeffs r)
Definition coeffs.h:895
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition coeffs.h:567
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition coeffs.h:521
void(* nCoeffsEnumeratorFunc)(ICoeffsEnumerator &numberCollectionEnumerator, number &output, const coeffs r)
goes over coeffs given by the ICoeffsEnumerator and changes them. Additionally returns a number;
Definition coeffs.h:89
static FORCE_INLINE number n_EucNorm(number a, const coeffs r)
Definition coeffs.h:678
short float_len2
additional char-flags, rInit
Definition coeffs.h:109
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
Definition coeffs.h:830
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition coeffs.h:684
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
Definition coeffs.h:625
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition coeffs.h:961
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition coeffs.h:500
static FORCE_INLINE BOOLEAN nCoeff_is_Domain(const coeffs r)
returns TRUE, if r is a field or r has no zero divisors (i.e is a domain)
Definition coeffs.h:736
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL
Definition coeffs.h:682
static FORCE_INLINE void n_MPZ(mpz_t result, number &n, const coeffs r)
conversion of n to a GMP integer; 0 if not possible
Definition coeffs.h:554
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition coeffs.h:478
static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r)
Definition coeffs.h:857
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
Definition numbers.cc:662
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:703
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition coeffs.h:560
static FORCE_INLINE void n_WriteLong(number n, const coeffs r)
write to the output buffer of the currently used reporter
Definition coeffs.h:586
const char * par_name
parameter name
Definition coeffs.h:110
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition coeffs.h:635
static FORCE_INLINE BOOLEAN nCoeff_has_simple_inverse(const coeffs r)
TRUE, if the computation of the inverse is fast, i.e. prefer leading coeff. 1 over content.
Definition coeffs.h:900
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition coeffs.h:759
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition coeffs.h:770
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition coeffs.h:618
static FORCE_INLINE CanonicalForm n_convSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
Definition coeffs.h:987
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
Definition coeffs.h:782
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition coeffs.h:804
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:412
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition coeffs.h:517
const unsigned short fftable[]
Definition ffields.cc:27
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
Definition coeffs.h:446
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:470
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition coeffs.h:573
static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
in Z: 1 in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that is co-prime with k i...
Definition coeffs.h:537
static FORCE_INLINE BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
TRUE if n_Delete is empty operation.
Definition coeffs.h:904
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition coeffs.h:658
static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &d, const coeffs r)
(inplace) Clears denominators on a collection of numbers number d is the LCM of all the coefficient d...
Definition coeffs.h:937
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Definition coeffs.h:732
static FORCE_INLINE BOOLEAN nCoeff_is_Q_or_BI(const coeffs r)
Definition coeffs.h:827
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition coeffs.h:756
number(* numberfunc)(number a, number b, const coeffs r)
Definition coeffs.h:77
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition coeffs.h:450
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition coeffs.h:439
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition coeffs.h:965
static FORCE_INLINE BOOLEAN nCoeff_is_Zn(const coeffs r)
Definition coeffs.h:824
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition coeffs.h:693
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
Definition coeffs.h:545
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition coeffs.h:766
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition coeffs.h:594
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition coeffs.h:794
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition coeffs.h:674
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition coeffs.h:883
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:541
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition coeffs.h:631
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Definition coeffs.h:930
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
Definition coeffs.h:726
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition coeffs.h:747
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition coeffs.h:908
static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
multiplication of 'a' and 'b'; replacement of 'a' by the product a*b
Definition coeffs.h:644
short float_len
additional char-flags, rInit
Definition coeffs.h:108
static FORCE_INLINE const char * n_Read(const char *s, number *a, const coeffs r)
!!! Recommendation: This method is too cryptic to be part of the user- !!! interface....
Definition coeffs.h:601
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition coeffs.h:466
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition coeffs.h:611
EXTERN_VAR omBin rnumber_bin
Definition coeffs.h:91
n_coeffRep
Definition coeffs.h:115
@ n_rep_gap_rat
(number), see longrat.h
Definition coeffs.h:118
@ n_rep_gap_gmp
(), see rinteger.h, new impl.
Definition coeffs.h:119
@ n_rep_float
(float), see shortfl.h
Definition coeffs.h:123
@ n_rep_int
(int), see modulop.h
Definition coeffs.h:117
@ n_rep_gmp_float
(gmp_float), see
Definition coeffs.h:124
@ n_rep_gmp
(mpz_ptr), see rmodulon,h
Definition coeffs.h:122
@ n_rep_poly
(poly), see algext.h
Definition coeffs.h:120
@ n_rep_gmp_complex
(gmp_complex), see gnumpc.h
Definition coeffs.h:125
@ n_rep_gf
(int), see ffields.h
Definition coeffs.h:126
@ n_rep_rat_fct
(fraction), see transext.h
Definition coeffs.h:121
@ n_rep_unknown
Definition coeffs.h:116
static FORCE_INLINE BOOLEAN n_DBTest(number n, const char *filename, const int linenumber, const coeffs r)
test whether n is a correct number; only used if LDEBUG is defined
Definition coeffs.h:712
static FORCE_INLINE void n_WriteShort(number n, const coeffs r)
write to the output buffer of the currently used reporter in a shortest possible way,...
Definition coeffs.h:591
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition coeffs.h:669
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
Definition coeffs.h:527
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition coeffs.h:785
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
Definition coeffs.h:834
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition coeffs.h:581
const char * GFPar_name
Definition coeffs.h:103
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
Definition coeffs.h:892
int GFChar
Definition coeffs.h:101
static FORCE_INLINE BOOLEAN nCoeff_is_Q_transExt(const coeffs r)
is it an trans. ext. of Q?
Definition coeffs.h:920
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:563
static FORCE_INLINE void n_InpAdd(number &a, number b, const coeffs r)
addition of 'a' and 'b'; replacement of 'a' by the sum a+b
Definition coeffs.h:649
static FORCE_INLINE BOOLEAN nCoeff_is_Zp_long(const coeffs r)
Definition coeffs.h:797
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition coeffs.h:474
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition coeffs.h:916
static FORCE_INLINE BOOLEAN nCoeff_is_Q_algExt(const coeffs r)
is it an alg. ext. of Q?
Definition coeffs.h:912
static FORCE_INLINE void n_WriteFd_S(number a, const coeffs r)
Definition coeffs.h:974
static FORCE_INLINE number n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
Definition coeffs.h:676
Creation data needed for finite fields.
Definition coeffs.h:100
return result
const CanonicalForm int s
Definition facAbsFact.cc:51
CanonicalForm res
Definition facAbsFact.cc:60
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
factory.h' is the user interface to Factory.
#define const
Definition fegetopt.c:39
#define EXTERN_VAR
Definition globaldefs.h:6
'SR_INT' is the type of those integers small enough to fit into 29 bits.
Definition longrat.h:49
void rem(unsigned long *a, unsigned long *q, unsigned long p, int &dega, int degq)
Definition minpoly.cc:572
#define assume(x)
Definition mod2.h:389
The main handler for Singular numbers which are suitable for Singular polynomials.
#define NULL
Definition omList.c:12
omBin_t * omBin
Definition omStructs.h:12
int(* siRandProc)(void)
Definition sirandom.h:9
number(* cfReadFd_S)(char **s, const coeffs r)
Definition coeffs.h:419
int ch
Definition coeffs.h:347
CanonicalForm(* convSingNFactoryN)(number n, BOOLEAN setChar, const coeffs r)
Definition coeffs.h:323
number(* cfInitMPZ)(mpz_t i, const coeffs r)
init with a GMP integer
Definition coeffs.h:188
number(* cfImPart)(number a, const coeffs r)
Definition coeffs.h:208
short float_len
Definition coeffs.h:359
number(* cfLcm)(number a, number b, const coeffs r)
Definition coeffs.h:277
int iNumberOfParameters
Number of Parameters in the coeffs (default 0).
Definition coeffs.h:326
int m_nfCharP
the characteristic: p
Definition coeffs.h:371
number(* cfSubringGcd)(number a, number b, const coeffs r)
Definition coeffs.h:254
BOOLEAN(* cfIsMOne)(number a, const coeffs r)
Definition coeffs.h:239
void(* cfWriteFd)(number a, const ssiInfo *f, const coeffs r)
Definition coeffs.h:284
BOOLEAN(* cfIsZero)(number a, const coeffs r)
Definition coeffs.h:235
number(* cfInvers)(number a, const coeffs r)
return 1/a
Definition coeffs.h:204
void(* cfMPZ)(mpz_t result, number &n, const coeffs r)
Converts a (integer) number n into a GMP number, 0 if impossible.
Definition coeffs.h:197
unsigned short * npInvTable
Definition coeffs.h:378
coeffs(* cfQuot1)(number c, const coeffs r)
Definition coeffs.h:414
BOOLEAN has_simple_Alloc
TRUE, if nDelete/nCopy are dummies.
Definition coeffs.h:141
mpz_ptr modNumber
Definition coeffs.h:411
int factoryVarOffset
how many variables of factory are already used by this coeff
Definition coeffs.h:137
number(* cfAnn)(number a, const coeffs r)
Definition coeffs.h:268
numberfunc cfSub
Definition coeffs.h:182
numberfunc cfDiv
Definition coeffs.h:182
number(* cfQuotRem)(number a, number b, number *rem, const coeffs r)
Definition coeffs.h:276
void * data
Definition coeffs.h:418
number(* cfParameter)(const int i, const coeffs r)
create i^th parameter or NULL if not possible
Definition coeffs.h:310
BOOLEAN(* cfIsUnit)(number a, const coeffs r)
Definition coeffs.h:385
number(* cfNormalizeHelper)(number a, number b, const coeffs r)
Definition coeffs.h:278
number(* cfRandom)(siRandProc p, number p1, number p2, const coeffs cf)
a function returning random elements
Definition coeffs.h:313
BOOLEAN(* cfDivBy)(number a, number b, const coeffs r)
test if b divides a cfDivBy(zero,b,r) is true, if b is a zero divisor
Definition coeffs.h:389
void(* cfCoeffWrite)(const coeffs r, BOOLEAN details)
output of coeff description via Print
Definition coeffs.h:155
number(* cfInpNeg)(number a, const coeffs r)
changes argument inline: a:= -a return -a! (no copy is returned) the result should be assigned to the...
Definition coeffs.h:202
number(* cfGcd)(number a, number b, const coeffs r)
Definition coeffs.h:253
n_coeffType type
Definition coeffs.h:135
void(* cfSetChar)(const coeffs r)
Definition coeffs.h:168
n_coeffRep rep
Definition coeffs.h:134
numberfunc cfAdd
Definition coeffs.h:182
nCoeffsEnumeratorFunc cfClearContent
function pointer behind n_ClearContent
Definition coeffs.h:316
int(* cfDivComp)(number a, number b, const coeffs r)
Definition coeffs.h:384
number(* cfReadFd)(const ssiInfo *f, const coeffs r)
Definition coeffs.h:285
number(* convFactoryNSingN)(const CanonicalForm n, const coeffs r)
conversion to CanonicalForm(factory) to number
Definition coeffs.h:322
BOOLEAN(* cfEqual)(number a, number b, const coeffs r)
tests
Definition coeffs.h:234
void(* cfWriteLong)(number a, const coeffs r)
print a given number (long format)
Definition coeffs.h:211
void(* cfDelete)(number *a, const coeffs r)
Definition coeffs.h:279
BOOLEAN(* nCoeffIsEqual)(const coeffs r, n_coeffType n, void *parameter)
Definition coeffs.h:152
nCoeffsEnumeratorFunc cfClearDenominators
function pointer behind n_ClearDenominators
Definition coeffs.h:319
numberfunc cfExactDiv
Definition coeffs.h:182
char const ** pParameterNames
array containing the names of Parameters (default NULL)
Definition coeffs.h:329
number(* cfEucNorm)(number a, const coeffs r)
Definition coeffs.h:265
BOOLEAN(* cfGreaterZero)(number a, const coeffs r)
Definition coeffs.h:244
void(* cfInpAdd)(number &a, number b, const coeffs r)
Inplace: a += b.
Definition coeffs.h:291
number(* cfExtGcd)(number a, number b, number *s, number *t, const coeffs r)
Definition coeffs.h:255
number(* cfFarey)(number p, number n, const coeffs)
rational reconstruction: "best" rational a/b with a/b = p mod n
Definition coeffs.h:298
int * m_nfMinPoly
Definition coeffs.h:374
unsigned long modExponent
Definition coeffs.h:410
mpz_ptr modBase
Definition coeffs.h:409
void(* cfWriteShort)(number a, const coeffs r)
print a given number in a shorter way, if possible e.g. in K(a): a2 instead of a^2
Definition coeffs.h:215
unsigned long mod2mMask
Definition coeffs.h:412
nMapFunc(* cfSetMap)(const coeffs src, const coeffs dst)
Definition coeffs.h:282
int(* cfParDeg)(number x, const coeffs r)
degree for coefficients: -1 for 0, 0 for "constants", ...
Definition coeffs.h:307
int m_nfM1
representation of -1
Definition coeffs.h:370
number(* cfInit)(long i, const coeffs r)
init with an integer
Definition coeffs.h:185
unsigned short * npExpTable
Definition coeffs.h:379
void(* cfInpMult)(number &a, number b, const coeffs r)
Inplace: a *= b.
Definition coeffs.h:288
void(* cfKillChar)(coeffs r)
Definition coeffs.h:166
BOOLEAN is_field
TRUE, if cf is a field.
Definition coeffs.h:147
ring extRing
Definition coeffs.h:341
coeffs next
Definition coeffs.h:132
long(* cfInt)(number &n, const coeffs r)
conversion to long, 0 if impossible
Definition coeffs.h:194
void(* cfPower)(number a, int i, number *result, const coeffs r)
Definition coeffs.h:246
number(* cfChineseRemainder)(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs)
chinese remainder returns X with X mod q[i]=x[i], i=0..rl-1
Definition coeffs.h:304
BOOLEAN(* cfGreater)(number a, number b, const coeffs r)
Definition coeffs.h:232
BOOLEAN(* cfDBTest)(number a, const char *f, const int l, const coeffs r)
Test: is "a" a correct number?
Definition coeffs.h:425
int m_nfCharQ
the number of elements: q
Definition coeffs.h:369
BOOLEAN has_simple_Inverse
TRUE, if std should make polynomials monic (if nInvers is cheap) if false, then a gcd routine is used...
Definition coeffs.h:144
number(* cfRePart)(number a, const coeffs r)
Definition coeffs.h:207
int ref
Definition coeffs.h:133
numberfunc cfMult
Definition coeffs.h:182
unsigned short * m_nfPlus1Table
Definition coeffs.h:373
int npPminus1M
characteristic - 1
Definition coeffs.h:382
unsigned short * npLogTable
Definition coeffs.h:380
number(* cfGetUnit)(number a, const coeffs r)
Definition coeffs.h:386
number(* cfCopy)(number a, const coeffs r)
return a copy of a
Definition coeffs.h:206
void(* cfNormalize)(number &a, const coeffs r)
Definition coeffs.h:230
numberfunc cfIntMod
Definition coeffs.h:182
number(* cfGetDenom)(number &n, const coeffs r)
Definition coeffs.h:247
short float_len2
Definition coeffs.h:360
BOOLEAN(* cfIsOne)(number a, const coeffs r)
Definition coeffs.h:236
number(* cfXExtGcd)(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
Definition coeffs.h:263
int m_nfCharQ1
q-1
Definition coeffs.h:372
number(* cfGetNumerator)(number &n, const coeffs r)
Definition coeffs.h:248
void(* cfWriteFd_S)(number a, const coeffs r)
Definition coeffs.h:420
int(* cfSize)(number n, const coeffs r)
how complicated, (0) => 0, or positive
Definition coeffs.h:191
BOOLEAN is_domain
TRUE, if cf is a domain.
Definition coeffs.h:149