PLearn 0.1
|
#include <VecExtendedVMatrix.h>
Public Member Functions | |
VecExtendedVMatrix (bool call_build_=false) | |
default constructor (for automatic deserialization) | |
VecExtendedVMatrix (VMat the_source, Vec extend_data, bool call_build_=true) | |
The fieldinfos of the source are copied, the extension fieldinfos are left empty (fill them yourself) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual VecExtendedVMatrix * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Simply calls inherited::build() then build_(). | |
virtual void | reset_dimensions () |
In case the dimensions of an underlying VMat has changed, recompute it. | |
Static Public Member Functions | |
static string | _classname_ () |
VecExtendedVMatrix. | |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
virtual void | getNewRow (int i, const Vec &v) const |
Must be implemented in subclasses: default version returns an error. | |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Protected Attributes | |
Vec | extend_data_ |
Private Types | |
typedef SourceVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
A VecExtendedVMatrix is similar to an ExtendedVMatrix: it extends the source VMat by appending COLUMNS to its right. The appended columns are filled with a constant vector passed upon construction. For example, if the vector [1,2,3] is passed at construction, then every row of the source VMat will be extended by 3 columns, containing [1,2,3] (constant).
Definition at line 62 of file VecExtendedVMatrix.h.
typedef SourceVMatrix PLearn::VecExtendedVMatrix::inherited [private] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 64 of file VecExtendedVMatrix.h.
PLearn::VecExtendedVMatrix::VecExtendedVMatrix | ( | bool | call_build_ = false | ) |
default constructor (for automatic deserialization)
Definition at line 65 of file VecExtendedVMatrix.cc.
: inherited(call_build_) { // build_() won't do anything }
PLearn::VecExtendedVMatrix::VecExtendedVMatrix | ( | VMat | the_source, |
Vec | extend_data, | ||
bool | call_build_ = true |
||
) |
The fieldinfos of the source are copied, the extension fieldinfos are left empty (fill them yourself)
Definition at line 71 of file VecExtendedVMatrix.cc.
References build_().
: inherited(the_source, the_source->length(), the_source->width() + extend_data.length(), call_build_), extend_data_(extend_data) { if( call_build_ ) build_(); }
string PLearn::VecExtendedVMatrix::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
OptionList & PLearn::VecExtendedVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
RemoteMethodMap & PLearn::VecExtendedVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
Object * PLearn::VecExtendedVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
StaticInitializer VecExtendedVMatrix::_static_initializer_ & PLearn::VecExtendedVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
void PLearn::VecExtendedVMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::SourceVMatrix.
Definition at line 83 of file VecExtendedVMatrix.cc.
References PLearn::SourceVMatrix::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::VecExtendedVMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 89 of file VecExtendedVMatrix.cc.
References PLearn::VMatrix::fieldinfos, PLearn::SourceVMatrix::source, and PLearn::VMatrix::updateMtime().
Referenced by build(), and VecExtendedVMatrix().
{ if (source) fieldinfos = source->getFieldInfos(); updateMtime(source); }
string PLearn::VecExtendedVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
void PLearn::VecExtendedVMatrix::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares this class' options.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 96 of file VecExtendedVMatrix.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::SourceVMatrix::declareOptions(), extend_data_, PLearn::OptionBase::learntoption, PLearn::OptionBase::nosave, and PLearn::SourceVMatrix::source.
{ declareOption(ol, "underlying_", &VecExtendedVMatrix::source, (OptionBase::learntoption | OptionBase::nosave), "DEPRECATED - Use 'source' instead."); declareOption(ol, "extend_data_", &VecExtendedVMatrix::extend_data_, OptionBase::buildoption, ""); inherited::declareOptions(ol); }
static const PPath& PLearn::VecExtendedVMatrix::declaringFile | ( | ) | [inline, static] |
VecExtendedVMatrix * PLearn::VecExtendedVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
Must be implemented in subclasses: default version returns an error.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 108 of file VecExtendedVMatrix.cc.
References PLearn::TVec< T >::begin(), std::copy(), PLearn::TVec< T >::end(), extend_data_, PLearn::VMatrix::length(), PLearn::TVec< T >::length(), PLERROR, PLearn::SourceVMatrix::source, PLearn::TVec< T >::subVec(), PLearn::VMat::width(), and PLearn::VMatrix::width().
{ #ifdef BOUNDCHECK if(i<0 || i>=length()) PLERROR("In VecExtendedVMatrix::getNewRow OUT OF BOUNDS"); if(v.length() != width()) PLERROR("In VecExtendedVMatrix::getNewRow v.length() must be equal to the VMat's width"); #endif Vec subv = v.subVec(0, source->width()); source->getRow(i,subv); copy(extend_data_.begin(), extend_data_.end(), v.begin() + source->width()); }
OptionList & PLearn::VecExtendedVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
OptionMap & PLearn::VecExtendedVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
RemoteMethodMap & PLearn::VecExtendedVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file VecExtendedVMatrix.cc.
virtual void PLearn::VecExtendedVMatrix::reset_dimensions | ( | ) | [inline, virtual] |
In case the dimensions of an underlying VMat has changed, recompute it.
Reimplemented from PLearn::VMatrix.
Definition at line 90 of file VecExtendedVMatrix.h.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 79 of file VecExtendedVMatrix.h.
Vec PLearn::VecExtendedVMatrix::extend_data_ [protected] |
Definition at line 100 of file VecExtendedVMatrix.h.
Referenced by declareOptions(), and getNewRow().