Skip to content

Commit b4b2fe0

Browse files
bmxammbouygesgdalle
authored
Supplement documentation to DirectLinearSolver (#202)
* wip * add doc to FAQ * fix IterativeLinearSolver name * Remove backticks * Apply suggestions from code review --------- Co-authored-by: mbouyges <maxime.bouyges@onera.fr> Co-authored-by: Guillaume Dalle <22795598+gdalle@users.noreply.github.com>
1 parent 388d5ff commit b4b2fe0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

docs/src/faq.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,18 @@ Packages such as [Memoize.jl](https://github.com/JuliaCollections/Memoize.jl) an
102102
using Memoize
103103
@memoize Dict forward(x, args...; kwargs...) = y, z
104104
```
105+
106+
### Linear solver selection
107+
108+
Differentiating your implicit function requires to solve a linear system. By default, an iterative solver (see [`IterativeLinearSolver`](@ref)) combined with a matrix-free representation of the jacobian (see [`OperatorRepresentation`](@ref)) is used. You can change the linear solver using the `linear_solver` keyword argument of the `ImplicitFunction` constructor, choosing between:
109+
110+
- [`IterativeLinearSolver`](@ref);
111+
- [`IterativeLeastSquaresSolver`](@ref);
112+
- [`DirectLinearSolver`](@ref).
113+
114+
Keyword arguments can be passed to the constructors of `IterativeLinearSolver` and `IterativeLeastSquaresSolver`, they will be forwarded to the solver that is currently being used.
115+
116+
!!! warning
117+
The specific choice of solver is not part of the public API, and may thus change without a breaking release. If you rely on keyword arguments, please freeze the exact version of ImplicitDifferentiation in your `Project.toml`.
118+
119+
Note that for the `DirectLinearSolver`, you must switch to a [`MatrixRepresentation`](@ref) using the `representation` argument : `ImplicitFunction(forward, conditions; linear_solver = DirectLinearSolver(), representation = MatrixRepresentation())`.

src/settings.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ Specify that linear systems `Ax = b` should be solved with a direct method.
1010
!!! warning
1111
Can only be used when the `solver` and the `conditions` both output an `AbstractVector`.
1212
13+
Additionally, this solver requires a [`MatrixRepresentation`](@ref) of the matrix `A`. To do so,
14+
use the `representation` keyword of the [`ImplicitFunction`](@ref) constructor :
15+
16+
f = ImplicitFunction(
17+
forward,
18+
conditions;
19+
solver = DirectLinearSolver(),
20+
representation = MatrixRepresentation()
21+
)
22+
1323
# See also
1424
1525
- [`ImplicitFunction`](@ref)

0 commit comments

Comments
 (0)