1#ifndef MPTENSOR_TEST_FILE_IO_COMMON_HPP_
2#define MPTENSOR_TEST_FILE_IO_COMMON_HPP_
23template <
typename TensorType>
27 for (std::size_t
i = 0;
i < t.local_size(); ++
i) {
28 const Index idx = t.global_index(
i);
29 t[
i] = idx[0] + idx[1] * 100 + idx[2] * 10000 + idx[3] * 1000000;
31 t.transpose(
Axes(3, 1, 0, 2));
37 std::ostringstream
ss;
44 std::ostringstream
ss;
45 ss <<
base <<
"." << std::setw(4) << std::setfill(
'0') << rank <<
".bin";
std::complex< double > complex
Definition complex.hpp:38
Index Shape
Definition index.hpp:215
Index Axes
Definition index.hpp:212
Top header file of mptensor.
Definition mpi_helpers.hpp:10
std::string binary_filename(const std::string &base, int rank)
Per-rank binary file written by Tensor::save: "<base>.NNNN.bin".
Definition file_io_common.hpp:43
Tensor< lapack::Matrix< double > > LocalTensorD
Non-distributed tensor types (always LAPACK).
Definition file_io_common.hpp:16
constexpr std::size_t kFileIoN
Definition file_io_common.hpp:19
Tensor< lapack::Matrix< complex > > LocalTensorC
Definition file_io_common.hpp:17
TensorType make_initial_tensor()
Definition file_io_common.hpp:24
std::string data_filename(const std::string &prefix, int proc_size)
"<prefix>_mpi000N" (same names as legacy).
Definition file_io_common.hpp:36