Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

MatMPpinv

Moore-Penrose pseudoinverse of a squared matrix


Description

For a matrix A its Moore-Penrose pseudoinverse is such a matrix A[+] which satisfies

(i) A*A[+]*A = A,
(ii) A[+]*A*A[+] = A[+],
(iii) (A*A[+])' = A*A[+],
(iv) (A[+]*A)' = A[+]*A.

Computation is done using spectral decomposition. At this moment, it is implemented for symmetric matrices only.

Usage

MatMPpinv(A)

Arguments

A

either a numeric vector in which case inverse of each element of A is returned or a squared matrix.

Value

Either a numeric vector or a matrix.

Author(s)

References

Golub, G. H. and Van Loan, C. F. (1996, Sec. 5.5). Matrix Computations. Third Edition. Baltimore: The Johns Hopkins University Press.

Examples

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)

mixAK

Multivariate Normal Mixture Models and Mixtures of Generalized Linear Mixed Models Including Model Based Clustering

v5.3
GPL (>= 3)
Authors
Arnošt Komárek <arnost.komarek@mff.cuni.cz>
Initial release
2020-06-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.