getting started
DESCRIPTION
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: - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/1.jpg)
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
![Page 2: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/2.jpg)
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
![Page 3: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/3.jpg)
![Page 4: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/4.jpg)
Enter matrix size
Hit “Return”
A random diagonal matrix is created
A random orthogonalmatrix is created
A randommatrix is created
Hit “Return”
![Page 5: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/5.jpg)
Current estimate of lambda(1)
Hit “Return”
Actual lambda(1)
Keep an eye on thisThe first element should become 1 (since q should eventually be the direction of the first columnof U).The other elements should become 0 (since q should eventually be orthogonalTo the other columns of U.)
![Page 6: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/6.jpg)
Notice that the component of q in the direction of uj should decrease in every iteration by a factor roughlyequal to | j|/|1|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 aretracking by what factor these components are decreasing in each step.
Here I report the ratios | j|/|1| as the i-th element of this vector
![Page 7: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/7.jpg)
I hit return a few times
!!!!! Starting to look like we want!
![Page 8: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/8.jpg)
I hit return a few more times
!!!!! Starting to look like we want!
![Page 9: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/9.jpg)
Finally reply “0” (or anything elsebut a return)
![Page 10: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/10.jpg)
Subspace Iteration
• The second demonstration centers around the relation between the Power Method and Subspace Iteration
![Page 11: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/11.jpg)
![Page 12: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/12.jpg)
![Page 13: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/13.jpg)
Hit “return” a few times to createa random matrix, etc.
![Page 14: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/14.jpg)
The Power Method and Subspace Iteration are now both tracked
![Page 15: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/15.jpg)
![Page 16: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/16.jpg)
A few iterations later
Again, these are the factors bywhich we would predict thatcomponents in the directions of uj would decrease(see similar discussion forpower method.)
![Page 17: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/17.jpg)
QR algorithm
• The third demonstration centers around the relation between Subspace Iteration and the QR algorithm
![Page 18: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/18.jpg)
![Page 19: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/19.jpg)
![Page 20: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/20.jpg)
Recall the QR algorithm:A0 = AFor i=0,…
Ai – I = QRAi+1 = R Q + I
![Page 21: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/21.jpg)
The difference here simply comes from a different numberof digits being printed
![Page 22: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/22.jpg)
For now, just use shift rho = 0by hitting return every time
![Page 23: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/23.jpg)
![Page 24: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/24.jpg)
A few iterations later…
![Page 25: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/25.jpg)
A few more iterations later…
All off-diagonal elements arestarting to become small
![Page 26: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/26.jpg)
QR algorithm
• The fourth demonstration centers around the effects of choosing shifts
![Page 27: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/27.jpg)
![Page 28: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/28.jpg)
![Page 29: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/29.jpg)
![Page 30: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/30.jpg)
![Page 31: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/31.jpg)
Notice MUCH faster convergenceto zero!
![Page 32: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/32.jpg)
![Page 33: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/33.jpg)
After only two iterations!
![Page 34: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/34.jpg)
Let’s start over, printing out moredigits.
![Page 35: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/35.jpg)
![Page 36: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/36.jpg)
![Page 37: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/37.jpg)
![Page 38: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/38.jpg)
A few iterations later…
![Page 39: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/39.jpg)
Now let’s pick a differentshift
![Page 40: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/40.jpg)
Now these elements are converging faster
![Page 41: Getting Started](https://reader035.vdocument.in/reader035/viewer/2022062722/568139f5550346895da1b246/html5/thumbnails/41.jpg)