Op_scalar_misc

Classes

class  op_scalar_plus
 'add scalar to a matrix/cube' operation More...
class  op_scalar_minus_pre
 'subtract matrix/cube from a scalar' operation More...
class  op_scalar_minus_post
 'subtract scalar from a matrix/cube' operation More...
class  op_scalar_times
 'multiply matrix/cube by a scalar' operation More...
class  op_scalar_div_pre
 'divide scalar by a matrix/cube' operation More...
class  op_scalar_div_post
 'divide matrix/cube by a scalar' operation More...

Functions

template<typename T1 >
static void op_scalar_plus::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_scalar_plus > &in)
 Add a scalar to all elements of a matrix.
template<typename T1 >
static void op_scalar_plus::apply (Cube< typename T1::elem_type > &out, const OpCube< T1, op_scalar_plus > &in)
 Add a scalar to all elements of a cube.
template<typename T1 >
static void op_scalar_minus_pre::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_scalar_minus_pre > &in)
 For each element of a matrix, subtract it from a scalar.
template<typename T1 >
static void op_scalar_minus_pre::apply (Cube< typename T1::elem_type > &out, const OpCube< T1, op_scalar_minus_pre > &in)
 For each element of a cube, subtract it from a scalar.
template<typename T1 >
static void op_scalar_minus_post::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_scalar_minus_post > &in)
 subtract a scalar from each element of a matrix
template<typename T1 >
static void op_scalar_minus_post::apply (Cube< typename T1::elem_type > &out, const OpCube< T1, op_scalar_minus_post > &in)
 subtract a scalar from each element of a cube
template<typename T1 >
static void op_scalar_times::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_scalar_times > &in)
 Multiply all elements of a matrix by a scalar.
template<typename T1 >
static void op_scalar_times::apply (Cube< typename T1::elem_type > &out, const OpCube< T1, op_scalar_times > &in)
 Multiply all elements of a cube by a scalar.
template<typename T1 , typename T2 >
static void op_scalar_times::apply (Mat< typename T1::elem_type > &out, const Op< Glue< T1, T2, glue_plus >, op_scalar_times > &in)
 Evaluate A + B, and then multiply each element of the result by a scalar.
template<typename T1 , typename T2 >
static void op_scalar_times::apply (Cube< typename T1::elem_type > &out, const OpCube< GlueCube< T1, T2, glue_cube_plus >, op_scalar_times > &in)
 Evaluate A + B, and then multiply each element of the result by a scalar.
template<typename T1 , typename T2 >
static void op_scalar_times::apply (Mat< typename T1::elem_type > &out, const Op< Glue< T1, T2, glue_minus >, op_scalar_times > &in)
 Evaluate A - B, and then multiply each element of the result by a scalar.
template<typename T1 , typename T2 >
static void op_scalar_times::apply (Cube< typename T1::elem_type > &out, const OpCube< GlueCube< T1, T2, glue_cube_minus >, op_scalar_times > &in)
 Evaluate A - B, and then multiply each element of the result by a scalar.
template<typename T1 , typename T2 >
static void op_scalar_times::apply (Mat< typename T1::elem_type > &out, const Op< Glue< T1, T2, glue_schur >, op_scalar_times > &in)
 Evaluate A % B (where % is the element-wise multiply operation) and then multiply each element of the result by a scalar.
template<typename T1 , typename T2 >
static void op_scalar_times::apply (Cube< typename T1::elem_type > &out, const OpCube< GlueCube< T1, T2, glue_cube_schur >, op_scalar_times > &in)
 Evaluate A % B (where % is the element-wise multiply operation) and then multiply each element of the result by a scalar.
