op_cx_scalar_meat.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2008-2010 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_cx_scalar_times::apply
00023   (
00024         Mat< typename std::complex<typename T1::pod_type> >& out,
00025   const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_times>& X
00026   )
00027   {
00028   arma_extra_debug_sigprint();
00029   
00030   typedef typename std::complex<typename T1::pod_type> eT;
00031   typedef typename T1::pod_type                         T;
00032   
00033   const Proxy<T1> A(X.m);
00034   
00035   out.set_size(A.get_n_rows(), A.get_n_cols());
00036   
00037   const eT  k       = X.aux_out_eT;
00038   const uword n_elem  = out.n_elem;
00039         eT* out_mem = out.memptr();
00040   
00041   for(uword i=0; i<n_elem; ++i)
00042     {
00043     out_mem[i] = A[i] * k;
00044     }
00045   }
00046 
00047 
00048 
00049 template<typename T1>
00050 inline
00051 void
00052 op_cx_scalar_plus::apply
00053   (
00054         Mat< typename std::complex<typename T1::pod_type> >& out,
00055   const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>& X
00056   )
00057   {
00058   arma_extra_debug_sigprint();
00059   
00060   typedef typename std::complex<typename T1::pod_type> eT;
00061   typedef typename T1::pod_type                         T;
00062   
00063   const Proxy<T1> A(X.m);
00064   
00065   out.set_size(A.get_n_rows(), A.get_n_cols());
00066   
00067   const eT  k       = X.aux_out_eT;
00068   const uword n_elem  = out.n_elem;
00069         eT* out_mem = out.memptr();
00070   
00071   for(uword i=0; i<n_elem; ++i)
00072     {
00073     out_mem[i] = A[i] + k;
00074     }
00075   }
00076 
00077 
00078 
00079 template<typename T1>
00080 inline
00081 void
00082 op_cx_scalar_minus_pre::apply
00083   (
00084         Mat< typename std::complex<typename T1::pod_type> >& out,
00085   const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_pre>& X
00086   )
00087   {
00088   arma_extra_debug_sigprint();
00089   
00090   typedef typename std::complex<typename T1::pod_type> eT;
00091   typedef typename T1::pod_type                         T;
00092   
00093   const Proxy<T1> A(X.m);
00094   
00095   out.set_size(A.get_n_rows(), A.get_n_cols());
00096   
00097   const eT  k       = X.aux_out_eT;
00098   const uword n_elem  = out.n_elem;
00099         eT* out_mem = out.memptr();
00100   
00101   for(uword i=0; i<n_elem; ++i)
00102     {
00103     out_mem[i] = k - A[i];
00104     }
00105   }
00106 
00107 
00108 
00109 template<typename T1>
00110 inline
00111 void
00112 op_cx_scalar_minus_post::apply
00113   (
00114         Mat< typename std::complex<typename T1::pod_type> >& out,
00115   const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_post>& X
00116   )
00117   {
00118   arma_extra_debug_sigprint();
00119   
00120   typedef typename std::complex<typename T1::pod_type> eT;
00121   typedef typename T1::pod_type                         T;
00122   
00123   const Proxy<T1> A(X.m);
00124   
00125   out.set_size(A.get_n_rows(), A.get_n_cols());
00126   
00127   const eT  k       = X.aux_out_eT;
00128   const uword n_elem  = out.n_elem;
00129         eT* out_mem = out.memptr();
00130   
00131   for(uword i=0; i<n_elem; ++i)
00132     {
00133     out_mem[i] = A[i] - k;
00134     }
00135   }
00136 
00137 
00138 
00139 template<typename T1>
00140 inline
00141 void
00142 op_cx_scalar_div_pre::apply
00143   (
00144         Mat< typename std::complex<typename T1::pod_type> >& out,
00145   const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_pre>& X
00146   )
00147   {
00148   arma_extra_debug_sigprint();
00149   
00150   typedef typename std::complex<typename T1::pod_type> eT;
00151   typedef typename T1::pod_type                         T;
00152   
00153   const Proxy<T1> A(X.m);
00154   
00155   out.set_size(A.get_n_rows(), A.get_n_cols());
00156   
00157   const eT  k       = X.aux_out_eT;
00158   const uword n_elem  = out.n_elem;
00159         eT* out_mem = out.memptr();
00160   
00161   for(uword i=0; i<n_elem; ++i)
00162     {
00163     out_mem[i] = k / A[i];
00164     }
00165   }
00166 
00167 
00168 
00169 template<typename T1>
00170 inline
00171 void
00172 op_cx_scalar_div_post::apply
00173   (
00174         Mat< typename std::complex<typename T1::pod_type> >& out,
00175   const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_post>& X
00176   )
00177   {
00178   arma_extra_debug_sigprint();
00179   
00180   typedef typename std::complex<typename T1::pod_type> eT;
00181   typedef typename T1::pod_type                         T;
00182   
00183   const Proxy<T1> A(X.m);
00184   
00185   out.set_size(A.get_n_rows(), A.get_n_cols());
00186   
00187   const eT  k       = X.aux_out_eT;
00188   const uword n_elem  = out.n_elem;
00189         eT* out_mem = out.memptr();
00190   
00191   for(uword i=0; i<n_elem; ++i)
00192     {
00193     out_mem[i] = A[i] / k;
00194     }
00195   }
00196 
00197 
00198 
00199 //
00200 //
00201 //
00202 
00203 
00204 
00205 template<typename T1>
00206 inline
00207 void
00208 op_cx_scalar_times::apply
00209   (
00210            Cube< typename std::complex<typename T1::pod_type> >& out,
00211   const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_times>& X
00212   )
00213   {
00214   arma_extra_debug_sigprint();
00215   
00216   typedef typename std::complex<typename T1::pod_type> eT;
00217   typedef typename T1::pod_type                         T;
00218   
00219   const ProxyCube<T1> A(X.m);
00220   
00221   out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
00222   
00223   const eT  k       = X.aux_out_eT;
00224   const uword n_elem  = out.n_elem;
00225         eT* out_mem = out.memptr();
00226   
00227   for(uword i=0; i<n_elem; ++i)
00228     {
00229     out_mem[i] = A[i] * k;
00230     }
00231   }
00232 
00233 
00234 
00235 template<typename T1>
00236 inline
00237 void
00238 op_cx_scalar_plus::apply
00239   (
00240            Cube< typename std::complex<typename T1::pod_type> >& out,
00241   const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_plus>& X
00242   )
00243   {
00244   arma_extra_debug_sigprint();
00245   
00246   typedef typename std::complex<typename T1::pod_type> eT;
00247   typedef typename T1::pod_type                         T;
00248   
00249   const ProxyCube<T1> A(X.m);
00250   
00251   out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
00252   
00253   const eT  k       = X.aux_out_eT;
00254   const uword n_elem  = out.n_elem;
00255         eT* out_mem = out.memptr();
00256   
00257   for(uword i=0; i<n_elem; ++i)
00258     {
00259     out_mem[i] = A[i] + k;
00260     }
00261   }
00262 
00263 
00264 
00265 template<typename T1>
00266 inline
00267 void
00268 op_cx_scalar_minus_pre::apply
00269   (
00270            Cube< typename std::complex<typename T1::pod_type> >& out,
00271   const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_pre>& X
00272   )
00273   {
00274   arma_extra_debug_sigprint();
00275   
00276   typedef typename std::complex<typename T1::pod_type> eT;
00277   typedef typename T1::pod_type                         T;
00278   
00279   const ProxyCube<T1> A(X.m);
00280   
00281   out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
00282   
00283   const eT  k       = X.aux_out_eT;
00284   const uword n_elem  = out.n_elem;
00285         eT* out_mem = out.memptr();
00286   
00287   for(uword i=0; i<n_elem; ++i)
00288     {
00289     out_mem[i] = k - A[i];
00290     }
00291   }
00292 
00293 
00294 
00295 template<typename T1>
00296 inline
00297 void
00298 op_cx_scalar_minus_post::apply
00299   (
00300            Cube< typename std::complex<typename T1::pod_type> >& out,
00301   const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_minus_post>& X
00302   )
00303   {
00304   arma_extra_debug_sigprint();
00305   
00306   typedef typename std::complex<typename T1::pod_type> eT;
00307   typedef typename T1::pod_type                         T;
00308   
00309   const ProxyCube<T1> A(X.m);
00310   
00311   out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
00312   
00313   const eT  k       = X.aux_out_eT;
00314   const uword n_elem  = out.n_elem;
00315         eT* out_mem = out.memptr();
00316   
00317   for(uword i=0; i<n_elem; ++i)
00318     {
00319     out_mem[i] = A[i] - k;
00320     }
00321   }
00322 
00323 
00324 
00325 template<typename T1>
00326 inline
00327 void
00328 op_cx_scalar_div_pre::apply
00329   (
00330            Cube< typename std::complex<typename T1::pod_type> >& out,
00331   const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_pre>& X
00332   )
00333   {
00334   arma_extra_debug_sigprint();
00335   
00336   typedef typename std::complex<typename T1::pod_type> eT;
00337   typedef typename T1::pod_type                         T;
00338   
00339   const ProxyCube<T1> A(X.m);
00340   
00341   out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
00342   
00343   const eT  k       = X.aux_out_eT;
00344   const uword n_elem  = out.n_elem;
00345         eT* out_mem = out.memptr();
00346   
00347   for(uword i=0; i<n_elem; ++i)
00348     {
00349     out_mem[i] = k / A[i];
00350     }
00351   }
00352 
00353 
00354 
00355 template<typename T1>
00356 inline
00357 void
00358 op_cx_scalar_div_post::apply
00359   (
00360            Cube< typename std::complex<typename T1::pod_type> >& out,
00361   const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_div_post>& X
00362   )
00363   {
00364   arma_extra_debug_sigprint();
00365   
00366   typedef typename std::complex<typename T1::pod_type> eT;
00367   typedef typename T1::pod_type                         T;
00368   
00369   const ProxyCube<T1> A(X.m);
00370   
00371   out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
00372   
00373   const eT  k       = X.aux_out_eT;
00374   const uword n_elem  = out.n_elem;
00375         eT* out_mem = out.memptr();
00376   
00377   for(uword i=0; i<n_elem; ++i)
00378     {
00379     out_mem[i] = A[i] / k;
00380     }
00381   }
00382 
00383 
00384 


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