cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
strictly_upper_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_UPPER_TRIANGULAR_H
4#define pRC_CORE_TENSOR_OPERATOR_VIEWS_STRICTLY_UPPER_TRIANGULAR_H
5
8
9namespace pRC::TensorViews
10{
11 template<class T, class N, class V>
12 requires IsTensorView<V> && (N::Dimension == 2)
14 : public View<T, N, StrictlyUpperTriangular<T, N, V>>
15 {
16 private:
18
19 public:
20 template<class X>
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 constexpr decltype(auto) operator[](Index const index) = delete;
60 constexpr decltype(auto) operator[](Index const index) const = delete;
61
62 private:
63 V mA;
64 };
65}
66#endif // pRC_CORE_TENSOR_OPERATOR_VIEWS_STRICTLY_UPPER_TRIANGULAR_H
Definition value.hpp:12
Definition strictly_upper_triangular.hpp:15
StrictlyUpperTriangular(X &&a)
Definition strictly_upper_triangular.hpp:22
constexpr T operator()(Index const i, Index const j) const
Definition strictly_upper_triangular.hpp:37
constexpr T operator()(Index const i, Index const j)
Definition strictly_upper_triangular.hpp:27
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