Learn R Programming

mcmcsae (version 0.7.9)

CG: Solve Ax=b by preconditioned conjugate gradients

Description

Solve Ax=b by preconditioned conjugate gradients

Usage

CG(
  b,
  env,
  x = 0 * b,
  max.it = length(b),
  e = 1e+06 * length(b),
  verbose = FALSE,
  ...
)

Value

The (approximated) solution to Ax=b.

Arguments

b

right hand side vector.

env

environment containing at least a function A_times that computes the matrix-vector product Ax for some input vector x, and a function M_solve that computes M^-1 x for some preconditioner matrix M.

x

start value for the conjugate gradient algorithm.

max.it

maximum number of iterations.

e

total squared error stop criterion.

verbose

whether progress information is shown.

...

any parameters passed to A_times and M_solve.

References

M.R. Hestenes and E. Stiefel (1952). Methods of conjugate gradients for solving linear systems. Journal of Research of the National Bureau of Standards 49(6), 409-436.