u "( U u ¡ ’U W

W W

W

uy § ¨( u¨

¡

Putting these relations together gives the following algorithm.

¥£ •

˜Q¤ v ¢

¡¦ U7R ¡ ¤ 6 D

5S@ &4TP A2

S 6 5Q @ 8

3 DA

C

' 7$

%# ) 2

1

3 3

V§ T²A¨ ¬ ¨ T

© ¨ ¬

1. Compute , . ¡

( $}

X ( Y ¬

2. For , until convergence Do:

Xu u 3

§ u wu ¨ u ( uy ¨ ¬ u u

3. ( ¡ ¢

¡

3

©¬W ©

u

4. ¡

3

u ² u ¨ T ¬ "U u ¨

Tu

X§ u

5. ¡

Xu u 3

¨ ( u ¨ ¬ "U u S W

6. ¨( ¨ 3

u u ’U w "u U ¨ ¬ W

WS u

7. ¡ ¡

W"U

"U

W

8. EndDo

u Se( u

It is important to note that the scalars in this algorithm are different from those of

u u

the Lanczos algorithm. The vectors are multiples of the ™s of Algorithm 6.16. ¡ ¡

§ §

In terms of storage, in addition to the matrix , four vectors (© , , , and ) must be ¨

¡ ¡

©

saved in Algorithm 6.17, versus ¬ve vectors (¦ , , , , and ) for Algorithm 6.16. ¦ ¥

¢ ¢ ¡

W“

6©'( 0¤ C78 E6P0b& 8 ¦

¨6¡

§ 35A

5 BA

I3 6E ' 0A 9&

B8

F

¢

Algorithm 6.17 is the best known formulation of the Conjugate Gradient algorithm. There

are, however, several alternative formulations. Here, only one such formulation is shown,

T

which can be derived once more from the Lanczos algorithm. X

The residual polynomial associated with the -th CG iterate must satisfy a ¨ ¢ !

three-term recurrence, implied by the three-term recurrence of the Lanczos vectors. Indeed,

these vectors are just the scaled versions of the residual vectors. Therefore, we must seek

a three-term recurrence of the form T T T T T

¬ X ²T X

w eX

X X

¢X

¡

¨ ¨ ¨ ¨

¢ ¢ ¢ ¢ ¢ ¢

W“

W"U X

¬

In addition, the consistency condition must be maintained for each , leading

¨ Y

¢ !

Ty

to the recurrence, T T T T T

± ¯ „ ®

i

X X

w XeX

X X

¬ ² ²

¡

¨ ¨ ¢¨ ¨

¢ ¢ ¢ ¢ ¢ ¢

W“

"U

W y

C C

³

75 B1B¥ © £ 5 Ct|¦’¥ yC£¤¥ § ¤ l ¢ y5

£§ |5 |„

„ §

T T T

X X X

¬ ¬ ¬

Observe that if and , then , as desired. Translating

¨ ¨ ¨

Y Y Y

¢ ¢ ¢

W“T ’U T

W

y y y

the above relation into the sequence of residual vectors yields

a±— „ ®

i

w X ¢© ¢ X

¬ §² ²

¡