Loading...
Searching...
No Matches
cf_reval.cc
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#define MORE_ZEROES
#include "config.h"
#include "cf_assert.h"
#include "cf_defs.h"
#include "cf_reval.h"
REvaluation::REvaluation( const REvaluation & e ):Evaluation()
{
if ( e.gen == 0 )
gen = 0;
else
gen = e.gen->clone();
values = e.values;
}
REvaluation::~REvaluation()
{
if ( gen != 0 )
delete gen;
}
REvaluation&
REvaluation::operator= ( const REvaluation & e )
{
if ( this != &e ) {
if (gen!=0)
delete gen;
values = e.values;
if ( e.gen == 0 )
gen = 0;
else
gen = e.gen->clone();
}
return *this;
}
void
REvaluation::nextpoint()
{
int n = values.max();
for ( int i = values.min(); i <= n; i++ )
values[i] = gen->generate();
}
void
REvaluation::nextpoint (int n)
{
int m= values.max();
int t= values.min();
for (int i= t; i <= m; i++)
values [i]= 0;
if (m == t)
{
values [t]= gen->generate();
return;
}
for (int i= 0; i < n; i++)
{
int l= factoryrandom (m - t + 1) + t;
values [l]= gen->generate();
}
}
l
int l
Definition cfEzgcd.cc:100
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
cf_assert.h
assertions for Factory
cf_defs.h
factory switches.
cf_reval.h
generate random evaluation points
CFRandom::clone
virtual CFRandom * clone() const
Definition cf_random.h:25
Evaluation::values
CFArray values
Definition cf_eval.h:34
Evaluation::Evaluation
Evaluation()
Definition cf_eval.h:36
REvaluation
class to generate random evaluation points
Definition cf_reval.h:26
REvaluation::gen
CFRandom * gen
Definition cf_reval.h:28
REvaluation::~REvaluation
~REvaluation()
Definition cf_reval.cc:24
REvaluation::REvaluation
REvaluation()
Definition cf_reval.h:30
REvaluation::nextpoint
void nextpoint()
Definition cf_reval.cc:46
REvaluation::operator=
REvaluation & operator=(const REvaluation &e)
Definition cf_reval.cc:31
factoryrandom
int factoryrandom(int n)
random integers with abs less than n
Definition cf_random.cc:177