de.jstacs.algorithms.optimization
Class NumericalDifferentiableFunction
java.lang.Object
de.jstacs.algorithms.optimization.DifferentiableFunction
de.jstacs.algorithms.optimization.NumericalDifferentiableFunction
- All Implemented Interfaces:
- Function
public abstract class NumericalDifferentiableFunction
- extends DifferentiableFunction
This class is the framework for any numerical differentiable function
. The gradient is computed numerically. Each partial
differentiation is computed by the formula
.
- Author:
- Jens Keilwagen
Field Summary |
protected double |
eps
The constant used in the computation of the gradient. |
Method Summary |
double[] |
evaluateGradientOfFunction(double[] x)
Evaluates the gradient of a function at a certain vector (in mathematical
sense) x numerically. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
eps
protected double eps
- The constant used in the computation of the gradient. Should be close to
0 but not exactly 0.
NumericalDifferentiableFunction
public NumericalDifferentiableFunction(double epsilon)
throws IllegalArgumentException
- Sets the value for epsilon for this
NumericalDifferentiableFunction
.
- Parameters:
epsilon
- the epsilon used for the numerical differentiation
- Throws:
IllegalArgumentException
- if epsilon = 0
evaluateGradientOfFunction
public double[] evaluateGradientOfFunction(double[] x)
throws DimensionException,
EvaluationException
- Evaluates the gradient of a function at a certain vector (in mathematical
sense)
x
numerically.
- Specified by:
evaluateGradientOfFunction
in class DifferentiableFunction
- Parameters:
x
- the current vector
- Returns:
- the evaluation of the gradient of a function, has dimension
Function.getDimensionOfScope()
- Throws:
DimensionException
- if dim(x) != n
, with
EvaluationException
- if there was something wrong during the evaluation of the
gradient- See Also:
DifferentiableFunction.evaluateGradientOfFunction(double[])