warp.sparse.bsr_set_diag#
- warp.sparse.bsr_set_diag(A, diag, rows_of_blocks=None, cols_of_blocks=None)[source]#
Set
Aas a block-diagonal matrix.- Parameters:
A (BsrMatrix[_MatrixBlockType[Rows, Cols, Scalar] | _ScalarBlockType[Scalar]]) – The sparse matrix to modify.
diag (_MatrixBlockType[Rows, Cols, Scalar] | _ScalarBlockType[Scalar] | Array[_MatrixBlockType[Rows, Cols, Scalar] | _ScalarBlockType[Scalar]]) –
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 blocksNone: Diagonal block values are left uninitialized
rows_of_blocks (int | None) – If not
None, the new number of rows of blocks.cols_of_blocks (int | None) – If not
None, the new number of columns of blocks.
- Return type:
None
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
diag, ifdiagis an arrayThe current dimensions of
Aotherwise