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

#include <RegularGridVMatrix.h>

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

List of all members.

Public Member Functions

 RegularGridVMatrix ()
 RegularGridVMatrix (TVec< int > the_dimensions, Vec the_coordstart, Vec the_coordend)
 RegularGridVMatrix (TVec< int > the_dimensions, TVec< pair< real, real > > the_range)
 DEPRECATED constructor.
virtual void build ()
 Simply calls inherited::build() then build_().
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual RegularGridVMatrixdeepCopy (CopiesMap &copies) const

Static Public Member Functions

static string _classname_ ()
 Declares name and deepCopy methods.
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 ()

Public Attributes

TVec< intdimensions
Vec coordstart
Vec coordend
TVec< pair< real, real > > range

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Member Functions

virtual void getNewRow (int i, const Vec &v) const
 This is the only method requiring implementation.

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares this class' options.

Private Types

typedef RowBufferedVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 49 of file RegularGridVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 51 of file RegularGridVMatrix.h.


Constructor & Destructor Documentation

PLearn::RegularGridVMatrix::RegularGridVMatrix ( )

Definition at line 48 of file RegularGridVMatrix.cc.

{
    // ...

    // ### You may or may not want to call build_() to finish building the object
    // build_();
}
PLearn::RegularGridVMatrix::RegularGridVMatrix ( TVec< int the_dimensions,
Vec  the_coordstart,
Vec  the_coordend 
)

Definition at line 62 of file RegularGridVMatrix.cc.

References build_().

    :dimensions(the_dimensions.copy()), coordstart(the_coordstart.copy()), coordend(the_coordend.copy())
{
    build_();
}

Here is the call graph for this function:

PLearn::RegularGridVMatrix::RegularGridVMatrix ( TVec< int the_dimensions,
TVec< pair< real, real > >  the_range 
)

DEPRECATED constructor.

Definition at line 56 of file RegularGridVMatrix.cc.

References build_().

    :dimensions(the_dimensions.copy()), range(the_range.copy())
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

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

Declares name and deepCopy methods.

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 69 of file RegularGridVMatrix.cc.

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 69 of file RegularGridVMatrix.cc.

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 69 of file RegularGridVMatrix.cc.

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 69 of file RegularGridVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 69 of file RegularGridVMatrix.cc.

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 69 of file RegularGridVMatrix.cc.

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

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

Reimplemented from PLearn::VMatrix.

Definition at line 141 of file RegularGridVMatrix.cc.

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

Here is the call graph for this function:

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

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 116 of file RegularGridVMatrix.cc.

References coordend, coordstart, dimensions, PLearn::TVec< T >::first(), PLearn::VMatrix::inputsize_, PLearn::TVec< T >::length(), PLearn::VMatrix::length_, n, PLearn::product(), range, PLearn::TVec< T >::resize(), PLearn::VMatrix::targetsize_, PLearn::VMatrix::weightsize_, and PLearn::VMatrix::width_.

Referenced by build(), and RegularGridVMatrix().

{
    int n = range.length();
    if(n>0)
    {
        coordstart.resize(n);
        coordend.resize(n);
        for(int k=0; k<n; k++)
        {
            coordstart[k] = range[k].first;
            coordstart[k] = range[k].second;
        }
    }

    width_ = dimensions.length();
    length_ = (width_ ? product(dimensions) : 0);
    if(inputsize_<0)
    {
        inputsize_ = width_;
        targetsize_ = 0;
        weightsize_ = 0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 69 of file RegularGridVMatrix.cc.

void PLearn::RegularGridVMatrix::declareOptions ( OptionList ol) [static, protected]

Declares this class' options.

Reimplemented from PLearn::VMatrix.

Definition at line 87 of file RegularGridVMatrix.cc.

References PLearn::OptionBase::buildoption, coordend, coordstart, PLearn::declareOption(), PLearn::VMatrix::declareOptions(), dimensions, and range.

{
    // ### Declare all of this object's options here
    // ### For the "flags" of each option, you should typically specify
    // ### one of OptionBase::buildoption, OptionBase::learntoption or
    // ### OptionBase::tuningoption. Another possible flag to be combined with
    // ### is OptionBase::nosave

    // ### ex:
    // declareOption(ol, "myoption", &RegularGridVMatrix::myoption, OptionBase::buildoption,
    //               "Help text describing this option");
    // ...
    declareOption(ol, "dimensions", &RegularGridVMatrix::dimensions, OptionBase::buildoption,
                  "A vector of integers giving the number of sample coordinates\n"
                  "for each dimension of the grid. Ex for a 100x100 2D grid: [ 100 100 ]\n");
    declareOption(ol, "range", &RegularGridVMatrix::range, OptionBase::buildoption,
                  "A vector of low:high pairs with as many dimensions as the grid\n"
                  "ex for 2D: [ -10:10 -3:4 ] \n");
    declareOption(ol, "coordstart", &RegularGridVMatrix::coordstart, OptionBase::buildoption,
                  "A vector of all the start ocoordinates of the grid in each dimension\n"
                  "ex for 2D: [ -10, -3 ] \n");
    declareOption(ol, "coordend", &RegularGridVMatrix::coordend, OptionBase::buildoption,
                  "A vector of all the end coordinates of the grid in each dimension\n"
                  "ex for 2D: [ 5, 4 ] \n");

    // Now call the parent class' declareOptions
    inherited::declareOptions(ol);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 106 of file RegularGridVMatrix.h.

RegularGridVMatrix * PLearn::RegularGridVMatrix::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 69 of file RegularGridVMatrix.cc.

void PLearn::RegularGridVMatrix::getNewRow ( int  i,
const Vec v 
) const [protected, virtual]

This is the only method requiring implementation.

Implements PLearn::RowBufferedVMatrix.

Definition at line 71 of file RegularGridVMatrix.cc.

References coordend, coordstart, d, dimensions, i, PLearn::VMatrix::length(), PLearn::TVec< T >::length(), PLERROR, and PLearn::VMatrix::width().

{
    int d = width();
    if(v.length()!=d)
        PLERROR("In RegularGridVMatrix::getNewRow, size of v (%d) differs from vmat width (%d)",v.length(), d);
    if(i<0 || i>=length())
        PLERROR("In RegularGridVMatrix::getNewRow, row %d out of range [0,%d]",i, length()-1);
    int idx = i;
    for(int k=d-1; k>=0; k--)
    {
        int idx_k = idx%dimensions[k];
        idx = idx/dimensions[k];
        v[k] = coordstart[k] + (coordend[k]-coordstart[k])/(dimensions[k]-1)*idx_k;
    }
}

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 69 of file RegularGridVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 69 of file RegularGridVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 69 of file RegularGridVMatrix.cc.

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 147 of file RegularGridVMatrix.cc.

References coordend, coordstart, PLearn::deepCopyField(), dimensions, PLearn::RowBufferedVMatrix::makeDeepCopyFromShallowCopy(), and range.

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 106 of file RegularGridVMatrix.h.

Definition at line 66 of file RegularGridVMatrix.h.

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


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