SimpleEquationSolver Class Reference

Simple algorithm to solve the equation f==0 over a box. More...

#include <sampling.h>

Inheritance diagram for SimpleEquationSolver:
Inheritance graph
[legend]
Collaboration diagram for SimpleEquationSolver:
Collaboration graph
[legend]

List of all members.

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 Funcf
const UserVector< double > & lower
const UserVector< double > & upper
int bisection_iter_max

Detailed Description

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.

Parameters:
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.


Constructor & Destructor Documentation

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.


Member Function Documentation

int SimpleEquationSolver::run ( const dvector start,
double  val,
dvector dir 
) [private]

Determines point at other extreme of box and tries bisections-algorithm, to find zero between them.

Parameters:
start Starting point.
val Value at starting point.
dir The direction.
Returns:
0, if we found a zero; 1, if functions values of current point and point at other side of the box have the same sign; 2, if we got a nan in the gradient or as function value; 3, if the iteration limit of the bisection method was reached; 4, if we couldn't compute an initial steplength
int SimpleEquationSolver::solve ( dvector x  )  [virtual]

Solves the problem for a starting point.

Sets sol_point to x. Calls solve().

Parameters:
x The dvector to start the solver with.
See also:
solve()

Reimplemented from Solver.

int SimpleEquationSolver::solve (  )  [inline, virtual]

Solves the problem.

Abstract.

Returns:
A status code: 0, if all went right.
See also:
solve(dvector&)

Implements Solver.

Definition at line 205 of file sampling.h.


Member Data Documentation

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.

Definition at line 185 of file sampling.h.


The documentation for this class was generated from the following file:

Generated on 10 Mar 2013 for LaGO by  doxygen 1.6.1