Learn R Programming

VCA (version 1.3.4)

Sinv: Calling C-implementation of the SWEEP-Operator for Matrix-Inversion

Description

Function calls a fast C-implementation of the SWEEP operator using the transpose of the matrix to be swept for generating a generalized inverse of a matrix for which no regular matrix invers exists.

Usage

Sinv(M, tol = .Machine$double.eps)

Arguments

M

(matrix) matrix, representing the augmented matrix \(X'X\)

tol

(numeric) value used to check numerical equivalence to zero

Value

(Matrix) object corresponding to the inverted matrix

Details

Transposing prior to applying the SWEEP-operator speeds up things since the complete matrix is stored in memory in consecutive manner. This version of the SWEEP-operator is intended for matrix inversion only, thus, not computing ANOVA sum of squares and number of linear dependencies (see function Csweep).

This is an utility-function not intended to be called directly.

Examples

Run this code
# NOT RUN {
M <- matrix(c(4,-6,6,-9),2)
solve(m)			# regular inverse does not exist
Mi1 <- MPinv(M)			# MASS-implementation 'ginv'
Mi1
M %*% Mi1 %*% M			# should be M
Mi2 <- VCA:::Sinv(M)
Mi2
M %*% Mi2 %*% M			# should be M
# }

Run the code above in your browser using DataLab