cMHN 1.1
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<class TA, class TB, If<IsValue<TA>> = 0, If<IsValue<TB>> = 0,
14 If<None<IsUnsignedInteger<TA>, IsUnsignedInteger<TB>>> = 0>
15 static inline constexpr auto delta(TA const &a, TB const &b)
16 {
17 return abs(a - b);
18 }
19
20 template<class TA, class TB, If<IsValue<TA>> = 0, If<IsValue<TB>> = 0,
21 If<Any<IsUnsignedInteger<TA>, IsUnsignedInteger<TB>>> = 0>
22 static inline constexpr auto delta(TA const &a, TB const &b)
23 {
24 return a >= b ? (a - b) : (b - a);
25 }
26}
27#endif // pRC_CORE_VALUE_FUNCTIONS_DELTA_H
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
static constexpr auto delta(Complex< TA > const &a, Complex< TB > const &b)
Definition delta.hpp:12
static constexpr auto abs(Complex< T > const &a)
Definition abs.hpp:12