scipy.sparse.coo_matrix.setdiag

coo_matrix.setdiag(values, k=0)

Fills the diagonal elements {a_ii} with the values from the given sequence. If k != 0, fills the off-diagonal elements {a_{i,i+k}} instead.

values may have any length. If the diagonal is longer than values, then the remaining diagonal entries will not be set. If values if longer than the diagonal, then the remaining values are ignored.

Previous topic

scipy.sparse.coo_matrix.set_shape

Next topic

scipy.sparse.coo_matrix.sum

This Page