1 // SPDX-License-Identifier: Apache-2.0
2 //
3 // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
4 // Copyright 2008-2016 National ICT Australia (NICTA)
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 // ------------------------------------------------------------------------
17 
18 
19 //! \addtogroup subview_cube_each
20 //! @{
21 
22 
23 
24 template<typename eT>
25 class subview_cube_each_common
26   {
27   public:
28 
29   const Cube<eT>& P;
30 
31   inline void check_size(const Mat<eT>& A) const;
32 
33 
34   protected:
35 
36   arma_inline subview_cube_each_common(const Cube<eT>& in_p);
37        inline subview_cube_each_common() = delete;
38 
39   arma_cold inline const std::string incompat_size_string(const Mat<eT>& A) const;
40   };
41 
42 
43 
44 
45 template<typename eT>
46 class subview_cube_each1 : public subview_cube_each_common<eT>
47   {
48   protected:
49 
50   arma_inline subview_cube_each1(const Cube<eT>& in_p);
51        inline subview_cube_each1() = delete;
52 
53 
54   public:
55 
56   inline ~subview_cube_each1();
57 
58   // deliberately returning void
59   template<typename T1> inline void operator=  (const Base<eT,T1>& x);
60   template<typename T1> inline void operator+= (const Base<eT,T1>& x);
61   template<typename T1> inline void operator-= (const Base<eT,T1>& x);
62   template<typename T1> inline void operator%= (const Base<eT,T1>& x);
63   template<typename T1> inline void operator/= (const Base<eT,T1>& x);
64   template<typename T1> inline void operator*= (const Base<eT,T1>& x);
65 
66 
67   friend class Cube<eT>;
68   };
69 
70 
71 
72 template<typename eT, typename TB>
73 class subview_cube_each2 : public subview_cube_each_common<eT>
74   {
75   protected:
76 
77   inline subview_cube_each2(const Cube<eT>& in_p, const Base<uword, TB>& in_indices);
78   inline subview_cube_each2() = delete;
79 
80 
81   public:
82 
83   const Base<uword, TB>& base_indices;
84 
85   inline void check_indices(const Mat<uword>& indices) const;
86   inline ~subview_cube_each2();
87 
88   // deliberately returning void
89   template<typename T1> inline void operator=  (const Base<eT,T1>& x);
90   template<typename T1> inline void operator+= (const Base<eT,T1>& x);
91   template<typename T1> inline void operator-= (const Base<eT,T1>& x);
92   template<typename T1> inline void operator%= (const Base<eT,T1>& x);
93   template<typename T1> inline void operator/= (const Base<eT,T1>& x);
94 
95 
96   friend class Cube<eT>;
97   };
98 
99 
100 
101 class subview_cube_each1_aux
102   {
103   public:
104 
105   template<typename eT, typename T2>
106   static inline Cube<eT> operator_plus(const subview_cube_each1<eT>& X, const Base<eT,T2>& Y);
107 
108   template<typename eT, typename T2>
109   static inline Cube<eT> operator_minus(const subview_cube_each1<eT>& X, const Base<eT,T2>& Y);
110 
111   template<typename T1, typename eT>
112   static inline Cube<eT> operator_minus(const Base<eT,T1>& X, const subview_cube_each1<eT>& Y);
113 
114   template<typename eT, typename T2>
115   static inline Cube<eT> operator_schur(const subview_cube_each1<eT>& X, const Base<eT,T2>& Y);
116 
117   template<typename eT, typename T2>
118   static inline Cube<eT> operator_div(const subview_cube_each1<eT>& X,const Base<eT,T2>& Y);
119 
120   template<typename T1, typename eT>
121   static inline Cube<eT> operator_div(const Base<eT,T1>& X, const subview_cube_each1<eT>& Y);
122 
123   template<typename eT, typename T2>
124   static inline Cube<eT> operator_times(const subview_cube_each1<eT>& X,const Base<eT,T2>& Y);
125 
126   template<typename T1, typename eT>
127   static inline Cube<eT> operator_times(const Base<eT,T1>& X, const subview_cube_each1<eT>& Y);
128   };
129 
130 
131 
132 class subview_cube_each2_aux
133   {
134   public:
135 
136   template<typename eT, typename TB, typename T2>
137   static inline Cube<eT> operator_plus(const subview_cube_each2<eT,TB>& X, const Base<eT,T2>& Y);
138 
139   template<typename eT, typename TB, typename T2>
140   static inline Cube<eT> operator_minus(const subview_cube_each2<eT,TB>& X, const Base<eT,T2>& Y);
141 
142   template<typename T1, typename eT, typename TB>
143   static inline Cube<eT> operator_minus(const Base<eT,T1>& X, const subview_cube_each2<eT,TB>& Y);
144 
145   template<typename eT, typename TB, typename T2>
146   static inline Cube<eT> operator_schur(const subview_cube_each2<eT,TB>& X, const Base<eT,T2>& Y);
147 
148   template<typename eT, typename TB, typename T2>
149   static inline Cube<eT> operator_div(const subview_cube_each2<eT,TB>& X, const Base<eT,T2>& Y);
150 
151   template<typename T1, typename eT, typename TB>
152   static inline Cube<eT> operator_div(const Base<eT,T1>& X, const subview_cube_each2<eT,TB>& Y);
153 
154   // TODO: operator_times
155   };
156 
157 
158 
159 //! @}
160