Chris@49
|
1 // Copyright (C) 2010-2013 NICTA (www.nicta.com.au)
|
Chris@49
|
2 // Copyright (C) 2010-2013 Conrad Sanderson
|
Chris@49
|
3 //
|
Chris@49
|
4 // This Source Code Form is subject to the terms of the Mozilla Public
|
Chris@49
|
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
|
Chris@49
|
6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
Chris@49
|
7
|
Chris@49
|
8
|
Chris@49
|
9 //! \addtogroup Proxy
|
Chris@49
|
10 //! @{
|
Chris@49
|
11
|
Chris@49
|
12
|
Chris@49
|
13 // ea_type is the "element accessor" type,
|
Chris@49
|
14 // which can provide access to elements via operator[]
|
Chris@49
|
15
|
Chris@49
|
16
|
Chris@49
|
17
|
Chris@49
|
18 template<typename T1>
|
Chris@49
|
19 struct Proxy_default
|
Chris@49
|
20 {
|
Chris@49
|
21 inline Proxy_default(const T1&)
|
Chris@49
|
22 {
|
Chris@49
|
23 arma_type_check(( is_arma_type<T1>::value == false ));
|
Chris@49
|
24 }
|
Chris@49
|
25 };
|
Chris@49
|
26
|
Chris@49
|
27
|
Chris@49
|
28
|
Chris@49
|
29 template<typename T1>
|
Chris@49
|
30 struct Proxy_fixed
|
Chris@49
|
31 {
|
Chris@49
|
32 typedef typename T1::elem_type elem_type;
|
Chris@49
|
33 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
34 typedef T1 stored_type;
|
Chris@49
|
35 typedef const elem_type* ea_type;
|
Chris@49
|
36 typedef const T1& aligned_ea_type;
|
Chris@49
|
37
|
Chris@49
|
38 static const bool prefer_at_accessor = false;
|
Chris@49
|
39 static const bool has_subview = false;
|
Chris@49
|
40 static const bool is_fixed = true;
|
Chris@49
|
41 static const bool fake_mat = false;
|
Chris@49
|
42
|
Chris@49
|
43 static const bool is_row = T1::is_row;
|
Chris@49
|
44 static const bool is_col = T1::is_col;
|
Chris@49
|
45
|
Chris@49
|
46 arma_aligned const T1& Q;
|
Chris@49
|
47
|
Chris@49
|
48 inline explicit Proxy_fixed(const T1& A)
|
Chris@49
|
49 : Q(A)
|
Chris@49
|
50 {
|
Chris@49
|
51 arma_extra_debug_sigprint();
|
Chris@49
|
52 }
|
Chris@49
|
53
|
Chris@49
|
54 arma_inline static uword get_n_rows() { return T1::n_rows; }
|
Chris@49
|
55 arma_inline static uword get_n_cols() { return T1::n_cols; }
|
Chris@49
|
56 arma_inline static uword get_n_elem() { return T1::n_elem; }
|
Chris@49
|
57
|
Chris@49
|
58 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
59 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
60 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
61
|
Chris@49
|
62 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
63 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
64
|
Chris@49
|
65 template<typename eT2>
|
Chris@49
|
66 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
|
Chris@49
|
67
|
Chris@49
|
68 arma_inline bool is_aligned() const
|
Chris@49
|
69 {
|
Chris@49
|
70 #if defined(ARMA_HAVE_ALIGNED_ATTRIBUTE)
|
Chris@49
|
71 return true;
|
Chris@49
|
72 #else
|
Chris@49
|
73 return memory::is_aligned(Q.memptr());
|
Chris@49
|
74 #endif
|
Chris@49
|
75 }
|
Chris@49
|
76 };
|
Chris@49
|
77
|
Chris@49
|
78
|
Chris@49
|
79
|
Chris@49
|
80 template<typename T1, bool condition>
|
Chris@49
|
81 struct Proxy_redirect {};
|
Chris@49
|
82
|
Chris@49
|
83 template<typename T1>
|
Chris@49
|
84 struct Proxy_redirect<T1, false> { typedef Proxy_default<T1> result; };
|
Chris@49
|
85
|
Chris@49
|
86 template<typename T1>
|
Chris@49
|
87 struct Proxy_redirect<T1, true> { typedef Proxy_fixed<T1> result; };
|
Chris@49
|
88
|
Chris@49
|
89
|
Chris@49
|
90
|
Chris@49
|
91 template<typename T1>
|
Chris@49
|
92 class Proxy : public Proxy_redirect<T1, is_Mat_fixed<T1>::value >::result
|
Chris@49
|
93 {
|
Chris@49
|
94 public:
|
Chris@49
|
95 inline Proxy(const T1& A)
|
Chris@49
|
96 : Proxy_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
|
Chris@49
|
97 {
|
Chris@49
|
98 }
|
Chris@49
|
99 };
|
Chris@49
|
100
|
Chris@49
|
101
|
Chris@49
|
102
|
Chris@49
|
103 template<typename eT>
|
Chris@49
|
104 class Proxy< Mat<eT> >
|
Chris@49
|
105 {
|
Chris@49
|
106 public:
|
Chris@49
|
107
|
Chris@49
|
108 typedef eT elem_type;
|
Chris@49
|
109 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
110 typedef Mat<eT> stored_type;
|
Chris@49
|
111 typedef const eT* ea_type;
|
Chris@49
|
112 typedef const Mat<eT>& aligned_ea_type;
|
Chris@49
|
113
|
Chris@49
|
114 static const bool prefer_at_accessor = false;
|
Chris@49
|
115 static const bool has_subview = false;
|
Chris@49
|
116 static const bool is_fixed = false;
|
Chris@49
|
117 static const bool fake_mat = false;
|
Chris@49
|
118
|
Chris@49
|
119 static const bool is_row = false;
|
Chris@49
|
120 static const bool is_col = false;
|
Chris@49
|
121
|
Chris@49
|
122 arma_aligned const Mat<eT>& Q;
|
Chris@49
|
123
|
Chris@49
|
124 inline explicit Proxy(const Mat<eT>& A)
|
Chris@49
|
125 : Q(A)
|
Chris@49
|
126 {
|
Chris@49
|
127 arma_extra_debug_sigprint();
|
Chris@49
|
128 }
|
Chris@49
|
129
|
Chris@49
|
130 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
131 arma_inline uword get_n_cols() const { return Q.n_cols; }
|
Chris@49
|
132 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
133
|
Chris@49
|
134 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
135 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
136 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
137
|
Chris@49
|
138 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
139 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
140
|
Chris@49
|
141 template<typename eT2>
|
Chris@49
|
142 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
|
Chris@49
|
143
|
Chris@49
|
144 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
145 };
|
Chris@49
|
146
|
Chris@49
|
147
|
Chris@49
|
148
|
Chris@49
|
149 template<typename eT>
|
Chris@49
|
150 class Proxy< Col<eT> >
|
Chris@49
|
151 {
|
Chris@49
|
152 public:
|
Chris@49
|
153
|
Chris@49
|
154 typedef eT elem_type;
|
Chris@49
|
155 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
156 typedef Col<eT> stored_type;
|
Chris@49
|
157 typedef const eT* ea_type;
|
Chris@49
|
158 typedef const Col<eT>& aligned_ea_type;
|
Chris@49
|
159
|
Chris@49
|
160 static const bool prefer_at_accessor = false;
|
Chris@49
|
161 static const bool has_subview = false;
|
Chris@49
|
162 static const bool is_fixed = false;
|
Chris@49
|
163 static const bool fake_mat = false;
|
Chris@49
|
164
|
Chris@49
|
165 static const bool is_row = false;
|
Chris@49
|
166 static const bool is_col = true;
|
Chris@49
|
167
|
Chris@49
|
168 arma_aligned const Col<eT>& Q;
|
Chris@49
|
169
|
Chris@49
|
170 inline explicit Proxy(const Col<eT>& A)
|
Chris@49
|
171 : Q(A)
|
Chris@49
|
172 {
|
Chris@49
|
173 arma_extra_debug_sigprint();
|
Chris@49
|
174 }
|
Chris@49
|
175
|
Chris@49
|
176 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
177 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
178 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
179
|
Chris@49
|
180 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
181 arma_inline elem_type at (const uword row, const uword) const { return Q[row]; }
|
Chris@49
|
182 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
183
|
Chris@49
|
184 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
185 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
186
|
Chris@49
|
187 template<typename eT2>
|
Chris@49
|
188 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
|
Chris@49
|
189
|
Chris@49
|
190 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
191 };
|
Chris@49
|
192
|
Chris@49
|
193
|
Chris@49
|
194
|
Chris@49
|
195 template<typename eT>
|
Chris@49
|
196 class Proxy< Row<eT> >
|
Chris@49
|
197 {
|
Chris@49
|
198 public:
|
Chris@49
|
199
|
Chris@49
|
200 typedef eT elem_type;
|
Chris@49
|
201 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
202 typedef Row<eT> stored_type;
|
Chris@49
|
203 typedef const eT* ea_type;
|
Chris@49
|
204 typedef const Row<eT>& aligned_ea_type;
|
Chris@49
|
205
|
Chris@49
|
206 static const bool prefer_at_accessor = false;
|
Chris@49
|
207 static const bool has_subview = false;
|
Chris@49
|
208 static const bool is_fixed = false;
|
Chris@49
|
209 static const bool fake_mat = false;
|
Chris@49
|
210
|
Chris@49
|
211 static const bool is_row = true;
|
Chris@49
|
212 static const bool is_col = false;
|
Chris@49
|
213
|
Chris@49
|
214 arma_aligned const Row<eT>& Q;
|
Chris@49
|
215
|
Chris@49
|
216 inline explicit Proxy(const Row<eT>& A)
|
Chris@49
|
217 : Q(A)
|
Chris@49
|
218 {
|
Chris@49
|
219 arma_extra_debug_sigprint();
|
Chris@49
|
220 }
|
Chris@49
|
221
|
Chris@49
|
222 arma_inline uword get_n_rows() const { return 1; }
|
Chris@49
|
223 arma_inline uword get_n_cols() const { return Q.n_cols; }
|
Chris@49
|
224 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
225
|
Chris@49
|
226 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
227 arma_inline elem_type at (const uword, const uword col) const { return Q[col]; }
|
Chris@49
|
228 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
229
|
Chris@49
|
230 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
231 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
232
|
Chris@49
|
233 template<typename eT2>
|
Chris@49
|
234 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
|
Chris@49
|
235
|
Chris@49
|
236 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
237 };
|
Chris@49
|
238
|
Chris@49
|
239
|
Chris@49
|
240
|
Chris@49
|
241 template<typename T1, typename gen_type>
|
Chris@49
|
242 class Proxy< Gen<T1, gen_type > >
|
Chris@49
|
243 {
|
Chris@49
|
244 public:
|
Chris@49
|
245
|
Chris@49
|
246 typedef typename T1::elem_type elem_type;
|
Chris@49
|
247 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
248 typedef Gen<T1, gen_type> stored_type;
|
Chris@49
|
249 typedef const Gen<T1, gen_type>& ea_type;
|
Chris@49
|
250 typedef const Gen<T1, gen_type>& aligned_ea_type;
|
Chris@49
|
251
|
Chris@49
|
252 static const bool prefer_at_accessor = Gen<T1, gen_type>::prefer_at_accessor;
|
Chris@49
|
253 static const bool has_subview = false;
|
Chris@49
|
254 static const bool is_fixed = false;
|
Chris@49
|
255 static const bool fake_mat = false;
|
Chris@49
|
256
|
Chris@49
|
257 static const bool is_row = Gen<T1, gen_type>::is_row;
|
Chris@49
|
258 static const bool is_col = Gen<T1, gen_type>::is_col;
|
Chris@49
|
259
|
Chris@49
|
260 arma_aligned const Gen<T1, gen_type>& Q;
|
Chris@49
|
261
|
Chris@49
|
262 inline explicit Proxy(const Gen<T1, gen_type>& A)
|
Chris@49
|
263 : Q(A)
|
Chris@49
|
264 {
|
Chris@49
|
265 arma_extra_debug_sigprint();
|
Chris@49
|
266 }
|
Chris@49
|
267
|
Chris@49
|
268 arma_inline uword get_n_rows() const { return (is_row ? 1 : Q.n_rows); }
|
Chris@49
|
269 arma_inline uword get_n_cols() const { return (is_col ? 1 : Q.n_cols); }
|
Chris@49
|
270 arma_inline uword get_n_elem() const { return (is_row ? 1 : Q.n_rows) * (is_col ? 1 : Q.n_cols); }
|
Chris@49
|
271
|
Chris@49
|
272 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
273 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
274 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
275
|
Chris@49
|
276 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
277 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
278
|
Chris@49
|
279 template<typename eT2>
|
Chris@49
|
280 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
281
|
Chris@49
|
282 arma_inline bool is_aligned() const { return Gen<T1, gen_type>::is_simple; }
|
Chris@49
|
283 };
|
Chris@49
|
284
|
Chris@49
|
285
|
Chris@49
|
286
|
Chris@49
|
287 template<typename T1, typename op_type>
|
Chris@49
|
288 class Proxy< Op<T1, op_type> >
|
Chris@49
|
289 {
|
Chris@49
|
290 public:
|
Chris@49
|
291
|
Chris@49
|
292 typedef typename T1::elem_type elem_type;
|
Chris@49
|
293 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
294 typedef Mat<elem_type> stored_type;
|
Chris@49
|
295 typedef const elem_type* ea_type;
|
Chris@49
|
296 typedef const Mat<elem_type>& aligned_ea_type;
|
Chris@49
|
297
|
Chris@49
|
298 static const bool prefer_at_accessor = false;
|
Chris@49
|
299 static const bool has_subview = false;
|
Chris@49
|
300 static const bool is_fixed = false;
|
Chris@49
|
301 static const bool fake_mat = false;
|
Chris@49
|
302
|
Chris@49
|
303 static const bool is_row = Op<T1, op_type>::is_row;
|
Chris@49
|
304 static const bool is_col = Op<T1, op_type>::is_col;
|
Chris@49
|
305
|
Chris@49
|
306 arma_aligned const Mat<elem_type> Q;
|
Chris@49
|
307
|
Chris@49
|
308 inline explicit Proxy(const Op<T1, op_type>& A)
|
Chris@49
|
309 : Q(A)
|
Chris@49
|
310 {
|
Chris@49
|
311 arma_extra_debug_sigprint();
|
Chris@49
|
312 }
|
Chris@49
|
313
|
Chris@49
|
314 arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
|
Chris@49
|
315 arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; }
|
Chris@49
|
316 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
317
|
Chris@49
|
318 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
319 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
320 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
321
|
Chris@49
|
322 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
323 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
324
|
Chris@49
|
325 template<typename eT2>
|
Chris@49
|
326 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
327
|
Chris@49
|
328 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
329 };
|
Chris@49
|
330
|
Chris@49
|
331
|
Chris@49
|
332
|
Chris@49
|
333 template<typename T1>
|
Chris@49
|
334 class Proxy_diagvec_mat
|
Chris@49
|
335 {
|
Chris@49
|
336 inline Proxy_diagvec_mat(const T1&) {}
|
Chris@49
|
337 };
|
Chris@49
|
338
|
Chris@49
|
339
|
Chris@49
|
340
|
Chris@49
|
341 template<typename T1>
|
Chris@49
|
342 class Proxy_diagvec_mat< Op<T1, op_diagvec> >
|
Chris@49
|
343 {
|
Chris@49
|
344 public:
|
Chris@49
|
345
|
Chris@49
|
346 typedef typename T1::elem_type elem_type;
|
Chris@49
|
347 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
348 typedef diagview<elem_type> stored_type;
|
Chris@49
|
349 typedef const diagview<elem_type>& ea_type;
|
Chris@49
|
350 typedef const diagview<elem_type>& aligned_ea_type;
|
Chris@49
|
351
|
Chris@49
|
352 static const bool prefer_at_accessor = false;
|
Chris@49
|
353 static const bool has_subview = true;
|
Chris@49
|
354 static const bool is_fixed = false;
|
Chris@49
|
355 static const bool fake_mat = false;
|
Chris@49
|
356
|
Chris@49
|
357 static const bool is_row = false;
|
Chris@49
|
358 static const bool is_col = true;
|
Chris@49
|
359
|
Chris@49
|
360 arma_aligned const Mat<elem_type>& R;
|
Chris@49
|
361 arma_aligned const diagview<elem_type> Q;
|
Chris@49
|
362
|
Chris@49
|
363 inline explicit Proxy_diagvec_mat(const Op<T1, op_diagvec>& A)
|
Chris@49
|
364 : R(A.m), Q( R.diag( (A.aux_uword_b > 0) ? -sword(A.aux_uword_a) : sword(A.aux_uword_a) ) )
|
Chris@49
|
365 {
|
Chris@49
|
366 arma_extra_debug_sigprint();
|
Chris@49
|
367 }
|
Chris@49
|
368
|
Chris@49
|
369 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
370 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
371 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
372
|
Chris@49
|
373 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
374 arma_inline elem_type at (const uword row, const uword) const { return Q.at(row, 0); }
|
Chris@49
|
375 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
376
|
Chris@49
|
377 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
378 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
379
|
Chris@49
|
380 template<typename eT2>
|
Chris@49
|
381 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&R) == void_ptr(&X)); }
|
Chris@49
|
382
|
Chris@49
|
383 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
384 };
|
Chris@49
|
385
|
Chris@49
|
386
|
Chris@49
|
387
|
Chris@49
|
388 template<typename T1>
|
Chris@49
|
389 class Proxy_diagvec_expr
|
Chris@49
|
390 {
|
Chris@49
|
391 inline Proxy_diagvec_expr(const T1&) {}
|
Chris@49
|
392 };
|
Chris@49
|
393
|
Chris@49
|
394
|
Chris@49
|
395
|
Chris@49
|
396 template<typename T1>
|
Chris@49
|
397 class Proxy_diagvec_expr< Op<T1, op_diagvec> >
|
Chris@49
|
398 {
|
Chris@49
|
399 public:
|
Chris@49
|
400
|
Chris@49
|
401 typedef typename T1::elem_type elem_type;
|
Chris@49
|
402 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
403 typedef Mat<elem_type> stored_type;
|
Chris@49
|
404 typedef const elem_type* ea_type;
|
Chris@49
|
405 typedef const Mat<elem_type>& aligned_ea_type;
|
Chris@49
|
406
|
Chris@49
|
407 static const bool prefer_at_accessor = false;
|
Chris@49
|
408 static const bool has_subview = false;
|
Chris@49
|
409 static const bool is_fixed = false;
|
Chris@49
|
410 static const bool fake_mat = false;
|
Chris@49
|
411
|
Chris@49
|
412 static const bool is_row = false;
|
Chris@49
|
413 static const bool is_col = true;
|
Chris@49
|
414
|
Chris@49
|
415 arma_aligned const Mat<elem_type> Q;
|
Chris@49
|
416
|
Chris@49
|
417 inline explicit Proxy_diagvec_expr(const Op<T1, op_diagvec>& A)
|
Chris@49
|
418 : Q(A)
|
Chris@49
|
419 {
|
Chris@49
|
420 arma_extra_debug_sigprint();
|
Chris@49
|
421 }
|
Chris@49
|
422
|
Chris@49
|
423 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
424 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
425 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
426
|
Chris@49
|
427 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
428 arma_inline elem_type at (const uword row, const uword) const { return Q.at(row, 0); }
|
Chris@49
|
429 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
430
|
Chris@49
|
431 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
432 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
433
|
Chris@49
|
434 template<typename eT2>
|
Chris@49
|
435 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
436
|
Chris@49
|
437 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
438 };
|
Chris@49
|
439
|
Chris@49
|
440
|
Chris@49
|
441
|
Chris@49
|
442 template<typename T1, bool condition>
|
Chris@49
|
443 struct Proxy_diagvec_redirect {};
|
Chris@49
|
444
|
Chris@49
|
445 template<typename T1>
|
Chris@49
|
446 struct Proxy_diagvec_redirect< Op<T1, op_diagvec>, true > { typedef Proxy_diagvec_mat < Op<T1, op_diagvec> > result; };
|
Chris@49
|
447
|
Chris@49
|
448 template<typename T1>
|
Chris@49
|
449 struct Proxy_diagvec_redirect< Op<T1, op_diagvec>, false> { typedef Proxy_diagvec_expr< Op<T1, op_diagvec> > result; };
|
Chris@49
|
450
|
Chris@49
|
451
|
Chris@49
|
452
|
Chris@49
|
453 template<typename T1>
|
Chris@49
|
454 class Proxy< Op<T1, op_diagvec> >
|
Chris@49
|
455 : public Proxy_diagvec_redirect< Op<T1, op_diagvec>, is_Mat<T1>::value >::result
|
Chris@49
|
456 {
|
Chris@49
|
457 public:
|
Chris@49
|
458
|
Chris@49
|
459 typedef typename Proxy_diagvec_redirect< Op<T1, op_diagvec>, is_Mat<T1>::value >::result Proxy_diagvec;
|
Chris@49
|
460
|
Chris@49
|
461 inline explicit Proxy(const Op<T1, op_diagvec>& A)
|
Chris@49
|
462 : Proxy_diagvec(A)
|
Chris@49
|
463 {
|
Chris@49
|
464 arma_extra_debug_sigprint();
|
Chris@49
|
465 }
|
Chris@49
|
466 };
|
Chris@49
|
467
|
Chris@49
|
468
|
Chris@49
|
469
|
Chris@49
|
470 template<typename T1>
|
Chris@49
|
471 struct Proxy_xtrans_default
|
Chris@49
|
472 {
|
Chris@49
|
473 typedef typename T1::elem_type eT;
|
Chris@49
|
474
|
Chris@49
|
475 static const bool prefer_at_accessor = false;
|
Chris@49
|
476 static const bool has_subview = false;
|
Chris@49
|
477 static const bool is_fixed = false;
|
Chris@49
|
478 static const bool fake_mat = false;
|
Chris@49
|
479
|
Chris@49
|
480 arma_aligned const Mat<eT> Q;
|
Chris@49
|
481
|
Chris@49
|
482 arma_hot
|
Chris@49
|
483 inline Proxy_xtrans_default(const T1& A)
|
Chris@49
|
484 : Q(A)
|
Chris@49
|
485 {
|
Chris@49
|
486 arma_extra_debug_sigprint();
|
Chris@49
|
487 }
|
Chris@49
|
488
|
Chris@49
|
489 template<typename eT2>
|
Chris@49
|
490 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
491 };
|
Chris@49
|
492
|
Chris@49
|
493
|
Chris@49
|
494
|
Chris@49
|
495 template<typename T1>
|
Chris@49
|
496 struct Proxy_xtrans_vector
|
Chris@49
|
497 {
|
Chris@49
|
498 inline Proxy_xtrans_vector(const T1&) {}
|
Chris@49
|
499 };
|
Chris@49
|
500
|
Chris@49
|
501
|
Chris@49
|
502
|
Chris@49
|
503 template<typename T1>
|
Chris@49
|
504 struct Proxy_xtrans_vector< Op<T1, op_htrans> >
|
Chris@49
|
505 {
|
Chris@49
|
506 typedef typename T1::elem_type eT;
|
Chris@49
|
507
|
Chris@49
|
508 static const bool prefer_at_accessor = false;
|
Chris@49
|
509 static const bool has_subview = quasi_unwrap<T1>::has_subview;
|
Chris@49
|
510 static const bool is_fixed = false;
|
Chris@49
|
511 static const bool fake_mat = true;
|
Chris@49
|
512
|
Chris@49
|
513 arma_aligned const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col or subview_col
|
Chris@49
|
514 arma_aligned const Mat<eT> Q;
|
Chris@49
|
515
|
Chris@49
|
516 inline Proxy_xtrans_vector(const Op<T1, op_htrans>& A)
|
Chris@49
|
517 : U(A.m)
|
Chris@49
|
518 , Q(const_cast<eT*>(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false)
|
Chris@49
|
519 {
|
Chris@49
|
520 arma_extra_debug_sigprint();
|
Chris@49
|
521 }
|
Chris@49
|
522
|
Chris@49
|
523 template<typename eT2>
|
Chris@49
|
524 arma_inline bool is_alias(const Mat<eT2>& X) const { return U.is_alias(X); }
|
Chris@49
|
525 };
|
Chris@49
|
526
|
Chris@49
|
527
|
Chris@49
|
528
|
Chris@49
|
529 template<typename T1>
|
Chris@49
|
530 struct Proxy_xtrans_vector< Op<T1, op_strans> >
|
Chris@49
|
531 {
|
Chris@49
|
532 typedef typename T1::elem_type eT;
|
Chris@49
|
533
|
Chris@49
|
534 static const bool prefer_at_accessor = false;
|
Chris@49
|
535 static const bool has_subview = quasi_unwrap<T1>::has_subview;
|
Chris@49
|
536 static const bool is_fixed = false;
|
Chris@49
|
537 static const bool fake_mat = true;
|
Chris@49
|
538
|
Chris@49
|
539 arma_aligned const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col or subview_col
|
Chris@49
|
540 arma_aligned const Mat<eT> Q;
|
Chris@49
|
541
|
Chris@49
|
542 inline Proxy_xtrans_vector(const Op<T1, op_strans>& A)
|
Chris@49
|
543 : U(A.m)
|
Chris@49
|
544 , Q(const_cast<eT*>(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false)
|
Chris@49
|
545 {
|
Chris@49
|
546 arma_extra_debug_sigprint();
|
Chris@49
|
547 }
|
Chris@49
|
548
|
Chris@49
|
549 template<typename eT2>
|
Chris@49
|
550 arma_inline bool is_alias(const Mat<eT2>& X) const { return U.is_alias(X); }
|
Chris@49
|
551 };
|
Chris@49
|
552
|
Chris@49
|
553
|
Chris@49
|
554
|
Chris@49
|
555 template<typename T1, bool condition>
|
Chris@49
|
556 struct Proxy_xtrans_redirect {};
|
Chris@49
|
557
|
Chris@49
|
558 template<typename T1>
|
Chris@49
|
559 struct Proxy_xtrans_redirect<T1, false> { typedef Proxy_xtrans_default<T1> result; };
|
Chris@49
|
560
|
Chris@49
|
561 template<typename T1>
|
Chris@49
|
562 struct Proxy_xtrans_redirect<T1, true> { typedef Proxy_xtrans_vector<T1> result; };
|
Chris@49
|
563
|
Chris@49
|
564
|
Chris@49
|
565
|
Chris@49
|
566 template<typename T1>
|
Chris@49
|
567 class Proxy< Op<T1, op_htrans> >
|
Chris@49
|
568 : public
|
Chris@49
|
569 Proxy_xtrans_redirect
|
Chris@49
|
570 <
|
Chris@49
|
571 Op<T1, op_htrans>,
|
Chris@49
|
572 ((is_complex<typename T1::elem_type>::value == false) && ((Op<T1, op_htrans>::is_row) || (Op<T1, op_htrans>::is_col)) )
|
Chris@49
|
573 >::result
|
Chris@49
|
574 {
|
Chris@49
|
575 public:
|
Chris@49
|
576
|
Chris@49
|
577 typedef
|
Chris@49
|
578 typename
|
Chris@49
|
579 Proxy_xtrans_redirect
|
Chris@49
|
580 <
|
Chris@49
|
581 Op<T1, op_htrans>,
|
Chris@49
|
582 ((is_complex<typename T1::elem_type>::value == false) && ((Op<T1, op_htrans>::is_row) || (Op<T1, op_htrans>::is_col)) )
|
Chris@49
|
583 >::result
|
Chris@49
|
584 Proxy_xtrans;
|
Chris@49
|
585
|
Chris@49
|
586 typedef typename T1::elem_type elem_type;
|
Chris@49
|
587 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
588 typedef Mat<elem_type> stored_type;
|
Chris@49
|
589 typedef const elem_type* ea_type;
|
Chris@49
|
590 typedef const Mat<elem_type>& aligned_ea_type;
|
Chris@49
|
591
|
Chris@49
|
592 static const bool prefer_at_accessor = Proxy_xtrans::prefer_at_accessor;
|
Chris@49
|
593 static const bool has_subview = Proxy_xtrans::has_subview;
|
Chris@49
|
594 static const bool is_fixed = Proxy_xtrans::is_fixed;
|
Chris@49
|
595 static const bool fake_mat = Proxy_xtrans::fake_mat;
|
Chris@49
|
596
|
Chris@49
|
597 // NOTE: the Op class takes care of swapping row and col for op_htrans
|
Chris@49
|
598 static const bool is_row = Op<T1, op_htrans>::is_row;
|
Chris@49
|
599 static const bool is_col = Op<T1, op_htrans>::is_col;
|
Chris@49
|
600
|
Chris@49
|
601 using Proxy_xtrans::Q;
|
Chris@49
|
602
|
Chris@49
|
603 inline explicit Proxy(const Op<T1, op_htrans>& A)
|
Chris@49
|
604 : Proxy_xtrans(A)
|
Chris@49
|
605 {
|
Chris@49
|
606 arma_extra_debug_sigprint();
|
Chris@49
|
607 }
|
Chris@49
|
608
|
Chris@49
|
609 arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
|
Chris@49
|
610 arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; }
|
Chris@49
|
611 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
612
|
Chris@49
|
613 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
614 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
615 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
616
|
Chris@49
|
617 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
618 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
619
|
Chris@49
|
620 template<typename eT2>
|
Chris@49
|
621 arma_inline bool is_alias(const Mat<eT2>& X) const { return Proxy_xtrans::is_alias(X); }
|
Chris@49
|
622
|
Chris@49
|
623 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
624 };
|
Chris@49
|
625
|
Chris@49
|
626
|
Chris@49
|
627
|
Chris@49
|
628 template<typename T1>
|
Chris@49
|
629 class Proxy< Op<T1, op_strans> >
|
Chris@49
|
630 : public
|
Chris@49
|
631 Proxy_xtrans_redirect
|
Chris@49
|
632 <
|
Chris@49
|
633 Op<T1, op_strans>,
|
Chris@49
|
634 ( (Op<T1, op_strans>::is_row) || (Op<T1, op_strans>::is_col) )
|
Chris@49
|
635 >::result
|
Chris@49
|
636 {
|
Chris@49
|
637 public:
|
Chris@49
|
638
|
Chris@49
|
639 typedef
|
Chris@49
|
640 typename
|
Chris@49
|
641 Proxy_xtrans_redirect
|
Chris@49
|
642 <
|
Chris@49
|
643 Op<T1, op_strans>,
|
Chris@49
|
644 ( (Op<T1, op_strans>::is_row) || (Op<T1, op_strans>::is_col) )
|
Chris@49
|
645 >::result
|
Chris@49
|
646 Proxy_xtrans;
|
Chris@49
|
647
|
Chris@49
|
648 typedef typename T1::elem_type elem_type;
|
Chris@49
|
649 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
650 typedef Mat<elem_type> stored_type;
|
Chris@49
|
651 typedef const elem_type* ea_type;
|
Chris@49
|
652 typedef const Mat<elem_type>& aligned_ea_type;
|
Chris@49
|
653
|
Chris@49
|
654 static const bool prefer_at_accessor = Proxy_xtrans::prefer_at_accessor;
|
Chris@49
|
655 static const bool has_subview = Proxy_xtrans::has_subview;
|
Chris@49
|
656 static const bool is_fixed = Proxy_xtrans::is_fixed;
|
Chris@49
|
657 static const bool fake_mat = Proxy_xtrans::fake_mat;
|
Chris@49
|
658
|
Chris@49
|
659 // NOTE: the Op class takes care of swapping row and col for op_strans
|
Chris@49
|
660 static const bool is_row = Op<T1, op_strans>::is_row;
|
Chris@49
|
661 static const bool is_col = Op<T1, op_strans>::is_col;
|
Chris@49
|
662
|
Chris@49
|
663 using Proxy_xtrans::Q;
|
Chris@49
|
664
|
Chris@49
|
665 inline explicit Proxy(const Op<T1, op_strans>& A)
|
Chris@49
|
666 : Proxy_xtrans(A)
|
Chris@49
|
667 {
|
Chris@49
|
668 arma_extra_debug_sigprint();
|
Chris@49
|
669 }
|
Chris@49
|
670
|
Chris@49
|
671 arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
|
Chris@49
|
672 arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; }
|
Chris@49
|
673 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
674
|
Chris@49
|
675 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
676 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
677 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
678
|
Chris@49
|
679 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
680 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
681
|
Chris@49
|
682 template<typename eT2>
|
Chris@49
|
683 arma_inline bool is_alias(const Mat<eT2>& X) const { return Proxy_xtrans::is_alias(X); }
|
Chris@49
|
684
|
Chris@49
|
685 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
686 };
|
Chris@49
|
687
|
Chris@49
|
688
|
Chris@49
|
689
|
Chris@49
|
690 template<typename eT>
|
Chris@49
|
691 struct Proxy_subview_row_htrans_cx
|
Chris@49
|
692 {
|
Chris@49
|
693 typedef eT elem_type;
|
Chris@49
|
694 typedef typename get_pod_type<eT>::result pod_type;
|
Chris@49
|
695 typedef subview_row_htrans<eT> stored_type;
|
Chris@49
|
696 typedef const subview_row_htrans<eT>& ea_type;
|
Chris@49
|
697 typedef const subview_row_htrans<eT>& aligned_ea_type;
|
Chris@49
|
698
|
Chris@49
|
699 static const bool prefer_at_accessor = false;
|
Chris@49
|
700 static const bool has_subview = true;
|
Chris@49
|
701 static const bool is_fixed = false;
|
Chris@49
|
702 static const bool fake_mat = false;
|
Chris@49
|
703
|
Chris@49
|
704 static const bool is_row = false;
|
Chris@49
|
705 static const bool is_col = true;
|
Chris@49
|
706
|
Chris@49
|
707 arma_aligned const subview_row_htrans<eT> Q;
|
Chris@49
|
708
|
Chris@49
|
709 inline explicit Proxy_subview_row_htrans_cx(const Op<subview_row<eT>, op_htrans>& A)
|
Chris@49
|
710 : Q(A.m)
|
Chris@49
|
711 {
|
Chris@49
|
712 arma_extra_debug_sigprint();
|
Chris@49
|
713 }
|
Chris@49
|
714
|
Chris@49
|
715 template<typename eT2>
|
Chris@49
|
716 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); }
|
Chris@49
|
717 };
|
Chris@49
|
718
|
Chris@49
|
719
|
Chris@49
|
720
|
Chris@49
|
721 template<typename eT>
|
Chris@49
|
722 struct Proxy_subview_row_htrans_non_cx
|
Chris@49
|
723 {
|
Chris@49
|
724 typedef eT elem_type;
|
Chris@49
|
725 typedef typename get_pod_type<eT>::result pod_type;
|
Chris@49
|
726 typedef subview_row_strans<eT> stored_type;
|
Chris@49
|
727 typedef const subview_row_strans<eT>& ea_type;
|
Chris@49
|
728 typedef const subview_row_strans<eT>& aligned_ea_type;
|
Chris@49
|
729
|
Chris@49
|
730 static const bool prefer_at_accessor = false;
|
Chris@49
|
731 static const bool has_subview = true;
|
Chris@49
|
732 static const bool is_fixed = false;
|
Chris@49
|
733 static const bool fake_mat = false;
|
Chris@49
|
734
|
Chris@49
|
735 static const bool is_row = false;
|
Chris@49
|
736 static const bool is_col = true;
|
Chris@49
|
737
|
Chris@49
|
738 arma_aligned const subview_row_strans<eT> Q;
|
Chris@49
|
739
|
Chris@49
|
740 inline explicit Proxy_subview_row_htrans_non_cx(const Op<subview_row<eT>, op_htrans>& A)
|
Chris@49
|
741 : Q(A.m)
|
Chris@49
|
742 {
|
Chris@49
|
743 arma_extra_debug_sigprint();
|
Chris@49
|
744 }
|
Chris@49
|
745
|
Chris@49
|
746 template<typename eT2>
|
Chris@49
|
747 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); }
|
Chris@49
|
748 };
|
Chris@49
|
749
|
Chris@49
|
750
|
Chris@49
|
751
|
Chris@49
|
752 template<typename eT, bool condition>
|
Chris@49
|
753 struct Proxy_subview_row_htrans_redirect {};
|
Chris@49
|
754
|
Chris@49
|
755 template<typename eT>
|
Chris@49
|
756 struct Proxy_subview_row_htrans_redirect<eT, true> { typedef Proxy_subview_row_htrans_cx<eT> result; };
|
Chris@49
|
757
|
Chris@49
|
758 template<typename eT>
|
Chris@49
|
759 struct Proxy_subview_row_htrans_redirect<eT, false> { typedef Proxy_subview_row_htrans_non_cx<eT> result; };
|
Chris@49
|
760
|
Chris@49
|
761
|
Chris@49
|
762
|
Chris@49
|
763 template<typename eT>
|
Chris@49
|
764 class Proxy< Op<subview_row<eT>, op_htrans> >
|
Chris@49
|
765 : public
|
Chris@49
|
766 Proxy_subview_row_htrans_redirect
|
Chris@49
|
767 <
|
Chris@49
|
768 eT,
|
Chris@49
|
769 is_complex<eT>::value
|
Chris@49
|
770 >::result
|
Chris@49
|
771 {
|
Chris@49
|
772 public:
|
Chris@49
|
773
|
Chris@49
|
774 typedef
|
Chris@49
|
775 typename
|
Chris@49
|
776 Proxy_subview_row_htrans_redirect
|
Chris@49
|
777 <
|
Chris@49
|
778 eT,
|
Chris@49
|
779 is_complex<eT>::value
|
Chris@49
|
780 >::result
|
Chris@49
|
781 Proxy_sv_row_ht;
|
Chris@49
|
782
|
Chris@49
|
783 typedef typename Proxy_sv_row_ht::elem_type elem_type;
|
Chris@49
|
784 typedef typename Proxy_sv_row_ht::pod_type pod_type;
|
Chris@49
|
785 typedef typename Proxy_sv_row_ht::stored_type stored_type;
|
Chris@49
|
786 typedef typename Proxy_sv_row_ht::ea_type ea_type;
|
Chris@49
|
787 typedef typename Proxy_sv_row_ht::ea_type aligned_ea_type;
|
Chris@49
|
788
|
Chris@49
|
789 static const bool prefer_at_accessor = Proxy_sv_row_ht::prefer_at_accessor;
|
Chris@49
|
790 static const bool has_subview = Proxy_sv_row_ht::has_subview;
|
Chris@49
|
791 static const bool is_fixed = Proxy_sv_row_ht::is_fixed;
|
Chris@49
|
792 static const bool fake_mat = Proxy_sv_row_ht::fake_mat;
|
Chris@49
|
793
|
Chris@49
|
794 static const bool is_row = false;
|
Chris@49
|
795 static const bool is_col = true;
|
Chris@49
|
796
|
Chris@49
|
797 using Proxy_sv_row_ht::Q;
|
Chris@49
|
798
|
Chris@49
|
799 inline explicit Proxy(const Op<subview_row<eT>, op_htrans>& A)
|
Chris@49
|
800 : Proxy_sv_row_ht(A)
|
Chris@49
|
801 {
|
Chris@49
|
802 arma_extra_debug_sigprint();
|
Chris@49
|
803 }
|
Chris@49
|
804
|
Chris@49
|
805 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
806 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
807 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
808
|
Chris@49
|
809 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
810 arma_inline elem_type at (const uword row, const uword) const { return Q[row]; }
|
Chris@49
|
811 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
812
|
Chris@49
|
813 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
814 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
815
|
Chris@49
|
816 template<typename eT2>
|
Chris@49
|
817 arma_inline bool is_alias(const Mat<eT2>& X) const { return Proxy_sv_row_ht::is_alias(X); }
|
Chris@49
|
818
|
Chris@49
|
819 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
820 };
|
Chris@49
|
821
|
Chris@49
|
822
|
Chris@49
|
823
|
Chris@49
|
824 template<typename eT>
|
Chris@49
|
825 class Proxy< Op<subview_row<eT>, op_strans> >
|
Chris@49
|
826 {
|
Chris@49
|
827 public:
|
Chris@49
|
828
|
Chris@49
|
829 typedef eT elem_type;
|
Chris@49
|
830 typedef typename get_pod_type<eT>::result pod_type;
|
Chris@49
|
831 typedef subview_row_strans<eT> stored_type;
|
Chris@49
|
832 typedef const subview_row_strans<eT>& ea_type;
|
Chris@49
|
833 typedef const subview_row_strans<eT>& aligned_ea_type;
|
Chris@49
|
834
|
Chris@49
|
835 static const bool prefer_at_accessor = false;
|
Chris@49
|
836 static const bool has_subview = true;
|
Chris@49
|
837 static const bool is_fixed = false;
|
Chris@49
|
838 static const bool fake_mat = false;
|
Chris@49
|
839
|
Chris@49
|
840 static const bool is_row = false;
|
Chris@49
|
841 static const bool is_col = true;
|
Chris@49
|
842
|
Chris@49
|
843 arma_aligned const subview_row_strans<eT> Q;
|
Chris@49
|
844
|
Chris@49
|
845 inline explicit Proxy(const Op<subview_row<eT>, op_strans>& A)
|
Chris@49
|
846 : Q(A.m)
|
Chris@49
|
847 {
|
Chris@49
|
848 arma_extra_debug_sigprint();
|
Chris@49
|
849 }
|
Chris@49
|
850
|
Chris@49
|
851 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
852 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
853 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
854
|
Chris@49
|
855 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
856 arma_inline elem_type at (const uword row, const uword) const { return Q[row]; }
|
Chris@49
|
857 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
858
|
Chris@49
|
859 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
860 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
861
|
Chris@49
|
862 template<typename eT2>
|
Chris@49
|
863 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); }
|
Chris@49
|
864
|
Chris@49
|
865 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
866 };
|
Chris@49
|
867
|
Chris@49
|
868
|
Chris@49
|
869
|
Chris@49
|
870 template<typename T>
|
Chris@49
|
871 class Proxy< Op< Row< std::complex<T> >, op_htrans> >
|
Chris@49
|
872 {
|
Chris@49
|
873 public:
|
Chris@49
|
874
|
Chris@49
|
875 typedef typename std::complex<T> eT;
|
Chris@49
|
876
|
Chris@49
|
877 typedef typename std::complex<T> elem_type;
|
Chris@49
|
878 typedef T pod_type;
|
Chris@49
|
879 typedef xvec_htrans<eT> stored_type;
|
Chris@49
|
880 typedef const xvec_htrans<eT>& ea_type;
|
Chris@49
|
881 typedef const xvec_htrans<eT>& aligned_ea_type;
|
Chris@49
|
882
|
Chris@49
|
883 static const bool prefer_at_accessor = false;
|
Chris@49
|
884 static const bool has_subview = false;
|
Chris@49
|
885 static const bool is_fixed = false;
|
Chris@49
|
886 static const bool fake_mat = false;
|
Chris@49
|
887
|
Chris@49
|
888 static const bool is_row = false;
|
Chris@49
|
889 static const bool is_col = true;
|
Chris@49
|
890
|
Chris@49
|
891 const xvec_htrans<eT> Q;
|
Chris@49
|
892 const Row<eT>& src;
|
Chris@49
|
893
|
Chris@49
|
894 inline explicit Proxy(const Op< Row< std::complex<T> >, op_htrans>& A)
|
Chris@49
|
895 : Q (A.m.memptr(), A.m.n_rows, A.m.n_cols)
|
Chris@49
|
896 , src(A.m)
|
Chris@49
|
897 {
|
Chris@49
|
898 arma_extra_debug_sigprint();
|
Chris@49
|
899 }
|
Chris@49
|
900
|
Chris@49
|
901 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
902 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
903 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
904
|
Chris@49
|
905 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
906 arma_inline elem_type at (const uword row, const uword) const { return Q[row]; }
|
Chris@49
|
907 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
908
|
Chris@49
|
909 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
910 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
911
|
Chris@49
|
912 template<typename eT2>
|
Chris@49
|
913 arma_inline bool is_alias(const Mat<eT2>& X) const { return void_ptr(&src) == void_ptr(&X); }
|
Chris@49
|
914
|
Chris@49
|
915 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
916 };
|
Chris@49
|
917
|
Chris@49
|
918
|
Chris@49
|
919
|
Chris@49
|
920 template<typename T>
|
Chris@49
|
921 class Proxy< Op< Col< std::complex<T> >, op_htrans> >
|
Chris@49
|
922 {
|
Chris@49
|
923 public:
|
Chris@49
|
924
|
Chris@49
|
925 typedef typename std::complex<T> eT;
|
Chris@49
|
926
|
Chris@49
|
927 typedef typename std::complex<T> elem_type;
|
Chris@49
|
928 typedef T pod_type;
|
Chris@49
|
929 typedef xvec_htrans<eT> stored_type;
|
Chris@49
|
930 typedef const xvec_htrans<eT>& ea_type;
|
Chris@49
|
931 typedef const xvec_htrans<eT>& aligned_ea_type;
|
Chris@49
|
932
|
Chris@49
|
933 static const bool prefer_at_accessor = false;
|
Chris@49
|
934 static const bool has_subview = false;
|
Chris@49
|
935 static const bool is_fixed = false;
|
Chris@49
|
936 static const bool fake_mat = false;
|
Chris@49
|
937
|
Chris@49
|
938 static const bool is_row = true;
|
Chris@49
|
939 static const bool is_col = false;
|
Chris@49
|
940
|
Chris@49
|
941 const xvec_htrans<eT> Q;
|
Chris@49
|
942 const Col<eT>& src;
|
Chris@49
|
943
|
Chris@49
|
944 inline explicit Proxy(const Op< Col< std::complex<T> >, op_htrans>& A)
|
Chris@49
|
945 : Q (A.m.memptr(), A.m.n_rows, A.m.n_cols)
|
Chris@49
|
946 , src(A.m)
|
Chris@49
|
947 {
|
Chris@49
|
948 arma_extra_debug_sigprint();
|
Chris@49
|
949 }
|
Chris@49
|
950
|
Chris@49
|
951 arma_inline uword get_n_rows() const { return 1; }
|
Chris@49
|
952 arma_inline uword get_n_cols() const { return Q.n_cols; }
|
Chris@49
|
953 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
954
|
Chris@49
|
955 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
956 arma_inline elem_type at (const uword, const uword col) const { return Q[col]; }
|
Chris@49
|
957 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
958
|
Chris@49
|
959 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
960 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
961
|
Chris@49
|
962 template<typename eT2>
|
Chris@49
|
963 arma_inline bool is_alias(const Mat<eT2>& X) const { return void_ptr(&src) == void_ptr(&X); }
|
Chris@49
|
964
|
Chris@49
|
965 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
966 };
|
Chris@49
|
967
|
Chris@49
|
968
|
Chris@49
|
969
|
Chris@49
|
970 template<typename T>
|
Chris@49
|
971 class Proxy< Op< subview_col< std::complex<T> >, op_htrans> >
|
Chris@49
|
972 {
|
Chris@49
|
973 public:
|
Chris@49
|
974
|
Chris@49
|
975 typedef typename std::complex<T> eT;
|
Chris@49
|
976
|
Chris@49
|
977 typedef typename std::complex<T> elem_type;
|
Chris@49
|
978 typedef T pod_type;
|
Chris@49
|
979 typedef xvec_htrans<eT> stored_type;
|
Chris@49
|
980 typedef const xvec_htrans<eT>& ea_type;
|
Chris@49
|
981 typedef const xvec_htrans<eT>& aligned_ea_type;
|
Chris@49
|
982
|
Chris@49
|
983 static const bool prefer_at_accessor = false;
|
Chris@49
|
984 static const bool has_subview = true;
|
Chris@49
|
985 static const bool is_fixed = false;
|
Chris@49
|
986 static const bool fake_mat = false;
|
Chris@49
|
987
|
Chris@49
|
988 static const bool is_row = true;
|
Chris@49
|
989 static const bool is_col = false;
|
Chris@49
|
990
|
Chris@49
|
991 const xvec_htrans<eT> Q;
|
Chris@49
|
992 const subview_col<eT>& src;
|
Chris@49
|
993
|
Chris@49
|
994 inline explicit Proxy(const Op< subview_col< std::complex<T> >, op_htrans>& A)
|
Chris@49
|
995 : Q (A.m.colptr(0), A.m.n_rows, A.m.n_cols)
|
Chris@49
|
996 , src(A.m)
|
Chris@49
|
997 {
|
Chris@49
|
998 arma_extra_debug_sigprint();
|
Chris@49
|
999 }
|
Chris@49
|
1000
|
Chris@49
|
1001 arma_inline uword get_n_rows() const { return 1; }
|
Chris@49
|
1002 arma_inline uword get_n_cols() const { return Q.n_cols; }
|
Chris@49
|
1003 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1004
|
Chris@49
|
1005 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1006 arma_inline elem_type at (const uword, const uword col) const { return Q[col]; }
|
Chris@49
|
1007 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
1008
|
Chris@49
|
1009 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
1010 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1011
|
Chris@49
|
1012 template<typename eT2>
|
Chris@49
|
1013 arma_inline bool is_alias(const Mat<eT2>& X) const { return void_ptr(&src.m) == void_ptr(&X); }
|
Chris@49
|
1014
|
Chris@49
|
1015 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
1016 };
|
Chris@49
|
1017
|
Chris@49
|
1018
|
Chris@49
|
1019
|
Chris@49
|
1020 template<typename T1>
|
Chris@49
|
1021 struct Proxy_htrans2_default
|
Chris@49
|
1022 {
|
Chris@49
|
1023 typedef typename T1::elem_type elem_type;
|
Chris@49
|
1024 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1025 typedef Mat<elem_type> stored_type;
|
Chris@49
|
1026 typedef const elem_type* ea_type;
|
Chris@49
|
1027 typedef const Mat<elem_type>& aligned_ea_type;
|
Chris@49
|
1028
|
Chris@49
|
1029 static const bool prefer_at_accessor = false;
|
Chris@49
|
1030 static const bool has_subview = false;
|
Chris@49
|
1031 static const bool is_fixed = false;
|
Chris@49
|
1032 static const bool fake_mat = false;
|
Chris@49
|
1033
|
Chris@49
|
1034 static const bool is_row = false;
|
Chris@49
|
1035 static const bool is_col = false;
|
Chris@49
|
1036
|
Chris@49
|
1037 arma_aligned const Mat<elem_type> Q;
|
Chris@49
|
1038
|
Chris@49
|
1039 arma_hot
|
Chris@49
|
1040 inline Proxy_htrans2_default(const T1& A)
|
Chris@49
|
1041 : Q(A)
|
Chris@49
|
1042 {
|
Chris@49
|
1043 arma_extra_debug_sigprint();
|
Chris@49
|
1044 }
|
Chris@49
|
1045
|
Chris@49
|
1046 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
1047 arma_inline uword get_n_cols() const { return Q.n_cols; }
|
Chris@49
|
1048 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1049
|
Chris@49
|
1050 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
1051 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1052
|
Chris@49
|
1053 template<typename eT2>
|
Chris@49
|
1054 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
1055
|
Chris@49
|
1056 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
1057 };
|
Chris@49
|
1058
|
Chris@49
|
1059
|
Chris@49
|
1060
|
Chris@49
|
1061 template<typename T1>
|
Chris@49
|
1062 struct Proxy_htrans2_vector
|
Chris@49
|
1063 {
|
Chris@49
|
1064 inline Proxy_htrans2_vector(const T1&) {}
|
Chris@49
|
1065 };
|
Chris@49
|
1066
|
Chris@49
|
1067
|
Chris@49
|
1068
|
Chris@49
|
1069 template<typename T1>
|
Chris@49
|
1070 struct Proxy_htrans2_vector< Op<T1, op_htrans2> >
|
Chris@49
|
1071 {
|
Chris@49
|
1072 public:
|
Chris@49
|
1073
|
Chris@49
|
1074 typedef typename T1::elem_type elem_type;
|
Chris@49
|
1075 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1076 typedef eOp< Op<T1, op_htrans>, eop_scalar_times> stored_type;
|
Chris@49
|
1077 typedef const eOp< Op<T1, op_htrans>, eop_scalar_times>& ea_type;
|
Chris@49
|
1078 typedef const eOp< Op<T1, op_htrans>, eop_scalar_times>& aligned_ea_type;
|
Chris@49
|
1079
|
Chris@49
|
1080 static const bool prefer_at_accessor = eOp< Op<T1, op_htrans>, eop_scalar_times>::prefer_at_accessor;
|
Chris@49
|
1081 static const bool has_subview = eOp< Op<T1, op_htrans>, eop_scalar_times>::has_subview;
|
Chris@49
|
1082 static const bool is_fixed = eOp< Op<T1, op_htrans>, eop_scalar_times>::is_fixed;
|
Chris@49
|
1083 static const bool fake_mat = eOp< Op<T1, op_htrans>, eop_scalar_times>::fake_mat;
|
Chris@49
|
1084
|
Chris@49
|
1085 // NOTE: the Op class takes care of swapping row and col for op_htrans
|
Chris@49
|
1086 static const bool is_row = eOp< Op<T1, op_htrans>, eop_scalar_times>::is_row;
|
Chris@49
|
1087 static const bool is_col = eOp< Op<T1, op_htrans>, eop_scalar_times>::is_col;
|
Chris@49
|
1088
|
Chris@49
|
1089 arma_aligned const Op<T1, op_htrans> R;
|
Chris@49
|
1090 arma_aligned const eOp< Op<T1, op_htrans>, eop_scalar_times > Q;
|
Chris@49
|
1091
|
Chris@49
|
1092 inline explicit Proxy_htrans2_vector(const Op<T1, op_htrans2>& A)
|
Chris@49
|
1093 : R(A.m)
|
Chris@49
|
1094 , Q(R, A.aux)
|
Chris@49
|
1095 {
|
Chris@49
|
1096 arma_extra_debug_sigprint();
|
Chris@49
|
1097 }
|
Chris@49
|
1098
|
Chris@49
|
1099 arma_inline uword get_n_rows() const { return is_row ? 1 : Q.get_n_rows(); }
|
Chris@49
|
1100 arma_inline uword get_n_cols() const { return is_col ? 1 : Q.get_n_cols(); }
|
Chris@49
|
1101 arma_inline uword get_n_elem() const { return Q.get_n_elem(); }
|
Chris@49
|
1102
|
Chris@49
|
1103 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
1104 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1105
|
Chris@49
|
1106 template<typename eT2>
|
Chris@49
|
1107 arma_inline bool is_alias(const Mat<eT2>& X) const { return Q.P.is_alias(X); }
|
Chris@49
|
1108
|
Chris@49
|
1109 arma_inline bool is_aligned() const { return Q.P.is_aligned(); }
|
Chris@49
|
1110 };
|
Chris@49
|
1111
|
Chris@49
|
1112
|
Chris@49
|
1113
|
Chris@49
|
1114 template<typename T1, bool condition>
|
Chris@49
|
1115 struct Proxy_htrans2_redirect {};
|
Chris@49
|
1116
|
Chris@49
|
1117 template<typename T1>
|
Chris@49
|
1118 struct Proxy_htrans2_redirect<T1, false> { typedef Proxy_htrans2_default<T1> result; };
|
Chris@49
|
1119
|
Chris@49
|
1120 template<typename T1>
|
Chris@49
|
1121 struct Proxy_htrans2_redirect<T1, true> { typedef Proxy_htrans2_vector<T1> result; };
|
Chris@49
|
1122
|
Chris@49
|
1123
|
Chris@49
|
1124
|
Chris@49
|
1125 template<typename T1>
|
Chris@49
|
1126 class Proxy< Op<T1, op_htrans2> >
|
Chris@49
|
1127 : public
|
Chris@49
|
1128 Proxy_htrans2_redirect
|
Chris@49
|
1129 <
|
Chris@49
|
1130 Op<T1, op_htrans2>,
|
Chris@49
|
1131 ( (Op<T1, op_htrans2>::is_row) || (Op<T1, op_htrans2>::is_col) )
|
Chris@49
|
1132 >::result
|
Chris@49
|
1133 {
|
Chris@49
|
1134 public:
|
Chris@49
|
1135
|
Chris@49
|
1136 typedef
|
Chris@49
|
1137 typename
|
Chris@49
|
1138 Proxy_htrans2_redirect
|
Chris@49
|
1139 <
|
Chris@49
|
1140 Op<T1, op_htrans2>,
|
Chris@49
|
1141 ( (Op<T1, op_htrans2>::is_row) || (Op<T1, op_htrans2>::is_col) )
|
Chris@49
|
1142 >::result
|
Chris@49
|
1143 Proxy_htrans2;
|
Chris@49
|
1144
|
Chris@49
|
1145 typedef typename Proxy_htrans2::elem_type elem_type;
|
Chris@49
|
1146 typedef typename Proxy_htrans2::pod_type pod_type;
|
Chris@49
|
1147 typedef typename Proxy_htrans2::stored_type stored_type;
|
Chris@49
|
1148 typedef typename Proxy_htrans2::ea_type ea_type;
|
Chris@49
|
1149 typedef typename Proxy_htrans2::aligned_ea_type aligned_ea_type;
|
Chris@49
|
1150
|
Chris@49
|
1151 static const bool prefer_at_accessor = Proxy_htrans2::prefer_at_accessor;
|
Chris@49
|
1152 static const bool has_subview = Proxy_htrans2::has_subview;
|
Chris@49
|
1153 static const bool is_fixed = Proxy_htrans2::is_fixed;
|
Chris@49
|
1154 static const bool fake_mat = Proxy_htrans2::fake_mat;
|
Chris@49
|
1155
|
Chris@49
|
1156 static const bool is_row = Proxy_htrans2::is_row;
|
Chris@49
|
1157 static const bool is_col = Proxy_htrans2::is_col;
|
Chris@49
|
1158
|
Chris@49
|
1159 using Proxy_htrans2::Q;
|
Chris@49
|
1160
|
Chris@49
|
1161 inline explicit Proxy(const Op<T1, op_htrans2>& A)
|
Chris@49
|
1162 : Proxy_htrans2(A)
|
Chris@49
|
1163 {
|
Chris@49
|
1164 arma_extra_debug_sigprint();
|
Chris@49
|
1165 }
|
Chris@49
|
1166
|
Chris@49
|
1167 arma_inline uword get_n_rows() const { return Proxy_htrans2::get_n_rows(); }
|
Chris@49
|
1168 arma_inline uword get_n_cols() const { return Proxy_htrans2::get_n_cols(); }
|
Chris@49
|
1169 arma_inline uword get_n_elem() const { return Proxy_htrans2::get_n_elem(); }
|
Chris@49
|
1170
|
Chris@49
|
1171 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1172 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
1173 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1174
|
Chris@49
|
1175 arma_inline ea_type get_ea() const { return Proxy_htrans2::get_ea(); }
|
Chris@49
|
1176 arma_inline aligned_ea_type get_aligned_ea() const { return Proxy_htrans2::get_aligned_ea(); }
|
Chris@49
|
1177
|
Chris@49
|
1178 template<typename eT2>
|
Chris@49
|
1179 arma_inline bool is_alias(const Mat<eT2>& X) const { return Proxy_htrans2::is_alias(X); }
|
Chris@49
|
1180
|
Chris@49
|
1181 arma_inline bool is_aligned() const { return Proxy_htrans2::is_aligned(); }
|
Chris@49
|
1182 };
|
Chris@49
|
1183
|
Chris@49
|
1184
|
Chris@49
|
1185
|
Chris@49
|
1186 template<typename T1, typename T2, typename glue_type>
|
Chris@49
|
1187 class Proxy< Glue<T1, T2, glue_type> >
|
Chris@49
|
1188 {
|
Chris@49
|
1189 public:
|
Chris@49
|
1190
|
Chris@49
|
1191 typedef typename T1::elem_type elem_type;
|
Chris@49
|
1192 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1193 typedef Mat<elem_type> stored_type;
|
Chris@49
|
1194 typedef const elem_type* ea_type;
|
Chris@49
|
1195 typedef const Mat<elem_type>& aligned_ea_type;
|
Chris@49
|
1196
|
Chris@49
|
1197 static const bool prefer_at_accessor = false;
|
Chris@49
|
1198 static const bool has_subview = false;
|
Chris@49
|
1199 static const bool is_fixed = false;
|
Chris@49
|
1200 static const bool fake_mat = false;
|
Chris@49
|
1201
|
Chris@49
|
1202 static const bool is_row = Glue<T1, T2, glue_type>::is_row;
|
Chris@49
|
1203 static const bool is_col = Glue<T1, T2, glue_type>::is_col;
|
Chris@49
|
1204
|
Chris@49
|
1205 arma_aligned const Mat<elem_type> Q;
|
Chris@49
|
1206
|
Chris@49
|
1207 inline explicit Proxy(const Glue<T1, T2, glue_type>& A)
|
Chris@49
|
1208 : Q(A)
|
Chris@49
|
1209 {
|
Chris@49
|
1210 arma_extra_debug_sigprint();
|
Chris@49
|
1211 }
|
Chris@49
|
1212
|
Chris@49
|
1213 arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
|
Chris@49
|
1214 arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; }
|
Chris@49
|
1215 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1216
|
Chris@49
|
1217 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1218 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
1219 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1220
|
Chris@49
|
1221 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
1222 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1223
|
Chris@49
|
1224 template<typename eT2>
|
Chris@49
|
1225 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
1226
|
Chris@49
|
1227 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
1228 };
|
Chris@49
|
1229
|
Chris@49
|
1230
|
Chris@49
|
1231
|
Chris@49
|
1232 template<typename eT>
|
Chris@49
|
1233 class Proxy< subview<eT> >
|
Chris@49
|
1234 {
|
Chris@49
|
1235 public:
|
Chris@49
|
1236
|
Chris@49
|
1237 typedef eT elem_type;
|
Chris@49
|
1238 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1239 typedef subview<eT> stored_type;
|
Chris@49
|
1240 typedef const subview<eT>& ea_type;
|
Chris@49
|
1241 typedef const subview<eT>& aligned_ea_type;
|
Chris@49
|
1242
|
Chris@49
|
1243 static const bool prefer_at_accessor = true;
|
Chris@49
|
1244 static const bool has_subview = true;
|
Chris@49
|
1245 static const bool is_fixed = false;
|
Chris@49
|
1246 static const bool fake_mat = false;
|
Chris@49
|
1247
|
Chris@49
|
1248 static const bool is_row = false;
|
Chris@49
|
1249 static const bool is_col = false;
|
Chris@49
|
1250
|
Chris@49
|
1251 arma_aligned const subview<eT>& Q;
|
Chris@49
|
1252
|
Chris@49
|
1253 inline explicit Proxy(const subview<eT>& A)
|
Chris@49
|
1254 : Q(A)
|
Chris@49
|
1255 {
|
Chris@49
|
1256 arma_extra_debug_sigprint();
|
Chris@49
|
1257 }
|
Chris@49
|
1258
|
Chris@49
|
1259 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
1260 arma_inline uword get_n_cols() const { return Q.n_cols; }
|
Chris@49
|
1261 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1262
|
Chris@49
|
1263 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1264 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
1265 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
1266
|
Chris@49
|
1267 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
1268 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1269
|
Chris@49
|
1270 template<typename eT2>
|
Chris@49
|
1271 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.m)) == void_ptr(&X)); }
|
Chris@49
|
1272
|
Chris@49
|
1273 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
1274 };
|
Chris@49
|
1275
|
Chris@49
|
1276
|
Chris@49
|
1277
|
Chris@49
|
1278 template<typename eT>
|
Chris@49
|
1279 class Proxy< subview_col<eT> >
|
Chris@49
|
1280 {
|
Chris@49
|
1281 public:
|
Chris@49
|
1282
|
Chris@49
|
1283 typedef eT elem_type;
|
Chris@49
|
1284 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1285 typedef subview_col<eT> stored_type;
|
Chris@49
|
1286 typedef const eT* ea_type;
|
Chris@49
|
1287 typedef const subview_col<eT>& aligned_ea_type;
|
Chris@49
|
1288
|
Chris@49
|
1289 static const bool prefer_at_accessor = false;
|
Chris@49
|
1290 static const bool has_subview = true;
|
Chris@49
|
1291 static const bool is_fixed = false;
|
Chris@49
|
1292 static const bool fake_mat = false;
|
Chris@49
|
1293
|
Chris@49
|
1294 static const bool is_row = false;
|
Chris@49
|
1295 static const bool is_col = true;
|
Chris@49
|
1296
|
Chris@49
|
1297 arma_aligned const subview_col<eT>& Q;
|
Chris@49
|
1298
|
Chris@49
|
1299 inline explicit Proxy(const subview_col<eT>& A)
|
Chris@49
|
1300 : Q(A)
|
Chris@49
|
1301 {
|
Chris@49
|
1302 arma_extra_debug_sigprint();
|
Chris@49
|
1303 }
|
Chris@49
|
1304
|
Chris@49
|
1305 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
1306 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
1307 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1308
|
Chris@49
|
1309 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1310 arma_inline elem_type at (const uword row, const uword) const { return Q[row]; }
|
Chris@49
|
1311 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1312
|
Chris@49
|
1313 arma_inline ea_type get_ea() const { return Q.colmem; }
|
Chris@49
|
1314 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1315
|
Chris@49
|
1316 template<typename eT2>
|
Chris@49
|
1317 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.m)) == void_ptr(&X)); }
|
Chris@49
|
1318
|
Chris@49
|
1319 arma_inline bool is_aligned() const { return memory::is_aligned(Q.colmem); }
|
Chris@49
|
1320 };
|
Chris@49
|
1321
|
Chris@49
|
1322
|
Chris@49
|
1323
|
Chris@49
|
1324 template<typename eT>
|
Chris@49
|
1325 class Proxy< subview_row<eT> >
|
Chris@49
|
1326 {
|
Chris@49
|
1327 public:
|
Chris@49
|
1328
|
Chris@49
|
1329 typedef eT elem_type;
|
Chris@49
|
1330 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1331 typedef subview_row<eT> stored_type;
|
Chris@49
|
1332 typedef const subview_row<eT>& ea_type;
|
Chris@49
|
1333 typedef const subview_row<eT>& aligned_ea_type;
|
Chris@49
|
1334
|
Chris@49
|
1335 static const bool prefer_at_accessor = false;
|
Chris@49
|
1336 static const bool has_subview = true;
|
Chris@49
|
1337 static const bool is_fixed = false;
|
Chris@49
|
1338 static const bool fake_mat = false;
|
Chris@49
|
1339
|
Chris@49
|
1340 static const bool is_row = true;
|
Chris@49
|
1341 static const bool is_col = false;
|
Chris@49
|
1342
|
Chris@49
|
1343 arma_aligned const subview_row<eT>& Q;
|
Chris@49
|
1344
|
Chris@49
|
1345 inline explicit Proxy(const subview_row<eT>& A)
|
Chris@49
|
1346 : Q(A)
|
Chris@49
|
1347 {
|
Chris@49
|
1348 arma_extra_debug_sigprint();
|
Chris@49
|
1349 }
|
Chris@49
|
1350
|
Chris@49
|
1351 arma_inline uword get_n_rows() const { return 1; }
|
Chris@49
|
1352 arma_inline uword get_n_cols() const { return Q.n_cols; }
|
Chris@49
|
1353 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1354
|
Chris@49
|
1355 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1356 arma_inline elem_type at (const uword, const uword col) const { return Q[col]; }
|
Chris@49
|
1357 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
1358
|
Chris@49
|
1359 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
1360 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1361
|
Chris@49
|
1362 template<typename eT2>
|
Chris@49
|
1363 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.m)) == void_ptr(&X)); }
|
Chris@49
|
1364
|
Chris@49
|
1365 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
1366 };
|
Chris@49
|
1367
|
Chris@49
|
1368
|
Chris@49
|
1369
|
Chris@49
|
1370 template<typename eT>
|
Chris@49
|
1371 class Proxy< subview_row_strans<eT> >
|
Chris@49
|
1372 {
|
Chris@49
|
1373 public:
|
Chris@49
|
1374
|
Chris@49
|
1375 typedef eT elem_type;
|
Chris@49
|
1376 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1377 typedef subview_row_strans<eT> stored_type;
|
Chris@49
|
1378 typedef const subview_row_strans<eT>& ea_type;
|
Chris@49
|
1379 typedef const subview_row_strans<eT>& aligned_ea_type;
|
Chris@49
|
1380
|
Chris@49
|
1381 static const bool prefer_at_accessor = false;
|
Chris@49
|
1382 static const bool has_subview = true;
|
Chris@49
|
1383 static const bool is_fixed = false;
|
Chris@49
|
1384 static const bool fake_mat = false;
|
Chris@49
|
1385
|
Chris@49
|
1386 static const bool is_row = false;
|
Chris@49
|
1387 static const bool is_col = true;
|
Chris@49
|
1388
|
Chris@49
|
1389 arma_aligned const subview_row_strans<eT>& Q;
|
Chris@49
|
1390
|
Chris@49
|
1391 inline explicit Proxy(const subview_row_strans<eT>& A)
|
Chris@49
|
1392 : Q(A)
|
Chris@49
|
1393 {
|
Chris@49
|
1394 arma_extra_debug_sigprint();
|
Chris@49
|
1395 }
|
Chris@49
|
1396
|
Chris@49
|
1397 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
1398 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
1399 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1400
|
Chris@49
|
1401 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1402 arma_inline elem_type at (const uword row, const uword) const { return Q[row]; }
|
Chris@49
|
1403 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
1404
|
Chris@49
|
1405 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
1406 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1407
|
Chris@49
|
1408 template<typename eT2>
|
Chris@49
|
1409 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); }
|
Chris@49
|
1410
|
Chris@49
|
1411 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
1412 };
|
Chris@49
|
1413
|
Chris@49
|
1414
|
Chris@49
|
1415
|
Chris@49
|
1416 template<typename eT>
|
Chris@49
|
1417 class Proxy< subview_row_htrans<eT> >
|
Chris@49
|
1418 {
|
Chris@49
|
1419 public:
|
Chris@49
|
1420
|
Chris@49
|
1421 typedef eT elem_type;
|
Chris@49
|
1422 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1423 typedef subview_row_htrans<eT> stored_type;
|
Chris@49
|
1424 typedef const subview_row_htrans<eT>& ea_type;
|
Chris@49
|
1425 typedef const subview_row_htrans<eT>& aligned_ea_type;
|
Chris@49
|
1426
|
Chris@49
|
1427 static const bool prefer_at_accessor = false;
|
Chris@49
|
1428 static const bool has_subview = true;
|
Chris@49
|
1429 static const bool is_fixed = false;
|
Chris@49
|
1430 static const bool fake_mat = false;
|
Chris@49
|
1431
|
Chris@49
|
1432 static const bool is_row = false;
|
Chris@49
|
1433 static const bool is_col = true;
|
Chris@49
|
1434
|
Chris@49
|
1435 arma_aligned const subview_row_htrans<eT>& Q;
|
Chris@49
|
1436
|
Chris@49
|
1437 inline explicit Proxy(const subview_row_htrans<eT>& A)
|
Chris@49
|
1438 : Q(A)
|
Chris@49
|
1439 {
|
Chris@49
|
1440 arma_extra_debug_sigprint();
|
Chris@49
|
1441 }
|
Chris@49
|
1442
|
Chris@49
|
1443 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
1444 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
1445 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1446
|
Chris@49
|
1447 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1448 arma_inline elem_type at (const uword row, const uword) const { return Q[row]; }
|
Chris@49
|
1449 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
1450
|
Chris@49
|
1451 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
1452 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1453
|
Chris@49
|
1454 template<typename eT2>
|
Chris@49
|
1455 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.sv_row.m)) == void_ptr(&X)); }
|
Chris@49
|
1456
|
Chris@49
|
1457 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
1458 };
|
Chris@49
|
1459
|
Chris@49
|
1460
|
Chris@49
|
1461
|
Chris@49
|
1462 template<typename eT>
|
Chris@49
|
1463 class Proxy< xvec_htrans<eT> >
|
Chris@49
|
1464 {
|
Chris@49
|
1465 public:
|
Chris@49
|
1466
|
Chris@49
|
1467 typedef eT elem_type;
|
Chris@49
|
1468 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1469 typedef Mat<eT> stored_type;
|
Chris@49
|
1470 typedef const eT* ea_type;
|
Chris@49
|
1471 typedef const Mat<eT>& aligned_ea_type;
|
Chris@49
|
1472
|
Chris@49
|
1473 static const bool prefer_at_accessor = false;
|
Chris@49
|
1474 static const bool has_subview = false;
|
Chris@49
|
1475 static const bool is_fixed = false;
|
Chris@49
|
1476 static const bool fake_mat = false;
|
Chris@49
|
1477
|
Chris@49
|
1478 static const bool is_row = false;
|
Chris@49
|
1479 static const bool is_col = false;
|
Chris@49
|
1480
|
Chris@49
|
1481 arma_aligned const Mat<eT> Q;
|
Chris@49
|
1482
|
Chris@49
|
1483 inline explicit Proxy(const xvec_htrans<eT>& A)
|
Chris@49
|
1484 : Q(A)
|
Chris@49
|
1485 {
|
Chris@49
|
1486 arma_extra_debug_sigprint();
|
Chris@49
|
1487 }
|
Chris@49
|
1488
|
Chris@49
|
1489 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
1490 arma_inline uword get_n_cols() const { return Q.n_cols; }
|
Chris@49
|
1491 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1492
|
Chris@49
|
1493 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1494 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row,col); }
|
Chris@49
|
1495 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1496
|
Chris@49
|
1497 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
1498 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1499
|
Chris@49
|
1500 template<typename eT2>
|
Chris@49
|
1501 arma_inline bool is_alias(const Mat<eT2>& X) const { return false; }
|
Chris@49
|
1502
|
Chris@49
|
1503 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
1504 };
|
Chris@49
|
1505
|
Chris@49
|
1506
|
Chris@49
|
1507
|
Chris@49
|
1508 template<typename eT, typename T1>
|
Chris@49
|
1509 class Proxy< subview_elem1<eT,T1> >
|
Chris@49
|
1510 {
|
Chris@49
|
1511 public:
|
Chris@49
|
1512
|
Chris@49
|
1513 typedef eT elem_type;
|
Chris@49
|
1514 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1515 typedef Mat<eT> stored_type;
|
Chris@49
|
1516 typedef const eT* ea_type;
|
Chris@49
|
1517 typedef const Mat<eT>& aligned_ea_type;
|
Chris@49
|
1518
|
Chris@49
|
1519 static const bool prefer_at_accessor = false;
|
Chris@49
|
1520 static const bool has_subview = false;
|
Chris@49
|
1521 static const bool is_fixed = false;
|
Chris@49
|
1522 static const bool fake_mat = false;
|
Chris@49
|
1523
|
Chris@49
|
1524 static const bool is_row = false;
|
Chris@49
|
1525 static const bool is_col = true;
|
Chris@49
|
1526
|
Chris@49
|
1527 arma_aligned const Mat<eT> Q;
|
Chris@49
|
1528
|
Chris@49
|
1529 inline explicit Proxy(const subview_elem1<eT,T1>& A)
|
Chris@49
|
1530 : Q(A)
|
Chris@49
|
1531 {
|
Chris@49
|
1532 arma_extra_debug_sigprint();
|
Chris@49
|
1533 }
|
Chris@49
|
1534
|
Chris@49
|
1535 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
1536 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
1537 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1538
|
Chris@49
|
1539 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1540 arma_inline elem_type at (const uword row, const uword) const { return Q[row]; }
|
Chris@49
|
1541 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1542
|
Chris@49
|
1543 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
1544 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1545
|
Chris@49
|
1546 template<typename eT2>
|
Chris@49
|
1547 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
1548
|
Chris@49
|
1549 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
1550 };
|
Chris@49
|
1551
|
Chris@49
|
1552
|
Chris@49
|
1553
|
Chris@49
|
1554 template<typename eT, typename T1, typename T2>
|
Chris@49
|
1555 class Proxy< subview_elem2<eT,T1,T2> >
|
Chris@49
|
1556 {
|
Chris@49
|
1557 public:
|
Chris@49
|
1558
|
Chris@49
|
1559 typedef eT elem_type;
|
Chris@49
|
1560 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1561 typedef Mat<eT> stored_type;
|
Chris@49
|
1562 typedef const eT* ea_type;
|
Chris@49
|
1563 typedef const Mat<eT>& aligned_ea_type;
|
Chris@49
|
1564
|
Chris@49
|
1565 static const bool prefer_at_accessor = false;
|
Chris@49
|
1566 static const bool has_subview = false;
|
Chris@49
|
1567 static const bool is_fixed = false;
|
Chris@49
|
1568 static const bool fake_mat = false;
|
Chris@49
|
1569
|
Chris@49
|
1570 static const bool is_row = false;
|
Chris@49
|
1571 static const bool is_col = false;
|
Chris@49
|
1572
|
Chris@49
|
1573 arma_aligned const Mat<eT> Q;
|
Chris@49
|
1574
|
Chris@49
|
1575 inline explicit Proxy(const subview_elem2<eT,T1,T2>& A)
|
Chris@49
|
1576 : Q(A)
|
Chris@49
|
1577 {
|
Chris@49
|
1578 arma_extra_debug_sigprint();
|
Chris@49
|
1579 }
|
Chris@49
|
1580
|
Chris@49
|
1581 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
1582 arma_inline uword get_n_cols() const { return Q.n_cols; }
|
Chris@49
|
1583 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1584
|
Chris@49
|
1585 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1586 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
1587 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1588
|
Chris@49
|
1589 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
1590 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1591
|
Chris@49
|
1592 template<typename eT2>
|
Chris@49
|
1593 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
1594
|
Chris@49
|
1595 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
1596 };
|
Chris@49
|
1597
|
Chris@49
|
1598
|
Chris@49
|
1599
|
Chris@49
|
1600 template<typename eT>
|
Chris@49
|
1601 class Proxy< diagview<eT> >
|
Chris@49
|
1602 {
|
Chris@49
|
1603 public:
|
Chris@49
|
1604
|
Chris@49
|
1605 typedef eT elem_type;
|
Chris@49
|
1606 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1607 typedef diagview<eT> stored_type;
|
Chris@49
|
1608 typedef const diagview<eT>& ea_type;
|
Chris@49
|
1609 typedef const diagview<eT>& aligned_ea_type;
|
Chris@49
|
1610
|
Chris@49
|
1611 static const bool prefer_at_accessor = false;
|
Chris@49
|
1612 static const bool has_subview = true;
|
Chris@49
|
1613 static const bool is_fixed = false;
|
Chris@49
|
1614 static const bool fake_mat = false;
|
Chris@49
|
1615
|
Chris@49
|
1616 static const bool is_row = false;
|
Chris@49
|
1617 static const bool is_col = true;
|
Chris@49
|
1618
|
Chris@49
|
1619 arma_aligned const diagview<eT>& Q;
|
Chris@49
|
1620
|
Chris@49
|
1621 inline explicit Proxy(const diagview<eT>& A)
|
Chris@49
|
1622 : Q(A)
|
Chris@49
|
1623 {
|
Chris@49
|
1624 arma_extra_debug_sigprint();
|
Chris@49
|
1625 }
|
Chris@49
|
1626
|
Chris@49
|
1627 arma_inline uword get_n_rows() const { return Q.n_rows; }
|
Chris@49
|
1628 arma_inline uword get_n_cols() const { return 1; }
|
Chris@49
|
1629 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1630
|
Chris@49
|
1631 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1632 arma_inline elem_type at (const uword row, const uword) const { return Q.at(row, 0); }
|
Chris@49
|
1633 arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
Chris@49
|
1634
|
Chris@49
|
1635 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
1636 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1637
|
Chris@49
|
1638 template<typename eT2>
|
Chris@49
|
1639 arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q.m)) == void_ptr(&X)); }
|
Chris@49
|
1640
|
Chris@49
|
1641 arma_inline bool is_aligned() const { return false; }
|
Chris@49
|
1642 };
|
Chris@49
|
1643
|
Chris@49
|
1644
|
Chris@49
|
1645
|
Chris@49
|
1646
|
Chris@49
|
1647 template<typename T1, typename eop_type>
|
Chris@49
|
1648 class Proxy< eOp<T1, eop_type > >
|
Chris@49
|
1649 {
|
Chris@49
|
1650 public:
|
Chris@49
|
1651
|
Chris@49
|
1652 typedef typename T1::elem_type elem_type;
|
Chris@49
|
1653 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1654 typedef eOp<T1, eop_type> stored_type;
|
Chris@49
|
1655 typedef const eOp<T1, eop_type>& ea_type;
|
Chris@49
|
1656 typedef const eOp<T1, eop_type>& aligned_ea_type;
|
Chris@49
|
1657
|
Chris@49
|
1658 static const bool prefer_at_accessor = eOp<T1, eop_type>::prefer_at_accessor;
|
Chris@49
|
1659 static const bool has_subview = eOp<T1, eop_type>::has_subview;
|
Chris@49
|
1660 static const bool is_fixed = eOp<T1, eop_type>::is_fixed;
|
Chris@49
|
1661 static const bool fake_mat = eOp<T1, eop_type>::fake_mat;
|
Chris@49
|
1662
|
Chris@49
|
1663 static const bool is_row = eOp<T1, eop_type>::is_row;
|
Chris@49
|
1664 static const bool is_col = eOp<T1, eop_type>::is_col;
|
Chris@49
|
1665
|
Chris@49
|
1666 arma_aligned const eOp<T1, eop_type>& Q;
|
Chris@49
|
1667
|
Chris@49
|
1668 inline explicit Proxy(const eOp<T1, eop_type>& A)
|
Chris@49
|
1669 : Q(A)
|
Chris@49
|
1670 {
|
Chris@49
|
1671 arma_extra_debug_sigprint();
|
Chris@49
|
1672 }
|
Chris@49
|
1673
|
Chris@49
|
1674 arma_inline uword get_n_rows() const { return is_row ? 1 : Q.get_n_rows(); }
|
Chris@49
|
1675 arma_inline uword get_n_cols() const { return is_col ? 1 : Q.get_n_cols(); }
|
Chris@49
|
1676 arma_inline uword get_n_elem() const { return Q.get_n_elem(); }
|
Chris@49
|
1677
|
Chris@49
|
1678 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1679 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
1680 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1681
|
Chris@49
|
1682 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
1683 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1684
|
Chris@49
|
1685 template<typename eT2>
|
Chris@49
|
1686 arma_inline bool is_alias(const Mat<eT2>& X) const { return Q.P.is_alias(X); }
|
Chris@49
|
1687
|
Chris@49
|
1688 arma_inline bool is_aligned() const { return Q.P.is_aligned(); }
|
Chris@49
|
1689 };
|
Chris@49
|
1690
|
Chris@49
|
1691
|
Chris@49
|
1692
|
Chris@49
|
1693 template<typename T1, typename T2, typename eglue_type>
|
Chris@49
|
1694 class Proxy< eGlue<T1, T2, eglue_type > >
|
Chris@49
|
1695 {
|
Chris@49
|
1696 public:
|
Chris@49
|
1697
|
Chris@49
|
1698 typedef typename T1::elem_type elem_type;
|
Chris@49
|
1699 typedef typename get_pod_type<elem_type>::result pod_type;
|
Chris@49
|
1700 typedef eGlue<T1, T2, eglue_type> stored_type;
|
Chris@49
|
1701 typedef const eGlue<T1, T2, eglue_type>& ea_type;
|
Chris@49
|
1702 typedef const eGlue<T1, T2, eglue_type>& aligned_ea_type;
|
Chris@49
|
1703
|
Chris@49
|
1704 static const bool prefer_at_accessor = eGlue<T1, T2, eglue_type>::prefer_at_accessor;
|
Chris@49
|
1705 static const bool has_subview = eGlue<T1, T2, eglue_type>::has_subview;
|
Chris@49
|
1706 static const bool is_fixed = eGlue<T1, T2, eglue_type>::is_fixed;
|
Chris@49
|
1707 static const bool fake_mat = eGlue<T1, T2, eglue_type>::fake_mat;
|
Chris@49
|
1708
|
Chris@49
|
1709 static const bool is_row = eGlue<T1, T2, eglue_type>::is_row;
|
Chris@49
|
1710 static const bool is_col = eGlue<T1, T2, eglue_type>::is_col;
|
Chris@49
|
1711
|
Chris@49
|
1712 arma_aligned const eGlue<T1, T2, eglue_type>& Q;
|
Chris@49
|
1713
|
Chris@49
|
1714 inline explicit Proxy(const eGlue<T1, T2, eglue_type>& A)
|
Chris@49
|
1715 : Q(A)
|
Chris@49
|
1716 {
|
Chris@49
|
1717 arma_extra_debug_sigprint();
|
Chris@49
|
1718 }
|
Chris@49
|
1719
|
Chris@49
|
1720 arma_inline uword get_n_rows() const { return is_row ? 1 : Q.get_n_rows(); }
|
Chris@49
|
1721 arma_inline uword get_n_cols() const { return is_col ? 1 : Q.get_n_cols(); }
|
Chris@49
|
1722 arma_inline uword get_n_elem() const { return Q.get_n_elem(); }
|
Chris@49
|
1723
|
Chris@49
|
1724 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1725 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
Chris@49
|
1726 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1727
|
Chris@49
|
1728 arma_inline ea_type get_ea() const { return Q; }
|
Chris@49
|
1729 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1730
|
Chris@49
|
1731 template<typename eT2>
|
Chris@49
|
1732 arma_inline bool is_alias(const Mat<eT2>& X) const { return (Q.P1.is_alias(X) || Q.P2.is_alias(X)); }
|
Chris@49
|
1733
|
Chris@49
|
1734 arma_inline bool is_aligned() const { return (Q.P1.is_aligned() && Q.P2.is_aligned()); }
|
Chris@49
|
1735 };
|
Chris@49
|
1736
|
Chris@49
|
1737
|
Chris@49
|
1738
|
Chris@49
|
1739 template<typename out_eT, typename T1, typename op_type>
|
Chris@49
|
1740 class Proxy< mtOp<out_eT, T1, op_type> >
|
Chris@49
|
1741 {
|
Chris@49
|
1742 public:
|
Chris@49
|
1743
|
Chris@49
|
1744 typedef out_eT elem_type;
|
Chris@49
|
1745 typedef typename get_pod_type<out_eT>::result pod_type;
|
Chris@49
|
1746 typedef Mat<out_eT> stored_type;
|
Chris@49
|
1747 typedef const elem_type* ea_type;
|
Chris@49
|
1748 typedef const Mat<out_eT>& aligned_ea_type;
|
Chris@49
|
1749
|
Chris@49
|
1750 static const bool prefer_at_accessor = false;
|
Chris@49
|
1751 static const bool has_subview = false;
|
Chris@49
|
1752 static const bool is_fixed = false;
|
Chris@49
|
1753 static const bool fake_mat = false;
|
Chris@49
|
1754
|
Chris@49
|
1755 static const bool is_row = mtOp<out_eT, T1, op_type>::is_row;
|
Chris@49
|
1756 static const bool is_col = mtOp<out_eT, T1, op_type>::is_col;
|
Chris@49
|
1757
|
Chris@49
|
1758 arma_aligned const Mat<out_eT> Q;
|
Chris@49
|
1759
|
Chris@49
|
1760 inline explicit Proxy(const mtOp<out_eT, T1, op_type>& A)
|
Chris@49
|
1761 : Q(A)
|
Chris@49
|
1762 {
|
Chris@49
|
1763 arma_extra_debug_sigprint();
|
Chris@49
|
1764 }
|
Chris@49
|
1765
|
Chris@49
|
1766 arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
|
Chris@49
|
1767 arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; }
|
Chris@49
|
1768 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1769
|
Chris@49
|
1770 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1771 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row,col); }
|
Chris@49
|
1772 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1773
|
Chris@49
|
1774 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
1775 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1776
|
Chris@49
|
1777 template<typename eT2>
|
Chris@49
|
1778 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
1779
|
Chris@49
|
1780 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
1781 };
|
Chris@49
|
1782
|
Chris@49
|
1783
|
Chris@49
|
1784
|
Chris@49
|
1785 template<typename out_eT, typename T1, typename T2, typename glue_type>
|
Chris@49
|
1786 class Proxy< mtGlue<out_eT, T1, T2, glue_type > >
|
Chris@49
|
1787 {
|
Chris@49
|
1788 public:
|
Chris@49
|
1789
|
Chris@49
|
1790 typedef out_eT elem_type;
|
Chris@49
|
1791 typedef typename get_pod_type<out_eT>::result pod_type;
|
Chris@49
|
1792 typedef Mat<out_eT> stored_type;
|
Chris@49
|
1793 typedef const elem_type* ea_type;
|
Chris@49
|
1794 typedef const Mat<out_eT>& aligned_ea_type;
|
Chris@49
|
1795
|
Chris@49
|
1796 static const bool prefer_at_accessor = false;
|
Chris@49
|
1797 static const bool has_subview = false;
|
Chris@49
|
1798 static const bool is_fixed = false;
|
Chris@49
|
1799 static const bool fake_mat = false;
|
Chris@49
|
1800
|
Chris@49
|
1801 static const bool is_row = mtGlue<out_eT, T1, T2, glue_type>::is_row;
|
Chris@49
|
1802 static const bool is_col = mtGlue<out_eT, T1, T2, glue_type>::is_col;
|
Chris@49
|
1803
|
Chris@49
|
1804 arma_aligned const Mat<out_eT> Q;
|
Chris@49
|
1805
|
Chris@49
|
1806 inline explicit Proxy(const mtGlue<out_eT, T1, T2, glue_type>& A)
|
Chris@49
|
1807 : Q(A)
|
Chris@49
|
1808 {
|
Chris@49
|
1809 arma_extra_debug_sigprint();
|
Chris@49
|
1810 }
|
Chris@49
|
1811
|
Chris@49
|
1812 arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
|
Chris@49
|
1813 arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; }
|
Chris@49
|
1814 arma_inline uword get_n_elem() const { return Q.n_elem; }
|
Chris@49
|
1815
|
Chris@49
|
1816 arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
Chris@49
|
1817 arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row,col); }
|
Chris@49
|
1818 arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
Chris@49
|
1819
|
Chris@49
|
1820 arma_inline ea_type get_ea() const { return Q.memptr(); }
|
Chris@49
|
1821 arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
Chris@49
|
1822
|
Chris@49
|
1823 template<typename eT2>
|
Chris@49
|
1824 arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
|
Chris@49
|
1825
|
Chris@49
|
1826 arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
Chris@49
|
1827 };
|
Chris@49
|
1828
|
Chris@49
|
1829
|
Chris@49
|
1830
|
Chris@49
|
1831 //! @}
|