op_cx_scalar_meat.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 
16 
17 
18 
19 template<typename T1>
20 inline
21 void
23  (
24  Mat< typename std::complex<typename T1::pod_type> >& out,
25  const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_times>& X
26  )
27  {
29 
30  typedef typename std::complex<typename T1::pod_type> eT;
31  typedef typename T1::pod_type T;
32 
33  const Proxy<T1> A(X.m);
34 
35  out.set_size(A.get_n_rows(), A.get_n_cols());
36 
37  const eT k = X.aux_out_eT;
38  const uword n_elem = out.n_elem;
39  eT* out_mem = out.memptr();
40 
41  for(uword i=0; i<n_elem; ++i)
42  {
43  out_mem[i] = A[i] * k;
44  }
45  }
46 
47 
48 
49 template<typename T1>
50 inline
51 void
53  (
54  Mat< typename std::complex<typename T1::pod_type> >& out,
55  const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>& X
56  )
57  {
59 
60  typedef typename std::complex<typename T1::pod_type> eT;
61  typedef typename T1::pod_type T;
62 
63  const Proxy<T1> A(X.m);
64 
65  out.set_size(A.get_n_rows(), A.get_n_cols());
66 
67  const eT k = X.aux_out_eT;
68  const uword n_elem = out.n_elem;
69  eT* out_mem = out.memptr();
70 
71  for(uword i=0; i<n_elem; ++i)
72  {
73  out_mem[i] = A[i] + k;
74  }
75  }
76 
77 
78 
79 template<typename T1>
80 inline
81 void
83  (
84  Mat< typename std::complex<typename T1::pod_type> >& out,
85  const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_pre>& X
86  )
87  {
89 
90  typedef typename std::complex<typename T1::pod_type> eT;
91  typedef typename T1::pod_type T;
92 
93  const Proxy<T1> A(X.m);
94 
95  out.set_size(A.get_n_rows(), A.get_n_cols());
96 
97  const eT k = X.aux_out_eT;
98  const uword n_elem = out.n_elem;
99  eT* out_mem = out.memptr();
100 
101  for(uword i=0; i<n_elem; ++i)
102  {
103  out_mem[i] = k - A[i];
104  }
105  }
106 
107 
108 
109 template<typename T1>
110 inline
111 void
113  (
114  Mat< typename std::complex<typename T1::pod_type> >& out,
115  const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_post>& X
116  )
117  {
119 
120  typedef typename std::complex<typename T1::pod_type> eT;
121  typedef typename T1::pod_type T;
122 
123  const Proxy<T1> A(X.m);
124 
125  out.set_size(A.get_n_rows(), A.get_n_cols());
126 
127  const eT k = X.aux_out_eT;
128  const uword n_elem = out.n_elem;
129  eT* out_mem = out.memptr();
130 
131  for(uword i=0; i<n_elem; ++i)
132  {
133  out_mem[i] = A[i] - k;
134  }
135  }
136 
137 
138 
139 template<typename T1>
140 inline
141 void
143  (
144  Mat< typename std::complex<typename T1::pod_type> >& out,
145  const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_pre>& X
146  )
147  {
149 
150  typedef typename std::complex<typename T1::pod_type> eT;
151  typedef typename T1::pod_type T;
152 
153  const Proxy<T1> A(X.m);
154 
155  out.set_size(A.get_n_rows(), A.get_n_cols());
156 
157  const eT k = X.aux_out_eT;
158  const uword n_elem = out.n_elem;
159  eT* out_mem = out.memptr();
160 
161  for(uword i=0; i<n_elem; ++i)
162  {
163  out_mem[i] = k / A[i];
164  }
165  }
166 
167 
168 
169 template<typename T1>
170 inline
171 void
173  (
174  Mat< typename std::complex<typename T1::pod_type> >& out,
175  const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_post>& X
176  )
177  {
179 
180  typedef typename std::complex<typename T1::pod_type> eT;
181  typedef typename T1::pod_type T;
182 
183  const Proxy<T1> A(X.m);
184 
185  out.set_size(A.get_n_rows(), A.get_n_cols());
186 
187  const eT k = X.aux_out_eT;
188  const uword n_elem = out.n_elem;
189  eT* out_mem = out.memptr();
190 
191  for(uword i=0; i<n_elem; ++i)
192  {
193  out_mem[i] = A[i] / k;
194  }
195  }
196 
197 
198 
199 //
200 //
201 //
202 
203 
204 
205 template<typename T1>
206 inline
207 void
209  (
210  Cube< typename std::complex<typename T1::pod_type> >& out,
211  const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_times>& X
212  )
213  {
215 
216  typedef typename std::complex<typename T1::pod_type> eT;
217  typedef typename T1::pod_type T;
218 
219  const ProxyCube<T1> A(X.m);
220 
221  out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
222 
223  const eT k = X.aux_out_eT;
224  const uword n_elem = out.n_elem;
225  eT* out_mem = out.memptr();
226 
227  for(uword i=0; i<n_elem; ++i)
228  {
229  out_mem[i] = A[i] * k;
230  }
231  }
232 
233 
234 
235 template<typename T1>
236 inline
237 void
239  (
240  Cube< typename std::complex<typename T1::pod_type> >& out,
241  const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>& X
242  )
243  {
245 
246  typedef typename std::complex<typename T1::pod_type> eT;
247  typedef typename T1::pod_type T;
248 
249  const ProxyCube<T1> A(X.m);
250 
251  out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
252 
253  const eT k = X.aux_out_eT;
254  const uword n_elem = out.n_elem;
255  eT* out_mem = out.memptr();
256 
257  for(uword i=0; i<n_elem; ++i)
258  {
259  out_mem[i] = A[i] + k;
260  }
261  }
262 
263 
264 
265 template<typename T1>
266 inline
267 void
269  (
270  Cube< typename std::complex<typename T1::pod_type> >& out,
271  const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_pre>& X
272  )
273  {
275 
276  typedef typename std::complex<typename T1::pod_type> eT;
277  typedef typename T1::pod_type T;
278 
279  const ProxyCube<T1> A(X.m);
280 
281  out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
282 
283  const eT k = X.aux_out_eT;
284  const uword n_elem = out.n_elem;
285  eT* out_mem = out.memptr();
286 
287  for(uword i=0; i<n_elem; ++i)
288  {
289  out_mem[i] = k - A[i];
290  }
291  }
292 
293 
294 
295 template<typename T1>
296 inline
297 void
299  (
300  Cube< typename std::complex<typename T1::pod_type> >& out,
301  const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_post>& X
302  )
303  {
305 
306  typedef typename std::complex<typename T1::pod_type> eT;
307  typedef typename T1::pod_type T;
308 
309  const ProxyCube<T1> A(X.m);
310 
311  out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
312 
313  const eT k = X.aux_out_eT;
314  const uword n_elem = out.n_elem;
315  eT* out_mem = out.memptr();
316 
317  for(uword i=0; i<n_elem; ++i)
318  {
319  out_mem[i] = A[i] - k;
320  }
321  }
322 
323 
324 
325 template<typename T1>
326 inline
327 void
329  (
330  Cube< typename std::complex<typename T1::pod_type> >& out,
331  const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_pre>& X
332  )
333  {
335 
336  typedef typename std::complex<typename T1::pod_type> eT;
337  typedef typename T1::pod_type T;
338 
339  const ProxyCube<T1> A(X.m);
340 
341  out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
342 
343  const eT k = X.aux_out_eT;
344  const uword n_elem = out.n_elem;
345  eT* out_mem = out.memptr();
346 
347  for(uword i=0; i<n_elem; ++i)
348  {
349  out_mem[i] = k / A[i];
350  }
351  }
352 
353 
354 
355 template<typename T1>
356 inline
357 void
359  (
360  Cube< typename std::complex<typename T1::pod_type> >& out,
361  const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_post>& X
362  )
363  {
365 
366  typedef typename std::complex<typename T1::pod_type> eT;
367  typedef typename T1::pod_type T;
368 
369  const ProxyCube<T1> A(X.m);
370 
371  out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
372 
373  const eT k = X.aux_out_eT;
374  const uword n_elem = out.n_elem;
375  eT* out_mem = out.memptr();
376 
377  for(uword i=0; i<n_elem; ++i)
378  {
379  out_mem[i] = A[i] / k;
380  }
381  }
382 
383 
384 
static void apply(Mat< typename std::complex< typename T1::pod_type > > &out, const mtOp< typename std::complex< typename T1::pod_type >, T1, op_cx_scalar_div_post > &X)
static void apply(Mat< typename std::complex< typename T1::pod_type > > &out, const mtOp< typename std::complex< typename T1::pod_type >, T1, op_cx_scalar_minus_pre > &X)
u32 uword
Definition: typedef.hpp:85
static void apply(Mat< typename std::complex< typename T1::pod_type > > &out, const mtOp< typename std::complex< typename T1::pod_type >, T1, op_cx_scalar_times > &X)
static void apply(Mat< typename std::complex< typename T1::pod_type > > &out, const mtOp< typename std::complex< typename T1::pod_type >, T1, op_cx_scalar_div_pre > &X)
Dense cube class.
Definition: Cube_bones.hpp:30
#define arma_extra_debug_sigprint
Definition: debug.hpp:1116
static void apply(Mat< typename std::complex< typename T1::pod_type > > &out, const mtOp< typename std::complex< typename T1::pod_type >, T1, op_cx_scalar_plus > &X)
Dense matrix class.
static void apply(Mat< typename std::complex< typename T1::pod_type > > &out, const mtOp< typename std::complex< typename T1::pod_type >, T1, op_cx_scalar_minus_post > &X)


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