![]() |
STAG C++
2.0.0
Spectral Toolkit of Algorithms for Graphs
|
Methods for dealing with datasets.
This file contains methods for reading and writing data to disk, and for converting data between different formats.
Classes | |
class | stag::DataPoint |
A data point in d-dimensional space. More... | |
Functions | |
DenseMat | stag::load_matrix (std::string &filename) |
void | stag::save_matrix (DenseMat &data, std::string &filename) |
std::vector< stag::DataPoint > | stag::matrix_to_datapoints (DenseMat *data) |
DenseMat stag::load_matrix | ( | std::string & | filename | ) |
Load data into a matrix from a file.
Each line of the file corresponds to a row in the matrix. On each row, matrix entries should be separated by blank spaces, or commas. Every row in the file must contain the same number of entries.
Lines beginning with '#' or '//' are ignored.
filename | the name of the file containing the data |
std::runtime_error | if the file doesn't exist or cannot be parsed |
void stag::save_matrix | ( | DenseMat & | data, |
std::string & | filename | ||
) |
Save a data matrix to a text file.
data | the matrix to be saved |
filename | the name of the file to save the data to |
std::runtime_error | if the file cannot be opened for writing |
std::vector< stag::DataPoint > stag::matrix_to_datapoints | ( | DenseMat * | data | ) |
Convert data in an eigen matrix to an array of data point pointers.
data | the eigen matrix containing the data |