(xx <- matrix(c( 1:3, 3:1, 1, 0, -2), 3, 3))
crossprod(xx)
(zz <- GramSchmidt(xx, normalize=FALSE))
zapsmall(crossprod(zz))
# normalized
(zz <- GramSchmidt(xx))
zapsmall(crossprod(zz))
# print steps
GramSchmidt(xx, verbose=TRUE)
# A non-invertible matrix; hence, it is of deficient rank
(xx <- matrix(c( 1:3, 3:1, 1, 0, -1), 3, 3))
R(xx)
crossprod(xx)
# GramSchmidt finds an orthonormal basis
(zz <- GramSchmidt(xx))
zapsmall(crossprod(zz))
Run the code above in your browser using DataLab