Mercurial > hg > segmenter-vamp-plugin
comparison armadillo-2.4.4/include/armadillo_bits/unwrap.hpp @ 0:8b6102e2a9b0
Armadillo Library
author | maxzanoni76 <max.zanoni@eecs.qmul.ac.uk> |
---|---|
date | Wed, 11 Apr 2012 09:27:06 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8b6102e2a9b0 |
---|---|
1 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) | |
2 // Copyright (C) 2008-2011 Conrad Sanderson | |
3 // | |
4 // This file is part of the Armadillo C++ library. | |
5 // It is provided without any warranty of fitness | |
6 // for any purpose. You can redistribute this file | |
7 // and/or modify it under the terms of the GNU | |
8 // Lesser General Public License (LGPL) as published | |
9 // by the Free Software Foundation, either version 3 | |
10 // of the License or (at your option) any later version. | |
11 // (see http://www.opensource.org/licenses for more info) | |
12 | |
13 | |
14 //! \addtogroup unwrap | |
15 //! @{ | |
16 | |
17 | |
18 | |
19 template<typename T1> | |
20 class unwrap | |
21 { | |
22 public: | |
23 | |
24 typedef typename T1::elem_type eT; | |
25 | |
26 inline unwrap(const T1& A) // TODO: change this to Base ? | |
27 : M(A) | |
28 { | |
29 arma_extra_debug_sigprint(); | |
30 } | |
31 | |
32 const Mat<eT> M; | |
33 }; | |
34 | |
35 | |
36 | |
37 template<typename eT> | |
38 class unwrap< Mat<eT> > | |
39 { | |
40 public: | |
41 | |
42 inline unwrap(const Mat<eT>& A) | |
43 : M(A) | |
44 { | |
45 arma_extra_debug_sigprint(); | |
46 } | |
47 | |
48 const Mat<eT>& M; | |
49 }; | |
50 | |
51 | |
52 | |
53 template<typename eT> | |
54 class unwrap< Row<eT> > | |
55 { | |
56 public: | |
57 | |
58 inline unwrap(const Row<eT>& A) | |
59 : M(A) | |
60 { | |
61 arma_extra_debug_sigprint(); | |
62 } | |
63 | |
64 const Row<eT>& M; | |
65 }; | |
66 | |
67 | |
68 | |
69 template<typename eT> | |
70 class unwrap< Col<eT> > | |
71 { | |
72 public: | |
73 | |
74 inline unwrap(const Col<eT>& A) | |
75 : M(A) | |
76 { | |
77 arma_extra_debug_sigprint(); | |
78 } | |
79 | |
80 const Col<eT>& M; | |
81 }; | |
82 | |
83 | |
84 | |
85 template<typename out_eT, typename T1, typename T2, typename glue_type> | |
86 class unwrap< mtGlue<out_eT, T1, T2, glue_type> > | |
87 { | |
88 public: | |
89 | |
90 inline unwrap(const mtGlue<out_eT, T1, T2, glue_type>& A) | |
91 : M(A) | |
92 { | |
93 arma_extra_debug_sigprint(); | |
94 } | |
95 | |
96 const Mat<out_eT> M; | |
97 }; | |
98 | |
99 | |
100 template<typename out_eT, typename T1, typename op_type> | |
101 class unwrap< mtOp<out_eT, T1, op_type> > | |
102 { | |
103 public: | |
104 | |
105 inline unwrap(const mtOp<out_eT, T1, op_type>& A) | |
106 : M(A) | |
107 { | |
108 arma_extra_debug_sigprint(); | |
109 } | |
110 | |
111 const Mat<out_eT> M; | |
112 }; | |
113 | |
114 | |
115 | |
116 // | |
117 // | |
118 // | |
119 | |
120 | |
121 template<typename T1> | |
122 class unwrap_check | |
123 { | |
124 public: | |
125 | |
126 typedef typename T1::elem_type eT; | |
127 | |
128 inline | |
129 unwrap_check(const T1& A, const Mat<eT>& B) | |
130 : M(A) | |
131 { | |
132 arma_extra_debug_sigprint(); | |
133 arma_ignore(B); | |
134 } | |
135 | |
136 inline | |
137 ~unwrap_check() | |
138 { | |
139 arma_extra_debug_sigprint(); | |
140 } | |
141 | |
142 const Mat<eT> M; | |
143 }; | |
144 | |
145 | |
146 | |
147 template<typename eT> | |
148 class unwrap_check< Mat<eT> > | |
149 { | |
150 public: | |
151 | |
152 inline | |
153 unwrap_check(const Mat<eT>& A, const Mat<eT>& B) | |
154 : M_local( (&A == &B) ? new Mat<eT>(A) : 0 ) | |
155 , M ( (&A == &B) ? (*M_local) : A ) | |
156 { | |
157 arma_extra_debug_sigprint(); | |
158 } | |
159 | |
160 | |
161 inline | |
162 ~unwrap_check() | |
163 { | |
164 arma_extra_debug_sigprint(); | |
165 | |
166 if(M_local) | |
167 { | |
168 delete M_local; | |
169 } | |
170 } | |
171 | |
172 | |
173 // the order below is important | |
174 const Mat<eT>* M_local; | |
175 const Mat<eT>& M; | |
176 }; | |
177 | |
178 | |
179 | |
180 template<typename eT> | |
181 class unwrap_check< Row<eT> > | |
182 { | |
183 public: | |
184 | |
185 inline | |
186 unwrap_check(const Row<eT>& A, const Mat<eT>& B) | |
187 : M_local( (&A == reinterpret_cast<const Row<eT>*>(&B)) ? new Row<eT>(A) : 0 ) | |
188 , M ( (&A == reinterpret_cast<const Row<eT>*>(&B)) ? (*M_local) : A ) | |
189 { | |
190 arma_extra_debug_sigprint(); | |
191 } | |
192 | |
193 | |
194 inline | |
195 ~unwrap_check() | |
196 { | |
197 arma_extra_debug_sigprint(); | |
198 | |
199 if(M_local) | |
200 { | |
201 delete M_local; | |
202 } | |
203 } | |
204 | |
205 | |
206 // the order below is important | |
207 const Row<eT>* M_local; | |
208 const Row<eT>& M; | |
209 }; | |
210 | |
211 | |
212 | |
213 template<typename eT> | |
214 class unwrap_check< Col<eT> > | |
215 { | |
216 public: | |
217 | |
218 inline | |
219 unwrap_check(const Col<eT>& A, const Mat<eT>& B) | |
220 : M_local( (&A == reinterpret_cast<const Col<eT>*>(&B)) ? new Col<eT>(A) : 0 ) | |
221 , M ( (&A == reinterpret_cast<const Col<eT>*>(&B)) ? (*M_local) : A ) | |
222 { | |
223 arma_extra_debug_sigprint(); | |
224 } | |
225 | |
226 | |
227 inline | |
228 ~unwrap_check() | |
229 { | |
230 arma_extra_debug_sigprint(); | |
231 | |
232 if(M_local) | |
233 { | |
234 delete M_local; | |
235 } | |
236 } | |
237 | |
238 | |
239 // the order below is important | |
240 const Col<eT>* M_local; | |
241 const Col<eT>& M; | |
242 | |
243 }; | |
244 | |
245 | |
246 | |
247 // | |
248 // | |
249 // | |
250 | |
251 | |
252 | |
253 template<typename T1> | |
254 class unwrap_check_mixed | |
255 { | |
256 public: | |
257 | |
258 typedef typename T1::elem_type eT1; | |
259 | |
260 template<typename eT2> | |
261 inline | |
262 unwrap_check_mixed(const T1& A, const Mat<eT2>& B) | |
263 : M(A) | |
264 { | |
265 arma_extra_debug_sigprint(); | |
266 arma_ignore(B); | |
267 } | |
268 | |
269 inline | |
270 ~unwrap_check_mixed() | |
271 { | |
272 arma_extra_debug_sigprint(); | |
273 } | |
274 | |
275 const Mat<eT1> M; | |
276 }; | |
277 | |
278 | |
279 | |
280 template<typename eT1> | |
281 class unwrap_check_mixed< Mat<eT1> > | |
282 { | |
283 public: | |
284 | |
285 template<typename eT2> | |
286 inline | |
287 unwrap_check_mixed(const Mat<eT1>& A, const Mat<eT2>& B) | |
288 : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Mat<eT1>(A) : 0 ) | |
289 , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) | |
290 { | |
291 arma_extra_debug_sigprint(); | |
292 } | |
293 | |
294 | |
295 inline | |
296 ~unwrap_check_mixed() | |
297 { | |
298 arma_extra_debug_sigprint(); | |
299 | |
300 if(M_local) | |
301 { | |
302 delete M_local; | |
303 } | |
304 } | |
305 | |
306 | |
307 // the order below is important | |
308 const Mat<eT1>* M_local; | |
309 const Mat<eT1>& M; | |
310 }; | |
311 | |
312 | |
313 | |
314 template<typename eT1> | |
315 class unwrap_check_mixed< Row<eT1> > | |
316 { | |
317 public: | |
318 | |
319 template<typename eT2> | |
320 inline | |
321 unwrap_check_mixed(const Row<eT1>& A, const Mat<eT2>& B) | |
322 : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Row<eT1>(A) : 0 ) | |
323 , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) | |
324 { | |
325 arma_extra_debug_sigprint(); | |
326 } | |
327 | |
328 | |
329 inline | |
330 ~unwrap_check_mixed() | |
331 { | |
332 arma_extra_debug_sigprint(); | |
333 | |
334 if(M_local) | |
335 { | |
336 delete M_local; | |
337 } | |
338 } | |
339 | |
340 | |
341 // the order below is important | |
342 const Row<eT1>* M_local; | |
343 const Row<eT1>& M; | |
344 }; | |
345 | |
346 | |
347 | |
348 template<typename eT1> | |
349 class unwrap_check_mixed< Col<eT1> > | |
350 { | |
351 public: | |
352 | |
353 template<typename eT2> | |
354 inline | |
355 unwrap_check_mixed(const Col<eT1>& A, const Mat<eT2>& B) | |
356 : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Col<eT1>(A) : 0 ) | |
357 , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) | |
358 { | |
359 arma_extra_debug_sigprint(); | |
360 } | |
361 | |
362 | |
363 inline | |
364 ~unwrap_check_mixed() | |
365 { | |
366 arma_extra_debug_sigprint(); | |
367 | |
368 if(M_local) | |
369 { | |
370 delete M_local; | |
371 } | |
372 } | |
373 | |
374 | |
375 // the order below is important | |
376 const Col<eT1>* M_local; | |
377 const Col<eT1>& M; | |
378 }; | |
379 | |
380 | |
381 | |
382 // | |
383 | |
384 | |
385 | |
386 template<typename T1> | |
387 class partial_unwrap | |
388 { | |
389 public: | |
390 | |
391 typedef typename T1::elem_type eT; | |
392 | |
393 inline partial_unwrap(const T1& A) // TODO: change this to Base ? | |
394 : M(A) | |
395 { | |
396 arma_extra_debug_sigprint(); | |
397 } | |
398 | |
399 | |
400 inline | |
401 ~partial_unwrap() | |
402 { | |
403 arma_extra_debug_sigprint(); | |
404 } | |
405 | |
406 | |
407 inline eT get_val() const { return eT(1); } | |
408 | |
409 | |
410 static const bool do_trans = false; | |
411 static const bool do_times = false; | |
412 | |
413 const Mat<eT> M; | |
414 }; | |
415 | |
416 | |
417 | |
418 template<typename eT> | |
419 class partial_unwrap< Mat<eT> > | |
420 { | |
421 public: | |
422 | |
423 inline | |
424 partial_unwrap(const Mat<eT>& A) | |
425 : M(A) | |
426 { | |
427 arma_extra_debug_sigprint(); | |
428 } | |
429 | |
430 | |
431 inline | |
432 ~partial_unwrap() | |
433 { | |
434 arma_extra_debug_sigprint(); | |
435 } | |
436 | |
437 | |
438 inline eT get_val() const { return eT(1); } | |
439 | |
440 | |
441 static const bool do_trans = false; | |
442 static const bool do_times = false; | |
443 | |
444 const Mat<eT>& M; | |
445 }; | |
446 | |
447 | |
448 | |
449 template<typename eT> | |
450 class partial_unwrap< Row<eT> > | |
451 { | |
452 public: | |
453 | |
454 inline | |
455 partial_unwrap(const Row<eT>& A) | |
456 : M(A) | |
457 { | |
458 arma_extra_debug_sigprint(); | |
459 } | |
460 | |
461 | |
462 inline | |
463 ~partial_unwrap() | |
464 { | |
465 arma_extra_debug_sigprint(); | |
466 } | |
467 | |
468 | |
469 inline eT get_val() const { return eT(1); } | |
470 | |
471 | |
472 static const bool do_trans = false; | |
473 static const bool do_times = false; | |
474 | |
475 const Mat<eT>& M; | |
476 }; | |
477 | |
478 | |
479 | |
480 template<typename eT> | |
481 class partial_unwrap< Col<eT> > | |
482 { | |
483 public: | |
484 | |
485 inline | |
486 partial_unwrap(const Col<eT>& A) | |
487 : M(A) | |
488 { | |
489 arma_extra_debug_sigprint(); | |
490 } | |
491 | |
492 | |
493 inline | |
494 ~partial_unwrap() | |
495 { | |
496 arma_extra_debug_sigprint(); | |
497 } | |
498 | |
499 | |
500 inline eT get_val() const { return eT(1); } | |
501 | |
502 | |
503 static const bool do_trans = false; | |
504 static const bool do_times = false; | |
505 | |
506 const Mat<eT>& M; | |
507 }; | |
508 | |
509 | |
510 | |
511 template<typename T1> | |
512 class partial_unwrap< Op<T1, op_htrans> > | |
513 { | |
514 public: | |
515 | |
516 typedef typename T1::elem_type eT; | |
517 | |
518 inline | |
519 partial_unwrap(const Op<T1,op_htrans>& A) | |
520 : M(A.m) | |
521 { | |
522 arma_extra_debug_sigprint(); | |
523 } | |
524 | |
525 inline | |
526 ~partial_unwrap() | |
527 { | |
528 arma_extra_debug_sigprint(); | |
529 } | |
530 | |
531 | |
532 inline eT get_val() const { return eT(1); } | |
533 | |
534 | |
535 static const bool do_trans = true; | |
536 static const bool do_times = false; | |
537 | |
538 const Mat<eT> M; | |
539 }; | |
540 | |
541 | |
542 | |
543 template<typename eT> | |
544 class partial_unwrap< Op< Mat<eT>, op_htrans> > | |
545 { | |
546 public: | |
547 | |
548 inline | |
549 partial_unwrap(const Op< Mat<eT>, op_htrans>& A) | |
550 : M(A.m) | |
551 { | |
552 arma_extra_debug_sigprint(); | |
553 } | |
554 | |
555 | |
556 inline | |
557 ~partial_unwrap() | |
558 { | |
559 arma_extra_debug_sigprint(); | |
560 } | |
561 | |
562 | |
563 inline eT get_val() const { return eT(1); } | |
564 | |
565 | |
566 static const bool do_trans = true; | |
567 static const bool do_times = false; | |
568 | |
569 const Mat<eT>& M; | |
570 }; | |
571 | |
572 | |
573 | |
574 template<typename eT> | |
575 class partial_unwrap< Op< Row<eT>, op_htrans> > | |
576 { | |
577 public: | |
578 | |
579 inline | |
580 partial_unwrap(const Op< Row<eT>, op_htrans>& A) | |
581 : M(A.m) | |
582 { | |
583 arma_extra_debug_sigprint(); | |
584 } | |
585 | |
586 inline | |
587 ~partial_unwrap() | |
588 { | |
589 arma_extra_debug_sigprint(); | |
590 } | |
591 | |
592 | |
593 inline eT get_val() const { return eT(1); } | |
594 | |
595 | |
596 static const bool do_trans = true; | |
597 static const bool do_times = false; | |
598 | |
599 const Mat<eT>& M; | |
600 }; | |
601 | |
602 | |
603 | |
604 template<typename eT> | |
605 class partial_unwrap< Op< Col<eT>, op_htrans> > | |
606 { | |
607 public: | |
608 | |
609 inline | |
610 partial_unwrap(const Op< Col<eT>, op_htrans>& A) | |
611 : M(A.m) | |
612 { | |
613 arma_extra_debug_sigprint(); | |
614 } | |
615 | |
616 inline | |
617 ~partial_unwrap() | |
618 { | |
619 arma_extra_debug_sigprint(); | |
620 } | |
621 | |
622 | |
623 inline eT get_val() const { return eT(1); } | |
624 | |
625 | |
626 static const bool do_trans = true; | |
627 static const bool do_times = false; | |
628 | |
629 const Mat<eT>& M; | |
630 }; | |
631 | |
632 | |
633 | |
634 template<typename T1> | |
635 class partial_unwrap< Op<T1, op_htrans2> > | |
636 { | |
637 public: | |
638 | |
639 typedef typename T1::elem_type eT; | |
640 | |
641 inline | |
642 partial_unwrap(const Op<T1,op_htrans2>& A) | |
643 : val(A.aux) | |
644 , M (A.m) | |
645 { | |
646 arma_extra_debug_sigprint(); | |
647 } | |
648 | |
649 inline | |
650 ~partial_unwrap() | |
651 { | |
652 arma_extra_debug_sigprint(); | |
653 } | |
654 | |
655 | |
656 inline eT get_val() const { return val; } | |
657 | |
658 | |
659 static const bool do_trans = true; | |
660 static const bool do_times = true; | |
661 | |
662 const eT val; | |
663 const Mat<eT> M; | |
664 }; | |
665 | |
666 | |
667 | |
668 template<typename eT> | |
669 class partial_unwrap< Op< Mat<eT>, op_htrans2> > | |
670 { | |
671 public: | |
672 | |
673 inline | |
674 partial_unwrap(const Op< Mat<eT>, op_htrans2>& A) | |
675 : val(A.aux) | |
676 , M (A.m) | |
677 { | |
678 arma_extra_debug_sigprint(); | |
679 } | |
680 | |
681 inline | |
682 ~partial_unwrap() | |
683 { | |
684 arma_extra_debug_sigprint(); | |
685 } | |
686 | |
687 | |
688 inline eT get_val() const { return val; } | |
689 | |
690 | |
691 static const bool do_trans = true; | |
692 static const bool do_times = true; | |
693 | |
694 const eT val; | |
695 const Mat<eT>& M; | |
696 }; | |
697 | |
698 | |
699 | |
700 template<typename eT> | |
701 class partial_unwrap< Op< Row<eT>, op_htrans2> > | |
702 { | |
703 public: | |
704 | |
705 inline | |
706 partial_unwrap(const Op< Row<eT>, op_htrans2>& A) | |
707 : val(A.aux) | |
708 , M (A.m) | |
709 { | |
710 arma_extra_debug_sigprint(); | |
711 } | |
712 | |
713 inline | |
714 ~partial_unwrap() | |
715 { | |
716 arma_extra_debug_sigprint(); | |
717 } | |
718 | |
719 | |
720 inline eT get_val() const { return val; } | |
721 | |
722 | |
723 static const bool do_trans = true; | |
724 static const bool do_times = true; | |
725 | |
726 const eT val; | |
727 const Mat<eT>& M; | |
728 }; | |
729 | |
730 | |
731 | |
732 template<typename eT> | |
733 class partial_unwrap< Op< Col<eT>, op_htrans2> > | |
734 { | |
735 public: | |
736 | |
737 inline | |
738 partial_unwrap(const Op< Col<eT>, op_htrans2>& A) | |
739 : val(A.aux) | |
740 , M (A.m) | |
741 { | |
742 arma_extra_debug_sigprint(); | |
743 } | |
744 | |
745 inline | |
746 ~partial_unwrap() | |
747 { | |
748 arma_extra_debug_sigprint(); | |
749 } | |
750 | |
751 | |
752 inline eT get_val() const { return val; } | |
753 | |
754 | |
755 static const bool do_trans = true; | |
756 static const bool do_times = true; | |
757 | |
758 const eT val; | |
759 const Mat<eT>& M; | |
760 }; | |
761 | |
762 | |
763 | |
764 template<typename T1> | |
765 class partial_unwrap< eOp<T1, eop_scalar_times> > | |
766 { | |
767 public: | |
768 | |
769 typedef typename T1::elem_type eT; | |
770 | |
771 inline | |
772 partial_unwrap(const eOp<T1,eop_scalar_times>& A) | |
773 : val(A.aux) | |
774 , M (A.P.Q) | |
775 { | |
776 arma_extra_debug_sigprint(); | |
777 } | |
778 | |
779 inline | |
780 ~partial_unwrap() | |
781 { | |
782 arma_extra_debug_sigprint(); | |
783 } | |
784 | |
785 | |
786 inline eT get_val() const { return val; } | |
787 | |
788 | |
789 static const bool do_trans = false; | |
790 static const bool do_times = true; | |
791 | |
792 const eT val; | |
793 const Mat<eT> M; | |
794 }; | |
795 | |
796 | |
797 | |
798 template<typename eT> | |
799 class partial_unwrap< eOp<Mat<eT>, eop_scalar_times> > | |
800 { | |
801 public: | |
802 | |
803 inline | |
804 partial_unwrap(const eOp<Mat<eT>,eop_scalar_times>& A) | |
805 : val(A.aux) | |
806 , M (A.P.Q) | |
807 { | |
808 arma_extra_debug_sigprint(); | |
809 } | |
810 | |
811 inline | |
812 ~partial_unwrap() | |
813 { | |
814 arma_extra_debug_sigprint(); | |
815 } | |
816 | |
817 | |
818 inline eT get_val() const { return val; } | |
819 | |
820 | |
821 static const bool do_trans = false; | |
822 static const bool do_times = true; | |
823 | |
824 const eT val; | |
825 const Mat<eT>& M; | |
826 }; | |
827 | |
828 | |
829 | |
830 template<typename eT> | |
831 class partial_unwrap< eOp<Row<eT>, eop_scalar_times> > | |
832 { | |
833 public: | |
834 | |
835 inline | |
836 partial_unwrap(const eOp<Row<eT>,eop_scalar_times>& A) | |
837 : val(A.aux) | |
838 , M (A.P.Q) | |
839 { | |
840 arma_extra_debug_sigprint(); | |
841 } | |
842 | |
843 inline | |
844 ~partial_unwrap() | |
845 { | |
846 arma_extra_debug_sigprint(); | |
847 } | |
848 | |
849 | |
850 inline eT get_val() const { return val; } | |
851 | |
852 | |
853 static const bool do_trans = false; | |
854 static const bool do_times = true; | |
855 | |
856 const eT val; | |
857 const Mat<eT>& M; | |
858 }; | |
859 | |
860 | |
861 | |
862 template<typename eT> | |
863 class partial_unwrap< eOp<Col<eT>, eop_scalar_times> > | |
864 { | |
865 public: | |
866 | |
867 inline | |
868 partial_unwrap(const eOp<Col<eT>,eop_scalar_times>& A) | |
869 : val(A.aux) | |
870 , M (A.P.Q) | |
871 { | |
872 arma_extra_debug_sigprint(); | |
873 } | |
874 | |
875 inline | |
876 ~partial_unwrap() | |
877 { | |
878 arma_extra_debug_sigprint(); | |
879 } | |
880 | |
881 | |
882 inline eT get_val() const { return val; } | |
883 | |
884 | |
885 static const bool do_trans = false; | |
886 static const bool do_times = true; | |
887 | |
888 const eT val; | |
889 const Mat<eT>& M; | |
890 }; | |
891 | |
892 | |
893 | |
894 // | |
895 | |
896 | |
897 | |
898 template<typename T1> | |
899 class partial_unwrap_check | |
900 { | |
901 public: | |
902 | |
903 typedef typename T1::elem_type eT; | |
904 | |
905 inline partial_unwrap_check(const T1& A, const Mat<eT>& B) | |
906 : M(A) | |
907 { | |
908 arma_extra_debug_sigprint(); | |
909 arma_ignore(B); | |
910 } | |
911 | |
912 | |
913 inline | |
914 ~partial_unwrap_check() | |
915 { | |
916 arma_extra_debug_sigprint(); | |
917 } | |
918 | |
919 | |
920 inline eT get_val() const { return eT(1); } | |
921 | |
922 | |
923 static const bool do_trans = false; | |
924 static const bool do_times = false; | |
925 | |
926 const Mat<eT> M; | |
927 }; | |
928 | |
929 | |
930 | |
931 template<typename eT> | |
932 class partial_unwrap_check< Mat<eT> > | |
933 { | |
934 public: | |
935 | |
936 inline | |
937 partial_unwrap_check(const Mat<eT>& A, const Mat<eT>& B) | |
938 : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) | |
939 , M ( (&A == &B) ? (*M_local) : A ) | |
940 { | |
941 arma_extra_debug_sigprint(); | |
942 } | |
943 | |
944 | |
945 inline | |
946 ~partial_unwrap_check() | |
947 { | |
948 arma_extra_debug_sigprint(); | |
949 | |
950 if(M_local) | |
951 { | |
952 delete M_local; | |
953 } | |
954 } | |
955 | |
956 | |
957 inline eT get_val() const { return eT(1); } | |
958 | |
959 | |
960 static const bool do_trans = false; | |
961 static const bool do_times = false; | |
962 | |
963 // the order below is important | |
964 const Mat<eT>* M_local; | |
965 const Mat<eT>& M; | |
966 }; | |
967 | |
968 | |
969 | |
970 template<typename eT> | |
971 class partial_unwrap_check< Row<eT> > | |
972 { | |
973 public: | |
974 | |
975 inline | |
976 partial_unwrap_check(const Row<eT>& A, const Mat<eT>& B) | |
977 : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) | |
978 , M ( (&A == &B) ? (*M_local) : A ) | |
979 { | |
980 arma_extra_debug_sigprint(); | |
981 } | |
982 | |
983 | |
984 inline | |
985 ~partial_unwrap_check() | |
986 { | |
987 arma_extra_debug_sigprint(); | |
988 | |
989 if(M_local) | |
990 { | |
991 delete M_local; | |
992 } | |
993 } | |
994 | |
995 | |
996 inline eT get_val() const { return eT(1); } | |
997 | |
998 | |
999 static const bool do_trans = false; | |
1000 static const bool do_times = false; | |
1001 | |
1002 // the order below is important | |
1003 const Mat<eT>* M_local; | |
1004 const Mat<eT>& M; | |
1005 }; | |
1006 | |
1007 | |
1008 | |
1009 template<typename eT> | |
1010 class partial_unwrap_check< Col<eT> > | |
1011 { | |
1012 public: | |
1013 | |
1014 inline | |
1015 partial_unwrap_check(const Col<eT>& A, const Mat<eT>& B) | |
1016 : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) | |
1017 , M ( (&A == &B) ? (*M_local) : A ) | |
1018 { | |
1019 arma_extra_debug_sigprint(); | |
1020 } | |
1021 | |
1022 | |
1023 inline | |
1024 ~partial_unwrap_check() | |
1025 { | |
1026 arma_extra_debug_sigprint(); | |
1027 | |
1028 if(M_local) | |
1029 { | |
1030 delete M_local; | |
1031 } | |
1032 } | |
1033 | |
1034 | |
1035 inline eT get_val() const { return eT(1); } | |
1036 | |
1037 | |
1038 static const bool do_trans = false; | |
1039 static const bool do_times = false; | |
1040 | |
1041 // the order below is important | |
1042 const Mat<eT>* M_local; | |
1043 const Mat<eT>& M; | |
1044 }; | |
1045 | |
1046 | |
1047 | |
1048 template<typename T1> | |
1049 class partial_unwrap_check< Op<T1, op_htrans> > | |
1050 { | |
1051 public: | |
1052 | |
1053 typedef typename T1::elem_type eT; | |
1054 | |
1055 inline | |
1056 partial_unwrap_check(const Op<T1,op_htrans>& A, const Mat<eT>& B) | |
1057 : M(A.m) | |
1058 { | |
1059 arma_extra_debug_sigprint(); | |
1060 arma_ignore(B); | |
1061 } | |
1062 | |
1063 inline | |
1064 ~partial_unwrap_check() | |
1065 { | |
1066 arma_extra_debug_sigprint(); | |
1067 } | |
1068 | |
1069 | |
1070 inline eT get_val() const { return eT(1); } | |
1071 | |
1072 | |
1073 static const bool do_trans = true; | |
1074 static const bool do_times = false; | |
1075 | |
1076 const Mat<eT> M; | |
1077 }; | |
1078 | |
1079 | |
1080 | |
1081 template<typename eT> | |
1082 class partial_unwrap_check< Op< Mat<eT>, op_htrans> > | |
1083 { | |
1084 public: | |
1085 | |
1086 inline | |
1087 partial_unwrap_check(const Op< Mat<eT>, op_htrans>& A, const Mat<eT>& B) | |
1088 : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |
1089 , M ( (&A.m == &B) ? (*M_local) : A.m ) | |
1090 { | |
1091 arma_extra_debug_sigprint(); | |
1092 } | |
1093 | |
1094 inline | |
1095 ~partial_unwrap_check() | |
1096 { | |
1097 arma_extra_debug_sigprint(); | |
1098 | |
1099 if(M_local) | |
1100 { | |
1101 delete M_local; | |
1102 } | |
1103 } | |
1104 | |
1105 | |
1106 inline eT get_val() const { return eT(1); } | |
1107 | |
1108 | |
1109 static const bool do_trans = true; | |
1110 static const bool do_times = false; | |
1111 | |
1112 // the order below is important | |
1113 const Mat<eT>* M_local; | |
1114 const Mat<eT>& M; | |
1115 }; | |
1116 | |
1117 | |
1118 | |
1119 template<typename eT> | |
1120 class partial_unwrap_check< Op< Row<eT>, op_htrans> > | |
1121 { | |
1122 public: | |
1123 | |
1124 inline | |
1125 partial_unwrap_check(const Op< Row<eT>, op_htrans>& A, const Mat<eT>& B) | |
1126 : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |
1127 , M ( (&A.m == &B) ? (*M_local) : A.m ) | |
1128 { | |
1129 arma_extra_debug_sigprint(); | |
1130 } | |
1131 | |
1132 inline | |
1133 ~partial_unwrap_check() | |
1134 { | |
1135 arma_extra_debug_sigprint(); | |
1136 | |
1137 if(M_local) | |
1138 { | |
1139 delete M_local; | |
1140 } | |
1141 } | |
1142 | |
1143 | |
1144 inline eT get_val() const { return eT(1); } | |
1145 | |
1146 | |
1147 static const bool do_trans = true; | |
1148 static const bool do_times = false; | |
1149 | |
1150 // the order below is important | |
1151 const Mat<eT>* M_local; | |
1152 const Mat<eT>& M; | |
1153 }; | |
1154 | |
1155 | |
1156 | |
1157 template<typename eT> | |
1158 class partial_unwrap_check< Op< Col<eT>, op_htrans> > | |
1159 { | |
1160 public: | |
1161 | |
1162 inline | |
1163 partial_unwrap_check(const Op< Col<eT>, op_htrans>& A, const Mat<eT>& B) | |
1164 : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |
1165 , M ( (&A.m == &B) ? (*M_local) : A.m ) | |
1166 { | |
1167 arma_extra_debug_sigprint(); | |
1168 } | |
1169 | |
1170 inline | |
1171 ~partial_unwrap_check() | |
1172 { | |
1173 arma_extra_debug_sigprint(); | |
1174 | |
1175 if(M_local) | |
1176 { | |
1177 delete M_local; | |
1178 } | |
1179 } | |
1180 | |
1181 | |
1182 inline eT get_val() const { return eT(1); } | |
1183 | |
1184 | |
1185 static const bool do_trans = true; | |
1186 static const bool do_times = false; | |
1187 | |
1188 // the order below is important | |
1189 const Mat<eT>* M_local; | |
1190 const Mat<eT>& M; | |
1191 }; | |
1192 | |
1193 | |
1194 | |
1195 template<typename T1> | |
1196 class partial_unwrap_check< Op<T1, op_htrans2> > | |
1197 { | |
1198 public: | |
1199 | |
1200 typedef typename T1::elem_type eT; | |
1201 | |
1202 inline | |
1203 partial_unwrap_check(const Op<T1,op_htrans2>& A, const Mat<eT>& B) | |
1204 : val(A.aux) | |
1205 , M (A.m) | |
1206 { | |
1207 arma_extra_debug_sigprint(); | |
1208 } | |
1209 | |
1210 inline | |
1211 ~partial_unwrap_check() | |
1212 { | |
1213 arma_extra_debug_sigprint(); | |
1214 } | |
1215 | |
1216 | |
1217 inline eT get_val() const { return val; } | |
1218 | |
1219 | |
1220 static const bool do_trans = true; | |
1221 static const bool do_times = true; | |
1222 | |
1223 const eT val; | |
1224 const Mat<eT> M; | |
1225 }; | |
1226 | |
1227 | |
1228 | |
1229 template<typename eT> | |
1230 class partial_unwrap_check< Op< Mat<eT>, op_htrans2> > | |
1231 { | |
1232 public: | |
1233 | |
1234 inline | |
1235 partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B) | |
1236 : val (A.aux) | |
1237 , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |
1238 , M ( (&A.m == &B) ? (*M_local) : A.m ) | |
1239 { | |
1240 arma_extra_debug_sigprint(); | |
1241 } | |
1242 | |
1243 inline | |
1244 ~partial_unwrap_check() | |
1245 { | |
1246 arma_extra_debug_sigprint(); | |
1247 | |
1248 if(M_local) | |
1249 { | |
1250 delete M_local; | |
1251 } | |
1252 } | |
1253 | |
1254 | |
1255 inline eT get_val() const { return val; } | |
1256 | |
1257 | |
1258 static const bool do_trans = true; | |
1259 static const bool do_times = true; | |
1260 | |
1261 // the order below is important | |
1262 const eT val; | |
1263 const Mat<eT>* M_local; | |
1264 const Mat<eT>& M; | |
1265 }; | |
1266 | |
1267 | |
1268 | |
1269 template<typename eT> | |
1270 class partial_unwrap_check< Op< Row<eT>, op_htrans2> > | |
1271 { | |
1272 public: | |
1273 | |
1274 inline | |
1275 partial_unwrap_check(const Op< Row<eT>, op_htrans2>& A, const Mat<eT>& B) | |
1276 : val (A.aux) | |
1277 , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |
1278 , M ( (&A.m == &B) ? (*M_local) : A.m ) | |
1279 { | |
1280 arma_extra_debug_sigprint(); | |
1281 } | |
1282 | |
1283 inline | |
1284 ~partial_unwrap_check() | |
1285 { | |
1286 arma_extra_debug_sigprint(); | |
1287 | |
1288 if(M_local) | |
1289 { | |
1290 delete M_local; | |
1291 } | |
1292 } | |
1293 | |
1294 | |
1295 inline eT get_val() const { return val; } | |
1296 | |
1297 | |
1298 static const bool do_trans = true; | |
1299 static const bool do_times = true; | |
1300 | |
1301 // the order below is important | |
1302 const eT val; | |
1303 const Mat<eT>* M_local; | |
1304 const Mat<eT>& M; | |
1305 }; | |
1306 | |
1307 | |
1308 | |
1309 template<typename eT> | |
1310 class partial_unwrap_check< Op< Col<eT>, op_htrans2> > | |
1311 { | |
1312 public: | |
1313 | |
1314 inline | |
1315 partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B) | |
1316 : val (A.aux) | |
1317 , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |
1318 , M ( (&A.m == &B) ? (*M_local) : A.m ) | |
1319 { | |
1320 arma_extra_debug_sigprint(); | |
1321 } | |
1322 | |
1323 inline | |
1324 ~partial_unwrap_check() | |
1325 { | |
1326 arma_extra_debug_sigprint(); | |
1327 | |
1328 if(M_local) | |
1329 { | |
1330 delete M_local; | |
1331 } | |
1332 } | |
1333 | |
1334 | |
1335 inline eT get_val() const { return val; } | |
1336 | |
1337 | |
1338 static const bool do_trans = true; | |
1339 static const bool do_times = true; | |
1340 | |
1341 // the order below is important | |
1342 const eT val; | |
1343 const Mat<eT>* M_local; | |
1344 const Mat<eT>& M; | |
1345 }; | |
1346 | |
1347 | |
1348 | |
1349 template<typename T1> | |
1350 class partial_unwrap_check< eOp<T1, eop_scalar_times> > | |
1351 { | |
1352 public: | |
1353 | |
1354 typedef typename T1::elem_type eT; | |
1355 | |
1356 inline | |
1357 partial_unwrap_check(const eOp<T1,eop_scalar_times>& A, const Mat<eT>& B) | |
1358 : val(A.aux) | |
1359 , M (A.P.Q) | |
1360 { | |
1361 arma_extra_debug_sigprint(); | |
1362 arma_ignore(B); | |
1363 } | |
1364 | |
1365 inline | |
1366 ~partial_unwrap_check() | |
1367 { | |
1368 arma_extra_debug_sigprint(); | |
1369 } | |
1370 | |
1371 | |
1372 inline eT get_val() const { return val; } | |
1373 | |
1374 | |
1375 static const bool do_trans = false; | |
1376 static const bool do_times = true; | |
1377 | |
1378 const eT val; | |
1379 const Mat<eT> M; | |
1380 }; | |
1381 | |
1382 | |
1383 | |
1384 template<typename eT> | |
1385 class partial_unwrap_check< eOp<Mat<eT>, eop_scalar_times> > | |
1386 { | |
1387 public: | |
1388 | |
1389 inline | |
1390 partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT>& B) | |
1391 : val(A.aux) | |
1392 , M (A.P.Q) | |
1393 { | |
1394 arma_extra_debug_sigprint(); | |
1395 arma_ignore(B); | |
1396 } | |
1397 | |
1398 inline | |
1399 ~partial_unwrap_check() | |
1400 { | |
1401 arma_extra_debug_sigprint(); | |
1402 } | |
1403 | |
1404 | |
1405 inline eT get_val() const { return val; } | |
1406 | |
1407 | |
1408 static const bool do_trans = false; | |
1409 static const bool do_times = true; | |
1410 | |
1411 const eT val; | |
1412 const Mat<eT>& M; | |
1413 }; | |
1414 | |
1415 | |
1416 | |
1417 template<typename eT> | |
1418 class partial_unwrap_check< eOp<Row<eT>, eop_scalar_times> > | |
1419 { | |
1420 public: | |
1421 | |
1422 inline | |
1423 partial_unwrap_check(const eOp<Row<eT>,eop_scalar_times>& A, const Mat<eT>& B) | |
1424 : val(A.aux) | |
1425 , M (A.P.Q) | |
1426 { | |
1427 arma_extra_debug_sigprint(); | |
1428 arma_ignore(B); | |
1429 } | |
1430 | |
1431 inline | |
1432 ~partial_unwrap_check() | |
1433 { | |
1434 arma_extra_debug_sigprint(); | |
1435 } | |
1436 | |
1437 | |
1438 inline eT get_val() const { return val; } | |
1439 | |
1440 | |
1441 static const bool do_trans = false; | |
1442 static const bool do_times = true; | |
1443 | |
1444 const eT val; | |
1445 const Mat<eT>& M; | |
1446 }; | |
1447 | |
1448 | |
1449 | |
1450 template<typename eT> | |
1451 class partial_unwrap_check< eOp<Col<eT>, eop_scalar_times> > | |
1452 { | |
1453 public: | |
1454 | |
1455 inline | |
1456 partial_unwrap_check(const eOp<Col<eT>,eop_scalar_times>& A, const Mat<eT>& B) | |
1457 : val(A.aux) | |
1458 , M (A.P.Q) | |
1459 { | |
1460 arma_extra_debug_sigprint(); | |
1461 arma_ignore(B); | |
1462 } | |
1463 | |
1464 inline | |
1465 ~partial_unwrap_check() | |
1466 { | |
1467 arma_extra_debug_sigprint(); | |
1468 } | |
1469 | |
1470 | |
1471 inline eT get_val() const { return val; } | |
1472 | |
1473 | |
1474 static const bool do_trans = false; | |
1475 static const bool do_times = true; | |
1476 | |
1477 const eT val; | |
1478 const Mat<eT>& M; | |
1479 }; | |
1480 | |
1481 | |
1482 | |
1483 //! @} |