Class NumericalGradientForward

java.lang.Object
org.ddogleg.optimization.derivative.NumericalGradientForward
All Implemented Interfaces:
FunctionNtoN

public class NumericalGradientForward
extends Object
implements FunctionNtoN
Finite difference numerical gradient calculation using forward equation. Forward difference equation, f'(x) = f(x+h)-f(x)/h. Scaling is taken in account by h based upon the magnitude of the elements in variable x.

NOTE: If multiple input parameters are modified by the function when a single one is changed numerical derivatives aren't reliable.

  • Constructor Details

    • NumericalGradientForward

      public NumericalGradientForward​(FunctionNtoS function, double differenceScale)
    • NumericalGradientForward

      public NumericalGradientForward​(FunctionNtoS function)
  • Method Details

    • getN

      public int getN()
      Description copied from interface: FunctionNtoN
      Returns the number of inputs and outputs for this function.
      Specified by:
      getN in interface FunctionNtoN
    • process

      public void process​(double[] input, double[] output)
      Description copied from interface: FunctionNtoN
      Processes the function.
      Specified by:
      process in interface FunctionNtoN
      Parameters:
      input - Array with the inputs of length N. Not modified.
      output - Array for storing the output of length N. Modified.