warp.sparse.bsr_from_triplets#

warp.sparse.bsr_from_triplets(
rows_of_blocks,
cols_of_blocks,
rows,
columns,
values,
prune_numerical_zeros=True,
)[source]#

Construct a BSR matrix with values defined by coordinate-oriented (COO) triplets.

The first dimension of the three input arrays must match and indicates the number of COO triplets. This convenience constructor always builds compact storage. To build into reserved row capacity, allocate with bsr_zeros() using row_capacity and then call bsr_set_from_triplets() with topology="padded".

Parameters:
  • rows_of_blocks (int) – Number of rows of blocks.

  • cols_of_blocks (int) – Number of columns of blocks.

  • rows (Array[int]) – Row index for each non-zero.

  • columns (Array[int]) – Columns index for each non-zero.

  • values (Array[Scalar | BlockType[Rows, Cols, Scalar]]) – Block values for each non-zero. Must be either a one-dimensional array with data type identical to the dest matrix’s block type, or a 3d array with data type equal to the dest matrix’s scalar type.

  • prune_numerical_zeros (bool) – If True, will ignore the zero-valued blocks.