comparison armadillo-2.4.4/include/armadillo_bits/operator_cube_div.hpp @ 0:8b6102e2a9b0

Armadillo Library
author maxzanoni76 <max.zanoni@eecs.qmul.ac.uk>
date Wed, 11 Apr 2012 09:27:06 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8b6102e2a9b0
1 // Copyright (C) 2009-2010 NICTA (www.nicta.com.au)
2 // Copyright (C) 2009-2010 Conrad Sanderson
3 //
4 // This file is part of the Armadillo C++ library.
5 // It is provided without any warranty of fitness
6 // for any purpose. You can redistribute this file
7 // and/or modify it under the terms of the GNU
8 // Lesser General Public License (LGPL) as published
9 // by the Free Software Foundation, either version 3
10 // of the License or (at your option) any later version.
11 // (see http://www.opensource.org/licenses for more info)
12
13
14 //! \addtogroup operator_cube_div
15 //! @{
16
17
18
19 //! BaseCube / scalar
20 template<typename T1>
21 arma_inline
22 const eOpCube<T1, eop_scalar_div_post>
23 operator/
24 (
25 const BaseCube<typename T1::elem_type,T1>& X,
26 const typename T1::elem_type k
27 )
28 {
29 arma_extra_debug_sigprint();
30
31 return eOpCube<T1, eop_scalar_div_post>(X.get_ref(), k);
32 }
33
34
35
36 //! scalar / BaseCube
37 template<typename T1>
38 arma_inline
39 const eOpCube<T1, eop_scalar_div_pre>
40 operator/
41 (
42 const typename T1::elem_type k,
43 const BaseCube<typename T1::elem_type,T1>& X
44 )
45 {
46 arma_extra_debug_sigprint();
47
48 return eOpCube<T1, eop_scalar_div_pre>(X.get_ref(), k);
49 }
50
51
52
53 //! complex scalar / non-complex BaseCube (experimental)
54 template<typename T1>
55 arma_inline
56 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_pre>
57 operator/
58 (
59 const std::complex<typename T1::pod_type>& k,
60 const BaseCube<typename T1::pod_type, T1>& X
61 )
62 {
63 arma_extra_debug_sigprint();
64
65 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_pre>('j', X.get_ref(), k);
66 }
67
68
69
70 //! non-complex BaseCube / complex scalar (experimental)
71 template<typename T1>
72 arma_inline
73 const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_post>
74 operator/
75 (
76 const BaseCube<typename T1::pod_type, T1>& X,
77 const std::complex<typename T1::pod_type>& k
78 )
79 {
80 arma_extra_debug_sigprint();
81
82 return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_post>('j', X.get_ref(), k);
83 }
84
85
86
87 //! element-wise division of BaseCube objects with same element type
88 template<typename T1, typename T2>
89 arma_inline
90 const eGlueCube<T1, T2, eglue_div>
91 operator/
92 (
93 const BaseCube<typename T1::elem_type,T1>& X,
94 const BaseCube<typename T1::elem_type,T2>& Y
95 )
96 {
97 arma_extra_debug_sigprint();
98
99 return eGlueCube<T1, T2, eglue_div>(X.get_ref(), Y.get_ref());
100 }
101
102
103
104 //! element-wise division of BaseCube objects with different element types
105 template<typename T1, typename T2>
106 inline
107 const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2::elem_type>::result, T1, T2, glue_mixed_div>
108 operator/
109 (
110 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T1_result, T1>& X,
111 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T2_result, T2>& Y
112 )
113 {
114 arma_extra_debug_sigprint();
115
116 typedef typename T1::elem_type eT1;
117 typedef typename T2::elem_type eT2;
118
119 typedef typename promote_type<eT1,eT2>::result out_eT;
120
121 promote_type<eT1,eT2>::check();
122
123 return mtGlueCube<out_eT, T1, T2, glue_mixed_div>( X.get_ref(), Y.get_ref() );
124 }
125
126
127
128 //! @}