Loading...
Searching...
No Matches
cf_eval.cc
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#include "config.h"
#include "cf_assert.h"
#include "cf_defs.h"
#include "cf_eval.h"
static CanonicalForm evalCF ( const CanonicalForm & f, const CFArray & a, int m, int n );
Evaluation& Evaluation::operator= ( const Evaluation & e )
{
if ( this != &e ) {
values = e.values;
}
return *this;
}
CanonicalForm
Evaluation::operator() ( const CanonicalForm & f ) const
{
if ( f.inCoeffDomain() || f.level() < values.min() )
return f;
else if ( f.level() < values.max() )
return evalCF( f, values, values.min(), f.level() );
else
return evalCF( f, values, values.min(), values.max() );
}
CanonicalForm
Evaluation::operator() ( const CanonicalForm & f, int i, int j ) const
{
if ( i > j )
return f;
return evalCF( f, values, i, j );
}
void
Evaluation::nextpoint()
{
int n = values.max();
for ( int i = values.min(); i <= n; i++ )
values[i] += 1;
}
void
Evaluation::setValue(int i, const CanonicalForm& f)
{
if (i < values.min() || i > values.max())
return;
values[i]= f;
}
#ifndef NOSTREAMIO
OSTREAM&
operator<< ( OSTREAM& s, const Evaluation &e )
{
e.values.print(s);
return s;
}
#endif /* NOSTREAMIO */
CanonicalForm
evalCF ( const CanonicalForm & f, const CFArray & a, int m, int n )
{
if ( m > n )
return f;
else {
CanonicalForm result = f;
while ( n >= m ) {
result = result( a[n], Variable( n ) );
n--;
}
return result;
}
// iterated method turned out to be faster than
// return evalCF( f( a[n], Variable( n ) ), a, m, n-1 );
}
CFArray
Array< CanonicalForm > CFArray
Definition canonicalform.h:397
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.
evalCF
static CanonicalForm evalCF(const CanonicalForm &f, const CFArray &a, int m, int n)
Definition cf_eval.cc:68
operator<<
OSTREAM & operator<<(OSTREAM &s, const Evaluation &e)
Definition cf_eval.cc:60
cf_eval.h
evaluate polynomials at points
f
FILE * f
Definition checklibs.c:9
Array::print
void print(OSTREAM &) const
Definition ftmpl_array.cc:138
CanonicalForm
factory's main class
Definition canonicalform.h:86
Evaluation::setValue
void setValue(int i, const CanonicalForm &f)
Definition cf_eval.cc:51
Evaluation::values
CFArray values
Definition cf_eval.h:34
Evaluation::operator=
Evaluation & operator=(const Evaluation &e)
Definition cf_eval.cc:15
Evaluation::operator()
CanonicalForm operator()(const CanonicalForm &f) const
Definition cf_eval.cc:24
Evaluation::nextpoint
virtual void nextpoint()
Definition cf_eval.cc:43
Evaluation::Evaluation
Evaluation()
Definition cf_eval.h:36
Variable
factory's class for variables
Definition factory.h:127
result
return result
Definition facAbsBiFact.cc:76
s
const CanonicalForm int s
Definition facAbsFact.cc:51
j
int j
Definition facHensel.cc:110
OSTREAM
#define OSTREAM