Skip to content

Commit 29d3c0a

Browse files
committed
fix #7 (implement speed improvements by @vtjnash), drop 0.3 support
1 parent e5bb04f commit 29d3c0a

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ os:
44
- linux
55
- osx
66
julia:
7-
- 0.3
87
- 0.4
98
- 0.5
109
- nightly

REQUIRE

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

src/Sobol.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION >= v"0.4.0-dev+6521" && __precompile__()
1+
__precompile__()
22

33
module Sobol
44
using Compat
@@ -17,7 +17,7 @@ type SobolSeq{N}
1717
n::UInt32 #number of x's generated so far
1818
end
1919

20-
ndims{N}(s::SobolSeq{N}) = N
20+
ndims{N}(s::SobolSeq{N}) = N::Int
2121

2222
function SobolSeq(N::Int)
2323
(N < 0 || N > 1111) && error("invalid Sobol dimension")
@@ -60,7 +60,7 @@ function next!{T<:AbstractFloat}(s::SobolSeq, x::AbstractVector{T})
6060
end
6161

6262
s.n += one(s.n)
63-
c = @compat UInt32(trailing_zeros(s.n))
63+
c = UInt32(trailing_zeros(s.n))
6464
sb = s.b
6565
sx = s.x
6666
sm = s.m
@@ -77,7 +77,7 @@ function next!{T<:AbstractFloat}(s::SobolSeq, x::AbstractVector{T})
7777
end
7878
return x
7979
end
80-
next(s::SobolSeq) = next!(s, Array(Float64,ndims(s)))
80+
next(s::SobolSeq) = next!(s, Array{Float64,1}(ndims(s)))
8181

8282
# if we know in advance how many points (n) we want to compute, then
8383
# adopt the suggestion of the Joe and Kuo paper, which in turn
@@ -88,7 +88,7 @@ function skip!(s::SobolSeq, n::Integer, x)
8888
for unused=1:nskip; next!(s,x); end
8989
return nothing
9090
end
91-
skip(s::SobolSeq, n::Integer) = skip!(s, n, Array(Float64, ndims(s)))
91+
skip(s::SobolSeq, n::Integer) = skip!(s, n, Array{Float64,1}(ndims(s)))
9292

9393
function show(io::IO, s::SobolSeq)
9494
print(io, "$(ndims(s))-dimensional Sobol sequence on [0,1]^$(ndims(s))")
@@ -115,7 +115,7 @@ type ScaledSobolSeq
115115
new(SobolSeq(N), lb, ub)
116116
end
117117
SobolSeq(N::Integer, lb, ub) =
118-
ScaledSobolSeq(N, copy!(Array(Float64,N),lb), copy!(Array(Float64,N),ub))
118+
ScaledSobolSeq(N, copy!(Array{Float64,1}(N),lb), copy!(Array{Float64,1}(N),ub))
119119

120120
ndims(s::ScaledSobolSeq) = ndims(s.s)
121121

@@ -128,10 +128,10 @@ function next!(s::SobolSeq, x::Vector{Float64},
128128
end
129129
return x
130130
end
131-
next{N}(s::SobolSeq{N}, lb::Vector, ub::Vector) = next!(s, Array(Float64,N), lb, ub)
131+
next{N}(s::SobolSeq{N}, lb::Vector, ub::Vector) = next!(s, Array{Float64,1}(N), lb, ub)
132132

133133
next!(s::ScaledSobolSeq, x::Vector{Float64}) = next!(s.s, x, s.lb, s.ub)
134-
next(s::ScaledSobolSeq) = next!(s, Array(Float64,ndims(s)))
134+
next(s::ScaledSobolSeq) = next!(s, Array{Float64,1}(ndims(s)))
135135

136136
start(s::ScaledSobolSeq) = s
137137
next(s::ScaledSobolSeq, s_::ScaledSobolSeq) = (next(s), s_)

0 commit comments

Comments
 (0)