annotate armadillo-3.900.4/include/armadillo_bits/operator_cube_plus.hpp @ 84:55a047986812 tip

Update library URI so as not to be document-local
author Chris Cannam
date Wed, 22 Apr 2020 14:21:57 +0100
parents 1ec0e2823891
children
rev   line source
Chris@49 1 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
Chris@49 2 // Copyright (C) 2008-2010 Conrad Sanderson
Chris@49 3 //
Chris@49 4 // This Source Code Form is subject to the terms of the Mozilla Public
Chris@49 5 // License, v. 2.0. If a copy of the MPL was not distributed with this
Chris@49 6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
Chris@49 7
Chris@49 8
Chris@49 9 //! \addtogroup operator_cube_plus
Chris@49 10 //! @{
Chris@49 11
Chris@49 12
Chris@49 13
Chris@49 14 //! unary plus operation (does nothing, but is required for completeness)
Chris@49 15 template<typename T1>
Chris@49 16 arma_inline
Chris@49 17 const BaseCube<typename T1::elem_type,T1>&
Chris@49 18 operator+
Chris@49 19 (
Chris@49 20 const BaseCube<typename T1::elem_type,T1>& X
Chris@49 21 )
Chris@49 22 {
Chris@49 23 arma_extra_debug_sigprint();
Chris@49 24
Chris@49 25 return X;
Chris@49 26 }
Chris@49 27
Chris@49 28
Chris@49 29
Chris@49 30 //! BaseCube + scalar
Chris@49 31 template<typename T1>
Chris@49 32 arma_inline
Chris@49 33 const eOpCube<T1, eop_scalar_plus>
Chris@49 34 operator+
Chris@49 35 (
Chris@49 36 const BaseCube<typename T1::elem_type,T1>& X,
Chris@49 37 const typename T1::elem_type k
Chris@49 38 )
Chris@49 39 {
Chris@49 40 arma_extra_debug_sigprint();
Chris@49 41
Chris@49 42 return eOpCube<T1, eop_scalar_plus>(X.get_ref(), k);
Chris@49 43 }
Chris@49 44
Chris@49 45
Chris@49 46
Chris@49 47 //! scalar + BaseCube
Chris@49 48 template<typename T1>
Chris@49 49 arma_inline
Chris@49 50 const eOpCube<T1, eop_scalar_plus>
Chris@49 51 operator+
Chris@49 52 (
Chris@49 53 const typename T1::elem_type k,
Chris@49 54 const BaseCube<typename T1::elem_type,T1>& X
Chris@49 55 )
Chris@49 56 {
Chris@49 57 arma_extra_debug_sigprint();
Chris@49 58
Chris@49 59 return eOpCube<T1, eop_scalar_plus>(X.get_ref(), k);
Chris@49 60 }
Chris@49 61
Chris@49 62
Chris@49 63
Chris@49 64 //! non-complex BaseCube + complex scalar (experimental)
Chris@49 65 template<typename T1>
Chris@49 66 arma_inline
Chris@49 67 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>
Chris@49 68 operator+
Chris@49 69 (
Chris@49 70 const BaseCube<typename T1::pod_type, T1>& X,
Chris@49 71 const std::complex<typename T1::pod_type>& k
Chris@49 72 )
Chris@49 73 {
Chris@49 74 arma_extra_debug_sigprint();
Chris@49 75
Chris@49 76 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>('j', X.get_ref(), k);
Chris@49 77 }
Chris@49 78
Chris@49 79
Chris@49 80
Chris@49 81 //! complex scalar + non-complex BaseCube (experimental)
Chris@49 82 template<typename T1>
Chris@49 83 arma_inline
Chris@49 84 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>
Chris@49 85 operator+
Chris@49 86 (
Chris@49 87 const std::complex<typename T1::pod_type>& k,
Chris@49 88 const BaseCube<typename T1::pod_type, T1>& X
Chris@49 89 )
Chris@49 90 {
Chris@49 91 arma_extra_debug_sigprint();
Chris@49 92
Chris@49 93 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>('j', X.get_ref(), k); // NOTE: order is swapped
Chris@49 94 }
Chris@49 95
Chris@49 96
Chris@49 97
Chris@49 98 //! addition of BaseCube objects with same element type
Chris@49 99 template<typename T1, typename T2>
Chris@49 100 arma_inline
Chris@49 101 const eGlueCube<T1, T2, eglue_plus>
Chris@49 102 operator+
Chris@49 103 (
Chris@49 104 const BaseCube<typename T1::elem_type,T1>& X,
Chris@49 105 const BaseCube<typename T1::elem_type,T2>& Y
Chris@49 106 )
Chris@49 107 {
Chris@49 108 arma_extra_debug_sigprint();
Chris@49 109
Chris@49 110 return eGlueCube<T1, T2, eglue_plus>(X.get_ref(), Y.get_ref());
Chris@49 111 }
Chris@49 112
Chris@49 113
Chris@49 114
Chris@49 115 //! addition of BaseCube objects with different element types
Chris@49 116 template<typename T1, typename T2>
Chris@49 117 inline
Chris@49 118 const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2::elem_type>::result, T1, T2, glue_mixed_plus>
Chris@49 119 operator+
Chris@49 120 (
Chris@49 121 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T1_result, T1>& X,
Chris@49 122 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T2_result, T2>& Y
Chris@49 123 )
Chris@49 124 {
Chris@49 125 arma_extra_debug_sigprint();
Chris@49 126
Chris@49 127 typedef typename T1::elem_type eT1;
Chris@49 128 typedef typename T2::elem_type eT2;
Chris@49 129
Chris@49 130 typedef typename promote_type<eT1,eT2>::result out_eT;
Chris@49 131
Chris@49 132 promote_type<eT1,eT2>::check();
Chris@49 133
Chris@49 134 return mtGlueCube<out_eT, T1, T2, glue_mixed_plus>( X.get_ref(), Y.get_ref() );
Chris@49 135 }
Chris@49 136
Chris@49 137
Chris@49 138
Chris@49 139 //! @}