template<typename T1 >
static void op_scalar_div_pre::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_scalar_div_pre > &in)
template<typename T1 >
static void op_scalar_div_pre::apply (Cube< typename T1::elem_type > &out, const OpCube< T1, op_scalar_div_pre > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_pre::apply (Mat< typename T1::elem_type > &out, const Op< Glue< T1, T2, glue_plus >, op_scalar_div_pre > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_pre::apply (Cube< typename T1::elem_type > &out, const OpCube< GlueCube< T1, T2, glue_cube_plus >, op_scalar_div_pre > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_pre::apply (Mat< typename T1::elem_type > &out, const Op< Glue< T1, T2, glue_minus >, op_scalar_div_pre > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_pre::apply (Cube< typename T1::elem_type > &out, const OpCube< GlueCube< T1, T2, glue_cube_minus >, op_scalar_div_pre > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_pre::apply (Mat< typename T1::elem_type > &out, const Op< Glue< T1, T2, glue_schur >, op_scalar_div_pre > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_pre::apply (Cube< typename T1::elem_type > &out, const OpCube< GlueCube< T1, T2, glue_cube_schur >, op_scalar_div_pre > &in)
template<typename T1 >
static void op_scalar_div_post::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_scalar_div_post > &in)
template<typename T1 >
static void op_scalar_div_post::apply (Cube< typename T1::elem_type > &out, const OpCube< T1, op_scalar_div_post > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_post::apply (Mat< typename T1::elem_type > &out, const Op< Glue< T1, T2, glue_plus >, op_scalar_div_post > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_post::apply (Cube< typename T1::elem_type > &out, const OpCube< GlueCube< T1, T2, glue_cube_plus >, op_scalar_div_post > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_post::apply (Mat< typename T1::elem_type > &out, const Op< Glue< T1, T2, glue_minus >, op_scalar_div_post > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_post::apply (Cube< typename T1::elem_type > &out, const OpCube< GlueCube< T1, T2, glue_cube_minus >, op_scalar_div_post > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_post::apply (Mat< typename T1::elem_type > &out, const Op< Glue< T1, T2, glue_schur >, op_scalar_div_post > &in)
template<typename T1 , typename T2 >
static void op_scalar_div_post::apply (Cube< typename T1::elem_type > &out, const OpCube< GlueCube< T1, T2, glue_cube_schur >, op_scalar_div_post > &in)

Function Documentation

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

Add a scalar to all elements of a matrix.

Definition at line 26 of file op_scalar_misc_meat.hpp.

References Op< T1, op_type >::aux, Op< T1, op_type >::m, Mat< eT >::memptr(), and Mat< eT >::n_elem.

00027   {
00028   arma_extra_debug_sigprint();
00029   
00030   typedef typename T1::elem_type eT;
00031   
00032   const unwrap_write<T1> tmp(out, in.m);
00033   const Mat<eT>& A     = tmp.M;
00034   
00035         eT* out_mem = out.memptr();
00036   const eT* A_mem   = A.memptr();
00037   const u32 n_elem  = out.n_elem;
00038   const eT  k       = in.aux;
00039     
00040   for(u32 i=0; i<n_elem; ++i)
00041     {
00042     out_mem[i] = A_mem[i] + k;
00043     }
00044   }

template<typename T1 >
void op_scalar_plus::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< T1, op_scalar_plus > &  in 
) [inline, static, inherited]

Add a scalar to all elements of a cube.

Definition at line 52 of file op_scalar_misc_meat.hpp.

References OpCube< T1, op_type >::aux, OpCube< T1, op_type >::m, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00053   {
00054   arma_extra_debug_sigprint();
00055   
00056   typedef typename T1::elem_type eT;
00057   
00058   const unwrap_cube_write<T1> tmp(out, in.m);
00059   const Cube<eT>& A         = tmp.M;
00060   
00061         eT* out_mem = out.memptr();
00062   const eT* A_mem   = A.memptr();
00063   const u32 n_elem  = out.n_elem;
00064   const eT  k       = in.aux;
00065     
00066   for(u32 i=0; i<n_elem; ++i)
00067     {
00068     out_mem[i] = A_mem[i] + k;
00069     }
00070   }

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

For each element of a matrix, subtract it from a scalar.

Definition at line 78 of file op_scalar_misc_meat.hpp.

References Op< T1, op_type >::aux, Op< T1, op_type >::m, Mat< eT >::memptr(), and Mat< eT >::n_elem.

00079   {
00080   arma_extra_debug_sigprint();
00081   
00082   typedef typename T1::elem_type eT;
00083   
00084   const unwrap_write<T1> tmp(out, in.m);
00085   const Mat<eT>& A     = tmp.M;
00086   
00087         eT* out_mem = out.memptr();
00088   const eT* A_mem   = A.memptr();
00089   const u32 n_elem  = out.n_elem;
00090   const eT  k       = in.aux;
00091     
00092   for(u32 i=0; i<n_elem; ++i)
00093     {
00094     out_mem[i] = k - A_mem[i];
00095     }
00096   }

template<typename T1 >
void op_scalar_minus_pre::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< T1, op_scalar_minus_pre > &  in 
) [inline, static, inherited]

For each element of a cube, subtract it from a scalar.

Definition at line 104 of file op_scalar_misc_meat.hpp.

References OpCube< T1, op_type >::aux, OpCube< T1, op_type >::m, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00105   {
00106   arma_extra_debug_sigprint();
00107   
00108   typedef typename T1::elem_type eT;
00109   
00110   const unwrap_cube_write<T1> tmp(out, in.m);
00111   const Cube<eT>& A         = tmp.M;
00112   
00113         eT* out_mem = out.memptr();
00114   const eT* A_mem   = A.memptr();
00115   const u32 n_elem  = out.n_elem;
00116   const eT  k       = in.aux;
00117     
00118   for(u32 i=0; i<n_elem; ++i)
00119     {
00120     out_mem[i] = k - A_mem[i];
00121     }
00122   }

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

subtract a scalar from each element of a matrix

Definition at line 130 of file op_scalar_misc_meat.hpp.

References Op< T1, op_type >::aux, Op< T1, op_type >::m, Mat< eT >::memptr(), and Mat< eT >::n_elem.

00131   {
00132   arma_extra_debug_sigprint();
00133   
00134   typedef typename T1::elem_type eT;
00135   
00136   const unwrap_write<T1> tmp(out, in.m);
00137   const Mat<eT>& A     = tmp.M;
00138   
00139         eT* out_mem = out.memptr();
00140   const eT* A_mem   = A.memptr();
00141   const u32 n_elem  = out.n_elem;
00142   const eT  k       = in.aux;
00143     
00144   for(u32 i=0; i<n_elem; ++i)
00145     {
00146     out_mem[i] = A_mem[i] - k;
00147     }
00148   }

template<typename T1 >
void op_scalar_minus_post::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< T1, op_scalar_minus_post > &  in 
) [inline, static, inherited]

subtract a scalar from each element of a cube

Definition at line 156 of file op_scalar_misc_meat.hpp.

References OpCube< T1, op_type >::aux, OpCube< T1, op_type >::m, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00157   {
00158   arma_extra_debug_sigprint();
00159   
00160   typedef typename T1::elem_type eT;
00161   
00162   const unwrap_cube_write<T1> tmp(out, in.m);
00163   const Cube<eT>& A         = tmp.M;
00164   
00165         eT* out_mem = out.memptr();
00166   const eT* A_mem   = A.memptr();
00167   const u32 n_elem  = out.n_elem;
00168   const eT  k       = in.aux;
00169     
00170   for(u32 i=0; i<n_elem; ++i)
00171     {
00172     out_mem[i] = A_mem[i] - k ;
00173     }
00174   }

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

Multiply all elements of a matrix by a scalar.

Definition at line 182 of file op_scalar_misc_meat.hpp.

References Op< T1, op_type >::aux, Op< T1, op_type >::m, Mat< eT >::memptr(), and Mat< eT >::n_elem.

00183   {
00184   arma_extra_debug_sigprint();
00185   
00186   typedef typename T1::elem_type eT;
00187   
00188   const unwrap_write<T1> tmp(out, in.m);
00189   const Mat<eT>& A     = tmp.M;
00190   
00191         eT* out_mem = out.memptr();
00192   const eT* A_mem   = A.memptr();
00193   const u32 n_elem  = out.n_elem;
00194   const eT  k       = in.aux;
00195     
00196   for(u32 i=0; i<n_elem; ++i)
00197     {
00198     out_mem[i] = A_mem[i] * k;
00199     }
00200   }

template<typename T1 >
void op_scalar_times::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< T1, op_scalar_times > &  in 
) [inline, static, inherited]

Multiply all elements of a cube by a scalar.

Definition at line 208 of file op_scalar_misc_meat.hpp.

References OpCube< T1, op_type >::aux, OpCube< T1, op_type >::m, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00209   {
00210   arma_extra_debug_sigprint();
00211   
00212   typedef typename T1::elem_type eT;
00213   
00214   const unwrap_cube_write<T1> tmp(out, in.m);
00215   const Cube<eT>& A         = tmp.M;
00216   
00217         eT* out_mem = out.memptr();
00218   const eT* A_mem   = A.memptr();
00219   const u32 n_elem  = out.n_elem;
00220   const eT  k       = in.aux;
00221     
00222   for(u32 i=0; i<n_elem; ++i)
00223     {
00224     out_mem[i] = A_mem[i] * k;
00225     }
00226   }

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

Evaluate A + B, and then multiply each element of the result by a scalar.

Definition at line 238 of file op_scalar_misc_meat.hpp.

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

00239   {
00240   arma_extra_debug_sigprint();
00241   
00242   const unwrap<T1> tmp1(in.m.A);
00243   const unwrap<T2> tmp2(in.m.B);
00244   
00245   typedef typename T1::elem_type eT;
00246   
00247   const Mat<eT>& A = tmp1.M;
00248   const Mat<eT>& B = tmp2.M;
00249   
00250   arma_debug_assert_same_size(A, B, "matrix addition");
00251   
00252   // no alias problems
00253   //out.set_size(A.n_rows, A.n_cols);
00254   out.copy_size(A);
00255   
00256         eT* out_mem = out.memptr();
00257   const eT* A_mem   = A.mem;
00258   const eT* B_mem   = B.mem;
00259   
00260   const eT  k       = in.aux;
00261   const u32 n_elem  = A.n_elem;
00262   
00263   for(u32 i=0; i<n_elem; ++i)
00264     {
00265     out_mem[i] = (A_mem[i] + B_mem[i]) * k;
00266     }
00267   
00268   }

template<typename T1 , typename T2 >
void op_scalar_times::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< GlueCube< T1, T2, glue_cube_plus >, op_scalar_times > &  in 
) [inline, static, inherited]

Evaluate A + B, and then multiply each element of the result by a scalar.

Definition at line 276 of file op_scalar_misc_meat.hpp.

References Cube< eT >::copy_size(), Cube< eT >::mem, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00277   {
00278   arma_extra_debug_sigprint();
00279   
00280   const unwrap_cube<T1> tmp1(in.m.A);
00281   const unwrap_cube<T2> tmp2(in.m.B);
00282   
00283   typedef typename T1::elem_type eT;
00284   
00285   const Cube<eT>& A = tmp1.M;
00286   const Cube<eT>& B = tmp2.M;
00287   
00288   arma_debug_assert_same_size(A, B, "cube addition");
00289   
00290   // no alias problems
00291   //out.set_size(A.n_rows, A.n_cols, A.n_slices);
00292   out.copy_size(A);
00293   
00294         eT* out_mem = out.memptr();
00295   const eT* A_mem   = A.mem;
00296   const eT* B_mem   = B.mem;
00297   
00298   const eT  k       = in.aux;
00299   const u32 n_elem  = A.n_elem;
00300   
00301   for(u32 i=0; i<n_elem; ++i)
00302     {
00303     out_mem[i] = (A_mem[i] + B_mem[i]) * k;
00304     }
00305   
00306   }

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

Evaluate A - B, and then multiply each element of the result by a scalar.

Definition at line 314 of file op_scalar_misc_meat.hpp.

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

00315   {
00316   arma_extra_debug_sigprint();
00317   
00318   const unwrap<T1> tmp1(in.m.A);
00319   const unwrap<T2> tmp2(in.m.B);
00320   
00321   typedef typename T1::elem_type eT;
00322   
00323   const Mat<eT>& A = tmp1.M;
00324   const Mat<eT>& B = tmp2.M;
00325   
00326   arma_debug_assert_same_size(A, B, "matrix subtraction");
00327   
00328   // no alias problems
00329   //out.set_size(A.n_rows, A.n_cols);
00330   out.copy_size(A);
00331   
00332         eT* out_mem = out.memptr();
00333   const eT* A_mem   = A.mem;
00334   const eT* B_mem   = B.mem;
00335   
00336   const eT  k       = in.aux;
00337   const u32 n_elem  = A.n_elem;
00338   
00339   for(u32 i=0; i<n_elem; ++i)
00340     {
00341     out_mem[i] = (A_mem[i] - B_mem[i]) * k;
00342     }
00343   
00344   }

template<typename T1 , typename T2 >
void op_scalar_times::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< GlueCube< T1, T2, glue_cube_minus >, op_scalar_times > &  in 
) [inline, static, inherited]

Evaluate A - B, and then multiply each element of the result by a scalar.

Definition at line 352 of file op_scalar_misc_meat.hpp.

References Cube< eT >::copy_size(), Cube< eT >::mem, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00353   {
00354   arma_extra_debug_sigprint();
00355   
00356   const unwrap_cube<T1> tmp1(in.m.A);
00357   const unwrap_cube<T2> tmp2(in.m.B);
00358   
00359   typedef typename T1::elem_type eT;
00360   
00361   const Cube<eT>& A = tmp1.M;
00362   const Cube<eT>& B = tmp2.M;
00363   
00364   arma_debug_assert_same_size(A, B, "cube subtraction");
00365   
00366   // no alias problems
00367   //out.set_size(A.n_rows, A.n_cols, A.n_slices);
00368   out.copy_size(A);
00369   
00370         eT* out_mem = out.memptr();
00371   const eT* A_mem   = A.mem;
00372   const eT* B_mem   = B.mem;
00373   
00374   const eT  k       = in.aux;
00375   const u32 n_elem  = A.n_elem;
00376   
00377   for(u32 i=0; i<n_elem; ++i)
00378     {
00379     out_mem[i] = (A_mem[i] - B_mem[i]) * k;
00380     }
00381   
00382   }

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

Evaluate A % B (where % is the element-wise multiply operation) and then multiply each element of the result by a scalar.

Definition at line 390 of file op_scalar_misc_meat.hpp.

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

00391   {
00392   arma_extra_debug_sigprint();
00393   
00394   const unwrap<T1> tmp1(in.m.A);
00395   const unwrap<T2> tmp2(in.m.B);
00396   
00397   typedef typename T1::elem_type eT;
00398   
00399   const Mat<eT>& A = tmp1.M;
00400   const Mat<eT>& B = tmp2.M;
00401   
00402   arma_debug_assert_same_size(A, B, "schur product");
00403   
00404   // no alias problems
00405   //out.set_size(A.n_rows, A.n_cols);
00406   out.copy_size(A);
00407   
00408         eT* out_mem = out.memptr();
00409   const eT* A_mem   = A.mem;
00410   const eT* B_mem   = B.mem;
00411   
00412   const eT  k       = in.aux;
00413   const u32 n_elem  = A.n_elem;
00414   
00415   for(u32 i=0; i<n_elem; ++i)
00416     {
00417     out_mem[i] = (A_mem[i] * B_mem[i]) * k;
00418     }
00419   
00420   }

template<typename T1 , typename T2 >
void op_scalar_times::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< GlueCube< T1, T2, glue_cube_schur >, op_scalar_times > &  in 
) [inline, static, inherited]

Evaluate A % B (where % is the element-wise multiply operation) and then multiply each element of the result by a scalar.

Definition at line 428 of file op_scalar_misc_meat.hpp.

References Cube< eT >::copy_size(), Cube< eT >::mem, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00429   {
00430   arma_extra_debug_sigprint();
00431   
00432   const unwrap_cube<T1> tmp1(in.m.A);
00433   const unwrap_cube<T2> tmp2(in.m.B);
00434   
00435   typedef typename T1::elem_type eT;
00436   
00437   const Cube<eT>& A = tmp1.M;
00438   const Cube<eT>& B = tmp2.M;
00439   
00440   arma_debug_assert_same_size(A, B, "schur product");
00441   
00442   // no alias problems
00443   //out.set_size(A.n_rows, A.n_cols, A.n_slices);
00444   out.copy_size(A);
00445   
00446         eT* out_mem = out.memptr();
00447   const eT* A_mem   = A.mem;
00448   const eT* B_mem   = B.mem;
00449   
00450   const eT  k       = in.aux;
00451   const u32 n_elem  = A.n_elem;
00452   
00453   for(u32 i=0; i<n_elem; ++i)
00454     {
00455     out_mem[i] = (A_mem[i] * B_mem[i]) * k;
00456     }
00457   
00458   }

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

Definition at line 475 of file op_scalar_misc_meat.hpp.

References Op< T1, op_type >::aux, Op< T1, op_type >::m, Mat< eT >::memptr(), and Mat< eT >::n_elem.

00476   {
00477   arma_extra_debug_sigprint();
00478   
00479   typedef typename T1::elem_type eT;
00480   
00481   const unwrap_write<T1> tmp(out, in.m);
00482   const Mat<eT>& A     = tmp.M;
00483   
00484         eT* out_mem = out.memptr();
00485   const eT* A_mem   = A.memptr();
00486   const u32 n_elem  = out.n_elem;
00487   const eT  k       = in.aux;
00488     
00489   for(u32 i=0; i<n_elem; ++i)
00490     {
00491     out_mem[i] = k / A_mem[i];
00492     }
00493   }

template<typename T1 >
void op_scalar_div_pre::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< T1, op_scalar_div_pre > &  in 
) [inline, static, inherited]

Definition at line 500 of file op_scalar_misc_meat.hpp.

References OpCube< T1, op_type >::aux, OpCube< T1, op_type >::m, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00501   {
00502   arma_extra_debug_sigprint();
00503   
00504   typedef typename T1::elem_type eT;
00505   
00506   const unwrap_cube_write<T1> tmp(out, in.m);
00507   const Cube<eT>& A         = tmp.M;
00508   
00509         eT* out_mem = out.memptr();
00510   const eT* A_mem   = A.memptr();
00511   const u32 n_elem  = out.n_elem;
00512   const eT  k       = in.aux;
00513     
00514   for(u32 i=0; i<n_elem; ++i)
00515     {
00516     out_mem[i] = k / A_mem[i];
00517     }
00518   }

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

Definition at line 529 of file op_scalar_misc_meat.hpp.

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

00530   {
00531   arma_extra_debug_sigprint();
00532   
00533   unwrap<T1> tmp1(in.m.A);
00534   unwrap<T2> tmp2(in.m.B);
00535   
00536   typedef typename T1::elem_type eT;
00537   
00538   const Mat<eT>& A = tmp1.M;
00539   const Mat<eT>& B = tmp2.M;
00540   
00541   arma_debug_assert_same_size(A, B, "matrix addition");
00542   
00543   // no alias problems
00544   //out.set_size(A.n_rows, A.n_cols);
00545   out.copy_size(A);
00546   
00547         eT* out_mem = out.memptr();
00548   const eT* A_mem   = A.mem;
00549   const eT* B_mem   = B.mem;
00550   
00551   const eT  k       = in.aux;
00552   const u32 n_elem  = A.n_elem;
00553   
00554   for(u32 i=0; i<n_elem; ++i)
00555     {
00556     out_mem[i] = k / (A_mem[i] + B_mem[i]);
00557     }
00558   
00559   }

template<typename T1 , typename T2 >
void op_scalar_div_pre::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< GlueCube< T1, T2, glue_cube_plus >, op_scalar_div_pre > &  in 
) [inline, static, inherited]

Definition at line 566 of file op_scalar_misc_meat.hpp.

References Cube< eT >::copy_size(), Cube< eT >::mem, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00567   {
00568   arma_extra_debug_sigprint();
00569   
00570   unwrap_cube<T1> tmp1(in.m.A);
00571   unwrap_cube<T2> tmp2(in.m.B);
00572   
00573   typedef typename T1::elem_type eT;
00574   
00575   const Cube<eT>& A = tmp1.M;
00576   const Cube<eT>& B = tmp2.M;
00577   
00578   arma_debug_assert_same_size(A, B, "cube addition");
00579   
00580   // no alias problems
00581   //out.set_size(A.n_rows, A.n_cols, A.n_slices);
00582   out.copy_size(A);
00583   
00584         eT* out_mem = out.memptr();
00585   const eT* A_mem   = A.mem;
00586   const eT* B_mem   = B.mem;
00587   
00588   const eT  k       = in.aux;
00589   const u32 n_elem  = A.n_elem;
00590   
00591   for(u32 i=0; i<n_elem; ++i)
00592     {
00593     out_mem[i] = k / (A_mem[i] + B_mem[i]);
00594     }
00595   
00596   }

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

Definition at line 603 of file op_scalar_misc_meat.hpp.

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

00604   {
00605   arma_extra_debug_sigprint();
00606   
00607   unwrap<T1> tmp1(in.m.A);
00608   unwrap<T2> tmp2(in.m.B);
00609   
00610   typedef typename T1::elem_type eT;
00611   
00612   const Mat<eT>& A = tmp1.M;
00613   const Mat<eT>& B = tmp2.M;
00614   
00615   arma_debug_assert_same_size(A, B, "matrix subtraction");
00616   
00617   // no alias problems
00618   //out.set_size(A.n_rows, A.n_cols);
00619   out.copy_size(A);
00620   
00621         eT* out_mem = out.memptr();
00622   const eT* A_mem   = A.mem;
00623   const eT* B_mem   = B.mem;
00624   
00625   const eT  k       = in.aux;
00626   const u32 n_elem  = A.n_elem;
00627   
00628   for(u32 i=0; i<n_elem; ++i)
00629     {
00630     out_mem[i] = k / (A_mem[i] - B_mem[i]);
00631     }
00632   
00633   }

template<typename T1 , typename T2 >
void op_scalar_div_pre::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< GlueCube< T1, T2, glue_cube_minus >, op_scalar_div_pre > &  in 
) [inline, static, inherited]

