 |
My Project
debian-1:4.1.2-p1+ds-2
|
Go to the source code of this file.
|
#define | nr2mNegM(A, r) (number)((r->mod2mMask+1 - (unsigned long)(A)) & r->mod2mMask) |
|
#define | nr2mEqualM(A, B) ((A)==(B)) |
|
|
BOOLEAN | nr2mDBTest (number a, const char *f, const int l, const coeffs r) |
|
static number | nr2mMultM (number a, number b, const coeffs r) |
|
static number | nr2mAddM (number a, number b, const coeffs r) |
|
static number | nr2mSubM (number a, number b, const coeffs r) |
|
static char * | nr2mCoeffName (const coeffs cf) |
|
static void | nr2mCoeffWrite (const coeffs r, BOOLEAN) |
|
static BOOLEAN | nr2mCoeffIsEqual (const coeffs r, n_coeffType n, void *p) |
|
static char * | nr2mCoeffString (const coeffs r) |
|
static coeffs | nr2mQuot1 (number c, const coeffs r) |
|
static BOOLEAN | nr2mGreaterZero (number k, const coeffs r) |
|
static number | nr2mMult (number a, number b, const coeffs r) |
|
static number | nr2mAnn (number b, const coeffs r) |
|
static number | nr2mLcm (number a, number b, const coeffs) |
|
static number | nr2mGcd (number a, number b, const coeffs) |
|
static void | specialXGCD (unsigned long &s, unsigned long a, const coeffs r) |
|
static unsigned long | InvMod (unsigned long a, const coeffs r) |
|
static number | nr2mInversM (number c, const coeffs r) |
|
static number | nr2mInvers (number c, const coeffs r) |
|
static number | nr2mExtGcd (number a, number b, number *s, number *t, const coeffs r) |
|
static void | nr2mPower (number a, int i, number *result, const coeffs r) |
|
static number | nr2mInit (long i, const coeffs r) |
|
static long | nr2mInt (number &n, const coeffs r) |
|
static number | nr2mAdd (number a, number b, const coeffs r) |
|
static number | nr2mSub (number a, number b, const coeffs r) |
|
static BOOLEAN | nr2mIsUnit (number a, const coeffs) |
|
static number | nr2mGetUnit (number k, const coeffs) |
|
static BOOLEAN | nr2mIsZero (number a, const coeffs) |
|
static BOOLEAN | nr2mIsOne (number a, const coeffs) |
|
static BOOLEAN | nr2mIsMOne (number a, const coeffs r) |
|
static BOOLEAN | nr2mEqual (number a, number b, const coeffs) |
|
static number | nr2mDiv (number a, number b, const coeffs r) |
|
static BOOLEAN | nr2mDivBy (number a, number b, const coeffs r) |
|
static BOOLEAN | nr2mGreater (number a, number b, const coeffs r) |
|
static int | nr2mDivComp (number as, number bs, const coeffs) |
|
static number | nr2mMod (number a, number b, const coeffs r) |
|
static number | nr2mNeg (number c, const coeffs r) |
|
static number | nr2mMapMachineInt (number from, const coeffs, const coeffs dst) |
|
static number | nr2mMapProject (number from, const coeffs, const coeffs dst) |
|
number | nr2mMapZp (number from, const coeffs, const coeffs dst) |
|
static number | nr2mMapGMP (number from, const coeffs, const coeffs dst) |
|
static number | nr2mMapQ (number from, const coeffs src, const coeffs dst) |
|
static number | nr2mMapZ (number from, const coeffs src, const coeffs dst) |
|
static nMapFunc | nr2mSetMap (const coeffs src, const coeffs dst) |
|
static void | nr2mSetExp (int m, coeffs r) |
|
static void | nr2mInitExp (int m, coeffs r) |
|
static void | nr2mWrite (number a, const coeffs r) |
|
static const char * | nr2mEati (const char *s, int *i, const coeffs r) |
|
static const char * | nr2mRead (const char *s, number *a, const coeffs r) |
|
BOOLEAN | nr2mInitChar (coeffs r, void *p) |
|
◆ nr2mEqualM
#define nr2mEqualM |
( |
|
A, |
|
|
|
B |
|
) |
| ((A)==(B)) |
◆ nr2mNegM
#define nr2mNegM |
( |
|
A, |
|
|
|
r |
|
) |
| (number)((r->mod2mMask+1 - (unsigned long)(A)) & r->mod2mMask) |
◆ InvMod()
static unsigned long InvMod |
( |
unsigned long |
a, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
◆ nr2mAdd()
static number nr2mAdd |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
◆ nr2mAddM()
static number nr2mAddM |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
inlinestatic |
Definition at line 43 of file rmodulo2m.cc.
47 ((((
unsigned long) a) + ((
unsigned long)
b)) & r->mod2mMask);
◆ nr2mAnn()
Definition at line 575 of file rmodulo2m.cc.
578 if ((
unsigned long)
b == 0)
580 if ((
unsigned long)
b == 1)
582 unsigned long c = r->mod2mMask + 1;
584 return (number)(c / (
unsigned long)
b);
588 mpz_ptr cc = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
589 mpz_init_set_ui(cc, r->mod2mMask); mpz_add_ui(cc, cc, 1);
590 mpz_div_ui(cc, cc, (
unsigned long)(
unsigned long)
b);
591 unsigned long s = mpz_get_ui(cc);
593 return (number)(
unsigned long)
s;
◆ nr2mCoeffIsEqual()
Definition at line 76 of file rmodulo2m.cc.
82 unsigned long mm=r->mod2mMask;
83 if (((mm+1)>>
m)==1L)
return TRUE;
◆ nr2mCoeffName()
Definition at line 61 of file rmodulo2m.cc.
65 if (
cf->modExponent>32)
66 snprintf(n2mCoeffName_buf,21,
"ZZ/(bigint(2)^%lu)",
cf->modExponent);
68 snprintf(n2mCoeffName_buf,21,
"ZZ/(2^%lu)",
cf->modExponent);
69 return n2mCoeffName_buf;
◆ nr2mCoeffString()
◆ nr2mCoeffWrite()
◆ nr2mDBTest()
Definition at line 25 of file rmodulo2m.cc.
28 if (((
long)a<0L) || ((
long)a>(
long)r->mod2mMask))
30 Print(
"wrong mod 2^n number %ld at %s,%d\n",(
long)a,
f,
l);
◆ nr2mDiv()
static number nr2mDiv |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 410 of file rmodulo2m.cc.
413 if ((
unsigned long)a == 0)
return (number)0;
414 else if ((
unsigned long)
b % 2 == 0)
416 if ((
unsigned long)
b != 0)
418 while (((
unsigned long)
b % 2 == 0) && ((
unsigned long)a % 2 == 0))
420 a = (number)((
unsigned long)a / 2);
421 b = (number)((
unsigned long)
b / 2);
424 if ((
unsigned long)
b % 2 == 0)
426 WerrorS(
"Division not possible, even by cancelling zero divisors.");
427 WerrorS(
"Result is integer division without remainder.");
428 return (number) ((
unsigned long) a / (
unsigned long)
b);
◆ nr2mDivBy()
Definition at line 438 of file rmodulo2m.cc.
443 unsigned long c = r->mod2mMask + 1;
445 return (c % (
unsigned long)
b) == 0;
450 c = (
unsigned long)
b;
453 if ((c % 2) != 0)
return FALSE;
◆ nr2mDivComp()
static int nr2mDivComp |
( |
number |
as, |
|
|
number |
bs, |
|
|
const |
coeffs |
|
) |
| |
|
static |
Definition at line 471 of file rmodulo2m.cc.
474 unsigned long a = (
unsigned long)as;
475 unsigned long b = (
unsigned long)bs;
477 while (a % 2 == 0 &&
b % 2 == 0)
◆ nr2mEati()
Definition at line 741 of file rmodulo2m.cc.
745 if (((*
s) >=
'0') && ((*
s) <=
'9'))
752 if ((*
i) >= (
MAX_INT_VAL / 10)) (*i) = (*i) & r->mod2mMask;
754 while (((*
s) >=
'0') && ((*
s) <=
'9'));
755 (*i) = (*i) & r->mod2mMask;
◆ nr2mEqual()
static BOOLEAN nr2mEqual |
( |
number |
a, |
|
|
number |
b, |
|
|
const |
coeffs |
|
) |
| |
|
static |
◆ nr2mExtGcd()
static number nr2mExtGcd |
( |
number |
a, |
|
|
number |
b, |
|
|
number * |
s, |
|
|
number * |
t, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 292 of file rmodulo2m.cc.
295 unsigned long res = 0;
296 if ((
unsigned long)a == 0 && (
unsigned long)
b == 0)
return (number)1;
297 while ((
unsigned long)a % 2 == 0 && (
unsigned long)
b % 2 == 0)
299 a = (number)((
unsigned long)a / 2);
300 b = (number)((
unsigned long)
b / 2);
303 if ((
unsigned long)
b % 2 == 0)
307 return (number)((1L <<
res));
313 return (number)((1L <<
res));
◆ nr2mGcd()
static number nr2mGcd |
( |
number |
a, |
|
|
number |
b, |
|
|
const |
coeffs |
|
) |
| |
|
static |
Definition at line 179 of file rmodulo2m.cc.
182 unsigned long res = 0;
183 if ((
unsigned long)a == 0 && (
unsigned long)
b == 0)
return (number)1;
184 while ((
unsigned long)a % 2 == 0 && (
unsigned long)
b % 2 == 0)
186 a = (number)((
unsigned long)a / 2);
187 b = (number)((
unsigned long)
b / 2);
196 return (number)((1L <<
res));
◆ nr2mGetUnit()
static number nr2mGetUnit |
( |
number |
k, |
|
|
const |
coeffs |
|
) |
| |
|
static |
Definition at line 382 of file rmodulo2m.cc.
385 if (
k ==
NULL)
return (number)1;
386 unsigned long erg = (
unsigned long)
k;
387 while (erg % 2 == 0) erg = erg / 2;
◆ nr2mGreater()
◆ nr2mGreaterZero()
Definition at line 131 of file rmodulo2m.cc.
134 if ((
unsigned long)
k == 0)
return FALSE;
135 if ((
unsigned long)
k > ((r->mod2mMask >> 1) + 1))
return FALSE;
◆ nr2mInit()
Definition at line 336 of file rmodulo2m.cc.
339 if (
i == 0)
return (number)(
unsigned long)
i;
342 unsigned long j = (
unsigned long)1;
343 if (ii < 0) {
j = r->mod2mMask; ii = -ii; }
344 unsigned long k = (
unsigned long)ii;
345 k =
k & r->mod2mMask;
347 return (number)
nr2mMult((number)
j, (number)
k, r);
◆ nr2mInitChar()
Definition at line 779 of file rmodulo2m.cc.
794 mpz_init_set_si (r->modBase, 2L);
796 mpz_init (r->modNumber);
797 mpz_pow_ui (r->modNumber, r->modBase, r->modExponent);
800 r->ch = (int)r->mod2mMask + 1;
838 r->has_simple_Alloc=
TRUE;
◆ nr2mInitExp()
static void nr2mInitExp |
( |
int |
m, |
|
|
coeffs |
r |
|
) |
| |
|
static |
Definition at line 728 of file rmodulo2m.cc.
733 WarnS(
"nr2mInitExp unexpectedly called with m = 1 (we continue with Z/2^2");
◆ nr2mInt()
Definition at line 353 of file rmodulo2m.cc.
356 unsigned long nn = (
unsigned long)n;
357 unsigned long l = r->mod2mMask >> 1;
l++;
358 if ((
unsigned long)nn >
l)
359 return (
long)((
unsigned long)nn - r->mod2mMask - 1);
361 return (
long)((
unsigned long)nn);
◆ nr2mInvers()
Definition at line 278 of file rmodulo2m.cc.
281 if ((
unsigned long)c % 2 == 0)
283 WerrorS(
"division by zero divisor");
◆ nr2mInversM()
◆ nr2mIsMOne()
Definition at line 400 of file rmodulo2m.cc.
403 return ((r->mod2mMask == (
unsigned long)a) &&(1L!=(
long)a));
◆ nr2mIsOne()
Definition at line 395 of file rmodulo2m.cc.
398 return 1 == (
unsigned long)a;
◆ nr2mIsUnit()
Definition at line 377 of file rmodulo2m.cc.
380 return ((
unsigned long)a % 2 == 1);
◆ nr2mIsZero()
Definition at line 390 of file rmodulo2m.cc.
393 return 0 == (
unsigned long)a;
◆ nr2mLcm()
static number nr2mLcm |
( |
number |
a, |
|
|
number |
b, |
|
|
const |
coeffs |
|
) |
| |
|
static |
Definition at line 156 of file rmodulo2m.cc.
159 unsigned long res = 0;
160 if ((
unsigned long)a == 0) a = (number) 1;
161 if ((
unsigned long)
b == 0)
b = (number) 1;
162 while ((
unsigned long)a % 2 == 0)
164 a = (number)((
unsigned long)a / 2);
165 if ((
unsigned long)
b % 2 == 0)
b = (number)((
unsigned long)
b / 2);
168 while ((
unsigned long)
b % 2 == 0)
170 b = (number)((
unsigned long)
b / 2);
173 return (number)(1L <<
res);
◆ nr2mMapGMP()
Definition at line 627 of file rmodulo2m.cc.
632 mpz_ptr
k = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
633 mpz_init_set_ui(
k, dst->mod2mMask);
635 mpz_and(erg, (mpz_ptr)from,
k);
636 number
res = (number) mpz_get_ui(erg);
◆ nr2mMapMachineInt()
Definition at line 604 of file rmodulo2m.cc.
607 unsigned long i = ((
unsigned long)from) % (dst->mod2mMask + 1) ;
◆ nr2mMapProject()
Definition at line 610 of file rmodulo2m.cc.
613 unsigned long i = ((
unsigned long)from) % (dst->mod2mMask + 1);
◆ nr2mMapQ()
◆ nr2mMapZ()
◆ nr2mMapZp()
Definition at line 616 of file rmodulo2m.cc.
619 unsigned long j = (
unsigned long)1;
620 long ii = (long)from;
621 if (ii < 0) {
j = dst->mod2mMask; ii = -ii; }
622 unsigned long i = (
unsigned long)ii;
623 i =
i & dst->mod2mMask;
625 return (number)
nr2mMult((number)
i, (number)
j, dst);
◆ nr2mMod()
static number nr2mMod |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 498 of file rmodulo2m.cc.
522 assume((
unsigned long)
b != 0);
524 unsigned long b_div = (
unsigned long)
b;
532 unsigned long rr = 0;
533 while ((g < r->mod2mMask ) && (b_div > 0) && (b_div % 2 == 0))
539 if (
g != 1) rr = (
unsigned long)a %
g;
◆ nr2mMult()
static number nr2mMult |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 141 of file rmodulo2m.cc.
145 if (((
unsigned long)a == 0) || ((
unsigned long)
b == 0))
◆ nr2mMultM()
static number nr2mMultM |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
inlinestatic |
Definition at line 37 of file rmodulo2m.cc.
41 ((((
unsigned long) a) * ((
unsigned long)
b)) & r->mod2mMask);
◆ nr2mNeg()
Definition at line 596 of file rmodulo2m.cc.
599 if ((
unsigned long)c == 0)
return c;
◆ nr2mPower()
static void nr2mPower |
( |
number |
a, |
|
|
int |
i, |
|
|
number * |
result, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
◆ nr2mQuot1()
Definition at line 92 of file rmodulo2m.cc.
96 long ch = r->cfInt(c, r);
98 mpz_init_set(a, r->modNumber);
99 mpz_init_set_ui(
b, ch);
104 if(mpz_cmp_ui(
gcd, 1) == 0)
106 WerrorS(
"constant in q-ideal is coprime to modulus in ground ring");
107 WerrorS(
"Unable to create qring!");
110 if(mpz_cmp_ui(
gcd, 2) == 0)
118 mpz_init(baseTokNew);
119 mpz_set(baseTokNew, r->modBase);
120 while(mpz_cmp(
gcd, baseTokNew) > 0)
123 mpz_mul(baseTokNew, baseTokNew, r->modBase);
125 mpz_clear(baseTokNew);
◆ nr2mRead()
Definition at line 760 of file rmodulo2m.cc.
773 *a = (number)(
long)z;
775 *a =
nr2mDiv((number)(
long)z,(number)(
long)n,r);
◆ nr2mSetExp()
static void nr2mSetExp |
( |
int |
m, |
|
|
coeffs |
r |
|
) |
| |
|
static |
Definition at line 710 of file rmodulo2m.cc.
719 for (
int i = 1;
i <
m;
i++) r->mod2mMask = (r->mod2mMask << 1) + 1;
◆ nr2mSetMap()
Definition at line 663 of file rmodulo2m.cc.
667 && (src->mod2mMask == dst->mod2mMask))
672 && (src->mod2mMask < dst->mod2mMask))
677 && (src->mod2mMask > dst->mod2mMask))
701 if (mpz_divisible_2exp_p(src->modNumber,dst->modExponent))
◆ nr2mSub()
static number nr2mSub |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
◆ nr2mSubM()
static number nr2mSubM |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
inlinestatic |
Definition at line 49 of file rmodulo2m.cc.
52 return (number)((
unsigned long)a < (
unsigned long)
b ?
53 r->mod2mMask+1 - (
unsigned long)
b + (
unsigned long)a:
54 (
unsigned long)a - (
unsigned long)
b);
◆ nr2mWrite()
◆ specialXGCD()
static void specialXGCD |
( |
unsigned long & |
s, |
|
|
unsigned long |
a, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 203 of file rmodulo2m.cc.
206 mpz_ptr u = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
207 mpz_init_set_ui(u, a);
208 mpz_ptr u0 = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
210 mpz_ptr u1 = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
211 mpz_init_set_ui(u1, 1);
212 mpz_ptr u2 = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
214 mpz_ptr
v = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
215 mpz_init_set_ui(
v, r->mod2mMask);
217 mpz_ptr v0 = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
219 mpz_ptr v1 = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
221 mpz_ptr v2 = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
222 mpz_init_set_ui(v2, 1);
223 mpz_ptr q = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
225 mpz_ptr rr = (mpz_ptr)
omAlloc(
sizeof(mpz_t));
236 mpz_mul(u2, u2, q); mpz_sub(u2, u1, u2);
237 mpz_mul(v2, v2, q); mpz_sub(v2, v1, v2);
245 mpz_add_ui(u1, u1, r->mod2mMask);
246 mpz_add_ui(u1, u1, 1);
◆ gmp_nrz_bin
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
(mpz_ptr), see rmodulon,h
static number nr2mMapProject(number from, const coeffs, const coeffs dst)
static BOOLEAN nr2mGreaterZero(number k, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
static number nr2mNeg(number c, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
static number nr2mLcm(number a, number b, const coeffs)
static number nr2mSub(number a, number b, const coeffs r)
EXTERN_VAR omBin gmp_nrz_bin
static number nr2mAdd(number a, number b, const coeffs r)
static int nr2mDivComp(number as, number bs, const coeffs)
only used if HAVE_RINGS is defined
static number nr2mMult(number a, number b, const coeffs r)
static number nr2mInvers(number c, const coeffs r)
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
static BOOLEAN nr2mIsUnit(number a, const coeffs)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static void nr2mInitExp(int m, coeffs r)
static number nr2mAnn(number b, const coeffs r)
static const char * nr2mRead(const char *s, number *a, const coeffs r)
static number nr2mGcd(number a, number b, const coeffs)
static number nr2mInit(long i, const coeffs r)
static void nr2mCoeffWrite(const coeffs r, BOOLEAN)
static number nr2mMapQ(number from, const coeffs src, const coeffs dst)
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
static void specialXGCD(unsigned long &s, unsigned long a, const coeffs r)
static BOOLEAN nr2mIsMOne(number a, const coeffs r)
static number nr2mSubM(number a, number b, const coeffs r)
static void nr2mSetExp(int m, coeffs r)
static char * nr2mCoeffName(const coeffs cf)
static unsigned long InvMod(unsigned long a, const coeffs r)
void PrintS(const char *s)
static number nr2mDiv(number a, number b, const coeffs r)
static const char * nr2mEati(const char *s, int *i, const coeffs r)
static number nr2mMod(number a, number b, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)
static number nr2mMultM(number a, number b, const coeffs r)
static number nr2mGetUnit(number k, const coeffs)
number nr2mMapZp(number from, const coeffs, const coeffs dst)
static nMapFunc nr2mSetMap(const coeffs src, const coeffs dst)
static number nr2mMapZ(number from, const coeffs src, const coeffs dst)
static number nr2mMapMachineInt(number from, const coeffs, const coeffs dst)
static coeffs nr2mQuot1(number c, const coeffs r)
static long nr2mInt(number &n, const coeffs r)
static number nr2mExtGcd(number a, number b, number *s, number *t, const coeffs r)
static number nr2mMapGMP(number from, const coeffs, const coeffs dst)
static BOOLEAN nr2mIsZero(number a, const coeffs)
void WerrorS(const char *s)
static number nr2mInversM(number c, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Zn(const coeffs r)
static BOOLEAN nr2mCoeffIsEqual(const coeffs r, n_coeffType n, void *p)
static void nr2mWrite(number a, const coeffs r)
static char * nr2mCoeffString(const coeffs r)
static BOOLEAN nr2mGreater(number a, number b, const coeffs r)
const Variable & v
< [in] a sqrfree bivariate poly
static BOOLEAN nr2mIsOne(number a, const coeffs)
static BOOLEAN nr2mDivBy(number a, number b, const coeffs r)
const CanonicalForm int s
BOOLEAN nr2mDBTest(number a, const char *f, const int l, const coeffs r)
static BOOLEAN nr2mEqual(number a, number b, const coeffs)
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
static number nr2mAddM(number a, number b, const coeffs r)
static void nr2mPower(number a, int i, number *result, const coeffs r)
void nlGMP(number &i, mpz_t n, const coeffs r)
(), see rinteger.h, new impl.