PLearn 0.1
|
Separates the input in nsep parts and distributes them on different rows. More...
#include <SeparateInputVMatrix.h>
Public Member Functions | |
SeparateInputVMatrix () | |
Default constructor. | |
SeparateInputVMatrix (VMat the_source, int the_nsep) | |
Constructor with the source vmat and the number of separations in arguments. | |
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 SeparateInputVMatrix * | 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 | nsep |
Number of separations of the input. | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
virtual void | getNewRow (int i, const Vec &v) const |
Fill the vector 'v' with the content of the i-th row. | |
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. |
Separates the input in nsep parts and distributes them on different rows.
Also copies target and weight parts for each of these rows
Definition at line 55 of file SeparateInputVMatrix.h.
typedef SourceVMatrix PLearn::SeparateInputVMatrix::inherited [private] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 60 of file SeparateInputVMatrix.h.
PLearn::SeparateInputVMatrix::SeparateInputVMatrix | ( | ) |
Default constructor.
Definition at line 52 of file SeparateInputVMatrix.cc.
: nsep(1) { // build_(); }
string PLearn::SeparateInputVMatrix::_classname_ | ( | ) | [static] |
Declares name and deepCopy methods.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
OptionList & PLearn::SeparateInputVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
RemoteMethodMap & PLearn::SeparateInputVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
Object * PLearn::SeparateInputVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
StaticInitializer SeparateInputVMatrix::_static_initializer_ & PLearn::SeparateInputVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
void PLearn::SeparateInputVMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::SourceVMatrix.
Definition at line 86 of file SeparateInputVMatrix.cc.
References PLearn::SourceVMatrix::build(), and build_().
{ // ### Nothing to add here, simply calls build_ inherited::build(); build_(); }
void PLearn::SeparateInputVMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 96 of file SeparateInputVMatrix.cc.
References PLearn::VMatrix::inputsize_, PLearn::VMat::length(), PLearn::VMatrix::length_, nsep, PLERROR, PLearn::TVec< T >::resize(), PLearn::SourceVMatrix::source, PLearn::SourceVMatrix::sourcerow, PLearn::VMatrix::targetsize_, PLearn::VMatrix::updateMtime(), PLearn::VMatrix::weightsize_, PLearn::VMat::width(), and PLearn::VMatrix::width_.
Referenced by build(), and SeparateInputVMatrix().
{ if (source) { updateMtime(source); if(source->inputsize() % nsep != 0) PLERROR("In SeparateInputVMatrix::build_(): inputsize=%d of source vmat should be a multiple of nsep=%d",source->inputsize(),nsep); inputsize_ = source->inputsize()/nsep; targetsize_ = source->targetsize(); weightsize_ = source->weightsize(); //fieldinfos = source->fieldinfos; length_ = source.length() * nsep; width_ = inputsize_+targetsize_+weightsize_; sourcerow.resize(source->width()); } }
string PLearn::SeparateInputVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
void PLearn::SeparateInputVMatrix::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares this class' options.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 74 of file SeparateInputVMatrix.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::SourceVMatrix::declareOptions(), and nsep.
{ declareOption(ol, "nsep", &SeparateInputVMatrix::nsep, OptionBase::buildoption, "Number of separations of the input. The input size has to be\n" "a multiple of that value."); inherited::declareOptions(ol); }
static const PPath& PLearn::SeparateInputVMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 119 of file SeparateInputVMatrix.h.
SeparateInputVMatrix * PLearn::SeparateInputVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
Fill the vector 'v' with the content of the i-th row.
v is assumed to be the right size.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 115 of file SeparateInputVMatrix.cc.
References PLearn::VMatrix::inputsize_, nsep, PLearn::SourceVMatrix::source, PLearn::SourceVMatrix::sourcerow, PLearn::TVec< T >::subVec(), PLearn::VMatrix::targetsize_, and PLearn::VMatrix::weightsize_.
{ source->getRow(i/nsep,sourcerow); v.subVec(0,inputsize_) << sourcerow.subVec(i%nsep * inputsize_, inputsize_); v.subVec(inputsize_,targetsize_+weightsize_) << sourcerow.subVec(source->inputsize(),targetsize_+weightsize_); }
OptionList & PLearn::SeparateInputVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
OptionMap & PLearn::SeparateInputVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
RemoteMethodMap & PLearn::SeparateInputVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 62 of file SeparateInputVMatrix.cc.
void PLearn::SeparateInputVMatrix::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 126 of file SeparateInputVMatrix.cc.
References PLearn::SourceVMatrix::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); // ### Call deepCopyField on all "pointer-like" fields // ### that you wish to be deepCopied rather than // ### shallow-copied. // ### ex: // deepCopyField(trainvec, copies); // ### Remove this line when you have fully implemented this method. //PLERROR("SeparateInputVMatrix::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); }
Reimplemented from PLearn::SourceVMatrix.
Definition at line 119 of file SeparateInputVMatrix.h.
Number of separations of the input.
The input size has to be a multiple of that value.
Definition at line 76 of file SeparateInputVMatrix.h.
Referenced by build_(), declareOptions(), and getNewRow().