Definition at line 640 of file op_scalar_misc_meat.hpp.

References Cube< eT >::copy_size(), Cube< eT >::mem, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00641   {
00642   arma_extra_debug_sigprint();
00643   
00644   unwrap_cube<T1> tmp1(in.m.A);
00645   unwrap_cube<T2> tmp2(in.m.B);
00646   
00647   typedef typename T1::elem_type eT;
00648   
00649   const Cube<eT>& A = tmp1.M;
00650   const Cube<eT>& B = tmp2.M;
00651   
00652   arma_debug_assert_same_size(A, B, "cube subtraction");
00653   
00654   // no alias problems
00655   //out.set_size(A.n_rows, A.n_cols, A.n_slices);
00656   out.copy_size(A);
00657   
00658         eT* out_mem = out.memptr();
00659   const eT* A_mem   = A.mem;
00660   const eT* B_mem   = B.mem;
00661   
00662   const eT  k       = in.aux;
00663   const u32 n_elem  = A.n_elem;
00664   
00665   for(u32 i=0; i<n_elem; ++i)
00666     {
00667     out_mem[i] = k / (A_mem[i] - B_mem[i]);
00668     }
00669   
00670   }

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

Definition at line 677 of file op_scalar_misc_meat.hpp.

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

00678   {
00679   arma_extra_debug_sigprint();
00680   
00681   unwrap<T1> tmp1(in.m.A);
00682   unwrap<T2> tmp2(in.m.B);
00683   
00684   typedef typename T1::elem_type eT;
00685   
00686   const Mat<eT>& A = tmp1.M;
00687   const Mat<eT>& B = tmp2.M;
00688   
00689   arma_debug_assert_same_size(A, B, "schur product");
00690   
00691   // no alias problems
00692   //out.set_size(A.n_rows, A.n_cols);
00693   out.copy_size(A);
00694   
00695         eT* out_mem = out.memptr();
00696   const eT* A_mem   = A.mem;
00697   const eT* B_mem   = B.mem;
00698   
00699   const eT  k       = in.aux;
00700   const u32 n_elem  = A.n_elem;
00701   
00702   for(u32 i=0; i<n_elem; ++i)
00703     {
00704     out_mem[i] = k / (A_mem[i] * B_mem[i]);
00705     }
00706   
00707   }

