@@ -19,15 +19,55 @@ void declare_cluster_builder(py::module &m, const std::string &className) {
19
19
py::class_<Class> py_class (m, className.c_str ());
20
20
21
21
py_class.def (py::init<>());
22
- py_class.def (" create_cluster_tree" , [](Class &self, py::array_t <CoordinatePrecision, py::array::f_style | py::array::forcecast> coordinates, int number_of_children, int size_of_partition) {
23
- return self.create_cluster_tree (coordinates.shape ()[1 ], coordinates.shape ()[0 ], coordinates.data (), number_of_children, size_of_partition);
24
- });
25
- py_class.def (" create_cluster_tree" , [](Class &self, py::array_t <CoordinatePrecision, py::array::f_style | py::array::forcecast> coordinates, int number_of_children, int size_of_partition, py::array_t <int , py::array::f_style | py::array::forcecast> partition) {
26
- if (partition.ndim () != 2 && partition.shape ()[0 ] != 2 ) {
27
- throw std::runtime_error (" Wrong format for partition" ); // LCOV_EXCL_LINE
28
- }
29
- return self.create_cluster_tree (coordinates.shape ()[1 ], coordinates.shape ()[0 ], coordinates.data (), number_of_children, size_of_partition, partition.data ());
30
- });
22
+ py_class.def (
23
+ " create_cluster_tree" , [](Class &self, py::array_t <CoordinatePrecision, py::array::f_style | py::array::forcecast> coordinates, int number_of_children, int size_of_partition, py::array_t <int , py::array::f_style | py::array::forcecast> partition, py::array_t <CoordinatePrecision, py::array::f_style | py::array::forcecast> radii, py::array_t <CoordinatePrecision, py::array::f_style | py::array::forcecast> weigths) {
24
+ if (partition.ndim () != 2 && partition.shape ()[0 ] != 2 ) {
25
+ throw std::runtime_error (" Wrong format for partition" ); // LCOV_EXCL_LINE
26
+ }
27
+ return self.create_cluster_tree (coordinates.shape ()[1 ], coordinates.shape ()[0 ], coordinates.data (), radii.data (), weigths.data (), number_of_children, size_of_partition, partition.data ());
28
+ },
29
+ py::arg (" coordinates" ),
30
+ py::arg (" number_of_children" ),
31
+ py::arg (" size_of_partition" ),
32
+ py::kw_only (),
33
+ py::arg (" partition" ), // make them optional with C++17 and None
34
+ py::arg (" radii" ), // make them optional with C++17 and None
35
+ py::arg (" weights" ) // make them optional with C++17 and None
36
+ );
37
+ py_class.def (
38
+ " create_cluster_tree" , [](Class &self, py::array_t <CoordinatePrecision, py::array::f_style | py::array::forcecast> coordinates, int number_of_children, int size_of_partition, py::array_t <int , py::array::f_style | py::array::forcecast> partition, py::array_t <CoordinatePrecision, py::array::f_style | py::array::forcecast> radii) {
39
+ if (partition.ndim () != 2 && partition.shape ()[0 ] != 2 ) {
40
+ throw std::runtime_error (" Wrong format for partition" ); // LCOV_EXCL_LINE
41
+ }
42
+ return self.create_cluster_tree (coordinates.shape ()[1 ], coordinates.shape ()[0 ], coordinates.data (), radii.data (), nullptr , number_of_children, size_of_partition, partition.data ());
43
+ },
44
+ py::arg (" coordinates" ),
45
+ py::arg (" number_of_children" ),
46
+ py::arg (" size_of_partition" ),
47
+ py::kw_only (),
48
+ py::arg (" partition" ), // make them optional with C++17 and None
49
+ py::arg (" radii" ) // make them optional with C++17 and None
50
+ );
51
+ py_class.def (
52
+ " create_cluster_tree" , [](Class &self, py::array_t <CoordinatePrecision, py::array::f_style | py::array::forcecast> coordinates, int number_of_children, int size_of_partition, py::array_t <int , py::array::f_style | py::array::forcecast> partition) {
53
+ if (partition.ndim () != 2 && partition.shape ()[0 ] != 2 ) {
54
+ throw std::runtime_error (" Wrong format for partition" ); // LCOV_EXCL_LINE
55
+ }
56
+ return self.create_cluster_tree (coordinates.shape ()[1 ], coordinates.shape ()[0 ], coordinates.data (), number_of_children, size_of_partition, partition.data ());
57
+ },
58
+ py::arg (" coordinates" ),
59
+ py::arg (" number_of_children" ),
60
+ py::arg (" size_of_partition" ),
61
+ py::kw_only (),
62
+ py::arg (" partition" ));
63
+
64
+ py_class.def (
65
+ " create_cluster_tree" , [](Class &self, py::array_t <CoordinatePrecision, py::array::f_style | py::array::forcecast> coordinates, int number_of_children, int size_of_partition) {
66
+ return self.create_cluster_tree (coordinates.shape ()[1 ], coordinates.shape ()[0 ], coordinates.data (), number_of_children, size_of_partition);
67
+ },
68
+ py::arg (" coordinates" ),
69
+ py::arg (" number_of_children" ),
70
+ py::arg (" size_of_partition" ));
31
71
py_class.def (" set_minclustersize" , &Class::set_minclustersize);
32
72
py_class.def (" set_direction_computation_strategy" , &Class::set_direction_computation_strategy);
33
73
py_class.def (" set_splitting_strategy" , &Class::set_splitting_strategy);
0 commit comments