Eigen_pinverse: Pseudo-inverse of a matrix

View source: R/EigenR.R

Eigen_pinverseR Documentation

Pseudo-inverse of a matrix

Description

Pseudo-inverse of a real or complex matrix (Moore-Penrose generalized inverse).

Usage

Eigen_pinverse(M)

Arguments

M

a matrix, real or complex, not necessarily square

Value

The pseudo-inverse matrix of M.

Examples

library(EigenR)
M <- rbind(
  toeplitz(c(3, 2, 1)), 
  toeplitz(c(4, 5, 6))
)
Mplus <- Eigen_pinverse(M)
all.equal(M, M %*% Mplus %*% M)
all.equal(Mplus, Mplus %*% M %*% Mplus)
#' a complex matrix
A <- M + 1i * M[, c(3L, 2L, 1L)]
Aplus <- Eigen_pinverse(A)
AAplus <- A %*% Aplus
all.equal(AAplus, t(Conj(AAplus))) #' `A %*% Aplus` is Hermitian
AplusA <- Aplus %*% A
all.equal(AplusA, t(Conj(AplusA))) #' `Aplus %*% A` is Hermitian

EigenR documentation built on May 18, 2022, 9:05 a.m.