Loading...
Searching...
No Matches
cnpy Namespace Reference

Classes

struct  NpyArray
 

Typedefs

using npz_t = std::map<std::string, NpyArray>
 

Functions

char BigEndianTest ()
 
char map_type (const std::type_info &t)
 
template<typename T >
std::vector< char > create_npy_header (const std::vector< size_t > &shape)
 
void parse_npy_header (FILE *fp, size_t &word_size, std::vector< size_t > &shape, bool &fortran_order, std::string &number_type)
 
void parse_npy_header (unsigned char *buffer, size_t &word_size, std::vector< size_t > &shape, bool &fortran_order, std::string &number_type)
 
void parse_zip_footer (FILE *fp, uint16_t &nrecs, size_t &global_header_size, size_t &global_header_offset)
 
npz_t npz_load (std::string fname)
 
NpyArray npz_load (std::string fname, std::string varname)
 
NpyArray npy_load (std::string fname)
 
template<typename T >
std::vector< char > & operator+= (std::vector< char > &lhs, const T rhs)
 
template<>
std::vector< char > & operator+= (std::vector< char > &lhs, const std::string rhs)
 
template<>
std::vector< char > & operator+= (std::vector< char > &lhs, const char *rhs)
 
template<typename T >
void npy_save (std::string fname, const T *data, const std::vector< size_t > shape, std::string mode="w")
 
template<typename T >
void npz_save (std::string zipname, std::string fname, const T *data, const std::vector< size_t > &shape, std::string mode="w")
 
template<typename T >
void npy_save (std::string fname, const std::vector< T > data, std::string mode="w")
 
template<typename T >
void npz_save (std::string zipname, std::string fname, const std::vector< T > data, std::string mode="w")
 
template<typename T , int dim>
Eigen::Matrix< T, -1, dim > load (Eigen::Matrix< T, -1, dim > &mat, const std::string fname, std::string order="rowMajor")
 
template<typename T >
Eigen::SparseMatrix< Tload (Eigen::SparseMatrix< T > &mat, const std::string fname)
 
template<typename T >
Eigen::Tensor< T, 3 > load (Eigen::Tensor< T, 3 > &tens, const std::string fname, std::string order="rowMajor")
 
template<typename T , int dim>
void save (const Eigen::Matrix< T, -1, dim > &mat, const std::string fname)
 
template<typename T >
void save (const Eigen::Tensor< T, 3 > &tensor, const std::string fname)
 
template<typename T >
void save (const Eigen::SparseMatrix< T > &mat, const std::string fname)
 
cnpy::NpyArray load_the_npy_file (FILE *fp)
 
cnpy::NpyArray load_the_npy_file (std::string fname)
 

Typedef Documentation

◆ npz_t

using cnpy::npz_t = std::map<std::string, NpyArray>

Definition at line 163 of file cnpy.H.

Function Documentation

◆ BigEndianTest()

char cnpy::BigEndianTest ( )

Definition at line 15 of file cnpy.C.

◆ create_npy_header()

template<typename T >
std::vector< char > cnpy::create_npy_header ( const std::vector< size_t > & shape)

Definition at line 374 of file cnpy.H.

◆ load() [1/3]

template<typename T , int dim>
Eigen::Matrix< T, -1, dim > cnpy::load ( Eigen::Matrix< T, -1, dim > & mat,
const std::string fname,
std::string order = "rowMajor" )

◆ load() [2/3]

template<typename T >
Eigen::SparseMatrix< T > cnpy::load ( Eigen::SparseMatrix< T > & mat,
const std::string fname )

Definition at line 608 of file cnpy.C.

◆ load() [3/3]

template<typename T >
Eigen::Tensor< T, 3 > cnpy::load ( Eigen::Tensor< T, 3 > & tens,
const std::string fname,
std::string order = "rowMajor" )

◆ load_the_npy_file() [1/2]

cnpy::NpyArray cnpy::load_the_npy_file ( FILE * fp)

Definition at line 266 of file cnpy.C.

◆ load_the_npy_file() [2/2]

cnpy::NpyArray cnpy::load_the_npy_file ( std::string fname)

Definition at line 284 of file cnpy.C.

◆ map_type()

char cnpy::map_type ( const std::type_info & t)

Definition at line 21 of file cnpy.C.

◆ npy_load()

cnpy::NpyArray cnpy::npy_load ( std::string fname)

Definition at line 464 of file cnpy.C.

◆ npy_save() [1/2]

template<typename T >
void cnpy::npy_save ( std::string fname,
const std::vector< T > data,
std::string mode = "w" )

Definition at line 358 of file cnpy.H.

◆ npy_save() [2/2]

template<typename T >
void cnpy::npy_save ( std::string fname,
const T * data,
const std::vector< size_t > shape,
std::string mode = "w" )

Definition at line 198 of file cnpy.H.

◆ npz_load() [1/2]

cnpy::npz_t cnpy::npz_load ( std::string fname)

Definition at line 329 of file cnpy.C.

◆ npz_load() [2/2]

cnpy::NpyArray cnpy::npz_load ( std::string fname,
std::string varname )

Definition at line 400 of file cnpy.C.

◆ npz_save() [1/2]

template<typename T >
void cnpy::npz_save ( std::string zipname,
std::string fname,
const std::vector< T > data,
std::string mode = "w" )

Definition at line 366 of file cnpy.H.

◆ npz_save() [2/2]

template<typename T >
void cnpy::npz_save ( std::string zipname,
std::string fname,
const T * data,
const std::vector< size_t > & shape,
std::string mode = "w" )

Definition at line 262 of file cnpy.H.

◆ operator+=() [1/3]

template<>
std::vector< char > & cnpy::operator+= ( std::vector< char > & lhs,
const char * rhs )

Definition at line 120 of file cnpy.C.

◆ operator+=() [2/3]

template<>
std::vector< char > & cnpy::operator+= ( std::vector< char > & lhs,
const std::string rhs )

Definition at line 113 of file cnpy.C.

◆ operator+=() [3/3]

template<typename T >
std::vector< char > & cnpy::operator+= ( std::vector< char > & lhs,
const T rhs )

Definition at line 179 of file cnpy.H.

◆ parse_npy_header() [1/2]

void cnpy::parse_npy_header ( FILE * fp,
size_t & word_size,
std::vector< size_t > & shape,
bool & fortran_order,
std::string & number_type )

Definition at line 175 of file cnpy.C.

◆ parse_npy_header() [2/2]

void cnpy::parse_npy_header ( unsigned char * buffer,
size_t & word_size,
std::vector< size_t > & shape,
bool & fortran_order,
std::string & number_type )

Definition at line 135 of file cnpy.C.

◆ parse_zip_footer()

void cnpy::parse_zip_footer ( FILE * fp,
uint16_t & nrecs,
size_t & global_header_size,
size_t & global_header_offset )

Definition at line 240 of file cnpy.C.

◆ save() [1/3]

template<typename T , int dim>
void cnpy::save ( const Eigen::Matrix< T, -1, dim > & mat,
const std::string fname )

◆ save() [2/3]

template<typename T >
void cnpy::save ( const Eigen::SparseMatrix< T > & mat,
const std::string fname )

Definition at line 642 of file cnpy.C.

◆ save() [3/3]

template<typename T >
void cnpy::save ( const Eigen::Tensor< T, 3 > & tensor,
const std::string fname )