1#ifndef MODELFUNCTION_HH
2#define MODELFUNCTION_HH
6#include "istl/matrix.hh"
9#include "dune/common/fmatrix.hh"
28virtual void update(
double abscissa,
double value) {
data = std::make_pair(abscissa,value);
modified=
true; }
34 virtual double getIntegral(
double high,
double low) { assert(!
"Computation of integrals not implemented");
return 0.0; }
37 virtual double getAbscissa(
double value) { assert(!
"Computation of abscissa not implemented");
return 0.0; }
72 for(
int i=0; i<=
degree; ++i)
96 int startdata=enddata-rows;
98 if(rows==0 || cols==0)
return;
101 std::vector<double> b(rows), x(cols);
102 for(
int i=0; i<rows; ++i)
106 for(
int j=0; j<cols; ++j)
140 virtual double valFwd(
double v) {
return v;}
141 virtual double valBwd(
double v) {
return v;}
164 assert(a>-1.0 || high*low > 0);
165 return b/(1+a)*(std::pow(high,1+a)-std::pow(low,1+a));
169 virtual double abscFwd(
double a) { assert(a>0);
return std::log(a); }
170 virtual double abscBwd(
double a) {
return std::exp(a); }
171 virtual double valFwd(
double v) { assert(v>0);
return std::log(v); }
172 virtual double valBwd(
double v) {
return std::exp(v); }
Interfaces for function space oriented algorithms.
virtual void computeCoefficients()
virtual void update(double abscissa, double value)
Add new value to the sample points, will be overwritten by the next update, until fixUpdate() is call...
virtual double getDataVal(int i)
virtual double getDataAbsc(int i)
virtual void computeCoefficients()
virtual double getScaling(int i)
Polynomial model in a loglog scale.
virtual double abscBwd(double a)
virtual double abscFwd(double a)
LogLogModel(std::vector< double > defaults)
virtual double valFwd(double v)
virtual double valBwd(double v)
virtual double getIntegral(double high, double low)
Compute integral of the model function from low to high.
Class that represents a quantity that can be logged during the course of an algortihm.
int size()
Get size of log buffer.
bool isValid()
Returns true, iff there is a valid current value.
void logValue()
Insert current value into log buffer.
virtual void computeCoefficients()
double getAbscissa(double value)
Compute abscissa corresponding to a value. This is of course only possible for monotone functions.
std::vector< double > coefficients
std::vector< double > const & getCoefficients()
PolynomialModel(std::vector< double > defaults)
virtual void computeCoefficients()
PolynomialModel(int degree_, int maxels_=10000000)
virtual double getValue(double abscissa)
Compute value of the model function at abscissa.
Interface for a scalar model function on a scalar domain that may fit data.
virtual void fixUpdate()
fix the last updated value and thus increase the number of sampling points
virtual void update(double abscissa, double value)
Add new value to the sample points, will be overwritten by the next update, until fixUpdate() is call...
LoggedQuantity< std::pair< double, double > > data
virtual ~ScalarModelFunction()
virtual double getAbscissa(double value)
Compute abscissa corresponding to a value. This is of course only possible for monotone functions.
virtual double getDataAbsc(int i)
virtual double getValue(double abscissa)=0
Compute value of the model function at abscissa.
void setDataStart(int ds)
virtual double getScaling(int i)
virtual double getIntegral(double high, double low)
Compute integral of the model function from low to high.
virtual double getDataVal(int i)
Dune::FieldVector< T, n > min(Dune::FieldVector< T, n > x, Dune::FieldVector< T, n > const &y)
Componentwise minimum.
void LeastSquares(SLAPMatrix< double > a, std::vector< double > const &b, std::vector< double > &x)
Solve linear least squares problem, given by a*x=b.
Simple interface to acml (AMD Core Math Library), to be augmented.