comparison armadillo-3.900.4/include/armadillo_bits/fn_trunc_log.hpp @ 49:1ec0e2823891

Switch to using subrepo copies of qm-dsp, nnls-chroma, vamp-plugin-sdk; update Armadillo version; assume build without external BLAS/LAPACK
author Chris Cannam
date Thu, 13 Jun 2013 10:25:24 +0100
parents
children
comparison
equal deleted inserted replaced
48:69251e11a913 49:1ec0e2823891
1 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-2012 Conrad Sanderson
3 //
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8
9 //! \addtogroup fn_trunc_log
10 //! @{
11
12
13
14 template<typename eT>
15 inline
16 static
17 typename arma_real_only<eT>::result
18 trunc_log(const eT x)
19 {
20 if(std::numeric_limits<eT>::is_iec559)
21 {
22 if(x == std::numeric_limits<eT>::infinity())
23 {
24 return Math<eT>::log_max();
25 }
26 else
27 {
28 return (x <= eT(0)) ? Math<eT>::log_min() : std::log(x);
29 }
30 }
31 else
32 {
33 return std::log(x);
34 }
35 }
36
37
38
39 template<typename eT>
40 inline
41 static
42 typename arma_integral_only<eT>::result
43 trunc_log(const eT x)
44 {
45 return eT( trunc_log( double(x) ) );
46 }
47
48
49
50 template<typename T>
51 inline
52 static
53 std::complex<T>
54 trunc_log(const std::complex<T>& x)
55 {
56 return std::complex<T>( trunc_log( std::abs(x) ), std::arg(x) );
57 }
58
59
60
61 template<typename T1>
62 arma_inline
63 const eOp<T1, eop_trunc_log>
64 trunc_log(const Base<typename T1::elem_type,T1>& A)
65 {
66 arma_extra_debug_sigprint();
67
68 return eOp<T1, eop_trunc_log>(A.get_ref());
69 }
70
71
72
73 template<typename T1>
74 arma_inline
75 const eOpCube<T1, eop_trunc_log>
76 trunc_log(const BaseCube<typename T1::elem_type,T1>& A)
77 {
78 arma_extra_debug_sigprint();
79
80 return eOpCube<T1, eop_trunc_log>(A.get_ref());
81 }
82
83
84
85 //! @}