ProteoWizard
Static Public Member Functions | List of all members
pwiz::analysis::MatrixIO Class Reference

Provides static methods for writing and reading matrices to/from files. More...

#include <MatrixIO.hpp>

Static Public Member Functions

static void GetWriteStream (std::ofstream &out, const std::string &filename)
 Factory method for generating output streams with fixed properties set for writing matrices.
 
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.
 
static void WriteBinary (const std::string &filename, boost::shared_ptr< DemuxTypes::MatrixType > matrix)
 Convience function for writing a single matrix to file.
 
static void GetReadStream (std::ifstream &in, const std::string &filename)
 Factory method for generating input streams with fixed properties set for reading matrices.
 
static void ReadBinary (std::ifstream &in, boost::shared_ptr< DemuxTypes::MatrixType > matrix)
 Convenience function for reading a single matrix from a file.
 
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.
 

Detailed Description

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.

Member Function Documentation

◆ GetWriteStream()

static void pwiz::analysis::MatrixIO::GetWriteStream ( std::ofstream &  out,
const std::string &  filename 
)
static

Factory method for generating output streams with fixed properties set for writing matrices.

Referenced by MatrixIOTest::MultiReadWrite().

◆ WriteBinary() [1/2]

static void pwiz::analysis::MatrixIO::WriteBinary ( std::ofstream &  out,
boost::shared_ptr< DemuxTypes::MatrixType matrix 
)
static

Writes a matrix to filestream including header information about the number of rows and columns. Matrices are written in row-major format.

Referenced by MatrixIOTest::MultiReadWrite(), and MatrixIOTest::SingleReadWrite().

◆ WriteBinary() [2/2]

static void pwiz::analysis::MatrixIO::WriteBinary ( const std::string &  filename,
boost::shared_ptr< DemuxTypes::MatrixType matrix 
)
static

Convience function for writing a single matrix to file.

◆ GetReadStream()

static void pwiz::analysis::MatrixIO::GetReadStream ( std::ifstream &  in,
const std::string &  filename 
)
static

Factory method for generating input streams with fixed properties set for reading matrices.

Referenced by MatrixIOTest::MultiReadWrite().

◆ ReadBinary() [1/2]

static void pwiz::analysis::MatrixIO::ReadBinary ( std::ifstream &  in,
boost::shared_ptr< DemuxTypes::MatrixType matrix 
)
static

Convenience function for reading a single matrix from a file.

Referenced by MatrixIOTest::MultiReadWrite(), and MatrixIOTest::SingleReadWrite().

◆ ReadBinary() [2/2]

static void pwiz::analysis::MatrixIO::ReadBinary ( const std::string &  filename,
boost::shared_ptr< DemuxTypes::MatrixType matrix 
)
static

Reads a matrix from filestream. Matrices are written in row-major format.


The documentation for this class was generated from the following file: