comparison armadillo-3.900.4/include/armadillo_bits/Proxy.hpp @ 49:1ec0e2823891

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