cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
delta.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_FUNCTIONS_DELTA_H
4#define pRC_CORE_VALUE_FUNCTIONS_DELTA_H
5
10
11namespace pRC
12{
13 template<IsValue TA, IsValue TB>
14 static inline constexpr auto delta(TA const &a, TB const &b)
15 {
16 return abs(a - b);
17 }
18
19 template<IsValue TA, IsValue TB>
20 requires IsUnsignedInteger<TA> || IsUnsignedInteger<TB>
21 static inline constexpr auto delta(TA const &a, TB const &b)
22 {
23 return a >= b ? (a - b) : (b - a);
24 }
25}
26#endif // pRC_CORE_VALUE_FUNCTIONS_DELTA_H
Definition cholesky.hpp:10
static constexpr auto abs(T const &a)
Definition abs.hpp:11
static constexpr auto delta(TA const &a, TB const &b)
Definition delta.hpp:11