cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
off_diagonal.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_OFF_DIAGONAL_H
4#define pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_OFF_DIAGONAL_H
5
10
11namespace pRC
12{
13 template<class X, IsTensorish R = RemoveReference<X>>
14 requires(isEven(R::Dimension))
15 static inline constexpr auto offDiagonal(X &&a)
16 {
17 if constexpr(IsInvocable<View, X>)
18 {
20 return TensorViews::OffDiagonal<typename R::Type, typename R::Sizes,
21 V>(view(forward<X>(a)));
22 }
23 else
24 {
25 return eval(offDiagonal(a));
26 }
27 }
28}
29#endif // pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_OFF_DIAGONAL_H
Definition off_diagonal.hpp:15
Definition concepts.hpp:31
Definition cholesky.hpp:10
static constexpr auto isEven(T const a)
Definition is_even.hpp:11
std::remove_reference_t< T > RemoveReference
Definition basics.hpp:41
static constexpr decltype(auto) view(X &&a)
Definition view.hpp:13
static constexpr auto offDiagonal(X &&a)
Definition off_diagonal.hpp:15
static constexpr decltype(auto) eval(X &&a)
Definition eval.hpp:12