Op_misc


Classes

class  op_log
class  op_trunc_log
class  op_log10
class  op_exp
class  op_trunc_exp
class  op_sqrt
class  op_square
class  op_pow
class  op_pow_s32
class  op_conj

Functions

template<typename T1 >
static void op_log::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_log > &in)
template<typename T1 >
static void op_trunc_log::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_trunc_log > &in)
template<typename T1 >
static void op_log10::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_log10 > &in)
template<typename T1 >
static void op_exp::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_exp > &in)
template<typename T1 >
static void op_trunc_exp::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_trunc_exp > &in)
template<typename T1 >
static void op_sqrt::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_sqrt > &in)
template<typename T1 >
static void op_square::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_square > &in)
template<typename T1 >
static void op_pow::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_pow > &in)
template<typename T , typename T1 >
static void op_pow::apply (Mat< std::complex< T > > &out, const Op< T1, op_pow > &in)
template<typename T1 >
static T1 op_pow_s32::internal_pow (const T1 base, const int exponent)
static char op_pow_s32::internal_pow (const char base, const int exponent)
static unsigned char op_pow_s32::internal_pow (const unsigned char base, const int exponent)
static int op_pow_s32::internal_pow (const int base, const int exponent)
static unsigned int op_pow_s32::internal_pow (const unsigned int base, const int exponent)
template<typename T1 >
static void op_pow_s32::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_pow_s32 > &in)
template<typename T1 >
static void op_conj::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_conj > &in)

Function Documentation

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

Definition at line 24 of file op_misc_meat.hpp.

References log(), Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, and Mat< eT >::set_size().

00025   {
00026   arma_extra_debug_sigprint();
00027   
00028   typedef typename T1::elem_type eT;
00029   
00030   const unwrap<T1> tmp(in.m);
00031   
00032   const Mat<eT>& A = tmp.M;
00033   const u32 n_elem       = A.n_elem;
00034   
00035   out.set_size(A.n_rows, A.n_cols);
00036   eT* out_ptr = out.memptr();
00037   
00038   for(u32 i=0; i<n_elem; ++i)
00039     {
00040     out_ptr[i] = std::log(A.mem[i]);
00041     }
00042   
00043   }

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

Definition at line 50 of file op_misc_meat.hpp.

References Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, Mat< eT >::set_size(), and trunc_log().

00051   {
00052   arma_extra_debug_sigprint();
00053   
00054   typedef typename T1::elem_type eT;
00055   
00056   const unwrap<T1> tmp(in.m);
00057   
00058   const Mat<eT>& A = tmp.M;
00059   const u32 n_elem       = A.n_elem;
00060   
00061   out.set_size(A.n_rows, A.n_cols);
00062   eT* out_ptr = out.memptr();
00063   
00064   for(u32 i=0; i<n_elem; ++i)
00065     {
00066     out_ptr[i] = trunc_log(A.mem[i]);
00067     }
00068   
00069   }

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

Definition at line 76 of file op_misc_meat.hpp.

References log10(), Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, and Mat< eT >::set_size().

00077   {
00078   arma_extra_debug_sigprint();
00079   
00080   typedef typename T1::elem_type eT;
00081   
00082   const unwrap<T1> tmp(in.m);
00083   
00084   const Mat<eT>& A = tmp.M;
00085   const u32 n_elem       = A.n_elem;
00086   
00087   out.set_size(A.n_rows, A.n_cols);
00088   eT* out_ptr = out.memptr();
00089   
00090   for(u32 i=0; i<n_elem; ++i)
00091     {
00092     out_ptr[i] = std::log10(A.mem[i]);
00093     }
00094   
00095   }

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

Definition at line 102 of file op_misc_meat.hpp.

References exp(), Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, and Mat< eT >::set_size().

