Classes | Functions

Eop_cube_core

//! More...

Classes

class  eop_cube_core< eop_cube_type >
class  eop_cube_neg
class  eop_cube_scalar_plus
class  eop_cube_scalar_minus_pre
class  eop_cube_scalar_minus_post
class  eop_cube_scalar_times
class  eop_cube_scalar_div_pre
class  eop_cube_scalar_div_post
class  eop_cube_square
class  eop_cube_sqrt
class  eop_cube_log10
class  eop_cube_log
class  eop_cube_trunc_log
class  eop_cube_exp
class  eop_cube_trunc_exp
class  eop_cube_cos
class  eop_cube_cosh
class  eop_cube_acos
class  eop_cube_acosh
class  eop_cube_sin
class  eop_cube_sinh
class  eop_cube_asin
class  eop_cube_asinh
class  eop_cube_tan
class  eop_cube_tanh
class  eop_cube_atan
class  eop_cube_atanh
class  eop_cube_eps
class  eop_cube_abs
class  eop_cube_conj
class  eop_cube_pow
class  eop_cube_pow_int
class  eop_cube_ones_full
class  eop_cube_randu
class  eop_cube_randn
class  eop_cube_zeros
struct  is_cube_generator< T1 >
struct  is_cube_generator< eop_cube_ones_full >
struct  is_cube_generator< eop_cube_randu >
struct  is_cube_generator< eop_cube_randn >
struct  is_cube_generator< eop_cube_zeros >

Functions

template<typename T1 >
arma_hot static arma_inline
T1::elem_type 
eop_cube_core::get_elem (const eOpCube< T1, eop_cube_type > &x, const u32 i)
template<typename T1 >
arma_hot static arma_inline
T1::elem_type 
eop_cube_core::get_elem (const eOpCube< T1, eop_cube_type > &x, const u32 row, const u32 col, const u32 slice)
template<typename T1 >
arma_hot static arma_inline
T1::elem_type 
eop_cube_core::process (const eOpCube< T1, eop_cube_type > &x, const typename T1::elem_type val)
template<typename T1 >
arma_hot static arma_inline void eop_cube_core::apply (Cube< typename T1::elem_type > &out, const eOpCube< T1, eop_cube_type > &x)
template<typename T1 >
static arma_hot void eop_cube_core::apply_proxy (Cube< typename T1::elem_type > &out, const eOpCube< T1, eop_cube_type > &x)
template<typename T1 >
static arma_hot void eop_cube_core::apply_unwrap (Cube< typename T1::elem_type > &out, const eOpCube< T1, eop_cube_type > &x)
template<typename T1 >
static arma_hot void eop_cube_core::apply_inplace_plus (Cube< typename T1::elem_type > &out, const eOpCube< T1, eop_cube_type > &x)
template<typename T1 >
static arma_hot void eop_cube_core::apply_inplace_minus (Cube< typename T1::elem_type > &out, const eOpCube< T1, eop_cube_type > &x)
template<typename T1 >
static arma_hot void eop_cube_core::apply_inplace_schur (Cube< typename T1::elem_type > &out, const eOpCube< T1, eop_cube_type > &x)
template<typename T1 >
static arma_hot void eop_cube_core::apply_inplace_div (Cube< typename T1::elem_type > &out, const eOpCube< T1, eop_cube_type > &x)

Detailed Description

//!


Function Documentation

template<typename eop_cube_type>
template<typename T1 >
arma_hot arma_inline T1::elem_type eop_cube_core< eop_cube_type >::get_elem ( const eOpCube< T1, eop_cube_type > &  x,
const u32  i 
) [static, inherited]

Definition at line 27 of file eop_cube_core_meat.hpp.

References eOpCube< T1, eop_type >::P, and eop_cube_core< eop_cube_type >::process().

  {
  typedef typename T1::elem_type eT;
  
  if(is_cube_generator<eop_cube_type>::value == true) { return eop_aux::generate<eT,eop_cube_type>();            }
  else                                                { return eop_cube_core<eop_cube_type>::process(x, x.P[i]); }
  }

