25 explicit MatrixIO(
const std::filesystem::path &path,
char separator =
',')
26 : _path(std::move(path)), _separator(separator) {};
83 requires(std::is_floating_point_v<T>)
102 template <
typename T>
104 bool has_header =
false) {
106 Matrix<T> resp{io.read_text_file<T>(has_header)};
124 template <
typename T>
126 char separator =
',') {
147 template <
typename T>
148 requires(std::is_floating_point_v<T>)
150 const std::filesystem::path &path,
char separator =
',') {
156 std::filesystem::path _path;
166 using std::runtime_error::runtime_error;
A class representing a matrix, derived from Tensor.
Exceptions concerning txeo::MatrixIO.
A class to read file data to matrix and to write file data to a matrix.
void write_text_file(const txeo::Matrix< T > &matrix, size_t precision) const
Writes a floating-point matrix with specified precision to a text file.
void write_text_file(const txeo::Matrix< T > &matrix) const
Writes a matrix to a text file.
MatrixIO(const std::filesystem::path &path, char separator=',')
Constructs MatrixIO object.
static void write_textfile(const txeo::Matrix< T > &matrix, const std::filesystem::path &path, char separator=',')
Writes a matrix to a text file.
txeo::Matrix< T > read_text_file(bool has_header=false) const
Returns a matrix with elements read from a text file.
static txeo::Matrix< T > read_textfile(const std::filesystem::path &path, char separator=',', bool has_header=false)
Returns a matrix with elements read from a text file.
static void write_textfile(const txeo::Matrix< T > &matrix, size_t precision, const std::filesystem::path &path, char separator=',')
Writes a floating-point matrix with specified precision to a text file.