aGrUM
0.20.2
a C++ library for (probabilistic) graphical models
LpInterface_inl.h
Go to the documentation of this file.
1
/**
2
*
3
* Copyright 2005-2020 Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4
* info_at_agrum_dot_org
5
*
6
* This library is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this library. If not, see <http://www.gnu.org/licenses/>.
18
*
19
*/
20
21
22
/**
23
* @file
24
* @brief Class to include at least once this header
25
*
26
* @author Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
27
*/
28
29
#
include
<
agrum
/
CN
/
polytope
/
LpInterface
.
h
>
30
31
#
ifndef
DOXYGEN_SHOULD_SKIP_THIS
32
33
namespace
gum
{
34
35
INLINE Size
36
HashFunc
<
credal
::
lp
::
LpCol
>::
castToSize
(
const
credal
::
lp
::
LpCol
&
key
) {
37
return
Size
(
key
.
id
());
38
}
39
40
INLINE
Size
HashFunc
<
credal
::
lp
::
LpCol
>::
operator
()(
41
const
credal
::
lp
::
LpCol
&
key
)
const
{
42
return
(
castToSize
(
key
) *
gum
::
HashFuncConst
::
gold
) &
this
->
hash_mask_
;
43
}
44
45
46
namespace
credal
{
47
namespace
lp
{
48
/**
49
* class LpCol
50
*/
51
52
INLINE
unsigned
int
LpCol
::
id
()
const
{
return
id__
; }
53
54
INLINE
bool
LpCol
::
operator
<(
const
LpCol
&
col
)
const
{
55
return
(
id__
<
col
.
id
());
56
}
57
58
INLINE
bool
LpCol
::
operator
==(
const
LpCol
&
col
)
const
{
59
return
(
id__
==
col
.
id
());
60
}
61
62
INLINE
bool
LpCol
::
operator
!=(
const
LpCol
&
col
)
const
{
63
return
(
id__
!=
col
.
id
());
64
}
65
66
INLINE
LpCol
&
LpCol
::
operator
=(
const
LpCol
&
col
) {
67
id__
=
col
.
id__
;
68
69
return
*
this
;
70
}
71
72
INLINE
std
::
ostream
&
operator
<<(
std
::
ostream
&
out
,
const
LpCol
&
col
) {
73
out
<<
col
.
toString
();
74
return
out
;
75
}
76
77
INLINE
std
::
string
LpCol
::
toString
()
const
{
78
return
"V"
+
std
::
to_string
(
id__
);
79
}
80
81
82
INLINE
void
swap
(
HashTable
<
LpCol
,
double
>*&
a
,
83
HashTable
<
LpCol
,
double
>*&
b
) {
84
HashTable
<
LpCol
,
double
>*
tmp
(
a
);
85
a
=
b
;
86
b
=
tmp
;
87
}
88
89
90
INLINE
std
::
ostream
&
operator
<<(
std
::
ostream
&
out
,
const
LpExpr
&
expr
) {
91
out
<<
expr
.
toString
();
92
return
out
;
93
}
94
}
// namespace lp
95
96
}
// namespace credal
97
98
}
/* namespace gum */
99
100
#
endif
/* DOXYGEN_SHOULD_SKIP_THIS */
gum::Set::emplace
INLINE void emplace(Args &&... args)
Definition:
set_tpl.h:669