diff --git a/REQUIRE b/REQUIRE index 94237c0..2652857 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1 +1,2 @@ julia 0.5 +Compat 0.17.0 diff --git a/src/Matching.jl b/src/Matching.jl index 4ee4cfe..c7e2e0a 100644 --- a/src/Matching.jl +++ b/src/Matching.jl @@ -1,5 +1,7 @@ module Matching +using Compat + include("util.jl") include("deferred_acceptance.jl") include("matching_tools.jl") diff --git a/src/deferred_acceptance.jl b/src/deferred_acceptance.jl index a885687..5e63946 100644 --- a/src/deferred_acceptance.jl +++ b/src/deferred_acceptance.jl @@ -87,7 +87,7 @@ function deferred_acceptance(prop_prefs::Matrix{Int}, next_resps = ones(Int, num_props) # Props currently matched - current_props = Array(Int, num_resp_caps) + current_props = Array{Int}(num_resp_caps) fill!(current_props, resp_unmatched_idx) # Numbers of resps' occupied seats @@ -96,9 +96,9 @@ function deferred_acceptance(prop_prefs::Matrix{Int}, # Binary heaps bhs = [ BinHeap(view(resp_ranks, :, r), - view(current_props, resp_indptr[r]:resp_indptr[r+1]-1), - false) - for r in 1:num_resps + view(current_props, resp_indptr[r]:resp_indptr[r+1]-1), + false) + for r in 1:num_resps ] # Main loop @@ -192,7 +192,7 @@ function deferred_acceptance(prop_prefs::Matrix{Int}, resp_prefs::Matrix{Int}) end # Many-to-one -abstract DAProposal +@compat abstract type DAProposal end immutable SProposing <: DAProposal end immutable CProposing <: DAProposal end @@ -260,7 +260,7 @@ end function _caps2indptr(caps::Vector{Int}) n = length(caps) - indptr = Array(Int, n+1) + indptr = Array{Int}(n+1) indptr[1] = 1 @inbounds for i in 1:n indptr[i+1] = indptr[i] + caps[i] diff --git a/src/matching_tools.jl b/src/matching_tools.jl index d17d26c..45a7bc9 100644 --- a/src/matching_tools.jl +++ b/src/matching_tools.jl @@ -122,7 +122,7 @@ function random_prefs(rng::AbstractRNG, c_prefs = _random_prefs(rng, n, m) if allow_unmatched - unmatched_rankings = Array(Int, n) #rand(r, 2:n+1, m) + unmatched_rankings = Array{Int}(n) #rand(r, 2:n+1, m) _random_unmatched!(rng, c_prefs, unmatched_rankings) caps = _random_caps(rng, unmatched_rankings) else @@ -137,7 +137,7 @@ random_prefs(m::Integer, n::Integer, T::Type{ReturnCaps}; function _random_prefs(rng::AbstractRNG, m::Integer, n::Integer) - prefs = Array(Int, n+1, m) + prefs = Array{Int}(n+1, m) for j in 1:m prefs[end, j] = 0 end @@ -163,7 +163,7 @@ function _random_prefs(rng::AbstractRNG, m::Integer, n::Integer, prefs = _random_prefs(rng, m, n) if allow_unmatched - unmatched_rankings = Array(Int, m) + unmatched_rankings = Array{Int}(m) _random_unmatched!(rng, prefs, unmatched_rankings) end