MAT G=MPINV(A) computes the Moore-Penrose inverse G of any m*n matrix A.
If m<n, G is computed as MPINV(A')'.
Let the singular value decomposition of A be A=U*D*V'
where D is the diagonal matrix of singular values d1>=d2>=,...,>=dm>=0.
Then MPINV(A)=V*INV_D*U' where INV_D is a diagonal matrix of numbers
ei, i=1,2,...,m where e1=1/di if di>=eps*d1 and e1=0 otherwise.
eps is given by a specification EPS. By default eps=1e-15.
G is the only generalized inverse of A satisfying the conditions
AGA=A, GAG=G, (AG)'=AG, (GA)'=GA.
Certain useful MAT expressions (proposed by Simo Puntanen):
MAT P=A*MPINV(A)
is the orthogonal projector (with respect to standard inner product)
onto the column space of A.
MAT C=A*MPINV(A'*V*A)*A'*V
is the orthogonal projector (with respect to inner product matrix V)
onto the column space of A.
MAT P=IDN(m,m)-BASIS(A)*(BASIS(A))'.
is the orthogonal projector (with respect to standard inner product)
onto the orthocomplement of the column space of A.
MAT Z=BASIS(IDN(m,m)-BASIS(A)*(BASIS(A))').
is the orthonormal basis of the orthocomplement of the column space of
A.