29template <
typename DistFunc>
37 for (
auto& w : array) {
44template <
typename DistFunc>
49template <
typename DistFunc>
54template <
typename DistFunc>
59template <
typename DistFunc>
64template <
typename DistFunc>
69template <
typename DistFunc>
74template <
typename DistFunc>
79template <
typename DistFunc>
84template <
typename DistFunc>
89template <
typename DistFunc>
94template <
typename DistFunc>
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);
111template <
typename DistFunc>
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);
129template <
typename DistFunc>
130template <
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));
140template <
typename DistFunc>
141template <
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
std::tuple< std::size_t, std::size_t, double > findBMU(const std::vector< double > &input) const
typename CellGridType::reference_type reference_type
const std::pair< std::size_t, std::size_t > & getSize() const
reference_type operator()(std::size_t x, std::size_t y)
typename CellGridType::iterator iterator
std::size_t getDimensions() const
SOM(std::size_t nd, std::size_t x, std::size_t y, InitFunc::Signature init_func=InitFunc::zero)
std::pair< std::size_t, std::size_t > m_size
std::function< double()> Signature