Character string. Path to the group containing the dataset.
dataset
Character string. Name of the dataset to modify.
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: Character string with the full dataset path to the diagonal elements written (group/dataset)
5 Details
This function provides efficient diagonal modification capabilities with: - Write features: - Direct diagonal access - Type checking and validation - Support for large matrices - Implementation features: - Safe HDF5 file operations - Memory-efficient implementation - Comprehensive error handling - Type conversion support
The function validates input types and dimensions before modification.
6 Examples
Code
library(BigDataStatMeth)# Create test matrixX <-matrix(rnorm(100), 10, 10)# Save to HDF5bdCreate_hdf5_matrix("test.hdf5", X, "data", "matrix1",overwriteFile =TRUE)# Create new diagonalnew_diag <-seq(1, 10)# Update diagonalbdWriteDiagonal_hdf5(new_diag, "test.hdf5", "data", "matrix1")# Verifydiag_elements <-bdgetDiagonal_hdf5("test.hdf5", "data", "matrix1")print(diag_elements)# Cleanupif (file.exists("test.hdf5")) {file.remove("test.hdf5")}
---title: "bdWriteDiagonal_hdf5"subtitle: "bdWriteDiagonal_hdf5"---<span class="category-badge hdf5_algebra">HDF5_ALGEBRA</span>## DescriptionUpdates the diagonal elements of a matrix stored in an HDF5 file.## Usage```rbdWriteDiagonal_hdf5(diagonal, filename, group, dataset)```## Arguments::: {.param-table}| Parameter | Description ||-----------|-------------||`diagonal`| Numeric vector. New diagonal elements to write. ||`filename`| Character string. Path to the HDF5 file. ||`group`| Character string. Path to the group containing the dataset. ||`dataset`| Character string. Name of the dataset to modify. |:::## 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`**: Character string with the full dataset path to the diagonal elements written (group/dataset):::## DetailsThis function provides efficient diagonal modification capabilities with:- Write features: - Direct diagonal access - Type checking and validation - Support for large matrices- Implementation features: - Safe HDF5 file operations - Memory-efficient implementation - Comprehensive error handling - Type conversion supportThe function validates input types and dimensions before modification.## Examples```{r}#| eval: false#| code-fold: showlibrary(BigDataStatMeth)# Create test matrixX <-matrix(rnorm(100), 10, 10)# Save to HDF5bdCreate_hdf5_matrix("test.hdf5", X, "data", "matrix1",overwriteFile =TRUE)# Create new diagonalnew_diag <-seq(1, 10)# Update diagonalbdWriteDiagonal_hdf5(new_diag, "test.hdf5", "data", "matrix1")# Verifydiag_elements <-bdgetDiagonal_hdf5("test.hdf5", "data", "matrix1")print(diag_elements)# Cleanupif (file.exists("test.hdf5")) {file.remove("test.hdf5")}```## See Also::: {.see-also}- [bdgetDiagonal_hdf5](bdgetDiagonal_hdf5.html) for reading diagonal elements- [bdCreate_hdf5_matrix](../hdf5_io_management/bdCreate_hdf5_matrix.html) for creating HDF5 matrices:::