template<typename T1 , typename T2 >
void op_scalar_div_pre::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< GlueCube< T1, T2, glue_cube_schur >, op_scalar_div_pre > &  in 
) [inline, static, inherited]

Definition at line 714 of file op_scalar_misc_meat.hpp.

References Cube< eT >::copy_size(), Cube< eT >::mem, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00715   {
00716   arma_extra_debug_sigprint();
00717   
00718   unwrap_cube<T1> tmp1(in.m.A);
00719   unwrap_cube<T2> tmp2(in.m.B);
00720   
00721   typedef typename T1::elem_type eT;
00722   
00723   const Cube<eT>& A = tmp1.M;
00724   const Cube<eT>& B = tmp2.M;
00725   
00726   arma_debug_assert_same_size(A, B, "schur product");
00727   
00728   // no alias problems
00729   //out.set_size(A.n_rows, A.n_cols, A.n_slices);
00730   out.copy_size(A);
00731 
00732         eT* out_mem = out.memptr();
00733   const eT* A_mem   = A.mem;
00734   const eT* B_mem   = B.mem;
00735   
00736   const eT  k       = in.aux;
00737   const u32 n_elem  = A.n_elem;
00738   
00739   for(u32 i=0; i<n_elem; ++i)
00740     {
00741     out_mem[i] = k / (A_mem[i] * B_mem[i]);
00742     }
00743   
00744   }

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

