DP3
ProximityClustering.h
Go to the documentation of this file.
1 // ProximityClustering.h: clustering to achieve speedup
2 //
3 // Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy)
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 
6 #ifndef PROXIMITY_CLUSTERING_H
7 #define PROXIMITY_CLUSTERING_H
8 
9 #include <vector>
10 #include <utility>
11 
12 namespace dp3 {
13 namespace common {
14 
20  public:
21  using NumType = double; // can be changed to float if desired
22  using Coordinate = std::pair<NumType, NumType>;
23 
24  ProximityClustering(const std::vector<Coordinate> &coordinates);
25  std::vector<std::vector<std::size_t>> Group(NumType max_distance);
26 
27  private:
28  Coordinate GetCoordinate(std::size_t i) const;
29  NumType ClusterDistance(std::size_t i, std::size_t j) const;
30  void GroupSource(std::size_t source_index, NumType max_distance);
31  Coordinate Centroid(std::size_t i) const;
32 
33  std::vector<std::vector<std::size_t>> clusters_;
34  const std::vector<Coordinate> &coordinates_;
35 };
36 
37 } // namespace common
38 } // namespace dp3
39 
40 #endif
Definition: ProximityClustering.h:19
std::vector< std::vector< std::size_t > > Group(NumType max_distance)
std::pair< NumType, NumType > Coordinate
Definition: ProximityClustering.h:22
double NumType
Definition: ProximityClustering.h:21
ProximityClustering(const std::vector< Coordinate > &coordinates)
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53