00103   {
00104   arma_extra_debug_sigprint();
00105   
00106   typedef typename T1::elem_type eT;
00107   
00108   const unwrap<T1> tmp(in.m);
00109   
00110   const Mat<eT>& A = tmp.M;
00111   const u32 n_elem       = A.n_elem;
00112   
00113   out.set_size(A.n_rows, A.n_cols);
00114   eT* out_ptr = out.memptr();
00115   
00116   for(u32 i=0; i<n_elem; ++i)
00117     {
00118     out_ptr[i] = std::exp(A.mem[i]);
00119     }
00120   
00121   }

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

Definition at line 128 of file op_misc_meat.hpp.

References Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, Mat< eT >::set_size(), and trunc_exp().

00129   {
00130   arma_extra_debug_sigprint();
00131   
00132   typedef typename T1::elem_type eT;
00133   
00134   const unwrap<T1> tmp(in.m);
00135   
00136   const Mat<eT>& A = tmp.M;
00137   const u32 n_elem       = A.n_elem;
00138   
00139   out.set_size(A.n_rows, A.n_cols);
00140   eT* out_ptr = out.memptr();
00141   
00142   for(u32 i=0; i<n_elem; ++i)
00143     {
00144     out_ptr[i] = trunc_exp(A.mem[i]);
00145     }
00146   
00147   }

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

Definition at line 154 of file op_misc_meat.hpp.

References Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, Mat< eT >::set_size(), and sqrt().

00155   {
00156   arma_extra_debug_sigprint();
00157   
00158   typedef typename T1::elem_type eT;
00159   
00160   const unwrap<T1> tmp(in.m);
00161   
00162   const Mat<eT>& A = tmp.M;
00163   const u32 n_elem       = A.n_elem;
00164   
00165   out.set_size(A.n_rows, A.n_cols);
00166   eT* out_ptr = out.memptr();
00167   
00168   for(u32 i=0; i<n_elem; ++i)
00169     {
00170     out_ptr[i] = std::sqrt(A.mem[i]);
00171     }
00172   
00173   }

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

Definition at line 180 of file op_misc_meat.hpp.

References Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, and Mat< eT >::set_size().

00181   {
00182   arma_extra_debug_sigprint();
00183   
00184   typedef typename T1::elem_type eT;
00185   
00186   const unwrap<T1> tmp(in.m);
00187   
00188   const Mat<eT>& A = tmp.M;
00189   const u32 n_elem = A.n_elem;
00190   
00191   out.set_size(A.n_rows, A.n_cols);
00192   eT* out_ptr = out.memptr();
00193   
00194   for(u32 i=0; i<n_elem; ++i)
00195     {
00196     const eT tmp_val = A.mem[i];
00197     out_ptr[i] = tmp_val*tmp_val;
00198     }
00199   
00200   }

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

Definition at line 207 of file op_misc_meat.hpp.

References Op< T1, op_type >::aux, Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, pow(), and Mat< eT >::set_size().

00208   {
00209   arma_extra_debug_sigprint();
00210   
00211   typedef typename T1::elem_type eT;
00212   
00213   const unwrap<T1> tmp(in.m);
00214   
00215   const Mat<eT>& A = tmp.M;
00216   const u32 n_elem       = A.n_elem;
00217   
00218   out.set_size(A.n_rows, A.n_cols);
00219   eT* out_ptr = out.memptr();
00220   
00221   for(u32 i=0; i<n_elem; ++i)
00222     {
00223     out_ptr[i] = std::pow(A.mem[i], in.aux);
00224     }
00225   
00226   }

template<typename T , typename T1 >
void op_pow::apply ( Mat< std::complex< T > > &  out,
const Op< T1, op_pow > &  in 
) [inline, static, inherited]

Definition at line 233 of file op_misc_meat.hpp.

References Op< T1, op_type >::aux, Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, and pow().

