Learn R Programming

BigDataStatMeth (version 2.0.3)

solve.HDF5Matrix: Matrix inverse of a symmetric positive-definite HDF5Matrix via Cholesky

Description

Computes the matrix inverse of a symmetric positive-definite HDF5Matrix using Cholesky decomposition + back-substitution. Equivalent to base::solve(A) for SPD matrices.

Usage

# S3 method for HDF5Matrix
solve(
  a,
  b,
  full_matrix = TRUE,
  overwrite = FALSE,
  threads = -1L,
  block_size = NULL,
  compression = NULL,
  ...
)

Value

HDF5Matrix containing the matrix inverse.

Arguments

a

An HDF5Matrix (square, symmetric positive-definite).

b

Not supported for HDF5Matrix; must be missing.

full_matrix

Logical. Return full symmetric inverse. Default TRUE.

overwrite

Logical. Overwrite existing result. Default FALSE.

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 hdf5matrix_options (default 6). Use 0 to disable compression (faster for benchmarks).

...

Ignored (for S3 compatibility).

Examples

Run this code
# \donttest{
tmp <- tempfile(fileext = ".h5")

X  <- hdf5_create_matrix(tmp, "data/X", data = matrix(rnorm(10000), 100, 100))

X   <- hdf5_matrix(tmp, "data/X")
AtA <- crossprod(X)              # HDF5Matrix, square SPD
inv <- solve(AtA)               # inverse of AtA

hdf5_close_all()
unlink(tmp)
# }

Run the code above in your browser using DataLab