max@0
|
1 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
|
max@0
|
2 // Copyright (C) 2008-2010 Conrad Sanderson
|
max@0
|
3 //
|
max@0
|
4 // This file is part of the Armadillo C++ library.
|
max@0
|
5 // It is provided without any warranty of fitness
|
max@0
|
6 // for any purpose. You can redistribute this file
|
max@0
|
7 // and/or modify it under the terms of the GNU
|
max@0
|
8 // Lesser General Public License (LGPL) as published
|
max@0
|
9 // by the Free Software Foundation, either version 3
|
max@0
|
10 // of the License or (at your option) any later version.
|
max@0
|
11 // (see http://www.opensource.org/licenses for more info)
|
max@0
|
12
|
max@0
|
13
|
max@0
|
14 //! \addtogroup glue_times
|
max@0
|
15 //! @{
|
max@0
|
16
|
max@0
|
17
|
max@0
|
18
|
max@0
|
19 //! \brief
|
max@0
|
20 //! Template metaprogram depth_lhs
|
max@0
|
21 //! calculates the number of Glue<Tx,Ty, glue_type> instances on the left hand side argument of Glue<Tx,Ty, glue_type>
|
max@0
|
22 //! i.e. it recursively expands each Tx, until the type of Tx is not "Glue<..,.., glue_type>" (i.e the "glue_type" changes)
|
max@0
|
23
|
max@0
|
24 template<typename glue_type, typename T1>
|
max@0
|
25 struct depth_lhs
|
max@0
|
26 {
|
max@0
|
27 static const uword num = 0;
|
max@0
|
28 };
|
max@0
|
29
|
max@0
|
30 template<typename glue_type, typename T1, typename T2>
|
max@0
|
31 struct depth_lhs< glue_type, Glue<T1,T2,glue_type> >
|
max@0
|
32 {
|
max@0
|
33 static const uword num = 1 + depth_lhs<glue_type, T1>::num;
|
max@0
|
34 };
|
max@0
|
35
|
max@0
|
36
|
max@0
|
37
|
max@0
|
38 template<uword N>
|
max@0
|
39 struct glue_times_redirect
|
max@0
|
40 {
|
max@0
|
41 template<typename T1, typename T2>
|
max@0
|
42 inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_times>& X);
|
max@0
|
43 };
|
max@0
|
44
|
max@0
|
45
|
max@0
|
46 template<>
|
max@0
|
47 struct glue_times_redirect<3>
|
max@0
|
48 {
|
max@0
|
49 template<typename T1, typename T2, typename T3>
|
max@0
|
50 inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Glue<T1,T2,glue_times>,T3,glue_times>& X);
|
max@0
|
51 };
|
max@0
|
52
|
max@0
|
53
|
max@0
|
54 template<>
|
max@0
|
55 struct glue_times_redirect<4>
|
max@0
|
56 {
|
max@0
|
57 template<typename T1, typename T2, typename T3, typename T4>
|
max@0
|
58 inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Glue< Glue<T1,T2,glue_times>, T3, glue_times>, T4, glue_times>& X);
|
max@0
|
59 };
|
max@0
|
60
|
max@0
|
61
|
max@0
|
62
|
max@0
|
63 //! Class which implements the immediate multiplication of two or more matrices
|
max@0
|
64 class glue_times
|
max@0
|
65 {
|
max@0
|
66 public:
|
max@0
|
67
|
max@0
|
68
|
max@0
|
69 template<typename T1, typename T2>
|
max@0
|
70 inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_times>& X);
|
max@0
|
71
|
max@0
|
72
|
max@0
|
73 template<typename T1>
|
max@0
|
74 inline static void apply_inplace(Mat<typename T1::elem_type>& out, const T1& X);
|
max@0
|
75
|
max@0
|
76 template<typename T1, typename T2>
|
max@0
|
77 arma_hot inline static void apply_inplace_plus(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_times>& X, const sword sign);
|
max@0
|
78
|
max@0
|
79 template<typename eT1, typename eT2>
|
max@0
|
80 inline static void apply_mixed(Mat<typename promote_type<eT1,eT2>::result>& out, const Mat<eT1>& X, const Mat<eT2>& Y);
|
max@0
|
81
|
max@0
|
82
|
max@0
|
83 template<typename eT>
|
max@0
|
84 arma_inline static uword mul_storage_cost(const Mat<eT>& A, const Mat<eT>& B, const bool do_trans_A, const bool do_trans_B);
|
max@0
|
85
|
max@0
|
86 template<typename eT>
|
max@0
|
87 arma_hot inline static void apply(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, const eT val, const bool do_trans_A, const bool do_trans_B, const bool do_scalar_times);
|
max@0
|
88
|
max@0
|
89 template<typename eT>
|
max@0
|
90 inline static void apply(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, const Mat<eT>& C, const eT val, const bool do_trans_A, const bool do_trans_B, const bool do_trans_C, const bool do_scalar_times);
|
max@0
|
91
|
max@0
|
92 template<typename eT>
|
max@0
|
93 inline static void apply(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, const Mat<eT>& C, const Mat<eT>& D, const eT val, const bool do_trans_A, const bool do_trans_B, const bool do_trans_C, const bool do_trans_D, const bool do_scalar_times);
|
max@0
|
94
|
max@0
|
95 };
|
max@0
|
96
|
max@0
|
97
|
max@0
|
98
|
max@0
|
99 class glue_times_diag
|
max@0
|
100 {
|
max@0
|
101 public:
|
max@0
|
102
|
max@0
|
103 template<typename T1, typename T2>
|
max@0
|
104 arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_times_diag>& X);
|
max@0
|
105
|
max@0
|
106 };
|
max@0
|
107
|
max@0
|
108
|
max@0
|
109
|
max@0
|
110 //! @}
|
max@0
|
111
|