Skip to content

Commit 27622e7

Browse files
committed
add documentation
1 parent 58ce874 commit 27622e7

File tree

1 file changed

+89
-1
lines changed

1 file changed

+89
-1
lines changed

docs/src/basics/common_solver_opts.md

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ The following are the options these algorithms take, along with their defaults.
1212
`A` and `b` can be written to and changed by the solver algorithm. When fields are `nothing`
1313
the default behavior is used, which is to default to `true` when the algorithm is known
1414
not to modify the matrices, and false otherwise.
15-
- `verbose`: Whether to print extra information. Defaults to `false`.
1615
- `assumptions`: Sets the assumptions of the operator in order to effect the default
1716
choice algorithm. See the [Operator Assumptions page for more details](@ref assumptions).
1817

@@ -26,3 +25,92 @@ solve completely. Error controls only apply to iterative solvers.
2625
- `maxiters`: The number of iterations allowed. Defaults to `length(prob.b)`
2726
- `Pl,Pr`: The left and right preconditioners, respectively. For more information,
2827
see [the Preconditioners page](@ref prec).
28+
29+
## Verbosity Controls
30+
31+
The verbosity system in LinearSolve.jl provides fine-grained control over the diagnostic messages, warnings, and errors that are displayed during the solution of linear systems.
32+
33+
The verbosity system is organized hierarchically into three main categories:
34+
35+
1. Error Control - Messages related to fallbacks and error handling
36+
2. Performance - Messages related to performance considerations
37+
3. Numerical - Messages related to numerical solvers and iterations
38+
39+
Each category can be configured independently, and individual settings can be adjusted to suit your needs.
40+
41+
### Verbosity Levels
42+
The following verbosity levels are available:
43+
44+
#### Individual Settings
45+
These settings are meant for individual settings within a category. These can also be used to set all of the individual settings in a group to the same value.
46+
- Verbosity.None() - Suppress all messages
47+
- Verbosity.Info() - Show message as log message at info level
48+
- Verbosity.Warn() - Show warnings (default for most settings)
49+
- Verbosity.Error() - Throw errors instead of warnings
50+
- Verbosity.Level(n) - Show messages with a log level setting of n
51+
52+
#### Group Settings
53+
These settings are meant for
54+
- Verbosity.Default() - Use the default settings
55+
- Verbosity.All() - Show all possible messages
56+
57+
### Basic Usage
58+
59+
#### Global Verbosity Control
60+
61+
```julia
62+
using LinearSolve
63+
64+
# Suppress all messages
65+
verbose = LinearVerbosity(Verbosity.None())
66+
prob = LinearProblem(A, b)
67+
sol = solve(prob; verbose=verbose)
68+
69+
# Show all messages
70+
verbose = LinearVerbosity(Verbosity.All())
71+
sol = solve(prob; verbose=verbose)
72+
73+
# Use default settings
74+
verbose = LinearVerbosity(Verbosity.Default())
75+
sol = solve(prob; verbose=verbose)
76+
```
77+
78+
#### Group Level Control
79+
80+
```julia
81+
# Customize by category
82+
verbose = LinearVerbosity(
83+
error_control = Verbosity.Warn(), # Show warnings for error control related issues
84+
performance = Verbosity.None(), # Suppress performance messages
85+
numerical = Verbosity.Info() # Show all numerical related log messages at info level
86+
)
87+
88+
sol = solve(prob; verbose=verbose)
89+
```
90+
91+
#### Fine-grained Control
92+
The constructor for `LinearVerbosity` allows you to set verbosity for each specific message toggle, giving you fine-grained control.
93+
The verbosity settings for the toggles are automatically passed to the group objects.
94+
```julia
95+
# Set specific message types
96+
verbose = LinearVerbosity(
97+
default_lu_fallback = Verbosity.Info(), # Show info when LU fallback is used
98+
KrylovJL_verbosity = Verbosity.Warn(), # Show warnings from KrylovJL
99+
no_right_preconditioning = Verbosity.None(), # Suppress right preconditioning messages
100+
KrylovKit_verbosity = Verbosity.Level(KrylovKit.WARN_LEVEL) # Set KrylovKit verbosity level using KrylovKit's own verbosity levels
101+
)
102+
103+
sol = solve(prob; verbose=verbose)
104+
105+
```
106+
107+
#### Verbosity Levels
108+
##### Error Control Settings
109+
- default_lu_fallback: Controls messages when falling back to LU factorization (default: Warn)
110+
##### Performance Settings
111+
- no_right_preconditioning: Controls messages when right preconditioning is not used (default: Warn)
112+
##### Numerical Settings
113+
- using_IterativeSolvers: Controls messages when using the IterativeSolvers.jl package (default: Warn)
114+
- IterativeSolvers_iterations: Controls messages about iteration counts from IterativeSolvers.jl (default: Warn)
115+
- KrylovKit_verbosity: Controls messages from the KrylovKit.jl package (default: Warn)
116+
- KrylovJL_verbosity: Controls verbosity of the KrylovJL.jl package (default: None)

0 commit comments

Comments
 (0)