View source: R/orthonormalization.R
| orthonormalization | R Documentation | 
Gram-Schmidt orthogonalization of a matrix considering its columns as vectors. Normalization is provided as will.
orthonormalization(u, basis=TRUE, norm=TRUE)
| u | a matrix (n x p) representing n different vectors in a n dimensional space | 
| basis | does the returned matrix have to be a basis | 
| norm | does the returned vectors have to be normed | 
This is a simple application of the Gram-Schmidt algorithm of orthogonalization (please note that this process was presented first by Laplace).
The user provides a set of vector (structured in a matrix) and the function calculate a orthogonal basis of the same space. If desired, the returned basis can be normed, or/and completed to cover the hole space.
If the number of vectors in u is greater than the
dimension of the space (that is if n > p), only the first
p columns are taken into account to computed the result.
A warning is also provided.
The only assumption made on u is that the span space
is of size min(n,p). In other words, there must be no
colinearities in the initial set of vector.
The orthogonalized matrix obtained from u where the
vector are arranged in columns.
If basis is set to TRUE, the returned matrix
is squared.
J. Damon
  mat1 <- matrix(c(1,0,1,1,1,0),nrow=3,ncol=2)
  orth1 <- orthonormalization(mat1, basis=FALSE, norm=FALSE)
  orth2 <- orthonormalization(mat1, basis=FALSE, norm=TRUE)
  orth3 <- orthonormalization(mat1, basis=TRUE, norm=TRUE)
  crossprod(orth1)
  crossprod(orth2)
  crossprod(orth3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.