cupyx.scipy.sparse.block_array#

cupyx.scipy.sparse.block_array(blocks, *, format=None, dtype=None)[source]#

Build a sparse array from sparse sub-blocks.

This is the array-returning equivalent of bmat(): even when none of the input blocks are sparse arrays the result is still a sparse array.

Parameters:
  • blocks (array_like) – Grid of sparse arrays/matrices with compatible shapes. An entry of None denotes an all-zero block.

  • format (str, optional) – Sparse format of the result (e.g. 'csr'). By default, an appropriate format is chosen.

  • dtype (dtype, optional) – Data type of the output. Defaults to a promotion across input dtypes.

Returns:

Stacked sparse array.

Return type:

cupyx.scipy.sparse.sparray