cMHN 1.2
C++ library for learning MHNs with pRC
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 requires IsTensorView<V> && (N::Dimension == 2)
13 class LowerTriangular : public View<T, N, LowerTriangular<T, N, V>>
14 {
15 private:
17
18 public:
19 template<class X>
22 : mA(forward<X>(a))
23 {
24 }
25
26 constexpr T operator()(Index const i, Index const j)
27 {
28 if(i >= j)
29 {
30 return mA(i, j);
31 }
32
33 return zero();
34 }
35
36 constexpr T operator()(Index const i, Index const j) const
37 {
38 if(i >= j)
39 {
40 return mA(i, j);
41 }
42
43 return zero();
44 }
45
46 constexpr decltype(auto) operator()(
47 typename Base::Subscripts const &subscripts)
48 {
49 return this->call(subscripts);
50 }
51
52 constexpr decltype(auto) operator()(
53 typename Base::Subscripts const &subscripts) const
54 {
55 return this->call(subscripts);
56 }
57
58 constexpr decltype(auto) operator[](Index const index) = delete;
59 constexpr decltype(auto) operator[](Index const index) const = delete;
60
61 private:
62 V mA;
63 };
64}
65#endif // pRC_CORE_TENSOR_OPERATOR_VIEWS_LOWER_TRIANGULAR_H
Definition value.hpp:12
Definition lower_triangular.hpp:14
LowerTriangular(X &&a)
Definition lower_triangular.hpp:21
constexpr T operator()(Index const i, Index const j) const
Definition lower_triangular.hpp:36
constexpr T operator()(Index const i, Index const j)
Definition lower_triangular.hpp:26
Definition declarations.hpp:20
Definition concepts.hpp:28
int i
Definition gmock-matchers-comparisons_test.cc:603
Definition declarations.hpp:18
Size Index
Definition basics.hpp:32
static constexpr auto zero()
Definition zero.hpp:12