cMHN 1.2
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>
16 requires IsInvocable<Sub, XA, XB> &&
17 IsInvocable<Norm<>, ResultOf<Sub, XA, XB>>
18 static inline constexpr auto absoluteError(XA &&a, XB &&b)
19 {
20 auto const err = [&a, &b]()
21 {
23 {
24 return norm(delta(a, b));
25 }
26 else
27 {
28 return norm(a - b);
29 }
30 }();
31
32 return Value<decltype(err)>(err);
33 }
34}
35#endif // pRC_CORE_VALUE_FUNCTIONS_ABSOLUTE_ERROR_H
Definition value.hpp:46
Definition cholesky.hpp:10
static constexpr auto absoluteError(XA &&a, XB &&b)
Definition absolute_error.hpp:18
typename ValueType< T >::Type Value
Definition value.hpp:72
static constexpr auto delta(TA const &a, TB const &b)
Definition delta.hpp:11
static constexpr auto norm(T const &a)
Definition norm.hpp:12