cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
abs.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_FUNCTIONS_ABS_H
4#define pRC_CORE_VALUE_FUNCTIONS_ABS_H
5
9
10namespace pRC
11{
12 template<class T, If<IsValue<T>> = 0,
13 If<IsSatisfied<(typename T::Signed() == true)>> = 0>
14 static inline constexpr auto abs(T const &a)
15 {
16 return (a >= zero()) ? a : -a;
17 }
18
19 template<class T, If<IsValue<T>> = 0,
20 If<IsSatisfied<(typename T::Signed() == false)>> = 0>
21 static inline constexpr auto abs(T const &a)
22 {
23 return a;
24 }
25}
26#endif // pRC_CORE_VALUE_FUNCTIONS_ABS_H
Definition cholesky.hpp:18
static constexpr auto zero()
Definition zero.hpp:12
static constexpr auto abs(Complex< T > const &a)
Definition abs.hpp:12