00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 template<typename T1>
00023 class ProxyCube
00024 {
00025 public:
00026 inline ProxyCube(const T1& A)
00027 {
00028 arma_type_check< is_arma_type<T1>::value == false >::apply();
00029 }
00030 };
00031
00032
00033
00034 template<typename eT>
00035 class ProxyCube< Cube<eT> >
00036 {
00037 public:
00038
00039 typedef eT elem_type;
00040 typedef typename get_pod_type<elem_type>::result pod_type;
00041 typedef Cube<eT> stored_type;
00042
00043
00044 const Cube<eT>& Q;
00045
00046 const u32 n_rows;
00047 const u32 n_cols;
00048 const u32 n_elem_slice;
00049 const u32 n_slices;
00050 const u32 n_elem;
00051
00052 inline explicit ProxyCube(const Cube<eT>& A)
00053 : Q (A)
00054 , n_rows (A.n_rows)
00055 , n_cols (A.n_cols)
00056 , n_elem_slice(A.n_elem_slice)
00057 , n_slices (A.n_slices)
00058 , n_elem (A.n_elem)
00059 {
00060 arma_extra_debug_sigprint();
00061 }
00062
00063 inline explicit ProxyCube(const u32 in_n_rows, const u32 in_n_cols, const u32 in_n_slices)
00064 : Q (Q)
00065 , n_rows (in_n_rows)
00066 , n_cols (in_n_cols)
00067 , n_elem_slice(in_n_rows*in_n_cols)
00068 , n_slices (in_n_slices)
00069 , n_elem (in_n_rows*in_n_cols*in_n_slices)
00070 {
00071 arma_extra_debug_sigprint();
00072 }
00073
00074 arma_inline elem_type operator[] (const u32 i) const { return Q[i]; }
00075 arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); }
00076 };
00077
00078
00079
00080 template<typename T1, typename op_type>
00081 class ProxyCube< OpCube<T1, op_type> >
00082 {
00083 public:
00084
00085 typedef typename T1::elem_type elem_type;
00086 typedef typename get_pod_type<elem_type>::result pod_type;
00087 typedef Cube<elem_type> stored_type;
00088
00089 const Cube<elem_type> Q;
00090
00091 const u32 n_rows;
00092 const u32 n_cols;
00093 const u32 n_elem_slice;
00094 const u32 n_slices;
00095 const u32 n_elem;
00096
00097 inline explicit ProxyCube(const OpCube<T1, op_type>& A)
00098 : Q (A)
00099 , n_rows (Q.n_rows)
00100 , n_cols (Q.n_cols)
00101 , n_elem_slice(Q.n_elem_slice)
00102 , n_slices (Q.n_slices)
00103 , n_elem (Q.n_elem)
00104 {
00105 arma_extra_debug_sigprint();
00106 }
00107
00108 arma_inline elem_type operator[] (const u32 i) const { return Q[i]; }
00109 arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); }
00110 };
00111
00112
00113
00114 template<typename T1, typename T2, typename glue_type>
00115 class ProxyCube< GlueCube<T1, T2, glue_type> >
00116 {
00117 public:
00118
00119 typedef typename T1::elem_type elem_type;
00120 typedef typename get_pod_type<elem_type>::result pod_type;
00121 typedef Cube<elem_type> stored_type;
00122
00123 const Cube<elem_type> Q;
00124
00125 const u32 n_rows;
00126 const u32 n_cols;
00127 const u32 n_elem_slice;
00128 const u32 n_slices;
00129 const u32 n_elem;
00130
00131 inline explicit ProxyCube(const GlueCube<T1, T2, glue_type>& A)
00132 : Q (A)
00133 , n_rows (Q.n_rows)
00134 , n_cols (Q.n_cols)
00135 , n_elem_slice(Q.n_elem_slice)
00136 , n_slices (Q.n_slices)
00137 , n_elem (Q.n_elem)
00138 {
00139 arma_extra_debug_sigprint();
00140 }
00141
00142 arma_inline elem_type operator[] (const u32 i) const { return Q[i]; }
00143 arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); }
00144 };
00145
00146
00147
00148 template<typename eT>
00149 class ProxyCube< subview_cube<eT> >
00150 {
00151 public:
00152
00153 typedef eT elem_type;
00154 typedef typename get_pod_type<elem_type>::result pod_type;
00155 typedef subview_cube<eT> stored_type;
00156
00157 const subview_cube<eT>& Q;
00158
00159 const u32 n_rows;
00160 const u32 n_cols;
00161 const u32 n_elem_slice;
00162 const u32 n_slices;
00163 const u32 n_elem;
00164
00165 inline explicit ProxyCube(const subview_cube<eT>& A)
00166 : Q (A)
00167 , n_rows (A.n_rows)
00168 , n_cols (A.n_cols)
00169 , n_elem_slice(A.n_elem_slice)
00170 , n_slices (A.n_slices)
00171 , n_elem (A.n_elem)
00172 {
00173 arma_extra_debug_sigprint();
00174 }
00175
00176 arma_inline elem_type operator[] (const u32 i) const { return Q[i]; }
00177 arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); }
00178 };
00179
00180
00181
00182
00183 template<typename T1, typename eop_type>
00184 class ProxyCube< eOpCube<T1, eop_type > >
00185 {
00186 public:
00187
00188 typedef typename T1::elem_type elem_type;
00189 typedef typename get_pod_type<elem_type>::result pod_type;
00190 typedef eOpCube<T1, eop_type> stored_type;
00191
00192 const eOpCube<T1, eop_type>& Q;
00193
00194 const u32 n_rows;
00195 const u32 n_cols;
00196 const u32 n_elem_slice;
00197 const u32 n_slices;
00198 const u32 n_elem;
00199
00200 inline explicit ProxyCube(const eOpCube<T1, eop_type>& A)
00201 : Q (A)
00202 , n_rows (A.P.n_rows)
00203 , n_cols (A.P.n_cols)
00204 , n_elem_slice(A.P.n_elem_slice)
00205 , n_slices (A.P.n_slices)
00206 , n_elem (A.P.n_elem)
00207 {
00208 arma_extra_debug_sigprint();
00209 }
00210
00211 arma_inline elem_type operator[] (const u32 i) const { return eop_type::get_elem(Q, i); }
00212 arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return eop_type::get_elem(Q, row, col, slice); }
00213 };
00214
00215
00216
00217 template<typename T1, typename T2, typename eglue_type>
00218 class ProxyCube< eGlueCube<T1, T2, eglue_type > >
00219 {
00220 public:
00221
00222 typedef typename T1::elem_type elem_type;
00223 typedef typename get_pod_type<elem_type>::result pod_type;
00224 typedef eGlueCube<T1, T2, eglue_type> stored_type;
00225
00226 const eGlueCube<T1, T2, eglue_type>& Q;
00227
00228 const u32 n_rows;
00229 const u32 n_cols;
00230 const u32 n_elem_slice;
00231 const u32 n_slices;
00232 const u32 n_elem;
00233
00234 inline explicit ProxyCube(const eGlueCube<T1, T2, eglue_type>& A)
00235 : Q (A)
00236 , n_rows (A.P1.n_rows)
00237 , n_cols (A.P1.n_cols)
00238 , n_elem_slice(A.P1.n_elem_slice)
00239 , n_slices (A.P1.n_slices)
00240 , n_elem (A.P1.n_elem)
00241 {
00242 arma_extra_debug_sigprint();
00243 }
00244
00245 arma_inline elem_type operator[] (const u32 i) const { return eglue_type::get_elem(Q, i); }
00246 arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return eglue_type::get_elem(Q, row, col, slice); }
00247 };
00248
00249
00250
00251