My Project
cf_reval.cc
Go to the documentation of this file.
1 /* emacs edit mode for this file is -*- C++ -*- */
2 
3 #define MORE_ZEROES
4 
5 
6 #include "config.h"
7 
8 
9 #include "cf_assert.h"
10 
11 #include "cf_defs.h"
12 #include "cf_reval.h"
13 
14 
16 {
17  if ( e.gen == 0 )
18  gen = 0;
19  else
20  gen = e.gen->clone();
21  values = e.values;
22 }
23 
25 {
26  if ( gen != 0 )
27  delete gen;
28 }
29 
32 {
33  if ( this != &e ) {
34  if (gen!=0)
35  delete gen;
36  values = e.values;
37  if ( e.gen == 0 )
38  gen = 0;
39  else
40  gen = e.gen->clone();
41  }
42  return *this;
43 }
44 
45 void
47 {
48  int n = values.max();
49  for ( int i = values.min(); i <= n; i++ )
50  values[i] = gen->generate();
51 }
52 
53 void
55 {
56  int m= values.max();
57  int t= values.min();
58  for (int i= t; i <= m; i++)
59  values [i]= 0;
60 
61  if (m == t)
62  {
63  values [t]= gen->generate();
64  return;
65  }
66  for (int i= 0; i < n; i++)
67  {
68  int l= factoryrandom (m - t + 1) + t;
69  values [l]= gen->generate();
70  }
71 }
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
assertions for Factory
factory switches.
int factoryrandom(int n)
random integers with abs less than n
Definition: cf_random.cc:180
generate random evaluation points
int max() const
Definition: ftmpl_array.cc:104
int min() const
Definition: ftmpl_array.cc:98
virtual CanonicalForm generate() const
Definition: cf_random.h:24
virtual CFRandom * clone() const
Definition: cf_random.h:25
class to evaluate a polynomial at points
Definition: cf_eval.h:32
CFArray values
Definition: cf_eval.h:34
class to generate random evaluation points
Definition: cf_reval.h:26
CFRandom * gen
Definition: cf_reval.h:28
~REvaluation()
Definition: cf_reval.cc:24
REvaluation()
Definition: cf_reval.h:30
void nextpoint()
Definition: cf_reval.cc:46
REvaluation & operator=(const REvaluation &e)
Definition: cf_reval.cc:31