My Project
Loading...
Searching...
No Matches
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
12static 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
35Evaluation::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
42void
44{
45 int n = values.max();
46 for ( int i = values.min(); i <= n; i++ )
47 values[i] += 1;
48}
49
50void
52{
53 if (i < values.min() || i > values.max())
54 return;
55 values[i]= f;
56}
57
58#ifndef NOSTREAMIO
60operator<< ( OSTREAM& s, const Evaluation &e )
61{
62 e.values.print(s);
63 return s;
64}
65#endif /* NOSTREAMIO */
66
68evalCF ( 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}
#define OSTREAM
Definition: canonicalform.h:16
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
assertions for Factory
factory switches.
static CanonicalForm evalCF(const CanonicalForm &f, const CFArray &a, int m, int n)
Definition: cf_eval.cc:68
evaluate polynomials at points
FILE * f
Definition: checklibs.c:9
int max() const
Definition: ftmpl_array.cc:104
int min() const
Definition: ftmpl_array.cc:98
void print(OSTREAM &) const
Definition: ftmpl_array.cc:138
factory's main class
Definition: canonicalform.h:86
class to evaluate a polynomial at points
Definition: cf_eval.h:32
void setValue(int i, const CanonicalForm &f)
Definition: cf_eval.cc:51
CFArray values
Definition: cf_eval.h:34
Evaluation & operator=(const Evaluation &e)
Definition: cf_eval.cc:15
CanonicalForm operator()(const CanonicalForm &f) const
Definition: cf_eval.cc:24
virtual void nextpoint()
Definition: cf_eval.cc:43
factory's class for variables
Definition: variable.h:33
return result
Definition: facAbsBiFact.cc:75
const CanonicalForm int s
Definition: facAbsFact.cc:51
int j
Definition: facHensel.cc:110
ostream & operator<<(ostream &s, const spectrum &spec)
Definition: semic.cc:249