|
PLearn 0.1
|
#include <ThresholdVMatrix.h>


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 |
Definition at line 54 of file ThresholdVMatrix.h.
typedef SourceVMatrix PLearn::ThresholdVMatrix::inherited [private] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file ThresholdVMatrix.h.
| PLearn::ThresholdVMatrix::ThresholdVMatrix | ( | bool | call_build_ = false | ) |
default constructor (for automatic deserialization)
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); }

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

| 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.
real PLearn::ThresholdVMatrix::cold_value [protected] |
Definition at line 63 of file ThresholdVMatrix.h.
Referenced by getNewRow().
bool PLearn::ThresholdVMatrix::gt_threshold [protected] |
Definition at line 65 of file ThresholdVMatrix.h.
Referenced by getNewRow().
real PLearn::ThresholdVMatrix::hot_value [protected] |
Definition at line 64 of file ThresholdVMatrix.h.
Referenced by getNewRow().
real PLearn::ThresholdVMatrix::threshold [protected] |
Definition at line 62 of file ThresholdVMatrix.h.
Referenced by getNewRow().
1.7.4