Docs
Loading...
Searching...
No Matches
Datax.hpp
Go to the documentation of this file.
1
13
14#pragma once
15
16#include "Data.hpp"
17#include "ClusterInfo.hpp"
18#include <memory>
19
28class Datax : public Data {
29
30protected:
31 std::vector<std::shared_ptr<ClusterInfo>> cluster_info;
32
33 void compact_cluster(int old_cluster);
34
35public:
36 Datax(const Params &p, std::vector<std::shared_ptr<ClusterInfo>> ci,
37 const Eigen::VectorXi &initial_allocations = Eigen::VectorXi())
38 : Data(p, initial_allocations), cluster_info(std::move(ci)) {}
39
46 void set_allocation(int index, int cluster) override;
47
53 void set_allocations(const Eigen::VectorXi &new_allocations) override;
54
62 void restore_state(Eigen::VectorXi &old_allocations, std::unordered_map<int, std::vector<int>> &old_cluster_members,
63 int old_K) override;
64
65 virtual ~Datax() = default;
66};
Abstract base class for managing cluster information and caches.
Data structure for managing point distances and cluster allocations.
Data(const Params &p, const Eigen::VectorXi &initial_allocations=Eigen::VectorXi())
Constructs a Data object with a distance matrix.
Definition Data.cpp:10
void restore_state(Eigen::VectorXi &old_allocations, std::unordered_map< int, std::vector< int > > &old_cluster_members, int old_K) override
Restores allocations, cluster memberships, and cluster count from a saved state.
Definition Datax.cpp:85
void set_allocation(int index, int cluster) override
Assigns a point to a cluster.
Definition Datax.cpp:58
void compact_cluster(int old_cluster)
Definition Datax.cpp:9
void set_allocations(const Eigen::VectorXi &new_allocations) override
Sets all cluster allocations at once.
Definition Datax.cpp:78
Datax(const Params &p, std::vector< std::shared_ptr< ClusterInfo > > ci, const Eigen::VectorXi &initial_allocations=Eigen::VectorXi())
Definition Datax.hpp:36
virtual ~Datax()=default
std::vector< std::shared_ptr< ClusterInfo > > cluster_info
Definition Datax.hpp:31
Structure containing all parameters needed for the NGGP (Normalized Generalized Gamma Process) and DP...
Definition Params.hpp:35