Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
SOM.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012-2022 Euclid Science Ground Segment
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 3.0 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
25#ifndef _SOM_SOM_H
26#define _SOM_SOM_H
27
30#include "SOM/Distance.h"
31#include "SOM/InitFunc.h"
32#include <array>
33#include <limits>
34#include <tuple>
35#include <type_traits>
36#include <vector>
37
38namespace Euclid {
39namespace SOM {
40
46template <typename DistFunc = Distance::L2>
47class SOM {
48
50 "DistFunc must be a subclass of the Distance::Interface");
51
52public:
58
60
61 SOM(SOM<DistFunc>&&) = default;
63
67 virtual ~SOM() = default;
68
70
72
74
76
78
80
82
84
86
88
90
92 const std::vector<double>& uncertainties) const;
93
94 template <typename InputType, typename WeightFunc>
95 std::tuple<std::size_t, std::size_t, double> findBMU(const InputType& input, WeightFunc weight_func) const;
96
97 template <typename InputType, typename WeightFunc, typename UncertaintyFunc>
98 std::tuple<std::size_t, std::size_t, double> findBMU(const InputType& input, WeightFunc weight_func,
99 UncertaintyFunc uncertainty_func) const;
100
101private:
105
106}; /* End of SOM class */
107
108} /* namespace SOM */
109} /* namespace Euclid */
110
111#include "SOM/_impl/SOM.icpp"
112
113#endif
iter< cell_type const, pointer_type const, reference_type const > const_iterator
decltype(ref_test< GridCellManagerTraits< GridCellManager > >(nullptr)) reference_type
Reference type.
typename CellGridType::const_iterator const_iterator
Definition SOM.h:56
const reference_type operator()(std::size_t x, std::size_t y) const
std::tuple< std::size_t, std::size_t, double > findBMU(const std::vector< double > &input) const
typename CellGridType::reference_type reference_type
Definition SOM.h:57
virtual ~SOM()=default
Destructor.
const std::pair< std::size_t, std::size_t > & getSize() const
std::tuple< std::size_t, std::size_t, double > findBMU(const std::vector< double > &input, const std::vector< double > &uncertainties) const
const_iterator cend()
const_iterator begin() const
CellGridType m_cells
Definition SOM.h:103
reference_type operator()(std::size_t x, std::size_t y)
std::tuple< std::size_t, std::size_t, double > findBMU(const InputType &input, WeightFunc weight_func, UncertaintyFunc uncertainty_func) const
iterator end()
std::tuple< std::size_t, std::size_t, double > findBMU(const InputType &input, WeightFunc weight_func) const
typename CellGridType::iterator iterator
Definition SOM.h:55
const_iterator cbegin()
SOM(SOM< DistFunc > &&)=default
const_iterator end() const
std::size_t getDimensions() const
SOM & operator=(SOM< DistFunc > &&)=default
iterator begin()
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
Definition SOM.h:104
std::size_t m_dimensions
Definition SOM.h:102