Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::VMatLanguage Class Reference

#include <VMatLanguage.h>

Inheritance diagram for PLearn::VMatLanguage:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 VMatLanguage ()
 VMatLanguage (VMat vmsrc)
 PLEARN_DECLARE_OBJECT (VMatLanguage)
virtual void build ()
 Should call simply inherited::build(), then this class's build_().

void run (const Vec &srcvec, const Vec &result, int rowindex=-1) const
 Executes the program on the srcvec, copy resulting stack to result rowindex is only there for instruction 'rowindex' that pushes it on the stack.

void run (int rowindex, const Vec &result) const
 Gets the row with the given rowindex from the vmsource VMat and applies program to it.

void setSource (VMat the_source)
void compileStream (istream &in, vector< string > &fieldnames)
 takes a string, filename, or istream and generate the bytecode from it On exit, fieldnames will contain fieldnames of the resulting matrix The source vmat must be set before compiling a VPL program.

void compileString (const string &code, vector< string > &fieldnames)
void compileFile (const string &filename, vector< string > &fieldnames)
int pstackSize () const

Static Public Member Functions

void declareOptions (OptionList &ol)
 redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)


Static Public Attributes

bool output_preproc = false

Private Types

typedef Object inherited

Private Member Functions

void generateCode (const string &processed_sourcecode)
void generateCode (istream &processed_sourcecode)
void preprocess (istream &in, map< string, string > &defines, string &processed_sourcecode, vector< string > &fieldnames)
void build_ ()

Static Private Member Functions

void build_opcodes_map ()
 builds the map if it does not already exist


Private Attributes

VMat vmsource
TVec< intprogram
TVec< RealMappingmappings
Vec pstack
Vec myvec
Vec mem

Static Private Attributes

map< string, intopcodes

Member Typedef Documentation

typedef Object PLearn::VMatLanguage::inherited [private]
 

Reimplemented from PLearn::Object.

Definition at line 61 of file VMatLanguage.h.


Constructor & Destructor Documentation

PLearn::VMatLanguage::VMatLanguage  )  [inline]
 

Definition at line 86 of file VMatLanguage.h.

References build_(), PLearn::Mat, and vmsource.

PLearn::VMatLanguage::VMatLanguage VMat  vmsrc  )  [inline]
 

Definition at line 87 of file VMatLanguage.h.

References build_(), and vmsource.


Member Function Documentation

void PLearn::VMatLanguage::build  )  [virtual]
 

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 84 of file VMatLanguage.cc.

References build_().

void PLearn::VMatLanguage::build_  )  [private]
 

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 it's parent's build_ has already been called.

Reimplemented from PLearn::Object.

Definition at line 91 of file VMatLanguage.cc.

References build_opcodes_map().

Referenced by build(), and VMatLanguage().

void PLearn::VMatLanguage::build_opcodes_map  )  [static, private]
 

builds the map if it does not already exist

Definition at line 416 of file VMatLanguage.cc.

References opcodes.

Referenced by build_().

void PLearn::VMatLanguage::compileFile const string filename,
vector< string > &  fieldnames
 

Definition at line 379 of file VMatLanguage.cc.

References compileStream(), and PLERROR.

void PLearn::VMatLanguage::compileStream istream &  in,
vector< string > &  fieldnames
 

takes a string, filename, or istream and generate the bytecode from it On exit, fieldnames will contain fieldnames of the resulting matrix The source vmat must be set before compiling a VPL program.

Definition at line 387 of file VMatLanguage.cc.

References PLearn::endl(), PLearn::VMat::fieldName(), generateCode(), mappings, output_preproc, PLERROR, preprocess(), program, PLearn::TVec< RealMapping >::resize(), PLearn::TVec< int >::resize(), PLearn::tostring(), vmsource, and PLearn::VMat::width().

Referenced by compileFile(), and compileString().

void PLearn::VMatLanguage::compileString const string code,
vector< string > &  fieldnames
 

Definition at line 373 of file VMatLanguage.cc.

References compileStream().

Referenced by PLearn::ProcessingVMatrix::build_(), PLearn::FilteredVMatrix::build_(), PLearn::VVMatrix::generateFilterIndexFile(), PLearn::PreprocessingVMatrix::PreprocessingVMatrix(), and PLearn::vmatmain().

void PLearn::VMatLanguage::declareOptions OptionList ol  )  [static]
 

redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)

ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); }

Reimplemented from PLearn::Object.

Definition at line 97 of file VMatLanguage.cc.

References PLearn::declareOption(), and PLearn::OptionList.

void PLearn::VMatLanguage::generateCode istream &  processed_sourcecode  )  [private]
 

Definition at line 309 of file VMatLanguage.cc.

References PLearn::TVec< int >::append(), mappings, opcodes, PLearn::peekAfterSkipBlanks(), PLearn::pl_isnumber(), PLERROR, program, PLearn::TVec< RealMapping >::read(), PLearn::TVec< RealMapping >::resize(), PLearn::TVec< RealMapping >::size(), PLearn::split(), PLearn::tofloat(), PLearn::toint(), and val.

