[mlpack-git] [mlpack/mlpack] backported ind2sub and sub2ind. (#683)
stereomatchingkiss
notifications at github.com
Thu Jun 9 13:45:05 EDT 2016
> + for(size_t j = 0; j < mag.n_cols; ++j)
> + {
> + double max = -9999999999.0; int max_loc = 0;
> + for(size_t k = 0; k < mag.n_slices; ++k)
> + {
> + if(mag(i, j, k) > max)
> + {
> + max = mag(i, j, k);
> + MaxVal(i, j) = max;
> + Location(i, j) = k;
> + }
> + }
> + }
> + }
> + return MaxVal;
> +}
Maybe we can vectorize the codes?
```
//pseudo codes
arma::uvec location = location = arma::find(mag.slice(0) > mag.slice(1));
MaxVal.elem(location == 1) = mag.slice(1).elem(location == 1);
```
We can optimize this part after the prototype can work :)
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/683/files/9d85b64c6c6bdff608331195351d09abf56cfc96#r66487517
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160609/8f67e681/attachment.html>
More information about the mlpack-git
mailing list