Skip to content

Commit 11096c1

Browse files
sanderdemeyerlkdvosJutho
authored
Add docs for matrix functions and exponential (#251)
* add docs Add documentation for general matrix functions, specifically for `exponential`. * Update docs/src/user_interface/matrix_functions.md Co-authored-by: Lukas Devos <ldevos98@gmail.com> * separate decompositions and matrix functions * change docs * Update docs/src/user_interface/matrix_functions.md Co-authored-by: Jutho <Jutho@users.noreply.github.com> * Update docs/src/user_interface/matrix_functions.md Co-authored-by: Jutho <Jutho@users.noreply.github.com> --------- Co-authored-by: Lukas Devos <ldevos98@gmail.com> Co-authored-by: Jutho <Jutho@users.noreply.github.com>
1 parent b2da707 commit 11096c1

2 files changed

Lines changed: 46 additions & 2 deletions

File tree

docs/src/user_interface/algorithms.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ DefaultAlgorithm
8080

8181
## Available Algorithm Types
8282

83-
The following high-level algorithm types are available.
83+
There are several high-level algorithm types available.
8484
They all accept an optional `driver` keyword to select the computational backend; see [Driver Selection](@ref sec_driverselection) for details.
8585

86+
The following algorithms for matrix decompositions are available.
87+
8688
| Algorithm | Applicable decompositions | Key keyword arguments |
8789
|:----------|:--------------------------|:----------------------|
8890
| [`Householder`](@ref) | QR, LQ | `positive`, `pivoted`, `blocksize` |
@@ -96,6 +98,14 @@ They all accept an optional `driver` keyword to select the computational backend
9698
| [`PolarViaSVD`](@ref) | polar | positional `svd_alg` argument |
9799
| [`PolarNewton`](@ref) | polar | `maxiter`, `tol` |
98100

101+
The following algorithms for matrix functions are available.
102+
103+
| Algorithm | Applicable matrix functions | Key keyword arguments |
104+
|:----------|:--------------------------|:----------------------|
105+
| [`MatrixFunctionViaLA`](@ref) | exponential | |
106+
| [`MatrixFunctionViaEig`](@ref) | exponential | `eig_alg` |
107+
| [`MatrixFunctionViaEigh`](@ref) | exponential | `eigh_alg` |
108+
99109
For full docstring details on each algorithm type, see the corresponding section in [Decompositions](@ref).
100110

101111
## [Driver Selection](@id sec_driverselection)
Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
```@meta
2+
CurrentModule = MatrixAlgebraKit
3+
CollapsedDocStrings = true
4+
```
5+
16
# Matrix functions
27

3-
Coming soon...
8+
Another class of matrix algebra methods consists of calculating some function of a single input `A`.
9+
In order to streamline these functions, they all follow a similar common code pattern.
10+
For a given function `f`, this consists of the following methods:
11+
12+
```julia
13+
f(A; kwargs...) -> F...
14+
f!(A, [F]; kwargs...) -> F...
15+
```
16+
17+
Here, the input matrix is always the first argument, and optionally the output can be provided as well.
18+
The keywords are algorithm-specific, and can be used to influence the behavior of the algorithms.
19+
For a full description of how to select and configure algorithms, see [Algorithm Selection](@ref sec_algorithmselection).
20+
Importantly, for generic code patterns it is recommended to always use the output `F` explicitly, since some implementations may not be able to reuse the provided memory.
21+
Additionally, the `f!` method typically assumes that it is allowed to destroy the input `A`, and making use of the contents of `A` afterwards should be deemed as undefined behavior.
22+
23+
## Exponential
24+
25+
The [exponential](https://en.wikipedia.org/wiki/Matrix_exponential) of a square matrix `A` is used in many scientific applications, as it arises in the solution of an autonomous linear differential equation.
26+
An implementation for the matrix exponential based on a Padé approximation is available in `LinearAlgebra`, and can be accessed by the algorithm [`MatrixFunctionViaLA`](@ref).
27+
For more generic data types, the exponential can be calculated by first calculating the (hermitian) eigenvalue decomposition, and then computing
28+
the scalar exponential of the diagonal elements.
29+
This strategy is implemented via the algorithms [`MatrixFunctionViaEig`](@ref) and [`MatrixFunctionViaEigh`](@ref), and call `eig_full` and `eigh_full`, respectively.
30+
Additionally, in order to calculate `exp(τ * A)`, the function `exponential` can be called with `(τ, A)`, using the same algorithms as before.
31+
32+
```@docs; canonical=false
33+
exponential
34+
MatrixAlgebraKit.MatrixFunctionViaLA
35+
MatrixAlgebraKit.MatrixFunctionViaEig
36+
MatrixAlgebraKit.MatrixFunctionViaEigh
37+
```

0 commit comments

Comments
 (0)