void PLearn::VMatLanguage::generateCode const string processed_sourcecode  )  [private]
 

Definition at line 365 of file VMatLanguage.cc.

References generateCode().

Referenced by compileStream(), and generateCode().

PLearn::VMatLanguage::PLEARN_DECLARE_OBJECT VMatLanguage   ) 
 

void PLearn::VMatLanguage::preprocess istream &  in,
map< string, string > &  defines,
string processed_sourcecode,
vector< string > &  fieldnames
[private]
 

Definition at line 105 of file VMatLanguage.cc.

References c_str(), PLearn::VMat::fieldName(), PLearn::getDataSetDate(), PLearn::is_missing(), PLearn::isBlank(), PLearn::join(), PLearn::mtime(), PLearn::pl_isnumber(), PLERROR, PLWARNING, preprocess(), PLearn::removeblanks(), PLearn::skipRestOfLine(), PLearn::split(), PLearn::toint(), PLearn::tostring(), vmsource, and PLearn::VMat::width().

Referenced by compileStream(), and preprocess().

int PLearn::VMatLanguage::pstackSize  )  const [inline]
 

Definition at line 119 of file VMatLanguage.h.

References pstack, and PLearn::TVec< T >::size().

void PLearn::VMatLanguage::run int  rowindex,
const Vec result
const
 

Gets the row with the given rowindex from the vmsource VMat and applies program to it.

Definition at line 798 of file VMatLanguage.cc.

References myvec, PLearn::TVec< T >::resize(), PLearn::Object::run(), vmsource, and PLearn::VMat::width().

void PLearn::VMatLanguage::run const Vec srcvec,
const Vec result,
int  rowindex = -1
const
 

Executes the program on the srcvec, copy resulting stack to result rowindex is only there for instruction 'rowindex' that pushes it on the stack.

Definition at line 479 of file VMatLanguage.cc.

References PLearn::TVec< int >::begin(), PLearn::TVec< T >::data(), PLearn::date_to_float(), PLearn::PDate::day, PLearn::PDate::dayOfWeek(), PLearn::TVec< int >::end(), PLearn::exp(), PLearn::float_to_date(), PLearn::is_missing(), PLearn::TVec< T >::length(), PLearn::log(), mappings, mem, MISSING_VALUE, PLearn::PDate::month, PLERROR, PLearn::TVec< T >::pop(), PLearn::pow(), program, pstack, PLearn::TVec< T >::push(), PLearn::TVec< T >::resize(), PLearn::TVec< T >::size(), PLearn::sqrt(), PLearn::PDate::toJulianDay(), PLearn::TVec< T >::top(), PLearn::Vec, vmsource, PLearn::VMat::width(), and PLearn::PDate::year.

Referenced by PLearn::VVMatrix::generateFilterIndexFile(), PLearn::PreprocessingVMatrix::getNewRow(), PLearn::ProcessingVMatrix::getNewRow(), PLearn::FilteredVMatrix::openIndex(), and PLearn::vmatmain().

void PLearn::VMatLanguage::setSource VMat  the_source  )  [inline]
 

Definition at line 102 of file VMatLanguage.h.

References program, PLearn::TVec< int >::resize(), setSource(), and vmsource.

Referenced by PLearn::ProcessingVMatrix::build_(), PLearn::FilteredVMatrix::build_(), and setSource().


Member Data Documentation

TVec<RealMapping> PLearn::VMatLanguage::mappings [private]
 

Definition at line 65 of file VMatLanguage.h.

Referenced by compileStream(), generateCode(), and run().

Vec PLearn::VMatLanguage::mem [mutable, private]
 

Definition at line 68 of file VMatLanguage.h.

Referenced by run().

Vec PLearn::VMatLanguage::myvec [mutable, private]
 

Definition at line 67 of file VMatLanguage.h.

Referenced by run().

map< string, int > PLearn::VMatLanguage::opcodes [static, private]
 

Definition at line 79 of file VMatLanguage.cc.

Referenced by build_opcodes_map(), and generateCode().

bool PLearn::VMatLanguage::output_preproc = false [static]
 

Definition at line 52 of file VMatLanguage.cc.

Referenced by compileStream().

TVec<int> PLearn::VMatLanguage::program [private]
 

Definition at line 64 of file VMatLanguage.h.

Referenced by compileStream(), generateCode(), run(), and setSource().

Vec PLearn::VMatLanguage::pstack [mutable, private]
 

Definition at line 66 of file VMatLanguage.h.

Referenced by pstackSize(), and run().

VMat PLearn::VMatLanguage::vmsource [private]
 

Definition at line 63 of file VMatLanguage.h.

Referenced by compileStream(), preprocess(), run(), setSource(), and VMatLanguage().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:27:00 2004 for PLearn by doxygen 1.3.7