org.nd4j.finitedifferences

## Class TwoPointApproximation

• java.lang.Object
• org.nd4j.finitedifferences.TwoPointApproximation

• ```public class TwoPointApproximation
extends java.lang.Object```
Simple 2 point finite difference approximation to compute the partial derivatives wrt the 2 given points based on: https://github.com/apache/commons-math/blob/master/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java
• ### Constructor Summary

Constructors
Constructor and Description
`TwoPointApproximation()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static INDArray[]` ```adjustSchemeToBounds(INDArray x, INDArray h, int numSteps, INDArray lowerBound, INDArray upperBound)```
Adjust final scheme to presence of bounds Returns (in this order): adjusted hypothesis, whether to use onesided as an int mask array
`static INDArray` ```approximateDerivative(Function<INDArray,INDArray> f, INDArray x, INDArray relStep, INDArray f0, INDArray bounds)```
`static INDArray` `computeAbsoluteStep(INDArray x)`
`static INDArray` ```computeAbsoluteStep(INDArray relStep, INDArray x)```
`static INDArray` ```denseDifference(Function<INDArray,INDArray> func, INDArray x0, INDArray f0, INDArray h, INDArray oneSided)```
`static double` `getEpsRelativeTo(INDArray data)`
`static INDArray[]` ```prepareBounds(INDArray bounds, INDArray x)```
Prepare the boundaries for processing
• ### Methods inherited from class java.lang.Object

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

• #### TwoPointApproximation

`public TwoPointApproximation()`
• ### Method Detail

• #### prepareBounds

```public static INDArray[] prepareBounds(INDArray bounds,
INDArray x)```
Prepare the boundaries for processing
Parameters:
`bounds` - the bounds
`x` - the input in to the approximation
Returns:
the lower and upper bounds as an array of ndarrays (in that order) of the same shape as x
• #### adjustSchemeToBounds

```public static INDArray[] adjustSchemeToBounds(INDArray x,
INDArray h,
int numSteps,
INDArray lowerBound,
INDArray upperBound)```
Adjust final scheme to presence of bounds Returns (in this order): adjusted hypothesis, whether to use onesided as an int mask array
Parameters:
`x` - the point to estimate the derivative
`h` - the finite difference steps
`numSteps` - Number of h steps in 1 direction to implement finite difference scheme.
`lowerBound` - Lower bounds for independent variable variable
`upperBound` - Upper bounds for independent variable
Returns:
• #### computeAbsoluteStep

`public static INDArray computeAbsoluteStep(INDArray x)`
Parameters:
`x` -
Returns:
• #### getEpsRelativeTo

`public static double getEpsRelativeTo(INDArray data)`
• #### computeAbsoluteStep

```public static INDArray computeAbsoluteStep(INDArray relStep,
INDArray x)```
Parameters:
`relStep` -
`x` -
Returns:
• #### approximateDerivative

```public static INDArray approximateDerivative(Function<INDArray,INDArray> f,
INDArray x,
INDArray relStep,
INDArray f0,
INDArray bounds)```
Parameters:
`f` -
`x` -
`relStep` -
`f0` -
`bounds` -
Returns:
• #### denseDifference

```public static INDArray denseDifference(Function<INDArray,INDArray> func,
INDArray x0,
INDArray f0,
INDArray h,
INDArray oneSided)```
Parameters:
`func` -
`x0` -
`f0` -
`h` -
`oneSided` -
Returns: