Skip to content

Commit

Permalink
Fix v0.6 deprecations
Browse files Browse the repository at this point in the history
Except for `floor`
  • Loading branch information
oyamad committed Jun 1, 2017
1 parent ff70707 commit e5187cc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
julia 0.5
Compat 0.17.0
2 changes: 2 additions & 0 deletions src/Matching.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Matching

using Compat

include("util.jl")
include("deferred_acceptance.jl")
include("matching_tools.jl")
Expand Down
12 changes: 6 additions & 6 deletions src/deferred_acceptance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions src/matching_tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit e5187cc

Please sign in to comment.