-
Notifications
You must be signed in to change notification settings - Fork 234
Closed
Description
I've noticed that in the explanation in the docs of the Nelder-Mead solver contains a couple of bugs, specifically the snippet of code to construct the initial simplexer for a Matlab like simplex:
function Optim.simplexer(A::MatlabSimplexer, initial_x::AbstractArray{T, N}) where {T, N}
n = length(initial_x)
initial_simplex = Array{T, N}[initial_x for i = 1:n+1]
for j = 1:n
initial_simplex[j+1][j] += initial_simplex[j+1][j] == zero(T) ? S.b * initial_simplex[j+1][j] : S.a
end
initial_simplex
end
I was going to submit a small pull request to fix this before I noticed that the fixes had already been implemented:
Optim.jl/docs/src/algo/nelder_mead.md
Lines 82 to 89 in 78ab1f4
function Optim.simplexer(S::MatlabSimplexer, initial_x::AbstractArray{T, N}) where {T, N} | |
n = length(initial_x) | |
initial_simplex = Array{T, N}[copy(initial_x) for i = 1:n+1] | |
for j = 1:n | |
initial_simplex[j+1][j] += initial_simplex[j+1][j] != zero(T) ? S.b * initial_simplex[j+1][j] : S.a | |
end | |
initial_simplex | |
end |
Presumably the docs using this example should be updated to the correct version.
Metadata
Metadata
Assignees
Labels
No labels