#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <cstdio>
#include "linbox/util/commentator.h"
#include "linbox/util/field-axpy.h"
#include "linbox/vector/stream.h"
#include "linbox/vector/vector-domain.h"
#include "linbox/blackbox/dense.h"
#include "linbox/integer.h"
#include "test-common.h"
Generic field tests | |
template<class Field> bool | testField (Field &F, const char *title) |
template<class Field> bool | testFieldNegation (const Field &F, const char *name, unsigned int iterations) |
template<class Field> bool | testFieldInversion (const Field &F, const char *name, unsigned int iterations) |
template<class Field> bool | testFieldAxioms (const Field &F, const char *name, unsigned int iterations) |
template<class Field> bool | testFieldAssociativity (const Field &F, const char *name, unsigned int iterations) |
template<class Field> bool | testGeometricSummation (const Field &F, const char *name, unsigned int iterations, unsigned int n) |
template<class Field> bool | testFieldCharacteristic (const Field &F, const char *name, unsigned int iterations) |
template<class Field> bool | testFreshmansDream (const Field &F, const char *name, unsigned int iterations) |
template<class Field> bool | testArithmeticConsistency (const Field &F, const char *name, unsigned int iterations) |
template<class Field> bool | testAxpyConsistency (const Field &F, const char *name, unsigned int iterations) |
template<class Field> bool | testRanditerBasic (const Field &F, const char *name, unsigned int iterations) |
template<class Field> bool | runFieldTests (const Field &F, const char *desc, unsigned int iterations, size_t n, bool runCharacteristicTest) |
Generic field tests | |
template<class Field> bool | testRandomIterator (const Field &F, const char *text, unsigned int num_trials, unsigned int num_categories, unsigned int hist_len) |
template<class Field> bool | testRandomIteratorStep (const Field &F, const char *text, unsigned int num_trials, unsigned int num_categories, unsigned int hist_len) |
Functions | |
template<class Field> Field::Element | expt (const Field &F, typename Field::Element &res, const typename Field::Element &a, LinBox::integer &n) |
|
|
|
|
|
Generic test 7: Consistency of in-place and out-of-place arithmetic Generates random elements 'a' and 'b' and performs all basic arithmetic operations in-place and out-of-place, checking for consistency |
|
Generic test 8: Consistency of axpy Generates random elements 'a', 'x', and 'y' and checks that a * x + y is the same for axpy, axpyin, add/mul |
|
Generic test 1: Test of field operations Test various field oeprations F - Field over which to perform computations title - String to use as the descriptive title of this test Return true on success and false on failure |
|
Generic test 7: Associativity of addition and multiplication Given random field elements 'a', 'b', and 'c', checks that (a * b) * c = a * (b * c) and (a + b) + c = a + (b + c) |
|
@memo Generic test 7: Commutativity and distributivity of addition and multiplication @doc Given random field elements 'a', 'b', and 'c', checks that (a + b) * c = a * c + b * c = c * (a + b) = b * c + a * c |
|
Generic test 3: Test of field characteristic Take random field elements and add them p times, where p is the characteristic of the field. Checks that the sum is 0. The test is not too useful when the characteristic of the field is 0, but it should still work correctly. |
|
Generic test 5: Inversion of elements Inverts random elements and checks that they are true inverses |
|
Tests of algebraic properties of fields |
|
Generic test 4: The Freshman's Dream Generates two random field elements 'a' and 'b', and checks whether (a + b)^p = a^p + b^p, where p is the characteristic of the field. Bails out with an error if the field is of characteristic 0. |
|
Generic test 2: Geometric summation Generates a random field element 'a' and raises it through repeated exponentiation to the power n. Takes the sum k of all intermediate values and checks that a^n = (k-1)/(a-1). |
|
Generic test 9: Basic concept check of RandIter In a loop, generates random element 'a', and fails if it is always zero. |
|
Random number test Test that the random iterator over the given field works. Test up to five times, accepting any one, to increase probability of passing statistical tests. |
|
|