Completed
Push — master ( e79f33...799814 )
by Andrei
01:59
created

cure_get_means()   A

Complexity

Conditions 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
1
"""!
2
3
@brief CCORE Wrapper for DBSCAN algorithm.
4
5
@authors Andrei Novikov ([email protected])
6
@date 2014-2016
7
@copyright GNU Public License
8
9
@cond GNU_PUBLIC_LICENSE
10
    PyClustering is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
12
    the Free Software Foundation, either version 3 of the License, or
13
    (at your option) any later version.
14
    
15
    PyClustering is distributed in the hope that it will be useful,
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
19
    
20
    You should have received a copy of the GNU General Public License
21
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
@endcond
23
24
"""
25
26
from ctypes import cdll, c_double, c_size_t;
27
28
from pyclustering.core.wrapper import PATH_DLL_CCORE_64, create_pointer_data, extract_pyclustering_package;
29
30
31
def cure_algorithm(sample, number_clusters, number_represent_points, compression):
32
    pointer_data = create_pointer_data(sample);
33
    
34
    ccore = cdll.LoadLibrary(PATH_DLL_CCORE_64);
35
    cure_data_pointer = ccore.cure_algorithm(pointer_data, c_size_t(number_clusters), c_size_t(number_represent_points), c_double(compression));
36
    
37
    return cure_data_pointer;
38
39
40
def cure_data_destroy(cure_data_pointer):
41
    ccore = cdll.LoadLibrary(PATH_DLL_CCORE_64);
42
    ccore.cure_data_destroy(cure_data_pointer);
43
44
45
def cure_get_clusters(cure_data_pointer):
46
    ccore = cdll.LoadLibrary(PATH_DLL_CCORE_64);
47
    package = ccore.cure_get_clusters(cure_data_pointer);
48
    
49
    result = extract_pyclustering_package(package);
50
    ccore.free_pyclustering_package(package);
51
    
52
    return result;
53
54
55
def cure_get_representors(cure_data_pointer):
56
    ccore = cdll.LoadLibrary(PATH_DLL_CCORE_64);
57
    package = ccore.cure_get_representors(cure_data_pointer);
58
    
59
    result = extract_pyclustering_package(package);
60
    ccore.free_pyclustering_package(package);
61
    
62
    return result;
63
64
65
def cure_get_means(cure_data_pointer):
66
    ccore = cdll.LoadLibrary(PATH_DLL_CCORE_64);
67
    package = ccore.cure_get_means(cure_data_pointer);
68
    
69
    result = extract_pyclustering_package(package);
70
    ccore.free_pyclustering_package(package);
71
    
72
    return result;