gov.sandia.cognition.math.matrix
Class NumericalDifferentiator<InputType,OutputType,DerivativeType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.math.matrix.NumericalDifferentiator<InputType,OutputType,DerivativeType>
Type Parameters:
InputType - Class of the input to the Evaluator
OutputType - Class of the output from the Evaluator
DerivativeType - Class of the derivative of the Evaluator
All Implemented Interfaces:
Evaluator<InputType,OutputType>, DifferentiableEvaluator<InputType,OutputType,DerivativeType>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
NumericalDifferentiator.DoubleJacobian, NumericalDifferentiator.MatrixJacobian, NumericalDifferentiator.VectorJacobian

@PublicationReference(author="Wikipedia",
                      title="Numerical differentiation",
                      type=WebPage,
                      url="http://en.wikipedia.org/wiki/Numerical_differentiation",
                      year=2008)
public abstract class NumericalDifferentiator<InputType,OutputType,DerivativeType>
extends AbstractCloneableSerializable
implements DifferentiableEvaluator<InputType,OutputType,DerivativeType>

Automatically differentiates a function by the method of forward differences.

Since:
2.1
Author:
Kevin R. Dixon
See Also:
Serialized Form

Nested Class Summary
static class NumericalDifferentiator.DoubleJacobian
          Numerical differentiator based on a Vector Jacobian.
static class NumericalDifferentiator.MatrixJacobian
          Numerical differentiator based on a Matrix Jacobian.
static class NumericalDifferentiator.VectorJacobian
          Numerical differentiator based on a Vector Jacobian.
 
Constructor Summary
NumericalDifferentiator(Evaluator<InputType,OutputType> internalFunction, double delta)
          Creates a new instance of NumericalDifferentiator
 
Method Summary
 NumericalDifferentiator<InputType,OutputType,DerivativeType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 OutputType evaluate(InputType input)
          Evaluates the function on the given input and returns the output.
 double getDelta()
          Getter for delta
 Evaluator<InputType,OutputType> getInternalFunction()
          Getter for internalFunction
 void setDelta(double delta)
          Setter for delta
 void setInternalFunction(Evaluator<InputType,OutputType> internalFunction)
          Setter for internalFunction
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.math.DifferentiableEvaluator
differentiate
 

Constructor Detail

NumericalDifferentiator

public NumericalDifferentiator(Evaluator<InputType,OutputType> internalFunction,
                               double delta)
Creates a new instance of NumericalDifferentiator

Parameters:
internalFunction - Internal function to numerically differencing.
delta - Value for x-value differencing, must be greater than 0.0
Method Detail

clone

public NumericalDifferentiator<InputType,OutputType,DerivativeType> clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the Object class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call super.clone() to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in ObjectUtil may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use super.clone() as the basis for your implementation.

Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

getInternalFunction

public Evaluator<InputType,OutputType> getInternalFunction()
Getter for internalFunction

Returns:
Internal function to numerically differencing.

setInternalFunction

public void setInternalFunction(Evaluator<InputType,OutputType> internalFunction)
Setter for internalFunction

Parameters:
internalFunction - Internal function to numerically differencing.

getDelta

public double getDelta()
Getter for delta

Returns:
Value for x-value differencing, must be greater than 0.0

setDelta

public void setDelta(double delta)
Setter for delta

Parameters:
delta - Value for x-value differencing, must be greater than 0.0

evaluate

public OutputType evaluate(InputType input)
Description copied from interface: Evaluator
Evaluates the function on the given input and returns the output.

Specified by:
evaluate in interface Evaluator<InputType,OutputType>
Parameters:
input - The input to evaluate.
Returns:
The output produced by evaluating the input.