library(BigDataStatMeth)
# Create a singular matrix
X <- matrix(c(1,2,3,2,4,6), 2, 3)
fn <- "test.hdf5"
# Save to HDF5
bdCreate_hdf5_matrix(filename = fn,
object = X,
group = "data",
dataset = "X",
overwriteFile = TRUE)
# Compute pseudoinverse
bdpseudoinv_hdf5(filename = fn,
group = "data",
dataset = "X",
outgroup = "results",
outdataset = "X_pinv",
overwrite = TRUE)
# Cleanup
if (file.exists(fn)) {
file.remove(fn)
}bdpseudoinv_hdf5
bdpseudoinv_hdf5
HDF5_ALGEBRA
1 Description
Computes the Moore-Penrose pseudoinverse of a matrix stored in HDF5 format. The implementation is designed for large matrices, using block-based processing and efficient I/O operations.
2 Usage
bdpseudoinv_hdf5(filename, group, dataset, outgroup = NULL, outdataset = NULL, overwrite = NULL, threads = NULL)3 Arguments
| Parameter | Description |
|---|---|
filename |
String. Path to the HDF5 file. |
group |
String. Group containing the input matrix. |
dataset |
String. Dataset name for the input matrix. |
outgroup |
Optional string. Output group name (defaults to “PseudoInverse”). |
outdataset |
Optional string. Output dataset name (defaults to input dataset name). |
overwrite |
Logical. Whether to overwrite existing results. |
threads |
Optional integer. Number of threads for parallel computation. |
4 Value
List with components. If an error occurs, all string values are returned as empty strings (““):
fn: Character string with the HDF5 filenameds: Character string with the full dataset path to the pseudoinverse matrix (group/dataset)
5 Details
This function provides an HDF5-based implementation for computing pseudoinverses of large matrices. Key features: - HDF5 Integration: - Efficient reading of input matrix - Block-based processing for large matrices - Memory-efficient computation - Direct output to HDF5 format - Implementation Features: - SVD-based computation - Parallel processing support - Automatic memory management - Flexible output options
The function handles: - Data validation - Memory management - Error handling - HDF5 file operations
6 Examples
7 See Also
- bdpseudoinv for in-memory computation
- bdCreate_hdf5_matrix for creating HDF5 matrices