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

Fix TrustRegion docstring #193

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/raphson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ mutable struct NewtonRaphsonCache{iip, fType, algType, uType, duType, resType, p
stats::NLStats

function NewtonRaphsonCache{iip}(f::fType, alg::algType, u::uType, fu::resType,
p::pType, uf::ufType, linsolve::L, J::jType, du1::duType,
jac_config::JC, force_stop::Bool, maxiters::Int, internalnorm::INType,
p::pType, uf::ufType, linsolve::L, J::jType,
du1::duType,
jac_config::JC, force_stop::Bool, maxiters::Int,
internalnorm::INType,
retcode::SciMLBase.ReturnCode.T, abstol::tolType,
prob::probType,
stats::NLStats) where {
Expand Down
19 changes: 10 additions & 9 deletions src/trustRegion.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
EnumX.@enumx RadiusUpdateSchemes begin
Simple
Hei
Yuan
Bastin
Fan
end

"""
```julia
TrustRegion(; chunk_size = Val{0}(), autodiff = Val{true}(),
Expand Down Expand Up @@ -80,14 +88,6 @@ for large-scale and numerically-difficult nonlinear systems.
Currently, the linear solver and chunk size choice only applies to in-place defined
`NonlinearProblem`s. That is expected to change in the future.
"""
EnumX.@enumx RadiusUpdateSchemes begin
Simple
Hei
Yuan
Bastin
Fan
end

struct TrustRegion{CS, AD, FDT, L, P, ST, CJ, MTR} <:
AbstractNewtonAlgorithm{CS, AD, FDT, ST, CJ}
linsolve::L
Expand Down Expand Up @@ -197,7 +197,8 @@ mutable struct TrustRegionCache{iip, fType, algType, uType, resType, pType,
suType, su2Type, tmpType}
new{iip, fType, algType, uType, resType, pType,
INType, tolType, probType, ufType, L, jType, JC, floatType,
trustType, suType, su2Type, tmpType}(f, alg, u_prev, u, fu_prev, fu, p, uf, linsolve, J,
trustType, suType, su2Type, tmpType}(f, alg, u_prev, u, fu_prev, fu, p, uf,
linsolve, J,
jac_config, force_stop,
maxiters, internalnorm, retcode,
abstol, prob, radius_update_scheme,
Expand Down
6 changes: 3 additions & 3 deletions test/basictests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ end
g = function (p)
probN = NonlinearProblem{false}(f, csu0, p)
sol = solve(probN, TrustRegion(radius_update_scheme = RadiusUpdateSchemes.Bastin),
abstol = 1e-9)
abstol = 1e-9)
return sol.u[end]
end

Expand Down Expand Up @@ -358,7 +358,7 @@ end
g = function (p)
probN = NonlinearProblem{false}(f, oftype(p, u0), p)
sol = solve(probN, TrustRegion(radius_update_scheme = RadiusUpdateSchemes.Bastin),
abstol = 1e-10)
abstol = 1e-10)
return sol.u
end

Expand Down Expand Up @@ -516,7 +516,7 @@ f(u, p)
g = function (p)
probN = NonlinearProblem{false}(f, u0, p)
sol = solve(probN, TrustRegion(radius_update_scheme = RadiusUpdateSchemes.Bastin),
abstol = 1e-10)
abstol = 1e-10)
return sol.u
end
p = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Expand Down