33 clog << ( _2S(
"TEST: sum[0..") + _2S(N) +
"]: ");
38 const unsigned long ssss = (N * (N+1)) / 2;
40 number sum1 =
n_Init(ssss, r);
41 clog<<
"N*(N+1)/2 (int: " << ssss <<
"): "; PrintSized(sum1, r);
50 clog<<
"N*(N+1): ("<< N*(N+1) <<
")"; PrintSized(s, r);
53 clog<<
"2: "; PrintSized(i, r);
63 clog<<
"N*(N+1)/2: "; PrintSized(res, r);
66 number d =
n_Sub(res, sum1, r);
86 for(
int k = N;
k >= 0;
k-- )
96 clog<<
"ss: "; PrintSized(ss, r);
100 clog<<
"real sum : "; PrintSized(s, r);
101 clog<<
"real sum(--): "; PrintSized(ss, r);
109 clog << (
" >>> TEST DONE!" );
117 clog << (
"TEST: Simple Arithmetics: ");
120 number two =
n_Init(2, r);
142 clog<<
"a: "; PrintSized(a, r);
145 clog<<
"two: "; PrintSized(two, r);
147 number aa0 =
n_Init(N*2, r);
149 number aa =
n_Add(a, a, r);
151 clog<<
"aa = a + a: "; PrintSized(aa, r);
153 number aa2 =
n_Mult(a, two, r);
155 clog<<
"aa2 = a * 2: "; PrintSized(aa2, r);
157 number aa1 =
n_Mult(two, a, r);
159 clog<<
"aa1 = 2 * a: "; PrintSized(aa1, r);
165 a =
n_Sub( aa, aa1, r );
167 clog<<
"a = aa - aa1: "; PrintSized(a, r);
173 a =
n_Sub( aa, aa2, r );
175 clog<<
"a = aa - aa2: "; PrintSized(a, r);
182 a =
n_Sub( aa1, aa2, r );
184 clog<<
"a = aa1 - aa2: "; PrintSized(a, r);
206 clog << (
" >>> TEST DONE!" );
219 clog << (
"----------------------- Testing coeffs: [" + _2S(type) +
", " + _2S(
p) +
"]: -----------------------");
226 clog << (
"Test: could not get this coeff. domain" );
232 if( r->cfCoeffWrite !=
NULL )
234 clog <<
"Coeff-domain: " << endl;
241 PrintS(
"Parameter: "); PrintSized(z, r);
246 clog <<
"Char: " <<
n_GetChar(r) << endl;
454 mpz_init_set_ui (Znmparam.
base, 3);
485 clog << (
"Test: could not get this coeff. domain" );
489 if (cf->cfCoeffWrite !=
NULL )
491 clog <<
"Coeff-domain: " << endl;
495 number q1 =
n_Init(21, cf);
496 number q2 =
n_Init(2, cf);
497 number q3 =
n_Div(q1, q2, cf);
498 number q4 =
n_Init(30, cf);
499 number q5 =
n_Mult(q3, q4, cf);
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
const CanonicalForm int s
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_ModN(const coeffs r)
void TestSum(const coeffs r, const unsigned long N)
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
only used if HAVE_RINGS is defined: ?
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
only used if HAVE_RINGS is defined: ?
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 nCoeff_is_long_R(const coeffs r)
#define TS_ASSERT_EQUALS(x, y)
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(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_R(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
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...
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...
void TestArith(const coeffs r)
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
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
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Creation data needed for finite fields.
real floating point (GMP) numbers
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
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..n_NumberOfParameters(...)
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
single prescision (6,6) real numbers
Coefficient rings, fields and other domains suitable for Singular polynomials.
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 BOOLEAN nCoeff_is_CF(const coeffs r)
const CanonicalForm CFMap CFMap & N
The main handler for Singular numbers which are suitable for Singular polynomials.
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 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 BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
TRUE if n_Delete/n_New are empty operations.
complex floating point (GMP) numbers
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
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)
only used if HAVE_RINGS is defined: ?
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)
void PrintS(const char *s)
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
static GlobalPrintingFixture globalPrintingFixture
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
BOOLEAN Test(const n_coeffType type, void *p=NULLp)
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
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_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...
#define TS_ASSERT_DIFFERS(x, y)
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_Extension(const coeffs r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
void simple(const n_coeffType _type)
void nKillChar(coeffs r)
undo all initialisations
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL