fn_trunc_log.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 eT>
20 inline
21 static
23 trunc_log(const eT x)
24  {
25  if(std::numeric_limits<eT>::is_iec559)
26  {
27  if(x == std::numeric_limits<eT>::infinity())
28  {
29  return Math<eT>::log_max();
30  }
31  else
32  {
33  return (x <= eT(0)) ? Math<eT>::log_min() : std::log(x);
34  }
35  }
36  else
37  {
38  return std::log(x);
39  }
40  }
41 
42 
43 
44 template<typename eT>
45 inline
46 static
48 trunc_log(const eT x)
49  {
50  return eT( trunc_log( double(x) ) );
51  }
52 
53 
54 
55 template<typename T>
56 inline
57 static
58 std::complex<T>
59 trunc_log(const std::complex<T>& x)
60  {
61  return std::log(x);
62  }
63 
64 
65 
66 template<typename T1>
70  {
72 
73  return eOp<T1, eop_trunc_log>(A.get_ref());
74  }
75 
76 
77 
78 template<typename T1>
82  {
84 
86  }
87 
88 
89 
arma_inline const derived & get_ref() const
Definition: Base_meat.hpp:22
static eT log_min()
log of the minimum representable value
Definition: constants.hpp:139
#define arma_extra_debug_sigprint
Definition: debug.hpp:1116
Analog of the Base class, intended for cubes.
#define arma_inline
arma_inline const derived & get_ref() const
arma_inline const eOp< T1, eop_log > log(const Base< typename T1::elem_type, T1 > &A)
Definition: fn_elem.hpp:156
static arma_float_only< eT >::result trunc_log(const eT x)
static eT log_max()
log of the maximum representable value
Definition: constants.hpp:142


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