eop_aux Class Reference
[Eop_aux]

use of the SFINAE approach to work around compiler limitations http://en.wikipedia.org/wiki/SFINAE More...

#include <eop_aux.hpp>

List of all members.

Static Public Member Functions

template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
acos (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
asin (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
atan (const eT &x)
template<typename eT >
static arma_inline
arma_float_only< eT >::result 
acos (const eT &x)
template<typename eT >
static arma_inline
arma_float_only< eT >::result 
asin (const eT &x)
template<typename eT >
static arma_inline
arma_float_only< eT >::result 
atan (const eT &x)
template<typename eT >
static arma_inline
arma_cx_only< eT >::result 
acos (const eT &x)
template<typename eT >
static arma_inline
arma_cx_only< eT >::result 
asin (const eT &x)
template<typename eT >
static arma_inline
arma_cx_only< eT >::result 
atan (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
acosh (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
asinh (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
atanh (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
acosh (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
asinh (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
atanh (const eT &x)
template<typename eT >
static arma_inline eT conj (const eT &x)
template<typename T >
static arma_inline
std::complex< T > 
conj (const std::complex< T > &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
sqrt (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
log10 (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
log (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
exp (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
cos (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
sin (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
tan (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
cosh (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
sinh (const eT &x)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
tanh (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
sqrt (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
log10 (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
log (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
exp (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
cos (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
sin (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
tan (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
cosh (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
sinh (const eT &x)
template<typename eT >
static arma_inline
arma_float_or_cx_only< eT >
::result 
tanh (const eT &x)
template<typename T1 , typename T2 >
static arma_inline
arma_float_or_cx_only< T1 >
::result 
pow (const T1 base, const T2 exponent)
template<typename T1 , typename T2 >
static arma_inline
arma_integral_only< T1 >
::result 
pow (const T1 base, const T2 exponent)
template<typename T1 >
static arma_inline
arma_float_or_cx_only< T1 >
::result 
pow_int (const T1 base, const int exponent)
template<typename T1 >
static arma_inline
arma_integral_only< T1 >
::result 
pow_int (const T1 base, const int exponent)
template<typename eT >
static arma_inline
arma_integral_only< eT >
::result 
direct_eps (const eT &x)
template<typename eT >
static arma_float_only< eT >
::result 
direct_eps (const eT &x)
template<typename T >
static arma_float_only< T >::result direct_eps (const std::complex< T > &x)
template<typename eT >
static arma_inline
arma_unsigned_integral_only
< eT >::result 
arma_abs (const eT &x)
 work around a bug in GCC 4.4
template<typename eT >
static arma_inline
arma_signed_integral_only< eT >
::result 
arma_abs (const eT &x)
template<typename eT >
static arma_inline
arma_float_only< eT >::result 
arma_abs (const eT &x)
template<typename T >
static arma_inline
arma_float_only< T >::result 
arma_abs (const std::complex< T > &x)
template<typename eT , typename eop_type >
static arma_inline eT generate ()

Detailed Description

use of the SFINAE approach to work around compiler limitations http://en.wikipedia.org/wiki/SFINAE

Definition at line 122 of file eop_aux.hpp.


Member Function Documentation

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::acos ( const eT &  x  )  [inline, static]

Definition at line 126 of file eop_aux.hpp.

Referenced by acos().

00126 { return std::acos(double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::asin ( const eT &  x  )  [inline, static]

Definition at line 127 of file eop_aux.hpp.

Referenced by asin().

00127 { return std::asin(double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::atan ( const eT &  x  )  [inline, static]

Definition at line 128 of file eop_aux.hpp.

Referenced by atan().

00128 { return std::atan(double(x)); }

template<typename eT >
static arma_inline arma_float_only<eT>::result eop_aux::acos ( const eT &  x  )  [inline, static]

Definition at line 130 of file eop_aux.hpp.

References acos().

00130 { return std::acos(x); }

template<typename eT >
static arma_inline arma_float_only<eT>::result eop_aux::asin ( const eT &  x  )  [inline, static]

Definition at line 131 of file eop_aux.hpp.

References asin().

00131 { return std::asin(x); }

template<typename eT >
static arma_inline arma_float_only<eT>::result eop_aux::atan ( const eT &  x  )  [inline, static]

Definition at line 132 of file eop_aux.hpp.

References atan().

00132 { return std::atan(x); }

template<typename eT >
static arma_inline arma_cx_only<eT>::result eop_aux::acos ( const eT &  x  )  [inline, static]

Definition at line 134 of file eop_aux.hpp.

References arma_acos().

00134 { return arma_acos(x); }

template<typename eT >
static arma_inline arma_cx_only<eT>::result eop_aux::asin ( const eT &  x  )  [inline, static]

Definition at line 135 of file eop_aux.hpp.

References arma_asin().

00135 { return arma_asin(x); }

template<typename eT >
static arma_inline arma_cx_only<eT>::result eop_aux::atan ( const eT &  x  )  [inline, static]

Definition at line 136 of file eop_aux.hpp.

References arma_atan().

00136 { return arma_atan(x); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::acosh ( const eT &  x  )  [inline, static]

Definition at line 138 of file eop_aux.hpp.

References arma_acosh().

00138 { return arma_acosh(double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::asinh ( const eT &  x  )  [inline, static]

Definition at line 139 of file eop_aux.hpp.

References arma_asinh().

00139 { return arma_asinh(double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::atanh ( const eT &  x  )  [inline, static]

Definition at line 140 of file eop_aux.hpp.

References arma_atanh().

00140 { return arma_atanh(double(x)); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::acosh ( const eT &  x  )  [inline, static]

Definition at line 142 of file eop_aux.hpp.

References arma_acosh().

00142 { return arma_acosh(x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::asinh ( const eT &  x  )  [inline, static]

Definition at line 143 of file eop_aux.hpp.

References arma_asinh().

00143 { return arma_asinh(x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::atanh ( const eT &  x  )  [inline, static]

Definition at line 144 of file eop_aux.hpp.

References arma_atanh().

00144 { return arma_atanh(x); }

template<typename eT >
static arma_inline eT eop_aux::conj ( const eT &  x  )  [inline, static]

Definition at line 146 of file eop_aux.hpp.

Referenced by conj().

00146 { return x;            }

template<typename T >
static arma_inline std::complex<T> eop_aux::conj ( const std::complex< T > &  x  )  [inline, static]

Definition at line 147 of file eop_aux.hpp.

References conj().

00147 { return std::conj(x); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::sqrt ( const eT &  x  )  [inline, static]

Definition at line 149 of file eop_aux.hpp.

Referenced by sqrt().

00149 { return std::sqrt (double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::log10 ( const eT &  x  )  [inline, static]

Definition at line 150 of file eop_aux.hpp.

Referenced by log10().

00150 { return std::log10(double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::log ( const eT &  x  )  [inline, static]

Definition at line 151 of file eop_aux.hpp.

Referenced by log().

00151 { return std::log  (double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::exp ( const eT &  x  )  [inline, static]

Definition at line 152 of file eop_aux.hpp.

Referenced by exp().

00152 { return std::exp  (double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::cos ( const eT &  x  )  [inline, static]

Definition at line 153 of file eop_aux.hpp.

Referenced by cos().

00153 { return std::cos  (double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::sin ( const eT &  x  )  [inline, static]

Definition at line 154 of file eop_aux.hpp.

Referenced by sin().

00154 { return std::sin  (double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::tan ( const eT &  x  )  [inline, static]

Definition at line 155 of file eop_aux.hpp.

Referenced by tan().

00155 { return std::tan  (double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::cosh ( const eT &  x  )  [inline, static]

Definition at line 156 of file eop_aux.hpp.

Referenced by cosh().

00156 { return std::cosh (double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::sinh ( const eT &  x  )  [inline, static]

Definition at line 157 of file eop_aux.hpp.

Referenced by sinh().

00157 { return std::sinh (double(x)); }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::tanh ( const eT &  x  )  [inline, static]

Definition at line 158 of file eop_aux.hpp.

Referenced by tanh().

00158 { return std::tanh (double(x)); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::sqrt ( const eT &  x  )  [inline, static]

Definition at line 160 of file eop_aux.hpp.

References sqrt().

00160 { return std::sqrt (x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::log10 ( const eT &  x  )  [inline, static]

Definition at line 161 of file eop_aux.hpp.

References log10().

00161 { return std::log10(x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::log ( const eT &  x  )  [inline, static]

Definition at line 162 of file eop_aux.hpp.

References log().

00162 { return std::log  (x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::exp ( const eT &  x  )  [inline, static]

Definition at line 163 of file eop_aux.hpp.

References exp().

00163 { return std::exp  (x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::cos ( const eT &  x  )  [inline, static]

Definition at line 164 of file eop_aux.hpp.

References cos().

00164 { return std::cos  (x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::sin ( const eT &  x  )  [inline, static]

Definition at line 165 of file eop_aux.hpp.

References sin().

00165 { return std::sin  (x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::tan ( const eT &  x  )  [inline, static]

Definition at line 166 of file eop_aux.hpp.

References tan().

00166 { return std::tan  (x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::cosh ( const eT &  x  )  [inline, static]

Definition at line 167 of file eop_aux.hpp.

References cosh().

00167 { return std::cosh (x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::sinh ( const eT &  x  )  [inline, static]

Definition at line 168 of file eop_aux.hpp.

References sinh().

00168 { return std::sinh (x); }

template<typename eT >
static arma_inline arma_float_or_cx_only<eT>::result eop_aux::tanh ( const eT &  x  )  [inline, static]

Definition at line 169 of file eop_aux.hpp.

References tanh().

00169 { return std::tanh (x); }

template<typename T1 , typename T2 >
static arma_inline arma_float_or_cx_only<T1>::result eop_aux::pow ( const T1  base,
const T2  exponent 
) [inline, static]

Definition at line 177 of file eop_aux.hpp.

Referenced by direct_eps(), and pow_int().

00178     {
00179     return std::pow(base, exponent);
00180     }

template<typename T1 , typename T2 >
static arma_inline arma_integral_only<T1>::result eop_aux::pow ( const T1  base,
const T2  exponent 
) [inline, static]

Definition at line 188 of file eop_aux.hpp.

References pow().

00189     {
00190     return T1( std::pow( double(base), double(exponent) ) );
00191     }

template<typename T1 >
static arma_inline arma_float_or_cx_only<T1>::result eop_aux::pow_int ( const T1  base,
const int  exponent 
) [inline, static]

Definition at line 199 of file eop_aux.hpp.

References pow().

Referenced by eop_cube_core< eop_cube_type >::process(), and eop_core< eop_type >::process().

00200     { 
00201     return std::pow(base, exponent);
00202     }

template<typename T1 >
static arma_inline arma_integral_only<T1>::result eop_aux::pow_int ( const T1  base,
const int  exponent 
) [inline, static]

Definition at line 210 of file eop_aux.hpp.

References pow().

00211     { 
00212     return T1( std::pow( double(base), exponent) );
00213     }

template<typename eT >
static arma_inline arma_integral_only<eT>::result eop_aux::direct_eps ( const eT &  x  )  [inline, static]

Definition at line 221 of file eop_aux.hpp.

Referenced by op_pinv::direct_pinv(), eps(), eop_cube_core< eop_cube_type >::process(), eop_core< eop_type >::process(), and rank().

00222     {
00223     return eT(0);
00224     }

template<typename eT >
static arma_float_only<eT>::result eop_aux::direct_eps ( const eT &  x  )  [inline, static]

Definition at line 232 of file eop_aux.hpp.

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

00233     {
00234     //arma_extra_debug_sigprint();
00235     
00236     // acording to IEEE Standard for Floating-Point Arithmetic (IEEE 754)
00237     // the mantissa length for double is 53 bits = std::numeric_limits<double>::digits
00238     // the mantissa length for float  is 24 bits = std::numeric_limits<float >::digits
00239     
00240     //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)) );
00241     
00242     const eT radix_eT     = eT(std::numeric_limits<eT>::radix);
00243     const eT digits_m1_eT = eT(std::numeric_limits<eT>::digits - 1);
00244     
00245     // return std::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/std::log10(radix_eT)) - digits_m1_eT) );
00246     return eop_aux::pow( radix_eT, eT(std::floor(std::log10(std::abs(x))/std::log10(radix_eT)) - digits_m1_eT) );
00247     }

template<typename T >
static arma_float_only<T>::result eop_aux::direct_eps ( const std::complex< T > &  x  )  [inline, static]

Definition at line 255 of file eop_aux.hpp.

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

00256     {
00257     //arma_extra_debug_sigprint();
00258     
00259     //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)) );
00260     
00261     const T radix_T     = T(std::numeric_limits<T>::radix);
00262     const T digits_m1_T = T(std::numeric_limits<T>::digits - 1);
00263     
00264     return std::pow( radix_T, T(std::floor(std::log10(std::abs(x))/std::log10(radix_T)) - digits_m1_T) );
00265     }

template<typename eT >
static arma_inline arma_unsigned_integral_only<eT>::result eop_aux::arma_abs ( const eT &  x  )  [inline, static]

work around a bug in GCC 4.4

Definition at line 271 of file eop_aux.hpp.

Referenced by eop_cube_core< eop_cube_type >::process(), and eop_core< eop_type >::process().

00271 { return x;           }

template<typename eT >
static arma_inline arma_signed_integral_only<eT>::result eop_aux::arma_abs ( const eT &  x  )  [inline, static]

Definition at line 274 of file eop_aux.hpp.

References abs().

00274 { return std::abs(x); }

template<typename eT >
static arma_inline arma_float_only<eT>::result eop_aux::arma_abs ( const eT &  x  )  [inline, static]

Definition at line 277 of file eop_aux.hpp.

References abs().

00277 { return std::abs(x); }

template<typename T >
static arma_inline arma_float_only<T>::result eop_aux::arma_abs ( const std::complex< T > &  x  )  [inline, static]

Definition at line 280 of file eop_aux.hpp.

References abs().

00280 { return std::abs(x); }

template<typename eT , typename eop_type >
static arma_inline eT eop_aux::generate (  )  [inline, static]

Definition at line 288 of file eop_aux.hpp.

00289     {
00290          if(is_same_type<eop_type, eop_randu         >::value == true) { return eT(eop_aux_randu<eT>()); }
00291     else if(is_same_type<eop_type, eop_randn         >::value == true) { return eT(eop_aux_randn<eT>()); }
00292     else if(is_same_type<eop_type, eop_zeros         >::value == true) { return eT(0);                   }
00293     else if(is_same_type<eop_type, eop_ones_full     >::value == true) { return eT(1);                   }
00294     else if(is_same_type<eop_type, eop_cube_randu    >::value == true) { return eT(eop_aux_randu<eT>()); }
00295     else if(is_same_type<eop_type, eop_cube_randn    >::value == true) { return eT(eop_aux_randn<eT>()); }
00296     else if(is_same_type<eop_type, eop_cube_zeros    >::value == true) { return eT(0);                   }
00297     else if(is_same_type<eop_type, eop_cube_ones_full>::value == true) { return eT(1);                   }
00298     else                                                               { return eT(0);                   }
00299     }