Checks whether a matrix stored in HDF5 format is suitable for eigenvalue decomposition using Spectra. The function verifies that the matrix is square and optionally checks for symmetry to recommend the best solver type.
Character string. Path to the HDF5 file containing the matrix.
group
Character string. Path to the group containing the dataset.
dataset
Character string. Name of the dataset to check.
check_symmetry
Logical. Whether to check if the matrix is symmetric (default = TRUE).
tolerance
Numeric. Tolerance for symmetry checking (default = 1e-12).
sample_size
Integer. Number of elements to sample for large matrices (default = 1000).
4 Value
A list with matrix properties and suitability assessment.
5 Examples
Code
# Check matrix suitabilitycheck_result <-bdEigen_check_matrix("data.h5", "matrices", "my_matrix")if (check_result$suitable_for_eigen) {# Use appropriate solver based on recommendationif (check_result$recommended_solver =="symmetric") { result <-bdEigen_hdf5("data.h5", "matrices", "my_matrix", which ="LA") } else { result <-bdEigen_hdf5("data.h5", "matrices", "my_matrix", which ="LM") }} else {cat("Matrix is not suitable for eigendecomposition\n")}
Source Code
---title: "bdCheckMatrix_hdf5"subtitle: "bdCheckMatrix_hdf5"---<span class="category-badge hdf5_io_management">HDF5_IO_MANAGEMENT</span>## DescriptionChecks whether a matrix stored in HDF5 format is suitable for eigenvalue decompositionusing Spectra. The function verifies that the matrix is square and optionally checksfor symmetry to recommend the best solver type.## Usage```rbdCheckMatrix_hdf5(filename, group =NULL, dataset =NULL, check_symmetry =NULL, tolerance =NULL, sample_size =NULL)```## Arguments::: {.param-table}| Parameter | Description ||-----------|-------------||`filename`| Character string. Path to the HDF5 file containing the matrix. ||`group`| Character string. Path to the group containing the dataset. ||`dataset`| Character string. Name of the dataset to check. ||`check_symmetry`| Logical. Whether to check if the matrix is symmetric (default = TRUE). ||`tolerance`| Numeric. Tolerance for symmetry checking (default = 1e-12). ||`sample_size`| Integer. Number of elements to sample for large matrices (default = 1000). |:::## Value::: {.return-value}A list with matrix properties and suitability assessment.:::## Examples```{r}#| eval: false#| code-fold: show# Check matrix suitabilitycheck_result <-bdEigen_check_matrix("data.h5", "matrices", "my_matrix")if (check_result$suitable_for_eigen) {# Use appropriate solver based on recommendationif (check_result$recommended_solver =="symmetric") { result <-bdEigen_hdf5("data.h5", "matrices", "my_matrix", which ="LA") } else { result <-bdEigen_hdf5("data.h5", "matrices", "my_matrix", which ="LM") }} else {cat("Matrix is not suitable for eigendecomposition\n")}```