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::SubInputVMatrix Class Reference

#include <SubInputVMatrix.h>

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

List of all members.

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 OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual SubInputVMatrixdeepCopy (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 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.

Detailed Description

Definition at line 52 of file SubInputVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file SubInputVMatrix.h.


Constructor & Destructor Documentation

PLearn::SubInputVMatrix::SubInputVMatrix ( )

Definition at line 51 of file SubInputVMatrix.cc.

    : inherited(),
      j_start(0),
      n_inputs(-1)
{
}

Member Function Documentation

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.

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

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

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

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.

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

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

Here is the call graph for this function:

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

Here is the call graph for this function:


Member Data Documentation

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


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