View source: R/S3_factorizations.R
| chol.HDF5Matrix | R Documentation |
Computes the Cholesky factor and returns it as an upper-triangular matrix U
such that t(U) %*% U == A, consistent with base::chol().
The internal C++ algorithm computes the lower-triangular factor L (A = L L');
the R/HDF5 transposition convention means the user receives L' = U.
The input matrix must be square and symmetric positive-definite.
## S3 method for class 'HDF5Matrix'
chol(
x,
full_matrix = FALSE,
overwrite = FALSE,
threads = -1L,
block_size = NULL,
compression = NULL,
...
)
x |
An |
full_matrix |
Logical. Return full symmetric matrix (L + L').
Default |
overwrite |
Logical. Overwrite existing result. Default |
threads |
Integer. OpenMP threads (-1 = auto). |
block_size |
Integer or NULL. Elements per block. NULL = auto. |
compression |
Integer (0-9) or NULL. gzip compression level for the
result dataset. NULL uses the global option set by
|
... |
Ignored (for S3 compatibility). |
HDF5Matrix containing the upper-triangular Cholesky factor U
such that t(U) %*% U == A (consistent with base::chol()).
tmp <- tempfile(fileext = ".h5")
X <- hdf5_create_matrix(tmp, "data/X", data = matrix(rnorm(10000), 100, 100))
# Create a symmetric positive-definite matrix: A = t(X) %*% X
X <- hdf5_matrix(tmp, "data/X")
AtA <- crossprod(X) # HDF5Matrix, square SPD
L <- chol(AtA)
hdf5_close_all()
unlink(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.