// Copyright (C) 2008-2015 National ICT Australia (NICTA) // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // ------------------------------------------------------------------- // // Written by Conrad Sanderson - http://conradsanderson.id.au //! \addtogroup unwrap //! @{ template struct unwrap_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline unwrap_default(const T1& A) : M(A) { arma_extra_debug_sigprint(); } const Mat M; }; template struct unwrap_fixed { typedef T1 stored_type; inline explicit unwrap_fixed(const T1& A) : M(A) { arma_extra_debug_sigprint(); } const T1& M; }; template struct unwrap_redirect {}; template struct unwrap_redirect { typedef unwrap_default result; }; template struct unwrap_redirect { typedef unwrap_fixed result; }; template struct unwrap : public unwrap_redirect::value >::result { inline unwrap(const T1& A) : unwrap_redirect< T1, is_Mat_fixed::value >::result(A) { } }; template struct unwrap< Mat > { typedef Mat stored_type; inline unwrap(const Mat& A) : M(A) { arma_extra_debug_sigprint(); } const Mat& M; }; template struct unwrap< Row > { typedef Row stored_type; inline unwrap(const Row& A) : M(A) { arma_extra_debug_sigprint(); } const Row& M; }; template struct unwrap< Col > { typedef Col stored_type; inline unwrap(const Col& A) : M(A) { arma_extra_debug_sigprint(); } const Col& M; }; template struct unwrap< mtGlue > { typedef Mat stored_type; inline unwrap(const mtGlue& A) : M(A) { arma_extra_debug_sigprint(); } const Mat M; }; template struct unwrap< mtOp > { typedef Mat stored_type; inline unwrap(const mtOp& A) : M(A) { arma_extra_debug_sigprint(); } const Mat M; }; // // // template struct quasi_unwrap_default { typedef typename T1::elem_type eT; static const bool has_subview = false; inline quasi_unwrap_default(const T1& A) : M(A) { arma_extra_debug_sigprint(); } // NOTE: DO NOT DIRECTLY CHECK FOR ALIASING BY TAKING THE ADDRESS OF THE "M" OBJECT IN ANY quasi_unwrap CLASS !!! const Mat M; template arma_inline bool is_alias(const Mat&) const { return false; } }; template struct quasi_unwrap_fixed { typedef typename T1::elem_type eT; static const bool has_subview = false; inline explicit quasi_unwrap_fixed(const T1& A) : M(A) { arma_extra_debug_sigprint(); } const Mat& M; template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&M) == void_ptr(&X)); } }; template struct quasi_unwrap_redirect {}; template struct quasi_unwrap_redirect { typedef quasi_unwrap_default result; }; template struct quasi_unwrap_redirect { typedef quasi_unwrap_fixed result; }; template struct quasi_unwrap : public quasi_unwrap_redirect::value >::result { typedef typename quasi_unwrap_redirect::value >::result quasi_unwrap_extra; static const bool has_subview = quasi_unwrap_extra::has_subview; inline quasi_unwrap(const T1& A) : quasi_unwrap_extra(A) { } using quasi_unwrap_extra::M; using quasi_unwrap_extra::is_alias; }; template struct quasi_unwrap< Mat > { static const bool has_subview = false; inline quasi_unwrap(const Mat& A) : M(A) { arma_extra_debug_sigprint(); } const Mat& M; template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&M) == void_ptr(&X)); } }; template struct quasi_unwrap< Row > { static const bool has_subview = false; inline quasi_unwrap(const Row& A) : M(A) { arma_extra_debug_sigprint(); } const Row& M; template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&M) == void_ptr(&X)); } }; template struct quasi_unwrap< Col > { static const bool has_subview = false; inline quasi_unwrap(const Col& A) : M(A) { arma_extra_debug_sigprint(); } const Col& M; template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&M) == void_ptr(&X)); } }; template struct quasi_unwrap< subview_row > { static const bool has_subview = false; inline quasi_unwrap(const subview_row& A) : M(A) { arma_extra_debug_sigprint(); } const Row M; template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&M) == void_ptr(&X)); } }; template struct quasi_unwrap< subview_col > { static const bool has_subview = true; inline quasi_unwrap(const subview_col& A) : orig( A.m ) , M ( const_cast( A.colptr(0) ), A.n_rows, false, false ) { arma_extra_debug_sigprint(); } const Mat& orig; const Col M; template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&orig) == void_ptr(&X)); } }; template struct quasi_unwrap< mtGlue > { static const bool has_subview = false; inline quasi_unwrap(const mtGlue& A) : M(A) { arma_extra_debug_sigprint(); } const Mat M; template arma_inline bool is_alias(const Mat&) const { return false; } }; template struct quasi_unwrap< mtOp > { static const bool has_subview = false; inline quasi_unwrap(const mtOp& A) : M(A) { arma_extra_debug_sigprint(); } const Mat M; template arma_inline bool is_alias(const Mat&) const { return false; } }; template struct quasi_unwrap< Op > { static const bool has_subview = true; typedef typename T1::elem_type eT; inline quasi_unwrap(const Op& A) : U( A.m ) , M( const_cast(U.M.memptr()), U.M.n_elem, 1, false, false ) { arma_extra_debug_sigprint(); } const unwrap U; const Mat M; template arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&(U.M)) == void_ptr(&X)); } }; // // // template struct unwrap_check_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline unwrap_check_default(const T1& A, const Mat&) : M(A) { arma_extra_debug_sigprint(); } inline unwrap_check_default(const T1& A, const bool) : M(A) { arma_extra_debug_sigprint(); } const Mat M; }; template struct unwrap_check_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline unwrap_check_fixed(const T1& A, const Mat& B) : M_local( (&A == &B) ? new T1(A) : 0 ) , M ( (&A == &B) ? *M_local : A ) { arma_extra_debug_sigprint(); } inline unwrap_check_fixed(const T1& A, const bool is_alias) : M_local( is_alias ? new T1(A) : 0 ) , M ( is_alias ? *M_local : A ) { arma_extra_debug_sigprint(); } inline ~unwrap_check_fixed() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const T1* M_local; const T1& M; }; template struct unwrap_check_redirect {}; template struct unwrap_check_redirect { typedef unwrap_check_default result; }; template struct unwrap_check_redirect { typedef unwrap_check_fixed result; }; template struct unwrap_check : public unwrap_check_redirect::value >::result { inline unwrap_check(const T1& A, const Mat& B) : unwrap_check_redirect< T1, is_Mat_fixed::value >::result(A, B) { } inline unwrap_check(const T1& A, const bool is_alias) : unwrap_check_redirect< T1, is_Mat_fixed::value >::result(A, is_alias) { } }; template struct unwrap_check< Mat > { typedef Mat stored_type; inline unwrap_check(const Mat& A, const Mat& B) : M_local( (&A == &B) ? new Mat(A) : 0 ) , M ( (&A == &B) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline unwrap_check(const Mat& A, const bool is_alias) : M_local( is_alias ? new Mat(A) : 0 ) , M ( is_alias ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Mat* M_local; const Mat& M; }; template struct unwrap_check< Row > { typedef Row stored_type; inline unwrap_check(const Row& A, const Mat& B) : M_local( (&A == &B) ? new Row(A) : 0 ) , M ( (&A == &B) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline unwrap_check(const Row& A, const bool is_alias) : M_local( is_alias ? new Row(A) : 0 ) , M ( is_alias ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Row* M_local; const Row& M; }; template struct unwrap_check< Col > { typedef Col stored_type; inline unwrap_check(const Col& A, const Mat& B) : M_local( (&A == &B) ? new Col(A) : 0 ) , M ( (&A == &B) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline unwrap_check(const Col& A, const bool is_alias) : M_local( is_alias ? new Col(A) : 0 ) , M ( is_alias ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Col* M_local; const Col& M; }; // // // template struct unwrap_check_mixed { typedef typename T1::elem_type eT1; template inline unwrap_check_mixed(const T1& A, const Mat&) : M(A) { arma_extra_debug_sigprint(); } //template inline unwrap_check_mixed(const T1& A, const bool) : M(A) { arma_extra_debug_sigprint(); } const Mat M; }; template struct unwrap_check_mixed< Mat > { template inline unwrap_check_mixed(const Mat& A, const Mat& B) : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Mat(A) : 0 ) , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } //template inline unwrap_check_mixed(const Mat& A, const bool is_alias) : M_local( is_alias ? new Mat(A) : 0 ) , M ( is_alias ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~unwrap_check_mixed() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Mat* M_local; const Mat& M; }; template struct unwrap_check_mixed< Row > { template inline unwrap_check_mixed(const Row& A, const Mat& B) : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Row(A) : 0 ) , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } //template inline unwrap_check_mixed(const Row& A, const bool is_alias) : M_local( is_alias ? new Row(A) : 0 ) , M ( is_alias ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~unwrap_check_mixed() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Row* M_local; const Row& M; }; template struct unwrap_check_mixed< Col > { template inline unwrap_check_mixed(const Col& A, const Mat& B) : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Col(A) : 0 ) , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } //template inline unwrap_check_mixed(const Col& A, const bool is_alias) : M_local( is_alias ? new Col(A) : 0 ) , M ( is_alias ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~unwrap_check_mixed() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } // the order below is important const Col* M_local; const Col& M; }; // // // template struct partial_unwrap_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_default(const T1& A) : M(A) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = false; static const bool do_times = false; const Mat M; }; template struct partial_unwrap_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_fixed(const T1& A) : M(A) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = false; const T1& M; }; template struct partial_unwrap_redirect {}; template struct partial_unwrap_redirect { typedef partial_unwrap_default result; }; template struct partial_unwrap_redirect { typedef partial_unwrap_fixed result; }; template struct partial_unwrap : public partial_unwrap_redirect::value >::result { inline partial_unwrap(const T1& A) : partial_unwrap_redirect< T1, is_Mat_fixed::value >::result(A) { } }; template struct partial_unwrap< Mat > { typedef Mat stored_type; inline partial_unwrap(const Mat& A) : M(A) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return ((&X) == (&M)); } static const bool do_trans = false; static const bool do_times = false; const Mat& M; }; template struct partial_unwrap< Row > { typedef Row stored_type; inline partial_unwrap(const Row& A) : M(A) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = false; const Row& M; }; template struct partial_unwrap< Col > { typedef Col stored_type; inline partial_unwrap(const Col& A) : M(A) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = false; const Col& M; }; template struct partial_unwrap< subview_col > { typedef Col stored_type; inline partial_unwrap(const subview_col& A) : orig( A.m ) , M ( const_cast( A.colptr(0) ), A.n_rows, false, false ) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static const bool do_trans = false; static const bool do_times = false; const Mat& orig; const Col M; }; template struct partial_unwrap< subview_row > { typedef Row stored_type; inline partial_unwrap(const subview_row& A) : M(A) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = false; static const bool do_times = false; const Row M; }; template struct partial_unwrap_htrans_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_htrans_default(const Op& A) : M(A.m) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = true; static const bool do_times = false; const Mat M; }; template struct partial_unwrap_htrans_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_htrans_fixed(const Op& A) : M(A.m) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = true; static const bool do_times = false; const T1& M; }; template struct partial_unwrap_htrans_redirect {}; template struct partial_unwrap_htrans_redirect { typedef partial_unwrap_htrans_default result; }; template struct partial_unwrap_htrans_redirect { typedef partial_unwrap_htrans_fixed result; }; template struct partial_unwrap< Op > : public partial_unwrap_htrans_redirect::value >::result { inline partial_unwrap(const Op& A) : partial_unwrap_htrans_redirect< T1, is_Mat_fixed::value >::result(A) { } }; template struct partial_unwrap< Op< Mat, op_htrans> > { typedef Mat stored_type; inline partial_unwrap(const Op< Mat, op_htrans>& A) : M(A.m) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = true; static const bool do_times = false; const Mat& M; }; template struct partial_unwrap< Op< Row, op_htrans> > { typedef Row stored_type; inline partial_unwrap(const Op< Row, op_htrans>& A) : M(A.m) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = true; static const bool do_times = false; const Row& M; }; template struct partial_unwrap< Op< Col, op_htrans> > { typedef Col stored_type; inline partial_unwrap(const Op< Col, op_htrans>& A) : M(A.m) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = true; static const bool do_times = false; const Col& M; }; template struct partial_unwrap< Op< subview_col, op_htrans> > { typedef Col stored_type; inline partial_unwrap(const Op< subview_col, op_htrans>& A) : orig( A.m.m ) , M ( const_cast( A.m.colptr(0) ), A.m.n_rows, false, false ) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static const bool do_trans = true; static const bool do_times = false; const Mat& orig; const Col M; }; template struct partial_unwrap< Op< subview_row, op_htrans> > { typedef Row stored_type; inline partial_unwrap(const Op< subview_row, op_htrans>& A) : M(A.m) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = true; static const bool do_times = false; const Row M; }; template struct partial_unwrap_htrans2_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_htrans2_default(const Op& A) : val(A.aux) , M (A.m) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return val; } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = true; static const bool do_times = true; const eT val; const Mat M; }; template struct partial_unwrap_htrans2_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_htrans2_fixed(const Op& A) : val(A.aux) , M (A.m) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = true; static const bool do_times = true; const eT val; const T1& M; }; template struct partial_unwrap_htrans2_redirect {}; template struct partial_unwrap_htrans2_redirect { typedef partial_unwrap_htrans2_default result; }; template struct partial_unwrap_htrans2_redirect { typedef partial_unwrap_htrans2_fixed result; }; template struct partial_unwrap< Op > : public partial_unwrap_htrans2_redirect::value >::result { inline partial_unwrap(const Op& A) : partial_unwrap_htrans2_redirect< T1, is_Mat_fixed::value >::result(A) { } }; template struct partial_unwrap< Op< Mat, op_htrans2> > { typedef Mat stored_type; inline partial_unwrap(const Op< Mat, op_htrans2>& A) : val(A.aux) , M (A.m) { arma_extra_debug_sigprint(); } inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = true; static const bool do_times = true; const eT val; const Mat& M; }; template struct partial_unwrap< Op< Row, op_htrans2> > { typedef Row stored_type; inline partial_unwrap(const Op< Row, op_htrans2>& A) : val(A.aux) , M (A.m) { arma_extra_debug_sigprint(); } inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = true; static const bool do_times = true; const eT val; const Row& M; }; template struct partial_unwrap< Op< Col, op_htrans2> > { typedef Col stored_type; inline partial_unwrap(const Op< Col, op_htrans2>& A) : val(A.aux) , M (A.m) { arma_extra_debug_sigprint(); } inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = true; static const bool do_times = true; const eT val; const Col& M; }; template struct partial_unwrap< Op< subview_col, op_htrans2> > { typedef Col stored_type; inline partial_unwrap(const Op< subview_col, op_htrans2>& A) : orig( A.m.m ) , val ( A.aux ) , M ( const_cast( A.m.colptr(0) ), A.m.n_rows, false, false ) { arma_extra_debug_sigprint(); } inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static const bool do_trans = true; static const bool do_times = true; const Mat& orig; const eT val; const Col M; }; template struct partial_unwrap< Op< subview_row, op_htrans2> > { typedef Row stored_type; inline partial_unwrap(const Op< subview_row, op_htrans2>& A) : val(A.aux) , M (A.m ) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return val; } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = true; static const bool do_times = true; const eT val; const Row M; }; template struct partial_unwrap_scalar_times_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_scalar_times_default(const eOp& A) : val(A.aux) , M (A.P.Q) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return val; } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = false; static const bool do_times = true; const eT val; const Mat M; }; template struct partial_unwrap_scalar_times_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_scalar_times_fixed(const eOp& A) : val(A.aux) , M (A.P.Q) { arma_extra_debug_sigprint(); } arma_hot arma_inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = true; const eT val; const T1& M; }; template struct partial_unwrap_scalar_times_redirect {}; template struct partial_unwrap_scalar_times_redirect { typedef partial_unwrap_scalar_times_default result; }; template struct partial_unwrap_scalar_times_redirect { typedef partial_unwrap_scalar_times_fixed result; }; template struct partial_unwrap< eOp > : public partial_unwrap_scalar_times_redirect::value >::result { typedef typename T1::elem_type eT; inline partial_unwrap(const eOp& A) : partial_unwrap_scalar_times_redirect< T1, is_Mat_fixed::value >::result(A) { } }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Mat stored_type; inline partial_unwrap(const eOp,eop_scalar_times>& A) : val(A.aux) , M (A.P.Q) { arma_extra_debug_sigprint(); } inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = true; const eT val; const Mat& M; }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Row stored_type; inline partial_unwrap(const eOp,eop_scalar_times>& A) : val(A.aux) , M (A.P.Q) { arma_extra_debug_sigprint(); } inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = true; const eT val; const Row& M; }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Col stored_type; inline partial_unwrap(const eOp,eop_scalar_times>& A) : val(A.aux) , M (A.P.Q) { arma_extra_debug_sigprint(); } inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = true; const eT val; const Col& M; }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Col stored_type; arma_hot inline partial_unwrap(const eOp,eop_scalar_times>& A) : orig( A.P.Q.m ) , val ( A.aux ) , M ( const_cast( A.P.Q.colptr(0) ), A.P.Q.n_rows, false, false ) { arma_extra_debug_sigprint(); } arma_hot arma_inline eT get_val() const { return val; } arma_hot arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static const bool do_trans = false; static const bool do_times = true; const Mat& orig; const eT val; const Col M; }; template struct partial_unwrap< eOp, eop_scalar_times> > { typedef Row stored_type; arma_hot inline partial_unwrap(const eOp,eop_scalar_times>& A) : val(A.aux) , M (A.P.Q) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return val; } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = false; static const bool do_times = true; const eT val; const Row M; }; template struct partial_unwrap_neg_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_neg_default(const eOp& A) : M(A.P.Q) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(-1); } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = false; static const bool do_times = true; const Mat M; }; template struct partial_unwrap_neg_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_neg_fixed(const eOp& A) : M(A.P.Q) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(-1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = true; const T1& M; }; template struct partial_unwrap_neg_redirect {}; template struct partial_unwrap_neg_redirect { typedef partial_unwrap_neg_default result; }; template struct partial_unwrap_neg_redirect { typedef partial_unwrap_neg_fixed result; }; template struct partial_unwrap< eOp > : public partial_unwrap_neg_redirect::value >::result { typedef typename T1::elem_type eT; inline partial_unwrap(const eOp& A) : partial_unwrap_neg_redirect< T1, is_Mat_fixed::value >::result(A) { } }; template struct partial_unwrap< eOp, eop_neg> > { typedef Mat stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : M(A.P.Q) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(-1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = true; const Mat& M; }; template struct partial_unwrap< eOp, eop_neg> > { typedef Row stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : M(A.P.Q) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(-1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = true; const Row& M; }; template struct partial_unwrap< eOp, eop_neg> > { typedef Col stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : M(A.P.Q) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(-1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&M)); } static const bool do_trans = false; static const bool do_times = true; const Col& M; }; template struct partial_unwrap< eOp, eop_neg> > { typedef Col stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : orig( A.P.Q.m ) , M ( const_cast( A.P.Q.colptr(0) ), A.P.Q.n_rows, false, false ) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(-1); } arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&X) == void_ptr(&orig)); } static const bool do_trans = false; static const bool do_times = true; const Mat& orig; const Col M; }; template struct partial_unwrap< eOp, eop_neg> > { typedef Row stored_type; inline partial_unwrap(const eOp,eop_neg>& A) : M(A.P.Q) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(-1); } arma_inline bool is_alias(const Mat&) const { return false; } static const bool do_trans = false; static const bool do_times = true; const Row M; }; // template struct partial_unwrap_check_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_check_default(const T1& A, const Mat&) : M(A) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = false; static const bool do_times = false; const Mat M; }; template struct partial_unwrap_check_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_check_fixed(const T1& A, const Mat& B) : M_local( (&A == &B) ? new T1(A) : 0 ) , M ( (&A == &B) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check_fixed() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = false; static const bool do_times = false; const T1* M_local; const T1& M; }; template struct partial_unwrap_check_redirect {}; template struct partial_unwrap_check_redirect { typedef partial_unwrap_check_default result; }; template struct partial_unwrap_check_redirect { typedef partial_unwrap_check_fixed result; }; template struct partial_unwrap_check : public partial_unwrap_check_redirect::value >::result { typedef typename T1::elem_type eT; inline partial_unwrap_check(const T1& A, const Mat& B) : partial_unwrap_check_redirect< T1, is_Mat_fixed::value >::result(A, B) { } }; template struct partial_unwrap_check< Mat > { typedef Mat stored_type; arma_hot inline partial_unwrap_check(const Mat& A, const Mat& B) : M_local ( (&A == &B) ? new Mat(A) : 0 ) , M ( (&A == &B) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = false; static const bool do_times = false; // the order below is important const Mat* M_local; const Mat& M; }; template struct partial_unwrap_check< Row > { typedef Row stored_type; arma_hot inline partial_unwrap_check(const Row& A, const Mat& B) : M_local ( (&A == &B) ? new Row(A) : 0 ) , M ( (&A == &B) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = false; static const bool do_times = false; // the order below is important const Row* M_local; const Row& M; }; template struct partial_unwrap_check< Col > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const Col& A, const Mat& B) : M_local ( (&A == &B) ? new Col(A) : 0 ) , M ( (&A == &B) ? (*M_local) : A ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = false; static const bool do_times = false; // the order below is important const Col* M_local; const Col& M; }; // NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class, // NOTE: which relies on partial_unwrap_check to check for aliasing template struct partial_unwrap_check< subview_col > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const subview_col& A, const Mat& B) : M ( const_cast( A.colptr(0) ), A.n_rows, (&(A.m) == &B), false ) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = false; static const bool do_times = false; const Col M; }; template struct partial_unwrap_check_htrans_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_check_htrans_default(const Op& A, const Mat&) : M(A.m) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = true; static const bool do_times = false; const Mat M; }; template struct partial_unwrap_check_htrans_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_check_htrans_fixed(const Op& A, const Mat& B) : M_local( (&(A.m) == &B) ? new T1(A.m) : 0 ) , M ( (&(A.m) == &B) ? (*M_local) : A.m ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check_htrans_fixed() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = true; static const bool do_times = false; const T1* M_local; const T1& M; }; template struct partial_unwrap_check_htrans_redirect {}; template struct partial_unwrap_check_htrans_redirect { typedef partial_unwrap_check_htrans_default result; }; template struct partial_unwrap_check_htrans_redirect { typedef partial_unwrap_check_htrans_fixed result; }; template struct partial_unwrap_check< Op > : public partial_unwrap_check_htrans_redirect::value >::result { typedef typename T1::elem_type eT; inline partial_unwrap_check(const Op& A, const Mat& B) : partial_unwrap_check_htrans_redirect< T1, is_Mat_fixed::value >::result(A, B) { } }; template struct partial_unwrap_check< Op< Mat, op_htrans> > { typedef Mat stored_type; arma_hot inline partial_unwrap_check(const Op< Mat, op_htrans>& A, const Mat& B) : M_local ( (&A.m == &B) ? new Mat(A.m) : 0 ) , M ( (&A.m == &B) ? (*M_local) : A.m ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = true; static const bool do_times = false; // the order below is important const Mat* M_local; const Mat& M; }; template struct partial_unwrap_check< Op< Row, op_htrans> > { typedef Row stored_type; arma_hot inline partial_unwrap_check(const Op< Row, op_htrans>& A, const Mat& B) : M_local ( (&A.m == &B) ? new Row(A.m) : 0 ) , M ( (&A.m == &B) ? (*M_local) : A.m ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = true; static const bool do_times = false; // the order below is important const Row* M_local; const Row& M; }; template struct partial_unwrap_check< Op< Col, op_htrans> > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const Op< Col, op_htrans>& A, const Mat& B) : M_local ( (&A.m == &B) ? new Col(A.m) : 0 ) , M ( (&A.m == &B) ? (*M_local) : A.m ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = true; static const bool do_times = false; // the order below is important const Col* M_local; const Col& M; }; // NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class, // NOTE: which relies on partial_unwrap_check to check for aliasing template struct partial_unwrap_check< Op< subview_col, op_htrans> > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const Op< subview_col, op_htrans>& A, const Mat& B) : M ( const_cast( A.m.colptr(0) ), A.m.n_rows, (&(A.m.m) == &B), false ) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(1); } static const bool do_trans = true; static const bool do_times = false; const Col M; }; template struct partial_unwrap_check_htrans2_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_check_htrans2_default(const Op& A, const Mat&) : val(A.aux) , M (A.m) { arma_extra_debug_sigprint(); } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = true; static const bool do_times = true; const eT val; const Mat M; }; template struct partial_unwrap_check_htrans2_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_check_htrans2_fixed(const Op& A, const Mat& B) : val (A.aux) , M_local( (&(A.m) == &B) ? new T1(A.m) : 0 ) , M ( (&(A.m) == &B) ? (*M_local) : A.m ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check_htrans2_fixed() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = true; static const bool do_times = true; const eT val; const T1* M_local; const T1& M; }; template struct partial_unwrap_check_htrans2_redirect {}; template struct partial_unwrap_check_htrans2_redirect { typedef partial_unwrap_check_htrans2_default result; }; template struct partial_unwrap_check_htrans2_redirect { typedef partial_unwrap_check_htrans2_fixed result; }; template struct partial_unwrap_check< Op > : public partial_unwrap_check_htrans2_redirect::value >::result { typedef typename T1::elem_type eT; inline partial_unwrap_check(const Op& A, const Mat& B) : partial_unwrap_check_htrans2_redirect< T1, is_Mat_fixed::value >::result(A, B) { } }; template struct partial_unwrap_check< Op< Mat, op_htrans2> > { typedef Mat stored_type; arma_hot inline partial_unwrap_check(const Op< Mat, op_htrans2>& A, const Mat& B) : val (A.aux) , M_local ( (&A.m == &B) ? new Mat(A.m) : 0 ) , M ( (&A.m == &B) ? (*M_local) : A.m ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = true; static const bool do_times = true; // the order below is important const eT val; const Mat* M_local; const Mat& M; }; template struct partial_unwrap_check< Op< Row, op_htrans2> > { typedef Row stored_type; arma_hot inline partial_unwrap_check(const Op< Row, op_htrans2>& A, const Mat& B) : val (A.aux) , M_local ( (&A.m == &B) ? new Row(A.m) : 0 ) , M ( (&A.m == &B) ? (*M_local) : A.m ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = true; static const bool do_times = true; // the order below is important const eT val; const Row* M_local; const Row& M; }; template struct partial_unwrap_check< Op< Col, op_htrans2> > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const Op< Col, op_htrans2>& A, const Mat& B) : val (A.aux) , M_local ( (&A.m == &B) ? new Col(A.m) : 0 ) , M ( (&A.m == &B) ? (*M_local) : A.m ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = true; static const bool do_times = true; // the order below is important const eT val; const Col* M_local; const Col& M; }; // NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class, // NOTE: which relies on partial_unwrap_check to check for aliasing template struct partial_unwrap_check< Op< subview_col, op_htrans2> > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const Op< subview_col, op_htrans2>& A, const Mat& B) : val( A.aux ) , M ( const_cast( A.m.colptr(0) ), A.m.n_rows, (&(A.m.m) == &B), false ) { arma_extra_debug_sigprint(); } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = true; static const bool do_times = true; const eT val; const Col M; }; template struct partial_unwrap_check_scalar_times_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_check_scalar_times_default(const eOp& A, const Mat&) : val(A.aux) , M (A.P.Q) { arma_extra_debug_sigprint(); } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = false; static const bool do_times = true; const eT val; const Mat M; }; template struct partial_unwrap_check_scalar_times_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_check_scalar_times_fixed(const eOp& A, const Mat& B) : val ( A.aux ) , M_local( (&(A.P.Q) == &B) ? new T1(A.P.Q) : 0 ) , M ( (&(A.P.Q) == &B) ? (*M_local) : A.P.Q ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check_scalar_times_fixed() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = false; static const bool do_times = true; const eT val; const T1* M_local; const T1& M; }; template struct partial_unwrap_check_scalar_times_redirect {}; template struct partial_unwrap_check_scalar_times_redirect { typedef partial_unwrap_check_scalar_times_default result; }; template struct partial_unwrap_check_scalar_times_redirect { typedef partial_unwrap_check_scalar_times_fixed result; }; template struct partial_unwrap_check< eOp > : public partial_unwrap_check_scalar_times_redirect::value >::result { typedef typename T1::elem_type eT; inline partial_unwrap_check(const eOp& A, const Mat& B) : partial_unwrap_check_scalar_times_redirect< T1, is_Mat_fixed::value >::result(A, B) { } }; template struct partial_unwrap_check< eOp, eop_scalar_times> > { typedef Mat stored_type; arma_hot inline partial_unwrap_check(const eOp,eop_scalar_times>& A, const Mat& B) : val (A.aux) , M_local( (&(A.P.Q) == &B) ? new Mat(A.P.Q) : 0 ) , M ( (&(A.P.Q) == &B) ? *M_local : A.P.Q ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = false; static const bool do_times = true; const eT val; const Mat* M_local; const Mat& M; }; template struct partial_unwrap_check< eOp, eop_scalar_times> > { typedef Row stored_type; arma_hot inline partial_unwrap_check(const eOp,eop_scalar_times>& A, const Mat& B) : val(A.aux) , M_local( (&(A.P.Q) == &B) ? new Row(A.P.Q) : 0 ) , M ( (&(A.P.Q) == &B) ? *M_local : A.P.Q ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = false; static const bool do_times = true; const eT val; const Row* M_local; const Row& M; }; template struct partial_unwrap_check< eOp, eop_scalar_times> > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const eOp,eop_scalar_times>& A, const Mat& B) : val ( A.aux ) , M_local( (&(A.P.Q) == &B) ? new Col(A.P.Q) : 0 ) , M ( (&(A.P.Q) == &B) ? *M_local : A.P.Q ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = false; static const bool do_times = true; const eT val; const Col* M_local; const Col& M; }; // NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class, // NOTE: which relies on partial_unwrap_check to check for aliasing template struct partial_unwrap_check< eOp, eop_scalar_times> > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const eOp,eop_scalar_times>& A, const Mat& B) : val( A.aux ) , M ( const_cast( A.P.Q.colptr(0) ), A.P.Q.n_rows, (&(A.P.Q.m) == &B), false ) { arma_extra_debug_sigprint(); } arma_hot arma_inline eT get_val() const { return val; } static const bool do_trans = false; static const bool do_times = true; const eT val; const Col M; }; template struct partial_unwrap_check_neg_default { typedef typename T1::elem_type eT; typedef Mat stored_type; inline partial_unwrap_check_neg_default(const eOp& A, const Mat&) : M(A.P.Q) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(-1); } static const bool do_trans = false; static const bool do_times = true; const Mat M; }; template struct partial_unwrap_check_neg_fixed { typedef typename T1::elem_type eT; typedef T1 stored_type; inline explicit partial_unwrap_check_neg_fixed(const eOp& A, const Mat& B) : M_local( (&(A.P.Q) == &B) ? new T1(A.P.Q) : 0 ) , M ( (&(A.P.Q) == &B) ? (*M_local) : A.P.Q ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check_neg_fixed() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(-1); } static const bool do_trans = false; static const bool do_times = true; const T1* M_local; const T1& M; }; template struct partial_unwrap_check_neg_redirect {}; template struct partial_unwrap_check_neg_redirect { typedef partial_unwrap_check_neg_default result; }; template struct partial_unwrap_check_neg_redirect { typedef partial_unwrap_check_neg_fixed result; }; template struct partial_unwrap_check< eOp > : public partial_unwrap_check_neg_redirect::value >::result { typedef typename T1::elem_type eT; inline partial_unwrap_check(const eOp& A, const Mat& B) : partial_unwrap_check_neg_redirect< T1, is_Mat_fixed::value >::result(A, B) { } }; template struct partial_unwrap_check< eOp, eop_neg> > { typedef Mat stored_type; arma_hot inline partial_unwrap_check(const eOp,eop_neg>& A, const Mat& B) : M_local( (&(A.P.Q) == &B) ? new Mat(A.P.Q) : 0 ) , M ( (&(A.P.Q) == &B) ? *M_local : A.P.Q ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(-1); } static const bool do_trans = false; static const bool do_times = true; const Mat* M_local; const Mat& M; }; template struct partial_unwrap_check< eOp, eop_neg> > { typedef Row stored_type; arma_hot inline partial_unwrap_check(const eOp,eop_neg>& A, const Mat& B) : M_local( (&(A.P.Q) == &B) ? new Row(A.P.Q) : 0 ) , M ( (&(A.P.Q) == &B) ? *M_local : A.P.Q ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(-1); } static const bool do_trans = false; static const bool do_times = true; const Row* M_local; const Row& M; }; template struct partial_unwrap_check< eOp, eop_neg> > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const eOp,eop_neg>& A, const Mat& B) : M_local( (&(A.P.Q) == &B) ? new Col(A.P.Q) : 0 ) , M ( (&(A.P.Q) == &B) ? *M_local : A.P.Q ) { arma_extra_debug_sigprint(); } inline ~partial_unwrap_check() { arma_extra_debug_sigprint(); if(M_local) { delete M_local; } } arma_inline eT get_val() const { return eT(-1); } static const bool do_trans = false; static const bool do_times = true; const Col* M_local; const Col& M; }; // NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class, // NOTE: which relies on partial_unwrap_check to check for aliasing template struct partial_unwrap_check< eOp, eop_neg> > { typedef Col stored_type; arma_hot inline partial_unwrap_check(const eOp,eop_neg>& A, const Mat& B) : M ( const_cast( A.P.Q.colptr(0) ), A.P.Q.n_rows, (&(A.P.Q.m) == &B), false ) { arma_extra_debug_sigprint(); } arma_inline eT get_val() const { return eT(-1); } static const bool do_trans = false; static const bool do_times = true; const Col M; }; //! @}