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

Add a nlls trait to BVProblem #567

Merged
merged 7 commits into from
Mar 25, 2024
Merged

Add a nlls trait to BVProblem #567

merged 7 commits into from
Mar 25, 2024

Conversation

avik-pal
Copy link
Member

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

The main compilation cost for BVDiffEq is coming from solving NLLS problems. Having this allows us to have a type stable path for NLLS BVPs.

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Attention: Patch coverage is 61.29032% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 30.03%. Comparing base (3746cda) to head (7ff95fc).
Report is 9 commits behind head on master.

Files Patch % Lines
src/problems/bvp_problems.jl 68.42% 6 Missing ⚠️
src/remake.jl 50.00% 3 Missing ⚠️
src/solutions/ode_solutions.jl 33.33% 2 Missing ⚠️
src/scimlfunctions.jl 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #567      +/-   ##
==========================================
- Coverage   38.43%   30.03%   -8.41%     
==========================================
  Files          55       55              
  Lines        4298     4309      +11     
==========================================
- Hits         1652     1294     -358     
- Misses       2646     3015     +369     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -115,6 +115,8 @@ struct ODESolution{T, N, uType, uType2, DType, tType, rateType, P, A, IType, S,
stats::S
alg_choice::AC
retcode::ReturnCode.T
resid::R
original::O
Copy link
Member

Choose a reason for hiding this comment

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

What about creating a BVPSolution to specifically handle these details only in the BVP context?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am open to that. We can do that by subtyping AbstractODESolution.

Copy link
Member

Choose a reason for hiding this comment

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

IMO it just seems a bit wasteful code wise. It's just two more fields, and original makes sense in the IVP case as well (we should use it with ODEInterface)

Comment on lines 160 to 179
struct BVPSolution{T, N, uType, uType2, DType, tType, rateType, P, A, IType, S,
AC <: Union{Nothing, Vector{Int}}, R, OI, ON} <:
AbstractODESolution{T, N, uType}
u::uType
u_analytic::uType2
errors::DType
t::tType
k::rateType
prob::P
alg::A
interp::IType
dense::Bool
tslocation::Int
stats::S
alg_choice::AC
retcode::ReturnCode.T
resid::R
original_ivp::OI
original_nlsolve::ON
end
Copy link
Member Author

Choose a reason for hiding this comment

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

@ErikQQY thoughts on this?

Copy link
Member

Choose a reason for hiding this comment

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

👍I think with this we can specifically handle solutions in the BVP context

@avik-pal avik-pal force-pushed the ap/nlls_bvp branch 2 times, most recently from 1dd64ac to 21dbeea Compare March 20, 2024 17:02
@avik-pal avik-pal changed the title [WIP] Add a nlls trait to BVProblem Add a nlls trait to BVProblem Mar 24, 2024
@avik-pal
Copy link
Member Author

avik-pal commented Mar 24, 2024

I am happy with the current state of this. To summarize

  1. Adds an nlls trait to BVProblem -- we try to infer it but err on the side of caution and set it to Nothing if we can reliably figure it out. It is the job of the upstream library to figure out how to deal with this case
  2. Adds original to the ODESolution. I agree with @ChrisRackauckas that we probably don't want to unnecessarily copy the code into a BVPSolution since original might be useful for ODEs as well. resid not for IVPs but that is probably not a good enough reason to copy so much code.
  3. Special cases the initial condition for the BVP to be a function

@ChrisRackauckas ChrisRackauckas merged commit 9baab96 into master Mar 25, 2024
32 of 43 checks passed
@ChrisRackauckas ChrisRackauckas deleted the ap/nlls_bvp branch March 25, 2024 13:39
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.

None yet

3 participants