[mlpack-git] [mlpack/mlpack] Implementation of Multiprobe LSH (#691)

Ryan Curtin notifications at github.com
Mon Jun 27 15:25:37 EDT 2016


> +  return score;
> +}
> +
> +// Inline function used by GetAdditionalProbingBins. The vector shift operation
> +// replaces the largest element of a vector A with (largest element) + 1.
> +inline bool perturbationShift(std::vector<bool>& A)
> +{
> +  size_t maxPos = 0;
> +  for (size_t i = 0; i < A.size(); ++i)
> +    if (A[i] == 1) // marked true
> +      maxPos=i;
> +  
> +  if ( maxPos + 1 < A.size()) // otherwise, this is an invalid vector 
> +  {
> +    A[maxPos] = 0;
> +    A[maxPos+1] = 1;

I'm going to be picky about style again, this should be `maxPos + 1`, and further up it should be `if (maxPos + 1` and above that, `maxPos = i`. :)

---
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/691/files/e2596c5ac626fe6264d89ec4d546506228e16d56#r68639747
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160627/8190c6a2/attachment.html>


More information about the mlpack-git mailing list