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

#include <ThresholdVMatrix.h>

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

List of all members.

Public Member Functions

 ThresholdVMatrix (bool call_build_=false)
 default constructor (for automatic deserialization)
 ThresholdVMatrix (VMat the_source, real threshold_, real the_cold_value=0.0, real the_hot_value=1.0, bool gt_threshold_=true, bool call_build_=false)
virtual void getNewRow (int i, const Vec &v) const
 Must be implemented in subclasses: default version returns an error.
virtual void reset_dimensions ()
 In case the dimensions of an underlying VMat has changed, recompute it.

Protected Attributes

real threshold
real cold_value
real hot_value
bool gt_threshold

Private Types

typedef SourceVMatrix inherited

Detailed Description

Definition at line 54 of file ThresholdVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::SourceVMatrix.

Definition at line 56 of file ThresholdVMatrix.h.


Constructor & Destructor Documentation

PLearn::ThresholdVMatrix::ThresholdVMatrix ( bool  call_build_ = false)

default constructor (for automatic deserialization)

ThresholdVMatrix.

Definition at line 45 of file ThresholdVMatrix.cc.

    : threshold(1), cold_value(0), hot_value(1), gt_threshold(true)
{
    // build_() isn't defined anyways...
}
PLearn::ThresholdVMatrix::ThresholdVMatrix ( VMat  the_source,
real  threshold_,
real  the_cold_value = 0.0,
real  the_hot_value = 1.0,
bool  gt_threshold_ = true,
bool  call_build_ = false 
)

Definition at line 51 of file ThresholdVMatrix.cc.

References PLearn::VMatrix::updateMtime().

    : inherited(the_source,
                the_source->length(), the_source->width(),
                call_build_),
      threshold(threshold_),
      cold_value(the_cold_value),
      hot_value(the_hot_value),
      gt_threshold(gt_threshold_)
{
    // build_() isn't defined anyways...
    updateMtime(the_source);
}

Here is the call graph for this function:


Member Function Documentation

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

Must be implemented in subclasses: default version returns an error.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 67 of file ThresholdVMatrix.cc.

References cold_value, gt_threshold, hot_value, PLearn::VMatrix::length(), PLearn::TVec< T >::length(), PLERROR, PLearn::TVec< T >::size(), PLearn::SourceVMatrix::source, threshold, and PLearn::VMatrix::width().

{
#ifdef BOUNDCHECK
    if(i<0 || i>=length())
        PLERROR("In ThresholdVMatrix::getNewRow OUT OF BOUNDS");
    if(v.length()!=width())
        PLERROR("In ThresholdVMatrix::getNewRow v.length() must be equal to the VMat's width");
#endif
    source->getRow(i,v);
    int p= v.size()-1;
    if((gt_threshold && v[p] <= threshold) 
       || (!gt_threshold && v[p] < threshold))
        v[p]= cold_value;
    else
        v[p]= hot_value;
}

Here is the call graph for this function:

virtual void PLearn::ThresholdVMatrix::reset_dimensions ( ) [inline, virtual]

In case the dimensions of an underlying VMat has changed, recompute it.

Reimplemented from PLearn::VMatrix.

Definition at line 81 of file ThresholdVMatrix.h.

    {
        source->reset_dimensions();
        width_=source->width();
        length_=source->length();
    }

Member Data Documentation

Definition at line 63 of file ThresholdVMatrix.h.

Referenced by getNewRow().

Definition at line 65 of file ThresholdVMatrix.h.

Referenced by getNewRow().

Definition at line 64 of file ThresholdVMatrix.h.

Referenced by getNewRow().

Definition at line 62 of file ThresholdVMatrix.h.

Referenced by getNewRow().


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