scipy.sparse.csr_matrix.

power#

csr_matrix.power(n, dtype=None)[source]#

此函數執行逐元素 (element-wise) 的次方運算。

參數:
n純量

n 是一個非零純量 (非零避免建立密集矩陣)。如果需要零次方,請特殊處理以使用 np.ones

dtype如果未指定 dtype,將保留目前的 dtype。
引發:
NotImplementedError如果 n 是零純量

如果需要零次方,請特殊處理以使用 np.ones(A.shape, dtype=A.dtype)