32 namespace UMatrix_impl {
40 return std::accumulate(dist_list.begin(), dist_list.end(), 0.) / dist_list.size();
45 template <
typename DistFunc>
50 auto size = som.getSize();
62 for (
int i =
int(x) - 1; i <= (int)x + 1; ++i) {
63 for (
int j =
int(y) - 1; j <= (int)y + 1; ++j) {
66 if (i == (
int)x && j == (int)y) {
70 if (i < 0 || i == (
int)size.first || j < 0 || j == (int)size.second) {
76 dist_list.push_back(dist_func.distance(sxy.begin(), sxy.end(), sij.begin()));
81 result(x, y) = type_func(dist_list);
GridContainer::GridContainer< std::vector< double >, std::size_t, std::size_t > UMatrix
Representation of a multi-dimensional grid which contains axis information.
std::map< UMatrixType, std::function< double(const std::vector< double > &)> > type_func_map
UMatrix computeUMatrix(const SOM< DistFunc > &som, UMatrixType type)