linbox
Public Member Functions
ModularRandIter< Element > Class Template Reference

Random field base element generator. More...

#include <modular.h>

Public Member Functions

 ModularRandIter (const Modular< Element > &F, const integer &size=0, const integer &seed=0)
 Constructor from field, sampling size, and seed. More...
 
 ModularRandIter (const ModularRandIter< Element > &R)
 Copy constructor. More...
 
 ~ModularRandIter ()
 Destructor. More...
 
ModularRandIter< Element > & operator= (const ModularRandIter< Element > &R)
 Assignment operator. More...
 
Element & random (Element &a) const
 Random field element creator. More...
 
Element & nonzerorandom (Element &a) const
 Random field element creator. More...
 
ElementAbstractrandom (ElementAbstract &a) const
 Random field element creator. More...
 

Detailed Description

template<class Element>
class LinBox::ModularRandIter< Element >

Random field base element generator.

This encapsulated class is a generator of random field base elements for the encapsulating field. It is required to contain constructors from a field object and two integers. The first integer being a cardinality of a set to draw the random elements from, and the second being a seed for the random number generator. It is also required to contain a copy constructor, a destructor, and an operator () which acts on a reference to a field base element. In this operator (), the random element is placed into the input field base element and also returned as a reference.

Constructor & Destructor Documentation

ModularRandIter ( const Modular< Element > &  F,
const integer size = 0,
const integer seed = 0 
)
inline

Constructor from field, sampling size, and seed.

The random field element iterator works in the field F, is seeded by seed, and it returns any one element with probability no more than 1/min (size, F.cardinality (c)). A sampling size of zero means to sample from the entire field. A seed of zero means to use some arbitrary seed for the generator. Purely virtual.

Parameters
FLinBox field archetype object in which to do arithmetic
sizeconstant integer reference of sample size from which to sample (default = modulus of field)
seedconstant integer reference from which to seed random number generator (default is 0 and new seed is generated)
ModularRandIter ( const ModularRandIter< Element > &  R)
inline

Copy constructor.

Constructs ModularRandIter object by copying the random field element generator. This is required to allow generator objects to be passed by value into functions.

Parameters
RModularRandIter object.
~ModularRandIter ( )
inline

Destructor.

This destructs the random field element generator object.

Member Function Documentation

ModularRandIter<Element>& operator= ( const ModularRandIter< Element > &  R)
inline

Assignment operator.

Assigns ModularRandIter object R to generator.

Parameters
RModularRandIter object.
Element& random ( Element &  a) const
inline

Random field element creator.

This returns a random field element from the information supplied at the creation of the generator. Required by abstract base class.

Returns
reference to random field element
Element& nonzerorandom ( Element &  a) const
inline

Random field element creator.

This returns a random field element from the information supplied at the creation of the generator. Required by abstract base class.

Returns
reference to random field element
ElementAbstract& random ( ElementAbstract a) const
inline

Random field element creator.

This returns a random field element from the information supplied at the creation of the generator. Required by abstract base class.

Returns
reference to random field element

The documentation for this class was generated from the following files: