Op_eps

Classes

class  op_eps

Functions

template<typename eT >
static eT op_eps::direct_eps (const eT x)
template<typename T >
static T op_eps::direct_eps (const std::complex< T > &x)
template<typename eT >
static void op_eps::direct_eps (Mat< eT > &out, const Mat< eT > &A)
template<typename T >
static void op_eps::direct_eps (Mat< T > &out, const Mat< std::complex< T > > &A)
template<typename T1 >
static void op_eps::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_eps > &in)

Function Documentation

template<typename eT >
eT op_eps::direct_eps ( const eT  x  )  [inline, static, inherited]

Definition at line 27 of file op_eps_meat.hpp.

References abs(), log10(), and pow().

Referenced by apply(), direct_eps(), op_pinv::direct_pinv(), eps(), and rank().

00028   {
00029   //arma_extra_debug_sigprint();
00030   
00031   // acording to IEEE Standard for Floating-Point Arithmetic (IEEE 754)
00032   // the mantissa length for double is 53 bits = std::numeric_limits<double>::digits
00033   // the mantissa length for float  is 24 bits = std::numeric_limits<float >::digits
00034   
00035   //return std::pow( std::numeric_limits<eT>::radix, (std::floor(std::log10(std::abs(x))/std::log10(std::numeric_limits<eT>::radix))-(std::numeric_limits<eT>::digits-1)) );
00036   
00037   const eT radix_eT     = eT(std::numeric_limits<eT>::radix);
00038   const eT digits_m1_eT = eT(std::numeric_limits<eT>::digits - 1);
00039   
00040   return std::pow( radix_eT, (std::floor(std::log10(std::abs(x))/std::log10(radix_eT)) - digits_m1_eT) );
00041   }

template<typename T >
T op_eps::direct_eps ( const std::complex< T > &  x  )  [inline, static, inherited]

Definition at line 48 of file op_eps_meat.hpp.

References abs(), log10(), and pow().

00049   {
00050   //arma_extra_debug_sigprint();
00051   
00052   //return std::pow( std::numeric_limits<T>::radix, (std::floor(std::log10(std::abs(x))/std::log10(std::numeric_limits<T>::radix))-(std::numeric_limits<T>::digits-1)) );
00053   
00054   const T radix_T     = T(std::numeric_limits<T>::radix);
00055   const T digits_m1_T = T(std::numeric_limits<T>::digits - 1);
00056   
00057   return std::pow( radix_T, (std::floor(std::log10(std::abs(x))/std::log10(radix_T)) - digits_m1_T) );
00058   }

template<typename eT >
void op_eps::direct_eps ( Mat< eT > &  out,
const Mat< eT > &  A 
) [inline, static, inherited]

Definition at line 65 of file op_eps_meat.hpp.

References Mat< eT >::copy_size(), direct_eps(), Mat< eT >::memptr(), and Mat< eT >::n_elem.

00066   {
00067   arma_extra_debug_sigprint();
00068   
00069   out.copy_size(A);
00070   
00071         eT* out_mem = out.memptr();
00072   const eT* A_mem   = A.memptr();
00073   const u32 n_elem  = A.n_elem;
00074   
00075   for(u32 i=0; i<n_elem; ++i)
00076     {
00077     out_mem[i] = op_eps::direct_eps( A_mem[i] );
00078     }
00079   
00080   }

template<typename T >
void op_eps::direct_eps ( Mat< T > &  out,
const Mat< std::complex< T > > &  A 
) [inline, static, inherited]

Definition at line 87 of file op_eps_meat.hpp.

References Mat< eT >::copy_size(), direct_eps(), and Mat< eT >::memptr().

00088   {
00089   arma_extra_debug_sigprint();
00090   
00091   typedef typename std::complex<T> eT;
00092   
00093   out.copy_size(A);
00094   
00095          T* out_mem = out.memptr();
00096   const eT* A_mem   = A.memptr();
00097   const u32 n_elem  = A.n_elem;
00098   
00099   for(u32 i=0; i<n_elem; ++i)
00100     {
00101     out_mem[i] = op_eps::direct_eps( A_mem[i] );
00102     }
00103   
00104   }

template<typename T1 >
void op_eps::apply ( Mat< typename T1::elem_type > &  out,
const Op< T1, op_eps > &  in 
) [inline, static, inherited]

Definition at line 111 of file op_eps_meat.hpp.

References direct_eps(), and Op< T1, op_type >::m.

00112   {
00113   arma_extra_debug_sigprint();
00114   
00115   typedef typename T1::elem_type  eT;
00116   
00117   // in this case it doesn't matter if there is aliasing
00118   // (i.e. &out = &in.m), hence we use unwrap rather than unwrap_check
00119   
00120   const unwrap<T1>   tmp(in.m);
00121   const Mat<eT>& A = tmp.M;
00122   
00123   op_eps::direct_eps(out, A);
00124   }