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
|
/*!
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
*/
#pragma once
#include <cstddef>
namespace pyclustering {
namespace clst {
/*!
@class optics_descriptor optics_descriptor.hpp pyclustering/cluster/optics_descriptor.hpp
@brief Object description that used by OPTICS algorithm for cluster analysis.
*/
struct optics_descriptor {
public:
static const double NONE_DISTANCE; /**< Denotes if a distance value is not defined. */
public:
std::size_t m_index = -1; /**< Index of the object in the data set. */
double m_core_distance = 0; /**< Core distance that is minimum distance to specified number of neighbors. */
double m_reachability_distance = 0; /**< Reachability distance to this object. */
bool m_processed = false; /**< Defines the object is processed -`true` if is current object has been already processed. */
public:
/**
*
* @brief Default constructor to create optics object descriptor.
*
*/
optics_descriptor() = default;
/**
*
* @brief Default copy constructor to create optics object descriptor.
*
*/
optics_descriptor(const optics_descriptor & p_other) = default;
/**
*
* @brief Default move constructor to create optics object descriptor.
*
*/
optics_descriptor(optics_descriptor && p_other) = default;
/**
*
* @brief Creates optics object descriptor using specified parameters.
* @details Processing is always false after creating for any created optics descriptor.
*
* @param[in] p_index: index of optics object that corresponds to index of real object in dataset.
* @param[in] p_core_distance: core distance of optics-object.
* @param[in] p_reachability_distance: reachability distance of optics-object.
*
*/
optics_descriptor(const std::size_t p_index, const double p_core_distance, const double p_reachability_distance);
/**
*
* @brief Default destructor to destroy optics object descriptor.
*
*/
~optics_descriptor() = default;
public:
/**
*
* @brief Clears core and reachability distances and processing flag (at the same time index is not reseted).
*
*/
void clear();
};
/**
*
* @brief Less comparator for object description that used by OPTICS algorithm for cluster analysis.
*
*/
struct optics_pointer_descriptor_less {
/**
*
* @brief Compare two OPTICS object using following rule: p_object1 < p_object2.
*
* @param[in] p_object1: the left operand to compare.
* @param[in] p_object2: the right operand to compare.
*
* @return `true` if left operand is less than right operand.
*
*/
bool operator()(const optics_descriptor * p_object1, const optics_descriptor * p_object2) const;
};
}
}
|