29 template <std::
size_t ND,
typename DistFunc>
35 for (
auto& w : array) {
42 template <std::
size_t ND,
typename DistFunc>
47 template <std::
size_t ND,
typename DistFunc>
52 template <std::
size_t ND,
typename DistFunc>
57 template <std::
size_t ND,
typename DistFunc>
59 return m_cells.
begin();
62 template <std::
size_t ND,
typename DistFunc>
67 template <std::
size_t ND,
typename DistFunc>
69 return m_cells.
begin();
72 template <std::
size_t ND,
typename DistFunc>
77 template <std::
size_t ND,
typename DistFunc>
82 template <std::
size_t ND,
typename DistFunc>
84 return m_cells.
cend();
89 template <std::
size_t ND,
typename DistFunc>
92 auto result_iter = som.
begin();
94 for (
auto iter = som.
begin(); iter != som.
end(); ++iter) {
95 double dist = dist_func(*iter);
96 if (dist < closest_distance) {
98 closest_distance = dist;
101 return std::make_tuple(result_iter.template axisValue<0>(), result_iter.template axisValue<1>(), closest_distance);
106 template <std::
size_t ND,
typename DistFunc>
108 DistFunc dist_func{};
109 return SOM_impl::findBMU_impl<ND, DistFunc>(
110 *
this, [&dist_func, &input](
const std::array<double, ND>& cell) ->
double {
return dist_func.distance(cell, input); });
113 template <std::
size_t ND,
typename DistFunc>
116 DistFunc dist_func{};
117 return SOM_impl::findBMU_impl<ND, DistFunc>(*
this,
119 return dist_func.distance(cell, input, uncertainties);
123 template <std::
size_t ND,
typename DistFunc>
124 template <
typename InputType,
typename WeightFunc>
128 "WeightFunc must be callable with input as parameter, returning an std::array<double, ND>");
130 return findBMU(weight_func(input));
133 template <std::
size_t ND,
typename DistFunc>
134 template <
typename InputType,
typename WeightFunc,
typename Uncerta
intyFunc>
136 UncertaintyFunc uncertainty_func)
const {
139 "WeightFunc must be callable with input as parameter, returning an std::array<double, ND>");
141 "UncertaintyFunc must be callable with input as parameter, returning an std::array<double, ND>");
143 return findBMU(weight_func(input), uncertainty_func(input));
typename CellGridType::iterator iterator
typename CellGridType::const_iterator const_iterator
std::tuple< std::size_t, std::size_t, double > findBMU_impl(const SOM< ND, DistFunc > &som, std::function< double(const std::array< double, ND > &)> dist_func)