warp.sparse.bsr_set_from_triplets#

warp.sparse.bsr_set_from_triplets(
dest,
rows,
columns,
values=None,
count=None,
prune_numerical_zeros=True,
masked=False,
)[source]#

Fill a BSR matrix with values defined by coordinate-oriented (COO) triplets, discarding existing blocks.

The first dimension of the three input arrays must match and indicates the number of COO triplets.

Parameters:
  • dest (BsrMatrix[_MatrixBlockType[Rows, Cols, Scalar] | _ScalarBlockType[Scalar]]) – Sparse matrix to populate.

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

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

  • values (Array[Scalar | _MatrixBlockType[Rows, Cols, Scalar] | _ScalarBlockType[Scalar]] | None) – 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. If None, the values array of the resulting matrix will be allocated but uninitialized.

  • count (Array[int] | None) – Single-element array indicating the number of triplets. If None, the number of triplets is determined from the shape of rows and columns arrays.

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

  • masked (bool) – If True, ignore blocks that are not existing non-zeros of dest.