fn_trunc_log.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2008-2010 Conrad Sanderson
00003 // 
00004 // This file is part of the Armadillo C++ library.
00005 // It is provided without any warranty of fitness
00006 // for any purpose. You can redistribute this file
00007 // and/or modify it under the terms of the GNU
00008 // Lesser General Public License (LGPL) as published
00009 // by the Free Software Foundation, either version 3
00010 // of the License or (at your option) any later version.
00011 // (see http://www.opensource.org/licenses for more info)
00012 
00013 
00016 
00017 
00018 
00019 template<typename eT>
00020 inline 
00021 static
00022 typename arma_float_only<eT>::result
00023 trunc_log(const eT x)
00024   {
00025   if(std::numeric_limits<eT>::is_iec559)
00026     {
00027     if(x == std::numeric_limits<eT>::infinity())
00028       {
00029       return Math<eT>::log_max();
00030       }
00031     else
00032       {
00033       return (x <= eT(0)) ? Math<eT>::log_min() : std::log(x);
00034       }
00035     }
00036   else
00037     {
00038     return std::log(x);
00039     }
00040   }
00041 
00042 
00043 
00044 template<typename eT>
00045 inline 
00046 static
00047 typename arma_integral_only<eT>::result
00048 trunc_log(const eT x)
00049   {
00050   return eT( trunc_log( double(x) ) );
00051   }
00052 
00053 
00054 
00055 template<typename T>
00056 inline 
00057 static
00058 std::complex<T>
00059 trunc_log(const std::complex<T>& x)
00060   {
00061   return std::log(x);
00062   }
00063 
00064 
00065 
00066 template<typename T1>
00067 arma_inline
00068 const eOp<T1, eop_trunc_log>
00069 trunc_log(const Base<typename T1::elem_type,T1>& A)
00070   {
00071   arma_extra_debug_sigprint();
00072   
00073   return eOp<T1, eop_trunc_log>(A.get_ref());
00074   }
00075 
00076 
00077 
00078 template<typename T1>
00079 arma_inline
00080 const eOpCube<T1, eop_trunc_log>
00081 trunc_log(const BaseCube<typename T1::elem_type,T1>& A)
00082   {
00083   arma_extra_debug_sigprint();
00084   
00085   return eOpCube<T1, eop_trunc_log>(A.get_ref());
00086   }
00087 
00088 
00089 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:04