Package org.ddogleg.optimization.lm
Class UnconLeastSqLevenbergMarquardt_F64<S extends DMatrix>
java.lang.Object
org.ddogleg.optimization.GaussNewtonBase_F64<ConfigLevenbergMarquardt,HM>
org.ddogleg.optimization.lm.LevenbergMarquardt_F64<S,HessianLeastSquares<S>>
org.ddogleg.optimization.lm.UnconLeastSqLevenbergMarquardt_F64<S>
- All Implemented Interfaces:
Serializable
,IterativeOptimization
,UnconstrainedLeastSquares<S>
public class UnconLeastSqLevenbergMarquardt_F64<S extends DMatrix>
extends LevenbergMarquardt_F64<S,HessianLeastSquares<S>>
implements UnconstrainedLeastSquares<S>
Implementation of
LevenbergMarquardt_F64
for UnconstrainedLeastSquares
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ddogleg.optimization.GaussNewtonBase_F64
GaussNewtonBase_F64.Mode
-
Field Summary
Fields inherited from class org.ddogleg.optimization.lm.LevenbergMarquardt_F64
diagOrig, diagStep, lambda, math, MAX_LAMBDA, nu, residuals
Fields inherited from class org.ddogleg.optimization.GaussNewtonBase_F64
config, ftest_val, fx, gradient, gtest_val, hessian, hessianScaling, mode, p, sameStateAsCost, totalFullSteps, totalSelectSteps, verbose, verboseLevel, x, x_next
-
Constructor Summary
ConstructorDescriptionUnconLeastSqLevenbergMarquardt_F64
(MatrixMath<S> math, HessianLeastSquares<S> hessian) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
computeResiduals
(DMatrixRMaj x, DMatrixRMaj residuals) Computes the residuals at state 'x'protected void
functionGradientHessian
(DMatrixRMaj x, boolean sameStateAsResiduals, DMatrixRMaj gradient, HessianLeastSquares<S> hessian) Computes the gradient and Hessian at 'x'.double
Returns the value of the objective function being evaluated at the current parameters value.double[]
After each iteration this function can be called to get the current best set of parameters.void
initialize
(double[] initial, double ftol, double gtol) Specify the initial set of parameters from which to start from.boolean
Indicates if iteration stopped due to convergence or not.boolean
True if the parameter(s) being optimized have been updatedvoid
setFunction
(FunctionNtoM function, @Nullable FunctionNtoMxN<S> jacobian) Specifies a set of functions and their Jacobian.Methods inherited from class org.ddogleg.optimization.lm.LevenbergMarquardt_F64
checkConvergenceFTest, computeStep, computeStep, configure, costFromResiduals, initialize, maximumLambdaNu, updateDerivates
Methods inherited from class org.ddogleg.optimization.GaussNewtonBase_F64
applyHessianScaling, checkConvergenceGTest, computeHessianScaling, computeHessianScaling, computePredictedReduction, initialize, iterate, mode, setVerbose, undoHessianScalingOnParameters
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ddogleg.optimization.IterativeOptimization
iterate, setVerbose
-
Field Details
-
functionResiduals
-
functionJacobian
-
-
Constructor Details
-
UnconLeastSqLevenbergMarquardt_F64
-
-
Method Details
-
setFunction
Description copied from interface:UnconstrainedLeastSquares
Specifies a set of functions and their Jacobian. See class description for documentation on output data format.- Specified by:
setFunction
in interfaceUnconstrainedLeastSquares<S extends DMatrix>
- Parameters:
function
- Computes the output of M functions fi(x) which take in N fit parameters as input.jacobian
- Computes the Jacobian of the M functions. If null a numerical Jacobian will be used.
-
initialize
public void initialize(double[] initial, double ftol, double gtol) Description copied from interface:UnconstrainedLeastSquares
Specify the initial set of parameters from which to start from. Call afterUnconstrainedLeastSquares.setFunction(org.ddogleg.optimization.functions.FunctionNtoM, org.ddogleg.optimization.functions.FunctionNtoMxN<S>)
has been called.- Specified by:
initialize
in interfaceUnconstrainedLeastSquares<S extends DMatrix>
- Parameters:
initial
- Initial parameters or guess with N elements..ftol
- Relative threshold for change in function value between iterations. 0 ≤ ftol ≤ 1. Try 1e-12gtol
- Absolute threshold for convergence based on the gradient's norm. 0 disables test. 0 ≤ gtol. Try 1e-12
-
getParameters
public double[] getParameters()Description copied from interface:UnconstrainedLeastSquares
After each iteration this function can be called to get the current best set of parameters.- Specified by:
getParameters
in interfaceUnconstrainedLeastSquares<S extends DMatrix>
-
getFunctionValue
public double getFunctionValue()Description copied from interface:UnconstrainedLeastSquares
Returns the value of the objective function being evaluated at the current parameters value. If not supported then an exception is thrown.- Specified by:
getFunctionValue
in interfaceUnconstrainedLeastSquares<S extends DMatrix>
- Returns:
- Objective function's value.
-
isUpdated
public boolean isUpdated()Description copied from interface:IterativeOptimization
True if the parameter(s) being optimized have been updated- Specified by:
isUpdated
in interfaceIterativeOptimization
- Returns:
- True if parameters have been updated
-
isConverged
public boolean isConverged()Description copied from interface:IterativeOptimization
Indicates if iteration stopped due to convergence or not.- Specified by:
isConverged
in interfaceIterativeOptimization
- Returns:
- True if iteration stopped because it converged.
-
functionGradientHessian
protected void functionGradientHessian(DMatrixRMaj x, boolean sameStateAsResiduals, DMatrixRMaj gradient, HessianLeastSquares<S> hessian) Description copied from class:GaussNewtonBase_F64
Computes the gradient and Hessian at 'x'. If sameStateAsCost is true then it can be assumed that 'x' has not changed since the cost was last computed.- Specified by:
functionGradientHessian
in classGaussNewtonBase_F64<ConfigLevenbergMarquardt,
HessianLeastSquares<S extends DMatrix>> sameStateAsResiduals
- (Input) If true then when the cost (or residuals) was last called it had the same value of xgradient
- (Input) xhessian
- (Output) hessian
-
computeResiduals
Description copied from class:LevenbergMarquardt_F64
Computes the residuals at state 'x'- Specified by:
computeResiduals
in classLevenbergMarquardt_F64<S extends DMatrix,
HessianLeastSquares<S extends DMatrix>> - Parameters:
x
- (Input) stateresiduals
- (Output) residuals F(x) - Y
-