MatMPpinv | R Documentation |
For a matrix \boldsymbol{A}
its Moore-Penrose pseudoinverse is such a matrix
\boldsymbol{A}^+
which satisfies
(i) \boldsymbol{A}\boldsymbol{A}^+\boldsymbol{A} = \boldsymbol{A} , |
(ii) \boldsymbol{A}^+\boldsymbol{A}\boldsymbol{A}^+ = \boldsymbol{A}^+ , |
(iii) (\boldsymbol{A}\boldsymbol{A}^+)' = \boldsymbol{A}\boldsymbol{A}^+ , |
(iv) (\boldsymbol{A}^+\boldsymbol{A}) = \boldsymbol{A}^+\boldsymbol{A} . |
Computation is done using spectral decomposition. At this moment, it is implemented for symmetric matrices only.
MatMPpinv(A)
A |
either a numeric vector in which case inverse of each element of A is returned or a squared matrix. |
Either a numeric vector or a matrix.
Arnošt Komárek arnost.komarek@mff.cuni.cz
Golub, G. H. and Van Loan, C. F. (1996, Sec. 5.5). Matrix Computations. Third Edition. Baltimore: The Johns Hopkins University Press.
set.seed(770328)
A <- rWISHART(1, 5, diag(4))
Ainv <- MatMPpinv(A)
### Check the conditions
prec <- 13
round(A - A %*% Ainv %*% A, prec)
round(Ainv - Ainv %*% A %*% Ainv, prec)
round(A %*% Ainv - t(A %*% Ainv), prec)
round(Ainv %*% A - t(Ainv %*% A), prec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.