Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Commit

Permalink
Speed up subset iteration (non-k)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamed2 committed Sep 22, 2016
1 parent 4845457 commit 7e85b3e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -429,16 +429,11 @@ end

function start(it::Subsets)
# one extra bit to indicated that we are at the end
BitVector(length(it.xs) + 1)
fill(false, length(it.xs) + 1)
end

function next(it::Subsets, state)
ss = Array(eltype(it.xs), 0)
for i = 1:length(it.xs)
if state[i]
push!(ss, it.xs[i])
end
end
ss = it.xs[state[1:end-1]]

state = copy(state)
state[1] = !state[1]
Expand Down

0 comments on commit 7e85b3e

Please sign in to comment.