DiSMEC++
anonymous_namespace{numpy.cpp} Namespace Reference

Typedefs

using WeightMatrix = Eigen::Matrix< real_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >
 

Functions

std::uint32_t read_header_length (std::streambuf &source)
 
long skip_whitespace (std::string_view source, long position)
 
std::pair< std::string_view, std::string_view > read_key_value (std::string_view source)
 This function parses a single element from a python dict literal. More...
 
io::NpyHeaderData parse_description (std::string_view view)
 
template<class T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > load_matrix_from_npy_imp (std::streambuf &source)
 
template<class T >
void save_matrix_to_npy_imp (std::streambuf &target, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &matrix)
 

Variables

constexpr const char MAGIC [] = {'\x93', 'N', 'U', 'M', 'P', 'Y', '\x03', '\x00'}
 
constexpr const int MAGIC_SIZE = 6
 
constexpr const unsigned NPY_PADDING = 64u
 

Typedef Documentation

◆ WeightMatrix

using anonymous_namespace{numpy.cpp}::WeightMatrix = typedef Eigen::Matrix<real_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>

Definition at line 13 of file numpy.cpp.

Function Documentation

◆ load_matrix_from_npy_imp()

template<class T >
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> anonymous_namespace{numpy.cpp}::load_matrix_from_npy_imp ( std::streambuf &  source)

Definition at line 310 of file numpy.cpp.

References dismec::io::binary_load(), dismec::io::parse_npy_header(), and THROW_ERROR.

◆ parse_description()

◆ read_header_length()

std::uint32_t anonymous_namespace{numpy.cpp}::read_header_length ( std::streambuf &  source)

Definition at line 72 of file numpy.cpp.

References THROW_ERROR.

Referenced by dismec::io::parse_npy_header(), and TEST_CASE().

◆ read_key_value()

std::pair<std::string_view, std::string_view> anonymous_namespace{numpy.cpp}::read_key_value ( std::string_view  source)

This function parses a single element from a python dict literal.

Definition at line 105 of file numpy.cpp.

References skip_whitespace(), dismec::ssize(), THROW_ERROR, and dismec::to_long().

Referenced by parse_description(), and TEST_CASE().

◆ save_matrix_to_npy_imp()

template<class T >
void anonymous_namespace{numpy.cpp}::save_matrix_to_npy_imp ( std::streambuf &  target,
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &  matrix 
)

◆ skip_whitespace()

long anonymous_namespace{numpy.cpp}::skip_whitespace ( std::string_view  source,
long  position 
)

Definition at line 96 of file numpy.cpp.

References dismec::ssize().

Referenced by read_key_value().

Variable Documentation

◆ MAGIC

constexpr const char anonymous_namespace{numpy.cpp}::MAGIC[] = {'\x93', 'N', 'U', 'M', 'P', 'Y', '\x03', '\x00'}
constexpr

◆ MAGIC_SIZE

constexpr const int anonymous_namespace{numpy.cpp}::MAGIC_SIZE = 6
constexpr

Definition at line 18 of file numpy.cpp.

Referenced by dismec::io::is_npy(), dismec::io::parse_npy_header(), and TEST_CASE().

◆ NPY_PADDING

constexpr const unsigned anonymous_namespace{numpy.cpp}::NPY_PADDING = 64u
constexpr

Definition at line 19 of file numpy.cpp.

Referenced by dismec::io::write_npy_header().