#include <FileVMatrix.h>
Inheritance diagram for PLearn::FileVMatrix:
Public Member Functions | |
FileVMatrix () | |
FileVMatrix (const string &filename, bool writable_=false) | |
opens an existing file | |
FileVMatrix (const string &filename, int the_length, int the_width) | |
create a new matrix file | |
FileVMatrix (const string &filename, int the_length, const TVec< string > &fieldnames) | |
create a new matrix file | |
virtual void | updateHeader () |
Re-write the header with all current field values. | |
virtual void | put (int i, int j, real value) |
sets element (i,j) to value | |
virtual void | putSubRow (int i, int j, 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 (FileVMatrix) | |
virtual void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
Transform a shallow copy into a deep copy. | |
virtual | ~FileVMatrix () |
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 | |
string | filename_ |
FILE * | f |
bool | file_is_bigendian |
bool | file_is_float |
Private Types | |
typedef RowBufferedVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. | |
Private Attributes | |
bool | build_new_file |
Definition at line 54 of file FileVMatrix.h.
|
Reimplemented from PLearn::RowBufferedVMatrix. Definition at line 59 of file FileVMatrix.h. Referenced by FileVMatrix(). |
|
Definition at line 55 of file FileVMatrix.cc. |
|
opens an existing file
Definition at line 61 of file FileVMatrix.cc. References PLearn::abspath(), build_(), and PLearn::isfile(). |
|
create a new matrix file
Definition at line 75 of file FileVMatrix.cc. References PLearn::abspath(), build_(), and inherited. |
|
create a new matrix file
Definition at line 83 of file FileVMatrix.cc. References PLearn::abspath(), build_(), and PLearn::VMatrix::saveFieldInfos(). |
|
Definition at line 267 of file FileVMatrix.cc. References f, and PLearn::VMatrix::saveFieldInfos(). |
|
This method must be implemented for matrices that are allowed to grow.
Reimplemented from PLearn::VMatrix. Definition at line 330 of file FileVMatrix.cc. References PLearn::TVec< T >::data(), DATAFILE_HEADERLENGTH, f, file_is_bigendian, file_is_float, PLearn::fwrite_double(), PLearn::fwrite_float(), PLearn::TVec< T >::length(), and updateHeader(). |
|
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 96 of file FileVMatrix.cc. References build_(). Referenced by makeDeepCopyFromShallowCopy(). |
|
This does the actual building.
Reimplemented from PLearn::VMatrix. Definition at line 105 of file FileVMatrix.cc. References build_new_file, DATAFILE_HEADERLENGTH, f, file_is_bigendian, file_is_float, filename_, PLearn::force_mkdir_for_file(), PLearn::VMatrix::getFieldInfos(), header, PLearn::isfile(), PLearn::mtime(), PLERROR, and updateHeader(). Referenced by build(), and FileVMatrix(). |
|
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 234 of file FileVMatrix.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 350 of file FileVMatrix.cc. References f. |
|
This is the only method requiring implementation in subclasses.
Implements PLearn::RowBufferedVMatrix. Definition at line 279 of file FileVMatrix.cc. References PLearn::TVec< T >::data(), DATAFILE_HEADERLENGTH, f, file_is_bigendian, file_is_float, PLearn::fread_double(), PLearn::fread_float(), PLearn::TVec< T >::length(), and PLearn::Vec. |
|
Transform a shallow copy into a deep copy.
Reimplemented from PLearn::RowBufferedVMatrix. Definition at line 244 of file FileVMatrix.cc. |
|
|
|
sets element (i,j) to value
Reimplemented from PLearn::VMatrix. Definition at line 313 of file FileVMatrix.cc. References DATAFILE_HEADERLENGTH, f, file_is_bigendian, file_is_float, PLearn::fwrite_double(), and PLearn::fwrite_float(). |
|
It is suggested that this method be implemented in subclasses of writable matrices to speed up accesses (default version repeatedly calls put(i,j,value) which may have a significant overhead) Reimplemented from PLearn::VMatrix. Definition at line 296 of file FileVMatrix.cc. References PLearn::TVec< T >::data(), DATAFILE_HEADERLENGTH, f, file_is_bigendian, file_is_float, PLearn::fwrite_double(), PLearn::fwrite_float(), and PLearn::TVec< T >::length(). |
|
Re-write the header with all current field values.
Definition at line 358 of file FileVMatrix.cc. References DATAFILE_HEADERLENGTH, f, header, and PLearn::strlen(). Referenced by appendRow(), and build_(). |
|
Definition at line 70 of file FileVMatrix.h. Referenced by build_(). |
|
Definition at line 64 of file FileVMatrix.h. Referenced by appendRow(), build_(), flush(), getNewRow(), makeDeepCopyFromShallowCopy(), put(), putSubRow(), updateHeader(), and ~FileVMatrix(). |
|
Definition at line 65 of file FileVMatrix.h. Referenced by appendRow(), build_(), getNewRow(), put(), and putSubRow(). |
|
Definition at line 66 of file FileVMatrix.h. Referenced by appendRow(), build_(), getNewRow(), put(), and putSubRow(). |
|
Definition at line 63 of file FileVMatrix.h. Referenced by build_(). |