cf_eval.cc
Go to the documentation of this file.
1 /* emacs edit mode for this file is -*- C++ -*- */
2 
3 
4 #include "config.h"
5 
6 
7 #include "cf_assert.h"
8 
9 #include "cf_defs.h"
10 #include "cf_eval.h"
11 
12 static CanonicalForm evalCF ( const CanonicalForm & f, const CFArray & a, int m, int n );
13 
14 
16 {
17  if ( this != &e ) {
18  values = e.values;
19  }
20  return *this;
21 }
22 
25 {
26  if ( f.inCoeffDomain() || f.level() < values.min() )
27  return f;
28  else if ( f.level() < values.max() )
29  return evalCF( f, values, values.min(), f.level() );
30  else
31  return evalCF( f, values, values.min(), values.max() );
32 }
33 
35 Evaluation::operator() ( const CanonicalForm & f, int i, int j ) const
36 {
37  if ( i > j )
38  return f;
39  return evalCF( f, values, i, j );
40 }
41 
42 void
44 {
45  int n = values.max();
46  for ( int i = values.min(); i <= n; i++ )
47  values[i] += 1;
48 }
49 
50 void
52 {
53  if (i < values.min() || i > values.max())
54  return;
55  values[i]= f;
56 }
57 
58 #ifndef NOSTREAMIO
59 OSTREAM&
61 {
62  e.values.print(s);
63  return s;
64 }
65 #endif /* NOSTREAMIO */
66 
68 evalCF ( const CanonicalForm & f, const CFArray & a, int m, int n )
69 {
70  if ( m > n )
71  return f;
72  else {
74  while ( n >= m ) {
75  result = result( a[n], Variable( n ) );
76  n--;
77  }
78  return result;
79  }
80 // iterated method turned out to be faster than
81 // return evalCF( f( a[n], Variable( n ) ), a, m, n-1 );
82 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static CanonicalForm evalCF(const CanonicalForm &f, const CFArray &a, int m, int n)
Definition: cf_eval.cc:68
const poly a
Definition: syzextra.cc:212
virtual void nextpoint()
Definition: cf_eval.cc:43
factory&#39;s class for variables
Definition: factory.h:115
CanonicalForm operator()(const CanonicalForm &f) const
Definition: cf_eval.cc:24
factory&#39;s main class
Definition: canonicalform.h:75
assertions for Factory
void print(OSTREAM &) const
Definition: ftmpl_array.cc:138
int min() const
Definition: ftmpl_array.cc:98
friend OSTREAM & operator<<(OSTREAM &s, const Evaluation &e)
Definition: cf_eval.cc:60
Evaluation & operator=(const Evaluation &e)
Definition: cf_eval.cc:15
int max() const
Definition: ftmpl_array.cc:104
CFArray values
Definition: cf_eval.h:34
int j
Definition: myNF.cc:70
void setValue(int i, const CanonicalForm &f)
Definition: cf_eval.cc:51
int m
Definition: cfEzgcd.cc:119
FILE * f
Definition: checklibs.c:9
int i
Definition: cfEzgcd.cc:123
factory switches.
class to evaluate a polynomial at points
Definition: cf_eval.h:31
#define OSTREAM
Definition: canonicalform.h:16
int level() const
level() returns the level of CO.
return result
Definition: facAbsBiFact.cc:76
evaluate polynomials at points
bool inCoeffDomain() const