warp.sparse.bsr_diag#
- warp.sparse.bsr_diag(
- diag=None,
- rows_of_blocks=None,
- cols_of_blocks=None,
- block_type=None,
- device=None,
Create and return a block-diagonal BSR matrix from an given block value or array of block values.
- Parameters:
diag (_MatrixBlockType[Rows, Cols, Scalar] | _ScalarBlockType[Scalar] | Array[_MatrixBlockType[Rows, Cols, Scalar] | _ScalarBlockType[Scalar]] | None) –
Specifies the values for diagonal blocks. Can be one of:
A Warp array of type
A.values.dtype: Each element defines one block of the diagonalA constant value of type
A.values.dtype: This value is assigned to all diagonal blocks
rows_of_blocks (int | None) – If not
None, the new number of rows of blockscols_of_blocks (int | None) – If not
None, the new number of columns of blocksblock_type (_MatrixBlockType[Rows, Cols, Scalar] | _ScalarBlockType[Scalar] | None) – If
diagisNone, block type of the matrix. Otherwise deduced fromdiagdevice – If
diagis not a Warp array, device on which to allocate the matrix. Otherwise deduced fromdiag
- Return type:
BsrMatrix[_MatrixBlockType[Rows, Cols, Scalar] | _ScalarBlockType[Scalar]]
The shape of the matrix will be defined one of the following, in this order:
rows_of_blocksandcols_of_blocks, if provided. If only one is given, the second is assumed equal.The first dimension of
diagifdiagis an array.