Skip to content

Commit dc539b9

Browse files
committed
Propagate the verbose kwarg
1 parent bcb98c5 commit dc539b9

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

src/NonlinearSolve.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ include("default.jl")
136136

137137
@compile_workload begin
138138
for prob in probs_nls, alg in nls_algs
139-
solve(prob, alg; abstol = 1e-2)
139+
solve(prob, alg; abstol = 1e-2, verbose = false)
140140
end
141141
for prob in probs_nlls, alg in nlls_algs
142-
solve(prob, alg; abstol = 1e-2)
142+
solve(prob, alg; abstol = 1e-2, verbose = false)
143143
end
144144
end
145145
end

src/core/approximate_jacobian.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ end
114114
retcode::ReturnCode.T
115115
force_stop::Bool
116116
force_reinit::Bool
117+
kwargs
117118
end
118119

119120
store_inverse_jacobian(::ApproximateJacobianSolveCache{INV}) where {INV} = INV
@@ -214,7 +215,7 @@ function SciMLBase.__init(
214215
descent_cache, linesearch_cache, trustregion_cache,
215216
update_rule_cache, reinit_rule_cache, inv_workspace, 0, 0, 0,
216217
alg.max_resets, maxiters, maxtime, alg.max_shrink_times, 0, timer,
217-
0.0, termination_cache, trace, ReturnCode.Default, false, false)
218+
0.0, termination_cache, trace, ReturnCode.Default, false, false, kwargs)
218219
end
219220
end
220221

@@ -284,10 +285,10 @@ function __step!(cache::ApproximateJacobianSolveCache{INV, GB, iip};
284285
hasfield(typeof(cache.trustregion_cache), :trust_region)
285286
descent_result = __internal_solve!(
286287
cache.descent_cache, J, cache.fu, cache.u; new_jacobian,
287-
trust_region = cache.trustregion_cache.trust_region)
288+
trust_region = cache.trustregion_cache.trust_region, cache.kwargs...)
288289
else
289290
descent_result = __internal_solve!(
290-
cache.descent_cache, J, cache.fu, cache.u; new_jacobian)
291+
cache.descent_cache, J, cache.fu, cache.u; new_jacobian, cache.kwargs...)
291292
end
292293
end
293294
δu, descent_intermediates = descent_result.δu, descent_result.extras

src/core/generalized_first_order.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ concrete_jac(::GeneralizedFirstOrderAlgorithm{CJ}) where {CJ} = CJ
111111
trace
112112
retcode::ReturnCode.T
113113
force_stop::Bool
114+
kwargs
114115
end
115116

116117
SymbolicIndexingInterface.state_values(cache::GeneralizedFirstOrderAlgorithmCache) = cache.u
@@ -202,7 +203,7 @@ function SciMLBase.__init(
202203
return GeneralizedFirstOrderAlgorithmCache{iip, GB, maxtime !== nothing}(
203204
fu, u, u_cache, p, du, J, alg, prob, jac_cache, descent_cache, linesearch_cache,
204205
trustregion_cache, 0, 0, maxiters, maxtime, alg.max_shrink_times,
205-
timer, 0.0, true, termination_cache, trace, ReturnCode.Default, false)
206+
timer, 0.0, true, termination_cache, trace, ReturnCode.Default, false, kwargs)
206207
end
207208
end
208209

@@ -223,10 +224,10 @@ function __step!(cache::GeneralizedFirstOrderAlgorithmCache{iip, GB};
223224
hasfield(typeof(cache.trustregion_cache), :trust_region)
224225
descent_result = __internal_solve!(
225226
cache.descent_cache, J, cache.fu, cache.u; new_jacobian,
226-
trust_region = cache.trustregion_cache.trust_region)
227+
trust_region = cache.trustregion_cache.trust_region, cache.kwargs...)
227228
else
228229
descent_result = __internal_solve!(
229-
cache.descent_cache, J, cache.fu, cache.u; new_jacobian)
230+
cache.descent_cache, J, cache.fu, cache.u; new_jacobian, cache.kwargs...)
230231
end
231232
end
232233
δu, descent_intermediates = descent_result.δu, descent_result.extras

src/core/spectral_methods.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ concrete_jac(::GeneralizedDFSane) = nothing
7474
trace
7575
retcode::ReturnCode.T
7676
force_stop::Bool
77+
kwargs
7778
end
7879

7980
function __reinit_internal!(
@@ -150,7 +151,7 @@ function SciMLBase.__init(prob::AbstractNonlinearProblem, alg::GeneralizedDFSane
150151
return GeneralizedDFSaneCache{isinplace(prob), maxtime !== nothing}(
151152
fu, fu_cache, u, u_cache, prob.p, du, alg, prob, σ_n, T(alg.σ_min),
152153
T(alg.σ_max), linesearch_cache, 0, 0, maxiters, maxtime,
153-
timer, 0.0, tc_cache, trace, ReturnCode.Default, false)
154+
timer, 0.0, tc_cache, trace, ReturnCode.Default, false, kwargs)
154155
end
155156
end
156157

src/internal/linear_solve.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ end
125125
# Use LinearSolve.jl
126126
function (cache::LinearSolverCache)(;
127127
A = nothing, b = nothing, linu = nothing, du = nothing, p = nothing,
128-
weight = nothing, cachedata = nothing, reuse_A_if_factorization = false, kwargs...)
128+
weight = nothing, cachedata = nothing, reuse_A_if_factorization = false,
129+
verbose = true, kwargs...)
129130
cache.nsolve += 1
130131

131132
__update_A!(cache, A, reuse_A_if_factorization)
@@ -164,8 +165,10 @@ function (cache::LinearSolverCache)(;
164165
# TODO: We need to guard this somehow because this will surely fail if A is on GPU
165166
# TODO: or some fancy Matrix type
166167
if !(cache.linsolve isa QRFactorization{ColumnNorm})
167-
@warn "Potential Rank Deficient Matrix Detected. Attempting to solve using \
168-
Pivoted QR Factorization."
168+
if verbose
169+
@warn "Potential Rank Deficient Matrix Detected. Attempting to solve using \
170+
Pivoted QR Factorization."
171+
end
169172
@assert (A !== nothing)&&(b !== nothing) "This case is not yet supported. \
170173
Please open an issue at \
171174
https://github.com/SciML/NonlinearSolve.jl"

0 commit comments

Comments
 (0)