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();
96 template <
typename DistFunc>
100 auto result_iter = som.
begin();
102 for (
auto iter = som.
begin(); iter != som.
end(); ++iter) {
103 double dist = dist_func(*iter);
104 if (dist < closest_distance) {
106 closest_distance = dist;
109 return std::make_tuple(result_iter.template axisValue<0>(), result_iter.template axisValue<1>(), closest_distance);
114 template <
typename DistFunc>
116 assert(input.
size() == m_dimensions);
117 DistFunc dist_func{};
118 return SOM_impl::findBMU_impl<DistFunc>(
120 return dist_func.distance(cell.begin(), cell.end(), input.
begin());
124 template <
typename DistFunc>
127 assert(input.
size() == uncertainties.
size() && input.
size() == m_dimensions);
128 DistFunc dist_func{};
129 return SOM_impl::findBMU_impl<DistFunc>(
131 return dist_func.distance(cell.begin(), cell.end(), input.begin(), uncertainties.
begin());
135 template <
typename DistFunc>
136 template <
typename InputType,
typename WeightFunc>
138 WeightFunc weight_func)
const {
141 "WeightFunc must be callable with input as parameter, returning an std::vector<double>");
143 return findBMU(weight_func(input));
146 template <
typename DistFunc>
147 template <
typename InputType,
typename WeightFunc,
typename Uncerta
intyFunc>
149 UncertaintyFunc uncertainty_func)
const {
152 "WeightFunc must be callable with input as parameter, returning an std::vector<double>");
154 "UncertaintyFunc must be callable with input as parameter, returning an std::vector<double>");
156 return findBMU(weight_func(input), uncertainty_func(input));
typename CellGridType::const_iterator const_iterator
typename CellGridType::iterator iterator
std::tuple< std::size_t, std::size_t, double > findBMU_impl(const SOM< DistFunc > &som, std::function< double(const GridContainer::VectorValueProxy< double > &)> dist_func)
typename CellGridType::reference_type reference_type