1 / 41

# Getting Started

Getting Started. All matlab files you need can be found in /u/rvdg/class/CS383C.F04/QRalg/matlab/ You may want to copy these over into a directory of yours Start up matlab. The Power Method. The first demonstration centers around the Power Method Two M-script files are involved:

Télécharger la présentation

## Getting Started

E N D

### Presentation Transcript

1. Getting Started • All matlab files you need can be found in /u/rvdg/class/CS383C.F04/QRalg/matlab/ • You may want to copy these over into a directory of yours • Start up matlab

2. The Power Method • The first demonstration centers around the Power Method • Two M-script files are involved: • PowerMethod.m • This is the main driver • ShowPowerMethod.m • This is a utility routine that prints out interesting stuff

3. Enter matrix size A random diagonal matrix is created Hit “Return” A random orthogonal matrix is created A random matrix is created Hit “Return”

4. Keep an eye on this The first element should become 1 (since q should eventually be the direction of the first column of U). The other elements should become 0 (since q should eventually be orthogonal To the other columns of U.) Current estimate of lambda(1) Actual lambda(1) Hit “Return”

5. Here I report the ratios | lj|/|l1| as the i-th element of this vector Notice that the component of q in the direction of uj should decrease in every iteration by a factor roughly equal to | lj|/|l1| Notice that the jth component of UT * q equals the length of the component of q in the direction of uj. By looking at this ratio, we are tracking by what factor these components are decreasing in each step.

6. I hit return a few times !!!!! Starting to look like we want!

7. I hit return a few more times !!!!! Starting to look like we want!

8. Finally reply “0” (or anything else but a return)

9. Subspace Iteration • The second demonstration centers around the relation between the Power Method and Subspace Iteration

10. Hit “return” a few times to create a random matrix, etc.

11. The Power Method and Subspace Iteration are now both tracked

12. A few iterations later Again, these are the factors by which we would predict that components in the directions of uj would decrease (see similar discussion for power method.)

13. QR algorithm • The third demonstration centers around the relation between Subspace Iteration and the QR algorithm

14. Recall the QR algorithm: A0 = A For i=0,… Ai – r I = QR Ai+1 = R Q + r I

15. The difference here simply comes from a different number of digits being printed

16. For now, just use shift rho = 0 by hitting return every time

17. A few iterations later…

18. A few more iterations later… All off-diagonal elements are starting to become small

19. QR algorithm • The fourth demonstration centers around the effects of choosing shifts

20. Notice MUCH faster convergence to zero!

21. After only two iterations!

22. A few iterations later… A few iterations later…

23. Now these elements are converging faster

More Related