gramSchmidt(A, tol = .Machine$double.eps^0.5)
nrow(A)>=ncol(A)
.Q
and R
, Q
orthonormal and
R
upper triangular, such that A=Q%*%R
.householder, givens
## QR decomposition
A <- matrix(c(0,-4,2, 6,-3,-2, 8,1,-1), 3, 3, byrow=TRUE)
gs <- gramSchmidt(A)
(Q <- gs$Q); (R <- gs$R)
Q %*% R # = A
Run the code above in your browser using DataLab