Matrix_exp
Matrix_exp
torch_matrix_exp(self)
self |
(Tensor) the input tensor. |
Returns the matrix exponential. Supports batched input.
For a matrix A
, the matrix exponential is defined as
\exp^A = ∑_{k=0}^∞ A^k / k!.
The implementation is based on: Bader, P.; Blanes, S.; Casas, F. Computing the Matrix Exponential with an Optimized Taylor Polynomial Approximation. Mathematics 2019, 7, 1174.
if (torch_is_installed()) { a <- torch_randn(c(2, 2, 2)) a[1, , ] <- torch_eye(2, 2) a[2, , ] <- 2 * torch_eye(2, 2) a torch_matrix_exp(a) x <- torch_tensor(rbind(c(0, pi/3), c(-pi/3, 0))) x$matrix_exp() # should be [[cos(pi/3), sin(pi/3)], [-sin(pi/3), cos(pi/3)]] }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.