jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
lsh_util.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2012 Preferred Networks and Nippon Telegraph and Telephone Corporation.
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License version 2.1 as published by the Free Software Foundation.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 #ifndef JUBATUS_CORE_RECOMMENDER_LSH_UTIL_HPP_
18 #define JUBATUS_CORE_RECOMMENDER_LSH_UTIL_HPP_
19 
20 #include <vector>
21 #include <string>
22 #include "jubatus/util/data/unordered_map.h"
23 #include "../common/type.hpp"
24 
25 namespace jubatus {
26 namespace core {
27 namespace storage {
28 template <typename T>
29 class bit_vector_base;
30 typedef bit_vector_base<uint64_t> bit_vector;
31 } // namespace storage
32 namespace recommender {
33 
34 void generate_random_vector(size_t dim, uint32_t seed, std::vector<float>& v);
35 
36 void set_bit_vector(
37  const std::vector<float>& vec,
39 
41  const jubatus::util::data::unordered_map<std::string, std::vector<float> >&
42  matrix,
43  const common::sfv_t& vec,
44  size_t dim,
45  std::vector<float>& ret);
46 
47 } // namespace recommender
48 
49 } // namespace core
50 } // namespace jubatus
51 
52 #endif // JUBATUS_CORE_RECOMMENDER_LSH_UTIL_HPP_
void set_bit_vector(const std::vector< float > &vec, bit_vector &bit_vec)
Definition: lsh_util.cpp:44
bit_vector_base< uint64_t > bit_vector
void prod_invert_and_vector(const unordered_map< string, vector< float > > &matrix, const common::sfv_t &vec, size_t dim, vector< float > &ret)
Definition: lsh_util.cpp:55
std::vector< T > v(size)
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29
void generate_random_vector(size_t dim, uint32_t seed, vector< float > &ret)
Definition: lsh_util.cpp:35