Skip to content

Commit 2682eb2

Browse files
committed
silence 0.6 warnings
1 parent b12f447 commit 2682eb2

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
julia 0.4
2-
Compat 0.8
2+
Compat 0.18.0

src/Sobol.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function SobolSeq(N::Int)
4141
ac = a
4242
m[i,j] = m[i,j-d]
4343
for k = 0:d-1
44-
m[i,j] $= ((ac & one(UInt32)) * m[i, j-d+k]) << (d-k)
44+
@inbounds m[i,j] = m[i,j] (((ac & one(UInt32)) * m[i, j-d+k]) << (d-k))
4545
ac >>= 1
4646
end
4747
end
@@ -50,7 +50,7 @@ function SobolSeq(N::Int)
5050
end
5151

5252
# 1/2^m for m = 1:32
53-
const scale2m = exp2(-(1:32))
53+
const scale2m = @compat exp2.(-(1:32))
5454

5555
function next!{T<:AbstractFloat}(s::SobolSeq, x::AbstractVector{T})
5656
length(x) != ndims(s) && throw(BoundsError())
@@ -67,10 +67,10 @@ function next!{T<:AbstractFloat}(s::SobolSeq, x::AbstractVector{T})
6767
for i=1:ndims(s)
6868
@inbounds b = sb[i]
6969
if b >= c
70-
@inbounds sx[i] $= sm[i,c+1] << (b-c)
70+
@inbounds sx[i] = sx[i] (sm[i,c+1] << (b-c))
7171
@inbounds x[i] = sx[i] * scale2m[b+1]
7272
else
73-
@inbounds sx[i] = (sx[i] << (c-b)) $ sm[i,c+1]
73+
@inbounds sx[i] = (sx[i] << (c-b)) sm[i,c+1]
7474
@inbounds sb[i] = c
7575
@inbounds x[i] = sx[i] * scale2m[c+1]
7676
end

test/runtests.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Sobol
1+
using Sobol, Compat
22
using Base.Test
33

44
# test integrand from Joe and Kuo paper (integrates to 1)
@@ -13,7 +13,7 @@ end
1313

1414
function testint(N, n)
1515
s = SobolSeq(N)
16-
x = Array(Float64, N)
16+
x = Array{Float64}(N)
1717
skip(s, n)
1818
sum = 0.0
1919
for j = 1:n
@@ -43,9 +43,10 @@ for i = 1:length(N)
4343
for j = 1:length(n)
4444
println(" ... with $(n[j]) samples")
4545
t = testint(N[i], n[j])
46-
@test_approx_eq_eps t JoeKuo[i,j] 1e-4
46+
@test abs(t - JoeKuo[i,j]) < 1e-4
4747
end
4848
end
4949

5050
# issue #8
51+
using Compat.Iterators: take
5152
@test [x[1] for x in take(Sobol.SobolSeq(1),5)] == [0.5,0.75,0.25,0.375,0.875]

0 commit comments

Comments
 (0)