Functions to project one matrix onto another, or to ortghogonalise it against the other.
1 2 3
matrix to be projected or orthogonalised
matrix to be projected onto or orthogonalised against
project(M, N) calculates the projection of
i.e., N (N' N)^(-1) N' M.
orth(M, N) orthogonalises
M with respect to
i.e., it calculates the projection of
M onto the orthogonal
N: M - N (N' N)^(-1) N' M.
Corth(M, N) calculates the coefficient matrix needed to
orthogonalise future matrices, that is,
(N' N)^(-1) N' M. Future
n can be orthogonalised with
m - n %*% Corth(M, N).
The functions need to be opitmised, both for speed and numerical accurracy.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.