max@0: // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2011 Conrad Sanderson max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: //! \addtogroup unwrap max@0: //! @{ max@0: max@0: max@0: max@0: template max@0: class unwrap max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline unwrap(const T1& A) // TODO: change this to Base ? max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap< Mat > max@0: { max@0: public: max@0: max@0: inline unwrap(const Mat& A) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap< Row > max@0: { max@0: public: max@0: max@0: inline unwrap(const Row& A) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: const Row& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap< Col > max@0: { max@0: public: max@0: max@0: inline unwrap(const Col& A) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: const Col& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap< mtGlue > max@0: { max@0: public: max@0: max@0: inline unwrap(const mtGlue& A) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: const Mat M; max@0: }; max@0: max@0: max@0: template max@0: class unwrap< mtOp > max@0: { max@0: public: max@0: max@0: inline unwrap(const mtOp& A) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: // max@0: // max@0: // max@0: max@0: max@0: template max@0: class unwrap_check max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline max@0: unwrap_check(const T1& A, const Mat& B) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(B); max@0: } max@0: max@0: inline max@0: ~unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap_check< Mat > max@0: { max@0: public: max@0: max@0: inline max@0: unwrap_check(const Mat& A, const Mat& B) max@0: : M_local( (&A == &B) ? new Mat(A) : 0 ) max@0: , M ( (&A == &B) ? (*M_local) : A ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: // the order below is important max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap_check< Row > max@0: { max@0: public: max@0: max@0: inline max@0: unwrap_check(const Row& A, const Mat& B) max@0: : M_local( (&A == reinterpret_cast*>(&B)) ? new Row(A) : 0 ) max@0: , M ( (&A == reinterpret_cast*>(&B)) ? (*M_local) : A ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: // the order below is important max@0: const Row* M_local; max@0: const Row& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap_check< Col > max@0: { max@0: public: max@0: max@0: inline max@0: unwrap_check(const Col& A, const Mat& B) max@0: : M_local( (&A == reinterpret_cast*>(&B)) ? new Col(A) : 0 ) max@0: , M ( (&A == reinterpret_cast*>(&B)) ? (*M_local) : A ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: // the order below is important max@0: const Col* M_local; max@0: const Col& M; max@0: max@0: }; max@0: max@0: max@0: max@0: // max@0: // max@0: // max@0: max@0: max@0: max@0: template max@0: class unwrap_check_mixed max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT1; max@0: max@0: template max@0: inline max@0: unwrap_check_mixed(const T1& A, const Mat& B) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(B); max@0: } max@0: max@0: inline max@0: ~unwrap_check_mixed() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap_check_mixed< Mat > max@0: { max@0: public: max@0: max@0: template max@0: inline max@0: unwrap_check_mixed(const Mat& A, const Mat& B) max@0: : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Mat(A) : 0 ) max@0: , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~unwrap_check_mixed() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: // the order below is important max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap_check_mixed< Row > max@0: { max@0: public: max@0: max@0: template max@0: inline max@0: unwrap_check_mixed(const Row& A, const Mat& B) max@0: : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Row(A) : 0 ) max@0: , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~unwrap_check_mixed() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: // the order below is important max@0: const Row* M_local; max@0: const Row& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class unwrap_check_mixed< Col > max@0: { max@0: public: max@0: max@0: template max@0: inline max@0: unwrap_check_mixed(const Col& A, const Mat& B) max@0: : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Col(A) : 0 ) max@0: , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~unwrap_check_mixed() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: // the order below is important max@0: const Col* M_local; max@0: const Col& M; max@0: }; max@0: max@0: max@0: max@0: // max@0: max@0: max@0: max@0: template max@0: class partial_unwrap max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline partial_unwrap(const T1& A) // TODO: change this to Base ? max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = false; max@0: max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Mat > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const Mat& A) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = false; max@0: max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Row > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const Row& A) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = false; max@0: max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Col > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const Col& A) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = false; max@0: max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Op > max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline max@0: partial_unwrap(const Op& A) max@0: : M(A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = false; max@0: max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Op< Mat, op_htrans> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const Op< Mat, op_htrans>& A) max@0: : M(A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = false; max@0: max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Op< Row, op_htrans> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const Op< Row, op_htrans>& A) max@0: : M(A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = false; max@0: max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Op< Col, op_htrans> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const Op< Col, op_htrans>& A) max@0: : M(A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = false; max@0: max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Op > max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline max@0: partial_unwrap(const Op& A) max@0: : val(A.aux) max@0: , M (A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Op< Mat, op_htrans2> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const Op< Mat, op_htrans2>& A) max@0: : val(A.aux) max@0: , M (A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Op< Row, op_htrans2> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const Op< Row, op_htrans2>& A) max@0: : val(A.aux) max@0: , M (A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< Op< Col, op_htrans2> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const Op< Col, op_htrans2>& A) max@0: : val(A.aux) max@0: , M (A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< eOp > max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline max@0: partial_unwrap(const eOp& A) max@0: : val(A.aux) max@0: , M (A.P.Q) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< eOp, eop_scalar_times> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const eOp,eop_scalar_times>& A) max@0: : val(A.aux) max@0: , M (A.P.Q) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< eOp, eop_scalar_times> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const eOp,eop_scalar_times>& A) max@0: : val(A.aux) max@0: , M (A.P.Q) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap< eOp, eop_scalar_times> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap(const eOp,eop_scalar_times>& A) max@0: : val(A.aux) max@0: , M (A.P.Q) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: // max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline partial_unwrap_check(const T1& A, const Mat& B) max@0: : M(A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(B); max@0: } max@0: max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = false; max@0: max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Mat > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const Mat& A, const Mat& B) max@0: : M_local ( (&A == &B) ? new Mat(A) : 0 ) max@0: , M ( (&A == &B) ? (*M_local) : A ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = false; max@0: max@0: // the order below is important max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Row > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const Row& A, const Mat& B) max@0: : M_local ( (&A == &B) ? new Mat(A) : 0 ) max@0: , M ( (&A == &B) ? (*M_local) : A ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = false; max@0: max@0: // the order below is important max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Col > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const Col& A, const Mat& B) max@0: : M_local ( (&A == &B) ? new Mat(A) : 0 ) max@0: , M ( (&A == &B) ? (*M_local) : A ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = false; max@0: max@0: // the order below is important max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Op > max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline max@0: partial_unwrap_check(const Op& A, const Mat& B) max@0: : M(A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(B); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = false; max@0: max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Op< Mat, op_htrans> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const Op< Mat, op_htrans>& A, const Mat& B) max@0: : M_local ( (&A.m == &B) ? new Mat(A.m) : 0 ) max@0: , M ( (&A.m == &B) ? (*M_local) : A.m ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = false; max@0: max@0: // the order below is important max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Op< Row, op_htrans> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const Op< Row, op_htrans>& A, const Mat& B) max@0: : M_local ( (&A.m == &B) ? new Mat(A.m) : 0 ) max@0: , M ( (&A.m == &B) ? (*M_local) : A.m ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = false; max@0: max@0: // the order below is important max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Op< Col, op_htrans> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const Op< Col, op_htrans>& A, const Mat& B) max@0: : M_local ( (&A.m == &B) ? new Mat(A.m) : 0 ) max@0: , M ( (&A.m == &B) ? (*M_local) : A.m ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: inline eT get_val() const { return eT(1); } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = false; max@0: max@0: // the order below is important max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Op > max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline max@0: partial_unwrap_check(const Op& A, const Mat& B) max@0: : val(A.aux) max@0: , M (A.m) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Op< Mat, op_htrans2> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const Op< Mat, op_htrans2>& A, const Mat& B) max@0: : val (A.aux) max@0: , M_local ( (&A.m == &B) ? new Mat(A.m) : 0 ) max@0: , M ( (&A.m == &B) ? (*M_local) : A.m ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = true; max@0: max@0: // the order below is important max@0: const eT val; max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Op< Row, op_htrans2> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const Op< Row, op_htrans2>& A, const Mat& B) max@0: : val (A.aux) max@0: , M_local ( (&A.m == &B) ? new Mat(A.m) : 0 ) max@0: , M ( (&A.m == &B) ? (*M_local) : A.m ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = true; max@0: max@0: // the order below is important max@0: const eT val; max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< Op< Col, op_htrans2> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const Op< Mat, op_htrans2>& A, const Mat& B) max@0: : val (A.aux) max@0: , M_local ( (&A.m == &B) ? new Mat(A.m) : 0 ) max@0: , M ( (&A.m == &B) ? (*M_local) : A.m ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: if(M_local) max@0: { max@0: delete M_local; max@0: } max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = true; max@0: static const bool do_times = true; max@0: max@0: // the order below is important max@0: const eT val; max@0: const Mat* M_local; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< eOp > max@0: { max@0: public: max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: inline max@0: partial_unwrap_check(const eOp& A, const Mat& B) max@0: : val(A.aux) max@0: , M (A.P.Q) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(B); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< eOp, eop_scalar_times> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const eOp,eop_scalar_times>& A, const Mat& B) max@0: : val(A.aux) max@0: , M (A.P.Q) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(B); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< eOp, eop_scalar_times> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const eOp,eop_scalar_times>& A, const Mat& B) max@0: : val(A.aux) max@0: , M (A.P.Q) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(B); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: template max@0: class partial_unwrap_check< eOp, eop_scalar_times> > max@0: { max@0: public: max@0: max@0: inline max@0: partial_unwrap_check(const eOp,eop_scalar_times>& A, const Mat& B) max@0: : val(A.aux) max@0: , M (A.P.Q) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(B); max@0: } max@0: max@0: inline max@0: ~partial_unwrap_check() max@0: { max@0: arma_extra_debug_sigprint(); max@0: } max@0: max@0: max@0: inline eT get_val() const { return val; } max@0: max@0: max@0: static const bool do_trans = false; max@0: static const bool do_times = true; max@0: max@0: const eT val; max@0: const Mat& M; max@0: }; max@0: max@0: max@0: max@0: //! @}