cupyx.scipy.sparse.linalg.matrix_power#

cupyx.scipy.sparse.linalg.matrix_power(A, power)[source]#

Raise a square matrix to the integer power power.

For non-negative integers, A**power is computed using repeated matrix multiplications. Negative integers are not supported.

Parameters:
  • A (cupyx.scipy.sparse.spmatrix or cupyx.scipy.sparse.sparray) – Square sparse array or matrix to raise to the power.

  • power (int) – Non-negative integer exponent.

Returns:

A raised to power. For power >= 1 the result has the same shape and class as A (its sparse format may differ). power == 0 returns the identity built by eye_array() – a csr_array (scipy returns a dia_array); like scipy this is an array even when A is a matrix.

Return type:

cupyx.scipy.sparse.spmatrix or cupyx.scipy.sparse.sparray