40 const int K = allocations_ref.maxCoeff() + 1;
41 recompute(K > 0 ? K : 0, allocations_ref);
51 void set_allocation(
int index,
int cluster,
int old_cluster)
override;
72 void recompute(
const int K,
const Eigen::VectorXi &allocations_in)
override;
Abstract base class for managing cluster information and caches.
const Eigen::VectorXi binary_covariates
Definition binary_cache.hpp:35
void recompute(const int K, const Eigen::VectorXi &allocations_in) override
Recomputes all cluster information from current allocations.
Definition binary_cache.cpp:8
const ClusterStats & get_cluster_stats_ref(int cluster) const
Get cluster statistics reference for a specific cluster.
Definition binary_cache.hpp:65
void remove_info(int cluster) override
Removes information related to a specific cluster.
Definition binary_cache.hpp:87
ClusterStats get_cluster_stats(int cluster) const
Get cluster statistics for a specific cluster.
Definition binary_cache.hpp:58
void move_cluster_info(int from_cluster, int to_cluster) override
Moves cluster information from one cluster to another.
Definition binary_cache.hpp:79
BinaryCache(const Eigen::VectorXi &allocations_ref, const Eigen::VectorXi &binary_covariates)
Definition binary_cache.hpp:37
std::vector< ClusterStats > cluster_stats
Definition binary_cache.hpp:32
void set_allocation(int index, int cluster, int old_cluster) override
Assigns a point to a cluster.
Definition binary_cache.cpp:27
Structure to hold statistics for each cluster.
Definition binary_cache.hpp:26
int binary_sum
Definition binary_cache.hpp:27
int n
Definition binary_cache.hpp:28