linbox  1
UnparametricRandIter< K > Class Template Reference

#include <unparametric.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.

 UnparametricRandIter (void)
 Default constructor.
class RR.

Rational number field. This field is provided as a convenience in a few places. Use with caution because expression swell.

This specialization allows the UnparametricField} template class to be used to wrap NTL's RR class as a LinBox field.

template<>
NTL::RR & random (NTL::RR &elt) const

Common Object Interface.

These methods are required of all LinBox random field element generators.

typedef K Element
 UnparametricRandIter (const UnparametricField< K > &F, const integer &size=0, const integer &seed=0)
 UnparametricRandIter (const UnparametricRandIter &R)
 ~UnparametricRandIter (void)
UnparametricRandIteroperator= (const UnparametricRandIter &R)
Elementrandom (Element &x) const

Detailed Description

template<class K>
class LinBox::UnparametricRandIter< K >

Unparameterized random field element generator template. Implements LinBox random field element generator common object interface for unparameterized fields. Used to generate efficient field classes for unparameterized fields. Constructs LinBox unparameterized random field element generators from field types K. In particular, constructs LinBox random field element generators for unparameterized fields from field types that adhere to the operations for double, for example UnparametricRandIter< float >. Can be used as a pattern to write a particular field interface, such as, UnparametricRandIter< SaclibQ > as a template specialization. This implementation uses the standard C++ random number generator. Thus, only one random field element generator can be used at a time since creating a new one will re-seed the built-in generator and affect all current LinBox generators.

Parameters:
Kunparameterized field class

Member Typedef Documentation

typedef K Element

Field element type. The field element must contain a default constructor, a copy constructor, a destructor, and an assignment operator.


Constructor & Destructor Documentation

UnparametricRandIter ( const UnparametricField< K > &  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. This implementation sets the sampling size to be no more than the cardinality of the field.

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)
UnparametricRandIter ( const UnparametricRandIter< K > &  R) [inline]

Copy constructor. Constructs UnparametricRandIter 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:
RUnparametricRandIter object.
~UnparametricRandIter ( void  ) [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.


Member Function Documentation

UnparametricRandIter& operator= ( const UnparametricRandIter< K > &  R) [inline]

Assignment operator. Assigns UnparametricRandIter object R to generator. In this implementation, this means copying the generator to which R._randIter_ptr points.

Parameters:
RUnparametricRandIter object.
Element& random ( Element x) const [inline]

Random field element creator. This returns a random field element from the information supplied at the creation of the generator.

Returns:
random field element
NTL::RR & random ( NTL::RR &  elt) const

Random field element creator. This returns a random field element from the information supplied at the creation of the generator. This generator uses the built-in C++ random number generator instead of NTL's random function because the NTL function does not allow as much control over the sampling size as the generic LinBox template. This specialization is included only to allow conversion to an NTL object.

Returns:
random field element

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