dgl.sparse.SparseMatrix.csc

SparseMatrix.csc()Tuple[torch.Tensor, torch.Tensor, torch.Tensor][source]

Returns the compressed sparse column (CSC) representation of the sparse matrix.

See CSC in Wikipedia.

This function also returns value indices as an index tensor, indicating the order of the values of non-zero elements in the CSC representation. A None value indices array indicates the order of the values stays the same as the values of the SparseMatrix.

Returns

  • torch.Tensor – Column indptr

  • torch.Tensor – Row indices

  • torch.Tensor – Value indices

Examples

>>> indices = torch.tensor([[1, 2, 1], [2, 4, 3]])
>>> A = dglsp.spmatrix(indices)
>>> A.csc()
(tensor([0, 0, 0, 1, 2, 3]), tensor([1, 1, 2]), tensor([0, 2, 1]))