[mlpack-git] [mlpack/mlpack] backported ind2sub and sub2ind. (#683)

stereomatchingkiss notifications at github.com
Thu Jun 9 11:16:11 EDT 2016


> +  arma::vec d(n), v(n), z(n + 1);
> +  int k = 0;
> +  v[0] = 0.0;
> +  z[0] = -INF;
> +  z[1] = +INF;
> +  for (size_t q = 1; q <= n - 1; ++q)
> +  {
> +    float s  = ( (f[q] + q * q)-( f[v[k]] + v[k] * v[k]) ) / (2 * q - 2 * v[k]);
> +    while (s <= z[k])
> +    {
> +      --k;
> +      s  = ( (f[q] + q * q) - (f[v[k]] + v[k] * v[k]) ) / (2 * q - 2 * v[k]);
> +    }
> +
> +    k++;
> +    v[k] = (double)q;

Forgive me if I am picky about this, I think static_cast is a better choice than old style c cast at here

---
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#r66460836
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160609/8e006701/attachment-0001.html>


More information about the mlpack-git mailing list