template<typename eop_cube_type>
template<typename T1 >
arma_hot arma_inline T1::elem_type eop_cube_core< eop_cube_type >::get_elem ( const eOpCube< T1, eop_cube_type > &  x,
const u32  row,
const u32  col,
const u32  slice 
) [static, inherited]

Definition at line 42 of file eop_cube_core_meat.hpp.

References eOpCube< T1, eop_type >::P, and eop_cube_core< eop_cube_type >::process().

  {
  typedef typename T1::elem_type eT;
  
  if(is_cube_generator<eop_cube_type>::value == true) { return eop_aux::generate<eT,eop_cube_type>();                           }
  else                                                { return eop_cube_core<eop_cube_type>::process(x, x.P.at(row,col,slice)); }
  }

template<typename eop_cube_type>
template<typename T1 >
arma_hot arma_inline T1::elem_type eop_cube_core< eop_cube_type >::process ( const eOpCube< T1, eop_cube_type > &  x,
const typename T1::elem_type  val 
) [static, inherited]

Definition at line 57 of file eop_cube_core_meat.hpp.

References acos(), acosh(), eop_aux::arma_abs(), arma_stop(), asin(), asinh(), atan(), atanh(), eOpCube< T1, eop_type >::aux, eOpCube< T1, eop_type >::aux_u32_a, eOpCube< T1, eop_type >::aux_u32_b, conj(), cos(), cosh(), eop_aux::direct_eps(), exp(), log(), log10(), pow(), eop_aux::pow_int(), sin(), sinh(), sqrt(), tan(), tanh(), trunc_exp(), and trunc_log().

Referenced by eop_cube_core< eop_cube_type >::apply_inplace_div(), eop_cube_core< eop_cube_type >::apply_inplace_minus(), eop_cube_core< eop_cube_type >::apply_inplace_plus(), eop_cube_core< eop_cube_type >::apply_inplace_schur(), eop_cube_core< eop_cube_type >::apply_proxy(), eop_cube_core< eop_cube_type >::apply_unwrap(), and eop_cube_core< eop_cube_type >::get_elem().

  {
  typedef typename T1::elem_type eT;
  
  // the optimiser will keep only one return statement
  
       if(is_same_type<eop_cube_type, eop_cube_neg              >::value == true) { return -val;                    }
  else if(is_same_type<eop_cube_type, eop_cube_scalar_plus      >::value == true) { return val + x.aux;             }
  else if(is_same_type<eop_cube_type, eop_cube_scalar_minus_pre >::value == true) { return x.aux - val;             }
  else if(is_same_type<eop_cube_type, eop_cube_scalar_minus_post>::value == true) { return val - x.aux;             }
  else if(is_same_type<eop_cube_type, eop_cube_scalar_times     >::value == true) { return val * x.aux;             }
  else if(is_same_type<eop_cube_type, eop_cube_scalar_div_pre   >::value == true) { return x.aux / val;             }
  else if(is_same_type<eop_cube_type, eop_cube_scalar_div_post  >::value == true) { return val / x.aux;             }
  else if(is_same_type<eop_cube_type, eop_cube_square           >::value == true) { return val*val;                 }
  else if(is_same_type<eop_cube_type, eop_cube_sqrt             >::value == true) { return eop_aux::sqrt(val);      }
  else if(is_same_type<eop_cube_type, eop_cube_log10            >::value == true) { return eop_aux::log10(val);     }
  else if(is_same_type<eop_cube_type, eop_cube_log              >::value == true) { return eop_aux::log(val);       }
  else if(is_same_type<eop_cube_type, eop_cube_trunc_log        >::value == true) { return    arma::trunc_log(val); }
  else if(is_same_type<eop_cube_type, eop_cube_exp              >::value == true) { return eop_aux::exp(val);       }
  else if(is_same_type<eop_cube_type, eop_cube_trunc_exp        >::value == true) { return    arma::trunc_exp(val); }
  else if(is_same_type<eop_cube_type, eop_cube_cos              >::value == true) { return eop_aux::cos(val);       }
  else if(is_same_type<eop_cube_type, eop_cube_cosh             >::value == true) { return eop_aux::cosh(val);      }
  else if(is_same_type<eop_cube_type, eop_cube_acos             >::value == true) { return eop_aux::acos(val);      }
  else if(is_same_type<eop_cube_type, eop_cube_acosh            >::value == true) { return eop_aux::acosh(val);     }
  else if(is_same_type<eop_cube_type, eop_cube_sin              >::value == true) { return eop_aux::sin(val);       }
  else if(is_same_type<eop_cube_type, eop_cube_sinh             >::value == true) { return eop_aux::sinh(val);      }
  else if(is_same_type<eop_cube_type, eop_cube_asin             >::value == true) { return eop_aux::asin(val);      }
  else if(is_same_type<eop_cube_type, eop_cube_asinh            >::value == true) { return eop_aux::asinh(val);     }
  else if(is_same_type<eop_cube_type, eop_cube_tan              >::value == true) { return eop_aux::tan(val);       }
  else if(is_same_type<eop_cube_type, eop_cube_tanh             >::value == true) { return eop_aux::tanh(val);      }
  else if(is_same_type<eop_cube_type, eop_cube_atan             >::value == true) { return eop_aux::atan(val);      }
  else if(is_same_type<eop_cube_type, eop_cube_atanh            >::value == true) { return eop_aux::atanh(val);     }
  else if(is_same_type<eop_cube_type, eop_cube_eps              >::value == true) { return eop_aux::direct_eps(val);}
  else if(is_same_type<eop_cube_type, eop_cube_abs              >::value == true) { return eop_aux::arma_abs(val);  }
  else if(is_same_type<eop_cube_type, eop_cube_conj             >::value == true) { return eop_aux::conj(val);      }
  else if(is_same_type<eop_cube_type, eop_cube_pow              >::value == true) { return eop_aux::pow(val, x.aux);}
  else if(is_same_type<eop_cube_type, eop_cube_pow_int          >::value == true)
    {
    const int exponent = (x.aux_u32_b == 0) ? int(x.aux_u32_a) : -int(x.aux_u32_a);
    
    return eop_aux::pow_int(val, exponent);
    }
  else
    {
    arma_stop("eop_cube_core::process(): unhandled eop_cube_type");
    return eT(0);
    }
  }

