35 #include <boost/program_options.hpp>
40 namespace Clustering {
50 using Box = std::array<int, 2>;
54 constexpr
int BOX_DIFF[9][2] = {{-1, 1}, { 0, 1}, { 1, 1}
55 , {-1, 0}, { 0, 0}, { 1, 0}
56 , {-1,-1}, { 0,-1}, { 1,-1}};
81 std::map<Box, std::vector<int>>
boxes;
91 const std::size_t n_rows,
92 const std::size_t n_cols,
100 std::vector<std::size_t>
102 const std::size_t n_rows,
103 const std::size_t n_cols,
108 std::map<float, std::vector<std::size_t>>
110 const std::size_t n_rows,
111 const std::size_t n_cols,
112 const std::vector<float> radii);
119 std::vector<FreeEnergy>
123 std::tuple<Neighborhood, Neighborhood>
125 const std::size_t n_rows,
126 const std::size_t n_cols,
127 const std::vector<float>& free_energy);
131 std::set<std::size_t>
133 const std::size_t n_cols,
134 const std::vector<FreeEnergy>& sorted_fe,
135 const std::size_t i_frame,
136 const std::size_t limit,
137 const float max_dist);
149 std::vector<std::size_t>
152 const std::vector<float>& free_energy);
169 main(boost::program_options::variables_map args);
std::vector< std::size_t > assign_low_density_frames(const std::vector< std::size_t > &initial_clustering, const Neighborhood &nh_high_dens, const std::vector< float > &free_energy)
double compute_sigma2(const Neighborhood &nh)
const int N_NEIGHBOR_BOXES
number of neigbor boxes in 2D grid (including center box).
bool is_valid_box(const Box box, const BoxGrid &grid)
std::set< std::size_t > high_density_neighborhood(const float *coords, const std::size_t n_cols, const std::vector< FreeEnergy > &sorted_fe, const std::size_t i_frame, const std::size_t limit, const float max_dist)
void main(boost::program_options::variables_map args)
Clustering::Tools::Neighborhood Neighborhood
map frame id to neighbors
std::vector< int > n_boxes
total number of boxes
std::map< Box, std::vector< int > > boxes
the boxes with a list of assigned frame ids
std::tuple< Neighborhood, Neighborhood > nearest_neighbors(const float *coords, const std::size_t n_rows, const std::size_t n_cols, const std::vector< float > &free_energy)
constexpr int BOX_DIFF[9][2]
BoxGrid compute_box_grid(const float *coords, const std::size_t n_rows, const std::size_t n_cols, const float radius)
std::vector< std::size_t > calculate_populations(const float *coords, const std::size_t n_rows, const std::size_t n_cols, const float radius)
calculate population of n-dimensional hypersphere per frame for one fixed radius. ...
constexpr Box neighbor_box(const Box center, const int i_neighbor)
std::vector< float > calculate_free_energies(const std::vector< std::size_t > &pops)
std::vector< FreeEnergy > sorted_free_energies(const std::vector< float > &fe)
std::pair< std::size_t, float > FreeEnergy
matches frame id to free energy
std::array< int, 2 > Box
encodes 2D box for box-assisted search algorithm
Clustering::Tools::Neighbor Neighbor
matches neighbor's frame id to distance
std::vector< Box > assigned_box
matching frame id to the frame's assigned box