cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
is_unit.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_FUNCTIONS_IS_UNIT_H
4#define pRC_CORE_VALUE_FUNCTIONS_IS_UNIT_H
5
10
11namespace pRC
12{
13 template<class X, class R = RemoveReference<X>, IsValue TT = Value<R>>
14 requires IsDefined<Unit<R>> && IsConstructible<Unit<R>> &&
15 IsInvocable<RelativeError, decltype(unit<R>()), X>
16 static inline constexpr auto isUnit(X &&a,
17 TT const &tolerance = NumericLimits<TT>::tolerance())
18 {
19 return relativeError(unit<R>(), forward<X>(a)) <= tolerance;
20 }
21}
22#endif // pRC_CORE_VALUE_FUNCTIONS_IS_UNIT_H
Definition cholesky.hpp:10
static constexpr auto unit()
Definition unit.hpp:13
static constexpr auto isUnit(T const a)
Definition is_unit.hpp:11
static constexpr auto relativeError(XE &&expected, XA &&approx)
Definition relative_error.hpp:19
Definition limits.hpp:13