linbox
Namespaces | Functions
test-field.h File Reference

tests ring and field operations More...

#include <iostream>
#include <sstream>
#include <vector>
#include <cstdio>
#include "linbox/util/commentator.h"
#include "linbox/util/field-axpy.h"
#include <givaro/givranditer.h>
#include "linbox/integer.h"
#include "test-common.h"
+ Include dependency graph for test-field.h:
+ This graph shows which files directly or indirectly include this file:

Namespaces

 field_subtests
 Tests of algebraic properties of rings and fields.
 

Functions

template<class Ring >
bool testRing (Ring &F, const char *title, bool fieldp=true, bool runInitConvertIdentity=true)
 Check each field or ring operation. More...
 
template<class Field >
bool testFieldInversion (const Field &F, const char *name, unsigned int iterations)
 Generic test 5: Inversion of elements. More...
 
template<class Field >
bool testFieldDistributivity (const Field &F, const char *name, unsigned int iterations)
 Generic test 7a: Distributivity of multiplication over addition. More...
 
template<class Field >
bool testFieldCommutativity (const Field &F, const char *name, unsigned int iterations)
 Generic test 7b: Commutativity of multiplication and addition. More...
 
template<class Field >
bool testFieldAssociativity (const Field &F, const char *name, unsigned int iterations)
 Generic test 7c: Associativity of addition and multiplication. More...
 
template<class Field >
bool testGeometricSummation (const Field &F, const char *name, unsigned int iterations, unsigned int n)
 Generic test 2: Geometric summation. More...
 
template<class Field >
bool testFieldCharacteristic (const Field &F, const char *name, unsigned int iterations)
 Generic test 3: Test of field characteristic. More...
 
template<class Field >
bool testFreshmansDream (const Field &F, const char *name, unsigned int iterations)
 Generic test 4: The Freshman's Dream. More...
 
template<class Field >
bool testRingArithmeticConsistency (const Field &F, const char *name, unsigned int iterations)
 Generic test 7: Consistency of in-place and out-of-place arithmetic. More...
 
template<class Field >
bool testRingTrivia (const Field &F, const char *name)
 
template<class Field >
bool testAxpyConsistency (const Field &F, const char *name, unsigned int iterations)
 Generic test 8: Consistency of axpy. More...
 
template<class Field >
bool testRanditerBasic (const Field &F, const char *name, unsigned int iterations)
 Generic test 9: Basic concept check of RandIter. More...
 
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)
 Random number test. More...
 

Detailed Description

tests ring and field operations

Test:
tests ring and field operations

Function Documentation

◆ testRing()

bool testRing ( Ring &  F,
const char *  title,
bool  fieldp = true,
bool  runInitConvertIdentity = true 
)

Check each field or ring operation.

Test various field operations

F - Field over which to perform computations title - String to use as the descriptive title of this test fieldp - use true if inv and div must work for all nonzero denominators

Return true on success and false on failure

Todo:
untested so far :
  • ostream &write (ostream &os) const
  • istream &read (istream &is)
  • ostream &write (ostream &os, const Element &x) const
  • istream &read (istream &is, Element &x) const
  • FieldArchetype (FieldAbstract*, ElementAbstract*, RandIterAbstract* = 0)

◆ testRandomIterator()

bool testRandomIterator ( const Field &  F,
const char *  text,
unsigned int  num_trials,
unsigned int  num_categories,
unsigned int  hist_len 
)

Random number test.

Test that the random iterator over the given field works.

Test up to two times, accepting either one, to reduce probability of failing statistical tests.