Computes the n-th power of a square matrix for an integer n.
Computes the n-th power of a square matrix for an integer n.
Supports input of float, double, cfloat and cdouble dtypes. Also supports batches of matrices, and if A is a batch of matrices then the output has the same batch dimensions.
linalg_matrix_power(A, n)
Arguments
A: (Tensor): tensor of shape (*, m, m) where * is zero or more batch dimensions.
n: (int): the exponent.
Details
If n=0, it returns the identity matrix (or batch) of the same shape as A. If n is negative, it returns the inverse of each matrix (if invertible) raised to the power of abs(n).