src/bvp: fix uninitialized residual tail and size contract inconsistencies - #339
Open
abavoil wants to merge 1 commit into
Open
src/bvp: fix uninitialized residual tail and size contract inconsistencies#339abavoil wants to merge 1 commit into
abavoil wants to merge 1 commit into
Conversation
…ncies bvp_residual for Shooting/Trapeze/Collocation allocated out = similar(X) but only wrote the prefix out[1:n*M]; the trailing 'period' slot (advertised by generate_solution and total_dim) was never written, so residual(prob, x, p) returned uninitialized memory in newton (nondeterministic results) and the AutoDiffDense Jacobian carried a garbage last row. Fixed-interval design, consistent with bifurcationkit#312 ('no need for phase') and bifurcationkit#315 ('fixed final time; any unknown like tf must be a constant state'): - residuals fully write an output of length solution_dim and reject wrong-size input with an ArgumentError - generate_solution returns n*M (no dead trailing slot) - Base.length(DiscretizedBVP) = solution_dim; total_dim removed - get_periodic_orbit uses the model time interval instead of X[end] - remove dead bvp_jacobian(::Nothing) for Shooting (called three undefined helpers: _shooting_phase, integrate_shooting, euler_integrate) and the dangling exports - tests: update test/bvp/bvp.jl to the solution_dim contract, add dedicated MRE regression test test/bvp/mre_shooting_uninit.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bvp_residual for Shooting/Trapeze/Collocation allocated out = similar(X) but only wrote the prefix out[1:n*M]; the trailing 'period' slot (advertised by generate_solution and total_dim) was never written, so residual(prob, x, p) returned uninitialized memory in newton (nondeterministic results) and the AutoDiffDense Jacobian carried a garbage last row.
Fixed-interval design, consistent with #312 ('no need for phase') and #315 ('fixed final time; any unknown like tf must be a constant state'):
(GLM 5.3 flash)