Exercise "QR-decomposition"

  1. Implement a function which, given a matrix A, calculates its QR-decomposition by modified Gram-Schmidt orthogonalization.
  2. 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.
  3. Implement a function which, given the matrices Q and R from the QR-decomposition, calculates the (absolute value of the) determinant of matrix A.
  4. Implement a function which, given the matrices Q and R from the QR-decomposition of a matrix A, calculates its inverse.

  5. 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.
  6. Check that the time to perform a QR-decomposition of an (m cols)x(n rows) matrix scales as mn2.
  7. Implement LU-decomposition and back-substitution