Public API

Contents

Index

Public interface

ConjugateGradient.cgFunction
cg(𝐀, 𝐛, 𝐱₀=zeros(length(𝐛)); atol=eps(), maxiter=2000)

Solves the linear system $𝐀 𝐱 = 𝐛$ using the Conjugate Gradient method.

Arguments

  • 𝐀: square, symmetric, positive-definite matrix.
  • 𝐛: right-hand side vector.
  • 𝐱₀: initial guess for the solution. Defaults to a zero vector of appropriate length.
  • atol: absolute tolerance for convergence. Defaults to machine epsilon.
  • maxiter: maximum number of iterations. Defaults to 2000.

Returns

  • 𝐱: the solution vector.
  • iterations: an OffsetVector containing iteration history for each step.
  • isconverged: a boolean indicating whether the algorithm has converged.
source