Package wsh.opt
Class TransformQuadratic
- java.lang.Object
-
- wsh.opt.TransformQuadratic
-
- All Implemented Interfaces:
Quadratic
public class TransformQuadratic extends java.lang.Object implements Quadratic
For a linearized transform, implement the Gauss-Newton quadratic approximation of a damped least-squares objective function. Specifically,[f(m+x)-data]'N[f(m+x)-data] + (m+x)'M(m+x)
Linearization off(m+x) ~= f(m) + Fx
makes the function quadratic in x[f(m)+Fx-data]'N[f(m)+Fx-data] + (m+x)'M(m+x)
If only perturbations are damped, then the objective function is[f(m)+Fx-data]'N[f(m)+Fx-data] + x'Mx
m is the reference model, and x is the perturbation. f(m) is the nonlinear forward transform. F is the linearized version of f(m) with respect to the reference model m N is the inverse covariance of the data and M is the inverse covariance of the model.
The Hessian is given byH = F'NF + M
. b is determined byb = -F' N [data - f(m)] + Mm
for full damping, or byb = -F' N [data - f(m)]
if only perturbations are damped.
-
-
Constructor Summary
Constructors Constructor Description TransformQuadratic(VectConst data, VectConst referenceModel, VectConst perturbModel, Transform transform, boolean dampOnlyPerturbation)
Wrap known data, reference mode, and transform as a Gauss-Newton objectiveFunction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Free up internal cached vectorsdouble
evalFullObjectiveFunction(VectConst m)
Evaluate the full objective function without approximation.Vect
getB()
Return gradient term of quadratic.int
getTransposePrecision()
Run a few tests to ensure that transpose satisfies definition.void
inverseHessian(Vect x)
Multiply vector by an approximate inverse of the Hessian.void
multiplyHessian(Vect x)
Multiply by HessianH = F'NF + M
-
-
-
Constructor Detail
-
TransformQuadratic
public TransformQuadratic(VectConst data, VectConst referenceModel, VectConst perturbModel, Transform transform, boolean dampOnlyPerturbation)
Wrap known data, reference mode, and transform as a Gauss-Newton objectiveFunction.- Parameters:
referenceModel
- This is the reference model m in the objective function.perturbModel
- If non-null, then use instances of this vector to perturb the reference model. It must be possible to project the referenceModel and perturbModel into each other.data
- The data to be fit.transform
- Optimize with this transformdampOnlyPerturbation
- If true then use objective function[f(m)+Fx-data]'N[f(m)+Fx-data] + x'Mx
-
-
Method Detail
-
getTransposePrecision
public int getTransposePrecision()
Run a few tests to ensure that transpose satisfies definition. This is expensive and intended only for test code.- Returns:
- number of sigficant digits of precision in transpose. Expect 5 or 6. Unacceptable if not 3 or more. A value of 3 or 4 probably indicates a subtle error.
-
multiplyHessian
public void multiplyHessian(Vect x)
Multiply by HessianH = F'NF + M
- Specified by:
multiplyHessian
in interfaceQuadratic
- Parameters:
x
- Vector to be multiplied and modified
-
inverseHessian
public void inverseHessian(Vect x)
Description copied from interface:Quadratic
Multiply vector by an approximate inverse of the Hessian. Perform the operation in-place. This method is useful to speed convergence. An empty implementation is equivalent to an identity.- Specified by:
inverseHessian
in interfaceQuadratic
- Parameters:
x
- Vector to be multiplied and modified.
-
getB
public Vect getB()
Return gradient term of quadratic. This instance will be in the vector space of the perturbModel, if provided. Otherwise, uses an instance of the referenceModel.
-
evalFullObjectiveFunction
public double evalFullObjectiveFunction(VectConst m)
Evaluate the full objective function without approximation. Provide a model in the vector space of the referenceModel. perturbModel is unused. Useful for line-search of best scale factor. If dampedPerturbation, evaluates[f(m)-data]'N[f(m)-data] + (m-m0)'M(m-m0)
where m0 is the reference model. Otherwise evaluates[f(m)-data]'N[f(m)-data] + m'M m
- Parameters:
m
- Model to be evaluated.- Returns:
- Value of objective function.
-
dispose
public void dispose()
Free up internal cached vectors
-
-