warp.sparse.bsr_copy#

warp.sparse.bsr_copy(
A,
scalar_type=None,
block_shape=None,
structure_only=False,
topology='compact',
)[source]#

Return a copy of matrix A, possibly changing its scalar type.

Parameters:
  • A (BsrMatrix[BlockType] | _BsrExpression[BlockType]) – Matrix to be copied.

  • scalar_type (Scalar | None) – If provided, the returned matrix will use this scalar type instead of the one from A.

  • block_shape (tuple[int, int] | None) – If provided, the returned matrix will use blocks of this shape instead of the one from A. Both dimensions of block_shape must be either a multiple or an exact divider of the ones from A.

  • structure_only (bool) – If True, only the non-zeros indices are copied, and uninitialized value storage is allocated to accommodate at least src.nnz blocks. If structure_only is False, values are also copied with implicit casting if the two matrices use distinct scalar types.

  • topology (Literal['compact', 'padded']) – Topology policy for the copy. Supported values are "compact", which rebuilds compact storage, and "padded", which preserves row capacity. "masked" is not meaningful for a newly allocated copy; use bsr_assign() with an existing destination matrix when preserving an active destination topology.