pRC
multi-purpose Tensor Train library for C++
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{
26 template<class XA, class XB, If<IsInvocable<Sub, XA, XB>> = 0,
27 If<IsInvocable<Norm<>, ResultOf<Sub, XA, XB>>> = 0,
28 If<IsInvocable<Eval, ResultOf<Norm<>, ResultOf<Sub, XA, XB>>>> = 0>
29 static inline constexpr auto absoluteError(XA &&a, XB &&b)
30 {
31 if constexpr(typename ResultOf<Sub, XA, XB>::Value::Signed() == false)
32 {
33 return eval(norm(delta(a, b)));
34 }
35 else
36 {
37 return eval(norm(a - b));
38 }
39 }
40}
41#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 absoluteError(XA &&a, XB &&b)
Calculates the absolute error of two pRC objects.
Definition absolute_error.hpp:29
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 Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
static constexpr auto norm(Complex< T > const &a)
Definition norm.hpp:11