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

#include <KernelVMatrix.h>

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

List of all members.

Public Member Functions

 KernelVMatrix ()
 KernelVMatrix (VMat the_source1, VMat the_source2, Ker the_ker)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual KernelVMatrixdeepCopy (CopiesMap &copies) const
virtual void build ()
 Simply calls inherited::build() then build_().
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.
virtual real get (int i, int j) const
 This method must be implemented in all subclasses.
virtual void getSubRow (int i, int j, Vec v) const
 It is suggested that this method be implemented in subclasses to speed up accesses (default version repeatedly calls get(i,j) which may have a significant overhead).

Static Public Member Functions

static string _classname_ ()
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static Object_new_instance_for_typemap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()
static void declareOptions (OptionList &ol)
 Declare this class' options.

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Attributes

VMat source1
 KernelVMatrix() : source1(), source2(), ker(), input1(), input2() {}.
VMat source2
Ker ker
Vec input1
Vec input2

Private Types

typedef VMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

***************** KernelVMatrix *

This VMat is built from 2 other (possibly identical) VMats and a Kernel K. The resulting VMat takes every sample (x_i,y_i)

Definition at line 63 of file KernelVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 65 of file KernelVMatrix.h.


Constructor & Destructor Documentation

PLearn::KernelVMatrix::KernelVMatrix ( )

Definition at line 63 of file KernelVMatrix.cc.

{
}
PLearn::KernelVMatrix::KernelVMatrix ( VMat  the_source1,
VMat  the_source2,
Ker  the_ker 
)

Definition at line 67 of file KernelVMatrix.cc.

    : VMatrix(the_source1->length(), the_source2->length()),
      source1(the_source1), source2(the_source2), ker(the_ker),
      input1(the_source1->width()), input2(the_source2->width())
{}

Member Function Documentation

string PLearn::KernelVMatrix::_classname_ ( ) [static]

Reimplemented from PLearn::VMatrix.

Definition at line 61 of file KernelVMatrix.cc.

OptionList & PLearn::KernelVMatrix::_getOptionList_ ( ) [static]

Reimplemented from PLearn::VMatrix.

Definition at line 61 of file KernelVMatrix.cc.

RemoteMethodMap & PLearn::KernelVMatrix::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::VMatrix.

Definition at line 61 of file KernelVMatrix.cc.

bool PLearn::KernelVMatrix::_isa_ ( const Object o) [static]

Reimplemented from PLearn::VMatrix.

Definition at line 61 of file KernelVMatrix.cc.

Object * PLearn::KernelVMatrix::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 61 of file KernelVMatrix.cc.

StaticInitializer KernelVMatrix::_static_initializer_ & PLearn::KernelVMatrix::_static_initialize_ ( ) [static]

Reimplemented from PLearn::VMatrix.

Definition at line 61 of file KernelVMatrix.cc.

void PLearn::KernelVMatrix::build ( ) [virtual]

Simply calls inherited::build() then build_().

Reimplemented from PLearn::VMatrix.

Definition at line 74 of file KernelVMatrix.cc.

References PLearn::VMatrix::build(), and build_().

Here is the call graph for this function:

void PLearn::KernelVMatrix::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 81 of file KernelVMatrix.cc.

References input1, input2, ker, PLearn::TVec< T >::resize(), source1, source2, PLearn::VMatrix::updateMtime(), and PLearn::VMat::width().

Referenced by build().

{
    if (source1)
        input1.resize(source1->width());
    if (source2)
        input2.resize(source2->width());
    updateMtime(source1);
    updateMtime(source2);
    updateMtime(ker.getData());
}

Here is the call graph for this function:

Here is the caller graph for this function:

string PLearn::KernelVMatrix::classname ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 61 of file KernelVMatrix.cc.

void PLearn::KernelVMatrix::declareOptions ( OptionList ol) [static]

Declare this class' options.

Reimplemented from PLearn::VMatrix.

Definition at line 93 of file KernelVMatrix.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::VMatrix::declareOptions(), ker, source1, and source2.

