cupyx.scipy.sparse.block_diag#

cupyx.scipy.sparse.block_diag(mats, format=None, dtype=None)[source]#

Build a block-diagonal sparse object from a sequence of blocks.

Parameters:
  • mats (sequence) – Input sparse arrays/matrices, dense ndarrays, scalars, or Python lists/tuples. Each block becomes a diagonal sub-block in the output.

  • format (str, optional) – Sparse format of the result. Defaults to 'coo' when not specified.

  • dtype (dtype, optional) – Data type of the output.

Returns:

Sparse array if any input is a sparse array, else sparse matrix (matching scipy).

Return type:

cupyx.scipy.sparse