aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
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
// =========================================================================
61
#include <
agrum/base/core/sequence.h
>
62
#include <
agrum/base/core/smallobjectallocator/smallObjectAllocator.h
>
63
64
// =========================================================================
65
66
namespace
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
// ============================================================================
98
ArgMaxSet
(
const
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >
& src);
99
100
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >
&
101
operator=
(
const
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >
& src);
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
// ============================================================================
125
SequenceIteratorSafe< GUM_SCALAR_SEQ >
beginSafe
()
const
;
126
127
// ============================================================================
129
// ============================================================================
130
SequenceIteratorSafe< GUM_SCALAR_SEQ >
endSafe
()
const
;
131
133
134
// ###########################################################################
136
// ###########################################################################
138
139
// ============================================================================
141
// ============================================================================
142
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >
&
operator+=
(
const
GUM_SCALAR_SEQ& elem);
143
144
// ============================================================================
146
// ============================================================================
147
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >
&
148
operator+=
(
const
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >
& src);
149
150
// ============================================================================
152
// ============================================================================
153
const
GUM_SCALAR_SEQ&
operator[]
(
const
Idx
i)
const
;
154
155
// ============================================================================
157
// ============================================================================
158
bool
operator==
(
const
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >
& compared)
const
;
159
160
// ============================================================================
162
// ============================================================================
163
auto
operator<=>
(
const
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ >
& compared)
const
;
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
:
181
Sequence< GUM_SCALAR_SEQ >
*
_argMaxSeq_
;
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
193
#include <
agrum/base/core/argMaxSet_tpl.h
>
194
195
#endif
/* GUM_ARG_MAX_SET_H */
argMaxSet_tpl.h
Outlined implementation of ArgMaxSet.
gum::ArgMaxSet::_val_
GUM_SCALAR_VAL _val_
Definition
argMaxSet.h:182
gum::ArgMaxSet::size
Idx size() const
Gives the size.
Definition
argMaxSet_tpl.h:191
gum::ArgMaxSet::value
const GUM_SCALAR_VAL & value() const
Returns the value on which comparison are made.
Definition
argMaxSet_tpl.h:181
gum::ArgMaxSet::operator<<
friend std::ostream & operator<<(std::ostream &streamy, const ArgMaxSet &objy)
Definition
argMaxSet.h:185
gum::ArgMaxSet::beginSafe
SequenceIteratorSafe< GUM_SCALAR_SEQ > beginSafe() const
Iterator beginning.
Definition
argMaxSet_tpl.h:170
gum::ArgMaxSet::operator=
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & operator=(const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &src)
Constructor.
Definition
argMaxSet_tpl.h:93
gum::ArgMaxSet::operator==
bool operator==(const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &compared) const
Compares two ArgMaxSet to check if they are equals.
Definition
argMaxSet_tpl.h:140
gum::ArgMaxSet::exists
bool exists(const GUM_SCALAR_SEQ &elem) const
Definition
argMaxSet_tpl.h:186
gum::ArgMaxSet::operator<=>
auto operator<=>(const ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > &compared) const
Ordering comparisons based on val (C++20 spaceship operator).
Definition
argMaxSet_tpl.h:151
gum::ArgMaxSet::endSafe
SequenceIteratorSafe< GUM_SCALAR_SEQ > endSafe() const
Iterator end.
Definition
argMaxSet_tpl.h:176
gum::ArgMaxSet::operator[]
const GUM_SCALAR_SEQ & operator[](const Idx i) const
Gives the ith element.
gum::ArgMaxSet::operator+=
ArgMaxSet< GUM_SCALAR_VAL, GUM_SCALAR_SEQ > & operator+=(const GUM_SCALAR_SEQ &elem)
Ajout d'un élément.
Definition
argMaxSet_tpl.h:119
gum::ArgMaxSet::ArgMaxSet
ArgMaxSet()
Constructor.
Definition
argMaxSet_tpl.h:62
gum::ArgMaxSet::_argMaxSeq_
Sequence< GUM_SCALAR_SEQ > * _argMaxSeq_
The very bone of the ArgMaxSet.
Definition
argMaxSet.h:181
gum::SequenceImplementation< Key, std::is_scalar< Key >::value >::toString
std::string toString() const
gum::SequenceIteratorSafe< GUM_SCALAR_SEQ >
gum::Sequence< GUM_SCALAR_SEQ >
gum::Idx
Size Idx
Type for indexes.
Definition
types.h:79
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
sequence.h
Header file of gum::Sequence, a class for storing (ordered) sequences of objects.
smallObjectAllocator.h
Headers of gum::SmallObjectAllocator.
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0