pRC
multi-purpose Tensor Train library for C++
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{
24 template<class TA, class TB, If<IsValue<TA>> = 0, If<IsValue<TB>> = 0,
25 If<None<IsUnsignedInteger<TA>, IsUnsignedInteger<TB>>> = 0>
26 static inline constexpr auto delta(TA const &a, TB const &b)
27 {
28 return abs(a - b);
29 }
30
43 template<class TA, class TB, If<IsValue<TA>> = 0, If<IsValue<TB>> = 0,
44 If<Any<IsUnsignedInteger<TA>, IsUnsignedInteger<TB>>> = 0>
45 static inline constexpr auto delta(TA const &a, TB const &b)
46 {
47 return a >= b ? (a - b) : (b - a);
48 }
49}
50#endif // pRC_CORE_VALUE_FUNCTIONS_DELTA_H
Definition cholesky.hpp:18
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
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13