r"""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
(self)
| 170 | return self.c_sparse_matrix.csr() |
| 171 | |
| 172 | def csc(self) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: |
| 173 | r"""Returns the compressed sparse column (CSC) representation of the |
| 174 | sparse matrix. |
| 175 | |
| 176 | See `CSC in Wikipedia <https://en.wikipedia.org/wiki/ |
| 177 | Sparse_matrix#Compressed_sparse_column_(CSC_or_CCS)>`_. |
| 178 | |
| 179 | This function also returns value indices as an index tensor, indicating |
| 180 | the order of the values of non-zero elements in the CSC representation. |
| 181 | A ``None`` value indices array indicates the order of the values stays |
| 182 | the same as the values of the SparseMatrix. |
| 183 | |
| 184 | Returns |
| 185 | ------- |
| 186 | torch.Tensor |
| 187 | Column indptr |
| 188 | torch.Tensor |
| 189 | Row indices |
| 190 | torch.Tensor |
| 191 | Value indices |
| 192 | |
| 193 | Examples |
| 194 | -------- |
| 195 | |
| 196 | >>> indices = torch.tensor([[1, 2, 1], [2, 4, 3]]) |
| 197 | >>> A = dglsp.spmatrix(indices) |
| 198 | >>> A.csc() |
| 199 | (tensor([0, 0, 0, 1, 2, 3]), tensor([1, 1, 2]), tensor([0, 2, 1])) |
| 200 | """ |
| 201 | return self.c_sparse_matrix.csc() |
| 202 | |
| 203 | def to_dense(self) -> torch.Tensor: |
| 204 | """Returns a copy in dense matrix format of the sparse matrix. |
no outgoing calls