Completed
Push — master ( 0ab444...af3192 )
by Andrei
01:25
created

bsas()   A

Complexity

Conditions 1

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
1
"""!
2
3
@brief CCORE Wrapper for BSAS algorithm.
4
5
@authors Andrei Novikov ([email protected])
6
@date 2014-2018
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
27
from ctypes import c_double, c_size_t, POINTER;
28
29
from pyclustering.core.wrapper import ccore_library;
30
from pyclustering.core.pyclustering_package import pyclustering_package, package_extractor, package_builder;
31
32
33 View Code Duplication
def bsas(sample, amount, threshold, metric_pointer):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
34
    pointer_data = package_builder(sample, c_double).create();
35
36
    ccore = ccore_library.get();
37
38
    ccore.bsas_algorithm.restype = POINTER(pyclustering_package);
39
    package = ccore.bsas_algorithm(pointer_data, c_size_t(amount), c_double(threshold), metric_pointer);
40
41
    result = package_extractor(package).extract();
42
    ccore.free_pyclustering_package(package);
43
44
    return result[0], result[1];