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

A VVec is a reference to a row or part of a row (a subrow) of a VMatrix. More...

#include <VVec.h>

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

List of all members.

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 OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual VVecdeepCopy (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 PPathdeclaringFile ()
static void declareOptions (OptionList &ol)
 Declare options (data fields) for the class.

Public Attributes

PP< VMatrixdata
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.

Detailed Description

A VVec is a reference to a row or part of a row (a subrow) of a VMatrix.

Definition at line 54 of file VVec.h.


Member Typedef Documentation

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

Reimplemented from PLearn::Object.

Definition at line 56 of file VVec.h.


Constructor & Destructor Documentation

PLearn::VVec::VVec ( ) [inline]

Definition at line 66 of file VVec.h.

Referenced by subVec().

        :row_index(0), col_index(0), length_(0) {}

Here is the caller graph for this function:

PLearn::VVec::VVec ( const PP< VMatrix > &  m,
int  i 
) [inline]

Definition at line 69 of file VVec.h.

        :data(m), row_index(i), col_index(0), length_(m->width()) {}
PLearn::VVec::VVec ( const PP< VMatrix > &  m,
int  i,
int  j,
int  l 
) [inline]

Definition at line 72 of file VVec.h.

        :data(m), row_index(i), col_index(j), length_(l) {}
PLearn::VVec::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.

So data will be shared with v.

Definition at line 49 of file VVec.cc.

    :data(new MemoryVMatrix(rowmatrix(v))),
     row_index(0), col_index(0), length_(v.length())
{}

Member Function Documentation

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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_().

Here is the call graph for this function:

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().

{
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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);
  }
Parameters:
olList 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.

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 131 of file VVec.h.

:
    void build_();
VVec * PLearn::VVec::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Reimplemented from PLearn::Object.

Definition at line 47 of file VVec.cc.

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

Here is the caller graph for this function:

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, ...).

Parameters:
outStream 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);
        }
    }

Here is the call graph for this function:

PLearn::VVec::operator Vec ( ) const [inline]

conversion to Vec

Definition at line 109 of file VVec.h.

References col_index, data, length_, and row_index.

    {
        Vec v(length_);
        data->getSubRow(row_index,col_index,v);
        return v;
    }
int PLearn::VVec::size ( ) const [inline]

Definition at line 81 of file VVec.h.

References length_.

{ return length_; }
VVec PLearn::VVec::subVec ( int  j,
int  len 
) [inline]

Definition at line 105 of file VVec.h.

References col_index, data, row_index, and VVec().

    { return VVec(data, row_index, col_index+j, len); }

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from PLearn::Object.

Definition at line 131 of file VVec.h.

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().


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