29 bool okay = hd.
create(
"test_write_matrix_reshape.hdf");
40 std::array<int, 2> shape{2, 3};
43 std::vector<std::complex<float>> v_cplx(6);
44 v_cplx[0] = {0.0, 0.2};
45 v_cplx[1] = {0.1, 0.3};
46 v_cplx[2] = {0.2, 0.4};
47 v_cplx[3] = {1.0, 1.2};
48 v_cplx[4] = {1.1, 1.3};
49 v_cplx[5] = {1.2, 1.4};
55 hd2.
open(
"test_write_matrix_reshape.hdf");
58 hd2.
read(
m,
"matrix_from_vector");
62 CHECK(
m(0, 0) == Approx(v[0]));
63 CHECK(
m(0, 1) == Approx(v[1]));
64 CHECK(
m(0, 2) == Approx(v[2]));
65 CHECK(
m(1, 0) == Approx(v[3]));
66 CHECK(
m(1, 1) == Approx(v[4]));
67 CHECK(
m(1, 2) == Approx(v[5]));
69 std::vector<double> vec;
73 CHECK(vec[0] == Approx(v[0]));
74 CHECK(vec[1] == Approx(v[1]));
75 CHECK(vec[2] == Approx(v[2]));
76 CHECK(vec[3] == Approx(v[3]));
77 CHECK(vec[4] == Approx(v[4]));
78 CHECK(vec[5] == Approx(v[5]));
82 std::array<int, 2> spec{-1, -1};
86 CHECK(vec_cplx[0] == ComplexApprox(v_cplx[0]));
87 CHECK(vec_cplx[1] == ComplexApprox(v_cplx[1]));
88 CHECK(vec_cplx[2] == ComplexApprox(v_cplx[2]));
89 CHECK(vec_cplx[3] == ComplexApprox(v_cplx[3]));
90 CHECK(vec_cplx[4] == ComplexApprox(v_cplx[4]));
91 CHECK(vec_cplx[5] == ComplexApprox(v_cplx[5]));
bool open(const std::filesystem::path &fname, unsigned flags=H5F_ACC_RDWR)
open a file
helper functions for EinsplineSetBuilder
TEST_CASE("complex_helper", "[type_traits]")
void close()
close all the open groups and file
void readSlabReshaped(T &data, const std::array< IT, RANK > &shape, const std::string &aname)
read file dataset with a specific shape into a container and check status
void readSlabSelection(T &data, const std::array< IT, RANK > &readSpec, const std::string &aname)
read a portion of the data from the group aname and check status runtime error is issued on I/O error...
size_type size() const
return the current size
REQUIRE(std::filesystem::exists(filename))
void writeSlabReshaped(T &data, const std::array< IT, RANK > &shape, const std::string &aname)
write the container data with a specific shape and check status
Declaraton of Vector<T,Alloc> Manage memory through Alloc directly and allow referencing an existing ...
bool create(const std::filesystem::path &fname, unsigned flags=H5F_ACC_TRUNC)
create a file
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void read(T &data, const std::string &aname)
read the data from the group aname and check status runtime error is issued on I/O error ...