jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
util.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2013 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_CLUSTERING_UTIL_HPP_
18 #define JUBATUS_CORE_CLUSTERING_UTIL_HPP_
19 
20 #include <utility>
21 #include <vector>
22 #include "types.hpp"
24 
25 namespace jubatus {
26 namespace core {
27 namespace clustering {
28 
29 void concat(const wplist& src, wplist& dst);
30 char digit(int num, int r, int n);
31 
32 double sum(const common::sfv_t& p);
33 double sum2(const common::sfv_t& p);
34 
36  const common::sfv_t& left,
37  float s,
38  common::sfv_t& right);
39 common::sfv_t add(const common::sfv_t& p1, const common::sfv_t& p2);
40 common::sfv_t sub(const common::sfv_t& p1, const common::sfv_t& p2);
41 common::sfv_t scalar_dot(const common::sfv_t& p, double s);
42 
43 double dist(const common::sfv_t& p1, const common::sfv_t& p2);
44 double dist(const weighted_point& p1, const weighted_point& p2);
45 std::pair<size_t, double> min_dist(
46  const common::sfv_t& p,
47  const std::vector<common::sfv_t>& P);
48 std::pair<size_t, double> min_dist(
49  const weighted_point& p,
50  const wplist& P);
51 
52 void dump_wplist(const wplist& src);
53 
54 } // namespace clustering
55 } // namespace core
56 } // namespace jubatus
57 
58 #endif // JUBATUS_CORE_CLUSTERING_UTIL_HPP_
void scalar_mul_and_add(const common::sfv_t &left, float s, common::sfv_t &right)
Definition: util.cpp:62
common::sfv_t scalar_dot(const common::sfv_t &p, double s)
Definition: util.cpp:143
char digit(int num, int r, int n)
Definition: util.cpp:37
double dist(const common::sfv_t &p1, const common::sfv_t &p2)
Definition: util.cpp:151
void concat(const wplist &src, wplist &dst)
Definition: util.cpp:33
pair< size_t, double > min_dist(const common::sfv_t &p, const vector< common::sfv_t > &P)
Definition: util.cpp:182
common::sfv_t sub(const common::sfv_t &p1, const common::sfv_t &p2)
Definition: util.cpp:116
double sum(const common::sfv_t &p)
Definition: util.cpp:47
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29
double sum2(const common::sfv_t &p)
Definition: util.cpp:54
void dump_wplist(const wplist &src)
std::vector< weighted_point > wplist
Definition: types.hpp:55
common::sfv_t add(const common::sfv_t &p1, const common::sfv_t &p2)
Definition: util.cpp:89