Package smile.util.function
Interface Function
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
DifferentiableFunction
,DotProductKernel
,IsotropicKernel
,RadialBasisFunction
,Variogram
- All Known Implementing Classes:
BinarySparseGaussianKernel
,BinarySparseHyperbolicTangentKernel
,BinarySparseLaplacianKernel
,BinarySparseLinearKernel
,BinarySparseMaternKernel
,BinarySparsePolynomialKernel
,BinarySparseThinPlateSplineKernel
,Exp
,ExponentialVariogram
,Gaussian
,GaussianKernel
,GaussianRadialBasis
,GaussianVariogram
,HyperbolicTangent
,HyperbolicTangentKernel
,InverseMultiquadricRadialBasis
,Kurtosis
,Laplacian
,LaplacianKernel
,LinearKernel
,LogCosh
,Matern
,MaternKernel
,MultiquadricRadialBasis
,Polynomial
,PolynomialKernel
,PowerVariogram
,Scaler
,SparseGaussianKernel
,SparseHyperbolicTangentKernel
,SparseLaplacianKernel
,SparseLinearKernel
,SparseMaternKernel
,SparsePolynomialKernel
,SparseThinPlateSplineKernel
,SphericalVariogram
,ThinPlateRadialBasis
,ThinPlateSpline
,ThinPlateSplineKernel
An interface representing a univariate real function.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault double
apply
(double x) Computes the value of the function at x.double
f
(double x) Computes the value of the function at x.default double
inv
(double x) Computes the value of the inverse function at x.default double
root
(double x1, double x2, double tol, int maxIter) Brent's method for root-finding.
-
Field Details
-
logger
static final org.slf4j.Logger loggerLogging facility.
-
-
Method Details
-
f
double f(double x) Computes the value of the function at x.- Parameters:
x
- a real number.- Returns:
- the function value.
-
inv
default double inv(double x) Computes the value of the inverse function at x.- Parameters:
x
- a real number.- Returns:
- the inverse function value.
-
apply
default double apply(double x) Computes the value of the function at x. It delegates the computation to f(). This is simply for Scala convenience.- Parameters:
x
- a real number.- Returns:
- the function value.
-
root
default double root(double x1, double x2, double tol, int maxIter) Brent's method for root-finding. It combines the bisection method, the secant method and inverse quadratic interpolation. It has the reliability of bisection, but it can be as quick as some of the less-reliable methods. The algorithm tries to use the potentially fast-converging secant method or inverse quadratic interpolation if possible, but it falls back to the more robust bisection method if necessary.The method is guaranteed to converge as long as the function can be evaluated within the initial interval known to contain a root.
- Parameters:
x1
- the left end of search interval.x2
- the right end of search interval.tol
- the desired accuracy (convergence tolerance).maxIter
- the maximum number of iterations.- Returns:
- the root.
-