5627: HW5 Least Squares

Write you own GS function whith input any nxm real matrix and output an nxm matrix Q and a mxm matrix R .  Test your function appropriately.

Modify you GS function to create a double orthogonalization function GSO with the same external syntax. Test your function appropriately.

Compare the run times of your GS and GSO and the built-in QR decomposition by creating a log-log plot of the run times of the three against matrix dimension n for square matrices.

Compare the accuracy (use some hard problems) and run-time (a log-log-plot of the timings on an appropriate set of randomly generated problems)  of the following different least square solvers.

Built in linear solve for Normal Equations.

QR decomposition for original equation.

GS decomposition and then  a linear solve.

GSO decomposition and then  a linear solve.

LinearSolve for over determined system.

SVD technique with appropriate cut-offs

What happens to the built-in QR, your GS, and your GSO on rank deficient matrices.  Explain in words what you think should happen and show me what does happen in code.