27 clog << ( _2S(
"TEST: sum[0..") + _2S(
N) +
"]: ");
32 const unsigned long ssss = (
N * (
N+1)) / 2;
34 number sum1 =
n_Init(ssss, r);
35 clog<<
"N*(N+1)/2 (int: " << ssss <<
"): "; PrintSized(sum1, r);
44 clog<<
"N*(N+1): ("<<
N*(
N+1) <<
")"; PrintSized(
s, r);
47 clog<<
"2: "; PrintSized(
i, r);
57 clog<<
"N*(N+1)/2: "; PrintSized(
res, r);
80 for(
int k =
N;
k >= 0;
k-- )
90 clog<<
"ss: "; PrintSized(ss, r);
94 clog<<
"real sum : "; PrintSized(
s, r);
95 clog<<
"real sum(--): "; PrintSized(ss, r);
103 clog << (
" >>> TEST DONE!" );
111 clog << (
"TEST: Simple Arithmetics: ");
114 number two =
n_Init(2, r);
136 clog<<
"a: "; PrintSized(a, r);
139 clog<<
"two: "; PrintSized(two, r);
143 number aa =
n_Add(a, a, r);
145 clog<<
"aa = a + a: "; PrintSized(aa, r);
147 number aa2 =
n_Mult(a, two, r);
149 clog<<
"aa2 = a * 2: "; PrintSized(aa2, r);
151 number aa1 =
n_Mult(two, a, r);
153 clog<<
"aa1 = 2 * a: "; PrintSized(aa1, r);
159 a =
n_Sub( aa, aa1, r );
161 clog<<
"a = aa - aa1: "; PrintSized(a, r);
167 a =
n_Sub( aa, aa2, r );
169 clog<<
"a = aa - aa2: "; PrintSized(a, r);
176 a =
n_Sub( aa1, aa2, r );
178 clog<<
"a = aa1 - aa2: "; PrintSized(a, r);
200 clog << (
" >>> TEST DONE!" );
213 clog << (
"----------------------- Testing coeffs: [" + _2S(type) +
", " + _2S(
p) +
"]: -----------------------");
220 clog << (
"Test: could not get this coeff. domain" );
226 if( r->cfCoeffWrite !=
NULL )
228 clog <<
"Coeff-domain: " << endl;
235 PrintS(
"Parameter: "); PrintSized(z, r);
240 clog <<
"Char: " <<
n_GetChar(r) << endl;
448 mpz_init_set_ui (Znmparam.
base, 3);
479 clog << (
"Test: could not get this coeff. domain" );
483 if (
cf->cfCoeffWrite !=
NULL )
485 clog <<
"Coeff-domain: " << endl;
#define TS_ASSERT_EQUALS(x, y)
#define TS_ASSERT_DIFFERS(x, y)
const CanonicalForm CFMap CFMap & N
void simple(const n_coeffType _type)
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1....
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
static FORCE_INLINE BOOLEAN nCoeff_has_Units(const coeffs r)
returns TRUE, if r is not a field and r has non-trivial units
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
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_Ring_PtoM(const coeffs r)
@ n_R
single prescision (6,6) real numbers
@ n_Q
rational (GMP) numbers
@ n_Zn
only used if HAVE_RINGS is defined
@ n_long_R
real floating point (GMP) numbers
@ n_Z2m
only used if HAVE_RINGS is defined
@ n_Z
only used if HAVE_RINGS is defined
@ n_long_C
complex floating point (GMP) numbers
static FORCE_INLINE BOOLEAN nCoeff_is_CF(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Domain(const coeffs r)
returns TRUE, if r is a field or r has no zero divisors (i.e is a domain)
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
static FORCE_INLINE BOOLEAN nCoeff_has_simple_inverse(const coeffs r)
TRUE, if the computation of the inverse is fast, i.e. prefer leading coeff. 1 over content.
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static FORCE_INLINE BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
TRUE if n_Delete is empty operation.
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE BOOLEAN nCoeff_is_Zn(const coeffs r)
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
multiplication of 'a' and 'b'; replacement of 'a' by the product a*b
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
void nKillChar(coeffs r)
undo all initialisations
static FORCE_INLINE void n_InpAdd(number &a, number b, const coeffs r)
addition of 'a' and 'b'; replacement of 'a' by the sum a+b
Creation data needed for finite fields.
void TestArith(const coeffs r)
void TestSum(const coeffs r, const unsigned long N)
static GlobalPrintingFixture globalPrintingFixture
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
const CanonicalForm int s
The main handler for Singular numbers which are suitable for Singular polynomials.
BOOLEAN n_IsZeroDivisor(number a, const coeffs r)
Test whether a is a zero divisor in r i.e. not coprime with char. of r very inefficient implementatio...
void PrintS(const char *s)