#include <armadillo>
#include <h5cpp/all>
#include <iostream>
int main() {
arma::Col<short> M(10, arma::fill::zeros);
h5::current_dims{10, 100},
h5::max_dims{10, H5S_UNLIMITED},
h5::chunk{10, 10} | h5::gzip{9} | h5::fill_value<short>{0});
for (short i = 0; i < 4; ++i) {
M.fill(static_cast<short>(i + 1));
h5::write(ds, M, h5::offset{0,
static_cast<hsize_t
>(i)});
}
h5::offset offset{0, 0};
h5::count count {10, 1};
for (short i = 10; i < 15; ++i) {
offset[1] = static_cast<hsize_t>(i);
M.fill(static_cast<short>(i + 1));
}
for (int c = 0; c < 15; ++c) {
h5::offset{0, static_cast<hsize_t>(c)}, h5::count{10, 1});
head_of_each_col[c] = col(0);
}
std::cout <<
"col[0..14](row 0): " << head_of_each_col <<
"\n";
h5::offset{0, 11}, h5::count{10, 1});
for (arma::uword r = 0; r < col11.n_elem; ++r) col11_vals[r] = col11(r);
std::cout <<
"column 11 : " << col11_vals <<
"\n";
return 0;
}
h5::at_t create(const hid_t &parent, const std::string &path, args_t &&... args)
Create a new attribute of element type T on a parent HDF5 object.
Definition H5Acreate.hpp:100
T aread(const hid_t &ds, const std::string &name, const h5::acpl_t &acpl=h5::default_acpl)
Read an attribute by name and return its value as type T.
Definition H5Aread.hpp:76
h5::gr_t write(const LOC &parent, const std::string &path, const T &src)
Write a sparse matrix or vector as a CSC group.
Definition H5Dsparse.hpp:185