Computes the QR decomposition of a matrix stored in an HDF5 file, factoring it into a product A = QR where Q is an orthogonal matrix and R is an upper triangular matrix. Results are stored back in the HDF5 file.
Character string. Path to the HDF5 file containing the input matrix.
group
Character string. Path to the group containing the input dataset.
dataset
Character string. Name of the input dataset to decompose.
outgroup
Character string. Optional output group path where results will be stored. If not provided, results are stored in <input_group>/QRDec.
outdataset
Character string. Optional base name for output datasets. Results will be stored as Q.'outdataset' and R.'outdataset'.
thin
Logical. If TRUE, computes the reduced (thin) QR decomposition. If FALSE (default), computes the full decomposition.
block_size
Integer. Optional block size for blocked computation.
overwrite
Logical. If TRUE, allows overwriting existing datasets. Default is FALSE.
threads
Integer. Optional number of threads for parallel computation. If NULL, uses all available threads.
4 Value
List with components. If an error occurs, all string values are returned as empty strings (““):
fn: Character string with the HDF5 filename
ds_Q: Character string with the full dataset path to the Q matrix (orthogonal matrix). Results are written to the HDF5 file as “Q.’outdataset’” within the specified group
ds_R: Character string with the full dataset path to the R matrix (upper triangular matrix). Results are written to the HDF5 file as “R.’outdataset’” within the specified group
5 Details
This function performs QR decomposition on large matrices stored in HDF5 format, which is particularly useful for matrices too large to fit in memory. Features include: - Support for both thin and full QR decomposition - Blocked computation for improved performance - Parallel processing capabilities - Flexible output location specification - Optional overwriting of existing datasets
6 Examples
Code
# Create a sample HDF5 file with a matrixlibrary(rhdf5)A <-matrix(rnorm(1000), 100, 10)h5createFile("example.h5")h5write(A, "example.h5", "mygroup/mymatrix")# Compute QR decompositionbdQR_hdf5("example.h5", "mygroup", "mymatrix",outgroup ="mygroup/results",outdataset ="qr_result",thin =TRUE)
---title: "bdQR_hdf5"subtitle: "bdQR_hdf5"---<span class="category-badge hdf5_algebra">HDF5_ALGEBRA</span>## DescriptionComputes the QR decomposition of a matrix stored in an HDF5 file, factoring it into a product A = QR where Q is an orthogonal matrix and R is an upper triangular matrix.Results are stored back in the HDF5 file.## Usage```rbdQR_hdf5(filename, group, dataset, outgroup =NULL, outdataset =NULL, thin =NULL, block_size =NULL, overwrite =NULL, threads =NULL)```## Arguments::: {.param-table}| Parameter | Description ||-----------|-------------||`filename`| Character string. Path to the HDF5 file containing the input matrix. ||`group`| Character string. Path to the group containing the input dataset. ||`dataset`| Character string. Name of the input dataset to decompose. ||`outgroup`| Character string. Optional output group path where results will be stored. If not provided, results are stored in `<input_group>/QRDec`. ||`outdataset`| Character string. Optional base name for output datasets. Results will be stored as `Q.'outdataset'` and `R.'outdataset'`. ||`thin`| Logical. If TRUE, computes the reduced (thin) QR decomposition. If FALSE (default), computes the full decomposition. ||`block_size`| Integer. Optional block size for blocked computation. ||`overwrite`| Logical. If TRUE, allows overwriting existing datasets. Default is FALSE. ||`threads`| Integer. Optional number of threads for parallel computation. If NULL, uses all available threads. |:::## Value::: {.return-value}List with components. If an error occurs, all string values are returned as empty strings (""):- **`fn`**: Character string with the HDF5 filename- **`ds_Q`**: Character string with the full dataset path to the Q matrix (orthogonal matrix). Results are written to the HDF5 file as "Q.'outdataset'" within the specified group- **`ds_R`**: Character string with the full dataset path to the R matrix (upper triangular matrix). Results are written to the HDF5 file as "R.'outdataset'" within the specified group:::## DetailsThis function performs QR decomposition on large matrices stored in HDF5 format,which is particularly useful for matrices too large to fit in memory. Features include:- Support for both thin and full QR decomposition- Blocked computation for improved performance- Parallel processing capabilities- Flexible output location specification- Optional overwriting of existing datasets## Examples```{r}#| eval: false#| code-fold: show# Create a sample HDF5 file with a matrixlibrary(rhdf5)A <-matrix(rnorm(1000), 100, 10)h5createFile("example.h5")h5write(A, "example.h5", "mygroup/mymatrix")# Compute QR decompositionbdQR_hdf5("example.h5", "mygroup", "mymatrix",outgroup ="mygroup/results",outdataset ="qr_result",thin =TRUE)```## See Also::: {.see-also}[bdQR](../linear_algebra/bdQR.html) for QR decomposition of in-memory matrices:::