PLearn 0.1
|
#include <ByteMemoryVMatrix.h>
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 OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual ByteMemoryVMatrix * | deepCopy (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 PPath & | declaringFile () |
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 |
Definition at line 53 of file ByteMemoryVMatrix.h.
typedef VMatrix PLearn::ByteMemoryVMatrix::inherited [private] |
Reimplemented from PLearn::VMatrix.
Definition at line 55 of file ByteMemoryVMatrix.h.
PLearn::ByteMemoryVMatrix::ByteMemoryVMatrix | ( | ) |
default constructor (for automatic deserialization)
Definition at line 50 of file ByteMemoryVMatrix.cc.
: data(0) { }
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_); }
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_); }
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.
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] |
ByteMemoryVMatrix * PLearn::ByteMemoryVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::VMatrix.
Definition at line 46 of file ByteMemoryVMatrix.cc.
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().
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.
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]); }
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().
Vec PLearn::ByteMemoryVMatrix::offset_ [protected] |
Definition at line 60 of file ByteMemoryVMatrix.h.
Referenced by get(), and getSubRow().
Vec PLearn::ByteMemoryVMatrix::scale [protected] |
sample = (data[i]+offset_[i])*scale[i];
Definition at line 59 of file ByteMemoryVMatrix.h.
Referenced by get(), and getSubRow().