Here is the call graph for this function:

static const PPath& PLearn::KernelVMatrix::declaringFile ( ) [inline, static]

Reimplemented from PLearn::VMatrix.

Definition at line 80 of file KernelVMatrix.h.

:
    void build_();
KernelVMatrix * PLearn::KernelVMatrix::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::VMatrix.

Definition at line 61 of file KernelVMatrix.cc.

real PLearn::KernelVMatrix::get ( int  i,
int  j 
) const [virtual]

This method must be implemented in all subclasses.

Returns element (i,j).

Implements PLearn::VMatrix.

Definition at line 120 of file KernelVMatrix.cc.

References input1, input2, ker, PLearn::VMatrix::length(), PLERROR, source1, source2, and PLearn::VMatrix::width().

{
#ifdef BOUNDCHECK
    if(i<0 || i>=length() || j<0 || j>=width())
        PLERROR("In KernelVMatrix::get OUT OF BOUNDS");
#endif

    source1->getRow(i,input1);
    source2->getRow(j,input2);
    return ker(input1,input2);
}

Here is the call graph for this function:

OptionList & PLearn::KernelVMatrix::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 61 of file KernelVMatrix.cc.

OptionMap & PLearn::KernelVMatrix::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 61 of file KernelVMatrix.cc.

RemoteMethodMap & PLearn::KernelVMatrix::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 61 of file KernelVMatrix.cc.

void PLearn::KernelVMatrix::getSubRow ( int  i,
int  j,
Vec  v 
) const [virtual]

It is suggested that this method be implemented in subclasses to speed up accesses (default version repeatedly calls get(i,j) which may have a significant overhead).

Fills v with the subrow i lying between columns j (inclusive) and j+v.length() (exclusive).

Reimplemented from PLearn::VMatrix.

Definition at line 133 of file KernelVMatrix.cc.

References input1, input2, ker, PLearn::VMatrix::length(), PLearn::TVec< T >::length(), PLERROR, source1, source2, and PLearn::VMatrix::width().

{
#ifdef BOUNDCHECK
    if(i<0 || i>=length() || j<0 || j+v.length()>width())
        PLERROR("In KernelVMatrix::getRow OUT OF BOUNDS");
#endif

    source1->getRow(i,input1);
    for(int jj=0; jj<v.length(); jj++)
    {
        source2->getRow(j+jj,input2);
        v[jj] = ker(input1,input2);
    }
}

Here is the call graph for this function:

void PLearn::KernelVMatrix::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.

This needs to be overridden by every class that adds "complex" data members to the class, such as Vec, Mat, PP<Something>, etc. Typical implementation:

  void CLASS_OF_THIS::makeDeepCopyFromShallowCopy(CopiesMap& copies)
  {
      inherited::makeDeepCopyFromShallowCopy(copies);
      deepCopyField(complex_data_member1, copies);
      deepCopyField(complex_data_member2, copies);
      ...
  }
Parameters:
copiesA map used by the deep-copy mechanism to keep track of already-copied objects.

Reimplemented from PLearn::VMatrix.

Definition at line 109 of file KernelVMatrix.cc.

References PLearn::deepCopyField(), input1, input2, ker, PLearn::VMatrix::makeDeepCopyFromShallowCopy(), source1, and source2.

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 80 of file KernelVMatrix.h.

Definition at line 73 of file KernelVMatrix.h.

Referenced by build_(), get(), getSubRow(), and makeDeepCopyFromShallowCopy().

Definition at line 74 of file KernelVMatrix.h.

Referenced by build_(), get(), getSubRow(), and makeDeepCopyFromShallowCopy().

Definition at line 71 of file KernelVMatrix.h.

Referenced by build_(), declareOptions(), get(), getSubRow(), and makeDeepCopyFromShallowCopy().

Definition at line 70 of file KernelVMatrix.h.

Referenced by build_(), declareOptions(), get(), getSubRow(), and makeDeepCopyFromShallowCopy().


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