Exercise "QR-decomposition"
Objective: solve a system of linear equations by QR-decomposition and
back-substitution; calculate the absolute value of the determinant of a
matrix; calculate the matrix inverse.
- Implement a function which, given a matrix A, calculates its
QR-decomposition by modified Gram-Schmidt
orthogonalization.
- Implement a function which, given the matrices Q and R from the
QR-decomposition and the vector b of the right-hand-sides, solves the
system of linear equations Ax=b by back-substitution.
- Implement a function which, given the matrices Q and R
from the QR-decomposition, calculates the (absolute value of the)
determinant of matrix A.
- Implement a function which, given the matrices Q and R from
the QR-decomposition of a matrix A, calculates its inverse.
-
Compare the speed of your QR-routine with some library routine,
e.g. with the GSL routine 'gsl_linalg_QR_decomp' (an example of
its usage is here) by aplying
them to a rangom matrix of size n.
-
Check that the time to perform a QR-decomposition of an (m cols)x(n
rows) matrix scales as mn2.