Definition at line 761 of file op_scalar_misc_meat.hpp.

References Op< T1, op_type >::aux, Op< T1, op_type >::m, Mat< eT >::memptr(), and Mat< eT >::n_elem.

00762   {
00763   arma_extra_debug_sigprint();
00764   
00765   typedef typename T1::elem_type eT;
00766   
00767   const unwrap_write<T1> tmp(out, in.m);
00768   const Mat<eT>& A     = tmp.M;
00769   
00770         eT* out_mem = out.memptr();
00771   const eT* A_mem   = A.memptr();
00772   const u32 n_elem  = out.n_elem;
00773   const eT  k       = in.aux;
00774     
00775   for(u32 i=0; i<n_elem; ++i)
00776     {
00777     out_mem[i] = A_mem[i] / k;
00778     }
00779   }

template<typename T1 >
void op_scalar_div_post::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< T1, op_scalar_div_post > &  in 
) [inline, static, inherited]

Definition at line 786 of file op_scalar_misc_meat.hpp.

References OpCube< T1, op_type >::aux, OpCube< T1, op_type >::m, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00787   {
00788   arma_extra_debug_sigprint();
00789   
00790   typedef typename T1::elem_type eT;
00791   
00792   const unwrap_cube_write<T1> tmp(out, in.m);
00793   const Cube<eT>& A         = tmp.M;
00794   
00795         eT* out_mem = out.memptr();
00796   const eT* A_mem   = A.memptr();
00797   const u32 n_elem  = out.n_elem;
00798   const eT  k       = in.aux;
00799     
00800   for(u32 i=0; i<n_elem; ++i)
00801     {
00802     out_mem[i] = A_mem[i] / k;
00803     }
00804   }

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

