Skip to content

Commit

Permalink
Documentation of Efraimidis-Spirakis samplers (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamins authored and ararslan committed May 7, 2017
1 parent 6a78bce commit 3e3b00f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/source/sampling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,27 @@ All following functions write results to ``x`` (pre-allocated) and return ``x``.
It makes a copy of the weight vector at initialization, and sets the weight to zero when the corresponding sample is picked.

This algorithm consumes ``O(k)`` random numbers, and has overall time complexity ``O(n k)``.

.. function:: efraimidis_a_wsample_norep!([rng], a, wv, x)

Implementation of weighted sampling without replacement using Efraimidis-Spirakis A algorithm.

Reference: Efraimidis, P. S., Spirakis, P. G. *Weighted random sampling with a reservoir.* Information Processing Letters, 97 (5), 181-185, 2006.

This algorithm takes ``O(n + k log k)`` processing time to draw ``k`` elements. It consumes ``n`` random numbers.

.. function:: efraimidis_ares_wsample_norep!([rng], a, wv, x)

Implementation of weighted sampling without replacement using Efraimidis-Spirakis A-Res algorithm.

Reference: Efraimidis, P. S., Spirakis, P. G. *Weighted random sampling with a reservoir.* Information Processing Letters, 97 (5), 181-185, 2006.

This algorithm takes ``O(k log(k) log(n / k))`` processing time to draw ``k`` elements. It consumes ``n`` random numbers.

.. function:: efraimidis_aexpj_wsample_norep!([rng], a, wv, x)

Implementation of weighted sampling without replacement using Efraimidis-Spirakis A-ExpJ algorithm.

Reference: Efraimidis, P. S., Spirakis, P. G. *Weighted random sampling with a reservoir.* Information Processing Letters, 97 (5), 181-185, 2006.

This algorithm takes ``O(k log(k) log(n / k))`` processing time to draw ``k`` elements. It consumes ``O(k log(n / k))`` random numbers.

0 comments on commit 3e3b00f

Please sign in to comment.