fn_trunc_exp.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 
00014 
00017 
00018 
00019 
00020 template<typename eT>
00021 inline
00022 static
00023 typename arma_float_only<eT>::result
00024 trunc_exp(const eT x)
00025   {
00026   if(std::numeric_limits<eT>::is_iec559 && (x >= Math<eT>::log_max() ))
00027     {
00028     return std::numeric_limits<eT>::max();
00029     }
00030   else
00031     {
00032     return std::exp(x);
00033     }
00034   }
00035 
00036 
00037 
00038 template<typename eT>
00039 inline
00040 static
00041 typename arma_integral_only<eT>::result
00042 trunc_exp(const eT x)
00043   {
00044   return eT( trunc_exp( double(x) ) );
00045   }
00046 
00047 
00048 
00049 template<typename T>
00050 arma_inline
00051 static
00052 std::complex<T>
00053 trunc_exp(const std::complex<T>& x)
00054   {
00055   return std::exp(x);
00056   }
00057   
00058   
00059   
00060 template<typename T1>
00061 arma_inline
00062 const eOp<T1, eop_trunc_exp>
00063 trunc_exp(const Base<typename T1::elem_type,T1>& A)
00064   {
00065   arma_extra_debug_sigprint();
00066   
00067   return eOp<T1, eop_trunc_exp>(A.get_ref());
00068   }
00069 
00070 
00071 
00072 template<typename T1>
00073 arma_inline
00074 const eOpCube<T1, eop_trunc_exp>
00075 trunc_exp(const BaseCube<typename T1::elem_type,T1>& A)
00076   {
00077   arma_extra_debug_sigprint();
00078   
00079   return eOpCube<T1, eop_trunc_exp>(A.get_ref());
00080   }
00081 
00082 
00083 


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