 |
My Project
debian-1:4.1.2-p1+ds-2
|
Go to the source code of this file.
|
struct | number |
| 'SR_INT' is the type of those integers small enough to fit into 29 bits. More...
|
|
|
number | nlGetDenom (number &n, const coeffs r) |
|
number | nlGetNumerator (number &n, const coeffs r) |
|
BOOLEAN | nlInitChar (coeffs, void *) |
|
static FORCE_INLINE int | nlQlogSize (number n, const coeffs r) |
| only used by slimgb (tgb.cc) More...
|
|
static FORCE_INLINE BOOLEAN | nlIsInteger (number q, const coeffs r) |
|
number | nlModP (number q, const coeffs Q, const coeffs Zp) |
|
void | nlNormalize (number &x, const coeffs r) |
|
void | nlInpGcd (number &a, number b, const coeffs r) |
|
void | nlDelete (number *a, const coeffs r) |
|
number | nlInit2 (int i, int j, const coeffs r) |
| create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode More...
|
|
number | nlInit2gmp (mpz_t i, mpz_t j, const coeffs r) |
| create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode More...
|
|
void | nlGMP (number &i, mpz_t n, const coeffs r) |
|
number | nlMapGMP (number from, const coeffs src, const coeffs dst) |
|
number | nlChineseRemainderSym (number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs CF) |
|
◆ snumber
'SR_INT' is the type of those integers small enough to fit into 29 bits.
Therefor the value range of this small integers is: $-2^{28}...2^{28}-1$.
Small integers are represented by an immediate integer handle, containing the value instead of pointing to it, which has the following form:
+-------+-------+-------+-------+- - - -+-------+-------+-------+
| guard | sign | bit | bit | | bit | tag | tag |
| bit | bit | 27 | 26 | | 0 | 0 | 1 |
+-------+-------+-------+-------+- - - -+-------+-------+-------+
Immediate integers handles carry the tag 'SR_INT', i.e. the last bit is 1. This distuingishes immediate integers from other handles which point to structures aligned on 4 byte boundaries and therefor have last bit zero. (The second bit is reserved as tag to allow extensions of this scheme.) Using immediates as pointers and dereferencing them gives address errors.
To aid overflow check the most significant two bits must always be equal, that is to say that the sign bit of immediate integers has a guard bit.
The macros 'INT_TO_SR' and 'SR_TO_INT' should be used to convert between a small integer value and its representation as immediate integer handle.
Large integers and rationals are represented by z and n where n may be undefined (if s==3) NULL represents only deleted values
Definition at line 46 of file longrat.h.
Data Fields |
int |
debug |
|
mpz_t |
n |
|
BOOLEAN |
s |
parameter s in number: 0 (or FALSE): not normalised rational 1 (or TRUE): normalised rational 3 : integer with n==NULL |
mpz_t |
z |
|
◆ INT_TO_SR
#define INT_TO_SR |
( |
|
INT | ) |
((number) (((long)INT << 2) + SR_INT)) |
◆ MP_SMALL
◆ SR_HDL
#define SR_HDL |
( |
|
A | ) |
((long)(A)) |
◆ SR_INT
◆ SR_TO_INT
#define SR_TO_INT |
( |
|
SR | ) |
(((long)SR) >> 2) |
◆ nlChineseRemainderSym()
Definition at line 2934 of file longrat.cc.
2945 for(
i=rl-1;
i>=0;
i--)
2947 X[
i]=CF->convSingNFactoryN(
x[
i],
FALSE,CF);
2948 Q[
i]=CF->convSingNFactoryN(q[
i],
FALSE,CF);
2955 number n=CF->convFactoryNSingN(xnew,CF);
2958 number
p=CF->convFactoryNSingN(qnew,CF);
2961 else p2=CF->cfDiv(
p,CF->cfInit(2, CF),CF);
2962 if (CF->cfGreater(n,p2,CF))
2964 number n2=CF->cfSub(n,
p,CF);
2965 CF->cfDelete(&n,CF);
2968 CF->cfDelete(&p2,CF);
2969 CF->cfDelete(&
p,CF);
◆ nlDelete()
◆ nlGetDenom()
Definition at line 1496 of file longrat.cc.
1515 mpz_init_set(u->z,n->n);
◆ nlGetNumerator()
Definition at line 1525 of file longrat.cc.
1542 mpz_init_set(u->z,n->z);
◆ nlGMP()
Definition at line 1475 of file longrat.cc.
1489 WarnS(
"Omitted denominator during coefficient mapping !");
◆ nlInit2()
create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode
Definition at line 2372 of file longrat.cc.
2381 mpz_init_set_si(z->z,(
long)
i);
2382 mpz_init_set_si(z->n,(
long)
j);
◆ nlInit2gmp()
create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode
Definition at line 2385 of file longrat.cc.
2394 mpz_init_set(z->z,
i);
2395 mpz_init_set(z->n,
j);
◆ nlInitChar()
◆ nlInpGcd()
◆ nlIsInteger()
Definition at line 92 of file longrat.h.
101 return ( q->s == 3 );
◆ nlMapGMP()
Definition at line 198 of file longrat.cc.
206 mpz_init_set(z->z,(mpz_ptr) from);
◆ nlModP()
Definition at line 1433 of file longrat.cc.
1451 const unsigned long PP =
p;
1454 number z =
n_Init( static_cast<long>(mpz_fdiv_ui(q->z, PP)), Zp );
1460 number n =
n_Init( static_cast<long>(mpz_fdiv_ui(q->n, PP)), Zp );
◆ nlNormalize()
Definition at line 1342 of file longrat.cc.
1356 if (mpz_cmp_si(
x->n,1L)==0)
1366 mpz_gcd(
gcd,
x->z,
x->n);
1368 if (mpz_cmp_si(
gcd,1L)!=0)
1370 mpz_divexact(
x->z,
x->z,
gcd);
1371 mpz_divexact(
x->n,
x->n,
gcd);
1372 if (mpz_cmp_si(
x->n,1L)==0)
◆ nlQlogSize()
only used by slimgb (tgb.cc)
Definition at line 74 of file longrat.h.
89 return mpz_sizeinbase (nn->z, 2);
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static number nlLcm(number a, number b, const coeffs r)
BOOLEAN nlIsUnit(number a, const coeffs)
LINLINE BOOLEAN nlIsZero(number za, const coeffs r)
static const int SW_RATIONAL
set to 1 for computations over Q
coeffs nlQuot1(number c, const coeffs r)
LINLINE void nlInpMult(number &a, number b, const coeffs r)
nMapFunc nlSetMap(const coeffs src, const coeffs dst)
long nlInt(number &n, const coeffs r)
number nlExtGcd(number a, number b, number *s, number *t, const coeffs)
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
LINLINE BOOLEAN nlIsOne(number a, const coeffs r)
number nlChineseRemainderSym(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs CF)
LINLINE number nlCopy(number a, const coeffs r)
BOOLEAN nlIsMOne(number a, const coeffs r)
char * nlCoeffName(const coeffs r)
void nlCoeffWrite(const coeffs r, BOOLEAN details)
static int SI_LOG2(int v)
void _nlDelete_NoImm(number *a)
int nlDivComp(number a, number b, const coeffs r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
BOOLEAN nlDivBy(number a, number b, const coeffs)
LINLINE void nlInpAdd(number &a, number b, const coeffs r)
LINLINE number nlInit(long i, const coeffs r)
LINLINE number nlSub(number la, number li, const coeffs r)
BOOLEAN nlDBTest(number a, const char *f, const int l)
int nlSize(number a, const coeffs)
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
LINLINE BOOLEAN nlEqual(number a, number b, const coeffs r)
static number nlRandom(siRandProc p, number v2, number, const coeffs cf)
void nlPower(number x, int exp, number *lu, const coeffs r)
static void nlClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
void nlWriteFd(number n, const ssiInfo *d, const coeffs)
static void nlClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
void nlWrite(number a, const coeffs r)
number nlXExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
number nlGetUnit(number n, const coeffs cf)
number nlNormalizeHelper(number a, number b, const coeffs r)
static number nlConvFactoryNSingN(const CanonicalForm f, const coeffs r)
static void nlMPZ(mpz_t m, number &n, const coeffs r)
number nlGcd(number a, number b, const coeffs r)
static CanonicalForm nlConvSingNFactoryN(number n, const BOOLEAN setChar, const coeffs)
static number nlInitMPZ(mpz_t m, const coeffs)
void nlNormalize(number &x, const coeffs r)
void chineseRemainderCached(CFArray &a, CFArray &n, CanonicalForm &xnew, CanonicalForm &prod, CFArray &inv)
number nlGetNumerator(number &n, const coeffs r)
void chineseRemainder(const CanonicalForm &x1, const CanonicalForm &q1, const CanonicalForm &x2, const CanonicalForm &q2, CanonicalForm &xnew, CanonicalForm &qnew)
void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2,...
number nlGetDenom(number &n, 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
number nlQuotRem(number a, number b, number *r, const coeffs R)
BOOLEAN nlGreaterZero(number za, const coeffs r)
number nlIntMod(number a, number b, const coeffs r)
number nlDiv(number a, number b, const coeffs r)
LINLINE number nlAdd(number la, number li, const coeffs r)
number nlInvers(number a, const coeffs r)
static number nlShort3(number x)
number nlFarey(number nN, number nP, const coeffs CF)
const char * nlRead(const char *s, number *a, const coeffs r)
number nlIntDiv(number a, number b, const coeffs r)
number nlShort3_noinline(number x)
const Variable & v
< [in] a sqrfree bivariate poly
LINLINE number nlMult(number a, number b, const coeffs r)
LINLINE number nlNeg(number za, 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...
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
LINLINE void nlDelete(number *a, const coeffs r)
number nlExactDiv(number a, number b, const coeffs r)
BOOLEAN nlCoeffIsEqual(const coeffs r, n_coeffType n, void *p)
BOOLEAN nlGreater(number a, number b, const coeffs r)
number nlReadFd(const ssiInfo *d, const coeffs)
static char * nlCoeffString(const coeffs r)