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: fix remake for IntervalNonlinearProblem #727

Merged

Conversation

AayushSabharwal
Copy link
Member

@AayushSabharwal AayushSabharwal commented Jun 28, 2024

Close #726

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

@ChrisRackauckas
Copy link
Member

uspan = (1.0, 2.0)
prob_int = IntervalNonlinearProblem(interval_f, uspan)
prob2 = @inferred IntervalNonlinearProblem remake(prob_int; p = [0])
@test prob2.p == [2]
Copy link

@nathanrboyer nathanrboyer Jun 28, 2024

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

Copy link

@nathanrboyer nathanrboyer Jun 28, 2024

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.

Copy link
Member Author

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.

@AayushSabharwal AayushSabharwal force-pushed the as/interval-nonlinear-problem branch from ea1e723 to 32ff4de Compare June 28, 2024 15:31
uspan = (1.0, 2.0)
prob_int = IntervalNonlinearProblem(interval_f, uspan)
prob2 = @inferred IntervalNonlinearProblem remake(prob_int; p = [0])
@test prob2.p == [0]

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]

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@AayushSabharwal AayushSabharwal force-pushed the as/interval-nonlinear-problem branch from 32ff4de to bfbb09e Compare July 1, 2024 05:49
@ChrisRackauckas ChrisRackauckas merged commit 27dcb4c into SciML:master Jul 1, 2024
29 of 40 checks passed
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.

Error: IntervalNonlinearProblem has no field u0
3 participants