My Project
Toggle main menu visibility
Loading...
Searching...
No Matches
libpolys
coeffs
modulop_inl.h
Go to the documentation of this file.
1
#ifndef MODULOP2_H
2
#define MODULOP2_H
3
/****************************************
4
* Computer Algebra System SINGULAR *
5
****************************************/
6
/*
7
* ABSTRACT: numbers modulo p (<=32749)
8
*/
9
#include "
misc/auxiliary.h
"
10
#include "
coeffs/modulop.h
"
11
12
static
inline
number
npMult
(number a,number
b
,
const
coeffs
r)
13
{
14
n_Test
(a, r);
15
n_Test
(
b
, r);
16
17
if
(((
long
)a == 0) || ((
long
)
b
== 0))
18
return
(number)0;
19
number c =
npMultM
(a,
b
, r);
20
n_Test
(c, r);
21
return
c;
22
}
23
24
/*2
25
* create a number from int
26
*/
27
static
inline
number
npInit
(
long
i
,
const
coeffs
r)
28
{
29
long
ii=
i
% (long)r->ch;
30
if
(ii < 0L) ii += (long)r->ch;
31
32
number c = (number)ii;
33
n_Test
(c, r);
34
return
c;
35
}
36
37
#define npIsZeroM(A,B) (0==(long)A)
38
static
inline
BOOLEAN
npIsZero
(number a,
const
coeffs
r)
39
{
40
n_Test
(a, r);
41
42
return
npIsZeroM
(a,r);
43
}
44
45
#ifdef NV_OPS
46
// -----------------------------------------------------------
47
// operation for very large primes (32749< p < 2^31-1)
48
// ----------------------------------------------------------
49
#pragma GCC diagnostic ignored "-Wlong-long"
50
static
inline
number
nvMult
(number a, number
b
,
const
coeffs
r)
51
{
52
assume
(
getCoeffType
(r) ==
n_Zp
);
53
54
#if SIZEOF_LONG == 4
55
#define ULONG64 (unsigned long long)(unsigned long)
56
#else
57
#define ULONG64 (unsigned long)
58
#endif
59
return
(number)
60
(
unsigned
long)((
ULONG64
a)*(
ULONG64
b
) % (
ULONG64
r->ch));
61
}
62
#endif
63
#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.
Generated on
for My Project by
doxygen 1.17.0
for
Singular