warp.sparse.bsr_set_from_triplets#
- warp.sparse.bsr_set_from_triplets(
- dest,
- rows,
- columns,
- values=None,
- count=None,
- prune_numerical_zeros=True,
- topology=None,
- build_mapping=None,
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[BlockType[Rows, Cols, 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 | BlockType[Rows, Cols, Scalar]] | None) – Block values for each non-zero. Must be contiguous and either a one-dimensional array with data type identical to the
destmatrix’s block type, or a 3d array with data type equal to thedestmatrix’s scalar type. IfNone, 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 ofrowsandcolumnsarrays.prune_numerical_zeros (bool) – If
True, will ignore the zero-valued blocks.topology (Literal['compact', 'masked', 'padded'] | None) – Optional topology policy.
"compact"keeps the existing compact rebuild behavior,"masked"updates only existing non-zero blocks ofdest, and"padded"writes the compacted triplet topology into existing destination row capacity and records capacity overflow indest.status_sync().build_mapping (BsrTripletMap | bool | None) – If
True, build and return a new reusable mapping from the input entries to the compact destination blocks, seeBsrTripletMap. If aBsrTripletMap, rebuild that mapping in place, reusing its storage, and return it. This is only supported fortopology="compact"and requiresprune_numerical_zeros=False.
- Returns:
The built
BsrTripletMapwhenbuild_mappingis provided; otherwiseNone.- Return type:
BsrTripletMap | None