Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix constructor of ScaledSobolSeq #17

Merged
merged 6 commits into from
Jan 24, 2019

Conversation

moritzdrechselgrau
Copy link
Contributor

The following example from the README did not work:
SobolSeq(2, [-1,0,0],[1,3,2])
I added N to the arguments of the inner constructor.

add next!(s::ScaledSobolSeq) to allow for iteration over ScaledSobolSeq
…aledSobolSeq directly, support AbstractVector
src/Sobol.jl Outdated
end
SobolSeq(N::Integer, lb, ub) =
ScaledSobolSeq{Int(N)}(copy!(Vector{Float64}(undef,N), lb), copy!(Vector{Float64}(undef,N), ub))
function ScaledSobolSeq(lb::Vector{<:Real}, ub::Vector{<:Real})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be AbstractVector

src/Sobol.jl Outdated
@@ -122,11 +122,19 @@ struct ScaledSobolSeq{N} <: AbstractSobolSeq{N}
s::SobolSeq{N}
lb::Vector{Float64}
ub::Vector{Float64}
ScaledSobolSeq(lb::Vector{Float64}, ub::Vector{Float64}) =
function ScaledSobolSeq(N::Integer, lb::Vector{<:Real}, ub::Vector{<:Real})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The right thing to do is to use ScaledSobolSeq{N}(...) where {N} for the inner constructor here. (This changed in Julia 0.7, which is why this code stopped working.)

@stevengj
Copy link
Member

Thanks for catching this! I pushed commit that modifies this PR a bit as commented above.

@moritzdrechselgrau
Copy link
Contributor Author

Awesome, thank you!

@stevengj stevengj merged commit 9e8d36c into JuliaMath:master Jan 24, 2019
@stevengj stevengj mentioned this pull request Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants