pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
equal.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_FUNCTIONS_EQUAL_H
4#define pRC_CORE_VALUE_FUNCTIONS_EQUAL_H
5
8
9namespace pRC
10{
20 template<class TA, class TB, If<IsValue<TA>> = 0, If<IsValue<TB>> = 0,
21 If<Any<IsFloat<TA>, IsFloat<TB>>> = 0>
22 static inline constexpr auto operator==(TA const &a, TB const &b)
23 {
24 return a() == b();
25 }
26
36 template<class TA, class TB, If<IsInteger<TA>> = 0, If<IsInteger<TB>> = 0>
37 static inline constexpr auto operator==(TA const &a, TB const &b)
38 {
39 if constexpr(typename TA::Signed() == typename TB::Signed())
40 {
41 return a() == b();
42 }
43 else
44 {
45 if constexpr(typename TA::Signed() == true)
46 {
47 using UA = typename TA::template ChangeSigned<false>;
48 return a < zero() ? false : UA(a) == b;
49 }
50 else
51 {
52 using UB = typename TB::template ChangeSigned<false>;
53 return b < zero() ? false : a == UB(b);
54 }
55 }
56 }
57}
58#endif // pRC_CORE_VALUE_FUNCTIONS_EQUAL_H
Definition cholesky.hpp:18
static constexpr auto zero()
Definition zero.hpp:12
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
static constexpr auto operator==(JacobiRotation< TA > const &a, JacobiRotation< TB > const &b)
Definition jacobi_rotation.hpp:297