This repository was archived by the owner on May 15, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 24
Conversation
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
Codecov Report
@@ Coverage Diff @@
## main #14 +/- ##
==========================================
- Coverage 91.30% 88.82% -2.48%
==========================================
Files 6 7 +1
Lines 161 188 +27
==========================================
+ Hits 147 167 +20
- Misses 14 21 +7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/broyden.jl
Outdated
fₙ = f(x) | ||
T = eltype(x) | ||
if length(x) > 1 | ||
J⁻¹ = Matrix{T}(I, length(x), length(x)) |
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.
oh just here?
src/broyden.jl
Outdated
Comment on lines
6
to
20
A low-overhead implementation of Broyden. This method is non-allocating on scalar | ||
and static array problems. | ||
""" | ||
struct Broyden <: AbstractSimpleNonlinearSolveAlgorithm end | ||
|
||
function SciMLBase.solve(prob::NonlinearProblem, | ||
alg::Broyden, args...; abstol = nothing, | ||
reltol = nothing, | ||
maxiters = 1000, kwargs...) | ||
f = Base.Fix2(prob.f, prob.p) | ||
x = float(prob.u0) | ||
fₙ = f(x) | ||
T = eltype(x) | ||
if length(x) > 1 | ||
J⁻¹ = Matrix{T}(I, length(x), length(x)) |
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.
That will allocate on static array problems. J⁻¹ should be a static array in that case.
ChrisRackauckas
approved these changes
Jan 2, 2023
I did a few edits and it looks good. Thanks! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Adding a Broyden solver.
I've tried to look at the "raphson.jl" implementation and made "broyden.jl" similar.
The algorithm used can be found https://en.wikipedia.org/wiki/Broyden%27s_method.
This is my first open-source PR, so feel free to give any feedback so I can change this implementation, but more importantly, so I learn for future PRs to SciML.