[mlpack-git] [mlpack/mlpack] backported ind2sub and sub2ind. (#683)
Nilay Jain
notifications at github.com
Thu Jun 9 13:21:47 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;
I am reading about const now, I will try to put it to all the places it can be put in, including your suggestions. :)
---
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#r66483509
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160609/d69bd7ae/attachment.html>
More information about the mlpack-git
mailing list