Skip to content

Commit

Permalink
Improve automatic computation of type (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tortar committed Apr 18, 2024
1 parent e5fd2aa commit 12af11e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ version = "0.3.0"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ResumableFunctions = "c5292f4c-5179-55e1-98c5-05642aab7184"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[compat]
julia = "1.8"
DataStructures = "0.18"
Distributions = "0.25"
Random = "1"
ResumableFunctions = "0.6"
StatsBase = "0.32, 0.33, 0.34"
2 changes: 1 addition & 1 deletion src/SortedSamplingMulti.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function sortedindices_sample(rng, iter, n::Int; replace = false, ordered = fals
end
end
end
iter_type = Base.@default_eltype(iter)
iter_type = calculate_eltype(iter)
reservoir = Vector{iter_type}(undef, n)
indices = get_sorted_indices(rng, n, N, replace)
first_idx = indices[1]
Expand Down
1 change: 0 additions & 1 deletion src/StreamSampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module StreamSampling
using DataStructures
using Distributions
using Random
using ResumableFunctions
using StatsBase

struct WRSample end
Expand Down
6 changes: 2 additions & 4 deletions src/UnweightedSamplingMulti.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ function update_all!(s, iter, ordered)
end

function calculate_eltype(iter)
return Base.@default_eltype(iter)
end
function calculate_eltype(iter::ResumableFunctions.FiniteStateMachineIterator)
return eltype(iter)
T = eltype(iter)
return T === Any ? Base.@default_eltype(iter) : T
end

0 comments on commit 12af11e

Please sign in to comment.