{ } Raw JSON

bundles / scipy latest / scipy / linalg / _expm_frechet / expm_frechet

function

scipy.linalg._expm_frechet:expm_frechet

source: /scipy/linalg/_expm_frechet.py :10

Signature

def   expm_frechet ( A E method = None compute_expm = True check_finite = True )

Summary

Frechet derivative of the matrix exponential of A in the direction E.

Extended Summary

The documentation is written assuming array arguments are of specified "core" shapes. However, array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details. Note that calls with zero-size batches are unsupported and will raise a ValueError.

Parameters

A : (N, N) array_like

Matrix of which to take the matrix exponential.

E : (N, N) array_like

Matrix direction in which to take the Frechet derivative.

method : str, optional

Choice of algorithm. Should be one of

  • SPS (default)

  • blockEnlarge

compute_expm : bool, optional

Whether to compute also expm_A in addition to expm_frechet_AE. Default is True.

check_finite : bool, optional

Whether to check that the input matrix contains only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs.

Returns

expm_A : ndarray

Matrix exponential of A.

expm_frechet_AE : ndarray

Frechet derivative of the matrix exponential of A in the direction E.

: For ``compute_expm = False``, only `expm_frechet_AE` is returned.

Notes

This section describes the available implementations that can be selected by the method parameter. The default method is SPS.

Method blockEnlarge is a naive algorithm.

Method SPS is Scaling-Pade-Squaring [1]. It is a sophisticated implementation which should take only about 3/8 as much time as the naive implementation. The asymptotics are the same.

Examples

import numpy as np
from scipy import linalg
rng = np.random.default_rng()
A = rng.standard_normal((3, 3))
E = rng.standard_normal((3, 3))
expm_A, expm_frechet_AE = linalg.expm_frechet(A, E)
expm_A.shape, expm_frechet_AE.shape
Create a 6x6 matrix containing [[A, E], [0, A]]:
M = np.zeros((6, 6))
M[:3, :3] = A
M[:3, 3:] = E
M[3:, 3:] = A
expm_M = linalg.expm(M)
np.allclose(expm_A, expm_M[:3, :3])
np.allclose(expm_frechet_AE, expm_M[:3, 3:])

See also

expm

Compute the exponential of a matrix.

Aliases

  • scipy.linalg.expm_frechet