File: cluster_data.hpp

package info (click to toggle)
python-pyclustering 0.10.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 11,128 kB
  • sloc: cpp: 38,888; python: 24,311; sh: 384; makefile: 105
file content (160 lines) | stat: -rwxr-xr-x 3,348 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*!

@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause

*/

#pragma once


#include <vector>
#include <memory>


namespace pyclustering {

namespace clst {


using noise = std::vector<size_t>;
using noise_ptr = std::shared_ptr<noise>;

using index_sequence = std::vector<std::size_t>;

using cluster = std::vector<std::size_t>;
using cluster_sequence = std::vector<cluster>;
using cluster_sequence_ptr = std::shared_ptr<cluster_sequence>;


/*!

@class    cluster_data cluster_data.hpp pyclustering/cluster/cluster_data.hpp

@brief    Represents result of cluster analysis.

*/
class cluster_data {
protected:
    cluster_sequence      m_clusters = { };     /**< Allocated clusters during clustering process. */

public:
    /*!
    
    @brief    Default constructor that creates empty clustering data.
    
    */
    cluster_data() = default;

    /*!
    
    @brief    Copy constructor that creates clustering data that is the same to specified.
    
    @param[in] p_other: another clustering data.
    
    */
    cluster_data(const cluster_data & p_other) = default;

    /*!
    
    @brief    Move constructor that creates clustering data from another by moving data.
    
    @param[in] p_other: another clustering data.
    
    */
    cluster_data(cluster_data && p_other) = default;

    /*!
    
    @brief    Default destructor that destroy clustering data.
    
    */
    virtual ~cluster_data() = default;

public:
    /*!
    
    @brief    Returns reference to clusters.
    
    */
    cluster_sequence & clusters();

    /*!
    
    @brief    Returns constant reference to clusters.
    
    */
    const cluster_sequence & clusters() const;

    /*!
    
    @brief    Returns amount of clusters.
    
    */
    std::size_t size() const;

public:
    /*!
    
    @brief    Provides access to specified cluster.
    
    @param[in] p_index: index of specified cluster.
    
    */
    cluster & operator[](const size_t p_index);

    /*!
    
    @brief    Provides access to specified cluster.
    
    @param[in] p_index: index of specified cluster.
    
    */
    const cluster & operator[](const size_t p_index) const;

    /*!
    
    @brief    Set clustering data by copy it from another object.
    
    @param[in] p_other: another clustering data.
    
    */
    cluster_data & operator=(const cluster_data & p_other);

    /*!
    
    @brief    Set clustering data by move it from another object.
    
    @param[in] p_other: another clustering data.
    
    */
    cluster_data & operator=(cluster_data && p_other);

    /*!
    
    @brief    Compares clustering data.
    
    @param[in] p_other: another clustering data that is used for comparison.
    
    @return  Returns true if both objects have the same amount of clusters with the same elements.
    
    */
    bool operator==(const cluster_data & p_other) const;

    /*!
    
    @brief    Compares clustering data.
    
    @param[in] p_other: another clustering data that is used for comparison.
    
    @return  Returns true if both objects have are not the same.
    
    */
    bool operator!=(const cluster_data & p_other) const;
};


}

}