Docsity

Conjugate Gradient Method for Solving Linear Systems, Slides of Advanced Computer Architecture

Partial preview of the text

Download Conjugate Gradient Method for Solving Linear Systems and more Slides Advanced Computer Architecture in PDF only on Docsity!

  • Lecture

Overview

Steepest descent Conjugate gradient

Quadratic form (cont’d)

f (x) = 12 x>Ax − b>x + c At x∗, Ax∗ = b Let e = p − x∗

f (p) = f (x∗ + e) = 12 (x∗ + e)>A(x∗ + e) − b>(x∗ + e) + c = 12 x>∗ Ax∗ + e>Ax∗ + 12 e>Ae − b>e + c = 12 x>∗ Ax∗ − b>x∗ + c + e>b + 12 e>Ae − b>e = f (x∗) + 12 e>Ae

Steepest descent

Start at an arbitrary point x 0 and slide down to the bottom of the paraboloid by taking a series of steps x 1 , x 2 ,... until we are satisfied that we are close enough to the solution x∗ Choose the direction which f decreases most quickly, i.e., the opposite of ∇f (xi ) −∇f (xi ) = b − Axi The error ei = xi − x∗ is a vector that indicates how far we are from the solution The residual ri = b − Axi indicates how far we are from the correct value of b It is easy to see that ri = −Aei , and residual is being the error transformed by A into the same space as b More importantly, ri = −∇f (xi )

Can think of residual as the direction of steepest descent

Steepest descent (cont’d)

Put it all together,

ri− 1 = b − Axi− 1 αi =

r> i− 1 ri− 1 r> i− 1 Ari− 1 xi = xi− 1 + αi ri− 1

Can save computation by multiply −A to the above equation and adding b on both sides

ri = ri− 1 − αi Ari− 1

Steepest descent often finds itself taking steps in the same directions as earlier steps Convergence rate depends on the conditional number, κ Steepest descent can converge quickly if a fortunate starting point is chosen, but is usually at worst when κ is large

Conjugate gradient as a direct method

We want to solve a system of linear systems: Ax = b where A ∈ IRm×m^ is symmetric and positive Two non-zero vectors u and v are conjugate with respect to A if u>Av = 0 Since A is symmetric and positive definite 〈u, v〉A = 〈A>u, v〉 = 〈Au, v〉 = 〈u, Av〉 = u>Av Suppose {pn} is a sequence of m mutually conjugate directions, then the pn form a basis of IRm^ and we can expand the solution x∗ (unique solution of Ax = b) in this basis

x∗ =

∑^ m

i=

αi pi

The coefficients are given by b = Ax∗ =

∑m i=1 αi^ Api p> n b = p> n Ax∗ =

∑m i=1 αi^ p

n Api^ =^ αnp

n Apn αn = p

n b p> n Apn =^

〈pn,b〉 〈pn,pn〉A =^

〈pn,b〉 ‖pn‖^2 A

Conjugate gradient as an iterative method

If we choose the conjugate vectors pn carefully, we may not need all of them to obtain a good approximation Also, the direct method does not scale well when m is large Without loss of generality, assume the initial guess x 0 = 0 Need a metric to tell us whether we are getting closer to x∗

f (x) =

x>Ax − b>x , x ∈ IRm

where ∇f (x) = Ax − b This suggests taking the first basis vector p 1 to be the gradient of f at x 0 , i.e., Ax 0 − b Since x 0 = 0, p 1 = −b The other direction vectors in the basis will be conjugate to the gradient, hence the name conjugate gradient method

Conjugate gradient as an iterative method (cont’d)

Let rn be the residual at n-th step: rn = b − Axn Note that rn is the negative gradient of f at x = xn, so the gradient descent method would be to move in the direction of rn Here we insist the directions pn are conjugate to each other, so we take the direction closest to the gradient rn under the conjugacy constraint pn+1 = rn −

p> n Arn p> n Apn

pn

(green: steepest descent, red: conjugate gradient descent)

Minimizing the 2-norm of the residual

In GMRES, at step n, x∗ is approximated by the vector xn ∈ Kn that minimizes ‖rn‖ 2 where rn = b − Axn The usual GMRES algorithm does more work than is necessary for minimizing ‖rn‖ 2 When A is symmetric, faster algorithms are available based on three-term instead of (n + 1)-term recurrences at step n One of these goes by the names of conjugate residuals or MINRES (minimal residuals)

Minimize the A-norm of the error

Assume that A is real, symmetric, and positive definite That means the eigenvalues of A are all positive or equivalently, that x>Ax > 0 for every nonzero x ∈ IRm Under this assumption, the function ‖ · ‖A defined by

‖x‖A =

x>Ax

is the A-norm on IRm The vector whose A-norm will concern us is en = x∗ − xn, the error at step n The conjugate gradient iteration is a system of recurrence formulas that I (^) generated the unique sequence of iterates {x ∈ Kn} I (^) with the property that at step n, ‖en‖A is minimized Will reveal the use of orthogonality in minimizing ‖en‖A

The conjugate gradient iteration (cont’d)

At each step, the conjugate gradient iteration involves several vector manipulation and one matrix-vector product, the computation of Apn− 1 If A is dense and unstructured, the matrix-vector product dominates the operation count, O(m^2 ) flops for each step If A is sparse or has other structure that can be exploited, the operation count may be as low as O(m) flops per step

The conjugate gradient iteration (cont’d)

Theorem

Let the conjugate gradient iteration be applied to a symmetric positive definite matrix problem Ax = b. As long as the iteration has not yet converged (i.e., rn− 1 6 = 0), the algorithm proceeds without divisions by zero, and we have the following identities of subspaces:

Kn = 〈x 1 , x 2 ,... , xn〉 = 〈p 0 , p 1 ,... , pn− 1 〉 = 〈r 0 , r 1 ,... , rn− 1 〉 = 〈b, Ab,... , An−^1 b〉

Moreover, the residuals are orthogonal

r> n rj = 0 (j < n) (2)

and the search directions are A-conjugate

p> n Apj = 0 (j < n) (3)

The conjugate gradient iteration (cont’d)

To prove (3), we apply the formula pn = rn + βnpn− 1 to compute p> n Apj = r> n Apj + βnp> n− 1 Apj If j < n − 1, both terms on the right are again zero by induction If j = n − 1, the sum on the right is zero provided βn = −(r> n Apn− 1 )/(p> n− 1 Apn− 1 ), which we can write equivalently in the from βn = (−αnr> n Apn− 1 )/(αnp> n− 1 Apn− 1 ) Recall rn = rn− 1 + αnpn− 1 and r> n rn = r> n (rn− 1 + αnpn− 1 ) = αnr> n pn− 1 Likewise, use rn = rn− 1 − αnApn− 1 and pn = rn + βnpn− 1 to show r> n− 1 rn− 1 = r> n− 1 (rn + αnApn− 1 ) = (pn− 1 − βn− 1 pn− 2 )>αnApn− 1 = p> n− 1 (αnApn− 1 ) This is the same as the line βn = (r> n rn)/(r> n− 1 rn− 1 ) except that r> n rn has been replaced by r n> (−αnApn− 1 ) and r> n− 1 rn− 1 has been replaced by p> n− 1 (αnApn− 1 )