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

#include <SDBVMat.h>

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

List of all members.

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

Detailed Description

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.

Definition at line 480 of file SDBVMat.h.


Member Typedef Documentation

Reimplemented from PLearn::SDBVMFieldSource2.

Definition at line 482 of file SDBVMat.h.


Constructor & Destructor Documentation

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

Member Function Documentation

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

Here is the call graph for this function:

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

Member Data Documentation

Func PLearn::SDBVMFieldFunc2::func_ [mutable, protected]

Definition at line 495 of file SDBVMat.h.

Referenced by convertField().


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