cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
absolute_error.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_FUNCTIONS_ABSOLUTE_ERROR_H
4#define pRC_CORE_VALUE_FUNCTIONS_ABSOLUTE_ERROR_H
5
12
13namespace pRC
14{
15 template<class XA, class XB, If<IsInvocable<Sub, XA, XB>> = 0,
16 If<IsInvocable<Norm<>, ResultOf<Sub, XA, XB>>> = 0,
17 If<IsInvocable<Eval, ResultOf<Norm<>, ResultOf<Sub, XA, XB>>>> = 0>
18 static inline constexpr auto absoluteError(XA &&a, XB &&b)
19 {
20 if constexpr(typename ResultOf<Sub, XA, XB>::Value::Signed() == false)
21 {
22 return eval(norm(delta(a, b)));
23 }
24 else
25 {
26 return eval(norm(a - b));
27 }
28 }
29}
30#endif // pRC_CORE_VALUE_FUNCTIONS_ABSOLUTE_ERROR_H
Definition cholesky.hpp:18
static constexpr X eval(X &&a)
Definition eval.hpp:11
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
static constexpr auto absoluteError(XA &&a, XB &&b)
Definition absolute_error.hpp:18
std::invoke_result_t< F, Args... > ResultOf
Definition type_traits.hpp:140
static constexpr auto delta(Complex< TA > const &a, Complex< TB > const &b)
Definition delta.hpp:12
static constexpr auto norm(Complex< T > const &a)
Definition norm.hpp:11