Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
simonster committed Feb 9, 2015
1 parent 6aaf697 commit 2668b50
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/hist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ function histrange{T<:FloatingPoint}(v::AbstractArray{T}, n::Integer, closed::Sy
end
if closed == :right
start = step*(ceil(lo/step)-1)
nm1 = iceil((hi - start)/step)
nm1 = ceil(Integer, (hi - start)/step)
else
start = step*floor(lo/step)
nm1 = ifloor((hi - start)/step)+1
nm1 = floor(Integer, (hi - start)/step)+1
end
start:step:(start + nm1*step)
end
Expand All @@ -39,7 +39,7 @@ function histrange{T<:Integer}(v::AbstractArray{T}, n::Integer, closed::Symbol)
step = 1
else
bw = (hi - lo) / n
e = int(10^max(0,ifloor(log10(bw))))
e = int(10^max(0,floor(Integer, log10(bw))))
r = bw / e
if r <= 1
step = e
Expand All @@ -52,11 +52,11 @@ function histrange{T<:Integer}(v::AbstractArray{T}, n::Integer, closed::Symbol)
end
end
if closed == :right
start = step*(iceil(lo/step)-1)
nm1 = iceil((hi - start)/step)
start = step*(ceil(Integer, lo/step)-1)
nm1 = ceil(Integer, (hi - start)/step)
else
start = step*ifloor(lo/step)
nm1 = ifloor((hi - start)/step)+1
start = step*floor(Integer, lo/step)
nm1 = floor(Integer, (hi - start)/step)+1
end
start:step:(start + nm1*step)
end
Expand All @@ -73,7 +73,7 @@ midpoints(v::AbstractVector) = [0.5*(v[i] + v[i+1]) for i in 1:length(v)-1]
## histograms ##
function sturges(n) # Sturges' formula
n==0 && return one(n)
iceil(log2(n))+1
ceil(Integer, log2(n))+1
end

# N-dimensional histogram object
Expand Down
8 changes: 4 additions & 4 deletions src/sampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function self_avoid_sample!(a::AbstractArray, x::AbstractArray)
k <= n || error("length(x) should not exceed length(a)")

s = Set{Int}()
sizehint(s, k)
sizehint!(s, k)
rgen = RandIntSampler(n)

# first one
Expand Down Expand Up @@ -228,7 +228,7 @@ function seqsample_a!(a::AbstractArray, x::AbstractArray)
end

if k > 0 # checking k > 0 is necessary: x can be empty
s = itrunc(n * rand())
s = trunc(Int, n * rand())
x[j+1] = a[i+(s+1)]
end
return x
Expand Down Expand Up @@ -256,14 +256,14 @@ function seqsample_c!(a::AbstractArray, x::AbstractArray)
end
u -= 1
end
s = itrunc(minv) + 1
s = trunc(Int, minv) + 1
x[j+=1] = a[i+=s]
n -= s
k -= 1
end

if k > 0
s = itrunc(n * rand())
s = trunc(Int, n * rand())
x[j+1] = a[i+(s+1)]
end
return x
Expand Down
2 changes: 1 addition & 1 deletion src/scalarstats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function trimmean(x::RealArray, p::Real)
n = length(x)
n > 0 || error("x can not be empty.")
0 <= p < 1 || error("p must be non-negative and less than 1.")
rn = min(iround(n * p), n-1)
rn = min(round(Int, n * p), n-1)

sx = sort(x)
nl = rn >> 1
Expand Down
4 changes: 2 additions & 2 deletions src/signalcorr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function crosscov!{T<:RealFP}(r::AbstractArray{T,3}, x::Matrix{T}, y::Matrix{T},

# cached (centered) columns of x
zxs = Array(Vector{T}, 0)
sizehint(zxs, nx)
sizehint!(zxs, nx)
for j = 1 : nx
xj = x[:,j]
if demean
Expand Down Expand Up @@ -316,7 +316,7 @@ function crosscor!{T<:RealFP}(r::AbstractArray{T,3}, x::Matrix{T}, y::Matrix{T},

# cached (centered) columns of x
zxs = Array(Vector{T}, 0)
sizehint(zxs, nx)
sizehint!(zxs, nx)
xxs = Array(T, nx)

for j = 1 : nx
Expand Down

0 comments on commit 2668b50

Please sign in to comment.