fn_eps.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2009-2010 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2009-2010 Conrad Sanderson
00003 // Copyright (C) 2009-2010 Dimitrios Bouzas
00004 // 
00005 // This file is part of the Armadillo C++ library.
00006 // It is provided without any warranty of fitness
00007 // for any purpose. You can redistribute this file
00008 // and/or modify it under the terms of the GNU
00009 // Lesser General Public License (LGPL) as published
00010 // by the Free Software Foundation, either version 3
00011 // of the License or (at your option) any later version.
00012 // (see http://www.opensource.org/licenses for more info)
00013 
00014 
00015 
00018 
00019 
00020 
00023 template<typename T1>
00024 inline
00025 const eOp<T1, eop_eps>
00026 eps(const Base<typename T1::elem_type, T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = 0)
00027   {
00028   arma_extra_debug_sigprint();
00029   
00030   arma_ignore(junk);
00031   
00032   typedef typename T1::elem_type eT;
00033   
00034   return eOp<T1, eop_eps>(X.get_ref());
00035   }
00036 
00037 
00038 
00041 template<typename T1>
00042 inline
00043 Mat< typename T1::pod_type >
00044 eps(const Base< std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = 0)
00045   {
00046   arma_extra_debug_sigprint();
00047   
00048   arma_ignore(junk);
00049   
00050   typedef typename T1::pod_type   T;
00051   typedef typename T1::elem_type eT;
00052   
00053   const unwrap<T1>   tmp(X.get_ref());
00054   const Mat<eT>& A = tmp.M;
00055   
00056   Mat<T> out(A.n_rows, A.n_cols);
00057   
00058          T* out_mem = out.memptr();
00059   const eT* A_mem   = A.memptr();
00060   const uword n_elem  = A.n_elem;
00061   
00062   for(uword i=0; i<n_elem; ++i)
00063     {
00064     out_mem[i] = eop_aux::direct_eps( A_mem[i] );
00065     }
00066   
00067   
00068   return out;
00069   }
00070 
00071 
00072 
00073 template<typename eT>
00074 arma_inline
00075 arma_warn_unused
00076 typename arma_integral_only<eT>::result
00077 eps(const eT& x)
00078   {
00079   arma_ignore(x);
00080   
00081   return eT(0);
00082   }
00083 
00084 
00085 
00086 template<typename eT>
00087 arma_inline
00088 arma_warn_unused
00089 typename arma_float_only<eT>::result
00090 eps(const eT& x)
00091   {
00092   return eop_aux::direct_eps(x);
00093   }
00094 
00095 
00096 
00097 template<typename T>
00098 arma_inline
00099 arma_warn_unused
00100 typename arma_float_only<T>::result
00101 eps(const std::complex<T>& x)
00102   {
00103   return eop_aux::direct_eps(x);
00104   }
00105 
00106 
00107 


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:03