Eglue_cube_core

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)

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 
) [inline, 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.

00027   {
00028   typedef typename T1::elem_type eT;
00029   
00030   // the optimiser will keep only one return statement
00031   
00032        if(is_same_type<eglue_type, eglue_cube_plus >::value == true) { return x.P1[i] + x.P2[i]; }
00033   else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) { return x.P1[i] - x.P2[i]; }
00034   else if(is_same_type<eglue_type, eglue_cube_div  >::value == true) { return x.P1[i] / x.P2[i]; }
00035   else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) { return x.P1[i] * x.P2[i]; }
00036   else
00037     {
00038     arma_stop("eglue_cube_core::get_elem(): unhandled eglue_type");
00039     return eT(0);
00040     }
00041   }

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 
) [inline, 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.

00050   {
00051   typedef typename T1::elem_type eT;
00052   
00053        if(is_same_type<eglue_type, eglue_cube_plus >::value == true) { return x.P1.at(row,col,slice) + x.P2.at(row,col,slice); }
00054   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); }
00055   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); }
00056   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); }
00057   else
00058     {
00059     arma_stop("eglue_cube_core::get_elem(): unhandled eglue_type");
00060     return eT(0);
00061     }
00062   }

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().

00072   {
00073   arma_extra_debug_sigprint();
00074   
00075   // eglue_type::apply() function is not allowed to unwrap things
00076   // (in order to get the input into a common format).
00077   // the proxy class is already providing objects with element access
00078   
00079   typedef typename T1::elem_type eT;
00080   
00081   const ProxyCube<T1>& P1 = x.P1;
00082   const ProxyCube<T2>& P2 = x.P2;
00083   
00084   out.set_size(P1.n_rows, P1.n_cols, P1.n_slices);
00085   
00086         eT* out_mem = out.memptr();
00087   const u32 n_elem  = P1.n_elem;
00088   
00089        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]; }
00090   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]; }
00091   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]; }
00092   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]; }
00093   else
00094     {
00095     arma_stop("eglue_cube_core::apply(): unhandled eglue_type");
00096     }
00097   }

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.

00107   {
00108   arma_extra_debug_sigprint();
00109   
00110   typedef typename T1::elem_type eT;
00111   
00112   const ProxyCube<T1>& P1 = x.P1;
00113   const ProxyCube<T2>& P2 = x.P2;
00114   
00115   arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1.n_cols, P1.n_slices, "cube addition");
00116   
00117         eT* out_mem = out.memptr();
00118   const u32 n_elem  = P1.n_elem;
00119   
00120        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]; }
00121   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]; }
00122   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]; }
00123   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]; }
00124   else
00125     {
00126     arma_stop("eglue_cube_core::apply_inplace_plus(): unhandled eglue_type");
00127     }
00128   }

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.

00138   {
00139   arma_extra_debug_sigprint();
00140   
00141   typedef typename T1::elem_type eT;
00142   
00143   const ProxyCube<T1>& P1 = x.P1;
00144   const ProxyCube<T2>& P2 = x.P2;
00145   
00146   arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1.n_cols, P1.n_slices, "cube subtraction");
00147   
00148         eT* out_mem = out.memptr();
00149   const u32 n_elem  = P1.n_elem;
00150   
00151        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]; }
00152   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]; }
00153   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]; }
00154   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]; }
00155   else 
00156     {
00157     arma_stop("eglue_cube_core::apply_inplace_minus(): unhandled eglue_type");
00158     }
00159   }

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.

00169   {
00170   arma_extra_debug_sigprint();
00171   
00172   typedef typename T1::elem_type eT;
00173   
00174   const ProxyCube<T1>& P1 = x.P1;
00175   const ProxyCube<T2>& P2 = x.P2;
00176   
00177   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");
00178   
00179         eT* out_mem = out.memptr();
00180   const u32 n_elem  = P1.n_elem;
00181   
00182        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]; }
00183   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]; }
00184   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]; }
00185   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]; }
00186   else
00187     {
00188     arma_stop("eglue_cube_core::apply_inplace_schur(): unhandled eglue_type");
00189     }
00190   }

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.

00200   {
00201   arma_extra_debug_sigprint();
00202   
00203   typedef typename T1::elem_type eT;
00204   
00205   const ProxyCube<T1>& P1 = x.P1;
00206   const ProxyCube<T2>& P2 = x.P2;
00207   
00208   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");
00209   
00210         eT* out_mem = out.memptr();
00211   const u32 n_elem  = P1.n_elem;
00212   
00213        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]; }
00214   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]; }
00215   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]; }
00216   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]; }
00217   else
00218     {
00219     arma_stop("eglue_cube_core::apply_inplace_div(): unhandled eglue_type");
00220     }
00221   }