sisi4s
Loading...
Searching...
No Matches
TensorIo.hpp
Go to the documentation of this file.
1#ifndef TENSOR_IO_DEFINED
2#define TENSOR_IO_DEFINED
3
4#include <util/Scanner.hpp>
5#include <util/Tensor.hpp>
6
7namespace sisi4s {
8class TensorIo {
9public:
10 template <typename F = real, typename T = Tensor<F>>
11 static T *readBinary(std::string const &fileName);
12 template <typename F = real, typename T = Tensor<F>>
13 static T *readText(std::string const &fileName,
14 std::string const &delimiter = " ",
15 int64_t const bufferSize = 1024 * 1024 * 1024);
16
17 template <typename F = real, typename T = Tensor<F>>
18 static void writeBinary(std::string const &fileName, T &A);
19 template <typename F = real, typename T = Tensor<F>>
20 static void writeText(std::string const &fileName,
21 T &A,
22 std::string const &rowIndexOrder,
23 std::string const &columnIndexOrder,
24 std::string const &delimiter = " ");
25
26protected:
27 template <typename F = real, typename T = Tensor<F>>
28 static T *readBinaryHeader(MPI_File &file, int64_t &offset);
29 template <typename F = real, typename T = Tensor<F>>
30 static T *readTextHeader(Scanner &scanner);
31};
32} // namespace sisi4s
33
34#endif
Definition Scanner.hpp:13
Definition TensorIo.hpp:8
static T * readText(std::string const &fileName, std::string const &delimiter=" ", int64_t const bufferSize=1024 *1024 *1024)
Definition TensorIo.cxx:39
static void writeBinary(std::string const &fileName, T &A)
Definition TensorIo.cxx:120
static void writeText(std::string const &fileName, T &A, std::string const &rowIndexOrder, std::string const &columnIndexOrder, std::string const &delimiter=" ")
Definition TensorIo.cxx:158
static T * readBinary(std::string const &fileName)
Definition TensorIo.cxx:13
static T * readBinaryHeader(MPI_File &file, int64_t &offset)
Definition TensorIo.cxx:229
static T * readTextHeader(Scanner &scanner)
Definition Algorithm.hpp:10