template<typename eop_cube_type>
template<typename T1 >
arma_hot void eop_cube_core< eop_cube_type >::apply ( Cube< typename T1::elem_type > &  out,
const eOpCube< T1, eop_cube_type > &  x 
) [inline, static, inherited]
template<typename eop_cube_type>
template<typename T1 >
arma_hot void eop_cube_core< eop_cube_type >::apply_proxy ( Cube< typename T1::elem_type > &  out,
const eOpCube< T1, eop_cube_type > &  x 
) [inline, static, inherited]

Definition at line 134 of file eop_cube_core_meat.hpp.

References Cube< eT >::memptr(), eOpCube< T1, eop_type >::P, eop_cube_core< eop_cube_type >::process(), and Cube< eT >::set_size().

Referenced by eop_cube_core< eop_cube_type >::apply().

  {
  arma_extra_debug_sigprint();
  
  // eop_cube_type::apply() function is not allowed to unwrap things
  // (in order to get the input into a common format).
  // the proxy class is already providing objects with element access
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P = x.P;
  
  out.set_size(P.n_rows, P.n_cols, P.n_slices);
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P.n_elem;
  
  if(is_cube_generator<eop_cube_type>::value == true)
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] = eop_aux::generate<eT,eop_cube_type>();
      }
    }
  else
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] = eop_cube_core<eop_cube_type>::process(x, P[i]);
      }
    }
  }

template<typename eop_cube_type>
template<typename T1 >
arma_hot void eop_cube_core< eop_cube_type >::apply_unwrap ( Cube< typename T1::elem_type > &  out,
const eOpCube< T1, eop_cube_type > &  x 
) [inline, static, inherited]

Definition at line 174 of file eop_cube_core_meat.hpp.

References unwrap_cube< T1 >::M, Cube< eT >::memptr(), eOpCube< T1, eop_type >::P, eop_cube_core< eop_cube_type >::process(), and Cube< eT >::set_size().

