Package org.ddogleg.optimization.math
Class HessianSchurComplement_Base<S extends DMatrix>
java.lang.Object
org.ddogleg.optimization.math.HessianSchurComplement_Base<S>
- All Implemented Interfaces:
HessianMath
,HessianSchurComplement<S>
- Direct Known Subclasses:
HessianSchurComplement_DDRM
,HessianSchurComplement_DSCC
public abstract class HessianSchurComplement_Base<S extends DMatrix>
extends Object
implements HessianSchurComplement<S>
The approximate Hessian matrix (J'*J) is assumed to have the
following block triangle form: [A B;C D]. The system being solved for
is as follows: [A B;C D] [x_1;x_2] = [b_1;b_2]. Then the following steps
are followed to solve it:
- D' = D - C*inv(A)*B and b_2' = b_2 - C*inv(A)*b_1
- D'*x_2 = b_2'
- A*x_1 = b_1 - B*x_2
-
Field Summary
Modifier and TypeFieldDescriptionprotected LinearSolverSparse<S,
DMatrixRMaj> protected LinearSolverSparse<S,
DMatrixRMaj> -
Constructor Summary
ModifierConstructorDescriptionprotected
HessianSchurComplement_Base
(LinearSolverSparse<S, DMatrixRMaj> solverA, LinearSolverSparse<S, DMatrixRMaj> solverD) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
void
computeGradient
(S jacLeft, S jacRight, DMatrixRMaj residuals, DMatrixRMaj gradient) Computes the gradient using Schur complementprotected abstract void
divideRowsCols
(double[] diagA, int offsetA, S B, double[] diagC, int offsetC) void
divideRowsCols
(DMatrixRMaj scaling) Applies row and column division using the scaling vector.protected abstract void
extractDiag
(S input, DMatrixRMaj output) void
extractDiagonals
(DMatrixRMaj diag) Extracts diagonal elements from the hessian and stores them in the vector diagvoid
init
(int numParameters) Initialize Hessian to be in its initial state with the specified dimensionsboolean
Initializes the solverprotected abstract double
innerProduct
(double[] a, int offsetA, S B, double[] c, int offsetC) double
Vector matrix inner product of Hessian in block format.protected abstract void
mult
(S A, DMatrixRMaj B, DMatrixRMaj C) protected abstract void
multTransA
(S A, DMatrixRMaj B, DMatrixRMaj C) protected abstract void
multTransA
(S A, S B, S C) void
setDiagonals
(DMatrixRMaj diag) Sets the diagonal elements in the Hessian to the provided vectorboolean
solve
(DMatrixRMaj gradient, DMatrixRMaj step) Solves the system step = inv(B)*YMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ddogleg.optimization.math.HessianSchurComplement
computeHessian, createMatrix
-
Field Details
-
solverA
-
solverD
-
-
Constructor Details
-
HessianSchurComplement_Base
protected HessianSchurComplement_Base(LinearSolverSparse<S, DMatrixRMaj> solverA, LinearSolverSparse<S, DMatrixRMaj> solverD)
-
-
Method Details
-
init
public void init(int numParameters) Description copied from interface:HessianMath
Initialize Hessian to be in its initial state with the specified dimensions- Specified by:
init
in interfaceHessianMath
- Parameters:
numParameters
- Number of optimization parameters. Hessian will be N by N
-
innerVectorHessian
Vector matrix inner product of Hessian in block format.[A B;C D]*[x;y] = [c;d]
A*x + B*y = c
C*x + D*y = d
[x;y]T[A B;C D]*[x;y] = [x;y]T*[c;d]
- Specified by:
innerVectorHessian
in interfaceHessianMath
- Parameters:
v
- row vector- Returns:
- v'*H*v = v'*[A B;C D]*v
-
extractDiagonals
Description copied from interface:HessianMath
Extracts diagonal elements from the hessian and stores them in the vector diag- Specified by:
extractDiagonals
in interfaceHessianMath
- Parameters:
diag
- vector
-
setDiagonals
Description copied from interface:HessianMath
Sets the diagonal elements in the Hessian to the provided vector- Specified by:
setDiagonals
in interfaceHessianMath
- Parameters:
diag
- vector
-
divideRowsCols
Description copied from interface:HessianMath
Applies row and column division using the scaling vector. B = inv(diag(s))*B*inv(diag(s))- Specified by:
divideRowsCols
in interfaceHessianMath
-
initializeSolver
public boolean initializeSolver()Description copied from interface:HessianMath
Initializes the solver- Specified by:
initializeSolver
in interfaceHessianMath
- Returns:
- true if successful
-
solve
Description copied from interface:HessianMath
Solves the system step = inv(B)*Y- Specified by:
solve
in interfaceHessianMath
- Parameters:
gradient
- (Input) vectorstep
- (output) vector
-
computeGradient
Computes the gradient using Schur complement- Specified by:
computeGradient
in interfaceHessianSchurComplement<S extends DMatrix>
- Parameters:
jacLeft
- (Input) Left side of JacobianjacRight
- (Input) Right side of Jacobianresiduals
- (Input) Residualsgradient
- (Output) Gradient
-
innerProduct
-
extractDiag
-
divideRowsCols
protected abstract void divideRowsCols(double[] diagA, int offsetA, S B, double[] diagC, int offsetC) -
multTransA
-
multTransA
-
add
-
mult
-