cMHN 1.2
C++ library for learning MHNs with pRC
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
8
9namespace pRC
10{
11 template<class X, IsTensorish R = RemoveReference<X>>
12 requires IsInvocable<ExtractDiagonal, X>
13 static inline constexpr auto trace(X &&a)
14 {
15 return reduce<Add>(extractDiagonal(forward<X>(a)));
16 }
17}
18#endif // pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_TRACE_H
Definition cholesky.hpp:10
static constexpr auto reduce(Sequence< T, I1, I2, Is... > const)
Definition sequence.hpp:458
static constexpr auto extractDiagonal(X &&a)
Definition extract_diagonal.hpp:16
static constexpr auto trace(X &&a)
Definition trace.hpp:13