ExponentialAction.ExponentialAction
— ModuleExponentialAction.jl
implements the action of the Matrix exponential.
For details, see the docstring of expv
.
Exports
expv
: compute the action of the matrix exponential
ExponentialAction.expv
— Methodexpv(t, A, B; shift=true, tol)
Compute $\exp(tA)B$ without computing $tA$ or the matrix exponential $\exp(tA)$.
Computing the action of the matrix exponential is significantly faster than computing the matrix exponential and then multiplying it when the second dimension of $B$ is much smaller than the first one. The "time" $t$ may be real or complex.
In short, the approach computes
\[F = T_m(tA / s)^s B,\]
where $T_m(X)$ is the Taylor series of $\exp(X)$ truncated to degree $m = m^*$. The term $s$ determines how many times the Taylor series acts on $B$. $m^*$ and $s$ are chosen to minimize the number of matrix products needed while maintaining the required tolerance tol
.
The algorithm is described in detail in Algorithm 3.2 in [AlMohyHigham2011].
Keywords
shift=true
: Expand the Taylor series about the $n \times n$ matrix $A-μI=0$ instead of $A=0$, where $μ = \operatorname{tr}(A) / n$ to speed up convergence. See §3.1 of [AlMohyHigham2011].tol
: The relative tolerance at which to compute the result. Defaults to the tolerance of the eltype of the result.
ExponentialAction.expv_sequence
— Methodexpv_sequence(t::AbstractVector, A, B; kwargs...)
Compute $\exp(t_i A)B$ for the (sorted) sequence of (real) time points $t=(t_1, t_2, \ldots)$.
At each time point, the result $F_i$ is computed as
\[F_i = \exp\left((t_i - t_{i-1}) A\right) F_{i - 1}\]
using expv
, where $t_0 = 0$ and $F_0 = B$. For details, see Equation 5.2 of [AlMohyHigham2011].
Because the cost of computing expv
is related to the operator 1-norm of $t_i A$, this incremental computation is more efficient than computing expv
separately for each time point.
See expv
for a description of acceptable kwargs
.
expv_sequence(t::AbstractRange, A, B; kwargs...)
Compute expv
over the uniformly spaced sequence.
This algorithm takes special care to avoid overscaling and to save and reuse matrix products and is described in Algorithm 5.2 of [AlMohyHigham2011].
ExponentialAction.expv_taylor
— Methodexpv_taylor(t, A, B, degree_max; tol)
Compute $\exp(tA)B$ using the truncated Taylor series with degree $m=$ degree_max
.
Instead of computing the Taylor series $T_m(tA)$ of the matrix exponential directly, its action on $B$ is computed instead.
The series is truncated early if
\[\frac{\lVert \exp(t A) B - T_m(tA) B \rVert_1}{\lVert T_m(tA) B \rVert_1} \le \mathrm{tol},\]
where $\lVert X \rVert_1$ is the operator 1-norm of the matrix $X$. This condition is only approximately checked.
ExponentialAction.expv_taylor_cache
— Methodexpv_taylor_cache(t, A, B, degree_max, k, Z; tol)
Compute $\exp(tkA)B$ using the truncated Taylor series with degree $m=$ degree_max
.
This method stores all matrix products in a cache Z
, where $Z_p = \frac{1}{(p-1)!} (t A)^{p-1} B$. This cache can be reused if $k$ changes but $t$, $A$, and $B$ are unchanged.
Z
is a vector of arrays of the same shape as B
and is not mutated; instead the (possibly updated) cache is returned.
Returns
F::AbstractMatrix
: The action of the truncated Taylor seriesZ::AbstractVector
: The cache of matrix products of the same shape asF
. If the cache is updated, then this is a different object than the inputZ
.
See expv_taylor
.
ExponentialAction.parameters
— Methodparameters(t, A, ncols_B; kwargs...) -> (degree_opt, scale)
Compute Taylor series parameters needed for $\exp(tA)B$.
This is Code Fragment 3.1 from [AlMohyHigham2011].
Keywords
tol
: the desired relative tolerancedegree_max=55
: the maximum degree of the truncated Taylor series that will be used. This is $m_{\mathrm{max}}$ in [AlMohyHigham2011], where they recommend a value of 55 in §3.ℓ=2
: the number of columns in the matrix that is multiplied for norm estimation (note: currently only used for control flow.). Recommended values are 1 or 2.
Returns
degree_opt
: the degree of the truncated Taylor series that will be used. This is $m^*$ in [AlMohyHigham2011],scale
: the amount of scaling $s$ that will be applied to $A$. The truncated Taylor series of $\exp(t A / s)$ will be applied $s$ times to $B$.
- AlMohyHigham2011Al-Mohy, Awad H. and Higham, Nicholas J. (2011) Computing the Action of the Matrix Exponential, with an Application to Exponential Integrators. SIAM Journal on Scientific Computing, 33 (2). pp. 488-511. ISSN 1064-8275 doi: 10.1137/100788860 eprint: eprints.maths.manchester.ac.uk/id/eprint/1591
- AlMohyHigham2011Al-Mohy, Awad H. and Higham, Nicholas J. (2011) Computing the Action of the Matrix Exponential, with an Application to Exponential Integrators. SIAM Journal on Scientific Computing, 33 (2). pp. 488-511. ISSN 1064-8275 doi: 10.1137/100788860 eprint: eprints.maths.manchester.ac.uk/id/eprint/1591