Class RealSingleRootFinder
- java.lang.Object
-
- com.opengamma.strata.math.impl.rootfinding.RealSingleRootFinder
-
- All Implemented Interfaces:
SingleRootFinder<Double,Double>
- Direct Known Subclasses:
BisectionSingleRootFinder
,BrentSingleRootFinder
,NewtonRaphsonSingleRootFinder
,RidderSingleRootFinder
public abstract class RealSingleRootFinder extends Object implements SingleRootFinder<Double,Double>
Parent class for root-finders that find a single real root $x$ for a function $f(x)$.
-
-
Constructor Summary
Constructors Constructor Description RealSingleRootFinder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkInputs(DoubleFunction1D function, Double x1, Double x2)
Tests that the inputs to the root-finder are not null, and that a root is bracketed by the bounding values.protected void
checkInputs(Function<Double,Double> function, Double x1, Double x2)
Tests that the inputs to the root-finder are not null, and that a root is bracketed by the bounding values.Double
getRoot(Function<Double,Double> function, Double... startingPoints)
Finds the root.abstract Double
getRoot(Function<Double,Double> function, Double x1, Double x2)
-
-
-
Method Detail
-
getRoot
public Double getRoot(Function<Double,Double> function, Double... startingPoints)
Description copied from interface:SingleRootFinder
Finds the root.- Specified by:
getRoot
in interfaceSingleRootFinder<Double,Double>
- Parameters:
function
- the function, not nullstartingPoints
- the roots, not null- Returns:
- a root lying between x1 and x2
-
checkInputs
protected void checkInputs(Function<Double,Double> function, Double x1, Double x2)
Tests that the inputs to the root-finder are not null, and that a root is bracketed by the bounding values.- Parameters:
function
- The function, not nullx1
- The first bound, not nullx2
- The second bound, not null, must be greater than x1- Throws:
IllegalArgumentException
- if x1 and x2 do not bracket a root
-
checkInputs
protected void checkInputs(DoubleFunction1D function, Double x1, Double x2)
Tests that the inputs to the root-finder are not null, and that a root is bracketed by the bounding values.- Parameters:
function
- The function, not nullx1
- The first bound, not nullx2
- The second bound, not null, must be greater than x1- Throws:
IllegalArgumentException
- if x1 and x2 do not bracket a root
-
-