op_neg_meat.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 template<typename T1>
00022 inline
00023 void
00024 op_neg::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_neg> &in)
00025 {
00026 arma_extra_debug_sigprint();
00027
00028 typedef typename T1::elem_type eT;
00029
00030 const unwrap<T1> tmp(in.m);
00031 const Mat<eT>& X = tmp.M;
00032
00033
00034 out.set_size(X.n_rows, X.n_cols);
00035
00036 const eT* X_mem = X.mem;
00037 eT* out_mem = out.memptr();
00038
00039
00040 for(u32 i=0; i<X.n_elem; ++i)
00041 {
00042 out_mem[i] = -X_mem[i];
00043 }
00044
00045 }
00046
00047