19#include "factory/factory.h"
51extern const unsigned short fftable[];
86#define FREE_RNUMBER(x) omFreeBin((void *)x, rnumber_bin)
87#define ALLOC_RNUMBER() (number)omAllocBin(rnumber_bin)
88#define ALLOC0_RNUMBER() (number)omAlloc0Bin(rnumber_bin)
221 const char * (*cfRead)(
const char *
s, number * a,
const coeffs r);
700 return dst->cfSetMap(src,dst);
707{
assume(r !=
NULL);
assume(r->cfDBTest !=
NULL);
return r->cfDBTest(n, filename, linenumber, r); }
709#define n_Test(a,r) n_DBTest(a, __FILE__, __LINE__, r)
728{
assume(r !=
NULL);
return (r->is_field==0); }
730#define nCoeff_is_Ring_2toM(A) 0
731#define nCoeff_is_Ring_PtoM(A) 0
732#define nCoeff_is_Ring(A) 0
739 return (r->is_domain);
755 assume(r->cfDivBy!=
NULL);
return r->cfDivBy(a,
b,r);
762{
assume(r !=
NULL);
assume(r->cfChineseRemainder !=
NULL);
return r->cfChineseRemainder(a,
b,rl,sym,inv_cache,r); }
772{
assume(r !=
NULL);
return r->iNumberOfParameters; }
776{
assume(r !=
NULL);
return r->pParameterNames; }
784 return r->cfParameter(iParameter, r);
806 #if SI_INTEGER_VARIANT==1
816 #if SI_INTEGER_VARIANT==1
900{
assume(r !=
NULL);
return r->has_simple_Inverse; }
904{
assume(r !=
NULL);
return r->has_simple_Alloc; }
926{
assume(r !=
NULL); r->cfClearContent(numberCollectionEnumerator, c, r); }
933{
assume(r !=
NULL); r->cfClearDenominators(numberCollectionEnumerator, d, r); }
979{
assume(r !=
NULL);
assume(r->convSingNFactoryN !=
NULL);
return r->convSingNFactoryN(n, setChar, r); }
Abstract API for enumerators.
Templated enumerator interface for simple iteration over a generic collection of T's.
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
IEnumerator< number > ICoeffsEnumerator
Abstract interface for an enumerator of number coefficients for an object, e.g. a polynomial.
static FORCE_INLINE void number2mpz(number n, coeffs c, mpz_t m)
static FORCE_INLINE coeffs n_CoeffRingQuot1(number c, const coeffs r)
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....
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 ....
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
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,...
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
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)
static FORCE_INLINE number n_ReadFd(const ssiInfo *f, const coeffs r)
io via ssi:
static FORCE_INLINE BOOLEAN nCoeff_has_Units(const coeffs r)
returns TRUE, if r is not a field and r has non-trivial units
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
number ndCopyMap(number a, const coeffs src, const coeffs dst)
static FORCE_INLINE number n_Random(siRandProc p, number p1, number p2, const coeffs cf)
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
static FORCE_INLINE number mpz2number(mpz_t m, coeffs c)
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)
static FORCE_INLINE void n_WriteFd(number a, const ssiInfo *f, const coeffs r)
io via ssi:
@ n_R
single prescision (6,6) real numbers
@ n_FlintQrat
rational funtion field over Q
@ n_polyExt
used to represent polys as coeffcients
@ n_Q
rational (GMP) numbers
@ n_Znm
only used if HAVE_RINGS is defined
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
@ n_Zn
only used if HAVE_RINGS is defined
@ n_long_R
real floating point (GMP) numbers
@ n_Z2m
only used if HAVE_RINGS is defined
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
@ n_Z
only used if HAVE_RINGS is defined
@ n_nTupel
n-tupel of cf: ZZ/p1,... ZZ/pn, R, long_R
@ n_long_C
complex floating point (GMP) numbers
static FORCE_INLINE number n_convFactoryNSingN(const CanonicalForm n, const coeffs r)
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,...
static FORCE_INLINE BOOLEAN nCoeff_is_CF(const coeffs r)
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
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.
void(* nCoeffsEnumeratorFunc)(ICoeffsEnumerator &numberCollectionEnumerator, number &output, const coeffs r)
goes over coeffs given by the ICoeffsEnumerator and changes them. Additionally returns a number;
static FORCE_INLINE number n_EucNorm(number a, const coeffs r)
short float_len2
additional char-flags, rInit
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
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 ...
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
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),...
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)
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
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
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.
static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r)
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
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)
static FORCE_INLINE void n_WriteLong(number n, const coeffs r)
write to the output buffer of the currently used reporter
static FORCE_INLINE BOOLEAN nCoeff_is_Q_algext(const coeffs r)
is it an alg. ext. of Q?
const char * par_name
parameter name
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
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.
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
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...
static FORCE_INLINE CanonicalForm n_convSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
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...
const unsigned short fftable[]
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
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...
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...
static FORCE_INLINE BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
TRUE if n_Delete is empty operation.
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
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...
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Q_or_BI(const coeffs r)
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
number(* numberfunc)(number a, number b, const coeffs r)
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE char * nCoeffName(const coeffs cf)
static FORCE_INLINE BOOLEAN nCoeff_is_Zn(const coeffs r)
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,...
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
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...
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
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,...
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 ...
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
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:...
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
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
short float_len
additional char-flags, rInit
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....
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.
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)
EXTERN_VAR omBin rnumber_bin
@ n_rep_gap_rat
(number), see longrat.h
@ n_rep_gap_gmp
(), see rinteger.h, new impl.
@ n_rep_float
(float), see shortfl.h
@ n_rep_int
(int), see modulop.h
@ n_rep_gmp_float
(gmp_float), see
@ n_rep_gmp
(mpz_ptr), see rmodulon,h
@ n_rep_poly
(poly), see algext.h
@ n_rep_gmp_complex
(gmp_complex), see gnumpc.h
@ n_rep_gf
(int), see ffields.h
@ n_rep_rat_fct
(fraction), see transext.h
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
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,...
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
void nKillChar(coeffs r)
undo all initialisations
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
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
static FORCE_INLINE number n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
Creation data needed for finite fields.
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
'SR_INT' is the type of those integers small enough to fit into 29 bits.
void rem(unsigned long *a, unsigned long *q, unsigned long p, int °a, int degq)
The main handler for Singular numbers which are suitable for Singular polynomials.
BOOLEAN(* cfIsUnit)(number a, const coeffs r)
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
number(* cfNormalizeHelper)(number a, number b, const coeffs r)
int(* cfDivComp)(number a, number b, const coeffs r)
BOOLEAN(*)(*)(*)(*)(*)(*) cfGreaterZero(number a, const coeffs r)
number(* cfExtGcd)(number a, number b, number *s, number *t, const coeffs r)
number(* cfGetUnit)(number a, const coeffs r)
number(* cfLcm)(number a, number b, const coeffs r)
BOOLEAN is_domain
TRUE, if cf is a domain.
number(* cfGetNumerator)(number &n, const coeffs r)
number(* cfInvers)(number a, const coeffs r)
return 1/a
unsigned short * npExpTable
number(* cfInit)(long i, const coeffs r)
init with an integer
int iNumberOfParameters
Number of Parameters in the coeffs (default 0)
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...
number(* cfInitMPZ)(mpz_t i, const coeffs r)
init with a GMP integer
BOOLEAN is_field
TRUE, if cf is a field.
nMapFunc(* cfSetMap)(const coeffs src, const coeffs dst)
number(* cfParameter)(const int i, const coeffs r)
create i^th parameter or NULL if not possible
int m_nfM1
representation of -1
void(* cfSetChar)(const coeffs r)
number(* convFactoryNSingN)(const CanonicalForm n, const coeffs r)
conversion to CanonicalForm(factory) to number
number(* cfGcd)(number a, number b, const coeffs r)
number(* cfImPart)(number a, const coeffs r)
number(* cfFarey)(number p, number n, const coeffs)
rational reconstruction: "best" rational a/b with a/b = p mod n
unsigned short * npInvTable
number(* cfCopy)(number a, const coeffs r)
return a copy of a
BOOLEAN has_simple_Alloc
TRUE, if nDelete/nCopy are dummies.
BOOLEAN(*)(*)(*) cfIsZero(number a, const coeffs r)
void(* cfKillChar)(coeffs r)
BOOLEAN(*)(*) cfEqual(number a, number b, const coeffs r)
tests
void(* cfMPZ)(mpz_t result, number &n, const coeffs r)
Converts a (integer) number n into a GMP number, 0 if impossible.
unsigned long modExponent
int npPminus1M
characteristic - 1
BOOLEAN(* nCoeffIsEqual)(const coeffs r, n_coeffType n, void *parameter)
int factoryVarOffset
how many variables of factory are already used by this coeff
number(* cfXExtGcd)(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
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
number(* cfRePart)(number a, const coeffs r)
void(* cfNormalize)(number &a, const coeffs r)
int m_nfCharP
the characteristic: p
number(* cfGetDenom)(number &n, const coeffs r)
void(* cfWriteLong)(number a, const coeffs r)
print a given number (long format)
unsigned short * npLogTable
number(* cfSubringGcd)(number a, number b, const coeffs r)
BOOLEAN(*)(*)(*)(*) cfIsOne(number a, const coeffs r)
number(* cfEucNorm)(number a, const coeffs r)
number(* cfAnn)(number a, const coeffs r)
number(* cfReadFd)(const ssiInfo *f, const coeffs r)
void(* cfPower)(number a, int i, number *result, const coeffs r)
CanonicalForm(* convSingNFactoryN)(number n, BOOLEAN setChar, const coeffs r)
long(* cfInt)(number &n, const coeffs r)
convertion to long, 0 if impossible
BOOLEAN(* cfGreater)(number a, number b, const coeffs r)
number(* cfQuotRem)(number a, number b, number *rem, const coeffs r)
void(* cfCoeffWrite)(const coeffs r, BOOLEAN details)
output of coeff description via Print
void(* cfDelete)(number *a, const coeffs r)
unsigned short * m_nfPlus1Table
BOOLEAN has_simple_Inverse
TRUE, if std should make polynomials monic (if nInvers is cheap) if false, then a gcd routine is used...
BOOLEAN(* cfDBTest)(number a, const char *f, const int l, const coeffs r)
Test: is "a" a correct number?
void(* cfWriteFd)(number a, const ssiInfo *f, const coeffs r)
number(* cfRandom)(siRandProc p, number p1, number p2, const coeffs cf)
a function returning random elements
int m_nfCharQ
the number of elements: q
BOOLEAN(*)(*)(*)(*)(*) cfIsMOne(number a, const coeffs r)
char const ** pParameterNames
array containing the names of Parameters (default NULL)
int(* cfParDeg)(number x, const coeffs r)
degree for coeffcients: -1 for 0, 0 for "constants", ...
void(* cfInpMult)(number &a, number b, const coeffs r)
Inplace: a *= b.
coeffs(* cfQuot1)(number c, const coeffs r)
int(* cfSize)(number n, const coeffs r)
how complicated, (0) => 0, or positive
void(* cfInpAdd)(number &a, number b, const coeffs r)
Inplace: a += b.
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
nCoeffsEnumeratorFunc cfClearContent
function pointer behind n_ClearContent
nCoeffsEnumeratorFunc cfClearDenominators
function pointer behind n_ClearDenominators