LILAC
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hasher.h
Go to the documentation of this file.
1 #ifndef HASHER_H
2 #define HASHER_H
3 #include "../eigen3/Eigen/Eigen"
4 #include <vector>
5 #include <list>
6 #include <map>
7 //cause we really won't have namespace clashing here
8 using namespace Eigen;
9 using namespace std;
10 //more effecient to use others, but this works as well
11 
12 typedef Matrix<float, Dynamic, Dynamic, ColMajor> cmf;
13 typedef Matrix<float, Dynamic, Dynamic, RowMajor> rmf;
14 typedef Matrix<float, Dynamic, Dynamic> mf;
15 class hasher{
17  //outside vector is for each gamma val, middle is for each hash, and inner holds the bins
18  vector<vector<vector<size_t> > > tor_hashes;
22  float mnorm;
23  inline size_t get_bin(float hval, size_t n_bins);
24  void add_scores(const cmf& inscores);
25  vector<float> d_test;
26  public:
27  vector<float> get_cur_scores();
28  void add_vecs(const rmf& invecs);
29  void hash(const rmf& invecs, cmf& hashes);
30  hasher(size_t num_hash, size_t num_rand, vector<float> dims, size_t d_vals, float min_interest);
31  ~hasher();
32 };
33 #endif