Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,18 @@ Packages such as [Memoize.jl](https://github.com/JuliaCollections/Memoize.jl) an
using Memoize
@memoize Dict forward(x, args...; kwargs...) = y, z
```

### Linear solver selection

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:

- [`IterativeLinearSolver`](@ref);
- [`IterativeLeastSquaresSolver`](@ref);
- [`DirectLinearSolver`](@ref).

Keyword arguments can be passed to the constructors of `IterativeLinearSolver` and `IterativeLeastSquaresSolver`, they will be forwarded to the solver that is currently being used.

!!! warning
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`.

Note that for the `DirectLinearSolver`, you must switch to a [`MatrixRepresentation`](@ref) using the `representation` argument : `ImplicitFunction(forward, conditions; linear_solver = DirectLinearSolver(), representation = MatrixRepresentation())`.
10 changes: 10 additions & 0 deletions src/settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ Specify that linear systems `Ax = b` should be solved with a direct method.
!!! warning
Can only be used when the `solver` and the `conditions` both output an `AbstractVector`.

Additionally, this solver requires a [`MatrixRepresentation`](@ref) of the matrix `A`. To do so,
use the `representation` keyword of the [`ImplicitFunction`](@ref) constructor :

f = ImplicitFunction(
forward,
conditions;
solver = DirectLinearSolver(),
representation = MatrixRepresentation()
)

# See also

- [`ImplicitFunction`](@ref)
Expand Down