operator_times.hpp
Go to the documentation of this file.
1 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-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 
17 
18 
19 
21 template<typename T1>
24 operator*
25 (const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type k)
26  {
28 
29  return eOp<T1, eop_scalar_times>(X.get_ref(),k);
30  }
31 
32 
33 
35 template<typename T1>
38 operator*
39 (const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X)
40  {
42 
43  return eOp<T1, eop_scalar_times>(X.get_ref(),k); // NOTE: order is swapped
44  }
45 
46 
47 
49 template<typename T1>
52 operator*
53  (
55  const std::complex<typename T1::pod_type>& k
56  )
57  {
59 
60  return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_times>('j', X.get_ref(), k);
61  }
62 
63 
64 
66 template<typename T1>
68 const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_times>
69 operator*
70  (
71  const std::complex<typename T1::pod_type>& k,
73  )
74  {
76 
77  return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_times>('j', X.get_ref(), k);
78  }
79 
80 
81 
83 template<typename T1>
86 operator*
87 (const typename T1::elem_type k, const Op<T1, op_htrans>& X)
88  {
90 
91  return Op<T1, op_htrans2>(X.m, k);
92  }
93 
94 
95 
97 template<typename T1>
100 operator*
101 (const Op<T1, op_htrans>& X, const typename T1::elem_type k)
102  {
104 
105  return Op<T1, op_htrans2>(X.m, k);
106  }
107 
108 
109 
111 template<typename T1, typename T2>
114 operator*
116  {
118 
119  return Glue<T1, Op<T2, op_diagmat>, glue_times_diag>(X.get_ref(), Y);
120  }
121 
122 
123 
125 template<typename T1, typename T2>
128 operator*
130  {
132 
133  return Glue<Op<T1, op_diagmat>, T2, glue_times_diag>(X, Y.get_ref());
134  }
135 
136 
137 
139 template<typename T1, typename T2>
142 operator*
144  {
146 
147  typedef typename T1::elem_type eT1;
148  typedef typename T2::elem_type eT2;
149 
150  typedef typename promote_type<eT1,eT2>::result out_eT;
151 
153 
154  const diagmat_proxy<T1> A(X.m);
155  const diagmat_proxy<T2> B(Y.m);
156 
157  arma_debug_assert_mul_size(A.n_elem, A.n_elem, B.n_elem, B.n_elem, "matrix multiply");
158 
159  const uword N = A.n_elem;
160 
161  Mat<out_eT> out(N,N);
162 
163  out.zeros();
164 
165  for(uword i=0; i<N; ++i)
166  {
167  out.at(i,i) = upgrade_val<eT1,eT2>::apply( A[i] ) * upgrade_val<eT1,eT2>::apply( B[i] );
168  }
169 
170  return out;
171  }
172 
173 
174 
176 template<typename T1, typename T2>
179 operator*
181  {
183 
184  return Glue<T1, T2, glue_times>(X.get_ref(), Y.get_ref());
185  }
186 
187 
188 
190 template<typename T1, typename T2>
191 inline
193 operator*
194  (
197  )
198  {
200 
201  typedef typename T1::elem_type eT1;
202  typedef typename T2::elem_type eT2;
203 
204  typedef typename promote_type<eT1,eT2>::result out_eT;
205 
207 
208  return mtGlue<out_eT, T1, T2, glue_mixed_times>( X.get_ref(), Y.get_ref() );
209  }
210 
211 
212 
is_promotable< T1, T2 >::result result
static void check()
arma_inline const derived & get_ref() const
Definition: Base_meat.hpp:22
const uword n_elem
arma_aligned const T1 & m
storage of reference to the operand (eg. a matrix)
Definition: Op_bones.hpp:45
u32 uword
Definition: typedef.hpp:85
arma_inline arma_warn_unused eT & at(const uword i)
linear element accessor (treats the matrix as a vector); no bounds check.
Definition: Mat_meat.hpp:3692
static arma_inline promote_type< T1, T2 >::result apply(const T1 x)
Definition: upgrade_val.hpp:31
#define arma_extra_debug_sigprint
Definition: debug.hpp:1116
#define arma_debug_assert_mul_size
Definition: debug.hpp:1087
Dense matrix class.
#define arma_inline
const Mat & zeros()
Definition: Mat_meat.hpp:4331


armadillo_matrix
Author(s):
autogenerated on Fri Apr 16 2021 02:31:58