pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
diagonal.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_DIAGONAL_H
4#define pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_DIAGONAL_H
5
10
11namespace pRC
12{
23 template<class X, class R = RemoveReference<X>, If<IsTensorish<R>> = 0,
24 If<IsInvocable<View, X>> = 0,
25 If<IsSatisfied<(isEven(typename R::Dimension()))>> = 0>
26 static inline constexpr auto diagonal(X &&a)
27 {
30 view(forward<X>(a)));
31 }
32
46 template<class X, class R = RemoveReference<X>, If<IsTensorish<R>> = 0,
47 If<Not<IsInvocable<View, X>>> = 0, If<IsInvocable<Diagonal, X &>> = 0>
48 static inline constexpr auto diagonal(X &&a)
49 {
50 return eval(diagonal(a));
51 }
52}
53#endif // pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_DIAGONAL_H
Definition diagonal.hpp:14
Definition cholesky.hpp:18
static constexpr X eval(X &&a)
Definition eval.hpp:11
static constexpr auto diagonal(X &&a)
Transforms a Tensor into diagonal form.
Definition diagonal.hpp:26
static constexpr X view(X &&a)
Returns a TensorView obtained from a TensorView.
Definition view.hpp:22
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13