29 template <
typename DistFunc>
31 : m_dimensions(dimensions)
32 , m_cells(std::make_tuple(ImplTools::
indexAxis(
"X", x), ImplTools::
indexAxis(
"Y", y)), m_dimensions)
37 for (
auto& w : array) {
44 template <
typename DistFunc>
49 template <
typename DistFunc>
54 template <
typename DistFunc>
59 template <
typename DistFunc>
64 template <
typename DistFunc>
66 return m_cells.
begin();
69 template <
typename DistFunc>
74 template <
typename DistFunc>
76 return m_cells.
begin();
79 template <
typename DistFunc>
84 template <
typename DistFunc>
89 template <
typename DistFunc>
91 return m_cells.
cend();
94 template <
typename DistFunc>
96 assert(input.
size() == m_dimensions);
98 auto result_iter = begin();
101 for (
auto iter = begin(); iter != end_; ++iter) {
102 double dist = dist_func.distance(iter->cbegin(), iter->cend(), input.
cbegin());
103 if (dist < closest_distance) {
105 closest_distance = dist;
108 return std::make_tuple(result_iter.template axisValue<0>(), result_iter.template axisValue<1>(), closest_distance);
111 template <
typename DistFunc>
114 assert(input.
size() == m_dimensions);
115 DistFunc dist_func{};
116 auto result_iter = begin();
118 const auto end_ = end();
119 for (
auto iter = begin(); iter != end_; ++iter) {
120 double dist = dist_func.distance(iter->cbegin(), iter->cend(), input.
cbegin(), uncertainties.
cbegin());
121 if (dist < closest_distance) {
123 closest_distance = dist;
126 return std::make_tuple(result_iter.template axisValue<0>(), result_iter.template axisValue<1>(), closest_distance);
129 template <
typename DistFunc>
130 template <
typename InputType,
typename WeightFunc>
132 WeightFunc weight_func)
const {
135 "WeightFunc must be callable with input as parameter, returning an std::vector<double>");
137 return findBMU(weight_func(input));
140 template <
typename DistFunc>
141 template <
typename InputType,
typename WeightFunc,
typename Uncerta
intyFunc>
143 UncertaintyFunc uncertainty_func)
const {
146 "WeightFunc must be callable with input as parameter, returning an std::vector<double>");
148 "UncertaintyFunc must be callable with input as parameter, returning an std::vector<double>");
150 return findBMU(weight_func(input), uncertainty_func(input));
typename CellGridType::const_iterator const_iterator
typename CellGridType::iterator iterator
typename CellGridType::reference_type reference_type