gchol: Generalized Cholesky decompostion

Description Usage Arguments Details Value See Also Examples

Description

Perform the generalized Cholesky decompostion of a real symmetric matrix.

Usage

1
gchol(x, tolerance=1e-10)

Arguments

x

the symmetric matrix to be factored

tolerance

the numeric tolerance for detection of singular columns in x.

Details

A symmetric matrix A can be decomposed as LDL', where L is a lower triangular matrix with 1's on the diagonal, L' is the transpose of L, and D is diagonal. The inverse of L is also lower-triangular, with 1's on the diagonal. If all elements of D are positive, then A must be symmetric positive definite (SPD), and the solution can be reduced the usual Cholesky decomposition U'U where U is upper triangular and U = sqrt(D) L'.

The main advantage of the generalized form is that it admits of matrices that are not of full rank: D will contain zeros marking the redundant columns, and the rank of A is the number of non-zero columns. If all elements of D are zero or positive, then A is a non-negative definite (NND) matrix. The generalized form also has the (quite minor) numerical advantage of not requiring square roots during its calculation. To extract the components of the decompostion, use the diag and as.matrix functions.

The solve has a method for gchol decompostions, and there are gchol methods for block diagonal symmetric (bdsmatrix) matrices as well.

Value

an object of class gchol containing the generalized Cholesky decompostion. It has the appearance of a lower triangular matrix.

See Also

bsdmatrix, solve.gchol

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Create a matrix that is symmetric, but not positive definite
#   The matrix temp has column 6 redundant with cols 1-5
smat <- matrix(1:64, ncol=8)
smat <- smat + t(smat) + diag(rep(20,8))  #smat is 8 by 8 symmetric
temp <-  smat[c(1:5, 5:8), c(1:5, 5:8)]
ch1  <- gchol(temp)

print(as.matrix(ch1), digits=4)   # print out L
print(diag(ch1))        # Note the zero at position 6

ginv <- solve(ch1)    # generalized inverse
diag(ginv)            # also has column 6 marked as singular

Example output

Attaching package: 'bdsmatrix'

The following object is masked from 'package:base':

    backsolve

        [,1]   [,2]    [,3]    [,4]   [,5] [,6]  [,7]   [,8] [,9]
 [1,] 1.0000 0.0000 0.00000  0.0000   0.00    0 0.000 0.0000    0
 [2,] 0.5000 1.0000 0.00000  0.0000   0.00    0 0.000 0.0000    0
 [3,] 0.9091 0.5507 1.00000  0.0000   0.00    0 0.000 0.0000    0
 [4,] 1.3182 0.6812 0.26212  1.0000   0.00    0 0.000 0.0000    0
 [5,] 1.7273 0.8116 0.20557 -0.2909   1.00    0 0.000 0.0000    0
 [6,] 1.7273 0.8116 0.20557 -0.2909   1.00    1 0.000 0.0000    0
 [7,] 2.1364 0.9420 0.14901 -0.5691 -10.53    0 1.000 0.0000    0
 [8,] 2.5455 1.0725 0.09246 -0.8473 -14.73    0 1.481 1.0000    0
 [9,] 2.9545 1.2029 0.03591 -1.1255 -18.93    0 1.901 0.8764    1
[1]   22.000000   34.500000   29.354414   19.748654    2.727273    0.000000
[7] -328.666667   61.955375   42.996333
[1] 0.01558236 0.02852096 0.03751218 0.04255604 0.04365253 0.00000000 0.04080166
[8] 0.03400341 0.02325780

bdsmatrix documentation built on May 2, 2019, 4:45 p.m.

Related to gchol in bdsmatrix...