00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00016
00017
00018
00019 template<typename T1>
00020 inline
00021 void
00022 op_rel_lt_pre::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_lt_pre>& X)
00023 {
00024 arma_extra_debug_sigprint();
00025
00026 typedef typename T1::elem_type eT;
00027 typedef typename Proxy<T1>::ea_type ea_type;
00028
00029 const Proxy<T1> Y(X.m);
00030
00031 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00032
00033 const eT val = X.aux;
00034 ea_type A = Y.get_ea();
00035 uword* out_mem = out.memptr();
00036 const uword n_elem = out.n_elem;
00037
00038 uword i,j;
00039
00040 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00041 {
00042 out_mem[i] = (val < A[i]) ? uword(1) : uword(0);
00043 out_mem[j] = (val < A[j]) ? uword(1) : uword(0);
00044 }
00045
00046 if(i < n_elem)
00047 {
00048 out_mem[i] = (val < A[i]) ? uword(1) : uword(0);
00049 }
00050 }
00051
00052
00053
00054 template<typename T1>
00055 inline
00056 void
00057 op_rel_lt_post::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_lt_post>& X)
00058 {
00059 arma_extra_debug_sigprint();
00060
00061 typedef typename T1::elem_type eT;
00062 typedef typename Proxy<T1>::ea_type ea_type;
00063
00064 const Proxy<T1> Y(X.m);
00065
00066 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00067
00068 const eT val = X.aux;
00069 ea_type A = Y.get_ea();
00070 uword* out_mem = out.memptr();
00071 const uword n_elem = out.n_elem;
00072
00073 uword i,j;
00074
00075 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00076 {
00077 out_mem[i] = (A[i] < val) ? uword(1) : uword(0);
00078 out_mem[j] = (A[j] < val) ? uword(1) : uword(0);
00079 }
00080
00081 if(i < n_elem)
00082 {
00083 out_mem[i] = (A[i] < val) ? uword(1) : uword(0);
00084 }
00085 }
00086
00087
00088
00089 template<typename T1>
00090 inline
00091 void
00092 op_rel_gt_pre::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_gt_pre>& X)
00093 {
00094 arma_extra_debug_sigprint();
00095
00096 typedef typename T1::elem_type eT;
00097 typedef typename Proxy<T1>::ea_type ea_type;
00098
00099 const Proxy<T1> Y(X.m);
00100
00101 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00102
00103 const eT val = X.aux;
00104 ea_type A = Y.get_ea();
00105 uword* out_mem = out.memptr();
00106 const uword n_elem = out.n_elem;
00107
00108 uword i,j;
00109
00110 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00111 {
00112 out_mem[i] = (val > A[i]) ? uword(1) : uword(0);
00113 out_mem[j] = (val > A[j]) ? uword(1) : uword(0);
00114 }
00115
00116 if(i < n_elem)
00117 {
00118 out_mem[i] = (val > A[i]) ? uword(1) : uword(0);
00119 }
00120 }
00121
00122
00123
00124 template<typename T1>
00125 inline
00126 void
00127 op_rel_gt_post::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_gt_post>& X)
00128 {
00129 arma_extra_debug_sigprint();
00130
00131 typedef typename T1::elem_type eT;
00132 typedef typename Proxy<T1>::ea_type ea_type;
00133
00134 const Proxy<T1> Y(X.m);
00135
00136 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00137
00138 const eT val = X.aux;
00139 ea_type A = Y.get_ea();
00140 uword* out_mem = out.memptr();
00141 const uword n_elem = out.n_elem;
00142
00143 uword i,j;
00144
00145 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00146 {
00147 out_mem[i] = (A[i] > val) ? uword(1) : uword(0);
00148 out_mem[j] = (A[j] > val) ? uword(1) : uword(0);
00149 }
00150
00151 if(i < n_elem)
00152 {
00153 out_mem[i] = (A[i] > val) ? uword(1) : uword(0);
00154 }
00155 }
00156
00157
00158
00159 template<typename T1>
00160 inline
00161 void
00162 op_rel_lteq_pre::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_lteq_pre>& X)
00163 {
00164 arma_extra_debug_sigprint();
00165
00166 typedef typename T1::elem_type eT;
00167 typedef typename Proxy<T1>::ea_type ea_type;
00168
00169 const Proxy<T1> Y(X.m);
00170
00171 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00172
00173 const eT val = X.aux;
00174 ea_type A = Y.get_ea();
00175 uword* out_mem = out.memptr();
00176 const uword n_elem = out.n_elem;
00177
00178 uword i,j;
00179
00180 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00181 {
00182 out_mem[i] = (val <= A[i]) ? uword(1) : uword(0);
00183 out_mem[j] = (val <= A[j]) ? uword(1) : uword(0);
00184 }
00185
00186 if(i < n_elem)
00187 {
00188 out_mem[i] = (val <= A[i]) ? uword(1) : uword(0);
00189 }
00190 }
00191
00192
00193
00194 template<typename T1>
00195 inline
00196 void
00197 op_rel_lteq_post::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_lteq_post>& X)
00198 {
00199 arma_extra_debug_sigprint();
00200
00201 typedef typename T1::elem_type eT;
00202 typedef typename Proxy<T1>::ea_type ea_type;
00203
00204 const Proxy<T1> Y(X.m);
00205
00206 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00207
00208 const eT val = X.aux;
00209 ea_type A = Y.get_ea();
00210 uword* out_mem = out.memptr();
00211 const uword n_elem = out.n_elem;
00212
00213 uword i,j;
00214
00215 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00216 {
00217 out_mem[i] = (A[i] <= val) ? uword(1) : uword(0);
00218 out_mem[j] = (A[j] <= val) ? uword(1) : uword(0);
00219 }
00220
00221 if(i < n_elem)
00222 {
00223 out_mem[i] = (A[i] <= val) ? uword(1) : uword(0);
00224 }
00225 }
00226
00227
00228
00229 template<typename T1>
00230 inline
00231 void
00232 op_rel_gteq_pre::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_gteq_pre>& X)
00233 {
00234 arma_extra_debug_sigprint();
00235
00236 typedef typename T1::elem_type eT;
00237 typedef typename Proxy<T1>::ea_type ea_type;
00238
00239 const Proxy<T1> Y(X.m);
00240
00241 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00242
00243 const eT val = X.aux;
00244 ea_type A = Y.get_ea();
00245 uword* out_mem = out.memptr();
00246 const uword n_elem = out.n_elem;
00247
00248 uword i,j;
00249
00250 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00251 {
00252 out_mem[i] = (val >= A[i]) ? uword(1) : uword(0);
00253 out_mem[j] = (val >= A[j]) ? uword(1) : uword(0);
00254 }
00255
00256 if(i < n_elem)
00257 {
00258 out_mem[i] = (val >= A[i]) ? uword(1) : uword(0);
00259 }
00260 }
00261
00262
00263
00264 template<typename T1>
00265 inline
00266 void
00267 op_rel_gteq_post::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_gteq_post>& X)
00268 {
00269 arma_extra_debug_sigprint();
00270
00271 typedef typename T1::elem_type eT;
00272 typedef typename Proxy<T1>::ea_type ea_type;
00273
00274 const Proxy<T1> Y(X.m);
00275
00276 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00277
00278 const eT val = X.aux;
00279 ea_type A = Y.get_ea();
00280 uword* out_mem = out.memptr();
00281 const uword n_elem = out.n_elem;
00282
00283 uword i,j;
00284
00285 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00286 {
00287 out_mem[i] = (A[i] >= val) ? uword(1) : uword(0);
00288 out_mem[j] = (A[j] >= val) ? uword(1) : uword(0);
00289 }
00290
00291 if(i < n_elem)
00292 {
00293 out_mem[i] = (A[i] >= val) ? uword(1) : uword(0);
00294 }
00295 }
00296
00297
00298
00299 template<typename T1>
00300 inline
00301 void
00302 op_rel_eq::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_eq>& X)
00303 {
00304 arma_extra_debug_sigprint();
00305
00306 typedef typename T1::elem_type eT;
00307 typedef typename Proxy<T1>::ea_type ea_type;
00308
00309 const Proxy<T1> Y(X.m);
00310
00311 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00312
00313 const eT val = X.aux;
00314 ea_type A = Y.get_ea();
00315 uword* out_mem = out.memptr();
00316 const uword n_elem = out.n_elem;
00317
00318 uword i,j;
00319
00320 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00321 {
00322 out_mem[i] = (A[i] == val) ? uword(1) : uword(0);
00323 out_mem[j] = (A[j] == val) ? uword(1) : uword(0);
00324 }
00325
00326 if(i < n_elem)
00327 {
00328 out_mem[i] = (A[i] == val) ? uword(1) : uword(0);
00329 }
00330 }
00331
00332
00333
00334 template<typename T1>
00335 inline
00336 void
00337 op_rel_noteq::apply(Mat<uword>& out, const mtOp<uword, T1, op_rel_noteq>& X)
00338 {
00339 arma_extra_debug_sigprint();
00340
00341 typedef typename T1::elem_type eT;
00342 typedef typename Proxy<T1>::ea_type ea_type;
00343
00344 const Proxy<T1> Y(X.m);
00345
00346 out.set_size(Y.get_n_rows(), Y.get_n_cols());
00347
00348 const eT val = X.aux;
00349 ea_type A = Y.get_ea();
00350 uword* out_mem = out.memptr();
00351 const uword n_elem = out.n_elem;
00352
00353 uword i,j;
00354
00355 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00356 {
00357 out_mem[i] = (A[i] != val) ? uword(1) : uword(0);
00358 out_mem[j] = (A[j] != val) ? uword(1) : uword(0);
00359 }
00360
00361 if(i < n_elem)
00362 {
00363 out_mem[i] = (A[i] != val) ? uword(1) : uword(0);
00364 }
00365 }
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 template<typename T1>
00376 inline
00377 void
00378 op_rel_lt_pre::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_lt_pre>& X)
00379 {
00380 arma_extra_debug_sigprint();
00381
00382 typedef typename T1::elem_type eT;
00383 typedef typename ProxyCube<T1>::ea_type ea_type;
00384
00385 const ProxyCube<T1> Y(X.m);
00386
00387 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00388
00389 const eT val = X.aux;
00390 ea_type A = Y.get_ea();
00391 uword* out_mem = out.memptr();
00392 const uword n_elem = out.n_elem;
00393
00394 uword i,j;
00395
00396 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00397 {
00398 out_mem[i] = (val < A[i]) ? uword(1) : uword(0);
00399 out_mem[j] = (val < A[j]) ? uword(1) : uword(0);
00400 }
00401
00402 if(i < n_elem)
00403 {
00404 out_mem[i] = (val < A[i]) ? uword(1) : uword(0);
00405 }
00406 }
00407
00408
00409
00410 template<typename T1>
00411 inline
00412 void
00413 op_rel_lt_post::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_lt_post>& X)
00414 {
00415 arma_extra_debug_sigprint();
00416
00417 typedef typename T1::elem_type eT;
00418 typedef typename ProxyCube<T1>::ea_type ea_type;
00419
00420 const ProxyCube<T1> Y(X.m);
00421
00422 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00423
00424 const eT val = X.aux;
00425 ea_type A = Y.get_ea();
00426 uword* out_mem = out.memptr();
00427 const uword n_elem = out.n_elem;
00428
00429 uword i,j;
00430
00431 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00432 {
00433 out_mem[i] = (A[i] < val) ? uword(1) : uword(0);
00434 out_mem[j] = (A[j] < val) ? uword(1) : uword(0);
00435 }
00436
00437 if(i < n_elem)
00438 {
00439 out_mem[i] = (A[i] < val) ? uword(1) : uword(0);
00440 }
00441 }
00442
00443
00444
00445 template<typename T1>
00446 inline
00447 void
00448 op_rel_gt_pre::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_gt_pre>& X)
00449 {
00450 arma_extra_debug_sigprint();
00451
00452 typedef typename T1::elem_type eT;
00453 typedef typename ProxyCube<T1>::ea_type ea_type;
00454
00455 const ProxyCube<T1> Y(X.m);
00456
00457 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00458
00459 const eT val = X.aux;
00460 ea_type A = Y.get_ea();
00461 uword* out_mem = out.memptr();
00462 const uword n_elem = out.n_elem;
00463
00464 uword i,j;
00465
00466 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00467 {
00468 out_mem[i] = (val > A[i]) ? uword(1) : uword(0);
00469 out_mem[j] = (val > A[j]) ? uword(1) : uword(0);
00470 }
00471
00472 if(i < n_elem)
00473 {
00474 out_mem[i] = (val > A[i]) ? uword(1) : uword(0);
00475 }
00476 }
00477
00478
00479
00480 template<typename T1>
00481 inline
00482 void
00483 op_rel_gt_post::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_gt_post>& X)
00484 {
00485 arma_extra_debug_sigprint();
00486
00487 typedef typename T1::elem_type eT;
00488 typedef typename ProxyCube<T1>::ea_type ea_type;
00489
00490 const ProxyCube<T1> Y(X.m);
00491
00492 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00493
00494 const eT val = X.aux;
00495 ea_type A = Y.get_ea();
00496 uword* out_mem = out.memptr();
00497 const uword n_elem = out.n_elem;
00498
00499 uword i,j;
00500
00501 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00502 {
00503 out_mem[i] = (A[i] > val) ? uword(1) : uword(0);
00504 out_mem[j] = (A[j] > val) ? uword(1) : uword(0);
00505 }
00506
00507 if(i < n_elem)
00508 {
00509 out_mem[i] = (A[i] > val) ? uword(1) : uword(0);
00510 }
00511 }
00512
00513
00514
00515 template<typename T1>
00516 inline
00517 void
00518 op_rel_lteq_pre::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_lteq_pre>& X)
00519 {
00520 arma_extra_debug_sigprint();
00521
00522 typedef typename T1::elem_type eT;
00523 typedef typename ProxyCube<T1>::ea_type ea_type;
00524
00525 const ProxyCube<T1> Y(X.m);
00526
00527 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00528
00529 const eT val = X.aux;
00530 ea_type A = Y.get_ea();
00531 uword* out_mem = out.memptr();
00532 const uword n_elem = out.n_elem;
00533
00534 uword i,j;
00535
00536 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00537 {
00538 out_mem[i] = (val <= A[i]) ? uword(1) : uword(0);
00539 out_mem[j] = (val <= A[j]) ? uword(1) : uword(0);
00540 }
00541
00542 if(i < n_elem)
00543 {
00544 out_mem[i] = (val <= A[i]) ? uword(1) : uword(0);
00545 }
00546 }
00547
00548
00549
00550 template<typename T1>
00551 inline
00552 void
00553 op_rel_lteq_post::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_lteq_post>& X)
00554 {
00555 arma_extra_debug_sigprint();
00556
00557 typedef typename T1::elem_type eT;
00558 typedef typename ProxyCube<T1>::ea_type ea_type;
00559
00560 const ProxyCube<T1> Y(X.m);
00561
00562 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00563
00564 const eT val = X.aux;
00565 ea_type A = Y.get_ea();
00566 uword* out_mem = out.memptr();
00567 const uword n_elem = out.n_elem;
00568
00569 uword i,j;
00570
00571 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00572 {
00573 out_mem[i] = (A[i] <= val) ? uword(1) : uword(0);
00574 out_mem[j] = (A[j] <= val) ? uword(1) : uword(0);
00575 }
00576
00577 if(i < n_elem)
00578 {
00579 out_mem[i] = (A[i] <= val) ? uword(1) : uword(0);
00580 }
00581 }
00582
00583
00584
00585 template<typename T1>
00586 inline
00587 void
00588 op_rel_gteq_pre::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_gteq_pre>& X)
00589 {
00590 arma_extra_debug_sigprint();
00591
00592 typedef typename T1::elem_type eT;
00593 typedef typename ProxyCube<T1>::ea_type ea_type;
00594
00595 const ProxyCube<T1> Y(X.m);
00596
00597 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00598
00599 const eT val = X.aux;
00600 ea_type A = Y.get_ea();
00601 uword* out_mem = out.memptr();
00602 const uword n_elem = out.n_elem;
00603
00604 uword i,j;
00605
00606 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00607 {
00608 out_mem[i] = (val >= A[i]) ? uword(1) : uword(0);
00609 out_mem[j] = (val >= A[j]) ? uword(1) : uword(0);
00610 }
00611
00612 if(i < n_elem)
00613 {
00614 out_mem[i] = (val >= A[i]) ? uword(1) : uword(0);
00615 }
00616 }
00617
00618
00619
00620 template<typename T1>
00621 inline
00622 void
00623 op_rel_gteq_post::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_gteq_post>& X)
00624 {
00625 arma_extra_debug_sigprint();
00626
00627 typedef typename T1::elem_type eT;
00628 typedef typename ProxyCube<T1>::ea_type ea_type;
00629
00630 const ProxyCube<T1> Y(X.m);
00631
00632 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00633
00634 const eT val = X.aux;
00635 ea_type A = Y.get_ea();
00636 uword* out_mem = out.memptr();
00637 const uword n_elem = out.n_elem;
00638
00639 uword i,j;
00640
00641 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00642 {
00643 out_mem[i] = (A[i] >= val) ? uword(1) : uword(0);
00644 out_mem[j] = (A[j] >= val) ? uword(1) : uword(0);
00645 }
00646
00647 if(i < n_elem)
00648 {
00649 out_mem[i] = (A[i] >= val) ? uword(1) : uword(0);
00650 }
00651 }
00652
00653
00654
00655 template<typename T1>
00656 inline
00657 void
00658 op_rel_eq::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_eq>& X)
00659 {
00660 arma_extra_debug_sigprint();
00661
00662 typedef typename T1::elem_type eT;
00663 typedef typename ProxyCube<T1>::ea_type ea_type;
00664
00665 const ProxyCube<T1> Y(X.m);
00666
00667 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00668
00669 const eT val = X.aux;
00670 ea_type A = Y.get_ea();
00671 uword* out_mem = out.memptr();
00672 const uword n_elem = out.n_elem;
00673
00674 uword i,j;
00675
00676 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00677 {
00678 out_mem[i] = (A[i] == val) ? uword(1) : uword(0);
00679 out_mem[j] = (A[j] == val) ? uword(1) : uword(0);
00680 }
00681
00682 if(i < n_elem)
00683 {
00684 out_mem[i] = (A[i] == val) ? uword(1) : uword(0);
00685 }
00686 }
00687
00688
00689
00690 template<typename T1>
00691 inline
00692 void
00693 op_rel_noteq::apply(Cube<uword>& out, const mtOpCube<uword, T1, op_rel_noteq>& X)
00694 {
00695 arma_extra_debug_sigprint();
00696
00697 typedef typename T1::elem_type eT;
00698 typedef typename ProxyCube<T1>::ea_type ea_type;
00699
00700 const ProxyCube<T1> Y(X.m);
00701
00702 out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
00703
00704 const eT val = X.aux;
00705 ea_type A = Y.get_ea();
00706 uword* out_mem = out.memptr();
00707 const uword n_elem = out.n_elem;
00708
00709 uword i,j;
00710
00711 for(i=0, j=1; j<n_elem; i+=2, j+=2)
00712 {
00713 out_mem[i] = (A[i] != val) ? uword(1) : uword(0);
00714 out_mem[j] = (A[j] != val) ? uword(1) : uword(0);
00715 }
00716
00717 if(i < n_elem)
00718 {
00719 out_mem[i] = (A[i] != val) ? uword(1) : uword(0);
00720 }
00721 }
00722
00723
00724