Random commentary about C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
Saturday, March 13, 2010
A compressed vector space
Sometime is useful to represent a vector in a compressed form. This is particularly useful when you want to represent a vector of features in machine learning. The simplest data structure is an un-ordered vector of pairs (id, value), ... (id, value). The vector can be sorted on-the-fly for particular operations such as the intersection of two vectors. Here you have the code.