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

#include <ByteMemoryVMatrix.h>

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

List of all members.

Public Member Functions

 ByteMemoryVMatrix ()
 default constructor (for automatic deserialization)
 ByteMemoryVMatrix (unsigned char *data, int the_length, int the_width, double scaling_factor=1.0, double offset_=0.0)
 ByteMemoryVMatrix (unsigned char *data, int the_length, int the_width, Vec scale)
 ByteMemoryVMatrix (unsigned char *data, int the_length, int the_width, Vec scale, Vec offset_)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual ByteMemoryVMatrixdeepCopy (CopiesMap &copies) const
virtual real get (int i, int j) const
 This method must be implemented in all subclasses.
virtual void getSubRow (int i, int j, Vec v) const
 It is suggested that this method be implemented in subclasses to speed up accesses (default version repeatedly calls get(i,j) which may have a significant overhead).

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 Public Attributes

static StaticInitializer _static_initializer_

Protected Attributes

unsigned char * data
Vec scale
 sample = (data[i]+offset_[i])*scale[i];
Vec offset_

Private Types

typedef VMatrix inherited

Detailed Description

Definition at line 53 of file ByteMemoryVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 55 of file ByteMemoryVMatrix.h.


Constructor & Destructor Documentation

PLearn::ByteMemoryVMatrix::ByteMemoryVMatrix ( )

default constructor (for automatic deserialization)

ByteMemoryVMatrix.

Definition at line 50 of file ByteMemoryVMatrix.cc.

    : data(0)
{
}
PLearn::ByteMemoryVMatrix::ByteMemoryVMatrix ( unsigned char *  data,
int  the_length,
int  the_width,
double  scaling_factor = 1.0,
double  offset_ = 0.0 
)

Definition at line 74 of file ByteMemoryVMatrix.cc.

    : VMatrix(the_length, the_width), data(the_data),
      scale(the_width, the_scaling_factor), offset_(the_width, the_offset)
{
}
PLearn::ByteMemoryVMatrix::ByteMemoryVMatrix ( unsigned char *  data,
int  the_length,
int  the_width,
Vec  scale 
)

Definition at line 55 of file ByteMemoryVMatrix.cc.

References PLearn::TVec< T >::length(), PLERROR, and PLearn::VMatrix::width_.

    :inherited(the_length, the_width), data(the_data), scale(the_scale), offset_(the_scale.length())
{
    if (the_scale.length() != width_)
        PLERROR("ByteMemoryVMatrix: inconsistent arguments (scale(%d),n_col(%d))",
                the_scale.length(), width_);
}

Here is the call graph for this function:

PLearn::ByteMemoryVMatrix::ByteMemoryVMatrix ( unsigned char *  data,
int  the_length,
int  the_width,
Vec  scale,
Vec  offset_ 
)

Definition at line 64 of file ByteMemoryVMatrix.cc.

References PLearn::TVec< T >::length(), PLERROR, and PLearn::VMatrix::width_.

    :VMatrix(the_length, the_width), data(the_data),
     scale(the_scale), offset_(the_offset)
{
    if (the_scale.length() != width_ || the_offset.length()!=width_)
        PLERROR("ByteMemoryVMatrix: inconsistent arguments (scale(%d),offset(%d),n_col(%d))",
                the_scale.length(), the_offset.length(), width_);
}

Here is the call graph for this function:


Member Function Documentation

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

Reimplemented from PLearn::VMatrix.

Definition at line 46 of file ByteMemoryVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 46 of file ByteMemoryVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 46 of file ByteMemoryVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 46 of file ByteMemoryVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 46 of file ByteMemoryVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 46 of file ByteMemoryVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 46 of file ByteMemoryVMatrix.cc.

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

Reimplemented from PLearn::VMatrix.

Definition at line 72 of file ByteMemoryVMatrix.h.

:
};
ByteMemoryVMatrix * PLearn::ByteMemoryVMatrix::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::VMatrix.

Definition at line 46 of file ByteMemoryVMatrix.cc.

real PLearn::ByteMemoryVMatrix::get ( int  i,
int  j 
) const [virtual]

This method must be implemented in all subclasses.

Returns element (i,j).

Implements PLearn::VMatrix.

Definition at line 81 of file ByteMemoryVMatrix.cc.

References data, j, offset_, scale, and PLearn::VMatrix::width().

{
    return ( data[i*width()+j] + offset_[j] ) * scale[j];
}

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 46 of file ByteMemoryVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 46 of file ByteMemoryVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 46 of file ByteMemoryVMatrix.cc.

void PLearn::ByteMemoryVMatrix::getSubRow ( int  i,
int  j,
Vec  v 
) const [virtual]

It is suggested that this method be implemented in subclasses to speed up accesses (default version repeatedly calls get(i,j) which may have a significant overhead).

Fills v with the subrow i lying between columns j (inclusive) and j+v.length() (exclusive).

Reimplemented from PLearn::VMatrix.

Definition at line 86 of file ByteMemoryVMatrix.cc.

References data, PLearn::TVec< T >::data(), PLearn::TVec< T >::length(), offset_, scale, and PLearn::VMatrix::width_.

{
    unsigned char* p = &data[i*width_];
    real *v = samplevec.data();
    real *s = scale.data();
    real *o = offset_.data();
    for (int jj=0; jj<samplevec.length(); jj++)
        v[jj] = s[j+jj] * (p[j+jj] + o[j+jj]);
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::VMatrix.

Definition at line 72 of file ByteMemoryVMatrix.h.

unsigned char* PLearn::ByteMemoryVMatrix::data [protected]

Definition at line 58 of file ByteMemoryVMatrix.h.

Referenced by get(), and getSubRow().

Definition at line 60 of file ByteMemoryVMatrix.h.

Referenced by get(), and getSubRow().

sample = (data[i]+offset_[i])*scale[i];

Definition at line 59 of file ByteMemoryVMatrix.h.

Referenced by get(), and getSubRow().


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