pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
lower_triangular.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_OPERATOR_VIEWS_LOWER_TRIANGULAR_H
4#define pRC_CORE_TENSOR_OPERATOR_VIEWS_LOWER_TRIANGULAR_H
5
8
9namespace pRC::TensorViews
10{
11 template<class T, class N, class V>
12 class LowerTriangular : public View<T, N, LowerTriangular<T, N, V>>
13 {
14 static_assert(IsTensorView<V>());
15 static_assert(typename N::Dimension() == 2);
16
17 private:
19
20 public:
21 template<class X, If<IsConstructible<V, X>> = 0>
23 : mA(forward<X>(a))
24 {
25 }
26
27 constexpr T operator()(Index const i, Index const j)
28 {
29 if(i >= j)
30 {
31 return mA(i, j);
32 }
33
34 return zero();
35 }
36
37 constexpr T operator()(Index const i, Index const j) const
38 {
39 if(i >= j)
40 {
41 return mA(i, j);
42 }
43
44 return zero();
45 }
46
47 constexpr decltype(auto) operator()(
48 typename Base::Subscripts const &subscripts)
49 {
50 return this->call(subscripts);
51 }
52
53 constexpr decltype(auto) operator()(
54 typename Base::Subscripts const &subscripts) const
55 {
56 return this->call(subscripts);
57 }
58
59 private:
60 V mA;
61 };
62}
63#endif // pRC_CORE_TENSOR_OPERATOR_VIEWS_LOWER_TRIANGULAR_H
Definition lower_triangular.hpp:13
LowerTriangular(X &&a)
Definition lower_triangular.hpp:22
constexpr T operator()(Index const i, Index const j) const
Definition lower_triangular.hpp:37
constexpr T operator()(Index const i, Index const j)
Definition lower_triangular.hpp:27
Definition type_traits.hpp:32
Definition diagonal.hpp:11
static constexpr auto zero()
Definition zero.hpp:12
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
Size Index
Definition type_traits.hpp:21