PLearn 0.1
|
A VVec is a reference to a row or part of a row (a subrow) of a VMatrix. More...
#include <VVec.h>
Public Member Functions | |
VVec () | |
VVec (const PP< VMatrix > &m, int i) | |
VVec (const PP< VMatrix > &m, int i, int j, int l) | |
VVec (const Vec &v) | |
constructor from Vec Will build a MemoryVMatrix containing a view of v as its single row and have the VVec point to it. | |
int | length () const |
int | size () const |
void | toVec (const Vec &v) const |
void | copyFrom (const Vec &v) const |
copies v into into this VVec | |
VVec | subVec (int j, int len) |
operator Vec () const | |
conversion to Vec | |
virtual void | newwrite (PStream &out) const |
The default implementation serializes the object in the new format: | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual VVec * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-constructor. | |
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 PPath & | declaringFile () |
static void | declareOptions (OptionList &ol) |
Declare options (data fields) for the class. | |
Public Attributes | |
PP< VMatrix > | data |
int | row_index |
int | col_index |
int | length_ |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Private Types | |
typedef Object | inherited |
Private Member Functions | |
void | build_ () |
Object-specific post-constructor. |
typedef Object PLearn::VVec::inherited [private] |
Reimplemented from PLearn::Object.
PLearn::VVec::VVec | ( | ) | [inline] |
PLearn::VVec::VVec | ( | const Vec & | v | ) |
string PLearn::VVec::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
OptionList & PLearn::VVec::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
RemoteMethodMap & PLearn::VVec::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented from PLearn::Object.
Object * PLearn::VVec::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
StaticInitializer VVec::_static_initializer_ & PLearn::VVec::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
void PLearn::VVec::build | ( | ) | [virtual] |
Post-constructor.
The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.
Reimplemented from PLearn::Object.
Definition at line 55 of file VVec.cc.
References PLearn::Object::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::VVec::build_ | ( | ) | [private] |
Object-specific post-constructor.
This method should be redefined in subclasses and do the actual building of the object according to previously set option fields. Constructors can just set option fields, and then call build_. This method is NOT virtual, and will typically be called only from three places: a constructor, the public virtual build()
method, and possibly the public virtual read method (which calls its parent's read). build_()
can assume that its parent's build_()
has already been called.
Reimplemented from PLearn::Object.
Definition at line 62 of file VVec.cc.
Referenced by build().
{ }
string PLearn::VVec::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
void PLearn::VVec::copyFrom | ( | const Vec & | v | ) | const [inline] |
copies v into into this VVec
Definition at line 95 of file VVec.h.
References col_index, data, PLearn::TVec< T >::length(), length_, PLERROR, and row_index.
Referenced by PLearn::operator<<(), and PLearn::operator>>().
{ #ifdef BOUNDCHECK if(v.length()!=length_) PLERROR("In VVec::copyFrom length of Vec and VVec differ!"); #endif data->putSubRow(row_index,col_index,v); }
void PLearn::VVec::declareOptions | ( | OptionList & | ol | ) | [static] |
Declare options (data fields) for the class.
Redefine this in subclasses: call declareOption
(...) for each option, and then call inherited::declareOptions(options)
. Please call the inherited
method AT THE END to get the options listed in a consistent order (from most recently defined to least recently defined).
static void MyDerivedClass::declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "The size of the input; it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "The learned model weights"); inherited::declareOptions(ol); }
ol | List of options that is progressively being constructed for the current class. |
Reimplemented from PLearn::Object.
Definition at line 67 of file VVec.cc.
References PLearn::OptionBase::buildoption, col_index, data, PLearn::declareOption(), PLearn::Object::declareOptions(), length_, and row_index.
{ declareOption(ol, "data", &VVec::data, OptionBase::buildoption, ""); declareOption(ol, "row_index", &VVec::row_index, OptionBase::buildoption, ""); declareOption(ol, "col_index", &VVec::col_index, OptionBase::buildoption, ""); declareOption(ol, "length_", &VVec::length_, OptionBase::buildoption, ""); inherited::declareOptions(ol); }
static const PPath& PLearn::VVec::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::Object.
OptionList & PLearn::VVec::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
OptionMap & PLearn::VVec::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
RemoteMethodMap & PLearn::VVec::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
int PLearn::VVec::length | ( | ) | const [inline] |
Definition at line 80 of file VVec.h.
References length_.
Referenced by PLearn::TopDownAsymetricDeepNetwork::computeCostsFromOutputs(), and PLearn::TopDownAsymetricDeepNetwork::computeOutput().
{ return length_; }
virtual void PLearn::VVec::newwrite | ( | PStream & | out | ) | const [inline, virtual] |
The default implementation serializes the object in the new format:
Classname(optionname=optionval; optionname=optionval; ...)
Subclasses may override this method to provide different outputs depending on out's
mode (plearn_ascii
, raw_ascii
, ...).
out | Stream onto which serialize the object |
Reimplemented from PLearn::Object.
Definition at line 116 of file VVec.h.
References PLearn::flush(), PLearn::Object::newwrite(), PLearn::PStream::outmode, PLearn::PStream::pretty_ascii, and PLearn::PStream::raw_ascii.
{ switch(out.outmode) { case PStream::raw_ascii: case PStream::pretty_ascii: { out << ((Vec)*this) << flush; break; } default: inherited::newwrite(out); } }
PLearn::VVec::operator Vec | ( | ) | const [inline] |
int PLearn::VVec::size | ( | ) | const [inline] |
void PLearn::VVec::toVec | ( | const Vec & | v | ) | const [inline] |
Definition at line 85 of file VVec.h.
References col_index, data, PLearn::TVec< T >::length(), length_, PLERROR, and row_index.
Referenced by PLearn::operator<<(), and PLearn::operator>>().
{ #ifdef BOUNDCHECK if(v.length()!=length_) PLERROR("In VVec::toVec length of Vec and VVec differ!"); #endif data->getSubRow(row_index,col_index,v); }
Reimplemented from PLearn::Object.
Definition at line 63 of file VVec.h.
Referenced by copyFrom(), declareOptions(), operator Vec(), subVec(), and toVec().
Definition at line 61 of file VVec.h.
Referenced by copyFrom(), declareOptions(), operator Vec(), subVec(), and toVec().
Definition at line 64 of file VVec.h.
Referenced by copyFrom(), declareOptions(), length(), operator Vec(), size(), and toVec().
Definition at line 62 of file VVec.h.
Referenced by copyFrom(), declareOptions(), operator Vec(), subVec(), and toVec().