cMHN
1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
pRC
prc
core
value
functions
sign.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSD-2-Clause
2
3
#ifndef pRC_CORE_VALUE_FUNCTIONS_SIGN_H
4
#define pRC_CORE_VALUE_FUNCTIONS_SIGN_H
5
6
#include <
prc/core/basic/functions/zero.hpp
>
7
#include <
prc/core/value/functions/greater.hpp
>
8
#include <
prc/core/value/functions/less.hpp
>
9
#include <
prc/core/value/functions/minus.hpp
>
10
#include <
prc/core/value/value.hpp
>
11
12
namespace
pRC
13
{
14
template
<IsValue T>
15
static
inline
constexpr
auto
sign
(
T
const
&a)
16
{
17
if
(a <
zero
())
18
{
19
return
-
identity<T>
();
20
}
21
22
if
(a >
zero
())
23
{
24
return
identity<T>
();
25
}
26
27
return
zero<T>
();
28
}
29
30
template
<IsValue T>
31
requires
IsUnsignedInteger<T>
32
static
inline
constexpr
auto
sign
(
T
const
&a)
33
{
34
if
(a >
zero
())
35
{
36
return
identity<T>
();
37
}
38
39
return
zero<T>
();
40
}
41
}
42
#endif
// pRC_CORE_VALUE_FUNCTIONS_SIGN_H
pRC::Float
Definition
value.hpp:12
zero.hpp
minus.hpp
pRC
Definition
cholesky.hpp:10
pRC::sign
static constexpr auto sign(T const &a)
Definition
sign.hpp:11
pRC::identity
static constexpr auto identity()
Definition
identity.hpp:13
pRC::zero
static constexpr auto zero()
Definition
zero.hpp:12
greater.hpp
less.hpp
value.hpp
Generated by
1.11.0