Definition at line 815 of file op_scalar_misc_meat.hpp.

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

00816   {
00817   arma_extra_debug_sigprint();
00818   
00819   unwrap<T1> tmp1(in.m.A);
00820   unwrap<T2> tmp2(in.m.B);
00821   
00822   typedef typename T1::elem_type eT;
00823   
00824   const Mat<eT>& A = tmp1.M;
00825   const Mat<eT>& B = tmp2.M;
00826   
00827   arma_debug_assert_same_size(A, B, "matrix addition");
00828   
00829   // no alias problems
00830   //out.set_size(A.n_rows, A.n_cols);
00831   out.copy_size(A);
00832   
00833         eT* out_mem = out.memptr();
00834   const eT* A_mem   = A.mem;
00835   const eT* B_mem   = B.mem;
00836   
00837   const eT  k       = in.aux;
00838   const u32 n_elem  = A.n_elem;
00839   
00840   for(u32 i=0; i<n_elem; ++i)
00841     {
00842     out_mem[i] = (A_mem[i] + B_mem[i]) / k;
00843     }
00844   
00845   }

template<typename T1 , typename T2 >
void op_scalar_div_post::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< GlueCube< T1, T2, glue_cube_plus >, op_scalar_div_post > &  in 
) [inline, static, inherited]

