Loading...
Searching...
No Matches
rmodulo2m.h File Reference
`#include "misc/auxiliary.h"`

Go to the source code of this file.

## Functions

BOOLEAN | nr2mInitChar (coeffs r, void *)
number | nr2mMapZp (number from, const coeffs, const coeffs dst)

## Function Documentation

## nr2mInitChar()

BOOLEAN nr2mInitChar | ( | coeffs | r,
|  | void * | p )

Definition at line 797 of file rmodulo2m.cc.

{
assume( getCoeffType(r) == n_Z2m );
nr2mInitExp((int)(long)(p), r);
r->is_field=FALSE;
r->is_domain=FALSE;
r->rep=n_rep_int;
//r->cfKillChar = ndKillChar; /* dummy*/
r->nCoeffIsEqual = nr2mCoeffIsEqual;
r->modBase = (mpz_ptr) omAllocBin (gmp_nrz_bin);
mpz_init_set_si (r->modBase, 2L);
r->modNumber= (mpz_ptr) omAllocBin (gmp_nrz_bin);
mpz_init (r->modNumber);
mpz_pow_ui (r->modNumber, r->modBase, r->modExponent);
/* next cast may yield an overflow as mod2mMask is an unsigned long */
r->ch = (int)r->mod2mMask + 1;
r->cfInit = nr2mInit;
//r->cfCopy = ndCopy;
r->cfInt = nr2mInt;
r->cfAdd = nr2mAdd;
r->cfInpAdd = nr2mInpAdd;
r->cfSub = nr2mSub;
r->cfMult = nr2mMult;
r->cfInpMult = nr2mInpMult;
r->cfDiv = nr2mDiv;
r->cfAnn = nr2mAnn;
r->cfIntMod = nr2mMod;
r->cfExactDiv = nr2mDiv;
r->cfInpNeg = nr2mNeg;
r->cfInvers = nr2mInvers;
r->cfDivBy = nr2mDivBy;
r->cfDivComp = nr2mDivComp;
r->cfGreater = nr2mGreater;
r->cfEqual = nr2mEqual;
r->cfIsZero = nr2mIsZero;
r->cfIsOne = nr2mIsOne;
r->cfIsMOne = nr2mIsMOne;
r->cfGreaterZero = nr2mGreaterZero;
r->cfWriteLong = nr2mWrite;
r->cfRead = nr2mRead;
r->cfPower = nr2mPower;
r->cfSetMap = nr2mSetMap;
// r->cfNormalize = ndNormalize; // default
r->cfLcm = nr2mLcm;
r->cfGcd = nr2mGcd;
r->cfIsUnit = nr2mIsUnit;
r->cfGetUnit = nr2mGetUnit;
r->cfExtGcd = nr2mExtGcd;
r->cfCoeffName = nr2mCoeffName;
r->cfQuot1 = nr2mQuot1;
#ifdef LDEBUG
r->cfDBTest = nr2mDBTest;
#endif
r->has_simple_Alloc=TRUE;
return FALSE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
p
int p
Definition cfModGcd.cc:4086
n_Z2m
@ n_Z2m
only used if HAVE_RINGS is defined
Definition coeffs.h:46
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
n_rep_int
@ n_rep_int
(int), see modulop.h
Definition coeffs.h:117
assume
#define assume(x)
Definition mod2.h:389
omAllocBin
#define omAllocBin(bin)
Definition omAllocDecl.h:205
gmp_nrz_bin
VAR omBin gmp_nrz_bin
Definition rintegers.cc:23
nr2mGcd
static number nr2mGcd(number a, number b, const coeffs)
Definition rmodulo2m.cc:190
nr2mSetMap
static nMapFunc nr2mSetMap(const coeffs src, const coeffs dst)
Definition rmodulo2m.cc:686
nr2mWrite
static void nr2mWrite(number a, const coeffs r)
Definition rmodulo2m.cc:753
nr2mGreater
static BOOLEAN nr2mGreater(number as, number bs, const coeffs r)
Definition rmodulo2m.cc:488
nr2mIsUnit
static BOOLEAN nr2mIsUnit(number a, const coeffs)
Definition rmodulo2m.cc:394
nr2mInpAdd
static void nr2mInpAdd(number &a, number b, const coeffs r)
Definition rmodulo2m.cc:381
nr2mSub
static number nr2mSub(number a, number b, const coeffs r)
Definition rmodulo2m.cc:387
nr2mLcm
static number nr2mLcm(number a, number b, const coeffs)
Definition rmodulo2m.cc:167
nr2mIsOne
static BOOLEAN nr2mIsOne(number a, const coeffs)
Definition rmodulo2m.cc:412
nr2mAnn
static number nr2mAnn(number b, const coeffs r)
Definition rmodulo2m.cc:599
nr2mInit
static number nr2mInit(long i, const coeffs r)
Definition rmodulo2m.cc:347
nr2mExtGcd
static number nr2mExtGcd(number a, number b, number *s, number *t, const coeffs r)
Definition rmodulo2m.cc:303
nr2mGetUnit
static number nr2mGetUnit(number k, const coeffs)
Definition rmodulo2m.cc:399
nr2mInitExp
static void nr2mInitExp(int m, coeffs r)
Definition rmodulo2m.cc:746
nr2mPower
static void nr2mPower(number a, int i, number *result, const coeffs r)
Definition rmodulo2m.cc:327
nr2mInvers
static number nr2mInvers(number c, const coeffs r)
Definition rmodulo2m.cc:289
nr2mDivComp
static int nr2mDivComp(number as, number bs, const coeffs)
Definition rmodulo2m.cc:495
nr2mMult
static number nr2mMult(number a, number b, const coeffs r)
Definition rmodulo2m.cc:143
nr2mInt
static long nr2mInt(number &n, const coeffs r)
Definition rmodulo2m.cc:364
nr2mDivBy
static BOOLEAN nr2mDivBy(number a, number b, const coeffs r)
Definition rmodulo2m.cc:460
nr2mGreaterZero
static BOOLEAN nr2mGreaterZero(number k, const coeffs r)
Definition rmodulo2m.cc:133
nr2mNeg
static number nr2mNeg(number c, const coeffs r)
Definition rmodulo2m.cc:620
nr2mDBTest
static BOOLEAN nr2mDBTest(number a, const char *f, const int l, const coeffs r)
Definition rmodulo2m.cc:24
nr2mMod
static number nr2mMod(number a, number b, const coeffs r)
Definition rmodulo2m.cc:522
nr2mCoeffIsEqual
static BOOLEAN nr2mCoeffIsEqual(const coeffs r, n_coeffType n, void *p)
Definition rmodulo2m.cc:83
nr2mAdd
static number nr2mAdd(number a, number b, const coeffs r)
Definition rmodulo2m.cc:374
nr2mInpMult
static void nr2mInpMult(number &a, number b, const coeffs r)
Definition rmodulo2m.cc:154
nr2mCoeffName
static char * nr2mCoeffName(const coeffs cf)
Definition rmodulo2m.cc:73
nr2mEqual
static BOOLEAN nr2mEqual(number a, number b, const coeffs)
Definition rmodulo2m.cc:422
nr2mIsZero
static BOOLEAN nr2mIsZero(number a, const coeffs)
Definition rmodulo2m.cc:407
nr2mRead
static const char * nr2mRead(const char *s, number *a, const coeffs r)
Definition rmodulo2m.cc:778
nr2mIsMOne
static BOOLEAN nr2mIsMOne(number a, const coeffs r)
Definition rmodulo2m.cc:417
nr2mDiv
static number nr2mDiv(number a, number b, const coeffs r)
Definition rmodulo2m.cc:427
nr2mQuot1
static coeffs nr2mQuot1(number c, const coeffs r)
Definition rmodulo2m.cc:94

## nr2mMapZp()

number nr2mMapZp | ( | number | from,
|  | const coeffs | ,
|  | const coeffs | dst )

Definition at line 640 of file rmodulo2m.cc.

{
unsigned long j = (unsigned long)1;
long ii = (long)from;
if (ii < 0) { j = dst->mod2mMask; ii = -ii; }
unsigned long i = (unsigned long)ii;
i = i & dst->mod2mMask;
/* now we have: from = j * i mod 2^m */
return nr2mMult((number)i, (number)j, dst);
}
i
int i
Definition cfEzgcd.cc:132
j
int j
Definition facHensel.cc:110