PLearn 0.1
|
#include <SubInputVMatrix.h>
Public Member Functions | |
SubInputVMatrix () | |
virtual void | build () |
Simply calls inherited::build() then build_(). | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual SubInputVMatrix * | deepCopy (CopiesMap &copies) const |
Static Public Member Functions | |
static string | _classname_ () |
Declares name and deepCopy methods. | |
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 () |
Public Attributes | |
int | j_start |
int | n_inputs |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
virtual void | getNewRow (int i, const Vec &v) const |
This is the only method requiring implementation. | |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Private Types | |
typedef SourceVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
Definition at line 52 of file SubInputVMatrix.h.
typedef SourceVMatrix PLearn::SubInputVMatrix::inherited [private] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 54 of file SubInputVMatrix.h.
PLearn::SubInputVMatrix::SubInputVMatrix | ( | ) |
Definition at line 51 of file SubInputVMatrix.cc.
string PLearn::SubInputVMatrix::_classname_ | ( | ) | [static] |
Declares name and deepCopy methods.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
OptionList & PLearn::SubInputVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
RemoteMethodMap & PLearn::SubInputVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
Object * PLearn::SubInputVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
StaticInitializer SubInputVMatrix::_static_initializer_ & PLearn::SubInputVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
void PLearn::SubInputVMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::SourceVMatrix.
Definition at line 83 of file SubInputVMatrix.cc.
References PLearn::SourceVMatrix::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::SubInputVMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 92 of file SubInputVMatrix.cc.
References PLearn::VMatrix::inputsize_, j_start, PLearn::TVec< T >::length(), n_inputs, PLERROR, PLearn::VMatrix::setFieldInfos(), PLearn::SourceVMatrix::setMetaInfoFromSource(), PLearn::SourceVMatrix::source, PLearn::TVec< T >::subVec(), PLearn::VMat::width(), and PLearn::VMatrix::width_.
Referenced by build().
{ if (source) { if (source->inputsize() < 0) PLERROR("In SubInputVMatrix::build_ - The source's inputsize must be set"); if (n_inputs == -1) { // Default value: we keep all inputs. n_inputs = source->inputsize() - j_start; } if (n_inputs < 0 || n_inputs + j_start > source->inputsize()) { PLERROR("In SubInputVMatrix::build_ - Source VMatrix hasn't enough inputs"); } int n_removed = source->inputsize() - n_inputs; inputsize_ = n_inputs; width_ = source->width() - n_removed; // Set field infos. Array<VMField>& source_infos = source->getFieldInfos(); TVec<VMField> finfos(width_); finfos.subVec(0, inputsize_) << source_infos.subVec(0, inputsize_); finfos.subVec(inputsize_, finfos.length() - inputsize_) << source_infos.subVec(source->inputsize(), source_infos.length() - source->inputsize()); setFieldInfos(finfos); // Set other meta information. setMetaInfoFromSource(); } }
string PLearn::SubInputVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
void PLearn::SubInputVMatrix::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares this class' options.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 68 of file SubInputVMatrix.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::SourceVMatrix::declareOptions(), j_start, and n_inputs.
{ declareOption(ol, "j_start", &SubInputVMatrix::j_start, OptionBase::buildoption, "The column we start at."); declareOption(ol, "n_inputs", &SubInputVMatrix::n_inputs, OptionBase::buildoption, "The number of inputs to keep (-1 means we keep them all, from j_start)."); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::SubInputVMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 105 of file SubInputVMatrix.h.
SubInputVMatrix * PLearn::SubInputVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
This is the only method requiring implementation.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 122 of file SubInputVMatrix.cc.
References PLearn::VMat::getSubRow(), j_start, PLearn::TVec< T >::length(), n_inputs, PLearn::SourceVMatrix::source, and PLearn::TVec< T >::subVec().
{ // First fill the input part. source->getSubRow(i, j_start, v.subVec(0, n_inputs)); // Then the rest (target + weight). source->getSubRow( i, source->inputsize(), v.subVec(n_inputs, v.length() - n_inputs)); }
OptionList & PLearn::SubInputVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
OptionMap & PLearn::SubInputVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
RemoteMethodMap & PLearn::SubInputVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 63 of file SubInputVMatrix.cc.
void PLearn::SubInputVMatrix::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 136 of file SubInputVMatrix.cc.
References PLearn::SourceVMatrix::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); }
Reimplemented from PLearn::SourceVMatrix.
Definition at line 105 of file SubInputVMatrix.h.
Definition at line 68 of file SubInputVMatrix.h.
Referenced by build_(), declareOptions(), and getNewRow().
Definition at line 69 of file SubInputVMatrix.h.
Referenced by build_(), declareOptions(), and getNewRow().