Differentiable and numerically stable implementation of the matrix exponential
MIT License
matrix_exp
Two differentiable implementations of the exponential of matrices in Pytorch.
They implement the papers:
expm_taylor.py
:
Computing the matrix exponential with an optimized Taylor polynomial approximation
expm_pade.py
: A New Scaling and Squaring Algorithm for the Matrix Exponential
The Taylor implementation should run faster in GPU, as it does not require of a QR decomposition.
The Taylor implementation supports batches of square matrices of shape (*, n ,n)
.
The Taylor implementation is done entirely in Pytorch.
The Pade implementation requires Scipy. It is itself an adaptation of the implementation of expm
in Scipy.