Alexandria  2.19
Please provide a description of the project.
SOM.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2021 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 
29 #include "SOM/Distance.h"
30 #include "SOM/InitFunc.h"
31 #include <array>
32 #include <limits>
33 #include <tuple>
34 #include <type_traits>
35 #include <vector>
36 
37 namespace Euclid {
38 namespace SOM {
39 
45 template <std::size_t ND, typename DistFunc = Distance::L2<ND>>
46 class SOM {
47 
48  static_assert(std::is_base_of<Distance::Interface<ND>, DistFunc>::value,
49  "DistFunc must be a subclass of the Distance::Interface<ND>");
50 
51 public:
53  using iterator = typename CellGridType::iterator;
55 
57 
58  SOM(SOM<ND, DistFunc>&&) = default;
60 
64  virtual ~SOM() = default;
65 
67 
69 
71 
73 
75 
77 
79 
81 
83 
85 
87  const std::array<double, ND>& uncertainties) const;
88 
89  template <typename InputType, typename WeightFunc>
90  std::tuple<std::size_t, std::size_t, double> findBMU(const InputType& input, WeightFunc weight_func) const;
91 
92  template <typename InputType, typename WeightFunc, typename UncertaintyFunc>
93  std::tuple<std::size_t, std::size_t, double> findBMU(const InputType& input, WeightFunc weight_func,
94  UncertaintyFunc uncertainty_func) const;
95 
96 private:
99 
100 }; /* End of SOM class */
101 
102 } /* namespace SOM */
103 } /* namespace Euclid */
104 
105 #include "SOM/_impl/SOM.icpp"
106 
107 #endif
Euclid::SOM::SOM::operator()
const std::array< double, ND > & operator()(std::size_t x, std::size_t y) const
Euclid::SOM::SOM::~SOM
virtual ~SOM()=default
Destructor.
Euclid::SOM::SOM::end
iterator end()
Euclid::GridContainer::GridContainer< std::vector< std::array< double, ND > >, std::size_t, std::size_t >
Euclid::SOM::SOM::findBMU
std::tuple< std::size_t, std::size_t, double > findBMU(const std::array< double, ND > &input) const
Euclid::SOM::SOM::m_size
std::pair< std::size_t, std::size_t > m_size
Definition: SOM.h:98
std::pair< std::size_t, std::size_t >
Euclid::SOM::SOM::cend
const_iterator cend()
Euclid::SOM::SOM::end
const_iterator end() const
std::tuple
std::function
Distance.h
Euclid::SOM::SOM::iterator
typename CellGridType::iterator iterator
Definition: SOM.h:53
Euclid::SOM::SOM::getSize
const std::pair< std::size_t, std::size_t > & getSize() const
Euclid::SOM::SOM::findBMU
std::tuple< std::size_t, std::size_t, double > findBMU(const std::array< double, ND > &input, const std::array< double, ND > &uncertainties) const
Euclid::SOM::SOM::SOM
SOM(SOM< ND, DistFunc > &&)=default
InitFunc.h
Euclid::SOM::SOM::findBMU
std::tuple< std::size_t, std::size_t, double > findBMU(const InputType &input, WeightFunc weight_func, UncertaintyFunc uncertainty_func) const
Euclid::SOM::SOM
Definition: SOM.h:46
GridContainer.h
Euclid::SOM::SOM::findBMU
std::tuple< std::size_t, std::size_t, double > findBMU(const InputType &input, WeightFunc weight_func) const
std::array< double, ND >
Euclid::SOM::SOM::m_cells
CellGridType m_cells
Definition: SOM.h:97
Euclid::SOM::SOM::begin
iterator begin()
Euclid::SOM::InitFunc::zero
Signature zero
Definition: InitFunc.h:38
Euclid::SOM::SOM::SOM
SOM(std::size_t x, std::size_t y, InitFunc::Signature init_func=InitFunc::zero)
Euclid::SOM::SOM::begin
const_iterator begin() const
Euclid::SOM::SOM::const_iterator
typename CellGridType::const_iterator const_iterator
Definition: SOM.h:54
Euclid::GridContainer::GridContainer< std::vector< std::array< double, ND > >, std::size_t, std::size_t >::const_iterator
iter< cell_type const > const_iterator
Definition: GridContainer.h:118
Euclid::GridContainer::GridContainer< std::vector< std::array< double, ND > >, std::size_t, std::size_t >::iterator
iter< cell_type > iterator
Definition: GridContainer.h:115
Euclid::SOM::Distance::Interface
Definition: Distance.h:37
std::size_t
Euclid::SOM::SOM::operator=
SOM & operator=(SOM< ND, DistFunc > &&)=default
Euclid::SOM::SOM::operator()
std::array< double, ND > & operator()(std::size_t x, std::size_t y)
Euclid
Definition: InstOrRefHolder.h:29
SOM.icpp
Euclid::SOM::SOM::cbegin
const_iterator cbegin()
std::is_base_of