Class BaseNewtonVectorRootFinder
- java.lang.Object
-
- com.opengamma.strata.math.impl.rootfinding.VectorRootFinder
-
- com.opengamma.strata.math.impl.rootfinding.newton.BaseNewtonVectorRootFinder
-
- All Implemented Interfaces:
SingleRootFinder<DoubleArray,DoubleArray>
,NewtonVectorRootFinder
- Direct Known Subclasses:
BroydenVectorRootFinder
,NewtonDefaultVectorRootFinder
,ShermanMorrisonVectorRootFinder
public class BaseNewtonVectorRootFinder extends VectorRootFinder implements NewtonVectorRootFinder
Base implementation for all Newton-Raphson style multi-dimensional root finding (i.e. using the Jacobian matrix as a basis for some iterative process)
-
-
Constructor Summary
Constructors Constructor Description BaseNewtonVectorRootFinder(double absoluteTol, double relativeTol, int maxSteps, NewtonRootFinderDirectionFunction directionFunction, NewtonRootFinderMatrixInitializationFunction initializationFunction, NewtonRootFinderMatrixUpdateFunction updateFunction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DoubleArray
findRoot(Function<DoubleArray,DoubleArray> function, DoubleArray startPosition)
Finds the root from the specified start position.DoubleArray
findRoot(Function<DoubleArray,DoubleArray> function, Function<DoubleArray,DoubleMatrix> jacobianFunction, DoubleArray startPosition)
Finds the root from the specified start position.DoubleArray
getRoot(Function<DoubleArray,DoubleArray> function, DoubleArray startPosition)
protected void
updatePosition(DoubleArray p, Function<DoubleArray,DoubleArray> function, com.opengamma.strata.math.impl.rootfinding.newton.BaseNewtonVectorRootFinder.DataBundle data)
-
Methods inherited from class com.opengamma.strata.math.impl.rootfinding.VectorRootFinder
checkInputsAndApplyFunction, getRoot
-
-
-
-
Constructor Detail
-
BaseNewtonVectorRootFinder
public BaseNewtonVectorRootFinder(double absoluteTol, double relativeTol, int maxSteps, NewtonRootFinderDirectionFunction directionFunction, NewtonRootFinderMatrixInitializationFunction initializationFunction, NewtonRootFinderMatrixUpdateFunction updateFunction)
-
-
Method Detail
-
getRoot
public DoubleArray getRoot(Function<DoubleArray,DoubleArray> function, DoubleArray startPosition)
- Specified by:
getRoot
in classVectorRootFinder
- Parameters:
function
- The (vector) function, not nullstartPosition
- The starting point, not null- Returns:
- The vector root of this function
-
findRoot
public DoubleArray findRoot(Function<DoubleArray,DoubleArray> function, DoubleArray startPosition)
Description copied from interface:NewtonVectorRootFinder
Finds the root from the specified start position.This applies the specified function to find the root. Note if multiple roots exist which one is found will depend on the start position.
- Specified by:
findRoot
in interfaceNewtonVectorRootFinder
- Parameters:
function
- the vector functionstartPosition
- the start position of the root finder for- Returns:
- the vector root of the collection of functions
-
findRoot
public DoubleArray findRoot(Function<DoubleArray,DoubleArray> function, Function<DoubleArray,DoubleMatrix> jacobianFunction, DoubleArray startPosition)
Description copied from interface:NewtonVectorRootFinder
Finds the root from the specified start position.This applies the specified function and Jacobian function to find the root. Note if multiple roots exist which one is found will depend on the start position.
- Specified by:
findRoot
in interfaceNewtonVectorRootFinder
- Parameters:
function
- the vector functionjacobianFunction
- the function to calculate the JacobianstartPosition
- the start position of the root finder for- Returns:
- the vector root of the collection of functions
-
updatePosition
protected void updatePosition(DoubleArray p, Function<DoubleArray,DoubleArray> function, com.opengamma.strata.math.impl.rootfinding.newton.BaseNewtonVectorRootFinder.DataBundle data)
-
-