scipy.sparse.spdiags

scipy.sparse.spdiags(data, diags, m, n, format=None)

Return a sparse matrix from diagonals.

Parameters:

data : array_like

matrix diagonals stored row-wise

diags : diagonals to set

  • k = 0 the main diagonal
  • k > 0 the k-th upper diagonal
  • k < 0 the k-th lower diagonal

m, n : int

shape of the result

format : format of the result (e.g. “csr”)

By default (format=None) an appropriate sparse matrix format is returned. This choice is subject to change.

See also

The

Previous topic

scipy.sparse.lil_diags

Next topic

scipy.sparse.tril

This Page

Quick search