pcgsolve: Preconditioned conjugate gradient method

Description Usage Arguments Details Value Preconditioners Warning References See Also Examples

View source: R/RcppExports.R

Description

Preconditioned conjugate gradient method for solving system of linear equations Ax = b, where A is symmetric and positive definite, b is a column vector.

Usage

1
pcgsolve(A, b, preconditioner = "Jacobi", tol = 1e-6, maxIter = 1000)

Arguments

A

matrix, symmetric and positive definite.

b

vector, with same dimension as number of rows of A.

preconditioner

string, method for preconditioning: "Jacobi" (default), "SSOR", or "ICC".

tol

numeric, threshold for convergence, default is 1e-6.

maxIter

numeric, maximum iteration, default is 1000.

Details

When the condition number for A is large, the conjugate gradient (CG) method may fail to converge in a reasonable number of iterations. The Preconditioned Conjugate Gradient (PCG) Method applies a precondition matrix C and approaches the problem by solving:

{C}^{-1} A x = {C}^{-1} b

where the symmetric and positive-definite matrix C approximates A and {C}^{-1} A improves the condition number of A.

Common choices for the preconditioner include: Jacobi preconditioning, symmetric successive over-relaxation (SSOR), and incomplete Cholesky factorization [2].

Value

Returns a vector representing solution x.

Preconditioners

Jacobi: The Jacobi preconditioner is the diagonal of the matrix A, with an assumption that all diagonal elements are non-zero.

SSOR: The symmetric successive over-relaxation preconditioner, implemented as M = (D+L) D^{-1} (D+L)^T. [1]

ICC: The incomplete Cholesky factorization preconditioner. [2]

Warning

Users need to check that input matrix A is symmetric and positive definite before applying the function.

References

[1] David Young. <e2><80><9c>Iterative methods for solving partial difference equations of elliptic type<e2><80><9d>. In: Transactions of the American Mathematical Society 76.1 (1954), pp. 92<e2><80><93>111.

[2] David S Kershaw. <e2><80><9c>The incomplete Cholesky<e2><80><94>conjugate gradient method for the iter- ative solution of systems of linear equations<e2><80><9d>. In: Journal of computational physics 26.1 (1978), pp. 43<e2><80><93>65.

See Also

cgsolve

Examples

1
2
3
4
5
6
## Not run: 
test_A <- matrix(c(4,1,1,3), ncol = 2)
test_b <- matrix(1:2, ncol = 1)
pcgsolve(test_A, test_b, "ICC")

## End(Not run)

Example output

           [,1]
[1,] 0.09074421
[2,] 0.63682348

cPCG documentation built on May 2, 2019, 11:04 a.m.