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:
1. D' = D - C*inv(A)*B and b_2' = b_2 - C*inv(A)*b_1
2. D'*x_2 = b_2'
3. A*x_1 = b_1 - B*x_2
 Triggs, Bill, et al. "Bundle adjustment—a modern synthesis." International workshop on vision algorithms. Springer, Berlin, Heidelberg, 1999.

• 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 interface HessianMath
Parameters:
numParameters - Number of optimization parameters. Hessian will be N by N
• innerVectorHessian

public double 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 interface HessianMath
Parameters:
v - row vector
Returns:
v'*H*v = v'*[A B;C D]*v
• extractDiagonals

public void extractDiagonals​(DMatrixRMaj diag)
Description copied from interface: HessianMath
Extracts diagonal elements from the hessian and stores them in the vector diag
Specified by:
extractDiagonals in interface HessianMath
Parameters:
diag - vector
• setDiagonals

public void setDiagonals​(DMatrixRMaj diag)
Description copied from interface: HessianMath
Sets the diagonal elements in the Hessian to the provided vector
Specified by:
setDiagonals in interface HessianMath
Parameters:
diag - vector
• divideRowsCols

public void divideRowsCols​(DMatrixRMaj scaling)
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 interface HessianMath
• initializeSolver

public boolean initializeSolver()
Description copied from interface: HessianMath
Initializes the solver
Specified by:
initializeSolver in interface HessianMath
Returns:
true if successful
• solve

public boolean solve​(DMatrixRMaj gradient, DMatrixRMaj step)
Description copied from interface: HessianMath
Solves the system step = inv(B)*Y
Specified by:
solve in interface HessianMath
Parameters:
step - (output) vector

Computes the gradient using Schur complement
Specified by:
computeGradient in interface HessianSchurComplement<S extends DMatrix>
Parameters:
jacLeft - (Input) Left side of Jacobian
jacRight - (Input) Right side of Jacobian
residuals - (Input) Residuals
• innerProduct

protected abstract double innerProduct​(double[] a, int offsetA, S B, double[] c, int offsetC)
• extractDiag

protected abstract void extractDiag​(S input, DMatrixRMaj output)
• divideRowsCols

protected abstract void divideRowsCols​(double[] diagA, int offsetA, S B, double[] diagC, int offsetC)
• multTransA

protected abstract void multTransA​(S A, S B, S C)
• multTransA

protected abstract void multTransA​(S A, DMatrixRMaj B, DMatrixRMaj C)