Definition at line 852 of file op_scalar_misc_meat.hpp.

References Cube< eT >::copy_size(), Cube< eT >::mem, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00853   {
00854   arma_extra_debug_sigprint();
00855   
00856   unwrap_cube<T1> tmp1(in.m.A);
00857   unwrap_cube<T2> tmp2(in.m.B);
00858   
00859   typedef typename T1::elem_type eT;
00860   
00861   const Cube<eT>& A = tmp1.M;
00862   const Cube<eT>& B = tmp2.M;
00863   
00864   arma_debug_assert_same_size(A, B, "cube addition");
00865   
00866   // no alias problems
00867   //out.set_size(A.n_rows, A.n_cols, A.n_slices);
00868   out.copy_size(A);
00869   
00870         eT* out_mem = out.memptr();
00871   const eT* A_mem   = A.mem;
00872   const eT* B_mem   = B.mem;
00873   
00874   const eT  k       = in.aux;
00875   const u32 n_elem  = A.n_elem;
00876   
00877   for(u32 i=0; i<n_elem; ++i)
00878     {
00879     out_mem[i] = (A_mem[i] + B_mem[i]) / k;
00880     }
00881   
00882   }

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

Definition at line 889 of file op_scalar_misc_meat.hpp.

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

00890   {
00891   arma_extra_debug_sigprint();
00892   
00893   unwrap<T1> tmp1(in.m.A);
00894   unwrap<T2> tmp2(in.m.B);
00895   
00896   typedef typename T1::elem_type eT;
00897   
00898   const Mat<eT>& A = tmp1.M;
00899   const Mat<eT>& B = tmp2.M;
00900   
00901   arma_debug_assert_same_size(A, B, "matrix subtraction");
00902   
00903   // no alias problems
00904   //out.set_size(A.n_rows, A.n_cols);
00905   out.copy_size(A);
00906   
00907         eT* out_mem = out.memptr();
00908   const eT* A_mem   = A.mem;
00909   const eT* B_mem   = B.mem;
00910   
00911   const eT  k       = in.aux;
00912   const u32 n_elem  = A.n_elem;
00913   
00914   for(u32 i=0; i<n_elem; ++i)
00915     {
00916     out_mem[i] = (A_mem[i] - B_mem[i]) / k;
00917     }
00918   
00919   }

