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

The first sentence should be a BRIEF DESCRIPTION of what the class does. More...

#include <ValueSelectRowsVMatrix.h>

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

List of all members.

Public Member Functions

 ValueSelectRowsVMatrix ()
 Default constructor.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual ValueSelectRowsVMatrixdeepCopy (CopiesMap &copies) const
virtual void build ()
 Simply calls inherited::build() then build_().
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.

Static Public Member Functions

static string _classname_ ()
 SelectRowsVMatrix.
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

string col_name
 ### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //!
string col_name_sec
VMat second

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares the class options.

Private Types

typedef SelectRowsVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

The first sentence should be a BRIEF DESCRIPTION of what the class does.

Place the rest of the class programmer documentation here. Doxygen supports Javadoc-style comments. See http://www.doxygen.org/manual.html

Todo:
Write class to-do's here if there are any.
Deprecated:
Write deprecated stuff here if there is any. Indicate what else should be used instead.

Definition at line 57 of file ValueSelectRowsVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 59 of file ValueSelectRowsVMatrix.h.


Constructor & Destructor Documentation

PLearn::ValueSelectRowsVMatrix::ValueSelectRowsVMatrix ( )

Default constructor.

Definition at line 54 of file ValueSelectRowsVMatrix.cc.

{
}

Member Function Documentation

string PLearn::ValueSelectRowsVMatrix::_classname_ ( ) [static]

SelectRowsVMatrix.

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

OptionList & PLearn::ValueSelectRowsVMatrix::_getOptionList_ ( ) [static]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

RemoteMethodMap & PLearn::ValueSelectRowsVMatrix::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

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

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

Object * PLearn::ValueSelectRowsVMatrix::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

StaticInitializer ValueSelectRowsVMatrix::_static_initializer_ & PLearn::ValueSelectRowsVMatrix::_static_initialize_ ( ) [static]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

void PLearn::ValueSelectRowsVMatrix::build ( ) [virtual]

Simply calls inherited::build() then build_().

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 90 of file ValueSelectRowsVMatrix.cc.

{
    // ### Nothing to add here, simply calls build_
//    inherited::build();
    build_();
    inherited::build();//must recall as we changed selected_indices
}
void PLearn::ValueSelectRowsVMatrix::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 101 of file ValueSelectRowsVMatrix.cc.

References i, PLERROR, PLWARNING, and PLearn::sortElements().

{
    // ### This method should do the real building of the object,
    // ### according to set 'options', in *any* situation.
    // ### Typical situations include:
    // ###  - Initial building of an object from a few user-specified options
    // ###  - Building of a "reloaded" object: i.e. from the complete set of
    // ###    all serialised options.
    // ###  - Updating or "re-building" of an object after a few "tuning"
    // ###    options have been modified.
    // ### You should assume that the parent class' build_() has already been
    // ### called.

    // ### In a SourceVMatrix, you will typically end build_() with:
    // setMetaInfoFromSource();

    // ### You should keep the line 'updateMtime(0);' if you do not implement
    // ### the update of the mtime. Otherwise you can have an mtime != 0 that
    // ### is not valid.
    // ### Note that setMetaInfoFromSource() updates the mtime to the same as
    // ### the source, but this value will be erased with 'updateMtime(0)'.
    if(col_name_sec.empty())
        col_name_sec=col_name;
    Vec values_src(source->length()), values_sec(second->length());
    int idx = source->getFieldIndex(col_name,false);
    if(idx<0)
        PLERROR("In ValueSelectRowsVMatrix::build_ - the matrix source don't have the column %s",
                col_name.c_str());
    source->getColumn(idx,values_src);
    idx=second->getFieldIndex(col_name_sec);
    if(idx<0)
        PLERROR("In ValueSelectRowsVMatrix::build_ - the matrix second don't have the column %s",
                col_name.c_str());
    second->getColumn(idx,values_sec);

    //sort values_sec as it is shorter.
    sortElements(values_sec);
    for(int i=0;i<values_src.size();i++){
        real val = values_src[i];
        int idx=values_sec.findSorted(val);
        if(values_sec[idx]==val){
            indices.append(i);
        }
    }
    if(indices.size()!=values_sec.size())
        PLWARNING("In ValueSelectRowsVMatrix::build_() - we selected less rows"
                " (%d) than asked(%d). Maybe some disappeared.",
                indices.size(), values_sec.size());
    updateMtime(source);
    updateMtime(second);
}

Here is the call graph for this function:

string PLearn::ValueSelectRowsVMatrix::classname ( ) const [virtual]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

void PLearn::ValueSelectRowsVMatrix::declareOptions ( OptionList ol) [static, protected]

Declares the class options.

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 61 of file ValueSelectRowsVMatrix.cc.

References PLearn::OptionBase::buildoption, col_name, PLearn::declareOption(), and second.

{
    // ### Declare all of this object's options here.
    // ### For the "flags" of each option, you should typically specify
    // ### one of OptionBase::buildoption, OptionBase::learntoption or
    // ### OptionBase::tuningoption. If you don't provide one of these three,
    // ### this option will be ignored when loading values from a script.
    // ### You can also combine flags, for example with OptionBase::nosave:
    // ### (OptionBase::buildoption | OptionBase::nosave)

    declareOption(ol, "col_name", &ValueSelectRowsVMatrix::col_name,
                  OptionBase::buildoption,
                  "The name of the column to compare values.");

    declareOption(ol, "col_name_sec", &ValueSelectRowsVMatrix::col_name,
                  OptionBase::buildoption,
                  "The name of the column to compare values for the second matrix."
                  " If not provided, will use col_name.");

    declareOption(ol, "second", &ValueSelectRowsVMatrix::second,
                  OptionBase::buildoption,
                  "The matrix that have the value that we keep the columns.");

    inherited::declareOptions(ol);
}

Here is the call graph for this function:

static const PPath& PLearn::ValueSelectRowsVMatrix::declaringFile ( ) [inline, static]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 81 of file ValueSelectRowsVMatrix.h.

:
    //#####  Protected Options  ###############################################
ValueSelectRowsVMatrix * PLearn::ValueSelectRowsVMatrix::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

OptionList & PLearn::ValueSelectRowsVMatrix::getOptionList ( ) const [virtual]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

OptionMap & PLearn::ValueSelectRowsVMatrix::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

RemoteMethodMap & PLearn::ValueSelectRowsVMatrix::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 49 of file ValueSelectRowsVMatrix.cc.

void PLearn::ValueSelectRowsVMatrix::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 156 of file ValueSelectRowsVMatrix.cc.

References PLearn::deepCopyField().

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::SelectRowsVMatrix.

Definition at line 81 of file ValueSelectRowsVMatrix.h.

### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //!

Definition at line 67 of file ValueSelectRowsVMatrix.h.

Referenced by declareOptions().

Definition at line 68 of file ValueSelectRowsVMatrix.h.

Definition at line 69 of file ValueSelectRowsVMatrix.h.

Referenced by declareOptions().


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