reduction to 2x2 clusters for general clusters

This commit is contained in:
2025-08-18 18:23:15 +02:00
parent 9a3694b980
commit cb163c79b4
5 changed files with 205 additions and 106 deletions

View File

@@ -104,14 +104,23 @@ void define_ClusterVector(py::module &m, const std::string &typestr) {
});
}
template <typename Type, uint8_t ClusterSizeX, uint8_t ClusterSizeY,
typename CoordType = uint16_t>
void define_reduction(py::module &m) {
m.def("reduce_3x3_to_2x2", [](const ClusterVector<Cluster<int, 3, 3, uint16_t>> &cv) {
return new ClusterVector<Cluster<int, 2, 2, uint16_t>>(reduce_3x3_to_2x2(cv));
// return new ClusterVector<Cluster<int, 3, 3>>();
})
.def("reduce_5x5_to_3x3", [](const ClusterVector<Cluster<int, 5, 5, uint16_t>> &cv) {
return new ClusterVector<Cluster<int, 3, 3, uint16_t>>(reduce_5x5_to_3x3(cv));
});
m.def("reduce_to_2x2",
[](const ClusterVector<
Cluster<Type, ClusterSizeX, ClusterSizeY, CoordType>> &cv) {
return new ClusterVector<Cluster<Type, 2, 2, CoordType>>(
reduce_to_2x2(cv));
});
}
void define_3x3_reduction(py::module &m) {
m.def("reduce_5x5_to_3x3",
[](const ClusterVector<Cluster<int, 5, 5, uint16_t>> &cv) {
return new ClusterVector<Cluster<int, 3, 3, uint16_t>>(
reduce_5x5_to_3x3(cv));
});
}
#pragma GCC diagnostic pop