Class SymmetricGradientEstimator

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

public class SymmetricGradientEstimator 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 accurate although slower than GradientEstimator.
  • Field Details

    • xh1

      private double[] xh1
      Internal array containing one point to sample close to the original one.
    • xh2

      private double[] xh2
      Internal array containing one point to sample close to the original one.
  • Constructor Details

    • SymmetricGradientEstimator

      public SymmetricGradientEstimator(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.