cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
strictly_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_STRICTLY_LOWER_TRIANGULAR_H
4#define pRC_CORE_TENSOR_OPERATOR_VIEWS_STRICTLY_LOWER_TRIANGULAR_H
5
8
9namespace pRC::TensorViews
10{
11 template<class T, class N, class V>
13 : public View<T, N, StrictlyLowerTriangular<T, N, V>>
14 {
15 static_assert(IsTensorView<V>());
16 static_assert(typename N::Dimension() == 2);
17
18 private:
20
21 public:
22 template<class X, If<IsConstructible<V, X>> = 0>
24 : mA(forward<X>(a))
25 {
26 }
27
28 constexpr T operator()(Index const i, Index const j)
29 {
30 if(i > j)
31 {
32 return mA(i, j);
33 }
34
35 return zero();
36 }
37
38 constexpr T operator()(Index const i, Index const j) const
39 {
40 if(i > j)
41 {
42 return mA(i, j);
43 }
44
45 return zero();
46 }
47
48 constexpr decltype(auto) operator()(
49 typename Base::Subscripts const &subscripts)
50 {
51 return this->call(subscripts);
52 }
53
54 constexpr decltype(auto) operator()(
55 typename Base::Subscripts const &subscripts) const
56 {
57 return this->call(subscripts);
58 }
59
60 private:
61 V mA;
62 };
63}
64#endif // pRC_CORE_TENSOR_OPERATOR_VIEWS_STRICTLY_LOWER_TRIANGULAR_H
Definition strictly_lower_triangular.hpp:14
constexpr T operator()(Index const i, Index const j) const
Definition strictly_lower_triangular.hpp:38
constexpr T operator()(Index const i, Index const j)
Definition strictly_lower_triangular.hpp:28
StrictlyLowerTriangular(X &&a)
Definition strictly_lower_triangular.hpp:23
Definition type_traits.hpp:32
Definition diagonal.hpp:11
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
Size Index
Definition type_traits.hpp:21
static constexpr auto zero()
Definition zero.hpp:12