11 #include <string_view>
20 bool is_npy(std::istream& target);
41 std::string
make_npy_description(std::string_view dtype_desc,
bool column_major, std::size_t size);
51 std::string
make_npy_description(std::string_view dtype_desc,
bool column_major, std::size_t rows, std::size_t cols);
84 template<
class Derived>
86 return make_npy_description(data_type_string<typename Derived::Scalar>(), !Derived::IsRowMajor, matrix.rows(), matrix.cols());
std::string make_npy_description(std::string_view dtype_desc, bool column_major, std::size_t size)
Creates a string with the data description dictionary for (1 dimensional) arrays.
const char * data_type_string()
void write_npy_header(std::streambuf &target, std::string_view description)
Writes the header for a npy file.
bool is_npy(std::istream &target)
Check whether the stream is a npy file.
types::DenseRowMajor< real_t > load_matrix_from_npy(std::istream &source)
Loads a matrix from a numpy array.
void save_matrix_to_npy(std::ostream &source, const types::DenseRowMajor< real_t > &)
Saves a matrix to a numpy array.
NpyHeaderData parse_npy_header(std::streambuf &source)
Parses the header of the npy file given by source.
outer_const< T, dense_row_major_h > DenseRowMajor