pcg {pcg}R Documentation

Preconditioned Conjugate Gradient algorithm for solving Ax=b

Description

The function solves linear system of equations Ax=b by Preconditioned Conjugate Gradient algorithm. Here matrix A must be real symmetric and positive definite. This can also be used to minimize the quadractic function (x'Ax)/2-bx.

Usage

pcg(A, b, M, maxiter = 1e+05, tol = 1e-06)

Arguments

A

A is real symmetric positive definite matrix of order n x n.

b

b is a vector of order n x 1.

M

Optionally a suitable preconditioner matrix specified by user

maxiter

Maximum number of iterations

tol

Tolerance for convergence of the solution

Value

A vector of order n x 1

Note

The algorithm does not check for symmetricity and positive definiteness of matrix A. Please ensure these conditions yourself.

Author(s)

B N Mandal and Jun Ma

References

Barrett, R., M. Berry, T. F. Chan, et al., (1994). Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods, SIAM, Philadelphia.

Examples

A=matrix(rnorm(100*100,mean=10,sd=2),100,100)
A=t(A)%*%A
b=rnorm(100)
pcg(A,b)

[Package pcg version 1.1 Index]