 |
My Project
UNKNOWN_GIT_VERSION
|
Go to the source code of this file.
|
void | nNew (number *d) |
|
static void | ndDelete (number *d, const coeffs) |
|
static number | ndAnn (number, const coeffs) |
|
static char * | ndCoeffString (const coeffs r) |
|
static char * | ndCoeffName (const coeffs r) |
|
static void | ndInpMult (number &a, number b, const coeffs r) |
|
static void | ndInpAdd (number &a, number b, const coeffs r) |
|
static void | ndPower (number a, int i, number *res, const coeffs r) |
|
static number | ndInvers (number a, const coeffs r) |
|
static BOOLEAN | ndIsUnit (number a, const coeffs r) |
|
static BOOLEAN | ndDBTest (number, const char *, const int, const coeffs) |
|
static number | ndFarey (number, number, const coeffs r) |
|
static number | ndChineseRemainder (number *, number *, int, BOOLEAN, CFArray &, const coeffs r) |
|
static int | ndParDeg (number n, const coeffs r) |
|
static number | ndParameter (const int, const coeffs r) |
|
BOOLEAN | n_IsZeroDivisor (number a, const coeffs r) |
| Test whether a is a zero divisor in r i.e. not coprime with char. of r very inefficient implementation: should ONLY be used for debug stuff /tests. More...
|
|
static void | ndNormalize (number &, const coeffs) |
|
static number | ndReturn0 (number, const coeffs r) |
|
number | ndGcd (number, number, const coeffs r) |
|
static number | ndIntMod (number, number, const coeffs r) |
|
static number | ndGetDenom (number &, const coeffs r) |
|
static number | ndGetNumerator (number &a, const coeffs r) |
|
static int | ndSize (number a, const coeffs r) |
|
static void | ndClearContent (ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r) |
|
static void | ndClearDenominators (ICoeffsEnumerator &, number &d, const coeffs r) |
|
static number | ndCopy (number a, const coeffs) |
|
number | ndCopyMap (number a, const coeffs aRing, const coeffs r) |
|
static void | ndKillChar (coeffs) |
|
static void | ndSetChar (const coeffs) |
|
number | nd_Copy (number a, const coeffs r) |
|
static BOOLEAN | ndDivBy (number, number, const coeffs) |
|
static int | ndDivComp (number, number, const coeffs) |
|
static number | ndExtGcd (number, number, number *, number *, const coeffs r) |
|
CanonicalForm | ndConvSingNFactoryN (number, BOOLEAN, const coeffs) |
|
static number | ndConvFactoryNSingN (const CanonicalForm, const coeffs) |
| [in, out] a bigint number >= 0
More...
|
|
static void | ndMPZ (mpz_t result, number &n, const coeffs r) |
| Converts a non-negative bigint number into a GMP number. More...
|
|
static number | ndInitMPZ (mpz_t m, const coeffs r) |
|
static BOOLEAN | ndCoeffIsEqual (const coeffs r, n_coeffType n, void *) |
|
static number | ndQuotRem (number a, number b, number *r, const coeffs R) |
|
coeffs | nInitChar (n_coeffType t, void *parameter) |
| one-time initialisations for new coeffs in case of an error return NULL More...
|
|
void | nKillChar (coeffs r) |
| undo all initialisations More...
|
|
n_coeffType | nRegister (n_coeffType n, cfInitCharProc p) |
|
void | nRegisterCfByName (cfInitCfByNameProc p, n_coeffType n) |
|
coeffs | nFindCoeffByName (char *cf_name) |
| find an existing coeff by its "CoeffName" More...
|
|
void | n_Print (number &a, const coeffs r) |
| print a number (BEWARE of string buffers!) mostly for debugging More...
|
|
number | n_convFactoryNSingN (const CanonicalForm n, const coeffs r) |
|
CanonicalForm | n_convSingNFactoryN (number n, BOOLEAN setChar, const coeffs r) |
|
char * | nEati (char *s, int *i, int m) |
| divide by the first (leading) number and return it, i.e. make monic More...
|
|
char * | nEatLong (char *s, mpz_ptr i) |
| extracts a long integer from s, returns the rest More...
|
|
◆ nFindCoeffByName_s
struct nFindCoeffByName_s |
◆ n_convFactoryNSingN()
◆ n_convSingNFactoryN()
◆ n_IsZeroDivisor()
Test whether a is a zero divisor in r i.e. not coprime with char. of r very inefficient implementation: should ONLY be used for debug stuff /tests.
Definition at line 146 of file numbers.cc.
150 if (ret || (c==0) || (r->is_field))
152 number ch =
n_Init( c, r );
153 number
g =
n_Gcd( ch, a, r );
◆ n_Print()
print a number (BEWARE of string buffers!) mostly for debugging
Definition at line 611 of file numbers.cc.
◆ nd_Copy()
Definition at line 265 of file numbers.cc.
265 {
return r->cfCopy(a, r); }
◆ ndAnn()
static number ndAnn |
( |
number |
, |
|
|
const |
coeffs |
|
) |
| |
|
static |
◆ ndChineseRemainder()
Definition at line 129 of file numbers.cc.
131 Werror(
"ChineseRemainder not implemented for %s (c=%d)",r->cfCoeffString(r),
getCoeffType(r));
132 return r->cfInit(0,r);
◆ ndClearContent()
TODO: move to a separate implementation
Definition at line 168 of file numbers.cc.
176 numberCollectionEnumerator.
Reset();
178 if( !numberCollectionEnumerator.
MoveNext() )
184 number &curr = numberCollectionEnumerator.
Current();
200 while( numberCollectionEnumerator.
MoveNext() )
202 number &n = numberCollectionEnumerator.
Current();
228 while( numberCollectionEnumerator.
MoveNext() )
230 number &n = numberCollectionEnumerator.
Current();
◆ ndClearDenominators()
◆ ndCoeffIsEqual()
◆ ndCoeffName()
Definition at line 61 of file numbers.cc.
64 snprintf(
s,11,
"Coeffs(%d)",r->type);
◆ ndCoeffString()
Definition at line 56 of file numbers.cc.
58 char *
s=(
char *)
omAlloc(11);snprintf(
s,11,
"Coeffs(%d)",r->type);
◆ ndConvFactoryNSingN()
static number ndConvFactoryNSingN |
( |
const |
CanonicalForm, |
|
|
const |
coeffs |
|
) |
| |
|
static |
[in, out] a bigint number >= 0
[out] the GMP equivalent
Definition at line 280 of file numbers.cc.
◆ ndConvSingNFactoryN()
◆ ndCopy()
static number ndCopy |
( |
number |
a, |
|
|
const |
coeffs |
|
) |
| |
|
static |
◆ ndCopyMap()
Definition at line 252 of file numbers.cc.
255 assume(aRing->rep==r->rep);
259 return r->cfCopy(a, r);
◆ ndDBTest()
◆ ndDelete()
static void ndDelete |
( |
number * |
d, |
|
|
const |
coeffs |
|
) |
| |
|
static |
◆ ndDivBy()
◆ ndDivComp()
static int ndDivComp |
( |
number |
, |
|
|
number |
, |
|
|
const |
coeffs |
|
) |
| |
|
static |
◆ ndExtGcd()
static number ndExtGcd |
( |
number |
, |
|
|
number |
, |
|
|
number * |
, |
|
|
number * |
, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 270 of file numbers.cc.
270 {
return r->cfInit(1,r); }
◆ ndFarey()
static number ndFarey |
( |
number |
, |
|
|
number |
, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
◆ ndGcd()
Definition at line 162 of file numbers.cc.
162 {
return r->cfInit(1,r); }
◆ ndGetDenom()
Definition at line 164 of file numbers.cc.
164 {
return r->cfInit(1,r); }
◆ ndGetNumerator()
static number ndGetNumerator |
( |
number & |
a, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 165 of file numbers.cc.
165 {
return r->cfCopy(a,r); }
◆ ndInitMPZ()
Definition at line 293 of file numbers.cc.
296 return r->cfInit( mpz_get_si(
m), r);
◆ ndInpAdd()
static void ndInpAdd |
( |
number & |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 73 of file numbers.cc.
75 number n=r->cfAdd(a,
b,r);
◆ ndInpMult()
static void ndInpMult |
( |
number & |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 67 of file numbers.cc.
69 number n=r->cfMult(a,
b,r);
◆ ndIntMod()
static number ndIntMod |
( |
number |
, |
|
|
number |
, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 163 of file numbers.cc.
163 {
return r->cfInit(0,r); }
◆ ndInvers()
Definition at line 110 of file numbers.cc.
112 number one=r->cfInit(1,r);
113 number
res=r->cfDiv(one,a,r);
◆ ndIsUnit()
Definition at line 118 of file numbers.cc.
118 {
return !r->cfIsZero(a,r); }
◆ ndKillChar()
static void ndKillChar |
( |
coeffs |
| ) |
|
|
static |
◆ ndMPZ()
static void ndMPZ |
( |
mpz_t |
result, |
|
|
number & |
n, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Converts a non-negative bigint number into a GMP number.
Definition at line 288 of file numbers.cc.
291 mpz_init_set_si(
result, r->cfInt(n, r) );
◆ ndNormalize()
static void ndNormalize |
( |
number & |
, |
|
|
const |
coeffs |
|
) |
| |
|
static |
◆ ndParameter()
◆ ndParDeg()
Definition at line 135 of file numbers.cc.
137 return (-r->cfIsZero(n,r));
◆ ndPower()
static void ndPower |
( |
number |
a, |
|
|
int |
i, |
|
|
number * |
res, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 80 of file numbers.cc.
84 *
res = r->cfInit(1, r);
88 *
res = r->cfCopy(a, r);
92 *
res = r->cfMult(a, a, r);
96 number
b = r->cfInvers(a, r);
103 r->cfInpMult(*
res, *
res, r);
106 r->cfInpMult(*
res, a, r);
◆ ndQuotRem()
static number ndQuotRem |
( |
number |
a, |
|
|
number |
b, |
|
|
number * |
r, |
|
|
const coeffs |
R |
|
) |
| |
|
static |
◆ ndReturn0()
Definition at line 161 of file numbers.cc.
161 {
return r->cfInit(0,r); }
◆ ndSetChar()
static void ndSetChar |
( |
const |
coeffs | ) |
|
|
static |
◆ ndSize()
◆ nEati()
char* nEati |
( |
char * |
s, |
|
|
int * |
i, |
|
|
int |
m |
|
) |
| |
divide by the first (leading) number and return it, i.e. make monic
does nothing (just returns a dummy one number) helper routine: read an int from a string (mod m), return a pointer to the rest
Definition at line 631 of file numbers.cc.
635 if (((*
s) >=
'0') && ((*
s) <=
'9'))
644 while (((*
s) >=
'0') && ((*
s) <=
'9'));
645 if ((
m!=0) && (ii>=
m)) ii=ii%
m;
◆ nEatLong()
char* nEatLong |
( |
char * |
s, |
|
|
mpz_ptr |
i |
|
) |
| |
extracts a long integer from s, returns the rest
Definition at line 652 of file numbers.cc.
655 const char * start=
s;
657 while (*
s >=
'0' && *
s <=
'9')
s++;
660 mpz_set_str(
i,start,10);
666 mpz_set_str(
i,start,10);
◆ nFindCoeffByName()
coeffs nFindCoeffByName |
( |
char * |
cf_name | ) |
|
find an existing coeff by its "CoeffName"
Definition at line 589 of file numbers.cc.
597 && (strcmp(cf_name,n->
cfCoeffName(n))==0))
return n;
◆ nInitChar()
one-time initialisations for new coeffs in case of an error return NULL
Definition at line 350 of file numbers.cc.
422 Werror(
"Sorry: the coeff type [%d] was not registered: it is missing in nInitCharTable", (
int)t);
◆ nKillChar()
undo all initialisations
Definition at line 511 of file numbers.cc.
528 assume (r->cfKillChar!=
NULL); r->cfKillChar(r);
534 WarnS(
"cf_root list destroyed");
◆ nNew()
◆ nRegister()
◆ nRegisterCfByName()
◆ cf_root
◆ nFindCoeffByName_Root
nFindCoeffByName_p nFindCoeffByName_Root =NULL |
◆ nInitCharTable
◆ nInitCharTableDefault
◆ nLastCoeffs
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
void(* cfInpMult)(number &a, number b, const coeffs r)
Inplace: a *= b.
CanonicalForm(* convSingNFactoryN)(number n, BOOLEAN setChar, const coeffs r)
int(* cfSize)(number n, const coeffs r)
how complicated, (0) => 0, or positive
static void ndClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
number(* cfGcd)(number a, number b, const coeffs r)
int(* cfDivComp)(number a, number b, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
static void ndClearDenominators(ICoeffsEnumerator &, number &d, const coeffs r)
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...
static BOOLEAN ndDivBy(number, number, const coeffs)
static number ndConvFactoryNSingN(const CanonicalForm, const coeffs)
[in, out] a bigint number >= 0
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
number(* cfGetDenom)(number &n, const coeffs r)
int iNumberOfParameters
Number of Parameters in the coeffs (default 0)
virtual reference Current()=0
Gets the current element in the collection (read and write).
static void ndSetChar(const coeffs)
int(* cfParDeg)(number x, const coeffs r)
degree for coeffcients: -1 for 0, 0 for "constants", ...
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
static BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void *)
char *(* cfCoeffName)(const coeffs r)
default name of cf, should substitue cfCoeffWrite, cfCoeffString
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
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
static number ndReturn0(number, const coeffs r)
static BOOLEAN ndIsUnit(number a, const coeffs r)
static char * ndCoeffString(const coeffs r)
void(* cfCoeffWrite)(const coeffs r, BOOLEAN details)
output of coeff description via Print
static int ndParDeg(number n, const coeffs r)
static number ndParameter(const int, const coeffs r)
static number ndIntMod(number, number, const coeffs r)
number(* cfRePart)(number a, const coeffs r)
BOOLEAN(* cfDBTest)(number a, const char *f, const int l, const coeffs r)
Test: is "a" a correct number?
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static number ndQuotRem(number a, number b, number *r, const coeffs R)
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
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...
BOOLEAN(* cfGreater)(number a, number b, const coeffs r)
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
number(* cfInit)(long i, const coeffs r)
init with an integer
static number ndGetDenom(number &, const coeffs r)
virtual void Reset()=0
Sets the enumerator to its initial position: -1, which is before the first element in the collection.
void(* cfDelete)(number *a, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
static void ndInpMult(number &a, number b, const coeffs r)
static int ndDivComp(number, number, const coeffs)
CanonicalForm n_convSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
void(* cfPower)(number a, int i, number *result, const coeffs r)
const char *(* cfRead)(const char *s, number *a, const coeffs r)
cfInitCharProc nInitCharTableDefault[]
static number ndInitMPZ(mpz_t m, const coeffs r)
long(* cfInt)(number &n, const coeffs r)
convertion to long, 0 if impossible
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
number(* cfGetUnit)(number a, const coeffs r)
void(* cfMPZ)(mpz_t result, number &n, const coeffs r)
Converts a non-negative number n into a GMP number, 0 if impossible.
#define omFreeSize(addr, size)
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
number(* cfGetNumerator)(number &n, const coeffs r)
BOOLEAN(*)(*)(*) cfIsZero(number a, const coeffs r)
nCoeffsEnumeratorFunc cfClearDenominators
function pointer behind n_ClearDenominators
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
static char * ndCoeffName(const coeffs r)
void(* cfInpAdd)(number &a, number b, const coeffs r)
Inplace: a += b.
number(* cfInvers)(number a, const coeffs r)
return 1/a
number(* cfInitMPZ)(mpz_t i, const coeffs r)
init with a GMP integer
void(* cfWriteLong)(number a, const coeffs r)
print a given number (long format)
BOOLEAN(* cfInitCharProc)(coeffs, void *)
initialize an object of type coeff, return FALSE in case of success
number ndGcd(number, number, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
TRUE if n_Delete/n_New are empty operations.
static number ndAnn(number, const coeffs)
BOOLEAN(*)(*)(*)(*)(*)(*) cfGreaterZero(number a, const coeffs r)
number(* cfSubringGcd)(number a, number b, const coeffs r)
nMapFunc(* cfSetMap)(const coeffs src, const coeffs dst)
number(* cfCopy)(number a, const coeffs r)
return a copy of a
number(* cfImPart)(number 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 void ndKillChar(coeffs)
const char ** pParameterNames
array containing the names of Parameters (default NULL)
char *(* cfCoeffString)(const coeffs r)
string output of coeff description
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
number(* cfQuotRem)(number a, number b, number *rem, const coeffs r)
void(* cfSetChar)(const coeffs r)
static number ndCopy(number a, const coeffs)
static void ndDelete(number *d, const coeffs)
static FORCE_INLINE BOOLEAN nCoeff_has_Units(const coeffs r)
returns TRUE, if r is not a field and r has non-trivial units
number n_convFactoryNSingN(const CanonicalForm n, const coeffs r)
nCoeffsEnumeratorFunc cfClearContent
function pointer behind n_ClearContent
BOOLEAN(*)(*) cfEqual(number a, number b, const coeffs r)
tests
static number ndInvers(number a, const coeffs r)
number(* cfNormalizeHelper)(number a, number b, const coeffs r)
virtual bool MoveNext()=0
Advances the enumerator to the next element of the collection. returns true if the enumerator was suc...
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
void StringSetS(const char *st)
static void ndNormalize(number &, const coeffs)
BOOLEAN(*)(*)(*)(*) cfIsOne(number a, const coeffs r)
number(* cfAnn)(number a, const coeffs r)
void Werror(const char *fmt,...)
void(* cfNormalize)(number &a, const coeffs r)
number(* cfExtGcd)(number a, number b, number *s, number *t, const coeffs r)
static int ndSize(number a, const coeffs r)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
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,...
void WerrorS(const char *s)
BOOLEAN(* cfIsUnit)(number a, const coeffs r)
nFindCoeffByName_p nFindCoeffByName_Root
number(* cfParameter)(const int i, const coeffs r)
create i^th parameter or NULL if not possible
void nKillChar(coeffs r)
undo all initialisations
static void ndPower(number a, int i, number *res, const coeffs r)
number(* cfFarey)(number p, number n, const coeffs)
rational reconstruction: "best" rational a/b with a/b = p mod n
static void ndInpAdd(number &a, number b, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Q_algext(const coeffs r)
is it an alg. ext. of Q?
number(* cfLcm)(number a, number b, const coeffs r)
void(* cfKillChar)(coeffs r)
number(* convFactoryNSingN)(const CanonicalForm n, const coeffs r)
conversion to CanonicalForm(factory) to number
const CanonicalForm int s
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
static cfInitCharProc * nInitCharTable
static number ndExtGcd(number, number, number *, number *, const coeffs r)
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 number ndFarey(number, number, const coeffs r)
static number ndChineseRemainder(number *, number *, int, BOOLEAN, CFArray &, const coeffs r)
BOOLEAN(* cfDivBy)(number a, number b, const coeffs r)
#define n_Test(a, r)
BOOLEAN n_Test(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
BOOLEAN(* nCoeffIsEqual)(const coeffs r, n_coeffType n, void *parameter)
static number ndGetNumerator(number &a, const coeffs r)
static BOOLEAN ndDBTest(number, const char *, const int, const coeffs)
static n_coeffType nLastCoeffs
BOOLEAN(*)(*)(*)(*)(*) cfIsMOne(number a, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r)
static void ndMPZ(mpz_t result, number &n, const coeffs r)
Converts a non-negative bigint number into a GMP number.
#define omReallocSize(addr, o_size, size)