linbox  1
RandIterArchetype Class Reference

Random field element generator archetype. More...

#include <archetype.h>

List of all members.

Public Member Functions

Implementation-Specific Methods.

These methods are not required of all {LinBox Random field element generators} and are included only for this implementation of the archetype.

 RandIterArchetype (RandIterAbstract *randIter_ptr)

Common Object Interface.

These methods are required of all {LinBox} field element generators.

typedef ElementArchetype Element
 element type
 RandIterArchetype (const FieldArchetype &F, const integer &size=0, const integer &seed=0)
 RandIterArchetype (const RandIterArchetype &R)
template<class Field_qcq >
 RandIterArchetype (Field_qcq *f, const integer &size=0, const integer &seed=0)
 ~RandIterArchetype ()
RandIterArchetypeoperator= (const RandIterArchetype &R)
Elementrandom (Element &a) const

Additional Inherited Members


Detailed Description

Random field element generator archetype.

This encapsulated class is a generator of random field 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 element. In this operator (), the random element is placed into the input field element and also returned as a reference.


Constructor & Destructor Documentation

RandIterArchetype ( const FieldArchetype 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. In this implementation, this means copying the field to which { F._field_ptr} points, the element to which { F._elem_ptr} points, and the random element generator to which { F._randIter_ptr} points.

Parameters:
FLinBox field archetype object in which to do arithmetic
sizeconstant integer reference of sample size from which to sample (default = 0)
seedconstant integer reference from which to seed random number generator (default = 0)
RandIterArchetype ( const RandIterArchetype R)
inline

Copy constructor. Constructs RandIterArchetype object by copying the random field element generator. This is required to allow generator objects to be passed by value into functions. In this implementation, this means copying the random field element generator to which { R._randIter_ptr} points.

Parameters:
RRandIterArchetype object.
RandIterArchetype ( Field_qcq *  f,
const integer size = 0,
const integer seed = 0 
)
inline

Constructor. Constructs RandIterArchetype from ANYTHING matching the interface using the enveloppe as a {FieldAbstract} and its encapsulated element and random element generator if needed.

Parameters:
field_ptrpointer to field matching the interface
elem_ptrpointer to element matching the interface
randIter_ptrpointer to random matching the interface
~RandIterArchetype ( )
inline

Destructor.

This destructs the random field element generator object. In this implementation, this destroys the generator by deleting the random generator object to which { _randIter_ptr} points.

RandIterArchetype ( RandIterAbstract randIter_ptr)
inline

Constructor. Constructs field from pointer to {RandIterAbstract}. Not part of the interface. Creates new copies of random iterator generator object in dynamic memory.

Parameters:
randIter_ptrpointer to {RandIterAbstract}

Member Function Documentation

RandIterArchetype& operator= ( const RandIterArchetype R)
inline

Assignment operator.

Assigns RandIterArchetype object R to generator. In this implementation, this means copying the generator to which { R._randIter_ptr} points.

Parameters:
RRandIterArchetype 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.

Returns:
reference to random field element

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