46 main(
int argc, 
char **argv) {
 
   47   map<int, double> features1;
 
   52   map<int, double> features2;
 
   58   cout << 
"Feature vector 1:" << feature_vector1 << endl
 
   59        << 
"Feature vector 2:" << feature_vector2 << endl
 
   60        << 
"Dot product: " << feature_vector1.
Dot(feature_vector2) << endl;
 
   62   cout << 
"Weight in feature vector 1 for feature 2: " 
   64   cout << 
"Weight in feature vector 2 for feature 2: " 
   67   cout << 
"Feature vector 1 size: " << feature_vector1.
size() << endl
 
   68        << 
"Setting feature 0 to 0..." << endl;
 
   70   cout << 
"New feature vector 1 size: " << feature_vector1.
size() << endl;
 
   72   cout << 
"Printing out feature vector 1 using its iterators:" << endl;
 
   74        it != feature_vector1.
end();
 
   76     cout << 
"\t" << it->first << 
"=" << it->second << 
"\n";
 
   78   cout << 
"Done." << endl;
 
   80   cout << 
"Printing out feature vector 2 using its iterators:" << endl;
 
   82        it != feature_vector2.
end();
 
   84     cout << 
"\t" << it->first << 
"=" << it->second << 
"\n";
 
   86   cout << 
"Done." << endl;
 
   88   cout << 
"Scaling feature vector 2 by 2.0:" << endl;
 
   89   feature_vector2.
Scale(2.0);
 
   90   cout << 
"\t" << feature_vector2 << endl;
 
   92   cout << 
"Adding feature vector 2 scaled by 2.0 to feature vector 1:" << endl;
 
   94   cout << 
"\t" << feature_vector1 << endl;
 
   96   cout << 
"Have a nice day!" << endl;
 
FeatureVector< K, V > & AddScaledVector(const FeatureVector< K, V > &other, V scalar)
Modifies this vector so that it equals this vector plus the scaled specified vector. 
 
size_t size() const 
Returns the number of non-zero feature components of this feature vector. 
 
V GetWeight(const K &uid) const 
Returns the weight of the feature with the specified uid, where crucially features not "present" in t...
 
FeatureVector< K, V > & Scale(V scalar)
Multiplies this vector, in situ, by the specified scalar. 
 
const_iterator end() const 
Returns a const iterator pointing to the end of the feature-value pairs of this feature vector...
 
const_iterator begin() const 
Returns a const iterator pointing to the first of the feature-value pairs of this feature vector...
 
V SetWeight(const K &uid, V new_weight)
Sets the weight of the specified feature to the specified value. 
 
Defines the reranker::FeatureVector class, which, as it happens, is used to store feature vectors...
 
V Dot(const FeatureVector< K, V > &other) const 
Computes the dot product of this feature vector with the specified FeatureVector. ...
 
int main(int argc, char **argv)
 
A class to represent a feature vector, where features are represented by unique identifiers, and feature values are represented by the template type.