Classes | |
class | op_neg |
negate operation More... | |
Functions | |
template<typename T1 > | |
static void | op_neg::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_neg > &in) |
Negate all elements of a dense matrix. | |
template<typename T1 > | |
static void | op_neg::apply (Cube< typename T1::elem_type > &out, const OpCube< T1, op_neg > &in) |
Negate all elements of a dense cube. |
void op_neg::apply | ( | Mat< typename T1::elem_type > & | out, | |
const Op< T1, op_neg > & | in | |||
) | [inline, static, inherited] |
Negate all elements of a dense matrix.
Definition at line 26 of file op_neg_meat.hpp.
References 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 00039 for(u32 i=0; i<n_elem; ++i) 00040 { 00041 out_mem[i] = -A_mem[i]; 00042 } 00043 }
void op_neg::apply | ( | Cube< typename T1::elem_type > & | out, | |
const OpCube< T1, op_neg > & | in | |||
) | [inline, static, inherited] |
Negate all elements of a dense cube.
Definition at line 52 of file op_neg_meat.hpp.
References 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 00065 for(u32 i=0; i<n_elem; ++i) 00066 { 00067 out_mem[i] = -A_mem[i]; 00068 } 00069 }