The Bunch-Kaufman Decomposition of a square symmetric matrix A
is A = P LDL' P' where P is a permutation matrix, L
is unit-lower triangular and D is block-diagonal
with blocks of dimension 1 x 1 or 2 x 2.
Usage
BunchKaufman(x, ...)
Arguments
x
a symmetric square matrix.
...
potentially further arguments passed to methods.
Value
an object of class BunchKaufman, which can also
be used as a (triangular) matrix directly.
Methods
Currently, only methods for dense numeric symmetric matrices
are implemented.
x = "dspMatrix"
uses Lapack routine dsptrf,
x = "dsyMatrix"
uses Lapack routine dsytrf,
computing the Bunch-Kaufman decomposition.
The resulting class, BunchKaufman.
Related decompositions are the LU, lu, and the Cholesky,
chol (and for sparse matrices,
Cholesky).
Examples
data(CAex)
dim(CAex)
isSymmetric(CAex)# TRUE
CAs <- as(CAex, "symmetricMatrix")
if(FALSE) # no method defined yet for *sparse* :
bk. <- BunchKaufman(CAs)
## does apply to *dense* symmetric matrices:
bkCA <- BunchKaufman(as(CAs, "denseMatrix"))
bkCA
image(bkCA)# shows how sparse it is, too
str(R.CA <- as(bkCA, "sparseMatrix"))
## an upper triangular 72x72 matrix with only 144 non-zero entries
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Matrix)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Matrix/BunchKaufman-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: BunchKaufman-methods
> ### Title: Bunch-Kaufman Decomposition Methods
> ### Aliases: BunchKaufman BunchKaufman-methods
> ### BunchKaufman,dspMatrix-method BunchKaufman,dsyMatrix-method
> ### Keywords: methods
>
> ### ** Examples
>
> data(CAex)
> dim(CAex)
[1] 72 72
> isSymmetric(CAex)# TRUE
[1] TRUE
> CAs <- as(CAex, "symmetricMatrix")
> if(FALSE) # no method defined yet for *sparse* :
+ bk. <- BunchKaufman(CAs)
> ## does apply to *dense* symmetric matrices:
> bkCA <- BunchKaufman(as(CAs, "denseMatrix"))
> bkCA
'Bunch-Kaufman' factorization of Formal class 'BunchKaufman' [package "Matrix"] with 6 slots
..@ perm : int [1:72] 1 2 3 4 5 6 7 8 9 10 ...
..@ x : num [1:5184] 4.16e-16 0.00 0.00 0.00 0.00 ...
..@ Dim : int [1:2] 72 72
..@ Dimnames:List of 2
.. ..$ : NULL
.. ..$ : NULL
..@ uplo : chr "U"
..@ diag : chr "N"
>
> image(bkCA)# shows how sparse it is, too
> str(R.CA <- as(bkCA, "sparseMatrix"))
Formal class 'dtCMatrix' [package "Matrix"] with 7 slots
..@ i : int [1:144] 0 1 2 3 4 5 6 7 8 9 ...
..@ p : int [1:73] 0 1 2 3 4 5 6 7 8 9 ...
..@ Dim : int [1:2] 72 72
..@ Dimnames:List of 2
.. ..$ : NULL
.. ..$ : NULL
..@ x : num [1:144] 4.16e-16 -7.77e-16 -4.16e-16 -2.78e-16 -5.00e-16 ...
..@ uplo : chr "U"
..@ diag : chr "N"
> ## an upper triangular 72x72 matrix with only 144 non-zero entries
>
>
>
>
>
> dev.off()
null device
1
>