1 // SPDX-License-Identifier: Apache-2.0
2 //
3 // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
4 // Copyright 2008-2016 National ICT Australia (NICTA)
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 // ------------------------------------------------------------------------
17 
18 
19 //! \addtogroup fn_elem
20 //! @{
21 
22 
23 //
24 // real
25 
26 template<typename T1>
27 arma_warn_unused
28 arma_inline
29 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const T1& >::result
real(const T1 & X)30 real(const T1& X)
31   {
32   arma_extra_debug_sigprint();
33 
34   return X;
35   }
36 
37 
38 
39 template<typename T1>
40 arma_warn_unused
41 arma_inline
42 const T1&
real(const BaseCube<typename T1::pod_type,T1> & X)43 real(const BaseCube<typename T1::pod_type, T1>& X)
44   {
45   arma_extra_debug_sigprint();
46 
47   return X.get_ref();
48   }
49 
50 
51 
52 template<typename T1>
53 arma_warn_unused
54 arma_inline
55 const T1&
real(const SpBase<typename T1::pod_type,T1> & A)56 real(const SpBase<typename T1::pod_type,T1>& A)
57   {
58   arma_extra_debug_sigprint();
59 
60   return A.get_ref();
61   }
62 
63 
64 
65 template<typename T1>
66 arma_warn_unused
67 inline
68 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::yes), const mtOp<typename T1::pod_type, T1, op_real> >::result
real(const T1 & X)69 real(const T1& X)
70   {
71   arma_extra_debug_sigprint();
72 
73   return mtOp<typename T1::pod_type, T1, op_real>( X );
74   }
75 
76 
77 
78 template<typename T1>
79 arma_warn_unused
80 inline
81 const mtOpCube<typename T1::pod_type, T1, op_real>
real(const BaseCube<std::complex<typename T1::pod_type>,T1> & X)82 real(const BaseCube<std::complex<typename T1::pod_type>, T1>& X)
83   {
84   arma_extra_debug_sigprint();
85 
86   return mtOpCube<typename T1::pod_type, T1, op_real>( X.get_ref() );
87   }
88 
89 
90 
91 template<typename T1>
92 arma_warn_unused
93 arma_inline
94 const mtSpOp<typename T1::pod_type, T1, spop_real>
real(const SpBase<std::complex<typename T1::pod_type>,T1> & A)95 real(const SpBase<std::complex<typename T1::pod_type>,T1>& A)
96   {
97   arma_extra_debug_sigprint();
98 
99   return mtSpOp<typename T1::pod_type, T1, spop_real>(A.get_ref());
100   }
101 
102 
103 
104 //
105 // imag
106 
107 template<typename T1>
108 arma_warn_unused
109 inline
110 const Gen< Mat<typename T1::pod_type>, gen_zeros >
imag(const Base<typename T1::pod_type,T1> & X)111 imag(const Base<typename T1::pod_type,T1>& X)
112   {
113   arma_extra_debug_sigprint();
114 
115   const Proxy<T1> A(X.get_ref());
116 
117   return Gen< Mat<typename T1::pod_type>, gen_zeros>(A.get_n_rows(), A.get_n_cols());
118   }
119 
120 
121 
122 template<typename T1>
123 arma_warn_unused
124 inline
125 const GenCube<typename T1::pod_type, gen_zeros>
imag(const BaseCube<typename T1::pod_type,T1> & X)126 imag(const BaseCube<typename T1::pod_type,T1>& X)
127   {
128   arma_extra_debug_sigprint();
129 
130   const ProxyCube<T1> A(X.get_ref());
131 
132   return GenCube<typename T1::pod_type, gen_zeros>(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
133   }
134 
135 
136 
137 template<typename T1>
138 arma_warn_unused
139 inline
140 SpMat<typename T1::pod_type>
imag(const SpBase<typename T1::pod_type,T1> & A)141 imag(const SpBase<typename T1::pod_type,T1>& A)
142   {
143   arma_extra_debug_sigprint();
144 
145   const SpProxy<T1> P(A.get_ref());
146 
147   return SpMat<typename T1::pod_type>(P.get_n_rows(), P.get_n_cols());
148   }
149 
150 
151 
152 template<typename T1>
153 arma_warn_unused
154 inline
155 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::yes), const mtOp<typename T1::pod_type, T1, op_imag> >::result
imag(const T1 & X)156 imag(const T1& X)
157   {
158   arma_extra_debug_sigprint();
159 
160   return mtOp<typename T1::pod_type, T1, op_imag>( X );
161   }
162 
163 
164 
165 template<typename T1>
166 arma_warn_unused
167 inline
168 const mtOpCube<typename T1::pod_type, T1, op_imag>
imag(const BaseCube<std::complex<typename T1::pod_type>,T1> & X)169 imag(const BaseCube<std::complex<typename T1::pod_type>,T1>& X)
170   {
171   arma_extra_debug_sigprint();
172 
173   return mtOpCube<typename T1::pod_type, T1, op_imag>( X.get_ref() );
174   }
175 
176 
177 
178 template<typename T1>
179 arma_warn_unused
180 arma_inline
181 const mtSpOp<typename T1::pod_type, T1, spop_imag>
imag(const SpBase<std::complex<typename T1::pod_type>,T1> & A)182 imag(const SpBase<std::complex<typename T1::pod_type>,T1>& A)
183   {
184   arma_extra_debug_sigprint();
185 
186   return mtSpOp<typename T1::pod_type, T1, spop_imag>(A.get_ref());
187   }
188 
189 
190 
191 //
192 // log
193 
194 template<typename T1>
195 arma_warn_unused
196 arma_inline
197 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_log> >::result
log(const T1 & A)198 log(const T1& A)
199   {
200   arma_extra_debug_sigprint();
201 
202   return eOp<T1, eop_log>(A);
203   }
204 
205 
206 
207 template<typename T1>
208 arma_warn_unused
209 arma_inline
210 const eOpCube<T1, eop_log>
log(const BaseCube<typename T1::elem_type,T1> & A)211 log(const BaseCube<typename T1::elem_type,T1>& A)
212   {
213   arma_extra_debug_sigprint();
214 
215   return eOpCube<T1, eop_log>(A.get_ref());
216   }
217 
218 
219 
220 //
221 // log2
222 
223 template<typename T1>
224 arma_warn_unused
225 arma_inline
226 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_log2> >::result
log2(const T1 & A)227 log2(const T1& A)
228   {
229   arma_extra_debug_sigprint();
230 
231   return eOp<T1, eop_log2>(A);
232   }
233 
234 
235 
236 template<typename T1>
237 arma_warn_unused
238 arma_inline
239 const eOpCube<T1, eop_log2>
log2(const BaseCube<typename T1::elem_type,T1> & A)240 log2(const BaseCube<typename T1::elem_type,T1>& A)
241   {
242   arma_extra_debug_sigprint();
243 
244   return eOpCube<T1, eop_log2>(A.get_ref());
245   }
246 
247 
248 
249 //
250 // log10
251 
252 template<typename T1>
253 arma_warn_unused
254 arma_inline
255 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_log10> >::result
log10(const T1 & A)256 log10(const T1& A)
257   {
258   arma_extra_debug_sigprint();
259 
260   return eOp<T1, eop_log10>(A);
261   }
262 
263 
264 
265 template<typename T1>
266 arma_warn_unused
267 arma_inline
268 const eOpCube<T1, eop_log10>
log10(const BaseCube<typename T1::elem_type,T1> & A)269 log10(const BaseCube<typename T1::elem_type,T1>& A)
270   {
271   arma_extra_debug_sigprint();
272 
273   return eOpCube<T1, eop_log10>(A.get_ref());
274   }
275 
276 
277 
278 //
279 // log1p
280 
281 template<typename T1>
282 arma_warn_unused
283 arma_inline
284 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_log1p> >::result
log1p(const T1 & A)285 log1p(const T1& A)
286   {
287   arma_extra_debug_sigprint();
288 
289   return eOp<T1, eop_log1p>(A);
290   }
291 
292 
293 
294 template<typename T1>
295 arma_warn_unused
296 arma_inline
297 typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_log1p> >::result
log1p(const BaseCube<typename T1::elem_type,T1> & A)298 log1p(const BaseCube<typename T1::elem_type,T1>& A)
299   {
300   arma_extra_debug_sigprint();
301 
302   return eOpCube<T1, eop_log1p>(A.get_ref());
303   }
304 
305 
306 
307 //
308 // exp
309 
310 template<typename T1>
311 arma_warn_unused
312 arma_inline
313 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_exp> >::result
exp(const T1 & A)314 exp(const T1& A)
315   {
316   arma_extra_debug_sigprint();
317 
318   return eOp<T1, eop_exp>(A);
319   }
320 
321 
322 
323 template<typename T1>
324 arma_warn_unused
325 arma_inline
326 const eOpCube<T1, eop_exp>
exp(const BaseCube<typename T1::elem_type,T1> & A)327 exp(const BaseCube<typename T1::elem_type,T1>& A)
328   {
329   arma_extra_debug_sigprint();
330 
331   return eOpCube<T1, eop_exp>(A.get_ref());
332   }
333 
334 
335 
336 // exp2
337 
338 template<typename T1>
339 arma_warn_unused
340 arma_inline
341 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_exp2> >::result
exp2(const T1 & A)342 exp2(const T1& A)
343   {
344   arma_extra_debug_sigprint();
345 
346   return eOp<T1, eop_exp2>(A);
347   }
348 
349 
350 
351 template<typename T1>
352 arma_warn_unused
353 arma_inline
354 const eOpCube<T1, eop_exp2>
exp2(const BaseCube<typename T1::elem_type,T1> & A)355 exp2(const BaseCube<typename T1::elem_type,T1>& A)
356   {
357   arma_extra_debug_sigprint();
358 
359   return eOpCube<T1, eop_exp2>(A.get_ref());
360   }
361 
362 
363 
364 // exp10
365 
366 template<typename T1>
367 arma_warn_unused
368 arma_inline
369 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_exp10> >::result
exp10(const T1 & A)370 exp10(const T1& A)
371   {
372   arma_extra_debug_sigprint();
373 
374   return eOp<T1, eop_exp10>(A);
375   }
376 
377 
378 
379 template<typename T1>
380 arma_warn_unused
381 arma_inline
382 const eOpCube<T1, eop_exp10>
exp10(const BaseCube<typename T1::elem_type,T1> & A)383 exp10(const BaseCube<typename T1::elem_type,T1>& A)
384   {
385   arma_extra_debug_sigprint();
386 
387   return eOpCube<T1, eop_exp10>(A.get_ref());
388   }
389 
390 
391 
392 // expm1
393 
394 template<typename T1>
395 arma_warn_unused
396 arma_inline
397 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_expm1> >::result
expm1(const T1 & A)398 expm1(const T1& A)
399   {
400   arma_extra_debug_sigprint();
401 
402   return eOp<T1, eop_expm1>(A);
403   }
404 
405 
406 
407 template<typename T1>
408 arma_warn_unused
409 arma_inline
410 typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_expm1> >::result
expm1(const BaseCube<typename T1::elem_type,T1> & A)411 expm1(const BaseCube<typename T1::elem_type,T1>& A)
412   {
413   arma_extra_debug_sigprint();
414 
415   return eOpCube<T1, eop_expm1>(A.get_ref());
416   }
417 
418 
419 
420 //
421 // abs
422 
423 
424 template<typename T1>
425 arma_warn_unused
426 arma_inline
427 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_abs> >::result
abs(const T1 & X)428 abs(const T1& X)
429   {
430   arma_extra_debug_sigprint();
431 
432   return eOp<T1, eop_abs>(X);
433   }
434 
435 
436 
437 template<typename T1>
438 arma_warn_unused
439 arma_inline
440 const eOpCube<T1, eop_abs>
abs(const BaseCube<typename T1::elem_type,T1> & X,const typename arma_not_cx<typename T1::elem_type>::result * junk=nullptr)441 abs(const BaseCube<typename T1::elem_type,T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
442   {
443   arma_extra_debug_sigprint();
444 
445   arma_ignore(junk);
446 
447   return eOpCube<T1, eop_abs>(X.get_ref());
448   }
449 
450 
451 
452 template<typename T1>
453 arma_warn_unused
454 inline
455 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::yes), const mtOp<typename T1::pod_type, T1, op_abs> >::result
abs(const T1 & X)456 abs(const T1& X)
457   {
458   arma_extra_debug_sigprint();
459 
460   return mtOp<typename T1::pod_type, T1, op_abs>(X);
461   }
462 
463 
464 
465 template<typename T1>
466 arma_warn_unused
467 inline
468 const mtOpCube<typename T1::pod_type, T1, op_abs>
abs(const BaseCube<std::complex<typename T1::pod_type>,T1> & X,const typename arma_cx_only<typename T1::elem_type>::result * junk=nullptr)469 abs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = nullptr)
470   {
471   arma_extra_debug_sigprint();
472 
473   arma_ignore(junk);
474 
475   return mtOpCube<typename T1::pod_type, T1, op_abs>( X.get_ref() );
476   }
477 
478 
479 
480 template<typename T1>
481 arma_warn_unused
482 arma_inline
483 const SpOp<T1, spop_abs>
abs(const SpBase<typename T1::elem_type,T1> & X,const typename arma_not_cx<typename T1::elem_type>::result * junk=nullptr)484 abs(const SpBase<typename T1::elem_type,T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
485   {
486   arma_extra_debug_sigprint();
487   arma_ignore(junk);
488 
489   return SpOp<T1, spop_abs>(X.get_ref());
490   }
491 
492 
493 
494 template<typename T1>
495 arma_warn_unused
496 arma_inline
497 const mtSpOp<typename T1::pod_type, T1, spop_cx_abs>
abs(const SpBase<std::complex<typename T1::pod_type>,T1> & X,const typename arma_cx_only<typename T1::elem_type>::result * junk=nullptr)498 abs(const SpBase< std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = nullptr)
499   {
500   arma_extra_debug_sigprint();
501   arma_ignore(junk);
502 
503   return mtSpOp<typename T1::pod_type, T1, spop_cx_abs>(X.get_ref());
504   }
505 
506 
507 
508 //
509 // arg
510 
511 
512 template<typename T1>
513 arma_warn_unused
514 arma_inline
515 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_arg> >::result
arg(const T1 & X)516 arg(const T1& X)
517   {
518   arma_extra_debug_sigprint();
519 
520   return eOp<T1, eop_arg>(X);
521   }
522 
523 
524 
525 template<typename T1>
526 arma_warn_unused
527 arma_inline
528 const eOpCube<T1, eop_arg>
arg(const BaseCube<typename T1::elem_type,T1> & X,const typename arma_not_cx<typename T1::elem_type>::result * junk=nullptr)529 arg(const BaseCube<typename T1::elem_type,T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
530   {
531   arma_extra_debug_sigprint();
532 
533   arma_ignore(junk);
534 
535   return eOpCube<T1, eop_arg>(X.get_ref());
536   }
537 
538 
539 
540 template<typename T1>
541 arma_warn_unused
542 inline
543 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::yes), const mtOp<typename T1::pod_type, T1, op_arg> >::result
arg(const T1 & X)544 arg(const T1& X)
545   {
546   arma_extra_debug_sigprint();
547 
548   return mtOp<typename T1::pod_type, T1, op_arg>(X);
549   }
550 
551 
552 
553 template<typename T1>
554 arma_warn_unused
555 inline
556 const mtOpCube<typename T1::pod_type, T1, op_arg>
arg(const BaseCube<std::complex<typename T1::pod_type>,T1> & X,const typename arma_cx_only<typename T1::elem_type>::result * junk=nullptr)557 arg(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = nullptr)
558   {
559   arma_extra_debug_sigprint();
560 
561   arma_ignore(junk);
562 
563   return mtOpCube<typename T1::pod_type, T1, op_arg>( X.get_ref() );
564   }
565 
566 
567 
568 template<typename T1>
569 arma_warn_unused
570 arma_inline
571 const SpOp<T1, spop_arg>
arg(const SpBase<typename T1::elem_type,T1> & X,const typename arma_not_cx<typename T1::elem_type>::result * junk=nullptr)572 arg(const SpBase<typename T1::elem_type,T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
573   {
574   arma_extra_debug_sigprint();
575   arma_ignore(junk);
576 
577   return SpOp<T1, spop_arg>(X.get_ref());
578   }
579 
580 
581 
582 template<typename T1>
583 arma_warn_unused
584 arma_inline
585 const mtSpOp<typename T1::pod_type, T1, spop_cx_arg>
arg(const SpBase<std::complex<typename T1::pod_type>,T1> & X,const typename arma_cx_only<typename T1::elem_type>::result * junk=nullptr)586 arg(const SpBase< std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = nullptr)
587   {
588   arma_extra_debug_sigprint();
589   arma_ignore(junk);
590 
591   return mtSpOp<typename T1::pod_type, T1, spop_cx_arg>(X.get_ref());
592   }
593 
594 
595 
596 //
597 // square
598 
599 template<typename T1>
600 arma_warn_unused
601 arma_inline
602 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_square> >::result
square(const T1 & A)603 square(const T1& A)
604   {
605   arma_extra_debug_sigprint();
606 
607   return eOp<T1, eop_square>(A);
608   }
609 
610 
611 
612 template<typename T1>
613 arma_warn_unused
614 arma_inline
615 const eOpCube<T1, eop_square>
square(const BaseCube<typename T1::elem_type,T1> & A)616 square(const BaseCube<typename T1::elem_type,T1>& A)
617   {
618   arma_extra_debug_sigprint();
619 
620   return eOpCube<T1, eop_square>(A.get_ref());
621   }
622 
623 
624 
625 template<typename T1>
626 arma_warn_unused
627 arma_inline
628 const SpOp<T1, spop_square>
square(const SpBase<typename T1::elem_type,T1> & A)629 square(const SpBase<typename T1::elem_type,T1>& A)
630   {
631   arma_extra_debug_sigprint();
632 
633   return SpOp<T1, spop_square>(A.get_ref());
634   }
635 
636 
637 
638 //
639 // sqrt
640 
641 template<typename T1>
642 arma_warn_unused
643 arma_inline
644 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_sqrt> >::result
sqrt(const T1 & A)645 sqrt(const T1& A)
646   {
647   arma_extra_debug_sigprint();
648 
649   return eOp<T1, eop_sqrt>(A);
650   }
651 
652 
653 
654 template<typename T1>
655 arma_warn_unused
656 arma_inline
657 const eOpCube<T1, eop_sqrt>
sqrt(const BaseCube<typename T1::elem_type,T1> & A)658 sqrt(const BaseCube<typename T1::elem_type,T1>& A)
659   {
660   arma_extra_debug_sigprint();
661 
662   return eOpCube<T1, eop_sqrt>(A.get_ref());
663   }
664 
665 
666 
667 template<typename T1>
668 arma_warn_unused
669 arma_inline
670 const SpOp<T1, spop_sqrt>
sqrt(const SpBase<typename T1::elem_type,T1> & A)671 sqrt(const SpBase<typename T1::elem_type,T1>& A)
672   {
673   arma_extra_debug_sigprint();
674 
675   return SpOp<T1, spop_sqrt>(A.get_ref());
676   }
677 
678 
679 
680 //
681 // conj
682 
683 template<typename T1>
684 arma_warn_unused
685 arma_inline
686 const T1&
conj(const Base<typename T1::pod_type,T1> & A)687 conj(const Base<typename T1::pod_type,T1>& A)
688   {
689   arma_extra_debug_sigprint();
690 
691   return A.get_ref();
692   }
693 
694 
695 
696 template<typename T1>
697 arma_warn_unused
698 arma_inline
699 const T1&
conj(const BaseCube<typename T1::pod_type,T1> & A)700 conj(const BaseCube<typename T1::pod_type,T1>& A)
701   {
702   arma_extra_debug_sigprint();
703 
704   return A.get_ref();
705   }
706 
707 
708 
709 template<typename T1>
710 arma_warn_unused
711 arma_inline
712 const T1&
conj(const SpBase<typename T1::pod_type,T1> & A)713 conj(const SpBase<typename T1::pod_type,T1>& A)
714   {
715   arma_extra_debug_sigprint();
716 
717   return A.get_ref();
718   }
719 
720 
721 
722 template<typename T1>
723 arma_warn_unused
724 arma_inline
725 const eOp<T1, eop_conj>
conj(const Base<std::complex<typename T1::pod_type>,T1> & A)726 conj(const Base<std::complex<typename T1::pod_type>,T1>& A)
727   {
728   arma_extra_debug_sigprint();
729 
730   return eOp<T1, eop_conj>(A.get_ref());
731   }
732 
733 
734 
735 template<typename T1>
736 arma_warn_unused
737 arma_inline
738 const eOpCube<T1, eop_conj>
conj(const BaseCube<std::complex<typename T1::pod_type>,T1> & A)739 conj(const BaseCube<std::complex<typename T1::pod_type>,T1>& A)
740   {
741   arma_extra_debug_sigprint();
742 
743   return eOpCube<T1, eop_conj>(A.get_ref());
744   }
745 
746 
747 
748 template<typename T1>
749 arma_warn_unused
750 arma_inline
751 const SpOp<T1, spop_conj>
conj(const SpBase<std::complex<typename T1::pod_type>,T1> & A)752 conj(const SpBase<std::complex<typename T1::pod_type>,T1>& A)
753   {
754   arma_extra_debug_sigprint();
755 
756   return SpOp<T1, spop_conj>(A.get_ref());
757   }
758 
759 
760 
761 // pow
762 
763 template<typename T1>
764 arma_warn_unused
765 arma_inline
766 const eOp<T1, eop_pow>
pow(const Base<typename T1::elem_type,T1> & A,const typename T1::elem_type exponent)767 pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type exponent)
768   {
769   arma_extra_debug_sigprint();
770 
771   return eOp<T1, eop_pow>(A.get_ref(), exponent);
772   }
773 
774 
775 
776 template<typename T1>
777 arma_warn_unused
778 arma_inline
779 const eOpCube<T1, eop_pow>
pow(const BaseCube<typename T1::elem_type,T1> & A,const typename T1::elem_type exponent)780 pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_type exponent)
781   {
782   arma_extra_debug_sigprint();
783 
784   return eOpCube<T1, eop_pow>(A.get_ref(), exponent);
785   }
786 
787 
788 
789 // pow, specialised handling (non-complex exponent for complex matrices)
790 
791 template<typename T1>
792 arma_warn_unused
793 arma_inline
794 const eOp<T1, eop_pow>
pow(const Base<typename T1::elem_type,T1> & A,const typename T1::elem_type::value_type exponent)795 pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type::value_type exponent)
796   {
797   arma_extra_debug_sigprint();
798 
799   typedef typename T1::elem_type eT;
800 
801   return eOp<T1, eop_pow>(A.get_ref(), eT(exponent));
802   }
803 
804 
805 
806 template<typename T1>
807 arma_warn_unused
808 arma_inline
809 const eOpCube<T1, eop_pow>
pow(const BaseCube<typename T1::elem_type,T1> & A,const typename T1::elem_type::value_type exponent)810 pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_type::value_type exponent)
811   {
812   arma_extra_debug_sigprint();
813 
814   typedef typename T1::elem_type eT;
815 
816   return eOpCube<T1, eop_pow>(A.get_ref(), eT(exponent));
817   }
818 
819 
820 
821 //
822 // floor
823 
824 template<typename T1>
825 arma_warn_unused
826 arma_inline
827 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_floor> >::result
floor(const T1 & A)828 floor(const T1& A)
829   {
830   arma_extra_debug_sigprint();
831 
832   return eOp<T1, eop_floor>(A);
833   }
834 
835 
836 
837 template<typename T1>
838 arma_warn_unused
839 arma_inline
840 const eOpCube<T1, eop_floor>
floor(const BaseCube<typename T1::elem_type,T1> & A)841 floor(const BaseCube<typename T1::elem_type,T1>& A)
842   {
843   arma_extra_debug_sigprint();
844 
845   return eOpCube<T1, eop_floor>(A.get_ref());
846   }
847 
848 
849 
850 template<typename T1>
851 arma_warn_unused
852 arma_inline
853 const SpOp<T1, spop_floor>
floor(const SpBase<typename T1::elem_type,T1> & X)854 floor(const SpBase<typename T1::elem_type,T1>& X)
855   {
856   arma_extra_debug_sigprint();
857 
858   return SpOp<T1, spop_floor>(X.get_ref());
859   }
860 
861 
862 
863 //
864 // ceil
865 
866 template<typename T1>
867 arma_warn_unused
868 arma_inline
869 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_ceil> >::result
ceil(const T1 & A)870 ceil(const T1& A)
871   {
872   arma_extra_debug_sigprint();
873 
874   return eOp<T1, eop_ceil>(A);
875   }
876 
877 
878 
879 template<typename T1>
880 arma_warn_unused
881 arma_inline
882 const eOpCube<T1, eop_ceil>
ceil(const BaseCube<typename T1::elem_type,T1> & A)883 ceil(const BaseCube<typename T1::elem_type,T1>& A)
884   {
885   arma_extra_debug_sigprint();
886 
887   return eOpCube<T1, eop_ceil>(A.get_ref());
888   }
889 
890 
891 
892 template<typename T1>
893 arma_warn_unused
894 arma_inline
895 const SpOp<T1, spop_ceil>
ceil(const SpBase<typename T1::elem_type,T1> & X)896 ceil(const SpBase<typename T1::elem_type,T1>& X)
897   {
898   arma_extra_debug_sigprint();
899 
900   return SpOp<T1, spop_ceil>(X.get_ref());
901   }
902 
903 
904 
905 //
906 // round
907 
908 template<typename T1>
909 arma_warn_unused
910 arma_inline
911 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_round> >::result
round(const T1 & A)912 round(const T1& A)
913   {
914   arma_extra_debug_sigprint();
915 
916   return eOp<T1, eop_round>(A);
917   }
918 
919 
920 
921 template<typename T1>
922 arma_warn_unused
923 arma_inline
924 const eOpCube<T1, eop_round>
round(const BaseCube<typename T1::elem_type,T1> & A)925 round(const BaseCube<typename T1::elem_type,T1>& A)
926   {
927   arma_extra_debug_sigprint();
928 
929   return eOpCube<T1, eop_round>(A.get_ref());
930   }
931 
932 
933 
934 template<typename T1>
935 arma_warn_unused
936 arma_inline
937 const SpOp<T1, spop_round>
round(const SpBase<typename T1::elem_type,T1> & X)938 round(const SpBase<typename T1::elem_type,T1>& X)
939   {
940   arma_extra_debug_sigprint();
941 
942   return SpOp<T1, spop_round>(X.get_ref());
943   }
944 
945 
946 
947 //
948 // trunc
949 
950 template<typename T1>
951 arma_warn_unused
952 arma_inline
953 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_trunc> >::result
trunc(const T1 & A)954 trunc(const T1& A)
955   {
956   arma_extra_debug_sigprint();
957 
958   return eOp<T1, eop_trunc>(A);
959   }
960 
961 
962 
963 template<typename T1>
964 arma_warn_unused
965 arma_inline
966 const eOpCube<T1, eop_trunc>
trunc(const BaseCube<typename T1::elem_type,T1> & A)967 trunc(const BaseCube<typename T1::elem_type,T1>& A)
968   {
969   arma_extra_debug_sigprint();
970 
971   return eOpCube<T1, eop_trunc>(A.get_ref());
972   }
973 
974 
975 
976 template<typename T1>
977 arma_warn_unused
978 arma_inline
979 const SpOp<T1, spop_trunc>
trunc(const SpBase<typename T1::elem_type,T1> & X)980 trunc(const SpBase<typename T1::elem_type,T1>& X)
981   {
982   arma_extra_debug_sigprint();
983 
984   return SpOp<T1, spop_trunc>(X.get_ref());
985   }
986 
987 
988 
989 //
990 // sign
991 
992 template<typename eT>
993 arma_warn_unused
994 arma_inline
995 typename arma_scalar_only<eT>::result
sign(const eT x)996 sign(const eT x)
997   {
998   arma_extra_debug_sigprint();
999 
1000   return arma_sign(x);
1001   }
1002 
1003 
1004 
1005 template<typename T1>
1006 arma_warn_unused
1007 arma_inline
1008 typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_sign> >::result
sign(const T1 & A)1009 sign(const T1& A)
1010   {
1011   arma_extra_debug_sigprint();
1012 
1013   return eOp<T1, eop_sign>(A);
1014   }
1015 
1016 
1017 
1018 template<typename T1>
1019 arma_warn_unused
1020 arma_inline
1021 const eOpCube<T1, eop_sign>
sign(const BaseCube<typename T1::elem_type,T1> & A)1022 sign(const BaseCube<typename T1::elem_type,T1>& A)
1023   {
1024   arma_extra_debug_sigprint();
1025 
1026   return eOpCube<T1, eop_sign>(A.get_ref());
1027   }
1028 
1029 
1030 
1031 template<typename T1>
1032 arma_warn_unused
1033 arma_inline
1034 const SpOp<T1, spop_sign>
sign(const SpBase<typename T1::elem_type,T1> & X)1035 sign(const SpBase<typename T1::elem_type,T1>& X)
1036   {
1037   arma_extra_debug_sigprint();
1038 
1039   return SpOp<T1, spop_sign>(X.get_ref());
1040   }
1041 
1042 
1043 
1044 //
1045 // erf
1046 
1047 template<typename T1>
1048 arma_warn_unused
1049 arma_inline
1050 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_erf> >::result
erf(const T1 & A)1051 erf(const T1& A)
1052   {
1053   arma_extra_debug_sigprint();
1054 
1055   return eOp<T1, eop_erf>(A);
1056   }
1057 
1058 
1059 
1060 template<typename T1>
1061 arma_warn_unused
1062 arma_inline
1063 typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_erf> >::result
erf(const BaseCube<typename T1::elem_type,T1> & A)1064 erf(const BaseCube<typename T1::elem_type,T1>& A)
1065   {
1066   arma_extra_debug_sigprint();
1067 
1068   return eOpCube<T1, eop_erf>(A.get_ref());
1069   }
1070 
1071 
1072 
1073 //
1074 // erfc
1075 
1076 template<typename T1>
1077 arma_warn_unused
1078 arma_inline
1079 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_erfc> >::result
erfc(const T1 & A)1080 erfc(const T1& A)
1081   {
1082   arma_extra_debug_sigprint();
1083 
1084   return eOp<T1, eop_erfc>(A);
1085   }
1086 
1087 
1088 
1089 template<typename T1>
1090 arma_warn_unused
1091 arma_inline
1092 typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_erfc> >::result
erfc(const BaseCube<typename T1::elem_type,T1> & A)1093 erfc(const BaseCube<typename T1::elem_type,T1>& A)
1094   {
1095   arma_extra_debug_sigprint();
1096 
1097   return eOpCube<T1, eop_erfc>(A.get_ref());
1098   }
1099 
1100 
1101 
1102 //
1103 // lgamma
1104 
1105 template<typename T1>
1106 arma_warn_unused
1107 arma_inline
1108 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_lgamma> >::result
lgamma(const T1 & A)1109 lgamma(const T1& A)
1110   {
1111   arma_extra_debug_sigprint();
1112 
1113   return eOp<T1, eop_lgamma>(A);
1114   }
1115 
1116 
1117 
1118 template<typename T1>
1119 arma_warn_unused
1120 arma_inline
1121 typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_lgamma> >::result
lgamma(const BaseCube<typename T1::elem_type,T1> & A)1122 lgamma(const BaseCube<typename T1::elem_type,T1>& A)
1123   {
1124   arma_extra_debug_sigprint();
1125 
1126   return eOpCube<T1, eop_lgamma>(A.get_ref());
1127   }
1128 
1129 
1130 
1131 //
1132 // tgamma
1133 
1134 template<typename T1>
1135 arma_warn_unused
1136 arma_inline
1137 typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_tgamma> >::result
tgamma(const T1 & A)1138 tgamma(const T1& A)
1139   {
1140   arma_extra_debug_sigprint();
1141 
1142   return eOp<T1, eop_tgamma>(A);
1143   }
1144 
1145 
1146 
1147 template<typename T1>
1148 arma_warn_unused
1149 arma_inline
1150 typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_tgamma> >::result
tgamma(const BaseCube<typename T1::elem_type,T1> & A)1151 tgamma(const BaseCube<typename T1::elem_type,T1>& A)
1152   {
1153   arma_extra_debug_sigprint();
1154 
1155   return eOpCube<T1, eop_tgamma>(A.get_ref());
1156   }
1157 
1158 
1159 
1160 // the functions below are currently unused; reserved for potential future use
1161 
exp_approx(const T1 &)1162 template<typename T1> void exp_approx(const T1&) { arma_stop_logic_error("unimplemented"); }
log_approx(const T1 &)1163 template<typename T1> void log_approx(const T1&) { arma_stop_logic_error("unimplemented"); }
approx_exp(const T1 &)1164 template<typename T1> void approx_exp(const T1&) { arma_stop_logic_error("unimplemented"); }
approx_log(const T1 &)1165 template<typename T1> void approx_log(const T1&) { arma_stop_logic_error("unimplemented"); }
1166 
1167 //! @}
1168