scipy.sparse.dok_array.trace# dok_array.trace(offset=0)[source]# Returns the sum along diagonals of the sparse matrix. Parameters: offsetint, optionalWhich diagonal to get, corresponding to elements a[i, i+offset]. Default: 0 (the main diagonal).