cupynumeric.linalg.matrix_power#
- cupynumeric.linalg.matrix_power( ) 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. Ifn < 0
, the inverse is computed and then raised to theabs(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
See also
- Availability:
Multiple GPUs, Multiple CPUs