scipy.sparse.dia_array.

trace#

dia_array.trace(offset=0)[source]#

返回稀疏数组/矩阵沿对角线的和。

参数:
offsetint, 可选

要获取哪个对角线,对应于元素 a[i, i+offset]。默认值:0(主对角线)。