pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
is_identity.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_FUNCTIONS_IS_IDENTITY_H
4#define pRC_CORE_VALUE_FUNCTIONS_IS_IDENTITY_H
5
10
11namespace pRC
12{
26 template<class X, class R = RemoveReference<X>,
27 class TT = typename R::Value, If<IsValue<TT>> = 0,
28 If<IsDefined<Identity<R>>> = 0, If<IsInvocable<Identity<R>>> = 0,
29 If<IsInvocable<AbsoluteError, X, R>> = 0>
30 static inline constexpr auto isIdentity(X &&a,
31 TT const &tolerance = NumericLimits<TT>::tolerance())
32 {
33 return absoluteError(forward<X>(a), identity<R>()) <= tolerance;
34 }
35}
36#endif // pRC_CORE_VALUE_FUNCTIONS_IS_IDENTITY_H
Definition cholesky.hpp:18
static constexpr auto absoluteError(XA &&a, XB &&b)
Calculates the absolute error of two pRC objects.
Definition absolute_error.hpp:29
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
static constexpr auto isIdentity(T const a)
Definition is_identity.hpp:11
Definition limits.hpp:13