-
-
Notifications
You must be signed in to change notification settings - Fork 57
SciMLLogging Integration #647
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
Changes from all commits
2ce2898
736b90e
ab22f79
6b18880
02a46d5
4cc5560
a62b908
f3d8e4b
33b8997
1b77ca0
c123035
6dcc91f
48bd8e6
c772d3c
5d89987
e809f9d
ff7cea2
cdbba29
5452f62
e312c2c
c7070bf
a3703e1
89e1a08
edee93c
45edae4
a549ddf
d293b8a
817f3ab
184c02f
1bf1d3e
5e5351c
e8d1449
cd80d86
474d0fa
df26802
9170758
c4344e3
0ae7c11
3713686
75c2155
ba250b0
58840ad
d6ee5c5
5be94e0
643f667
cc41979
eb9bd6a
14e2e3f
78288cd
3991f12
bba8e72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,10 +7,20 @@ struct Brent <: AbstractBracketingAlgorithm end | |
|
|
||
| function SciMLBase.__solve( | ||
| prob::IntervalNonlinearProblem, alg::Brent, args...; | ||
| maxiters = 1000, abstol = nothing, verbose::Bool = true, kwargs... | ||
| maxiters = 1000, abstol = nothing, verbose = NonlinearVerbosity(), kwargs... | ||
| ) | ||
| @assert !SciMLBase.isinplace(prob) "`Brent` only supports out-of-place problems." | ||
|
|
||
| if verbose isa Bool | ||
| if verbose | ||
| verbose = NonlinearVerbosity() | ||
| else | ||
| verbose = NonlinearVerbosity(None()) | ||
| end | ||
| elseif verbose isa AbstractVerbosityPreset | ||
| verbose = NonlinearVerbosity(verbose) | ||
| end | ||
|
|
||
| f = Base.Fix2(prob.f, prob.p) | ||
| left, right = prob.tspan | ||
| fl, fr = f(left), f(right) | ||
|
|
@@ -33,9 +43,9 @@ function SciMLBase.__solve( | |
| end | ||
|
|
||
| if sign(fl) == sign(fr) | ||
| verbose && | ||
| @warn "The interval is not an enclosing interval, opposite signs at the \ | ||
| boundaries are required." | ||
| @SciMLMessage("The interval is not an enclosing interval, opposite signs at the \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this support Bool? Or do all of the downstream packages need to lower bound to the new NonlinearSolveBase?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see the lower bounds, perfect. |
||
| boundaries are required.", | ||
| verbose, :non_enclosing_interval) | ||
| return SciMLBase.build_solution( | ||
| prob, alg, left, fl; retcode = ReturnCode.InitialFailure, left, right | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,21 +5,22 @@ using ArrayInterface: ArrayInterface | |
| using CommonSolve: CommonSolve, init, solve! | ||
| using LinearSolve: LinearSolve, QRFactorization, SciMLLinearSolveAlgorithm | ||
| using SciMLBase: ReturnCode, LinearProblem, LinearAliasSpecifier | ||
| using SciMLLogging: @SciMLMessage | ||
|
|
||
| using LinearAlgebra: ColumnNorm | ||
|
|
||
| using NonlinearSolveBase: NonlinearSolveBase, LinearSolveJLCache, LinearSolveResult, Utils | ||
| using NonlinearSolveBase: NonlinearSolveBase, LinearSolveJLCache, LinearSolveResult, Utils, NonlinearVerbosity | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this not passing down the linearverbosity? Seems incorrect. |
||
|
|
||
| function (cache::LinearSolveJLCache)(; | ||
| A = nothing, b = nothing, linu = nothing, | ||
| reuse_A_if_factorization = false, verbose = true, kwargs... | ||
| reuse_A_if_factorization = false, kwargs... | ||
| ) | ||
| cache.stats.nsolve += 1 | ||
|
|
||
| update_A!(cache, A, reuse_A_if_factorization) | ||
| b !== nothing && setproperty!(cache.lincache, :b, b) | ||
| linu !== nothing && NonlinearSolveBase.set_lincache_u!(cache, linu) | ||
|
|
||
| linres = solve!(cache.lincache) | ||
| if linres.retcode === ReturnCode.Failure | ||
| return LinearSolveResult(; linres.u, success = false) | ||
|
|
||
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.
This goes in a manual page. Can you make a follow up PR? Just the quick introduction goes here, the docstring with more information on all of the controls needs a manual page.
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.
Yes, will do
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.
#722