Lesson 15 of 15
Conjugate Gradient Method
Conjugate Gradient Method
The Conjugate Gradient (CG) method solves symmetric positive definite systems iteratively — without factoring . It is the algorithm of choice for large sparse systems.
Key Idea
CG builds a sequence of search directions that are A-conjugate (mutually orthogonal in the energy inner product ). Each step minimises the error over an expanding Krylov subspace.
Algorithm
For :
For an SPD system, CG converges in at most iterations (exactly, in exact arithmetic).
Example
Your Task
Implement conjugate_gradient(A, b) that solves for symmetric positive definite .
Python runtime loading...
Loading...
Click "Run" to execute your code.