Referenced by eop_cube_core< eop_cube_type >::apply().

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P = x.P;
  
  out.set_size(P.n_rows, P.n_cols, P.n_slices);
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P.n_elem;
  
  if(is_cube_generator<eop_cube_type>::value == true)
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] = eop_aux::generate<eT,eop_cube_type>();
      }
    }
  else
    {
    const unwrap_cube<typename ProxyCube<T1>::stored_type> tmp(P.Q);
    
    const Cube<eT>& A     = tmp.M;
    const eT*       A_mem = A.memptr();
    
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] = eop_cube_core<eop_cube_type>::process(x, A_mem[i]);
      }
    }
  }

template<typename eop_cube_type>
template<typename T1 >
arma_hot void eop_cube_core< eop_cube_type >::apply_inplace_plus ( Cube< typename T1::elem_type > &  out,
const eOpCube< T1, eop_cube_type > &  x 
) [inline, static, inherited]

Definition at line 215 of file eop_cube_core_meat.hpp.

References Cube< eT >::memptr(), Cube< eT >::n_cols, Cube< eT >::n_rows, Cube< eT >::n_slices, eOpCube< T1, eop_type >::P, and eop_cube_core< eop_cube_type >::process().

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P = x.P;
  
  arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "cube addition");
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P.n_elem;
  
  if(is_cube_generator<eop_cube_type>::value == true)
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] += eop_aux::generate<eT,eop_cube_type>();
      }
    }
  else
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] += eop_cube_core<eop_cube_type>::process(x, P[i]);
      }
    }
  }

template<typename eop_cube_type>
template<typename T1 >
arma_hot void eop_cube_core< eop_cube_type >::apply_inplace_minus ( Cube< typename T1::elem_type > &  out,
const eOpCube< T1, eop_cube_type > &  x 
) [inline, static, inherited]

Definition at line 251 of file eop_cube_core_meat.hpp.

References Cube< eT >::memptr(), Cube< eT >::n_cols, Cube< eT >::n_rows, Cube< eT >::n_slices, eOpCube< T1, eop_type >::P, and eop_cube_core< eop_cube_type >::process().

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P = x.P;
  
  arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "cube subtraction");
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P.n_elem;
  
  if(is_cube_generator<eop_cube_type>::value == true)
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] -= eop_aux::generate<eT,eop_cube_type>();
      }
    }
  else
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] -= eop_cube_core<eop_cube_type>::process(x, P[i]);
      }
    }
  }

template<typename eop_cube_type>
template<typename T1 >
arma_hot void eop_cube_core< eop_cube_type >::apply_inplace_schur ( Cube< typename T1::elem_type > &  out,
const eOpCube< T1, eop_cube_type > &  x 
) [inline, static, inherited]

Definition at line 287 of file eop_cube_core_meat.hpp.

References Cube< eT >::memptr(), Cube< eT >::n_cols, Cube< eT >::n_rows, Cube< eT >::n_slices, eOpCube< T1, eop_type >::P, and eop_cube_core< eop_cube_type >::process().

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P = x.P;
  
  arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "element-wise cube multiplication");
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P.n_elem;
  
  if(is_cube_generator<eop_cube_type>::value == true)
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] *= eop_aux::generate<eT,eop_cube_type>();
      }
    }
  else
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] *= eop_cube_core<eop_cube_type>::process(x, P[i]);
      }
    }
  }

template<typename eop_cube_type>
template<typename T1 >
arma_hot void eop_cube_core< eop_cube_type >::apply_inplace_div ( Cube< typename T1::elem_type > &  out,
const eOpCube< T1, eop_cube_type > &  x 
) [inline, static, inherited]

Definition at line 323 of file eop_cube_core_meat.hpp.

References Cube< eT >::memptr(), Cube< eT >::n_cols, Cube< eT >::n_rows, Cube< eT >::n_slices, eOpCube< T1, eop_type >::P, and eop_cube_core< eop_cube_type >::process().

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P = x.P;
  
  arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_rows, P.n_cols, P.n_slices, "element-wise cube division");
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P.n_elem;
  
  if(is_cube_generator<eop_cube_type>::value == true)
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] /= eop_aux::generate<eT,eop_cube_type>();
      }
    }
  else
    {
    for(u32 i=0; i<n_elem; ++i)
      {
      out_mem[i] /= eop_cube_core<eop_cube_type>::process(x, P[i]);
      }
    }
  }