Skip to content

Commit

Permalink
change how we resolve the fencepost problem in sample_indices_iid and…
Browse files Browse the repository at this point in the history
… sample_indices_iid_uniform (this implementation avoids unncessary increments)
  • Loading branch information
rileyjmurray committed Sep 29, 2024
1 parent f09b3c4 commit 36da117
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions RandBLAS/util.hh
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ state_t sample_indices_iid(int64_t n, const T* cdf, int64_t k, sint_t* samples,
rv_index = 0;
}
}
if (rv_index < len_c) ctr.incr(1);
if (0 < rv_index) ctr.incr(1);
return state_t(ctr, key);
}

Expand Down Expand Up @@ -501,7 +501,7 @@ state_t sample_indices_iid_uniform(int64_t n, int64_t k, sint_t* samples, T* rad
rv_index = 0;
}
}
if (rv_index < len_c) ctr.incr(1);
if (0 < rv_index) ctr.incr(1);
return state_t(ctr, key);
}

Expand Down

0 comments on commit 36da117

Please sign in to comment.