diags (diagonals, offsets = 0, shape = None, format = None, dtype = None): From the diagonal structure sparse matrix.
Parameters
diagonals diagonal: determinant sequence
comprising a sequence matrix diagonal array, corresponding to an "offset."
offsets Offset: int int sequence or, alternatively
: to set the diagonal
-k main diagonal = 0 (default)
the diagonal on the k-th 0 -k>
<0 at k-th -k diagonal
shape: int tuples, optionally (python tuple similar array, the contents can not be changed)
the shape of the shape. If omitted, it returns a diagonal square matrix.
format FORMAT: { "dia", "csr ", "csc", "lil", ...}, an optional
result of the matrix format. By default (format = None) return the appropriate sparse matrix format. This choice may change at any time.
dtype Data Type: data type Optional data type matrix.
spmatrix.tocoo (self, copy = False): This matrix is converted into a coordinate format.
When copy = False, the data / index may be shared between the matrix and the matrix generated coo_.