comparison armadillo-3.900.4/include/armadillo_bits/operator_cube_minus.hpp @ 49:1ec0e2823891

Switch to using subrepo copies of qm-dsp, nnls-chroma, vamp-plugin-sdk; update Armadillo version; assume build without external BLAS/LAPACK
author Chris Cannam
date Thu, 13 Jun 2013 10:25:24 +0100
parents
children
comparison
equal deleted inserted replaced
48:69251e11a913 49:1ec0e2823891
1 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-2010 Conrad Sanderson
3 //
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8
9 //! \addtogroup operator_cube_minus
10 //! @{
11
12
13
14 //! unary -
15 template<typename T1>
16 arma_inline
17 const eOpCube<T1, eop_neg>
18 operator-
19 (
20 const BaseCube<typename T1::elem_type,T1>& X
21 )
22 {
23 arma_extra_debug_sigprint();
24
25 return eOpCube<T1, eop_neg>(X.get_ref());
26 }
27
28
29
30 //! cancellation of two consecutive negations: -(-T1)
31 template<typename T1>
32 arma_inline
33 const T1&
34 operator-
35 (
36 const eOpCube<T1, eop_neg>& X
37 )
38 {
39 arma_extra_debug_sigprint();
40
41 return X.m;
42 }
43
44
45
46 //! BaseCube - scalar
47 template<typename T1>
48 arma_inline
49 const eOpCube<T1, eop_scalar_minus_post>
50 operator-
51 (
52 const BaseCube<typename T1::elem_type,T1>& X,
53 const typename T1::elem_type k
54 )
55 {
56 arma_extra_debug_sigprint();
57
58 return eOpCube<T1, eop_scalar_minus_post>(X.get_ref(), k);
59 }
60
61
62
63 //! scalar - BaseCube
64 template<typename T1>
65 arma_inline
66 const eOpCube<T1, eop_scalar_minus_pre>
67 operator-
68 (
69 const typename T1::elem_type k,
70 const BaseCube<typename T1::elem_type,T1>& X
71 )
72 {
73 arma_extra_debug_sigprint();
74
75 return eOpCube<T1, eop_scalar_minus_pre>(X.get_ref(), k);
76 }
77
78
79
80 //! complex scalar - non-complex BaseCube (experimental)
81 template<typename T1>
82 arma_inline
83 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_pre>
84 operator-
85 (
86 const std::complex<typename T1::pod_type>& k,
87 const BaseCube<typename T1::pod_type, T1>& X
88 )
89 {
90 arma_extra_debug_sigprint();
91
92 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_pre>('j', X.get_ref(), k);
93 }
94
95
96
97 //! non-complex BaseCube - complex scalar (experimental)
98 template<typename T1>
99 arma_inline
100 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_post>
101 operator-
102 (
103 const BaseCube<typename T1::pod_type, T1>& X,
104 const std::complex<typename T1::pod_type>& k
105 )
106 {
107 arma_extra_debug_sigprint();
108
109 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_post>('j', X.get_ref(), k);
110 }
111
112
113
114 //! subtraction of BaseCube objects with same element type
115 template<typename T1, typename T2>
116 arma_inline
117 const eGlueCube<T1, T2, eglue_minus>
118 operator-
119 (
120 const BaseCube<typename T1::elem_type,T1>& X,
121 const BaseCube<typename T1::elem_type,T2>& Y
122 )
123 {
124 arma_extra_debug_sigprint();
125
126 return eGlueCube<T1, T2, eglue_minus>(X.get_ref(), Y.get_ref());
127 }
128
129
130
131 //! subtraction of BaseCube objects with different element types
132 template<typename T1, typename T2>
133 inline
134 const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2::elem_type>::result, T1, T2, glue_mixed_minus>
135 operator-
136 (
137 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T1_result, T1>& X,
138 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T2_result, T2>& Y
139 )
140 {
141 arma_extra_debug_sigprint();
142
143 typedef typename T1::elem_type eT1;
144 typedef typename T2::elem_type eT2;
145
146 typedef typename promote_type<eT1,eT2>::result out_eT;
147
148 promote_type<eT1,eT2>::check();
149
150 return mtGlueCube<out_eT, T1, T2, glue_mixed_minus>( X.get_ref(), Y.get_ref() );
151 }
152
153
154
155 //! @}