55 int h = (
int)((
long)
k);
56 return ((
int)
h !=0) && (
h <= (r->ch>>1));
73 if (((
long)a == 0) || ((
long)
b == 0))
87 if ((
long)n > (((
long)r->ch) >>1))
return ((
long)n -((
long)r->ch));
88 else return ((
long)n);
95 return ((r->npPminus1M == (
long)a) &&(1L!=(
long)a));
108 if ((
long)a==0)
return (
number)0L;
111#ifndef HAVE_GENERIC_MULT
112 int s = r->npLogTable[(
long)a] - r->npLogTable[(
long)
b];
113 #ifdef HAVE_GENERIC_ADD
118 s += ((
long)
s >> 63) & r->npPminus1M;
120 s += ((
long)
s >> 31) & r->npPminus1M;
123 d = (
number)(
long)r->npExpTable[
s];
152 if ((
long)c==0L)
return c;
171 return ((
long)a) > ((
long)
b);
188 if ((
long)a>(((
long)r->ch) >>1))
StringAppend(
"-%d",(
int)(((
long)r->ch)-((
long)a)));
216 return nEati((
char *)
s,
i,(
int)r->ch);
260 if (r->npInvTable!=
NULL)
262 omFreeSize( (
void *)r->npInvTable, r->ch*
sizeof(
unsigned short) );
266 #ifndef HAVE_GENERIC_MULT
267 if (r->npExpTable!=
NULL)
269 omFreeSize( (
void *)r->npExpTable, r->ch*
sizeof(
unsigned short) );
270 omFreeSize( (
void *)r->npLogTable, r->ch*
sizeof(
unsigned short) );
271 r->npExpTable=
NULL; r->npLogTable=
NULL;
326#ifndef HAVE_GENERIC_MULT
341 const int c = (
int) (
long)
p;
352 r->npPminus1M = c - 1;
411 r->has_simple_Alloc=
TRUE;
412 r->has_simple_Inverse=
TRUE;
420 r->npInvTable=(
unsigned short*)
omAlloc0( r->ch*
sizeof(
unsigned short) );
422#ifndef HAVE_GENERIC_MULT
423 r->cfParameter=
npPar;
424 r->npExpTable=(
unsigned short *)
omAlloc0( r->ch*
sizeof(
unsigned short) );
425 r->npLogTable=(
unsigned short *)
omAlloc0( r->ch*
sizeof(
unsigned short) );
426 r->npExpTable[0] = 1;
427 r->npLogTable[0] = 0;
433 r->npLogTable[1] = 0;
439 r->npExpTable[
i] =(
int)(((
long)
w * (
long)r->npExpTable[
i-1]) % r->ch);
440 r->npLogTable[r->npExpTable[
i]] =
i;
441 if ( r->npExpTable[
i] == 1 )
450 r->npExpTable[1] = 1;
451 r->npLogTable[1] = 0;
460 r->cfExactDiv =
nvDiv;
476 if (((
long)a<0L) || ((
long)a>(
long)r->ch))
478 Print(
"wrong mod p number %ld at %s,%d\n",(
long)a,
f,
l);
508 size = (*f)[0]._mp_size;
522 e=(*f)[0]._mp_exp-
size;
534 al = dest->_mp_size =
size;
551 al = dest->_mp_size =
size+e;
555 for (
i=0;
i<e;
i++)
dd[
i] = 0;
560 dest->_mp_alloc =
al;
592 long i = (
long) (((
unsigned long) from) %
dst->ch);
656 else if ((
long)
b==0L)
virtual class for internal CanonicalForm's
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_CF(const coeffs r)
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
@ n_rep_gap_rat
(number), see longrat.h
@ n_rep_gap_gmp
(), see rinteger.h, new impl.
@ n_rep_int
(int), see modulop.h
@ n_rep_gmp_float
(gmp_float), see
@ n_rep_gmp
(mpz_ptr), see rmodulon,h
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
const CanonicalForm int s
‘factory.h’ is the user interface to Factory.
void WerrorS(const char *s)
number nlModP(number q, const coeffs, const coeffs Zp)
static BOOLEAN npCoeffsEqual(const coeffs r, n_coeffType n, void *parameter)
static number npMapMachineInt(number from, const coeffs, const coeffs dst)
static const char * npRead(const char *s, number *a, const coeffs r)
static number npInitMPZ(mpz_t m, const coeffs r)
static void npWrite(number a, const coeffs r)
CanonicalForm npConvSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
static void npWriteFd(number n, const ssiInfo *d, const coeffs)
BOOLEAN npInitChar(coeffs r, void *p)
static number nvDiv(number a, number b, const coeffs r)
static number npDiv(number a, number b, const coeffs r)
static number npMapP(number from, const coeffs src, const coeffs dst_r)
number nvInvers(number c, const coeffs r)
static number npPar(int, coeffs r)
static number npInvers(number c, const coeffs r)
static BOOLEAN npEqual(number a, number b, const coeffs r)
static char * npCoeffName(const coeffs cf)
static number npNeg(number c, const coeffs r)
static BOOLEAN npGreater(number a, number b, const coeffs r)
void npInpMult(number &a, number b, const coeffs r)
static BOOLEAN npIsMOne(number a, const coeffs r)
static BOOLEAN npGreaterZero(number k, const coeffs r)
static number npMapLongR(number from, const coeffs, const coeffs dst_r)
static BOOLEAN npDBTest(number a, const char *f, const int l, const coeffs r)
static nMapFunc npSetMap(const coeffs src, const coeffs dst)
static number npMapZ(number from, const coeffs src, const coeffs dst)
static number npMapGMP(number from, const coeffs, const coeffs dst)
static number npReadFd(const ssiInfo *d, const coeffs)
static const char * npEati(const char *s, int *i, const coeffs r)
static void nvInpMult(number &a, number b, const coeffs r)
static number nvInversM(number c, const coeffs r)
static number npRandom(siRandProc p, number, number, const coeffs cf)
long npInt(number &n, const coeffs r)
void npKillChar(coeffs r)
static number npMapCanonicalForm(number a, const coeffs, const coeffs dst)
number npConvFactoryNSingN(const CanonicalForm n, const coeffs r)
static BOOLEAN npIsOne(number a, const coeffs)
static number npAddM(number a, number b, const coeffs r)
static number npMultM(number a, number b, const coeffs r)
static number npNegM(number a, const coeffs r)
#define npEqualM(A, B, r)
static long npInvMod(long a, const coeffs R)
static number npInversM(number c, const coeffs r)
static void npInpAddM(number &a, number b, const coeffs r)
static number npSubM(number a, number b, const coeffs r)
static number npInit(long i, const coeffs r)
static number nvMult(number a, number b, const coeffs r)
static number npMult(number a, number b, const coeffs r)
static BOOLEAN npIsZero(number a, const coeffs r)
The main handler for Singular numbers which are suitable for Singular polynomials.
char * nEati(char *s, int *i, int m)
divide by the first (leading) number and return it, i.e. make monic
const char *const nDivBy0
#define omFreeSize(addr, size)