#include <feature.h>
The size of the feature vector is determined at construction and cannot be changed. The elements in the vector and weight are mutable.
Public Member Functions | |
Feature (int dim) | |
Initially sets all elements in the vector to 0 and weight to 1. | |
~Feature () | |
int | GetDim () const |
Returns the size of the vector. | |
float | GetValue (int index) const |
Equivalent to operator[](int index) . | |
float | GetWeight () const |
Returns the current weight. | |
float & | operator[] (int index) |
Returns a reference to the specified index. Does bounds checking. | |
float | operator[] (int index) const |
Returns a reference to the specified index. Does bounds checking. | |
float | SetWeight (float weight) |
Sets a new weight, and returns the old weight. |
Feature | ( | int | dim | ) |
Initially sets all elements in the vector to 0 and weight to 1.
~Feature | ( | ) |
int GetDim | ( | ) | const |
Returns the size of the vector.
float GetValue | ( | int | index | ) | const |
Equivalent to operator[](int index) .
float GetWeight | ( | ) | const |
Returns the current weight.
float & operator[] | ( | int | index | ) |
Returns a reference to the specified index. Does bounds checking.
float operator[] | ( | int | index | ) | const |
Returns a reference to the specified index. Does bounds checking.
float SetWeight | ( | float | weight | ) |
Sets a new weight, and returns the old weight.