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_schur
|
Chris@49
|
10 //! @{
|
Chris@49
|
11
|
Chris@49
|
12
|
Chris@49
|
13 // operator %, which we define it to do a schur product (element-wise multiplication)
|
Chris@49
|
14
|
Chris@49
|
15
|
Chris@49
|
16 //! element-wise multiplication of BaseCube objects with same element type
|
Chris@49
|
17 template<typename T1, typename T2>
|
Chris@49
|
18 arma_inline
|
Chris@49
|
19 const eGlueCube<T1, T2, eglue_schur>
|
Chris@49
|
20 operator%
|
Chris@49
|
21 (
|
Chris@49
|
22 const BaseCube<typename T1::elem_type,T1>& X,
|
Chris@49
|
23 const BaseCube<typename T1::elem_type,T2>& Y
|
Chris@49
|
24 )
|
Chris@49
|
25 {
|
Chris@49
|
26 arma_extra_debug_sigprint();
|
Chris@49
|
27
|
Chris@49
|
28 return eGlueCube<T1, T2, eglue_schur>(X.get_ref(), Y.get_ref());
|
Chris@49
|
29 }
|
Chris@49
|
30
|
Chris@49
|
31
|
Chris@49
|
32
|
Chris@49
|
33 //! element-wise multiplication of BaseCube objects with different element types
|
Chris@49
|
34 template<typename T1, typename T2>
|
Chris@49
|
35 inline
|
Chris@49
|
36 const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2::elem_type>::result, T1, T2, glue_mixed_schur>
|
Chris@49
|
37 operator%
|
Chris@49
|
38 (
|
Chris@49
|
39 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T1_result, T1>& X,
|
Chris@49
|
40 const BaseCube< typename force_different_type<typename T1::elem_type, typename T2::elem_type>::T2_result, T2>& Y
|
Chris@49
|
41 )
|
Chris@49
|
42 {
|
Chris@49
|
43 arma_extra_debug_sigprint();
|
Chris@49
|
44
|
Chris@49
|
45 typedef typename T1::elem_type eT1;
|
Chris@49
|
46 typedef typename T2::elem_type eT2;
|
Chris@49
|
47
|
Chris@49
|
48 typedef typename promote_type<eT1,eT2>::result out_eT;
|
Chris@49
|
49
|
Chris@49
|
50 promote_type<eT1,eT2>::check();
|
Chris@49
|
51
|
Chris@49
|
52 return mtGlueCube<out_eT, T1, T2, glue_mixed_schur>( X.get_ref(), Y.get_ref() );
|
Chris@49
|
53 }
|
Chris@49
|
54
|
Chris@49
|
55
|
Chris@49
|
56
|
Chris@49
|
57 //! @}
|