$search
00001 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2008-2011 Conrad Sanderson 00003 // 00004 // This file is part of the Armadillo C++ library. 00005 // It is provided without any warranty of fitness 00006 // for any purpose. You can redistribute this file 00007 // and/or modify it under the terms of the GNU 00008 // Lesser General Public License (LGPL) as published 00009 // by the Free Software Foundation, either version 3 00010 // of the License or (at your option) any later version. 00011 // (see http://www.opensource.org/licenses for more info) 00012 00013 00016 00017 00018 00019 template<typename T1> 00020 class unwrap 00021 { 00022 public: 00023 00024 typedef typename T1::elem_type eT; 00025 00026 inline unwrap(const T1& A) // TODO: change this to Base ? 00027 : M(A) 00028 { 00029 arma_extra_debug_sigprint(); 00030 } 00031 00032 const Mat<eT> M; 00033 }; 00034 00035 00036 00037 template<typename eT> 00038 class unwrap< Mat<eT> > 00039 { 00040 public: 00041 00042 inline unwrap(const Mat<eT>& A) 00043 : M(A) 00044 { 00045 arma_extra_debug_sigprint(); 00046 } 00047 00048 const Mat<eT>& M; 00049 }; 00050 00051 00052 00053 template<typename eT> 00054 class unwrap< Row<eT> > 00055 { 00056 public: 00057 00058 inline unwrap(const Row<eT>& A) 00059 : M(A) 00060 { 00061 arma_extra_debug_sigprint(); 00062 } 00063 00064 const Row<eT>& M; 00065 }; 00066 00067 00068 00069 template<typename eT> 00070 class unwrap< Col<eT> > 00071 { 00072 public: 00073 00074 inline unwrap(const Col<eT>& A) 00075 : M(A) 00076 { 00077 arma_extra_debug_sigprint(); 00078 } 00079 00080 const Col<eT>& M; 00081 }; 00082 00083 00084 00085 template<typename out_eT, typename T1, typename T2, typename glue_type> 00086 class unwrap< mtGlue<out_eT, T1, T2, glue_type> > 00087 { 00088 public: 00089 00090 inline unwrap(const mtGlue<out_eT, T1, T2, glue_type>& A) 00091 : M(A) 00092 { 00093 arma_extra_debug_sigprint(); 00094 } 00095 00096 const Mat<out_eT> M; 00097 }; 00098 00099 00100 template<typename out_eT, typename T1, typename op_type> 00101 class unwrap< mtOp<out_eT, T1, op_type> > 00102 { 00103 public: 00104 00105 inline unwrap(const mtOp<out_eT, T1, op_type>& A) 00106 : M(A) 00107 { 00108 arma_extra_debug_sigprint(); 00109 } 00110 00111 const Mat<out_eT> M; 00112 }; 00113 00114 00115 00116 // 00117 // 00118 // 00119 00120 00121 template<typename T1> 00122 class unwrap_check 00123 { 00124 public: 00125 00126 typedef typename T1::elem_type eT; 00127 00128 inline 00129 unwrap_check(const T1& A, const Mat<eT>& B) 00130 : M(A) 00131 { 00132 arma_extra_debug_sigprint(); 00133 arma_ignore(B); 00134 } 00135 00136 inline 00137 ~unwrap_check() 00138 { 00139 arma_extra_debug_sigprint(); 00140 } 00141 00142 const Mat<eT> M; 00143 }; 00144 00145 00146 00147 template<typename eT> 00148 class unwrap_check< Mat<eT> > 00149 { 00150 public: 00151 00152 inline 00153 unwrap_check(const Mat<eT>& A, const Mat<eT>& B) 00154 : M_local( (&A == &B) ? new Mat<eT>(A) : 0 ) 00155 , M ( (&A == &B) ? (*M_local) : A ) 00156 { 00157 arma_extra_debug_sigprint(); 00158 } 00159 00160 00161 inline 00162 ~unwrap_check() 00163 { 00164 arma_extra_debug_sigprint(); 00165 00166 if(M_local) 00167 { 00168 delete M_local; 00169 } 00170 } 00171 00172 00173 // the order below is important 00174 const Mat<eT>* M_local; 00175 const Mat<eT>& M; 00176 }; 00177 00178 00179 00180 template<typename eT> 00181 class unwrap_check< Row<eT> > 00182 { 00183 public: 00184 00185 inline 00186 unwrap_check(const Row<eT>& A, const Mat<eT>& B) 00187 : M_local( (&A == reinterpret_cast<const Row<eT>*>(&B)) ? new Row<eT>(A) : 0 ) 00188 , M ( (&A == reinterpret_cast<const Row<eT>*>(&B)) ? (*M_local) : A ) 00189 { 00190 arma_extra_debug_sigprint(); 00191 } 00192 00193 00194 inline 00195 ~unwrap_check() 00196 { 00197 arma_extra_debug_sigprint(); 00198 00199 if(M_local) 00200 { 00201 delete M_local; 00202 } 00203 } 00204 00205 00206 // the order below is important 00207 const Row<eT>* M_local; 00208 const Row<eT>& M; 00209 }; 00210 00211 00212 00213 template<typename eT> 00214 class unwrap_check< Col<eT> > 00215 { 00216 public: 00217 00218 inline 00219 unwrap_check(const Col<eT>& A, const Mat<eT>& B) 00220 : M_local( (&A == reinterpret_cast<const Col<eT>*>(&B)) ? new Col<eT>(A) : 0 ) 00221 , M ( (&A == reinterpret_cast<const Col<eT>*>(&B)) ? (*M_local) : A ) 00222 { 00223 arma_extra_debug_sigprint(); 00224 } 00225 00226 00227 inline 00228 ~unwrap_check() 00229 { 00230 arma_extra_debug_sigprint(); 00231 00232 if(M_local) 00233 { 00234 delete M_local; 00235 } 00236 } 00237 00238 00239 // the order below is important 00240 const Col<eT>* M_local; 00241 const Col<eT>& M; 00242 00243 }; 00244 00245 00246 00247 // 00248 // 00249 // 00250 00251 00252 00253 template<typename T1> 00254 class unwrap_check_mixed 00255 { 00256 public: 00257 00258 typedef typename T1::elem_type eT1; 00259 00260 template<typename eT2> 00261 inline 00262 unwrap_check_mixed(const T1& A, const Mat<eT2>& B) 00263 : M(A) 00264 { 00265 arma_extra_debug_sigprint(); 00266 arma_ignore(B); 00267 } 00268 00269 inline 00270 ~unwrap_check_mixed() 00271 { 00272 arma_extra_debug_sigprint(); 00273 } 00274 00275 const Mat<eT1> M; 00276 }; 00277 00278 00279 00280 template<typename eT1> 00281 class unwrap_check_mixed< Mat<eT1> > 00282 { 00283 public: 00284 00285 template<typename eT2> 00286 inline 00287 unwrap_check_mixed(const Mat<eT1>& A, const Mat<eT2>& B) 00288 : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Mat<eT1>(A) : 0 ) 00289 , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) 00290 { 00291 arma_extra_debug_sigprint(); 00292 } 00293 00294 00295 inline 00296 ~unwrap_check_mixed() 00297 { 00298 arma_extra_debug_sigprint(); 00299 00300 if(M_local) 00301 { 00302 delete M_local; 00303 } 00304 } 00305 00306 00307 // the order below is important 00308 const Mat<eT1>* M_local; 00309 const Mat<eT1>& M; 00310 }; 00311 00312 00313 00314 template<typename eT1> 00315 class unwrap_check_mixed< Row<eT1> > 00316 { 00317 public: 00318 00319 template<typename eT2> 00320 inline 00321 unwrap_check_mixed(const Row<eT1>& A, const Mat<eT2>& B) 00322 : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Row<eT1>(A) : 0 ) 00323 , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) 00324 { 00325 arma_extra_debug_sigprint(); 00326 } 00327 00328 00329 inline 00330 ~unwrap_check_mixed() 00331 { 00332 arma_extra_debug_sigprint(); 00333 00334 if(M_local) 00335 { 00336 delete M_local; 00337 } 00338 } 00339 00340 00341 // the order below is important 00342 const Row<eT1>* M_local; 00343 const Row<eT1>& M; 00344 }; 00345 00346 00347 00348 template<typename eT1> 00349 class unwrap_check_mixed< Col<eT1> > 00350 { 00351 public: 00352 00353 template<typename eT2> 00354 inline 00355 unwrap_check_mixed(const Col<eT1>& A, const Mat<eT2>& B) 00356 : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Col<eT1>(A) : 0 ) 00357 , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) 00358 { 00359 arma_extra_debug_sigprint(); 00360 } 00361 00362 00363 inline 00364 ~unwrap_check_mixed() 00365 { 00366 arma_extra_debug_sigprint(); 00367 00368 if(M_local) 00369 { 00370 delete M_local; 00371 } 00372 } 00373 00374 00375 // the order below is important 00376 const Col<eT1>* M_local; 00377 const Col<eT1>& M; 00378 }; 00379 00380 00381 00382 // 00383 00384 00385 00386 template<typename T1> 00387 class partial_unwrap 00388 { 00389 public: 00390 00391 typedef typename T1::elem_type eT; 00392 00393 inline partial_unwrap(const T1& A) // TODO: change this to Base ? 00394 : M(A) 00395 { 00396 arma_extra_debug_sigprint(); 00397 } 00398 00399 00400 inline 00401 ~partial_unwrap() 00402 { 00403 arma_extra_debug_sigprint(); 00404 } 00405 00406 00407 inline eT get_val() const { return eT(1); } 00408 00409 00410 static const bool do_trans = false; 00411 static const bool do_times = false; 00412 00413 const Mat<eT> M; 00414 }; 00415 00416 00417 00418 template<typename eT> 00419 class partial_unwrap< Mat<eT> > 00420 { 00421 public: 00422 00423 inline 00424 partial_unwrap(const Mat<eT>& A) 00425 : M(A) 00426 { 00427 arma_extra_debug_sigprint(); 00428 } 00429 00430 00431 inline 00432 ~partial_unwrap() 00433 { 00434 arma_extra_debug_sigprint(); 00435 } 00436 00437 00438 inline eT get_val() const { return eT(1); } 00439 00440 00441 static const bool do_trans = false; 00442 static const bool do_times = false; 00443 00444 const Mat<eT>& M; 00445 }; 00446 00447 00448 00449 template<typename eT> 00450 class partial_unwrap< Row<eT> > 00451 { 00452 public: 00453 00454 inline 00455 partial_unwrap(const Row<eT>& A) 00456 : M(A) 00457 { 00458 arma_extra_debug_sigprint(); 00459 } 00460 00461 00462 inline 00463 ~partial_unwrap() 00464 { 00465 arma_extra_debug_sigprint(); 00466 } 00467 00468 00469 inline eT get_val() const { return eT(1); } 00470 00471 00472 static const bool do_trans = false; 00473 static const bool do_times = false; 00474 00475 const Mat<eT>& M; 00476 }; 00477 00478 00479 00480 template<typename eT> 00481 class partial_unwrap< Col<eT> > 00482 { 00483 public: 00484 00485 inline 00486 partial_unwrap(const Col<eT>& A) 00487 : M(A) 00488 { 00489 arma_extra_debug_sigprint(); 00490 } 00491 00492 00493 inline 00494 ~partial_unwrap() 00495 { 00496 arma_extra_debug_sigprint(); 00497 } 00498 00499 00500 inline eT get_val() const { return eT(1); } 00501 00502 00503 static const bool do_trans = false; 00504 static const bool do_times = false; 00505 00506 const Mat<eT>& M; 00507 }; 00508 00509 00510 00511 template<typename T1> 00512 class partial_unwrap< Op<T1, op_htrans> > 00513 { 00514 public: 00515 00516 typedef typename T1::elem_type eT; 00517 00518 inline 00519 partial_unwrap(const Op<T1,op_htrans>& A) 00520 : M(A.m) 00521 { 00522 arma_extra_debug_sigprint(); 00523 } 00524 00525 inline 00526 ~partial_unwrap() 00527 { 00528 arma_extra_debug_sigprint(); 00529 } 00530 00531 00532 inline eT get_val() const { return eT(1); } 00533 00534 00535 static const bool do_trans = true; 00536 static const bool do_times = false; 00537 00538 const Mat<eT> M; 00539 }; 00540 00541 00542 00543 template<typename eT> 00544 class partial_unwrap< Op< Mat<eT>, op_htrans> > 00545 { 00546 public: 00547 00548 inline 00549 partial_unwrap(const Op< Mat<eT>, op_htrans>& A) 00550 : M(A.m) 00551 { 00552 arma_extra_debug_sigprint(); 00553 } 00554 00555 00556 inline 00557 ~partial_unwrap() 00558 { 00559 arma_extra_debug_sigprint(); 00560 } 00561 00562 00563 inline eT get_val() const { return eT(1); } 00564 00565 00566 static const bool do_trans = true; 00567 static const bool do_times = false; 00568 00569 const Mat<eT>& M; 00570 }; 00571 00572 00573 00574 template<typename eT> 00575 class partial_unwrap< Op< Row<eT>, op_htrans> > 00576 { 00577 public: 00578 00579 inline 00580 partial_unwrap(const Op< Row<eT>, op_htrans>& A) 00581 : M(A.m) 00582 { 00583 arma_extra_debug_sigprint(); 00584 } 00585 00586 inline 00587 ~partial_unwrap() 00588 { 00589 arma_extra_debug_sigprint(); 00590 } 00591 00592 00593 inline eT get_val() const { return eT(1); } 00594 00595 00596 static const bool do_trans = true; 00597 static const bool do_times = false; 00598 00599 const Mat<eT>& M; 00600 }; 00601 00602 00603 00604 template<typename eT> 00605 class partial_unwrap< Op< Col<eT>, op_htrans> > 00606 { 00607 public: 00608 00609 inline 00610 partial_unwrap(const Op< Col<eT>, op_htrans>& A) 00611 : M(A.m) 00612 { 00613 arma_extra_debug_sigprint(); 00614 } 00615 00616 inline 00617 ~partial_unwrap() 00618 { 00619 arma_extra_debug_sigprint(); 00620 } 00621 00622 00623 inline eT get_val() const { return eT(1); } 00624 00625 00626 static const bool do_trans = true; 00627 static const bool do_times = false; 00628 00629 const Mat<eT>& M; 00630 }; 00631 00632 00633 00634 template<typename T1> 00635 class partial_unwrap< Op<T1, op_htrans2> > 00636 { 00637 public: 00638 00639 typedef typename T1::elem_type eT; 00640 00641 inline 00642 partial_unwrap(const Op<T1,op_htrans2>& A) 00643 : val(A.aux) 00644 , M (A.m) 00645 { 00646 arma_extra_debug_sigprint(); 00647 } 00648 00649 inline 00650 ~partial_unwrap() 00651 { 00652 arma_extra_debug_sigprint(); 00653 } 00654 00655 00656 inline eT get_val() const { return val; } 00657 00658 00659 static const bool do_trans = true; 00660 static const bool do_times = true; 00661 00662 const eT val; 00663 const Mat<eT> M; 00664 }; 00665 00666 00667 00668 template<typename eT> 00669 class partial_unwrap< Op< Mat<eT>, op_htrans2> > 00670 { 00671 public: 00672 00673 inline 00674 partial_unwrap(const Op< Mat<eT>, op_htrans2>& A) 00675 : val(A.aux) 00676 , M (A.m) 00677 { 00678 arma_extra_debug_sigprint(); 00679 } 00680 00681 inline 00682 ~partial_unwrap() 00683 { 00684 arma_extra_debug_sigprint(); 00685 } 00686 00687 00688 inline eT get_val() const { return val; } 00689 00690 00691 static const bool do_trans = true; 00692 static const bool do_times = true; 00693 00694 const eT val; 00695 const Mat<eT>& M; 00696 }; 00697 00698 00699 00700 template<typename eT> 00701 class partial_unwrap< Op< Row<eT>, op_htrans2> > 00702 { 00703 public: 00704 00705 inline 00706 partial_unwrap(const Op< Row<eT>, op_htrans2>& A) 00707 : val(A.aux) 00708 , M (A.m) 00709 { 00710 arma_extra_debug_sigprint(); 00711 } 00712 00713 inline 00714 ~partial_unwrap() 00715 { 00716 arma_extra_debug_sigprint(); 00717 } 00718 00719 00720 inline eT get_val() const { return val; } 00721 00722 00723 static const bool do_trans = true; 00724 static const bool do_times = true; 00725 00726 const eT val; 00727 const Mat<eT>& M; 00728 }; 00729 00730 00731 00732 template<typename eT> 00733 class partial_unwrap< Op< Col<eT>, op_htrans2> > 00734 { 00735 public: 00736 00737 inline 00738 partial_unwrap(const Op< Col<eT>, op_htrans2>& A) 00739 : val(A.aux) 00740 , M (A.m) 00741 { 00742 arma_extra_debug_sigprint(); 00743 } 00744 00745 inline 00746 ~partial_unwrap() 00747 { 00748 arma_extra_debug_sigprint(); 00749 } 00750 00751 00752 inline eT get_val() const { return val; } 00753 00754 00755 static const bool do_trans = true; 00756 static const bool do_times = true; 00757 00758 const eT val; 00759 const Mat<eT>& M; 00760 }; 00761 00762 00763 00764 template<typename T1> 00765 class partial_unwrap< eOp<T1, eop_scalar_times> > 00766 { 00767 public: 00768 00769 typedef typename T1::elem_type eT; 00770 00771 inline 00772 partial_unwrap(const eOp<T1,eop_scalar_times>& A) 00773 : val(A.aux) 00774 , M (A.P.Q) 00775 { 00776 arma_extra_debug_sigprint(); 00777 } 00778 00779 inline 00780 ~partial_unwrap() 00781 { 00782 arma_extra_debug_sigprint(); 00783 } 00784 00785 00786 inline eT get_val() const { return val; } 00787 00788 00789 static const bool do_trans = false; 00790 static const bool do_times = true; 00791 00792 const eT val; 00793 const Mat<eT> M; 00794 }; 00795 00796 00797 00798 template<typename eT> 00799 class partial_unwrap< eOp<Mat<eT>, eop_scalar_times> > 00800 { 00801 public: 00802 00803 inline 00804 partial_unwrap(const eOp<Mat<eT>,eop_scalar_times>& A) 00805 : val(A.aux) 00806 , M (A.P.Q) 00807 { 00808 arma_extra_debug_sigprint(); 00809 } 00810 00811 inline 00812 ~partial_unwrap() 00813 { 00814 arma_extra_debug_sigprint(); 00815 } 00816 00817 00818 inline eT get_val() const { return val; } 00819 00820 00821 static const bool do_trans = false; 00822 static const bool do_times = true; 00823 00824 const eT val; 00825 const Mat<eT>& M; 00826 }; 00827 00828 00829 00830 template<typename eT> 00831 class partial_unwrap< eOp<Row<eT>, eop_scalar_times> > 00832 { 00833 public: 00834 00835 inline 00836 partial_unwrap(const eOp<Row<eT>,eop_scalar_times>& A) 00837 : val(A.aux) 00838 , M (A.P.Q) 00839 { 00840 arma_extra_debug_sigprint(); 00841 } 00842 00843 inline 00844 ~partial_unwrap() 00845 { 00846 arma_extra_debug_sigprint(); 00847 } 00848 00849 00850 inline eT get_val() const { return val; } 00851 00852 00853 static const bool do_trans = false; 00854 static const bool do_times = true; 00855 00856 const eT val; 00857 const Mat<eT>& M; 00858 }; 00859 00860 00861 00862 template<typename eT> 00863 class partial_unwrap< eOp<Col<eT>, eop_scalar_times> > 00864 { 00865 public: 00866 00867 inline 00868 partial_unwrap(const eOp<Col<eT>,eop_scalar_times>& A) 00869 : val(A.aux) 00870 , M (A.P.Q) 00871 { 00872 arma_extra_debug_sigprint(); 00873 } 00874 00875 inline 00876 ~partial_unwrap() 00877 { 00878 arma_extra_debug_sigprint(); 00879 } 00880 00881 00882 inline eT get_val() const { return val; } 00883 00884 00885 static const bool do_trans = false; 00886 static const bool do_times = true; 00887 00888 const eT val; 00889 const Mat<eT>& M; 00890 }; 00891 00892 00893 00894 // 00895 00896 00897 00898 template<typename T1> 00899 class partial_unwrap_check 00900 { 00901 public: 00902 00903 typedef typename T1::elem_type eT; 00904 00905 inline partial_unwrap_check(const T1& A, const Mat<eT>& B) 00906 : M(A) 00907 { 00908 arma_extra_debug_sigprint(); 00909 arma_ignore(B); 00910 } 00911 00912 00913 inline 00914 ~partial_unwrap_check() 00915 { 00916 arma_extra_debug_sigprint(); 00917 } 00918 00919 00920 inline eT get_val() const { return eT(1); } 00921 00922 00923 static const bool do_trans = false; 00924 static const bool do_times = false; 00925 00926 const Mat<eT> M; 00927 }; 00928 00929 00930 00931 template<typename eT> 00932 class partial_unwrap_check< Mat<eT> > 00933 { 00934 public: 00935 00936 inline 00937 partial_unwrap_check(const Mat<eT>& A, const Mat<eT>& B) 00938 : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) 00939 , M ( (&A == &B) ? (*M_local) : A ) 00940 { 00941 arma_extra_debug_sigprint(); 00942 } 00943 00944 00945 inline 00946 ~partial_unwrap_check() 00947 { 00948 arma_extra_debug_sigprint(); 00949 00950 if(M_local) 00951 { 00952 delete M_local; 00953 } 00954 } 00955 00956 00957 inline eT get_val() const { return eT(1); } 00958 00959 00960 static const bool do_trans = false; 00961 static const bool do_times = false; 00962 00963 // the order below is important 00964 const Mat<eT>* M_local; 00965 const Mat<eT>& M; 00966 }; 00967 00968 00969 00970 template<typename eT> 00971 class partial_unwrap_check< Row<eT> > 00972 { 00973 public: 00974 00975 inline 00976 partial_unwrap_check(const Row<eT>& A, const Mat<eT>& B) 00977 : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) 00978 , M ( (&A == &B) ? (*M_local) : A ) 00979 { 00980 arma_extra_debug_sigprint(); 00981 } 00982 00983 00984 inline 00985 ~partial_unwrap_check() 00986 { 00987 arma_extra_debug_sigprint(); 00988 00989 if(M_local) 00990 { 00991 delete M_local; 00992 } 00993 } 00994 00995 00996 inline eT get_val() const { return eT(1); } 00997 00998 00999 static const bool do_trans = false; 01000 static const bool do_times = false; 01001 01002 // the order below is important 01003 const Mat<eT>* M_local; 01004 const Mat<eT>& M; 01005 }; 01006 01007 01008 01009 template<typename eT> 01010 class partial_unwrap_check< Col<eT> > 01011 { 01012 public: 01013 01014 inline 01015 partial_unwrap_check(const Col<eT>& A, const Mat<eT>& B) 01016 : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) 01017 , M ( (&A == &B) ? (*M_local) : A ) 01018 { 01019 arma_extra_debug_sigprint(); 01020 } 01021 01022 01023 inline 01024 ~partial_unwrap_check() 01025 { 01026 arma_extra_debug_sigprint(); 01027 01028 if(M_local) 01029 { 01030 delete M_local; 01031 } 01032 } 01033 01034 01035 inline eT get_val() const { return eT(1); } 01036 01037 01038 static const bool do_trans = false; 01039 static const bool do_times = false; 01040 01041 // the order below is important 01042 const Mat<eT>* M_local; 01043 const Mat<eT>& M; 01044 }; 01045 01046 01047 01048 template<typename T1> 01049 class partial_unwrap_check< Op<T1, op_htrans> > 01050 { 01051 public: 01052 01053 typedef typename T1::elem_type eT; 01054 01055 inline 01056 partial_unwrap_check(const Op<T1,op_htrans>& A, const Mat<eT>& B) 01057 : M(A.m) 01058 { 01059 arma_extra_debug_sigprint(); 01060 arma_ignore(B); 01061 } 01062 01063 inline 01064 ~partial_unwrap_check() 01065 { 01066 arma_extra_debug_sigprint(); 01067 } 01068 01069 01070 inline eT get_val() const { return eT(1); } 01071 01072 01073 static const bool do_trans = true; 01074 static const bool do_times = false; 01075 01076 const Mat<eT> M; 01077 }; 01078 01079 01080 01081 template<typename eT> 01082 class partial_unwrap_check< Op< Mat<eT>, op_htrans> > 01083 { 01084 public: 01085 01086 inline 01087 partial_unwrap_check(const Op< Mat<eT>, op_htrans>& A, const Mat<eT>& B) 01088 : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) 01089 , M ( (&A.m == &B) ? (*M_local) : A.m ) 01090 { 01091 arma_extra_debug_sigprint(); 01092 } 01093 01094 inline 01095 ~partial_unwrap_check() 01096 { 01097 arma_extra_debug_sigprint(); 01098 01099 if(M_local) 01100 { 01101 delete M_local; 01102 } 01103 } 01104 01105 01106 inline eT get_val() const { return eT(1); } 01107 01108 01109 static const bool do_trans = true; 01110 static const bool do_times = false; 01111 01112 // the order below is important 01113 const Mat<eT>* M_local; 01114 const Mat<eT>& M; 01115 }; 01116 01117 01118 01119 template<typename eT> 01120 class partial_unwrap_check< Op< Row<eT>, op_htrans> > 01121 { 01122 public: 01123 01124 inline 01125 partial_unwrap_check(const Op< Row<eT>, op_htrans>& A, const Mat<eT>& B) 01126 : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) 01127 , M ( (&A.m == &B) ? (*M_local) : A.m ) 01128 { 01129 arma_extra_debug_sigprint(); 01130 } 01131 01132 inline 01133 ~partial_unwrap_check() 01134 { 01135 arma_extra_debug_sigprint(); 01136 01137 if(M_local) 01138 { 01139 delete M_local; 01140 } 01141 } 01142 01143 01144 inline eT get_val() const { return eT(1); } 01145 01146 01147 static const bool do_trans = true; 01148 static const bool do_times = false; 01149 01150 // the order below is important 01151 const Mat<eT>* M_local; 01152 const Mat<eT>& M; 01153 }; 01154 01155 01156 01157 template<typename eT> 01158 class partial_unwrap_check< Op< Col<eT>, op_htrans> > 01159 { 01160 public: 01161 01162 inline 01163 partial_unwrap_check(const Op< Col<eT>, op_htrans>& A, const Mat<eT>& B) 01164 : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) 01165 , M ( (&A.m == &B) ? (*M_local) : A.m ) 01166 { 01167 arma_extra_debug_sigprint(); 01168 } 01169 01170 inline 01171 ~partial_unwrap_check() 01172 { 01173 arma_extra_debug_sigprint(); 01174 01175 if(M_local) 01176 { 01177 delete M_local; 01178 } 01179 } 01180 01181 01182 inline eT get_val() const { return eT(1); } 01183 01184 01185 static const bool do_trans = true; 01186 static const bool do_times = false; 01187 01188 // the order below is important 01189 const Mat<eT>* M_local; 01190 const Mat<eT>& M; 01191 }; 01192 01193 01194 01195 template<typename T1> 01196 class partial_unwrap_check< Op<T1, op_htrans2> > 01197 { 01198 public: 01199 01200 typedef typename T1::elem_type eT; 01201 01202 inline 01203 partial_unwrap_check(const Op<T1,op_htrans2>& A, const Mat<eT>& B) 01204 : val(A.aux) 01205 , M (A.m) 01206 { 01207 arma_extra_debug_sigprint(); 01208 } 01209 01210 inline 01211 ~partial_unwrap_check() 01212 { 01213 arma_extra_debug_sigprint(); 01214 } 01215 01216 01217 inline eT get_val() const { return val; } 01218 01219 01220 static const bool do_trans = true; 01221 static const bool do_times = true; 01222 01223 const eT val; 01224 const Mat<eT> M; 01225 }; 01226 01227 01228 01229 template<typename eT> 01230 class partial_unwrap_check< Op< Mat<eT>, op_htrans2> > 01231 { 01232 public: 01233 01234 inline 01235 partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B) 01236 : val (A.aux) 01237 , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) 01238 , M ( (&A.m == &B) ? (*M_local) : A.m ) 01239 { 01240 arma_extra_debug_sigprint(); 01241 } 01242 01243 inline 01244 ~partial_unwrap_check() 01245 { 01246 arma_extra_debug_sigprint(); 01247 01248 if(M_local) 01249 { 01250 delete M_local; 01251 } 01252 } 01253 01254 01255 inline eT get_val() const { return val; } 01256 01257 01258 static const bool do_trans = true; 01259 static const bool do_times = true; 01260 01261 // the order below is important 01262 const eT val; 01263 const Mat<eT>* M_local; 01264 const Mat<eT>& M; 01265 }; 01266 01267 01268 01269 template<typename eT> 01270 class partial_unwrap_check< Op< Row<eT>, op_htrans2> > 01271 { 01272 public: 01273 01274 inline 01275 partial_unwrap_check(const Op< Row<eT>, op_htrans2>& A, const Mat<eT>& B) 01276 : val (A.aux) 01277 , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) 01278 , M ( (&A.m == &B) ? (*M_local) : A.m ) 01279 { 01280 arma_extra_debug_sigprint(); 01281 } 01282 01283 inline 01284 ~partial_unwrap_check() 01285 { 01286 arma_extra_debug_sigprint(); 01287 01288 if(M_local) 01289 { 01290 delete M_local; 01291 } 01292 } 01293 01294 01295 inline eT get_val() const { return val; } 01296 01297 01298 static const bool do_trans = true; 01299 static const bool do_times = true; 01300 01301 // the order below is important 01302 const eT val; 01303 const Mat<eT>* M_local; 01304 const Mat<eT>& M; 01305 }; 01306 01307 01308 01309 template<typename eT> 01310 class partial_unwrap_check< Op< Col<eT>, op_htrans2> > 01311 { 01312 public: 01313 01314 inline 01315 partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B) 01316 : val (A.aux) 01317 , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) 01318 , M ( (&A.m == &B) ? (*M_local) : A.m ) 01319 { 01320 arma_extra_debug_sigprint(); 01321 } 01322 01323 inline 01324 ~partial_unwrap_check() 01325 { 01326 arma_extra_debug_sigprint(); 01327 01328 if(M_local) 01329 { 01330 delete M_local; 01331 } 01332 } 01333 01334 01335 inline eT get_val() const { return val; } 01336 01337 01338 static const bool do_trans = true; 01339 static const bool do_times = true; 01340 01341 // the order below is important 01342 const eT val; 01343 const Mat<eT>* M_local; 01344 const Mat<eT>& M; 01345 }; 01346 01347 01348 01349 template<typename T1> 01350 class partial_unwrap_check< eOp<T1, eop_scalar_times> > 01351 { 01352 public: 01353 01354 typedef typename T1::elem_type eT; 01355 01356 inline 01357 partial_unwrap_check(const eOp<T1,eop_scalar_times>& A, const Mat<eT>& B) 01358 : val(A.aux) 01359 , M (A.P.Q) 01360 { 01361 arma_extra_debug_sigprint(); 01362 arma_ignore(B); 01363 } 01364 01365 inline 01366 ~partial_unwrap_check() 01367 { 01368 arma_extra_debug_sigprint(); 01369 } 01370 01371 01372 inline eT get_val() const { return val; } 01373 01374 01375 static const bool do_trans = false; 01376 static const bool do_times = true; 01377 01378 const eT val; 01379 const Mat<eT> M; 01380 }; 01381 01382 01383 01384 template<typename eT> 01385 class partial_unwrap_check< eOp<Mat<eT>, eop_scalar_times> > 01386 { 01387 public: 01388 01389 inline 01390 partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT>& B) 01391 : val(A.aux) 01392 , M (A.P.Q) 01393 { 01394 arma_extra_debug_sigprint(); 01395 arma_ignore(B); 01396 } 01397 01398 inline 01399 ~partial_unwrap_check() 01400 { 01401 arma_extra_debug_sigprint(); 01402 } 01403 01404 01405 inline eT get_val() const { return val; } 01406 01407 01408 static const bool do_trans = false; 01409 static const bool do_times = true; 01410 01411 const eT val; 01412 const Mat<eT>& M; 01413 }; 01414 01415 01416 01417 template<typename eT> 01418 class partial_unwrap_check< eOp<Row<eT>, eop_scalar_times> > 01419 { 01420 public: 01421 01422 inline 01423 partial_unwrap_check(const eOp<Row<eT>,eop_scalar_times>& A, const Mat<eT>& B) 01424 : val(A.aux) 01425 , M (A.P.Q) 01426 { 01427 arma_extra_debug_sigprint(); 01428 arma_ignore(B); 01429 } 01430 01431 inline 01432 ~partial_unwrap_check() 01433 { 01434 arma_extra_debug_sigprint(); 01435 } 01436 01437 01438 inline eT get_val() const { return val; } 01439 01440 01441 static const bool do_trans = false; 01442 static const bool do_times = true; 01443 01444 const eT val; 01445 const Mat<eT>& M; 01446 }; 01447 01448 01449 01450 template<typename eT> 01451 class partial_unwrap_check< eOp<Col<eT>, eop_scalar_times> > 01452 { 01453 public: 01454 01455 inline 01456 partial_unwrap_check(const eOp<Col<eT>,eop_scalar_times>& A, const Mat<eT>& B) 01457 : val(A.aux) 01458 , M (A.P.Q) 01459 { 01460 arma_extra_debug_sigprint(); 01461 arma_ignore(B); 01462 } 01463 01464 inline 01465 ~partial_unwrap_check() 01466 { 01467 arma_extra_debug_sigprint(); 01468 } 01469 01470 01471 inline eT get_val() const { return val; } 01472 01473 01474 static const bool do_trans = false; 01475 static const bool do_times = true; 01476 01477 const eT val; 01478 const Mat<eT>& M; 01479 }; 01480 01481 01482