-
Notifications
You must be signed in to change notification settings - Fork 214
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
Breaking tests with Complex input #775
Conversation
Interesting :) Good catach... I will think about a better way of printing complexs (or just not print these) |
Can this be merged? |
…lvers#775) This is a minimal fix. Previous versions iterated over the minimizer, and displayed the first few elements compactly with @printf "%.2e". The @printf has been replaced with repr(_, context=:compact => true). Ideally, the whole minimizer could be formatted with repr(minimizer(r), context=:compact => true). However, this currently prints every element of the minimizer.
I've fixed the first one, I think. |
I'm looking at point 2. The error occurs at line 156. This assumes that the type of the minimum, returned by the cost function, is the same as the eltype of the minimizer. The error is caught at line 167, which sorts an array that is supposed to hold real costs, but has inherited the complex eltype of the minimizer. Optim.jl/src/multivariate/solvers/zeroth_order/nelder_mead.jl Lines 151 to 167 in 56dabf7
I presume that the code is supposed to handle a cost function that returns any subtype of A quick fix would be add, after line 152, something like |
At a higher level, I think there's a choice to be made between the following designs:
|
Yeah, I think maybe gradient free solvers will have to use the splitting and or special cases for the complex case.The problem with nelder mead (if I fixed the type stuff you found above) for example is that the simplex will be of order two times too low, and it will not be able to disentangle the real and imaginary part the way it's written right now. |
Then the next step might be to merge the display fix, and raise the gradient free solvers as an issue that will take longer to fix. What's the best way to rebase this PR onto the master branch? Should I just do it and force push to my github? I'll add an @test_broken to make Travis happy. |
I have a plan for zeroth order complex. Please tell me if there is an obvious problem or better way.
|
This adds two tests, that currently throw errors for the following reasons:
(I think) The
show
orrepr
method for solutions tries to@printf
complex numbers.The default solver attempts to sort complex numbers.