com.lgc.wsh.opt
Class TransformQuadratic

java.lang.Object
  extended by com.lgc.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 of
      f(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 by
      H = F'NF + M
    
. b is determined by
       b = -F' N [data - f(m)] + Mm
    
for full damping, or by
      b = -F' N [data - f(m)]
    
if only perturbations are damped.


Constructor Summary
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
 void dispose()
          Free up internal cached vectors
 double 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 Hessian H = F'NF + M
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 transform
dampOnlyPerturbation - 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 Hessian H = F'NF + M

Specified by:
multiplyHessian in interface Quadratic
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 interface Quadratic
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.

Specified by:
getB in interface Quadratic
Returns:
Value of b = -F' N [data - f(m)] + Mm if dampOnlyPerturbation is false, and b = -F' N [data - f(m)] if dampOnlyPerturbation is true.

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