## Class VectorFieldFirstOrderDifferentiator

• java.lang.Object
• com.opengamma.strata.math.impl.differentiation.VectorFieldFirstOrderDifferentiator
• All Implemented Interfaces:
Differentiator<DoubleArray,​DoubleArray,​DoubleMatrix>

public class VectorFieldFirstOrderDifferentiator
extends Object
implements Differentiator<DoubleArray,​DoubleArray,​DoubleMatrix>
Differentiates a vector field (i.e. there is a vector value for every point in some vector space) with respect to the vector space using finite difference.

For a function $\mathbf{y} = f(\mathbf{x})$ where $\mathbf{x}$ is a n-dimensional vector and $\mathbf{y}$ is a m-dimensional vector, this class produces the Jacobian function $\mathbf{J}(\mathbf{x})$, i.e. a function that returns the Jacobian for each point $\mathbf{x}$, where $\mathbf{J}$ is the $m \times n$ matrix $\frac{dy_i}{dx_j}$

• ### Constructor Summary

Constructors
Constructor Description
VectorFieldFirstOrderDifferentiator()
Creates an instance using the default value of eps (10-5) and central differencing type.
VectorFieldFirstOrderDifferentiator​(double eps)
Creates an instance using the central differencing type.
VectorFieldFirstOrderDifferentiator​(FiniteDifferenceType differenceType)
Creates an instance using the default value of eps (10-5).
VectorFieldFirstOrderDifferentiator​(FiniteDifferenceType differenceType, double eps)
Creates an instance.
• ### Method Summary

All Methods
Modifier and Type Method Description
Function<DoubleArray,​DoubleMatrix> differentiate​(Function<DoubleArray,​DoubleArray> function)
Provides a function that performs the differentiation.
Function<DoubleArray,​DoubleMatrix> differentiate​(Function<DoubleArray,​DoubleArray> function, Function<DoubleArray,​Boolean> domain)
Provides a function that performs the differentiation.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### VectorFieldFirstOrderDifferentiator

public VectorFieldFirstOrderDifferentiator()
Creates an instance using the default value of eps (10-5) and central differencing type.
• #### VectorFieldFirstOrderDifferentiator

public VectorFieldFirstOrderDifferentiator​(FiniteDifferenceType differenceType)
Creates an instance using the default value of eps (10-5).
Parameters:
differenceType - the differencing type to be used in calculating the gradient function
• #### VectorFieldFirstOrderDifferentiator

public VectorFieldFirstOrderDifferentiator​(double eps)
Creates an instance using the central differencing type.

If the size of the domain is very small or very large, consider re-scaling first. If this value is too small, the result will most likely be dominated by noise. Use around 10-5 times the domain size.

Parameters:
eps - the step size used to approximate the derivative
• #### VectorFieldFirstOrderDifferentiator

public VectorFieldFirstOrderDifferentiator​(FiniteDifferenceType differenceType,
double eps)
Creates an instance.

If the size of the domain is very small or very large, consider re-scaling first. If this value is too small, the result will most likely be dominated by noise. Use around 10-5 times the domain size.

Parameters:
differenceType - the differencing type to be used in calculating the gradient function
eps - the step size used to approximate the derivative
• ### Method Detail

• #### differentiate

public Function<DoubleArray,​DoubleMatrix> differentiate​(Function<DoubleArray,​DoubleArray> function)
Description copied from interface: Differentiator
Provides a function that performs the differentiation.
Specified by:
differentiate in interface Differentiator<DoubleArray,​DoubleArray,​DoubleMatrix>
Parameters:
function - a function for which to get the differential function
Returns:
a function that calculates the differential
• #### differentiate

public Function<DoubleArray,​DoubleMatrix> differentiate​(Function<DoubleArray,​DoubleArray> function,
Function<DoubleArray,​Boolean> domain)
Description copied from interface: Differentiator
Provides a function that performs the differentiation.
Specified by:
differentiate in interface Differentiator<DoubleArray,​DoubleArray,​DoubleMatrix>
Parameters:
function - a function for which to get the differential function
domain - a function that returns false if the requested value is not in the domain, true otherwise
Returns:
a function that calculates the differential