pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
trace.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_TRACE_H
4#define pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_TRACE_H
5
12
13namespace pRC
14{
24 template<class X, If<IsTensorish<RemoveReference<X>>> = 0,
25 If<IsInvocable<View, X>> = 0, If<IsInvocable<ExtractDiagonal, X>> = 0,
26 If<IsInvocable<Reduce<Add>, ResultOf<ExtractDiagonal, X>>> = 0>
27 static inline constexpr auto trace(X &&a)
28 {
30 }
31
44 template<class X, If<IsTensorish<RemoveReference<X>>> = 0,
45 If<Not<IsInvocable<View, X>>> = 0, If<IsInvocable<Trace, X &>> = 0>
46 static inline constexpr auto trace(X &&a)
47 {
48 return eval(trace(a));
49 }
50}
51#endif // pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_TRACE_H
Definition cholesky.hpp:18
static constexpr auto extractDiagonal(X &&a)
Extracts the diagonal of a Tensor.
Definition extract_diagonal.hpp:28
static constexpr X eval(X &&a)
Definition eval.hpp:11
static constexpr auto trace(X &&a)
Calculates the trace of a Tensor.
Definition trace.hpp:27
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13