Skip to content

Commit fb94ad8

Browse files
mtfishmanJutho
andauthored
Improve select_algorithm docstring
Co-authored-by: Jutho <Jutho@users.noreply.github.com>
1 parent 36725dd commit fb94ad8

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

src/algorithms.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,25 @@ function _show_alg(io::IO, alg::Algorithm)
5454
end
5555

5656
@doc """
57-
MatrixAlgebraKit.select_algorithm(f, A, alg=nothing; kwargs...)
57+
MatrixAlgebraKit.select_algorithm(f, A, alg::AbstractAlgorithm)
58+
MatrixAlgebraKit.select_algorithm(f, A, alg::Symbol; kwargs...)
59+
MatrixAlgebraKit.select_algorithm(f, A, alg::Type; kwargs...)
60+
MatrixAlgebraKit.select_algorithm(f, A; kwargs...)
61+
MatrixAlgebraKit.select_algorithm(f, A, (; kwargs...))
5862
5963
Decide on an algorithm to use for implementing the function `f` on inputs of type `A`.
6064
61-
If `alg` is `nothing` (the default value), an algorithm will be selected automatically
62-
with [`MatrixAlgebraKit.default_algorithm`](@ref) and the keyword arguments will be passed
63-
to the algorithm constructor.
65+
If `alg` is an `AbstractAlgorithm` instance, it will be returned as-is.
6466
65-
If `alg` is a `NamedTuple`, an algorithm will be selected automatically
66-
with [`default_algorithm`](@ref) and `alg` will be passed to the algorithm
67-
as keyword arguments. In that case, keyword arguments can't be passed
68-
to `MatrixAlgebraKit.select_algorithm`
67+
If `alg` is a `Symbol` or a `Type` of algorithm, the return value is obtained
68+
by calling the corresponding algorithm constructor;
69+
keyword arguments in `kwargs` are passed along to this constructor.
6970
70-
If `alg` is an `AbstractAlgorithm`, it will be returned as-is. In that case, keyword arguments
71-
can't be passed to `MatrixAlgebraKit.select_algorithm`.
71+
If `alg` is not specified (or `nothing`), an algorithm will be selected
72+
automatically with [`MatrixAlgebraKit.default_algorithm`](@ref) and
73+
the keyword arguments in `kwargs` will be passed to the algorithm constructor.
74+
Finally, the same behavior is obtained when the keyword arguments are
75+
passed as the third positional argument in the form of a `NamedTuple`.
7276
"""
7377
function select_algorithm end
7478

0 commit comments

Comments
 (0)