Library: | math |
See also: | givenrot plotgt |
Quantlet: | orthonormal | |
Description: | Computes an orthonormal system of column vectors using the Gramm-Schmidt procedure. |
Usage: | y = orthonormal(x{, norm}) | |
Input: | ||
x | m x n matrix | |
norm | optional scalar (zero by default); if non-zero, the columns of the input matrix x are normalized before starting the Gramm-Schmidt procedure - this improves numerical stability of the procedure | |
Output: | ||
y | m x n matrix; vectors that are a linear combination of its predecessors are set to zero, all other vectors are replaced by their orthonormalized counterparts. |
; loads the library math library("math") ; generate some vectors x = normal(6,4) ; orthonormalize x y = orthonormal(x) ; check it y'*y
gives the appropriate (4x4) identity matrix