PLearn 0.1
|
#include <SDBVMat.h>
Public Member Functions | |
SDBVMFieldFunc2 (SDBVMSource source1, SDBVMSource source2, Func func, real missing_values_mapping=MISSING_VALUE) | |
virtual void | convertField (const SDBWithStats &sdb, const Row &row, const Vec &output) const |
virtual int | fieldWidth () const |
Width that the field occupies in the VMat. | |
Protected Attributes | |
Func | func_ |
Private Types | |
typedef SDBVMFieldSource2 | inherited |
Apply a two-input func to the field: call operator()(const Vec& input1, const Vec& input2) of the func, with the input vectors set to the single value resulting from the conversion of each SDB field to a Real. Since the two-argument operator() in Func returns a real, the width of this field in the VMatrix is 1.
typedef SDBVMFieldSource2 PLearn::SDBVMFieldFunc2::inherited [private] |
Reimplemented from PLearn::SDBVMFieldSource2.
PLearn::SDBVMFieldFunc2::SDBVMFieldFunc2 | ( | SDBVMSource | source1, |
SDBVMSource | source2, | ||
Func | func, | ||
real | missing_values_mapping = MISSING_VALUE |
||
) | [inline] |
Definition at line 485 of file SDBVMat.h.
: inherited(source1, source2,missing_values_mapping,VMField::Continuous), func_(func) {}
void PLearn::SDBVMFieldFunc2::convertField | ( | const SDBWithStats & | sdb, |
const Row & | theRow, | ||
const Vec & | outputField | ||
) | const [virtual] |
Given a database row, convert the appropriate parts to a (preallocated) output vector of the correct width (given by fieldWidth). Replace MISSING_VALUEs by missing_values_mapping.
Implements PLearn::SDBVMField.
Definition at line 423 of file SDBVMat.cc.
References PLearn::SDBVMField::convertMissing(), func_, PLearn::SDBVMSource::getValue(), PLearn::SDBVMFieldSource2::source1_, and PLearn::SDBVMFieldSource2::source2_.
{ Vec input1(1), input2(1); input1[0] = real(source1_.getValue(sdb,row)); input2[0] = real(source2_.getValue(sdb,row)); output[0] = func_(input1, input2); convertMissing(output); }
int PLearn::SDBVMFieldFunc2::fieldWidth | ( | ) | const [virtual] |
Width that the field occupies in the VMat.
Implements PLearn::SDBVMField.
Definition at line 433 of file SDBVMat.cc.
{
return 1;
}
Func PLearn::SDBVMFieldFunc2::func_ [mutable, protected] |
Definition at line 495 of file SDBVMat.h.
Referenced by convertField().