-
-
Notifications
You must be signed in to change notification settings - Fork 104
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: fix remake for IntervalNonlinearProblem
#727
fix: fix remake for IntervalNonlinearProblem
#727
Conversation
test/remake_tests.jl
Outdated
uspan = (1.0, 2.0) | ||
prob_int = IntervalNonlinearProblem(interval_f, uspan) | ||
prob2 = @inferred IntervalNonlinearProblem remake(prob_int; p = [0]) | ||
@test prob2.p == [2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@test prob2.p == [0]
sol = solve(prob2)
@test sol.prob.p == [0]
@test sol.u ≈ √2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test code is a modified version of the tutorial in the documentation here. It does not use @inferred
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out the test error. @inferred
is here to ensure the remake
call is inferred (as much as possible). This testset is concerned with remake
, so testing the solve does not belong here; that's something that should happen in SimpleNonlinearSolve
.
ea1e723
to
32ff4de
Compare
test/remake_tests.jl
Outdated
uspan = (1.0, 2.0) | ||
prob_int = IntervalNonlinearProblem(interval_f, uspan) | ||
prob2 = @inferred IntervalNonlinearProblem remake(prob_int; p = [0]) | ||
@test prob2.p == [0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I would simplify the problem and naming.
interval_f(u, p) = u + p[1]
uspan = (-1.0, 1.0)
interval_prob = IntervalNonlinearProblem(interval_f, uspan)
new_prob = @inferred IntervalNonlinearProblem remake(interval_prob; p = [0])
@test new_prob.p == [0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
32ff4de
to
bfbb09e
Compare
Close #726
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.