invswp#

Purpose#

Computes a generalized sweep inverse.

Format#

xig = invswp(x)#
Parameters:

x (NxN matrix) – data

Returns:

xig (NxN matrix) – the generalized inverse of x.

Remarks#

This will invert any general matrix. That is, even matrices which will not invert using inv() because they are singular will invert using invswp().

x and xig will satisfy the two conditions:

  1. \(x*xig*x = x\)

  2. \(xig*x*xig = y\)

invswp() returns a row and column with zeros when the pivot fails. This is good for quadratic forms since it essentially removes rows with redundant information, i.e., the statistics generated will be “correct” but with reduced degrees of freedom.

The tolerance used to determine if a pivot element is zero is taken from the crout() singularity tolerance. The corresponding row and column are zeroed out. See Singularity Tolerance.