Chris@49: // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) Chris@49: // Copyright (C) 2008-2010 Conrad Sanderson Chris@49: // Chris@49: // This Source Code Form is subject to the terms of the Mozilla Public Chris@49: // License, v. 2.0. If a copy of the MPL was not distributed with this Chris@49: // file, You can obtain one at http://mozilla.org/MPL/2.0/. Chris@49: Chris@49: Chris@49: //! \addtogroup operator_cube_minus Chris@49: //! @{ Chris@49: Chris@49: Chris@49: Chris@49: //! unary - Chris@49: template Chris@49: arma_inline Chris@49: const eOpCube Chris@49: operator- Chris@49: ( Chris@49: const BaseCube& X Chris@49: ) Chris@49: { Chris@49: arma_extra_debug_sigprint(); Chris@49: Chris@49: return eOpCube(X.get_ref()); Chris@49: } Chris@49: Chris@49: Chris@49: Chris@49: //! cancellation of two consecutive negations: -(-T1) Chris@49: template Chris@49: arma_inline Chris@49: const T1& Chris@49: operator- Chris@49: ( Chris@49: const eOpCube& X Chris@49: ) Chris@49: { Chris@49: arma_extra_debug_sigprint(); Chris@49: Chris@49: return X.m; Chris@49: } Chris@49: Chris@49: Chris@49: Chris@49: //! BaseCube - scalar Chris@49: template Chris@49: arma_inline Chris@49: const eOpCube Chris@49: operator- Chris@49: ( Chris@49: const BaseCube& X, Chris@49: const typename T1::elem_type k Chris@49: ) Chris@49: { Chris@49: arma_extra_debug_sigprint(); Chris@49: Chris@49: return eOpCube(X.get_ref(), k); Chris@49: } Chris@49: Chris@49: Chris@49: Chris@49: //! scalar - BaseCube Chris@49: template Chris@49: arma_inline Chris@49: const eOpCube Chris@49: operator- Chris@49: ( Chris@49: const typename T1::elem_type k, Chris@49: const BaseCube& X Chris@49: ) Chris@49: { Chris@49: arma_extra_debug_sigprint(); Chris@49: Chris@49: return eOpCube(X.get_ref(), k); Chris@49: } Chris@49: Chris@49: Chris@49: Chris@49: //! complex scalar - non-complex BaseCube (experimental) Chris@49: template Chris@49: arma_inline Chris@49: const mtOpCube, T1, op_cx_scalar_minus_pre> Chris@49: operator- Chris@49: ( Chris@49: const std::complex& k, Chris@49: const BaseCube& X Chris@49: ) Chris@49: { Chris@49: arma_extra_debug_sigprint(); Chris@49: Chris@49: return mtOpCube, T1, op_cx_scalar_minus_pre>('j', X.get_ref(), k); Chris@49: } Chris@49: Chris@49: Chris@49: Chris@49: //! non-complex BaseCube - complex scalar (experimental) Chris@49: template Chris@49: arma_inline Chris@49: const mtOpCube, T1, op_cx_scalar_minus_post> Chris@49: operator- Chris@49: ( Chris@49: const BaseCube& X, Chris@49: const std::complex& k Chris@49: ) Chris@49: { Chris@49: arma_extra_debug_sigprint(); Chris@49: Chris@49: return mtOpCube, T1, op_cx_scalar_minus_post>('j', X.get_ref(), k); Chris@49: } Chris@49: Chris@49: Chris@49: Chris@49: //! subtraction of BaseCube objects with same element type Chris@49: template Chris@49: arma_inline Chris@49: const eGlueCube Chris@49: operator- Chris@49: ( Chris@49: const BaseCube& X, Chris@49: const BaseCube& Y Chris@49: ) Chris@49: { Chris@49: arma_extra_debug_sigprint(); Chris@49: Chris@49: return eGlueCube(X.get_ref(), Y.get_ref()); Chris@49: } Chris@49: Chris@49: Chris@49: Chris@49: //! subtraction of BaseCube objects with different element types Chris@49: template Chris@49: inline Chris@49: const mtGlueCube::result, T1, T2, glue_mixed_minus> Chris@49: operator- Chris@49: ( Chris@49: const BaseCube< typename force_different_type::T1_result, T1>& X, Chris@49: const BaseCube< typename force_different_type::T2_result, T2>& Y Chris@49: ) Chris@49: { Chris@49: arma_extra_debug_sigprint(); Chris@49: Chris@49: typedef typename T1::elem_type eT1; Chris@49: typedef typename T2::elem_type eT2; Chris@49: Chris@49: typedef typename promote_type::result out_eT; Chris@49: Chris@49: promote_type::check(); Chris@49: Chris@49: return mtGlueCube( X.get_ref(), Y.get_ref() ); Chris@49: } Chris@49: Chris@49: Chris@49: Chris@49: //! @}