Miscellaneous dataset-related routines. More...
Functions | |
template<typename Precision > | |
success_t | LargeLoad (const char *fname, GenMatrix< Precision > *matrix) |
Loads a matrix from a file. | |
success_t | Load (const char *fname, Matrix *matrix) |
Loads a matrix from a file. | |
success_t | Save (const char *fname, const Matrix &matrix) |
Saves a matrix to a file. |
Miscellaneous dataset-related routines.
success_t data::LargeLoad | ( | const char * | fname, | |
GenMatrix< Precision > * | matrix | |||
) | [inline] |
Loads a matrix from a file.
The Matrix is Statically Initialized from a memory mapped file
This supports only CSV Datasets
Matrix A; data::LargeLoad("foo.csv", &A);
fname | the file name to load | |
matrix | a pointer to an uninitialized matrix to load |
Definition at line 691 of file dataset.h.
References TextLineReader::Error(), TextLineReader::Gobble(), ArrayList< TElem >::Init(), TextLineReader::line_num(), TextLineReader::Open(), TextLineReader::Peek(), GenMatrix< T >::set(), GenMatrix< T >::SetAll(), ArrayList< TElem >::size(), String::Split(), and GenMatrix< T >::StaticInit().
success_t data::Load | ( | const char * | fname, | |
Matrix * | matrix | |||
) |
Loads a matrix from a file.
This supports any type the Dataset class supports with the InitFromFile function: CSV and ARFF.
Matrix A; data::Load("foo.csv", &A);
fname | the file name to load | |
matrix | a pointer to an uninitialized matrix to load |
Definition at line 671 of file dataset.cc.
References Dataset::InitFromFile(), and Dataset::matrix().
Referenced by tree::LoadKdTree(), and main().
success_t data::Save | ( | const char * | fname, | |
const Matrix & | matrix | |||
) |
Saves a matrix to a file.
This saves in CSV format that MATLAB and Excel can handle.
Matrix matrix_to_save; ... matrix_to_save contains the values you want to save data::Save("mymatrix.csv", matrix_to_save);
fname | the file name to load | |
matrix | a pointer to an uninitialized matrix to load |
Definition at line 678 of file dataset.cc.
References Dataset::AliasMatrix(), and Dataset::WriteCsv().
Referenced by GenerateArtificialDataset(), and linalg__private::SaveCorrectly().