getting started

41
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

Upload: morwen

Post on 04-Jan-2016

24 views

Category:

Documents


0 download

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 Presentation

TRANSCRIPT

Page 1: 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

Page 2: Getting Started

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
Page 4: Getting Started

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

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

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

I hit return a few times

!!!!! Starting to look like we want!

Page 8: Getting Started

I hit return a few more times

!!!!! Starting to look like we want!

Page 9: Getting Started

Finally reply “0” (or anything elsebut a return)

Page 10: Getting Started

Subspace Iteration

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

Page 11: Getting Started
Page 12: Getting Started
Page 13: Getting Started

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

Page 14: Getting Started

The Power Method and Subspace Iteration are now both tracked

Page 15: Getting Started
Page 16: Getting Started

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

QR algorithm

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

Page 18: Getting Started
Page 19: Getting Started
Page 20: Getting Started

Recall the QR algorithm:A0 = AFor i=0,…

Ai – I = QRAi+1 = R Q + I

Page 21: Getting Started

The difference here simply comes from a different numberof digits being printed

Page 22: Getting Started

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

Page 23: Getting Started
Page 24: Getting Started

A few iterations later…

Page 25: Getting Started

A few more iterations later…

All off-diagonal elements arestarting to become small

Page 26: Getting Started

QR algorithm

• The fourth demonstration centers around the effects of choosing shifts

Page 27: Getting Started
Page 28: Getting Started
Page 29: Getting Started
Page 30: Getting Started
Page 31: Getting Started

Notice MUCH faster convergenceto zero!

Page 32: Getting Started
Page 33: Getting Started

After only two iterations!

Page 34: Getting Started

Let’s start over, printing out moredigits.

Page 35: Getting Started
Page 36: Getting Started
Page 37: Getting Started
Page 38: Getting Started

A few iterations later…

Page 39: Getting Started

Now let’s pick a differentshift

Page 40: Getting Started

Now these elements are converging faster

Page 41: Getting Started