data Namespace Reference

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.

Detailed Description

Miscellaneous dataset-related routines.


Function Documentation

template<typename Precision >
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);
Parameters:
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);
Parameters:
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);
Parameters:
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().

Generated on Mon Jan 24 12:04:40 2011 for FASTlib by  doxygen 1.6.3