SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles.matrixtype.sparse.solver.iterative.nonstationary
Class ConjugateGradientNormalErrorSolver

java.lang.Object
  extended by com.numericalmethod.suanshu.matrix.doubles.matrixtype.sparse.solver.iterative.nonstationary.ConjugateGradientNormalErrorSolver
All Implemented Interfaces:
IterativeSolver

public class ConjugateGradientNormalErrorSolver
extends java.lang.Object
implements IterativeSolver

The Conjugate Gradient method (CG) can be applied on the normal equations. The Congugate Gradient Normal Error method (CGNE) is used to solve under-determined systems of linear equations, Ax = b. This algorithm applies CG to solve

(AAT)y = b
for y, and then compute the solution
x = ATy
The equivalent symmetric system is of the form:
 [ I  A ] [ r ] = [ b ]
 [ AT O ] [ x ]   [ 0 ]
 
with r = b - Ax, arises from the standard necessary conditions satisfied by the solution of the constrained optimization problem,
minimize || r - b ||2 subject to ATr = 0

When the coefficient matrix A is non-symmetric and nonsingular, the normal equations matrix AAT will be symmetric and positive definite, and hence CG can be applied. The convergence may be slow, since the spectrum of AAT will be less favorable than the spectrum of A.

Only left preconditioning is supported in this implementation.

See Also:
"Yousef Saad, “Preconditioned CG for the Normal Equations,” in Iterative Methods for Sparse Linear Systems, 2nd ed. 2000, ch. 9, sec. 9.5, p. 259-260."

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.matrix.doubles.matrixtype.sparse.solver.iterative.IterativeSolver
IterativeSolver.ConvergenceFailure, IterativeSolver.Problem
 
Field Summary
static int DEFAULT_RESIDUAL_REFRESH_RATE
          The algorithm recomputes the residual as b - Axi once per this number of iterations
 
Constructor Summary
ConjugateGradientNormalErrorSolver()
           
ConjugateGradientNormalErrorSolver(int residualRefreshRate)
          The solver recomputes the residual as b - Axi once per this number of iterations
 
Method Summary
 Vector solve(IterativeSolver.Problem problem)
          Solve iteratively Ax = b until the solution is close enough, i.e., the norm of residual (b - Ax) is less than or equal to the specified iteration.
 Vector solve(IterativeSolver.Problem problem, IterationMonitor monitor)
          Solve iteratively Ax = b until the solution is close enough, i.e., the norm of residual (b - Ax) is less than or equal to the specified iteration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RESIDUAL_REFRESH_RATE

public static final int DEFAULT_RESIDUAL_REFRESH_RATE
The algorithm recomputes the residual as b - Axi once per this number of iterations

See Also:
Constant Field Values
Constructor Detail

ConjugateGradientNormalErrorSolver

public ConjugateGradientNormalErrorSolver()

ConjugateGradientNormalErrorSolver

public ConjugateGradientNormalErrorSolver(int residualRefreshRate)
The solver recomputes the residual as b - Axi once per this number of iterations

Parameters:
residualRefreshRate - the number of iterations before the next refresh
Method Detail

solve

public Vector solve(IterativeSolver.Problem problem)
             throws IterativeSolver.ConvergenceFailure
Description copied from interface: IterativeSolver
Solve iteratively
Ax = b
until the solution is close enough, i.e., the norm of residual (b - Ax) is less than or equal to the specified iteration.

Specified by:
solve in interface IterativeSolver
Parameters:
problem - the problem of solving Ax = b
Returns:
the computed solution for the problem
Throws:
IterativeSolver.ConvergenceFailure - if the algorithm fails to converge

solve

public Vector solve(IterativeSolver.Problem problem,
                    IterationMonitor monitor)
             throws IterativeSolver.ConvergenceFailure
Description copied from interface: IterativeSolver
Solve iteratively
Ax = b
until the solution is close enough, i.e., the norm of residual (b - Ax) is less than or equal to the specified iteration.

In each iteration, the newly computed iterate is added to the IterationMonitor for statistics or diagnostic purpose.

Specified by:
solve in interface IterativeSolver
Parameters:
problem - the problem of solving Ax = b
monitor - an IterationMonitor instance
Returns:
the computed solution for the problem
Throws:
IterativeSolver.ConvergenceFailure - if the algorithm fails to converge

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.