Skip to content

Commit 37990ec

Browse files
authored
deprecate verbose (#504)
1 parent cf1d256 commit 37990ec

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Roots"
22
uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
3-
version = "2.2.14"
3+
version = "2.3.0"
44

55

66
[deps]

docs/src/reference.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,9 @@ fzeros
325325

326326
## Tracking iterations
327327

328-
It is possible to add the keyword argument `verbose=true` when calling the `find_zero` function to get detailed information about the solution and data from each iteration. To save this data a `Tracks`object may be passed in to `tracks`.
328+
To save this data a `Roots.Tracks`object may be passed in to `tracks` and displayed later.
329+
330+
Passing the keyword argument `verbose=true` is now deprecated when calling the `find_zero` function to get detailed information about the solution and data from each iteration.
329331

330332
----
331333

docs/src/roots.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ longer super-linear. This is the case here, where `Order2` uses $51$
318318
function calls, `Order8` uses $42$, and `Order0` takes $80$. The `Roots.Order2B` method is useful
319319
when a multiplicity is expected; on this problem it takes ``17`` function calls.
320320

321-
To investigate an algorithm and its convergence, the argument
322-
`verbose=true` may be specified. A `Roots.Tracks` object can be used to store the intermediate values.
321+
A `Roots.Tracks` object can be used to store the intermediate values and can be displayed.
322+
323+
It is now deprecated to use the `verbose=true` argument to investigate an algorithm and its convergence.
323324

324325

325326
For some functions, adjusting the default tolerances may be necessary

src/find_zero.jl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Interface to one of several methods for finding zeros of a univariate function,
1818
* `xatol`, `xrtol`: absolute and relative tolerance to decide if `xₙ₊₁ ≈ xₙ`
1919
* `atol`, `rtol`: absolute and relative tolerance to decide if `f(xₙ) ≈ 0`
2020
* `maxiters`: specify the maximum number of iterations the algorithm can take.
21-
* `verbose::Bool`: specifies if details about algorithm should be shown
21+
* `verbose::Bool`: specifies if details about algorithm should be shown [Deprecated; use `tracks`]
2222
* `tracks`: allows specification of `Tracks` objects
2323
2424
# Extended help
@@ -199,7 +199,8 @@ ERROR: Roots.ConvergenceFailed("Algorithm failed to converge")
199199
200200
# Tracing
201201
202-
Passing `verbose=true` will show details on the steps of the algorithm.
202+
Passing `verbose=true` will show details on the steps of the algorithm. [This is deprecated, use `tracks`.]
203+
203204
The `tracks` argument allows
204205
the passing of a [`Roots.Tracks`](@ref) object to record the values of `x` and `f(x)` used in
205206
the algorithm.
@@ -217,6 +218,7 @@ function find_zero(
217218
tracks::AbstractTracks=NullTracks(),
218219
kwargs...,
219220
)
221+
220222
xstar = solve(
221223
ZeroProblem(f, x0),
222224
M,
@@ -295,6 +297,7 @@ function init(
295297
tracks=NullTracks(),
296298
kwargs...,
297299
)
300+
298301
F = Callable_Function(M, 𝑭𝑿.F, something(p′, p, missing))
299302
state = init_state(M, F, 𝑭𝑿.x₀)
300303
options = init_options(M, state; kwargs...)
@@ -354,7 +357,7 @@ The latter calls the following, which can be useful independently:
354357
Returns `NaN`, not an error like `find_zero`, when the problem can not
355358
be solved. Tested for zero allocations.
356359
357-
360+
The `verbose` keyword is deprecated; pass a `Tracks` object to trace the algorithm.
358361
359362
## Examples:
360363
@@ -449,6 +452,14 @@ julia> order0(sin, 3)
449452
function solve!(P::ZeroProblemIterator; verbose=false)
450453
M, F, state, options, l = P.M, P.F, P.state, P.options, P.logger
451454

455+
if verbose !== false
456+
Base.depwarn(
457+
"The `verbose` keyword is deprecated. Pass a `tracks=Roots.Tracks()` object to the solver to see a trace.",
458+
:solve!
459+
)
460+
end
461+
462+
452463
val, stopped = :not_converged, false
453464
ctr = 1
454465
log_step(l, M, state; init=true)
@@ -494,6 +505,7 @@ function solve(
494505
verbose=false,
495506
kwargs...,
496507
)
508+
497509
Z = init(𝑭𝑿, M, p; verbose=verbose, kwargs...)
498510
solve!(Z; verbose=verbose)
499511
end

src/trace.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ implementation details may change without notice.) The methods
4444
`empty!`, to reset the `Tracks` object; `get`, to get the tracks;
4545
`last`, to get the value converted to, may be of interest.
4646
47+
[The following is now deprecated.]
48+
4749
If you only want to print the information, but you don't need it later, this can conveniently be
4850
done by passing `verbose=true` to the root-finding function. This will not
4951
effect the return value, which will still be the root of the function.

0 commit comments

Comments
 (0)