Skip to content

Commit 3cd445d

Browse files
committed
Restore stats
1 parent 9bb1d69 commit 3cd445d

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

docs/src/basics/solve.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ solve(prob::SciMLBase.NonlinearProblem, args...; kwargs...)
88

99
- `alias_u0::Bool`: Whether to alias the initial condition or use a copy.
1010
Defaults to `false`.
11-
- `internal_norm::Function`: The norm used by the solver. Default depends on algorithm
11+
- `internalnorm::Function`: The norm used by the solver. Default depends on algorithm
1212
choice.
1313

1414
## Iteration Controls
1515

1616
- `maxiters::Int`: The maximum number of iterations to perform. Defaults to `1000`.
17+
- `maxtime`: The maximum time for solving the nonlinear system of equations. Defaults to `Inf`.
1718
- `abstol::Number`: The absolute tolerance. Defaults to `real(oneunit(T)) * (eps(real(one(T))))^(4 // 5)`.
1819
- `reltol::Number`: The relative tolerance. Defaults to `real(oneunit(T)) * (eps(real(one(T))))^(4 // 5)`.
1920
- `termination_condition`: Termination Condition from DiffEqBase. Defaults to

src/core/generalized_first_order.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function SciMLBase.__init(prob::AbstractNonlinearProblem{uType, iip},
132132
end
133133
end
134134

135-
function SciMLBase.step!(cache::GeneralizedFirstOrderAlgorithmCache{iip, GB};
135+
function __step!(cache::GeneralizedFirstOrderAlgorithmCache{iip, GB};
136136
recompute_jacobian::Union{Nothing, Bool} = nothing, kwargs...) where {iip, GB}
137137
@timeit_debug cache.timer "jacobian" begin
138138
if (recompute_jacobian === nothing || recompute_jacobian) && cache.make_new_jacobian

src/core/generic.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ function SciMLBase.solve!(cache::AbstractNonlinearSolveCache)
2828
# nothing, nothing; last = Val(true))
2929
# end
3030

31+
stats = SciMLBase.NLStats(get_nf(cache), get_njacs(cache), get_nfactors(cache),
32+
get_nsolve(cache), get_nsteps(cache))
33+
3134
return SciMLBase.build_solution(cache.prob, cache.alg, get_u(cache), get_fu(cache);
32-
cache.retcode)
35+
cache.retcode, stats)
3336

3437
# return SciMLBase.build_solution(cache.prob, cache.alg, get_u(cache), get_fu(cache);
3538
# cache.retcode, cache.stats, trace)

src/core/spectral_methods.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function SciMLBase.__init(prob::AbstractNonlinearProblem, alg::GeneralizedDFSane
7575
end
7676
end
7777

78-
function SciMLBase.step!(cache::GeneralizedDFSaneCache{iip};
78+
function __step!(cache::GeneralizedDFSaneCache{iip};
7979
recompute_jacobian::Union{Nothing, Bool} = nothing, kwargs...) where {iip}
8080
if recompute_jacobian !== nothing
8181
@warn "GeneralizedDFSane is a Jacobian-Free Algorithm. Ignoring \

src/internal/helpers.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ function __construct_extension_jac(prob, alg, u0, fu; can_handle_oop::Val = Fals
203203
end
204204

205205
# Query Statistics
206-
# TODO: Deal with the total time in a dedicated way
207-
for stat in (:nsolve, :nfactors, :nsteps, :njacs, :nf) # , :total_time)
206+
for stat in (:nsolve, :nfactors, :nsteps, :njacs, :nf)
208207
fname = Symbol("get_$(stat)")
209208
@eval @inline $(fname)(cache) = __query_stat(cache, $(Val(stat)))
210209
end
@@ -216,7 +215,7 @@ end
216215
end
217216

218217
@inline __get_data(x::Number) = x
219-
@inline __get_data(x::Base.RefValue{<:Int}) = x
218+
@inline __get_data(x::Base.RefValue{Int}) = x[]
220219

221220
# Auto-generate some of the helper functions
222221
macro internal_caches(cType, internal_cache_names...)

src/internal/linear_solve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ end
9494

9595
@inline __update_A!(cache::LinearSolverCache, ::Nothing, reuse) = cache
9696
@inline function __update_A!(cache::LinearSolverCache, A, reuse)
97-
return __update_A!(cache, __getproperty(cache.linsolve, Val(:alg)), A, reuse)
97+
return __update_A!(cache, __getproperty(cache.lincache, Val(:alg)), A, reuse)
9898
end
9999
@inline function __update_A!(cache, alg, A, reuse)
100100
# Not a Factorization Algorithm so don't update `nfactors`

0 commit comments

Comments
 (0)