cMHN 1.2
C++ library for learning MHNs with pRC
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{
13 template<class X, class R = RemoveReference<X>, IsValue TT = Value<R>>
14 requires IsDefined<Identity<R>> && IsConstructible<Identity<R>> &&
15 IsInvocable<RelativeError, decltype(identity<R>()), X>
16 static inline constexpr auto isIdentity(X &&a,
17 TT const &tolerance = NumericLimits<TT>::tolerance())
18 {
19 return relativeError(identity<R>(), forward<X>(a)) <= tolerance;
20 }
21}
22#endif // pRC_CORE_VALUE_FUNCTIONS_IS_IDENTITY_H
Definition cholesky.hpp:10
static constexpr auto relativeError(XE &&expected, XA &&approx)
Definition relative_error.hpp:19
static constexpr auto isIdentity(T const a)
Definition is_identity.hpp:11
static constexpr auto identity()
Definition identity.hpp:13
Definition limits.hpp:13