bundles / scipy latest / scipy / linalg / _matfuncs / expm
function
scipy.linalg._matfuncs:expm
source: /scipy/linalg/_matfuncs.py :234
Signature
def expm ( A ) Summary
Compute the matrix exponential of an array.
Extended Summary
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.
Parameters
A: ndarrayInput with last two dimensions are square
(..., n, n).
Returns
eA: ndarrayThe resulting matrix exponential with the same shape of
A
Notes
Implements the algorithm given in [1], which is essentially a Pade approximation with a variable order that is decided based on the array data.
For input with size n, the memory usage is in the worst case in the order of 8*(n**2). If the input data is not of single and double precision of real and complex dtypes, it is copied to a new array.
For cases n >= 400, the exact 1-norm computation cost, breaks even with 1-norm estimation and from that point on the estimation scheme given in [2] is used to decide on the approximation order.
Examples
import numpy as np from scipy.linalg import expm, sinm, cosm✓
expm(np.zeros((3, 2, 2)))
✓a = np.array([[1.0, 2.0], [-1.0, 3.0]])
✓expm(1j*a) cosm(a) + 1j*sinm(a)✗
Aliases
-
scipy.linalg.expm