cunumeric.linalg.matrix_power#

cunumeric.linalg.matrix_power(a: ndarray, n: int) ndarray#

Raise a square matrix to the (integer) power n. For positive integers n, the power is computed by repeated matrix squarings and matrix multiplications. If n == 0, the identity matrix of the same shape as M is returned. If n < 0, the inverse is computed and then raised to the abs(n).

Parameters:
  • a ((..., M, M) array_like) – Matrix to be “powered”.

  • n (int) – The exponent can be any integer, positive, negative, or zero.

Returns:

a**n – The return value is the same shape and type as M; if the exponent is positive or zero then the type of the elements is the same as those of M. If the exponent is negative the elements are floating-point.

Return type:

(…, M, M) ndarray

Availability:

Multiple GPUs, Multiple CPUs