Class SavitzkyGolayGradientEstimator

java.lang.Object
com.irurueta.numerical.GradientEstimator
com.irurueta.numerical.SavitzkyGolayGradientEstimator

public class SavitzkyGolayGradientEstimator extends GradientEstimator
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 Details

    • N_POINTS

      public static final int N_POINTS
      Number of required point to evaluate to compute derivative.
      See Also:
  • Constructor Details

    • SavitzkyGolayGradientEstimator

      public SavitzkyGolayGradientEstimator(MultiDimensionFunctionEvaluatorListener listener)
      Constructor.
      Parameters:
      listener - Listener to evaluate a multidimensional function.
  • Method Details

    • gradient

      public void gradient(double[] point, double[] result) throws EvaluationException
      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 class GradientEstimator
      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.