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
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:– PowerMethod.m
• This is the main driver
– ShowPowerMethod.m• This is a utility routine that prints out interesting
stuff
Enter matrix size
Hit “Return”
A random diagonal matrix is created
A random orthogonalmatrix is created
A randommatrix is created
Hit “Return”
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.)
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
I hit return a few times
!!!!! Starting to look like we want!
I hit return a few more times
!!!!! Starting to look like we want!
Finally reply “0” (or anything elsebut a return)
Subspace Iteration
• The second demonstration centers around the relation between the Power Method and Subspace Iteration
Hit “return” a few times to createa random matrix, etc.
The Power Method and Subspace Iteration are now both tracked
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.)
QR algorithm
• The third demonstration centers around the relation between Subspace Iteration and the QR algorithm
Recall the QR algorithm:A0 = AFor i=0,…
Ai – I = QRAi+1 = R Q + I
The difference here simply comes from a different numberof digits being printed
For now, just use shift rho = 0by hitting return every time
A few iterations later…
A few more iterations later…
All off-diagonal elements arestarting to become small
QR algorithm
• The fourth demonstration centers around the effects of choosing shifts
Notice MUCH faster convergenceto zero!
After only two iterations!
Let’s start over, printing out moredigits.
A few iterations later…
Now let’s pick a differentshift
Now these elements are converging faster