diff --git a/ML1_12_factorisation_qr.R b/ML1_12_factorisation_qr.R new file mode 100644 index 0000000..20945d4 --- /dev/null +++ b/ML1_12_factorisation_qr.R @@ -0,0 +1,28 @@ +# Norm 2 +Norm <- function(x) { + stopifnot(is.numeric(x)) + sqrt(sum(x^2)) +} + +# Modified Gram-Schmidt +mgs <- function(A, tol = .Machine$double.eps^0.5) { + stopifnot(is.numeric(A), is.matrix(A)) + M <- nrow(A); N <- ncol(A) + if(M