SG++-Doxygen-Documentation
|
Namespace with functions to write data (vectors, matrices, grids, ...) to a file. More...
Functions | |
template<> | |
const char * | getTypeString (const std::vector< uint8_t > &A) |
template<> | |
const char * | getTypeString (const std::vector< uint16_t > &A) |
template<> | |
const char * | getTypeString (const std::vector< uint32_t > &A) |
template<> | |
const char * | getTypeString (const std::vector< uint64_t > &A) |
template<> | |
const char * | getTypeString (const std::vector< float > &A) |
template<> | |
const char * | getTypeString (const std::vector< double > &A) |
template<class T > | |
const char * | getTypeString (const std::vector< T > &A) |
template<> | |
const char * | getTypeString (const std::vector< std::string > &A) |
template<> | |
void | readEntry (std::ifstream &f, std::string &entry) |
Read string from input stream (called by readMatrix()). More... | |
template<class T > | |
void | readEntry (std::ifstream &f, T &entry) |
Read bytes of entry representation from input stream (called by readMatrix()). More... | |
void | readGrid (const std::string &filename, base::GridStorage &gridStorage) |
Read a grid (only grid points) from a file. More... | |
void | readGrid (const std::string &filename, base::GridStorage &gridStorage, base::DataVector &functionValues) |
Read a grid (grid points and function values) from a file. More... | |
void | readMatrix (const std::string &filename, base::DataMatrix &A) |
Read a matrix from a file. More... | |
template<class T > | |
void | readMatrix (const std::string &filename, std::vector< T > &A, size_t &m, size_t &n) |
Read a matrix (stored row-wise in a std::vector) from a file. More... | |
void | readVector (const std::string &filename, base::DataVector &x) |
Read a base::DataVector from a file. More... | |
template<class T > | |
void | readVector (const std::string &filename, std::vector< T > &x) |
Read a std::vector from a file. More... | |
template<> | |
void | writeEntry (std::ofstream &f, const std::string &entry) |
Write string to output stream (called by writeMatrix()). More... | |
template<class T > | |
void | writeEntry (std::ofstream &f, const T &entry) |
Write bytes of entry representation to output stream (called by writeMatrix()). More... | |
void | writeGrid (const std::string &filename, const base::GridStorage &gridStorage) |
Write a grid (only grid points) to a file. More... | |
void | writeGrid (const std::string &filename, const base::GridStorage &gridStorage, const base::DataVector &functionValues) |
Write a grid (grid points and function values) to a file. More... | |
void | writeMatrix (const std::string &filename, base::DataMatrix &A) |
Write a base::DataMatrix to a file. More... | |
template<class T > | |
void | writeMatrix (const std::string &filename, const std::vector< T > &A, size_t m, size_t n) |
Write a matrix (stored row-wise in a std::vector) to a file. More... | |
void | writeVector (const std::string &filename, base::DataVector &x) |
Write a base::DataVector to a file. More... | |
template<class T > | |
void | writeVector (const std::string &filename, const std::vector< T > &x) |
Write a std::vector to a file. More... | |
Namespace with functions to write data (vectors, matrices, grids, ...) to a file.
const char * sgpp::optimization::file_io::getTypeString | ( | const std::vector< uint8_t > & | A | ) |
A | ignored |
Referenced by getTypeString(), readMatrix(), and writeMatrix().
const char * sgpp::optimization::file_io::getTypeString | ( | const std::vector< uint16_t > & | A | ) |
A | ignored |
const char * sgpp::optimization::file_io::getTypeString | ( | const std::vector< uint32_t > & | A | ) |
A | ignored |
const char * sgpp::optimization::file_io::getTypeString | ( | const std::vector< uint64_t > & | A | ) |
A | ignored |
const char * sgpp::optimization::file_io::getTypeString | ( | const std::vector< float > & | A | ) |
A | ignored |
const char * sgpp::optimization::file_io::getTypeString | ( | const std::vector< double > & | A | ) |
A | ignored |
const char* sgpp::optimization::file_io::getTypeString | ( | const std::vector< T > & | A | ) |
A | ignored |
References python.utils.converter::filename, getTypeString(), python.utils.sg_projections::gridStorage, readGrid(), writeGrid(), and writeMatrix().
const char * sgpp::optimization::file_io::getTypeString | ( | const std::vector< std::string > & | A | ) |
A | ignored |
void sgpp::optimization::file_io::readEntry | ( | std::ifstream & | f, |
std::string & | entry | ||
) |
Read string from input stream (called by readMatrix()).
f | input stream to be read | |
[out] | entry | entry to be read |
Referenced by readEntry(), and readMatrix().
void sgpp::optimization::file_io::readEntry | ( | std::ifstream & | f, |
T & | entry | ||
) |
Read bytes of entry representation from input stream (called by readMatrix()).
f | input stream to be read | |
[out] | entry | entry to be read |
References readEntry().
void sgpp::optimization::file_io::readGrid | ( | const std::string & | filename, |
base::GridStorage & | gridStorage | ||
) |
Read a grid (only grid points) from a file.
The format is as in writeGrid (discarding function values).
filename | filename of the file to be read | |
[out] | gridStorage | grid storage containing the grid points |
Referenced by getTypeString().
void sgpp::optimization::file_io::readGrid | ( | const std::string & | filename, |
base::GridStorage & | gridStorage, | ||
base::DataVector & | functionValues | ||
) |
Read a grid (grid points and function values) from a file.
The format is as in writeGrid.
filename | filename of the file to be read | |
[out] | gridStorage | grid storage containing the grid points |
[out] | functionValues | vector of function values |
References sgpp::base::HashGridStorage::clear(), python.statsfileInfo::f, python.statsfileInfo::i, sgpp::base::HashGridStorage::insert(), python.utils.statsfile2gnuplot::j, parabola::N, and sgpp::base::HashGridPoint::set().
void sgpp::optimization::file_io::readMatrix | ( | const std::string & | filename, |
base::DataMatrix & | A | ||
) |
Read a matrix from a file.
The format is as in writeMatrix.
filename | filename of the file to be read | |
[out] | A | matrix |
References m, and sgpp::base::DataMatrix::resize().
Referenced by readVector(), and writeMatrix().
void sgpp::optimization::file_io::readMatrix | ( | const std::string & | filename, |
std::vector< T > & | A, | ||
size_t & | m, | ||
size_t & | n | ||
) |
Read a matrix (stored row-wise in a std::vector) from a file.
The format is as in writeMatrix.
filename | filename of the file to be written | |
[out] | A | matrix |
[out] | m | number of rows |
[out] | n | number of columns |
References python.statsfileInfo::f, getTypeString(), python.statsfileInfo::i, readEntry(), create_dataset::type, and writeVector().
void sgpp::optimization::file_io::readVector | ( | const std::string & | filename, |
base::DataVector & | x | ||
) |
Read a base::DataVector from a file.
It's readMatrix with the vector as one row.
filename | filename of the file to be read | |
[out] | x | vector |
References m, and readMatrix().
Referenced by writeVector().
void sgpp::optimization::file_io::readVector | ( | const std::string & | filename, |
std::vector< T > & | x | ||
) |
Read a std::vector from a file.
It's readMatrix with the vector as one row.
filename | filename of the file to be read | |
[out] | x | vector |
References m, and readMatrix().
void sgpp::optimization::file_io::writeEntry | ( | std::ofstream & | f, |
const std::string & | entry | ||
) |
Write string to output stream (called by writeMatrix()).
f | output stream to be written to |
entry | entry to be written |
Referenced by writeEntry(), and writeMatrix().
void sgpp::optimization::file_io::writeEntry | ( | std::ofstream & | f, |
const T & | entry | ||
) |
Write bytes of entry representation to output stream (called by writeMatrix()).
f | output stream to be written to |
entry | entry to be written |
References python.statsfileInfo::f, and writeEntry().
void sgpp::optimization::file_io::writeGrid | ( | const std::string & | filename, |
const base::GridStorage & | gridStorage | ||
) |
Write a grid (only grid points) to a file.
The format is the same as the version with functions values with all function values set to zero.
filename | filename of the file to be written |
gridStorage | grid storage containing the grid points |
References sgpp::base::HashGridStorage::getSize(), and parabola::N.
Referenced by getTypeString().
void sgpp::optimization::file_io::writeGrid | ( | const std::string & | filename, |
const base::GridStorage & | gridStorage, | ||
const base::DataVector & | functionValues | ||
) |
Write a grid (grid points and function values) to a file.
The format is as follows:
size_t N (number of grid points) size_t d (dimension) for j = 0, ..., N-1 for t = 0, ..., d-1 double grid_point[j].coord(t) unsigned int grid_point[j].level(t) unsigned int grid_point[j].index(t) end double function_value[j] end
filename | filename of the file to be written |
gridStorage | grid storage containing the grid points |
functionValues | vector of function values |
References python.statsfileInfo::f, sgpp::base::HashGridStorage::getCoordinate(), sgpp::base::HashGridStorage::getDimension(), sgpp::base::HashGridPoint::getIndex(), sgpp::base::HashGridPoint::getLevel(), sgpp::base::HashGridStorage::getSize(), sgpp::base::DataVector::getSize(), python.statsfileInfo::i, python.utils.statsfile2gnuplot::j, and parabola::N.
void sgpp::optimization::file_io::writeMatrix | ( | const std::string & | filename, |
base::DataMatrix & | A | ||
) |
Write a base::DataMatrix to a file.
filename | filename of the file to be written |
A | matrix |
References sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), and sgpp::base::DataMatrix::getPointer().
Referenced by getTypeString(), and writeVector().
void sgpp::optimization::file_io::writeMatrix | ( | const std::string & | filename, |
const std::vector< T > & | A, | ||
size_t | m, | ||
size_t | n | ||
) |
Write a matrix (stored row-wise in a std::vector) to a file.
The format is as follows:
size_t m size_t n char[16] type string (one of "uint8", "uint16", "uint32", "uint64", "double", "string", or "other", right-padded with spaces to 16 characters) for i = 0, ..., m*n - 1 T A[i] (size depending on template parameter, strings are written null-terminatedly) end
filename | filename of the file to be written |
A | matrix |
m | number of rows |
n | number of columns |
References python.statsfileInfo::f, getTypeString(), python.statsfileInfo::i, readMatrix(), create_dataset::type, and writeEntry().
void sgpp::optimization::file_io::writeVector | ( | const std::string & | filename, |
base::DataVector & | x | ||
) |
Write a base::DataVector to a file.
It's writeMatrix with the vector as one row.
filename | filename of the file to be written |
x | vector |
References sgpp::base::DataVector::getPointer(), sgpp::base::DataVector::getSize(), and writeMatrix().
Referenced by readMatrix().
void sgpp::optimization::file_io::writeVector | ( | const std::string & | filename, |
const std::vector< T > & | x | ||
) |
Write a std::vector to a file.
It's writeMatrix with the vector as one row.
filename | filename of the file to be written |
x | vector |
References readVector(), and writeMatrix().