10 h5::file file(
"ex5.h5",
'w');
14 for (
int i = 0;
auto &x : A) x = i++;
15 std::cout <<
"A = " << A << std::endl;
18 h5::write(file,
"A", A);
21 h5::write(file,
"A_v", A(nda::range(0, 5, 2), nda::range(0, 5, 2)));
25 h5::read(file,
"A", A_r);
26 std::cout <<
"A_r = " << A_r << std::endl;
30 auto B_v = B(nda::range(1, 4), nda::range(0, 5, 2));
31 h5::read(file,
"A_v", B_v);
32 std::cout <<
"B = " << B << std::endl;
38 auto slice_r024 = std::make_tuple(nda::range(0, 5, 2), nda::range::all);
41 h5::write(file,
"B", A(nda::range(0, 3), nda::range::all), slice_r024);
44 auto slice_r13 = std::make_tuple(nda::range(1, 5, 2), nda::range::all);
45 h5::write(file,
"B", A(nda::range(3, 5), nda::range::all), slice_r13);
49 auto C_r012 = C(nda::range(0, 3), nda::range::all);
50 h5::read(file,
"A", C_r012, slice_r024);
51 std::cout <<
"C = " << C << std::endl;
54 auto C_r13 = C(nda::range(3, 5), nda::range::all);
55 h5::read(file,
"A", C_r13, slice_r13);
56 std::cout <<
"C = " << C << std::endl;
60 h5::write(file,
"S", S);
64 h5::read(file,
"S", S_r);
65 std::cout <<
"S_r = " << S_r << std::endl;
68 auto I =
nda::array<nda::array<int, 1>, 1>{
nda::array<int, 1>{0, 1, 2},
nda::array<int, 1>{3, 4, 5},
nda::array<int, 1>{6, 7, 8}};
69 h5::write(file,
"I", I);
73 h5::read(file,
"I", I_r);
74 std::cout <<
"I_r = " << I_r << std::endl;
auto zeros(std::array< Int, Rank > const &shape)
Make an array of the given shape on the given address space and zero-initialize it.
basic_array< ValueType, Rank, Layout, 'A', ContainerPolicy > array
Alias template of an nda::basic_array with an 'A' algebra.
Provides HDF5 support for the nda library.
Includes all relevant headers for the core nda library.