Learn R Programming

cPCG (version 1.0)

cPCG-package: cPCG

Description

cPCG

Arguments

Details

Functions in this package serve the purpose of solving for x in \(Ax = b\), where A is a symmetric and positive definite matrix, b is a column vector.

To improve scalability of conjugate gradient methods for larger matrices, the Armadillo templated C++ linear algebra library is used for the implementation. The package also provides flexibility to have user-specified preconditioner options to cater for different optimization needs.

The DESCRIPTION file: cPCG cPCG

References

[1] Reeves Fletcher and Colin M Reeves. <U+201C>Function minimization by conjugate gradients<U+201D>. In: The computer journal 7.2 (1964), pp. 149<U+2013>154.

[2] David S Kershaw. <U+201C>The incomplete Cholesky<U+2014>conjugate gradient method for the iter- ative solution of systems of linear equations<U+201D>. In: Journal of computational physics 26.1 (1978), pp. 43<U+2013>65.

[3] Yousef Saad. Iterative methods for sparse linear systems. Vol. 82. siam, 2003.

[4] David Young. <U+201C>Iterative methods for solving partial difference equations of elliptic type<U+201D>. In: Transactions of the American Mathematical Society 76.1 (1954), pp. 92<U+2013>111.

Examples

Run this code
# NOT RUN {
  # generate test data
  test_A <- matrix(c(4,1,1,3), ncol = 2)
  test_b <- matrix(1:2, ncol = 1)
  
  # conjugate gradient method solver
  cgsolve(test_A, test_b, 1e-6, 1000)
  
  # preconditioned conjugate gradient method solver, 
  # with incomplete Cholesky factorization as preconditioner
  pcgsolve(test_A, test_b, "ICC")
# }

Run the code above in your browser using DataLab