|
| static void | GetWriteStream (std::ofstream &out, const std::string &filename) |
| | Factory method for generating output streams with fixed properties set for writing matrices. More...
|
| |
| static void | WriteBinary (std::ofstream &out, boost::shared_ptr< DemuxTypes::MatrixType > matrix) |
| | Writes a matrix to filestream including header information about the number of rows and columns. Matrices are written in row-major format. More...
|
| |
| static void | WriteBinary (const std::string &filename, boost::shared_ptr< DemuxTypes::MatrixType > matrix) |
| | Convience function for writing a single matrix to file. More...
|
| |
| static void | GetReadStream (std::ifstream &in, const std::string &filename) |
| | Factory method for generating input streams with fixed properties set for reading matrices. More...
|
| |
| static void | ReadBinary (std::ifstream &in, boost::shared_ptr< DemuxTypes::MatrixType > matrix) |
| | Convenience function for reading a single matrix from a file. More...
|
| |
| static void | ReadBinary (const std::string &filename, boost::shared_ptr< DemuxTypes::MatrixType > matrix) |
| | Reads a matrix from filestream. Matrices are written in row-major format. More...
|
| |
Provides static methods for writing and reading matrices to/from files.
An example file format used is as follows:
| byte | type | description |
| 0 | int64 | num_rows |
| 8 | int64 | num_cols |
| 16 | double | element_0 |
| 24 | double | element_1 |
| 32 | double | element_2 |
| ... | double(s) | ... |
| (num_elements - 1) * 8 + 16 | double | element_n |
Note that the type of the index (shown as int64) is subject to change and is dependent on the type of Matrix::Index. Similarly, the type of each element is dependent on the type of the Scalar type of the Matrix. However, in the current (as of 8/30/2016) implementation of DemuxTypes::MatrixType the types shown above are accurate.
Definition at line 45 of file MatrixIO.hpp.