FlashGraph-ng
A new frontier in large-scale graph analysis and data mining
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
kmeans.h
1 #ifndef __FG_KMEANS_H__
2 #define __FG_KMEANS_H__
3 
4 /*
5  * Copyright 2014 Open Connectome Project (http://openconnecto.me)
6  * Written by Disa Mhembere (disa@jhu.edu)
7  *
8  * This file is part of FlashMatrix.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY CURRENT_KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <math.h>
26 #include <omp.h>
27 #include <string.h>
28 #include <sys/time.h>
29 #ifdef PROFILER
30 #include <gperftools/profiler.h>
31 #endif
32 #include <vector>
33 #include <limits>
34 #include <iostream>
35 #include <algorithm>
36 
37 #include "log.h"
38 #include "common.h"
39 
52 namespace fg
53 {
54 unsigned compute_kmeans(const double* matrix, double* clusters,
55  unsigned* cluster_assignments, unsigned* cluster_assignment_counts,
56  const unsigned num_rows, const unsigned nev, const size_t k,
57  const unsigned MAX_ITERS, const int max_threads, const std::string init="kmeanspp",
58  const double tolerance=-1, const std::string dist_type="eucl");
59 }
60 #endif