Classes | Functions

Eglue_cube_core

//! More...

Classes

struct  eglue_cube_core< eglue_type >

Functions

template<typename T1 , typename T2 >
static arma_inline T1::elem_type eglue_cube_core::get_elem (const eGlueCube< T1, T2, eglue_type > &x, const u32 i)
template<typename T1 , typename T2 >
static arma_inline T1::elem_type eglue_cube_core::get_elem (const eGlueCube< T1, T2, eglue_type > &x, const u32 row, const u32 col, const u32 slice)
template<typename T1 , typename T2 >
static arma_hot void eglue_cube_core::apply (Cube< typename T1::elem_type > &out, const eGlueCube< T1, T2, eglue_type > &x)
template<typename T1 , typename T2 >
static arma_hot void eglue_cube_core::apply_inplace_plus (Cube< typename T1::elem_type > &out, const eGlueCube< T1, T2, eglue_type > &x)
template<typename T1 , typename T2 >
static arma_hot void eglue_cube_core::apply_inplace_minus (Cube< typename T1::elem_type > &out, const eGlueCube< T1, T2, eglue_type > &x)
template<typename T1 , typename T2 >
static arma_hot void eglue_cube_core::apply_inplace_schur (Cube< typename T1::elem_type > &out, const eGlueCube< T1, T2, eglue_type > &x)
template<typename T1 , typename T2 >
static arma_hot void eglue_cube_core::apply_inplace_div (Cube< typename T1::elem_type > &out, const eGlueCube< T1, T2, eglue_type > &x)

Detailed Description

//!


Function Documentation

template<typename eglue_type>
template<typename T1 , typename T2 >
arma_inline T1::elem_type eglue_cube_core< eglue_type >::get_elem ( const eGlueCube< T1, T2, eglue_type > &  x,
const u32  i 
) [static, inherited]

Definition at line 26 of file eglue_cube_core_meat.hpp.

References arma_stop(), eGlueCube< T1, T2, eglue_type >::P1, and eGlueCube< T1, T2, eglue_type >::P2.

  {
  typedef typename T1::elem_type eT;
  
  // the optimiser will keep only one return statement
  
       if(is_same_type<eglue_type, eglue_cube_plus >::value == true) { return x.P1[i] + x.P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) { return x.P1[i] - x.P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_div  >::value == true) { return x.P1[i] / x.P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) { return x.P1[i] * x.P2[i]; }
  else
    {
    arma_stop("eglue_cube_core::get_elem(): unhandled eglue_type");
    return eT(0);
    }
  }

template<typename eglue_type>
template<typename T1 , typename T2 >
arma_inline T1::elem_type eglue_cube_core< eglue_type >::get_elem ( const eGlueCube< T1, T2, eglue_type > &  x,
const u32  row,
const u32  col,
const u32  slice 
) [static, inherited]

Definition at line 49 of file eglue_cube_core_meat.hpp.

References arma_stop(), eGlueCube< T1, T2, eglue_type >::P1, and eGlueCube< T1, T2, eglue_type >::P2.

  {
  typedef typename T1::elem_type eT;
  
       if(is_same_type<eglue_type, eglue_cube_plus >::value == true) { return x.P1.at(row,col,slice) + x.P2.at(row,col,slice); }
  else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) { return x.P1.at(row,col,slice) - x.P2.at(row,col,slice); }
  else if(is_same_type<eglue_type, eglue_cube_div  >::value == true) { return x.P1.at(row,col,slice) / x.P2.at(row,col,slice); }
  else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) { return x.P1.at(row,col,slice) * x.P2.at(row,col,slice); }
  else
    {
    arma_stop("eglue_cube_core::get_elem(): unhandled eglue_type");
    return eT(0);
    }
  }

template<typename eglue_type>
template<typename T1 , typename T2 >
arma_hot void eglue_cube_core< eglue_type >::apply ( Cube< typename T1::elem_type > &  out,
const eGlueCube< T1, T2, eglue_type > &  x 
) [inline, static, inherited]

Definition at line 71 of file eglue_cube_core_meat.hpp.

References arma_stop(), Cube< eT >::memptr(), eGlueCube< T1, T2, eglue_type >::P1, eGlueCube< T1, T2, eglue_type >::P2, and Cube< eT >::set_size().

  {
  arma_extra_debug_sigprint();
  
  // eglue_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>& P1 = x.P1;
  const ProxyCube<T2>& P2 = x.P2;
  
  out.set_size(P1.n_rows, P1.n_cols, P1.n_slices);
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P1.n_elem;
  
       if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] + P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] - P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_div  >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] / P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] * P2[i]; }
  else
    {
    arma_stop("eglue_cube_core::apply(): unhandled eglue_type");
    }
  }

