#include <DiskVMatrix.h>
Inheritance diagram for PLearn::DiskVMatrix:
Public Member Functions | |
DiskVMatrix () | |
DiskVMatrix *. | |
DiskVMatrix (const string &the_dirname, bool readwrite=false) | |
DiskVMatrix (const string &the_dirname, int the_width, bool write_double_as_float=false) | |
virtual void | putRow (int i, Vec v) |
virtual void | appendRow (Vec v) |
This method must be implemented for matrices that are allowed to grow. | |
virtual void | flush () |
For matrices stored on disk, this should flush all pending buffered write operations. | |
virtual void | build () |
Should call simply inherited::build(), then this class's build_(). | |
PLEARN_DECLARE_OBJECT (DiskVMatrix) | |
virtual | ~DiskVMatrix () |
Public Attributes | |
string | dirname |
double | tolerance |
Protected Member Functions | |
virtual void | getNewRow (int i, const Vec &v) const |
This is the only method requiring implementation in subclasses. | |
Static Protected Member Functions | |
void | declareOptions (OptionList &ol) |
redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down) | |
Protected Attributes | |
FILE * | indexf |
TVec< FILE * > | dataf |
bool | freshnewfile |
bool | old_format |
bool | swap_endians |
Private Types | |
typedef RowBufferedVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
Each row is compressed/decompressed through the methods of VecCompressor
Definition at line 56 of file DiskVMatrix.h.
|
Reimplemented from PLearn::RowBufferedVMatrix. Definition at line 58 of file DiskVMatrix.h. |
|
DiskVMatrix *.
Definition at line 87 of file DiskVMatrix.cc. |
|
Opens an existing one. If directory does not exist or has missing files, an error is issued. If readwrite is true, then the files are opened in read/write mode and appendRow can be called. If readwrite is false (the default), then the files are opened in read only mode, and calling appendRow will issue an error. Definition at line 95 of file DiskVMatrix.cc. References build_(), and PLearn::remove_trailing_slash(). |
|
Create a new one. If directory already exist an error is issued (you may consider calling force_rmdir prior to this.) Howver if it is a file then the file is erased and replaced by a new directory (this was to allow TmpFilenames to be used with this class). Files are opened in read/write mode so appendRow can be called. Definition at line 105 of file DiskVMatrix.cc. References build_(), and PLearn::remove_trailing_slash(). |
|
Definition at line 307 of file DiskVMatrix.cc. References dataf, indexf, PLearn::VMatrix::saveFieldInfos(), and PLearn::TVec< FILE * >::size(). |
|
This method must be implemented for matrices that are allowed to grow.
Reimplemented from PLearn::VMatrix. Definition at line 263 of file DiskVMatrix.cc. References PLearn::binwrite_compressed(), PLearn::TVec< T >::data(), dataf, dirname, PLearn::endianswap(), indexf, PLearn::TVec< T >::length(), PLearn::new_write_compressed(), old_format, PLERROR, PLearn::TVec< FILE * >::size(), slash, swap_endians, tolerance, PLearn::tostring(), and PLearn::VMatrix::width(). Referenced by PLearn::VMatrix::saveDMAT(). |
|
Should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object. Reimplemented from PLearn::VMatrix. Definition at line 117 of file DiskVMatrix.cc. References build_(). |
|
This does the actual building.
Reimplemented from PLearn::VMatrix. Definition at line 123 of file DiskVMatrix.cc. References PLearn::TVec< FILE * >::append(), PLearn::append_slash(), PLearn::byte_order(), dataf, dirname, PLearn::endianswap(), fname, PLearn::force_mkdir(), freshnewfile, PLearn::VMatrix::getFieldInfos(), header, indexf, PLearn::isdir(), PLearn::isfile(), k, PLearn::mtime(), old_format, PLERROR, PLearn::TVec< T >::resize(), slash, swap_endians, and PLearn::tostring(). Referenced by build(), and DiskVMatrix(). |
|
redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down) ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); } Reimplemented from PLearn::VMatrix. Definition at line 226 of file DiskVMatrix.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
For matrices stored on disk, this should flush all pending buffered write operations.
Reimplemented from PLearn::VMatrix. Definition at line 299 of file DiskVMatrix.cc. References dataf, indexf, and PLearn::TVec< FILE * >::size(). |
|
This is the only method requiring implementation in subclasses.
Implements PLearn::RowBufferedVMatrix. Definition at line 233 of file DiskVMatrix.cc. References PLearn::binread_compressed(), PLearn::TVec< T >::data(), dataf, PLearn::endianswap(), indexf, PLearn::TVec< T >::length(), PLearn::VMatrix::length(), PLearn::new_read_compressed(), old_format, PLERROR, swap_endians, and PLearn::VMatrix::width(). |
|
|
|
Reimplemented from PLearn::VMatrix. Definition at line 257 of file DiskVMatrix.cc. References PLERROR. |
|
Definition at line 62 of file DiskVMatrix.h. Referenced by appendRow(), build_(), flush(), getNewRow(), and ~DiskVMatrix(). |
|
Definition at line 69 of file DiskVMatrix.h. Referenced by appendRow(), and build_(). |
|
Definition at line 63 of file DiskVMatrix.h. Referenced by build_(). |
|
Definition at line 61 of file DiskVMatrix.h. Referenced by appendRow(), build_(), flush(), getNewRow(), and ~DiskVMatrix(). |
|
Definition at line 64 of file DiskVMatrix.h. Referenced by appendRow(), build_(), and getNewRow(). |
|
Definition at line 65 of file DiskVMatrix.h. Referenced by appendRow(), build_(), and getNewRow(). |
|
Definition at line 71 of file DiskVMatrix.h. Referenced by appendRow(). |