1- VERSION >= v " 0.4.0-dev+6521 " && __precompile__ ()
1+ __precompile__ ()
22
33module Sobol
44using Compat
@@ -17,7 +17,7 @@ type SobolSeq{N}
1717 n:: UInt32 # number of x's generated so far
1818end
1919
20- ndims {N} (s:: SobolSeq{N} ) = N
20+ ndims {N} (s:: SobolSeq{N} ) = N:: Int
2121
2222function 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
7979end
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
9090end
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
9393function 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)
116116end
117117SobolSeq (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
120120ndims (s:: ScaledSobolSeq ) = ndims (s. s)
121121
@@ -128,10 +128,10 @@ function next!(s::SobolSeq, x::Vector{Float64},
128128 end
129129 return x
130130end
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
133133next! (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
136136start (s:: ScaledSobolSeq ) = s
137137next (s:: ScaledSobolSeq , s_:: ScaledSobolSeq ) = (next (s), s_)
0 commit comments