Choleski decomposition of a band diagonal matrix
Computes Choleski decomposition of a (symmetric positive definite) band-diagonal matrix, A
.
bandchol(B)
B |
An n by k matrix containing the diagonals of the matrix |
Calls dpbtrf
from LAPACK
. The point of this is that it has O(k^2n) computational cost, rather than the O(n^3) required by dense matrix methods.
Let R
be the factor such that t(R)%*%R = A
. R
is upper triangular and if the rows of B
contained the diagonals of A
on entry, then what is returned is an n by k matrix containing the diagonals of R
, packed as B
was packed on entry. If B
was square on entry, then R
is returned directly. See examples.
Simon N. Wood simon.wood@r-project.org
Anderson, E., Bai, Z., Bischof, C., Blackford, S., Dongarra, J., Du Croz, J., Greenbaum, A., Hammarling, S., McKenney, A. and Sorensen, D., 1999. LAPACK Users' guide (Vol. 9). Siam.
require(mgcv) ## simulate a banded diagonal matrix n <- 7;set.seed(8) A <- matrix(0,n,n) sdiag(A) <- runif(n);sdiag(A,1) <- runif(n-1) sdiag(A,2) <- runif(n-2) A <- crossprod(A) ## full matrix form... bandchol(A) chol(A) ## for comparison ## compact storage form... B <- matrix(0,3,n) B[1,] <- sdiag(A);B[2,1:(n-1)] <- sdiag(A,1) B[3,1:(n-2)] <- sdiag(A,2) bandchol(B)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.