aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
argMaxSet.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2026 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2026 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
54
55// =========================================================================
56#ifndef GUM_ARG_MAX_SET_H
57#define GUM_ARG_MAX_SET_H
58// =========================================================================
59#include <cstdlib>
60// =========================================================================
63
64// =========================================================================
65
66namespace gum {
67
77 template < GUM_Numeric GUM_SCALAR_VAL, GUM_Numeric GUM_SCALAR_SEQ >
78 class ArgMaxSet {
79 public:
80 // ###########################################################################
82 // ###########################################################################
84
85 // ============================================================================
87 // ============================================================================
88 ArgMaxSet();
89
90 // ============================================================================
92 // ============================================================================
93 ArgMaxSet(const GUM_SCALAR_VAL& val, const GUM_SCALAR_SEQ& elem);
94
95 // ============================================================================
97 // ============================================================================
99
102
103 // ============================================================================
105 // ============================================================================
106 ~ArgMaxSet();
107
108 // ============================================================================
110 // ============================================================================
111 void* operator new(size_t s);
112
113 void operator delete(void* p);
114
116
117 // ###########################################################################
119 // ###########################################################################
121
122 // ============================================================================
124 // ============================================================================
126
127 // ============================================================================
129 // ============================================================================
131
133
134 // ###########################################################################
136 // ###########################################################################
138
139 // ============================================================================
141 // ============================================================================
142 ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >& operator+=(const GUM_SCALAR_SEQ& elem);
143
144 // ============================================================================
146 // ============================================================================
149
150 // ============================================================================
152 // ============================================================================
153 const GUM_SCALAR_SEQ& operator[](const Idx i) const;
154
155 // ============================================================================
157 // ============================================================================
159
160 // ============================================================================
162 // ============================================================================
164
166
167 // ============================================================================
169 // ============================================================================
170 Idx size() const;
171
172 // ============================================================================
174 // ============================================================================
175 const GUM_SCALAR_VAL& value() const;
176
177 bool exists(const GUM_SCALAR_SEQ& elem) const;
178
179 private:
182 GUM_SCALAR_VAL _val_;
183
184 public:
185 friend std::ostream& operator<<(std::ostream& streamy, const ArgMaxSet& objy) {
186 streamy << "Value : " << objy.value() << " - Set : " << objy._argMaxSeq_->toString();
187 return streamy;
188 }
189 };
190
191} // End of namespace gum
192
194
195#endif /* GUM_ARG_MAX_SET_H */
Outlined implementation of ArgMaxSet.
~ArgMaxSet()
Destructor.
GUM_SCALAR_VAL _val_
Definition argMaxSet.h:182
Idx size() const
Gives the size.
const GUM_SCALAR_VAL & value() const
Returns the value on which comparison are made.
friend std::ostream & operator<<(std::ostream &streamy, const ArgMaxSet &objy)
Definition argMaxSet.h:185
SequenceIteratorSafe< GUM_SCALAR_SEQ > beginSafe() const
Iterator beginning.
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & operator=(const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &src)
Constructor.
bool operator==(const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &compared) const
Compares two ArgMaxSet to check if they are equals.
bool exists(const GUM_SCALAR_SEQ &elem) const
auto operator<=>(const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &compared) const
Ordering comparisons based on val (C++20 spaceship operator).
SequenceIteratorSafe< GUM_SCALAR_SEQ > endSafe() const
Iterator end.
const GUM_SCALAR_SEQ & operator[](const Idx i) const
Gives the ith element.
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & operator+=(const GUM_SCALAR_SEQ &elem)
Ajout d'un élément.
ArgMaxSet()
Constructor.
Sequence< GUM_SCALAR_SEQ > * _argMaxSeq_
The very bone of the ArgMaxSet.
Definition argMaxSet.h:181
Size Idx
Type for indexes.
Definition types.h:79
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Header file of gum::Sequence, a class for storing (ordered) sequences of objects.
Headers of gum::SmallObjectAllocator.