|
PLearn 0.1
|
#include <CrossReferenceVMatrix.h>


Public Member Functions | |
| CrossReferenceVMatrix () | |
| default constructor (for automatic deserialization) | |
| CrossReferenceVMatrix (VMat the_master, int the_index, VMat the_slave) | |
| The column headings are simply the concatenation of the headings in the two vmatrices. | |
| virtual string | classname () const |
| virtual OptionList & | getOptionList () const |
| virtual OptionMap & | getOptionMap () const |
| virtual RemoteMethodMap & | getRemoteMethodMap () const |
| virtual CrossReferenceVMatrix * | deepCopy (CopiesMap &copies) const |
| virtual void | build () |
| Simply calls inherited::build() then build_(). | |
| virtual void | getRow (int i, Vec samplevec) const |
| These methods do not usually need to be overridden in subclasses (default versions call getSubRow, which should do just fine) | |
| virtual real | get (int i, int j) const |
| This method must be implemented in all subclasses. | |
| virtual void | reset_dimensions () |
| In case the dimensions of an underlying VMat has changed, recompute it. | |
Static Public Member Functions | |
| static string | _classname_ () |
| CrossReferenceVMatrix. | |
| 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 () |
| static void | declareOptions (OptionList &ol) |
| Declare this class' options. | |
Static Public Attributes | |
| static StaticInitializer | _static_initializer_ |
Protected Attributes | |
| VMat | master |
| int | index |
| VMat | slave |
Private Types | |
| typedef VMatrix | inherited |
Private Member Functions | |
| void | build_ () |
| This does the actual building. | |
This VMat is a concatenation of 2 VMat, a 'master' and a 'slave'. The row of the 'slave' corresponding to the index set by 'index' of 'master', is merged with 'master'.
for i=1,master.length() this->row(i) <- [ master.row(i), slave.row(slave(i,index)) ]
Definition at line 61 of file CrossReferenceVMatrix.h.
typedef VMatrix PLearn::CrossReferenceVMatrix::inherited [private] |
Reimplemented from PLearn::VMatrix.
Definition at line 63 of file CrossReferenceVMatrix.h.
| PLearn::CrossReferenceVMatrix::CrossReferenceVMatrix | ( | ) |
default constructor (for automatic deserialization)
Definition at line 51 of file CrossReferenceVMatrix.cc.
: index(0) { }
| PLearn::CrossReferenceVMatrix::CrossReferenceVMatrix | ( | VMat | the_master, |
| int | the_index, | ||
| VMat | the_slave | ||
| ) |
The column headings are simply the concatenation of the headings in the two vmatrices.
Definition at line 56 of file CrossReferenceVMatrix.cc.
References build().
: inherited(the_master.length(), the_master.width()+the_slave.width()-1), master(the_master), index(the_index), slave(the_slave) { //fieldinfos = the_master->getFieldInfos(); // fieldinfos &= the_slave->getFieldInfos(); build(); }

| string PLearn::CrossReferenceVMatrix::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::VMatrix.
Definition at line 49 of file CrossReferenceVMatrix.cc.
| OptionList & PLearn::CrossReferenceVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::VMatrix.
Definition at line 49 of file CrossReferenceVMatrix.cc.
| RemoteMethodMap & PLearn::CrossReferenceVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::VMatrix.
Definition at line 49 of file CrossReferenceVMatrix.cc.
Reimplemented from PLearn::VMatrix.
Definition at line 49 of file CrossReferenceVMatrix.cc.
| Object * PLearn::CrossReferenceVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 49 of file CrossReferenceVMatrix.cc.
| StaticInitializer CrossReferenceVMatrix::_static_initializer_ & PLearn::CrossReferenceVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::VMatrix.
Definition at line 49 of file CrossReferenceVMatrix.cc.
| void PLearn::CrossReferenceVMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::VMatrix.
Definition at line 86 of file CrossReferenceVMatrix.cc.
References PLearn::VMatrix::build(), and build_().
Referenced by CrossReferenceVMatrix().
{
inherited::build();
build_();
}


| void PLearn::CrossReferenceVMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::VMatrix.
Definition at line 93 of file CrossReferenceVMatrix.cc.
References PLearn::VMatrix::fieldinfos, master, slave, and PLearn::VMatrix::updateMtime().
Referenced by build().
{
if (master && slave) {
fieldinfos = master->getFieldInfos();
fieldinfos &= slave->getFieldInfos();
updateMtime(master);
updateMtime(slave);
}
}


| string PLearn::CrossReferenceVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 49 of file CrossReferenceVMatrix.cc.
| void PLearn::CrossReferenceVMatrix::declareOptions | ( | OptionList & | ol | ) | [static] |
Declare this class' options.
Reimplemented from PLearn::VMatrix.
Definition at line 71 of file CrossReferenceVMatrix.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::VMatrix::declareOptions(), index, master, and slave.
{
declareOption(ol, "master", &CrossReferenceVMatrix::master,
OptionBase::buildoption, "");
declareOption(ol, "slave", &CrossReferenceVMatrix::slave,
OptionBase::buildoption, "");
declareOption(ol, "index", &CrossReferenceVMatrix::index,
OptionBase::buildoption, "");
inherited::declareOptions(ol);
}

| static const PPath& PLearn::CrossReferenceVMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::VMatrix.
Definition at line 82 of file CrossReferenceVMatrix.h.
{ PLERROR("CrossReferenceVMatrix::reset_dimensions() not implemented"); }
| CrossReferenceVMatrix * PLearn::CrossReferenceVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::VMatrix.
Definition at line 49 of file CrossReferenceVMatrix.cc.
This method must be implemented in all subclasses.
Returns element (i,j).
Implements PLearn::VMatrix.
Definition at line 121 of file CrossReferenceVMatrix.cc.
References index, PLearn::VMatrix::length(), master, PLERROR, slave, PLearn::VMat::width(), and PLearn::VMatrix::width().
{
#ifdef BOUNDCHECK
if(i<0 || i>=length() || j<0 || j>=width())
PLERROR("In CrossReferenceVMatrix::get OUT OF BOUNDS");
#endif
if (j < index)
return master->get(i,j);
else if (j < master.width()-1)
return master->get(i,j+1);
else {
int ii = (int)master->get(i,index);
int jj = j - master.width() + 1;
return slave->get(ii,jj);
}
}

| OptionList & PLearn::CrossReferenceVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 49 of file CrossReferenceVMatrix.cc.
| OptionMap & PLearn::CrossReferenceVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 49 of file CrossReferenceVMatrix.cc.
| RemoteMethodMap & PLearn::CrossReferenceVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 49 of file CrossReferenceVMatrix.cc.
These methods do not usually need to be overridden in subclasses (default versions call getSubRow, which should do just fine)
Copies row i into v (which must have appropriate length equal to the VMat's width).
Reimplemented from PLearn::VMatrix.
Definition at line 103 of file CrossReferenceVMatrix.cc.
References index, j, PLearn::VMatrix::length(), PLearn::TVec< T >::length(), master, PLERROR, slave, PLearn::VMat::width(), and PLearn::VMatrix::width().
{
#ifdef BOUNDCHECK
if (i<0 || i>=length() || samplevec.length()!=width())
PLERROR("In CrossReferenceVMatrix::getRow OUT OF BOUNDS");
#endif
Vec v1(master.width());
Vec v2(slave.width());
master->getRow(i, v1);
int index = (int)v1[index];
slave->getRow(index, v2);
for (int j=0; j<index; j++) samplevec[j] = v1[j];
for (int j=index+1; j<v1.length(); j++) samplevec[j-1] = v1[j];
for (int j=0; j<v2.length(); j++) samplevec[j+v1.length()-1] = v2[j];
}

| virtual void PLearn::CrossReferenceVMatrix::reset_dimensions | ( | ) | [inline, virtual] |
In case the dimensions of an underlying VMat has changed, recompute it.
Reimplemented from PLearn::VMatrix.
Definition at line 89 of file CrossReferenceVMatrix.h.
References PLERROR.
{ PLERROR("CrossReferenceVMatrix::reset_dimensions() not implemented"); }
Reimplemented from PLearn::VMatrix.
Definition at line 82 of file CrossReferenceVMatrix.h.
int PLearn::CrossReferenceVMatrix::index [protected] |
Definition at line 67 of file CrossReferenceVMatrix.h.
Referenced by declareOptions(), get(), and getRow().
VMat PLearn::CrossReferenceVMatrix::master [protected] |
Definition at line 66 of file CrossReferenceVMatrix.h.
Referenced by build_(), declareOptions(), get(), and getRow().
VMat PLearn::CrossReferenceVMatrix::slave [protected] |
Definition at line 68 of file CrossReferenceVMatrix.h.
Referenced by build_(), declareOptions(), get(), and getRow().
1.7.4