PLearn 0.1
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Private Types | Private Member Functions
PLearn::SeparateInputVMatrix Class Reference

Separates the input in nsep parts and distributes them on different rows. More...

#include <SeparateInputVMatrix.h>

Inheritance diagram for PLearn::SeparateInputVMatrix:
Inheritance graph
[legend]
Collaboration diagram for PLearn::SeparateInputVMatrix:
Collaboration graph
[legend]

List of all members.

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 OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual SeparateInputVMatrixdeepCopy (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 PPathdeclaringFile ()

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.

Detailed Description

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.


Member Typedef Documentation

Reimplemented from PLearn::SourceVMatrix.

Definition at line 60 of file SeparateInputVMatrix.h.


Constructor & Destructor Documentation

PLearn::SeparateInputVMatrix::SeparateInputVMatrix ( )

Default constructor.

Definition at line 52 of file SeparateInputVMatrix.cc.

    : nsep(1)
{

    // build_();
}
PLearn::SeparateInputVMatrix::SeparateInputVMatrix ( VMat  the_source,
int  the_nsep 
)

Constructor with the source vmat and the number of separations in arguments.

Definition at line 64 of file SeparateInputVMatrix.cc.

References build_().

    : inherited(the_source), nsep(the_nsep)
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

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.

bool PLearn::SeparateInputVMatrix::_isa_ ( const Object o) [static]

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_();
}

Here is the call graph for this function:

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());
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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);
}

Here is the call graph for this function:

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.

void PLearn::SeparateInputVMatrix::getNewRow ( int  i,
const Vec v 
) const [protected, virtual]

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_);
}

Here is the call graph for this function:

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!");
}

Here is the call graph for this function:


Member Data Documentation

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().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines