Chris@49
|
1 // Copyright (C) 2009-2010 NICTA (www.nicta.com.au)
|
Chris@49
|
2 // Copyright (C) 2009-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_div
|
Chris@49
|
10 //! @{
|
Chris@49
|
11
|
Chris@49
|
12
|
Chris@49
|
13
|
Chris@49
|
14 //! BaseCube / scalar
|
Chris@49
|
15 template<typename T1>
|
Chris@49
|
16 arma_inline
|
Chris@49
|
17 const eOpCube<T1, eop_scalar_div_post>
|
Chris@49
|
18 operator/
|
Chris@49
|
19 (
|
Chris@49
|
20 const BaseCube<typename T1::elem_type,T1>& X,
|
Chris@49
|
21 const typename T1::elem_type k
|
Chris@49
|
22 )
|
Chris@49
|
23 {
|
Chris@49
|
24 arma_extra_debug_sigprint();
|
Chris@49
|
25
|
Chris@49
|
26 return eOpCube<T1, eop_scalar_div_post>(X.get_ref(), k);
|
Chris@49
|
27 }
|
Chris@49
|
28
|
Chris@49
|
29
|
Chris@49
|
30
|
Chris@49
|
31 //! scalar / BaseCube
|
Chris@49
|
32 template<typename T1>
|
Chris@49
|
33 arma_inline
|
Chris@49
|
34 const eOpCube<T1, eop_scalar_div_pre>
|
Chris@49
|
35 operator/
|
Chris@49
|
36 (
|
Chris@49
|
37 const typename T1::elem_type k,
|
Chris@49
|
38 const BaseCube<typename T1::elem_type,T1>& X
|
Chris@49
|
39 )
|
Chris@49
|
40 {
|
Chris@49
|
41 arma_extra_debug_sigprint();
|
Chris@49
|
42
|
Chris@49
|
43 return eOpCube<T1, eop_scalar_div_pre>(X.get_ref(), k);
|
Chris@49
|
44 }
|
Chris@49
|
45
|
Chris@49
|
46
|
Chris@49
|
47
|
Chris@49
|
48 //! complex scalar / non-complex BaseCube (experimental)
|
Chris@49
|
49 template<typename T1>
|
Chris@49
|
50 arma_inline
|
Chris@49
|
51 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_pre>
|
Chris@49
|
52 operator/
|
Chris@49
|
53 (
|
Chris@49
|
54 const std::complex<typename T1::pod_type>& k,
|
Chris@49
|
55 const BaseCube<typename T1::pod_type, T1>& X
|
Chris@49
|
56 )
|
Chris@49
|
57 {
|
Chris@49
|
58 arma_extra_debug_sigprint();
|
Chris@49
|
59
|
Chris@49
|
60 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_pre>('j', X.get_ref(), k);
|
Chris@49
|
61 }
|
Chris@49
|
62
|
Chris@49
|
63
|
Chris@49
|
64
|
Chris@49
|
65 //! non-complex BaseCube / complex scalar (experimental)
|
Chris@49
|
66 template<typename T1>
|
Chris@49
|
67 arma_inline
|
Chris@49
|
68 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_post>
|
Chris@49
|
69 operator/
|
Chris@49
|
70 (
|
Chris@49
|
71 const BaseCube<typename T1::pod_type, T1>& X,
|
Chris@49
|
72 const std::complex<typename T1::pod_type>& k
|
Chris@49
|
73 )
|
Chris@49
|
74 {
|
Chris@49
|
75 arma_extra_debug_sigprint();
|
Chris@49
|
76
|
Chris@49
|
77 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_post>('j', X.get_ref(), k);
|
Chris@49
|
78 }
|
Chris@49
|
79
|
Chris@49
|
80
|
Chris@49
|
81
|
Chris@49
|
82 //! element-wise division of BaseCube objects with same element type
|
Chris@49
|
83 template<typename T1, typename T2>
|
Chris@49
|
84 arma_inline
|
Chris@49
|
85 const eGlueCube<T1, T2, eglue_div>
|
Chris@49
|
86 operator/
|
Chris@49
|
87 (
|
Chris@49
|
88 const BaseCube<typename T1::elem_type,T1>& X,
|
Chris@49
|
89 const BaseCube<typename T1::elem_type,T2>& Y
|
Chris@49
|
90 )
|
Chris@49
|
91 {
|
Chris@49
|
92 arma_extra_debug_sigprint();
|
Chris@49
|
93
|
Chris@49
|
94 return eGlueCube<T1, T2, eglue_div>(X.get_ref(), Y.get_ref());
|
Chris@49
|
95 }
|
Chris@49
|
96
|
Chris@49
|
97
|
Chris@49
|
98
|
Chris@49
|
99 //! element-wise division of BaseCube objects with different element types
|
Chris@49
|
100 template<typename T1, typename T2>
|
Chris@49
|
101 inline
|
Chris@49
|
102 const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2::elem_type>::result, T1, T2, glue_mixed_div>
|
Chris@49
|
103 operator/
|
Chris@49
|
104 (
|
Chris@49
|
105 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T1_result, T1>& X,
|
Chris@49
|
106 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T2_result, T2>& Y
|
Chris@49
|
107 )
|
Chris@49
|
108 {
|
Chris@49
|
109 arma_extra_debug_sigprint();
|
Chris@49
|
110
|
Chris@49
|
111 typedef typename T1::elem_type eT1;
|
Chris@49
|
112 typedef typename T2::elem_type eT2;
|
Chris@49
|
113
|
Chris@49
|
114 typedef typename promote_type<eT1,eT2>::result out_eT;
|
Chris@49
|
115
|
Chris@49
|
116 promote_type<eT1,eT2>::check();
|
Chris@49
|
117
|
Chris@49
|
118 return mtGlueCube<out_eT, T1, T2, glue_mixed_div>( X.get_ref(), Y.get_ref() );
|
Chris@49
|
119 }
|
Chris@49
|
120
|
Chris@49
|
121
|
Chris@49
|
122
|
Chris@49
|
123 //! @}
|