template<typename eglue_type>
template<typename T1 , typename T2 >
arma_hot void eglue_cube_core< eglue_type >::apply_inplace_plus ( Cube< typename T1::elem_type > &  out,
const eGlueCube< T1, T2, eglue_type > &  x 
) [inline, static, inherited]

Definition at line 106 of file eglue_cube_core_meat.hpp.

References arma_assert_same_size(), arma_stop(), Cube< eT >::memptr(), Cube< eT >::n_cols, Cube< eT >::n_rows, Cube< eT >::n_slices, eGlueCube< T1, T2, eglue_type >::P1, and eGlueCube< T1, T2, eglue_type >::P2.

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P1 = x.P1;
  const ProxyCube<T2>& P2 = x.P2;
  
  arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1.n_cols, P1.n_slices, "cube addition");
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P1.n_elem;
  
       if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] + P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] - P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_div  >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] / P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] * P2[i]; }
  else
    {
    arma_stop("eglue_cube_core::apply_inplace_plus(): unhandled eglue_type");
    }
  }

template<typename eglue_type>
template<typename T1 , typename T2 >
arma_hot void eglue_cube_core< eglue_type >::apply_inplace_minus ( Cube< typename T1::elem_type > &  out,
const eGlueCube< T1, T2, eglue_type > &  x 
) [inline, static, inherited]

Definition at line 137 of file eglue_cube_core_meat.hpp.

References arma_assert_same_size(), arma_stop(), Cube< eT >::memptr(), Cube< eT >::n_cols, Cube< eT >::n_rows, Cube< eT >::n_slices, eGlueCube< T1, T2, eglue_type >::P1, and eGlueCube< T1, T2, eglue_type >::P2.

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P1 = x.P1;
  const ProxyCube<T2>& P2 = x.P2;
  
  arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1.n_cols, P1.n_slices, "cube subtraction");
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P1.n_elem;
  
       if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] + P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] - P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_div  >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] / P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] * P2[i]; }
  else 
    {
    arma_stop("eglue_cube_core::apply_inplace_minus(): unhandled eglue_type");
    }
  }

template<typename eglue_type>
template<typename T1 , typename T2 >
arma_hot void eglue_cube_core< eglue_type >::apply_inplace_schur ( Cube< typename T1::elem_type > &  out,
const eGlueCube< T1, T2, eglue_type > &  x 
) [inline, static, inherited]

Definition at line 168 of file eglue_cube_core_meat.hpp.

References arma_assert_same_size(), arma_stop(), Cube< eT >::memptr(), Cube< eT >::n_cols, Cube< eT >::n_rows, Cube< eT >::n_slices, eGlueCube< T1, T2, eglue_type >::P1, and eGlueCube< T1, T2, eglue_type >::P2.

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P1 = x.P1;
  const ProxyCube<T2>& P2 = x.P2;
  
  arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1.n_cols, P1.n_slices, "element-wise cube multiplication");
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P1.n_elem;
  
       if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] + P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] - P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_div  >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] / P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] * P2[i]; }
  else
    {
    arma_stop("eglue_cube_core::apply_inplace_schur(): unhandled eglue_type");
    }
  }

template<typename eglue_type>
template<typename T1 , typename T2 >
arma_hot void eglue_cube_core< eglue_type >::apply_inplace_div ( Cube< typename T1::elem_type > &  out,
const eGlueCube< T1, T2, eglue_type > &  x 
) [inline, static, inherited]

Definition at line 199 of file eglue_cube_core_meat.hpp.

References arma_assert_same_size(), arma_stop(), Cube< eT >::memptr(), Cube< eT >::n_cols, Cube< eT >::n_rows, Cube< eT >::n_slices, eGlueCube< T1, T2, eglue_type >::P1, and eGlueCube< T1, T2, eglue_type >::P2.

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const ProxyCube<T1>& P1 = x.P1;
  const ProxyCube<T2>& P2 = x.P2;
  
  arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1.n_cols, P1.n_slices, "element-wise cube division");
  
        eT* out_mem = out.memptr();
  const u32 n_elem  = P1.n_elem;
  
       if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] + P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] - P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_div  >::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] / P2[i]; }
  else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u32 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] * P2[i]; }
  else
    {
    arma_stop("eglue_cube_core::apply_inplace_div(): unhandled eglue_type");
    }
  }