unwrap.hpp

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