Package com.irurueta.numerical
Class SavitzkyGolayGradientEstimator
java.lang.Object
com.irurueta.numerical.GradientEstimator
com.irurueta.numerical.SavitzkyGolayGradientEstimator
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 robust against small discontinuities than
SymmetricGradientEstimator, but it is also slower to compute.
This method interpolates the sampled function values into a polynomial of
2nd degree (parabolic) on each direction, whose derivative is known.
Because a linear system of equations has to be solved to determine such
polynomials, this method might be less accurate when large values are
involved due to limited machine precision.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Number of required point to evaluate to compute derivative.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
-
N_POINTS
public static final int N_POINTSNumber of required point to evaluate to compute derivative.- See Also:
-
-
Constructor Details
-
SavitzkyGolayGradientEstimator
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.
-