Load the csv file.This class use boost::spirit to implement the parser, please refer to following link http://theboostcpplibraries.com/boost.spirit for quick review. More...
Public Member Functions | |
LoadCSV (const std::string &file) | |
Construct the LoadCSV object on the given file. More... | |
template < typename T , typename MapPolicy > | |
void | GetMatrixSize (size_t &rows, size_t &cols, DatasetMapper< MapPolicy > &info) |
Peek at the file to determine the number of rows and columns in the matrix, assuming a non-transposed matrix. More... | |
template < typename T , typename MapPolicy > | |
void | GetTransposeMatrixSize (size_t &rows, size_t &cols, DatasetMapper< MapPolicy > &info) |
Peek at the file to determine the number of rows and columns in the matrix, assuming a transposed matrix. More... | |
template < typename T , typename PolicyType > | |
void | Load (arma::Mat< T > &inout, DatasetMapper< PolicyType > &infoSet, const bool transpose=true) |
Load the file into the given matrix with the given DatasetMapper object. More... | |
Load the csv file.This class use boost::spirit to implement the parser, please refer to following link http://theboostcpplibraries.com/boost.spirit for quick review.
Definition at line 36 of file load_csv.hpp.
LoadCSV | ( | const std::string & | file | ) |
Construct the LoadCSV object on the given file.
This will construct the rules necessary for loading and attempt to open the file.
|
inline |
Peek at the file to determine the number of rows and columns in the matrix, assuming a non-transposed matrix.
This will also take a first pass over the data for DatasetMapper, if MapPolicy::NeedsFirstPass is true. The info object will be re-initialized with the correct dimensionality.
rows | Variable to be filled with the number of rows. |
cols | Variable to be filled with the number of columns. |
info | DatasetMapper object to use for first pass. |
Definition at line 78 of file load_csv.hpp.
References DatasetMapper< PolicyType, InputType >::Dimensionality(), and DatasetMapper< PolicyType, InputType >::SetDimensionality().
|
inline |
Peek at the file to determine the number of rows and columns in the matrix, assuming a transposed matrix.
This will also take a first pass over the data for DatasetMapper, if MapPolicy::NeedsFirstPass is true. The info object will be re-initialized with the correct dimensionality.
rows | Variable to be filled with the number of rows. |
cols | Variable to be filled with the number of columns. |
info | DatasetMapper object to use for first pass. |
Definition at line 164 of file load_csv.hpp.
References DatasetMapper< PolicyType, InputType >::Dimensionality(), and DatasetMapper< PolicyType, InputType >::SetDimensionality().
|
inline |
Load the file into the given matrix with the given DatasetMapper object.
Throws exceptions on errors.
inout | Matrix to load into. |
infoSet | DatasetMapper to use while loading. |
transpose | If true, the matrix should be transposed on loading (default). |
Definition at line 55 of file load_csv.hpp.