00234   {
00235   arma_extra_debug_sigprint();
00236   
00237   typedef std::complex<T> eT;
00238   
00239   isnt_same_type<eT, typename T1::elem_type>::check();
00240   
00241   const unwrap<T1> tmp(in.m);
00242   
00243   const Mat<eT>& A = tmp.M;
00244   const u32 n_elem       = A.n_elem;
00245   
00246   out.set_size(A.n_rows, A.n_cols);
00247   eT* out_ptr = out.memptr();
00248   
00249   
00250   if(in.aux.imag() == T(0))
00251     {
00252     const T in_aux_real = in.aux.real();
00253     
00254     for(u32 i=0; i<n_elem; ++i)
00255       {
00256       out_ptr[i] = std::pow(A.mem[i], in_aux_real);
00257       }
00258     }
00259   else
00260     {
00261     for(u32 i=0; i<n_elem; ++i)
00262       {
00263       out_ptr[i] = std::pow(A.mem[i], in.aux);
00264       }
00265     }
00266   }

template<typename T1 >
T1 op_pow_s32::internal_pow ( const T1  base,
const int  exponent 
) [inline, static, inherited]

Definition at line 273 of file op_misc_meat.hpp.

References pow().

Referenced by op_pow_s32::apply().

00274   {
00275   return std::pow(base, exponent);
00276   }

char op_pow_s32::internal_pow ( const char  base,
const int  exponent 
) [inline, static, inherited]

Definition at line 282 of file op_misc_meat.hpp.

References pow().

00283   {
00284   typedef char out_type;
00285   return out_type( std::pow(double(base), exponent) );
00286   }

unsigned char op_pow_s32::internal_pow ( const unsigned char  base,
const int  exponent 
) [inline, static, inherited]

Definition at line 292 of file op_misc_meat.hpp.

References pow().

00293   {
00294   typedef unsigned char out_type;
00295   return out_type( std::pow(double(base), exponent) );
00296   }

int op_pow_s32::internal_pow ( const int  base,
const int  exponent 
) [inline, static, inherited]

Definition at line 302 of file op_misc_meat.hpp.

References pow().

00303   {
00304   typedef int out_type;
00305   return out_type( std::pow(double(base), exponent) );
00306   }

unsigned int op_pow_s32::internal_pow ( const unsigned int  base,
const int  exponent 
) [inline, static, inherited]

Definition at line 312 of file op_misc_meat.hpp.

References pow().

00313   {
00314   typedef unsigned int out_type;
00315   return out_type( std::pow(double(base), exponent) );
00316   }

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

Definition at line 323 of file op_misc_meat.hpp.

References Op< T1, op_type >::aux_u32_a, Op< T1, op_type >::aux_u32_b, op_pow_s32::internal_pow(), Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, and Mat< eT >::set_size().

00324   {
00325   arma_extra_debug_sigprint();
00326   
00327   typedef typename T1::elem_type eT;
00328   
00329   const unwrap<T1> tmp(in.m);
00330   
00331   const Mat<eT>& A = tmp.M;
00332   const u32 n_elem       = A.n_elem;
00333   
00334   out.set_size(A.n_rows, A.n_cols);
00335   eT* out_ptr = out.memptr();
00336   
00337   const int exponent = (in.aux_u32_b == 0) ? in.aux_u32_a : -in.aux_u32_a;
00338   
00339   for(u32 i=0; i<n_elem; ++i)
00340     {
00341     //out_ptr[i] = std::pow(A.mem[i], exponent);  // causes problems with gcc 4.1/4.2 for base that has an integer type
00342     out_ptr[i] = op_pow_s32::internal_pow(A.mem[i], exponent);
00343     }
00344   
00345   }

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

Definition at line 352 of file op_misc_meat.hpp.

References conj(), Op< T1, op_type >::m, Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, and Mat< eT >::set_size().

00353   {
00354   arma_extra_debug_sigprint();
00355   
00356   typedef typename T1::elem_type eT;
00357 
00358   arma_type_check< is_complex<T1>::value == true >::apply();
00359   
00360   const unwrap<T1> tmp(in.m);
00361   
00362   const Mat<eT>& A = tmp.M;
00363   const u32 n_elem       = A.n_elem;
00364   
00365   out.set_size(A.n_rows, A.n_cols);
00366   eT* out_ptr = out.memptr();
00367   
00368   for(u32 i=0; i<n_elem; ++i)
00369     {
00370     out_ptr[i] = std::conj(A.mem[i]);
00371     }
00372   
00373   }