linbox
RandIterArchetype Class Reference

Random field element generator archetype. More...

#include <archetype.h>

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)
 Constructor. More...
 

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 uint64_t seed=0)
 Constructor from field, sampling size, and seed. More...
 
 RandIterArchetype (const RandIterArchetype &R)
 Copy constructor. More...
 
template<class Field_qcq >
 RandIterArchetype (Field_qcq *f, const integer &size=0, const uint64_t seed=0)
 Constructor. More...
 
 ~RandIterArchetype ()
 Destructor. More...
 
RandIterArchetypeoperator= (const RandIterArchetype &R)
 Assignment operator. More...
 
Elementrandom (Element &a) const
 Random field element creator. More...
 

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() [1/4]

RandIterArchetype ( const FieldArchetype F,
const integer size = 0,
const uint64_t  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() [2/4]

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() [3/4]

RandIterArchetype ( Field_qcq *  f,
const integer size = 0,
const uint64_t  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
f
size
seed

◆ ~RandIterArchetype()

~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() [4/4]

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

◆ operator=()

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.

◆ random()

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: