Loading...
Searching...
No Matches
modulop_inl.h
Go to the documentation of this file.
#ifndef MODULOP2_H
#define MODULOP2_H
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT: numbers modulo p (<=32749)
*/
#include "misc/auxiliary.h"
#include "coeffs/modulop.h"
static inline number npMult (number a,number b, const coeffs r)
{
n_Test(a, r);
n_Test(b, r);
if (((long)a == 0) || ((long)b == 0))
return (number)0;
number c = npMultM(a,b, r);
n_Test(c, r);
return c;
}
/*2
* create a number from int
*/
static inline number npInit (long i, const coeffs r)
{
long ii=i % (long)r->ch;
if (ii < 0L) ii += (long)r->ch;
number c = (number)ii;
n_Test(c, r);
return c;
}
#define npIsZeroM(A,B) (0==(long)A)
static inline BOOLEAN npIsZero (number a, const coeffs r)
{
n_Test(a, r);
return npIsZeroM(a,r);
}
#ifdef NV_OPS
// -----------------------------------------------------------
// operation for very large primes (32749< p < 2^31-1)
// ----------------------------------------------------------
#pragma GCC diagnostic ignored "-Wlong-long"
static inline number nvMult(number a, number b, const coeffs r)
{
assume( getCoeffType(r) == n_Zp );
#if SIZEOF_LONG == 4
#define ULONG64 (unsigned long long)(unsigned long)
#else
#define ULONG64 (unsigned long)
#endif
return (number)
(unsigned long)((ULONG64 a)*(ULONG64 b) % (ULONG64 r->ch));
}
#endif
#endif
auxiliary.h
All the auxiliary stuff.
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
i
int i
Definition cfEzgcd.cc:132
b
CanonicalForm b
Definition cfModGcd.cc:4111
n_Test
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r).
Definition coeffs.h:715
n_Zp
@ n_Zp
\F{p < 2^31}
Definition coeffs.h:29
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
ULONG64
#define ULONG64
assume
#define assume(x)
Definition mod2.h:389
modulop.h
npMultM
static number npMultM(number a, number b, const coeffs r)
Definition modulop.h:71
npInit
static number npInit(long i, const coeffs r)
Definition modulop_inl.h:27
nvMult
static number nvMult(number a, number b, const coeffs r)
Definition modulop_inl.h:50
npMult
static number npMult(number a, number b, const coeffs r)
Definition modulop_inl.h:12
npIsZero
static BOOLEAN npIsZero(number a, const coeffs r)
Definition modulop_inl.h:38
npIsZeroM
#define npIsZeroM(A, B)
Definition modulop_inl.h:37
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.