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