Package com.irurueta.numerical
Class SymmetricGradientEstimator
java.lang.Object
com.irurueta.numerical.GradientEstimator
com.irurueta.numerical.SymmetricGradientEstimator
Class to estimate the gradient of a multidimensional function.
This class evaluates a function at very close locations of a given input
point in order to determine the gradient at such point
The algorithm used in this implementation is valid for continuous functions
only, otherwise inaccurate results might be obtained.
This implementation is more accurate although slower than
GradientEstimator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double[]
Internal array containing one point to sample close to the original one.private double[]
Internal array containing one point to sample close to the original one.Fields inherited from class com.irurueta.numerical.GradientEstimator
EPS, listener
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
gradient
(double[] point, double[] result) Sets estimated gradient in provided result array of a multidimensional function at provided point.Methods inherited from class com.irurueta.numerical.GradientEstimator
gradient
-
Field Details
-
xh1
private double[] xh1Internal array containing one point to sample close to the original one. -
xh2
private double[] xh2Internal array containing one point to sample close to the original one.
-
-
Constructor Details
-
SymmetricGradientEstimator
Constructor.- Parameters:
listener
- Listener to evaluate a multidimensional function.
-
-
Method Details
-
gradient
Sets estimated gradient in provided result array of a multidimensional function at provided point. This method is preferred respect to gradient(double[]) because result array can be reused and hence is more memory efficient.- Overrides:
gradient
in classGradientEstimator
- Parameters:
point
- Input point.result
- Output parameter containing estimated array. This parameter must be an array of length equal to point.- Throws:
EvaluationException
- Raised if function cannot be evaluated.IllegalArgumentException
- Raised if length of result and point are not equal.
-