00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 template<typename T1>
00030 inline
00031 void
00032 op_cos::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_cos>& in)
00033 {
00034 arma_extra_debug_sigprint();
00035
00036 typedef typename T1::elem_type eT;
00037
00038 const unwrap<T1> tmp(in.m);
00039
00040 const Mat<eT>& A = tmp.M;
00041 const u32 n_elem = A.n_elem;
00042
00043 out.set_size(A.n_rows, A.n_cols);
00044 eT* out_ptr = out.memptr();
00045
00046 for(u32 i=0; i<n_elem; ++i)
00047 {
00048 out_ptr[i] = std::cos(A.mem[i]);
00049 }
00050
00051 }
00052
00053
00054
00055 template<typename T1>
00056 inline
00057 void
00058 op_acos::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_acos>& in)
00059 {
00060 arma_extra_debug_sigprint();
00061
00062 typedef typename T1::elem_type eT;
00063
00064 const unwrap<T1> tmp(in.m);
00065
00066 const Mat<eT>& A = tmp.M;
00067 const u32 n_elem = A.n_elem;
00068
00069 out.set_size(A.n_rows, A.n_cols);
00070 eT* out_ptr = out.memptr();
00071
00072 for(u32 i=0; i<n_elem; ++i)
00073 {
00074 out_ptr[i] = std::acos(A.mem[i]);
00075 }
00076
00077 }
00078
00079
00080
00081 template<typename T, typename T1>
00082 inline
00083 void
00084 op_acos::apply(Mat< std::complex<T> >& out, const Op<T1,op_acos>& in)
00085 {
00086 arma_extra_debug_sigprint();
00087
00088 #if defined(ARMA_USE_BOOST)
00089 {
00090 typedef typename std::complex<T> eT;
00091 isnt_same_type<eT, typename T1::elem_type>::check();
00092
00093 const unwrap<T1> tmp(in.m);
00094
00095 const Mat<eT>& A = tmp.M;
00096 const u32 n_elem = A.n_elem;
00097
00098 out.set_size(A.n_rows, A.n_cols);
00099 eT* out_ptr = out.memptr();
00100
00101 for(u32 i=0; i<n_elem; ++i)
00102 {
00103 out_ptr[i] = boost::math::acos(A.mem[i]);
00104 }
00105 }
00106 #else
00107 {
00108 arma_stop("op_acos::apply(): need Boost libraries");
00109 }
00110 #endif
00111 }
00112
00113
00114
00115 template<typename T1>
00116 inline
00117 void
00118 op_cosh::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_cosh>& in)
00119 {
00120 arma_extra_debug_sigprint();
00121
00122 typedef typename T1::elem_type eT;
00123
00124 const unwrap<T1> tmp(in.m);
00125
00126 const Mat<eT>& A = tmp.M;
00127 const u32 n_elem = A.n_elem;
00128
00129 out.set_size(A.n_rows, A.n_cols);
00130 eT* out_ptr = out.memptr();
00131
00132 for(u32 i=0; i<n_elem; ++i)
00133 {
00134 out_ptr[i] = std::cosh(A.mem[i]);
00135 }
00136
00137 }
00138
00139
00140
00141 template<typename T1>
00142 inline
00143 void
00144 op_acosh::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_acosh>& in)
00145 {
00146 arma_extra_debug_sigprint();
00147
00148 #if defined(ARMA_USE_BOOST)
00149 {
00150 typedef typename T1::elem_type eT;
00151
00152 const unwrap<T1> tmp(in.m);
00153
00154 const Mat<eT>& A = tmp.M;
00155 const u32 n_elem = A.n_elem;
00156
00157 out.set_size(A.n_rows, A.n_cols);
00158 eT* out_ptr = out.memptr();
00159
00160 for(u32 i=0; i<n_elem; ++i)
00161 {
00162 out_ptr[i] = boost::math::acosh(A.mem[i]);
00163 }
00164 }
00165 #else
00166 {
00167 arma_stop("op_acosh::apply(): need Boost libraries");
00168 }
00169 #endif
00170
00171 }
00172
00173
00174
00175
00176
00177 template<typename T1>
00178 inline
00179 void
00180 op_sin::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_sin>& in)
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 out_ptr[i] = std::sin(A.mem[i]);
00197 }
00198
00199 }
00200
00201
00202
00203 template<typename T1>
00204 inline
00205 void
00206 op_asin::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_asin>& in)
00207 {
00208 arma_extra_debug_sigprint();
00209
00210 typedef typename T1::elem_type eT;
00211
00212 const unwrap<T1> tmp(in.m);
00213
00214 const Mat<eT>& A = tmp.M;
00215 const u32 n_elem = A.n_elem;
00216
00217 out.set_size(A.n_rows, A.n_cols);
00218 eT* out_ptr = out.memptr();
00219
00220 for(u32 i=0; i<n_elem; ++i)
00221 {
00222 out_ptr[i] = std::acos(A.mem[i]);
00223 }
00224
00225 }
00226
00227
00228
00229 template<typename T, typename T1>
00230 inline
00231 void
00232 op_asin::apply(Mat< std::complex<T> >& out, const Op<T1,op_asin>& in)
00233 {
00234 arma_extra_debug_sigprint();
00235
00236 #if defined(ARMA_USE_BOOST)
00237 {
00238 typedef typename std::complex<T> eT;
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 for(u32 i=0; i<n_elem; ++i)
00250 {
00251 out_ptr[i] = boost::math::asin(A.mem[i]);
00252 }
00253 }
00254 #else
00255 {
00256 arma_stop("op_asin::apply(): need Boost libraries");
00257 }
00258 #endif
00259 }
00260
00261
00262
00263 template<typename T1>
00264 inline
00265 void
00266 op_sinh::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_sinh>& in)
00267 {
00268 arma_extra_debug_sigprint();
00269
00270 typedef typename T1::elem_type eT;
00271
00272 const unwrap<T1> tmp(in.m);
00273
00274 const Mat<eT>& A = tmp.M;
00275 const u32 n_elem = A.n_elem;
00276
00277 out.set_size(A.n_rows, A.n_cols);
00278 eT* out_ptr = out.memptr();
00279
00280 for(u32 i=0; i<n_elem; ++i)
00281 {
00282 out_ptr[i] = std::sinh(A.mem[i]);
00283 }
00284
00285 }
00286
00287
00288
00289 template<typename T1>
00290 inline
00291 void
00292 op_asinh::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_asinh>& in)
00293 {
00294 arma_extra_debug_sigprint();
00295
00296 #if defined(ARMA_USE_BOOST)
00297 {
00298 typedef typename T1::elem_type eT;
00299
00300 const unwrap<T1> tmp(in.m);
00301
00302 const Mat<eT>& A = tmp.M;
00303 const u32 n_elem = A.n_elem;
00304
00305 out.set_size(A.n_rows, A.n_cols);
00306 eT* out_ptr = out.memptr();
00307
00308 for(u32 i=0; i<n_elem; ++i)
00309 {
00310 out_ptr[i] = boost::math::asinh(A.mem[i]);
00311 }
00312 }
00313 #else
00314 {
00315 arma_stop("op_asinh::apply(): need Boost libraries");
00316 }
00317 #endif
00318 }
00319
00320
00321
00322
00323
00324 template<typename T1>
00325 inline
00326 void
00327 op_tan::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_tan>& in)
00328 {
00329 arma_extra_debug_sigprint();
00330
00331 typedef typename T1::elem_type eT;
00332
00333 const unwrap<T1> tmp(in.m);
00334
00335 const Mat<eT>& A = tmp.M;
00336 const u32 n_elem = A.n_elem;
00337
00338 out.set_size(A.n_rows, A.n_cols);
00339 eT* out_ptr = out.memptr();
00340
00341 for(u32 i=0; i<n_elem; ++i)
00342 {
00343 out_ptr[i] = std::tan(A.mem[i]);
00344 }
00345
00346 }
00347
00348
00349
00350 template<typename T1>
00351 inline
00352 void
00353 op_atan::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_atan>& in)
00354 {
00355 arma_extra_debug_sigprint();
00356
00357 typedef typename T1::elem_type eT;
00358
00359 const unwrap<T1> tmp(in.m);
00360
00361 const Mat<eT>& A = tmp.M;
00362 const u32 n_elem = A.n_elem;
00363
00364 out.set_size(A.n_rows, A.n_cols);
00365 eT* out_ptr = out.memptr();
00366
00367 for(u32 i=0; i<n_elem; ++i)
00368 {
00369 out_ptr[i] = std::atan(A.mem[i]);
00370 }
00371
00372 }
00373
00374
00375
00376 template<typename T, typename T1>
00377 inline
00378 void
00379 op_atan::apply(Mat< std::complex<T> >& out, const Op<T1,op_atan>& in)
00380 {
00381 arma_extra_debug_sigprint();
00382
00383 #if defined(ARMA_USE_BOOST)
00384 {
00385 typedef typename std::complex<T> eT;
00386 isnt_same_type<eT, typename T1::elem_type>::check();
00387
00388 const unwrap<T1> tmp(in.m);
00389
00390 const Mat<eT>& A = tmp.M;
00391 const u32 n_elem = A.n_elem;
00392
00393 out.set_size(A.n_rows, A.n_cols);
00394 eT* out_ptr = out.memptr();
00395
00396 for(u32 i=0; i<n_elem; ++i)
00397 {
00398 out_ptr[i] = boost::math::atan(A.mem[i]);
00399 }
00400 }
00401 #else
00402 {
00403 arma_stop("op_asin::apply(): need Boost libraries");
00404 }
00405 #endif
00406 }
00407
00408
00409
00410 template<typename T1>
00411 inline
00412 void
00413 op_tanh::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_tanh>& in)
00414 {
00415 arma_extra_debug_sigprint();
00416
00417 typedef typename T1::elem_type eT;
00418
00419 const unwrap<T1> tmp(in.m);
00420
00421 const Mat<eT>& A = tmp.M;
00422 const u32 n_elem = A.n_elem;
00423
00424 out.set_size(A.n_rows, A.n_cols);
00425 eT* out_ptr = out.memptr();
00426
00427 for(u32 i=0; i<n_elem; ++i)
00428 {
00429 out_ptr[i] = std::tanh(A.mem[i]);
00430 }
00431
00432 }
00433
00434
00435
00436 template<typename T1>
00437 inline
00438 void
00439 op_atanh::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_atanh>& in)
00440 {
00441 arma_extra_debug_sigprint();
00442
00443 #if defined(ARMA_USE_BOOST)
00444 {
00445 typedef typename T1::elem_type eT;
00446
00447 const unwrap<T1> tmp(in.m);
00448
00449 const Mat<eT>& A = tmp.M;
00450 const u32 n_elem = A.n_elem;
00451
00452 out.set_size(A.n_rows, A.n_cols);
00453 eT* out_ptr = out.memptr();
00454
00455 for(u32 i=0; i<n_elem; ++i)
00456 {
00457 out_ptr[i] = boost::math::atanh(A.mem[i]);
00458 }
00459 }
00460 #else
00461 {
00462 arma_stop("op_atanh::apply(): need Boost libraries");
00463 }
00464 #endif
00465
00466 }
00467
00468
00469
00470