42 const Eigen::MatrixXi
W;
61 const Eigen::VectorXi *old_alloc_provider =
nullptr,
62 const std::unordered_map<
int, std::vector<int>> *old_cluster_members_provider_ =
nullptr)
64 Module(old_alloc_provider, old_cluster_members_provider_) {
Data structure for managing point distances and cluster allocations.
Base class for modules used in processes.
Manages distance matrices and cluster allocations for points.
Definition Data.hpp:27
Module(const Eigen::VectorXi *old_allocations_provider_=nullptr, const std::unordered_map< int, std::vector< int > > *old_cluster_members_provider_=nullptr)
Definition Module.hpp:31
SpatialModule(const Data &data_, const Eigen::MatrixXi W_, double spatial_coeff, const Eigen::VectorXi *old_alloc_provider=nullptr, const std::unordered_map< int, std::vector< int > > *old_cluster_members_provider_=nullptr)
Constructs a SpatialModule with parameter and data references.
Definition spatial_module.hpp:60
const Eigen::MatrixXi W
Reference to adjacency matrix W from covariates.
Definition spatial_module.hpp:42
std::vector< std::vector< int > > neighbor_cache
Cache storing neighbor indices for each observation.
Definition spatial_module.hpp:30
void neighbor_cache_compute()
Precomputes and stores neighbor indices for all observations.
Definition spatial_module.cpp:23
Eigen::VectorXd compute_similarity_obs(int obs_idx) const override
Counts neighbors of an observation grouped by cluster membership.
Definition spatial_module.cpp:64
double compute_similarity_cls(int cls_idx, bool old_allo=false) const override
Counts internal edges within a cluster.
Definition spatial_module.cpp:40
const Data & data_module
Reference to data object with cluster assignments.
Definition spatial_module.hpp:41
const double spatial_weight
Weighting factor for spatial similarity.
Definition spatial_module.hpp:43