bdpseudoinv

bdpseudoinv

LINEAR_ALGEBRA

1 Description

Computes the Moore-Penrose pseudoinverse of a matrix using SVD decomposition. This implementation handles both square and rectangular matrices, and provides numerically stable results even for singular or near-singular matrices.

2 Usage

bdpseudoinv(X, threads = NULL)

3 Arguments

Parameter Description
X Numeric matrix or vector to be pseudoinverted.
threads Optional integer. Number of threads for parallel computation. If NULL, uses maximum available threads.

4 Value

The pseudoinverse matrix of X.

5 Details

The Moore-Penrose pseudoinverse (denoted A+) of a matrix A is computed using Singular Value Decomposition (SVD).

For a matrix A = USigmaV^T (where ^T denotes transpose), the pseudoinverse is computed as:

where Sigma+ is obtained by taking the reciprocal of non-zero singular values.

6 Examples

library(BigDataStatMeth)

# Create a singular matrix
X <- matrix(c(1,2,3,2,4,6), 2, 3)  # rank-deficient matrix

# Compute pseudoinverse
X_pinv <- bdpseudoinv(X)

# Verify Moore-Penrose conditions
# 1. X %*% X_pinv %*% X = X
all.equal(X %*% X_pinv %*% X, X)

# 2. X_pinv %*% X %*% X_pinv = X_pinv
all.equal(X_pinv %*% X %*% X_pinv, X_pinv)

7 See Also