Simple algorithm to solve the equation f==0 over a box. More...
#include <sampling.h>
Public Member Functions | |
SimpleEquationSolver (const Func &f_, const UserVector< double > &lower_, const UserVector< double > &upper_, Pointer< Param > param=NULL) | |
int | solve (dvector &start) |
Solves the problem for a starting point. | |
int | solve () |
Solves the problem. | |
Private Member Functions | |
int | run (const dvector &start, double val, dvector &dir) |
Determines point at other extreme of box and tries bisections-algorithm, to find zero between them. | |
Private Attributes | |
const Func & | f |
const UserVector< double > & | lower |
const UserVector< double > & | upper |
int | bisection_iter_max |
Simple algorithm to solve the equation f==0 over a box.
Starting from a point, finds the other extreme of the box towards gradient direction, and do bisection to find the zero inside the box.
SimpleEquationSolver | max iter options integer $ 0$ default 4 Maximum number of gradient steps. | |
SimpleEquationSolver | tolerance options double $ 0$ default 1E-4 Function value tolerance. If absolut value of point is <1E-4, we accept the point. | |
SimpleEquationSolver | bisection max iter options integer $ 0$ default 1000 Maximum number of iterations in bisection algorithm. |
Definition at line 179 of file sampling.h.
SimpleEquationSolver::SimpleEquationSolver | ( | const Func & | f_, | |
const UserVector< double > & | lower_, | |||
const UserVector< double > & | upper_, | |||
Pointer< Param > | param = NULL | |||
) | [inline] |
Definition at line 196 of file sampling.h.
Determines point at other extreme of box and tries bisections-algorithm, to find zero between them.
start | Starting point. | |
val | Value at starting point. | |
dir | The direction. |
int SimpleEquationSolver::solve | ( | dvector & | x | ) | [virtual] |
int SimpleEquationSolver::solve | ( | ) | [inline, virtual] |
Solves the problem.
Abstract.
Implements Solver.
Definition at line 205 of file sampling.h.
const Func& SimpleEquationSolver::f [private] |
Definition at line 181 of file sampling.h.
const UserVector<double>& SimpleEquationSolver::lower [private] |
Definition at line 182 of file sampling.h.
const UserVector<double>& SimpleEquationSolver::upper [private] |
Definition at line 183 of file sampling.h.
int SimpleEquationSolver::bisection_iter_max [private] |
Definition at line 185 of file sampling.h.