MCPcopy
hub / github.com/dmlc/dgl / csc

Method csc

python/dgl/sparse/sparse_matrix.py:172–201  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 13

to_torch_sparse_cscFunction · 0.80
test_from_cscFunction · 0.80
test_coo_to_cscFunction · 0.80
test_csr_to_cscFunction · 0.80
test_diag_conversionsFunction · 0.80
test_val_likeFunction · 0.80
test_has_duplicateFunction · 0.80

Calls

no outgoing calls

Tested by 11

test_from_cscFunction · 0.64
test_coo_to_cscFunction · 0.64
test_csr_to_cscFunction · 0.64
test_diag_conversionsFunction · 0.64
test_val_likeFunction · 0.64
test_has_duplicateFunction · 0.64