template<typename T1 , typename T2 >
void op_scalar_div_post::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< GlueCube< T1, T2, glue_cube_minus >, op_scalar_div_post > &  in 
) [inline, static, inherited]

Definition at line 926 of file op_scalar_misc_meat.hpp.

References Cube< eT >::copy_size(), Cube< eT >::mem, Cube< eT >::memptr(), and Cube< eT >::n_elem.

00927   {
00928   arma_extra_debug_sigprint();
00929   
00930   unwrap_cube<T1> tmp1(in.m.A);
00931   unwrap_cube<T2> tmp2(in.m.B);
00932   
00933   typedef typename T1::elem_type eT;
00934   
00935   const Cube<eT>& A = tmp1.M;
00936   const Cube<eT>& B = tmp2.M;
00937   
00938   arma_debug_assert_same_size(A, B, "cube subtraction");
00939   
00940   // no alias problems
00941   //out.set_size(A.n_rows, A.n_cols, A.n_slices);
00942   out.copy_size(A);
00943   
00944         eT* out_mem = out.memptr();
00945   const eT* A_mem   = A.mem;
00946   const eT* B_mem   = B.mem;
00947   
00948   const eT  k       = in.aux;
00949   const u32 n_elem  = A.n_elem;
00950   
00951   for(u32 i=0; i<n_elem; ++i)
00952     {
00953     out_mem[i] = (A_mem[i] - B_mem[i]) / k;
00954     }
00955   
00956   }

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

Definition at line 963 of file op_scalar_misc_meat.hpp.

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

00964   {
00965   arma_extra_debug_sigprint();
00966   
00967   unwrap<T1> tmp1(in.m.A);
00968   unwrap<T2> tmp2(in.m.B);
00969   
00970   typedef typename T1::elem_type eT;
00971   
00972   const Mat<eT>& A = tmp1.M;
00973   const Mat<eT>& B = tmp2.M;
00974   
00975   arma_debug_assert_same_size(A, B, "schur product");
00976   
00977   // no alias problems
00978   //out.set_size(A.n_rows, A.n_cols);
00979   out.copy_size(A);
00980   
00981         eT* out_mem = out.memptr();
00982   const eT* A_mem   = A.mem;
00983   const eT* B_mem   = B.mem;
00984   
00985   const eT  k       = in.aux;
00986   const u32 n_elem  = A.n_elem;
00987   
00988   for(u32 i=0; i<n_elem; ++i)
00989     {
00990     out_mem[i] = (A_mem[i] * B_mem[i]) / k;
00991     }
00992   
00993   }

template<typename T1 , typename T2 >
void op_scalar_div_post::apply ( Cube< typename T1::elem_type > &  out,
const OpCube< GlueCube< T1, T2, glue_cube_schur >, op_scalar_div_post > &  in 
) [inline, static, inherited]

Definition at line 1000 of file op_scalar_misc_meat.hpp.

References Cube< eT >::copy_size(), Cube< eT >::mem, Cube< eT >::memptr(), and Cube< eT >::n_elem.

01001   {
01002   arma_extra_debug_sigprint();
01003   
01004   unwrap_cube<T1> tmp1(in.m.A);
01005   unwrap_cube<T2> tmp2(in.m.B);
01006   
01007   typedef typename T1::elem_type eT;
01008   
01009   const Cube<eT>& A = tmp1.M;
01010   const Cube<eT>& B = tmp2.M;
01011   
01012   arma_debug_assert_same_size(A, B, "schur product");
01013   
01014   // no alias problems
01015   //out.set_size(A.n_rows, A.n_cols, A.n_slices);
01016   out.copy_size(A);
01017   
01018         eT* out_mem = out.memptr();
01019   const eT* A_mem   = A.mem;
01020   const eT* B_mem   = B.mem;
01021   
01022   const eT  k       = in.aux;
01023   const u32 n_elem  = A.n_elem;
01024   
01025   for(u32 i=0; i<n_elem; ++i)
01026     {
01027     out_mem[i] = (A_mem[i] * B_mem[i]) / k;
01028     }
01029   
01030   }