Skip to content

feat: pass resid_prototype as u to null oop NonlinearLeastSquaresProblem #1149

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

Merged

Conversation

AayushSabharwal
Copy link
Member

No description provided.

@AayushSabharwal AayushSabharwal force-pushed the as/null-sol-resid-prototype branch from e1b6e19 to 2dd9348 Compare May 5, 2025 16:09
@@ -776,7 +776,7 @@ function build_null_solution(
resid = isnothing(prob.f.resid_prototype) ? Float64[] : copy(prob.f.resid_prototype)
prob.f(resid, prob.u0, prob.p)
else
resid = prob.f(prob.u0, prob.p)
resid = prob.f(prob.f.resid_prototype, prob.p)
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong though?

Copy link
Member

Choose a reason for hiding this comment

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

Only do this if u0 === nothing? Why is this needed though?

Copy link
Member Author

Choose a reason for hiding this comment

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

build_null_solution is only called when prob.u0 === nothing

Copy link
Member Author

Choose a reason for hiding this comment

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

This is necessary because otherwise the OOP form doesn't know what sort of array to create

Copy link
Member

Choose a reason for hiding this comment

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

I see, makes sense in its own way.

@ChrisRackauckas ChrisRackauckas merged commit 204690b into SciML:master May 5, 2025
37 of 45 checks passed
@AayushSabharwal AayushSabharwal deleted the as/null-sol-resid-prototype branch May 6, 2025 06:04
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.

2 participants