Matlab Database > Linear Algebra > Iterative Solvers > Conjugate Gradients Method

Matlab File(s)

Title: Conjugate Gradients Method
Author: Andreas Klimke
Institution: Technische Universität München
Description: Conjugate Gradients method for solving a system of linear equations Ax = f.

Input parameters:

  • A: Symmetric, positive definite NxN matrix
  • f: Right-hand side Nx1 column vector
  • s: Nx1 start vector (the initial guess)
  • tol: Relative residual error tolerance for break condition
  • maxiter: Maximum number of iterations to perform

Output parameters:
  • u: Nx1 solution vector
  • niter: Number of iterations performed
  • flag: 1 if convergence criteria specified by tol could not be fulfilled within the specified maximum number of iterations, 0 otherwise (= iteration successful).

Keywords: cg, iterative solvers
File Name: solveCG.m
File Size: 2 KB
File Version: 1.0
Matlab Version: 6.5 (R13)
Date: 2003-05-13
Downloads: 16135
Download File

Upload your own files today! Click here for more information.