op_misc_meat.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2008-2011 Conrad Sanderson
00003 // 
00004 // This file is part of the Armadillo C++ library.
00005 // It is provided without any warranty of fitness
00006 // for any purpose. You can redistribute this file
00007 // and/or modify it under the terms of the GNU
00008 // Lesser General Public License (LGPL) as published
00009 // by the Free Software Foundation, either version 3
00010 // of the License or (at your option) any later version.
00011 // (see http://www.opensource.org/licenses for more info)
00012 
00013 
00016 
00017 
00018 
00019 template<typename T1>
00020 inline
00021 void
00022 op_real::apply( Mat<typename T1::pod_type>& out, const mtOp<typename T1::pod_type, T1, op_real>& X )
00023   {
00024   arma_extra_debug_sigprint();
00025   
00026   typedef typename T1::pod_type T;
00027   
00028   const Proxy<T1> A(X.m);
00029   
00030   out.set_size(A.get_n_rows(), A.get_n_cols());
00031   
00032   const uword n_elem  = out.n_elem;
00033         T*  out_mem = out.memptr();
00034   
00035   for(uword i=0; i<n_elem; ++i)
00036     {
00037     out_mem[i] = std::real(A[i]);
00038     }
00039   }
00040 
00041 
00042 
00043 template<typename T1>
00044 inline
00045 void
00046 op_real::apply( Cube<typename T1::pod_type>& out, const mtOpCube<typename T1::pod_type, T1, op_real>& X )
00047   {
00048   arma_extra_debug_sigprint();
00049   
00050   typedef typename T1::pod_type T;
00051   
00052   const ProxyCube<T1> A(X.m);
00053   
00054   out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
00055   
00056   const uword n_elem  = out.n_elem;
00057         T*  out_mem = out.memptr();
00058   
00059   for(uword i=0; i<n_elem; ++i)
00060     {
00061     out_mem[i] = std::real(A[i]);
00062     }
00063   }
00064 
00065 
00066 
00067 template<typename T1>
00068 inline
00069 void
00070 op_imag::apply( Mat<typename T1::pod_type>& out, const mtOp<typename T1::pod_type, T1, op_imag>& X )
00071   {
00072   arma_extra_debug_sigprint();
00073   
00074   typedef typename T1::pod_type T;
00075   
00076   const Proxy<T1> A(X.m);
00077   
00078   out.set_size(A.get_n_rows(), A.get_n_cols());
00079   
00080   const uword n_elem  = out.n_elem;
00081         T*  out_mem = out.memptr();
00082   
00083   for(uword i=0; i<n_elem; ++i)
00084     {
00085     out_mem[i] = std::imag(A[i]);
00086     }
00087   }
00088 
00089 
00090 
00091 template<typename T1>
00092 inline
00093 void
00094 op_imag::apply( Cube<typename T1::pod_type>& out, const mtOpCube<typename T1::pod_type, T1, op_imag>& X )
00095   {
00096   arma_extra_debug_sigprint();
00097   
00098   typedef typename T1::pod_type T;
00099   
00100   const ProxyCube<T1> A(X.m);
00101   
00102   out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
00103   
00104   const uword n_elem  = out.n_elem;
00105         T*  out_mem = out.memptr();
00106   
00107   for(uword i=0; i<n_elem; ++i)
00108     {
00109     out_mem[i] = std::imag(A[i]);
00110     }
00111   }
00112 
00113 
00114 
00115 template<typename T1>
00116 inline
00117 void
00118 op_abs::apply( Mat<typename T1::pod_type>& out, const mtOp<typename T1::pod_type, T1, op_abs>& X )
00119   {
00120   arma_extra_debug_sigprint();
00121   
00122   typedef typename T1::pod_type T;
00123   
00124   const Proxy<T1> A(X.m);
00125   
00126   out.set_size(A.get_n_rows(), A.get_n_cols());
00127   
00128   const uword n_elem  = out.n_elem;
00129         T*  out_mem = out.memptr();
00130   
00131   for(uword i=0; i<n_elem; ++i)
00132     {
00133     out_mem[i] = std::abs(A[i]);
00134     }
00135   }
00136 
00137 
00138 
00139 template<typename T1>
00140 inline
00141 void
00142 op_abs::apply( Cube<typename T1::pod_type>& out, const mtOpCube<typename T1::pod_type, T1, op_abs>& X )
00143   {
00144   arma_extra_debug_sigprint();
00145   
00146   typedef typename T1::pod_type T;
00147   
00148   const ProxyCube<T1> A(X.m);
00149   
00150   out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
00151   
00152   const uword n_elem  = out.n_elem;
00153         T*  out_mem = out.memptr();
00154   
00155   for(uword i=0; i<n_elem; ++i)
00156     {
00157     out_mem[i] = std::abs(A[i]);
00158     }
00159   }
00160 
00161 
00162 
00163 template<typename T1>
00164 inline
00165 void
00166 op_sympd::apply( Mat<typename T1::elem_type>& out, const Op<T1, op_sympd>& X )
00167   {
00168   arma_extra_debug_sigprint();
00169   
00170   out = X.m;
00171   }
00172 
00173 
00174 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:05