|
PLearn 0.1
|
#include <RegularGridVMatrix.h>


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 OptionList & | getOptionList () const |
| virtual OptionMap & | getOptionMap () const |
| virtual RemoteMethodMap & | getRemoteMethodMap () const |
| virtual RegularGridVMatrix * | deepCopy (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 PPath & | declaringFile () |
Public Attributes | |
| TVec< int > | dimensions |
| 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. | |
Definition at line 49 of file RegularGridVMatrix.h.
typedef RowBufferedVMatrix PLearn::RegularGridVMatrix::inherited [private] |
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 51 of file RegularGridVMatrix.h.
| 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_(); }

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

| 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.
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_().
{
inherited::build();
build_();
}

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


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

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

| 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.
{
inherited::makeDeepCopyFromShallowCopy(copies);
deepCopyField(dimensions, copies);
deepCopyField(range, copies);
deepCopyField(coordstart, copies);
deepCopyField(coordend, copies);
}

Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 106 of file RegularGridVMatrix.h.
Definition at line 65 of file RegularGridVMatrix.h.
Referenced by build_(), declareOptions(), getNewRow(), and makeDeepCopyFromShallowCopy().
Definition at line 64 of file RegularGridVMatrix.h.
Referenced by build_(), declareOptions(), getNewRow(), and makeDeepCopyFromShallowCopy().
Definition at line 63 of file RegularGridVMatrix.h.
Referenced by build_(), declareOptions(), getNewRow(), and makeDeepCopyFromShallowCopy().
| TVec< pair<real,real> > PLearn::RegularGridVMatrix::range |
Definition at line 66 of file RegularGridVMatrix.h.
Referenced by build_(), declareOptions(), and makeDeepCopyFromShallowCopy().
1.7.4