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

Apply an affine transformation to the field: y = a*x+b. More...

#include <SDBVMat.h>

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

List of all members.

Public Member Functions

 SDBVMFieldAffine (SDBVMSource source, real a, real b=0.0, 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

real a_
real b_

Private Types

typedef SDBVMFieldSource1 inherited

Detailed Description

Apply an affine transformation to the field: y = a*x+b.

Definition at line 383 of file SDBVMat.h.


Member Typedef Documentation

Reimplemented from PLearn::SDBVMFieldSource1.

Definition at line 385 of file SDBVMat.h.


Constructor & Destructor Documentation

PLearn::SDBVMFieldAffine::SDBVMFieldAffine ( SDBVMSource  source,
real  a,
real  b = 0.0,
real  missing_values_mapping = MISSING_VALUE 
) [inline]

Definition at line 388 of file SDBVMat.h.

        : inherited(source,missing_values_mapping,VMField::Continuous), a_(a), b_(b) {}

Member Function Documentation

void PLearn::SDBVMFieldAffine::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 349 of file SDBVMat.cc.

References a_, b_, PLearn::SDBVMField::convertMissing(), PLearn::SDBVMSource::getValue(), and PLearn::SDBVMFieldSource1::source_.

{
    real v = source_.getValue(sdb,row); 
    //if (is_missing(v))
    //  output[0] = MISSING_VALUE;
    //else
    output[0] = a_ * v + b_;
    convertMissing(output);
}

Here is the call graph for this function:

int PLearn::SDBVMFieldAffine::fieldWidth ( ) const [virtual]

Width that the field occupies in the VMat.

Implements PLearn::SDBVMField.

Definition at line 360 of file SDBVMat.cc.

{
    return 1;
}

Member Data Documentation

Definition at line 398 of file SDBVMat.h.

Referenced by convertField().

Definition at line 398 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