My Project
Loading...
Searching...
No Matches
Functions
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.

798{
799 assume( getCoeffType(r) == n_Z2m );
800 nr2mInitExp((int)(long)(p), r);
801
802 r->is_field=FALSE;
803 r->is_domain=FALSE;
804 r->rep=n_rep_int;
805
806 //r->cfKillChar = ndKillChar; /* dummy*/
807 r->nCoeffIsEqual = nr2mCoeffIsEqual;
808
809 r->modBase = (mpz_ptr) omAllocBin (gmp_nrz_bin);
810 mpz_init_set_si (r->modBase, 2L);
811 r->modNumber= (mpz_ptr) omAllocBin (gmp_nrz_bin);
812 mpz_init (r->modNumber);
813 mpz_pow_ui (r->modNumber, r->modBase, r->modExponent);
814
815 /* next cast may yield an overflow as mod2mMask is an unsigned long */
816 r->ch = (int)r->mod2mMask + 1;
817
818 r->cfInit = nr2mInit;
819 //r->cfCopy = ndCopy;
820 r->cfInt = nr2mInt;
821 r->cfAdd = nr2mAdd;
822 r->cfInpAdd = nr2mInpAdd;
823 r->cfSub = nr2mSub;
824 r->cfMult = nr2mMult;
825 r->cfInpMult = nr2mInpMult;
826 r->cfDiv = nr2mDiv;
827 r->cfAnn = nr2mAnn;
828 r->cfIntMod = nr2mMod;
829 r->cfExactDiv = nr2mDiv;
830 r->cfInpNeg = nr2mNeg;
831 r->cfInvers = nr2mInvers;
832 r->cfDivBy = nr2mDivBy;
833 r->cfDivComp = nr2mDivComp;
834 r->cfGreater = nr2mGreater;
835 r->cfEqual = nr2mEqual;
836 r->cfIsZero = nr2mIsZero;
837 r->cfIsOne = nr2mIsOne;
838 r->cfIsMOne = nr2mIsMOne;
839 r->cfGreaterZero = nr2mGreaterZero;
840 r->cfWriteLong = nr2mWrite;
841 r->cfRead = nr2mRead;
842 r->cfPower = nr2mPower;
843 r->cfSetMap = nr2mSetMap;
844// r->cfNormalize = ndNormalize; // default
845 r->cfLcm = nr2mLcm;
846 r->cfGcd = nr2mGcd;
847 r->cfIsUnit = nr2mIsUnit;
848 r->cfGetUnit = nr2mGetUnit;
849 r->cfExtGcd = nr2mExtGcd;
850 r->cfCoeffName = nr2mCoeffName;
851 r->cfQuot1 = nr2mQuot1;
852#ifdef LDEBUG
853 r->cfDBTest = nr2mDBTest;
854#endif
855 r->has_simple_Alloc=TRUE;
856 return FALSE;
857}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4078
@ n_Z2m
only used if HAVE_RINGS is defined
Definition: coeffs.h:46
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
@ n_rep_int
(int), see modulop.h
Definition: coeffs.h:110
#define assume(x)
Definition: mod2.h:389
#define LDEBUG
Definition: mod2.h:307
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
static number nr2mGcd(number a, number b, const coeffs)
Definition: rmodulo2m.cc:192
static nMapFunc nr2mSetMap(const coeffs src, const coeffs dst)
Definition: rmodulo2m.cc:686
static void nr2mWrite(number a, const coeffs r)
Definition: rmodulo2m.cc:753
static BOOLEAN nr2mIsUnit(number a, const coeffs)
Definition: rmodulo2m.cc:396
static void nr2mInpAdd(number &a, number b, const coeffs r)
Definition: rmodulo2m.cc:383
static number nr2mSub(number a, number b, const coeffs r)
Definition: rmodulo2m.cc:389
static number nr2mLcm(number a, number b, const coeffs)
Definition: rmodulo2m.cc:169
static BOOLEAN nr2mIsOne(number a, const coeffs)
Definition: rmodulo2m.cc:414
static number nr2mAnn(number b, const coeffs r)
Definition: rmodulo2m.cc:599
static number nr2mInit(long i, const coeffs r)
Definition: rmodulo2m.cc:349
static number nr2mExtGcd(number a, number b, number *s, number *t, const coeffs r)
Definition: rmodulo2m.cc:305
static number nr2mGetUnit(number k, const coeffs)
Definition: rmodulo2m.cc:401
static void nr2mInitExp(int m, coeffs r)
Definition: rmodulo2m.cc:746
static void nr2mPower(number a, int i, number *result, const coeffs r)
Definition: rmodulo2m.cc:329
static number nr2mInvers(number c, const coeffs r)
Definition: rmodulo2m.cc:291
static int nr2mDivComp(number as, number bs, const coeffs)
Definition: rmodulo2m.cc:495
static number nr2mMult(number a, number b, const coeffs r)
Definition: rmodulo2m.cc:145
static long nr2mInt(number &n, const coeffs r)
Definition: rmodulo2m.cc:366
static BOOLEAN nr2mDivBy(number a, number b, const coeffs r)
Definition: rmodulo2m.cc:462
static BOOLEAN nr2mGreaterZero(number k, const coeffs r)
Definition: rmodulo2m.cc:135
static number nr2mNeg(number c, const coeffs r)
Definition: rmodulo2m.cc:620
EXTERN_VAR omBin gmp_nrz_bin
Definition: rmodulo2m.cc:73
static BOOLEAN nr2mDBTest(number a, const char *f, const int l, const coeffs r)
Definition: rmodulo2m.cc:26
static number nr2mMod(number a, number b, const coeffs r)
Definition: rmodulo2m.cc:522
static BOOLEAN nr2mCoeffIsEqual(const coeffs r, n_coeffType n, void *p)
Definition: rmodulo2m.cc:85
static number nr2mAdd(number a, number b, const coeffs r)
Definition: rmodulo2m.cc:376
static void nr2mInpMult(number &a, number b, const coeffs r)
Definition: rmodulo2m.cc:156
static char * nr2mCoeffName(const coeffs cf)
Definition: rmodulo2m.cc:75
static BOOLEAN nr2mEqual(number a, number b, const coeffs)
Definition: rmodulo2m.cc:424
static BOOLEAN nr2mGreater(number a, number b, const coeffs r)
Definition: rmodulo2m.cc:490
static BOOLEAN nr2mIsZero(number a, const coeffs)
Definition: rmodulo2m.cc:409
static const char * nr2mRead(const char *s, number *a, const coeffs r)
Definition: rmodulo2m.cc:778
static BOOLEAN nr2mIsMOne(number a, const coeffs r)
Definition: rmodulo2m.cc:419
static number nr2mDiv(number a, number b, const coeffs r)
Definition: rmodulo2m.cc:429
static coeffs nr2mQuot1(number c, const coeffs r)
Definition: rmodulo2m.cc:96

◆ nr2mMapZp()

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

Definition at line 640 of file rmodulo2m.cc.

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