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

Method has_duplicate

python/dgl/sparse/sparse_matrix.py:463–476  ·  view source on GitHub ↗

Returns ``True`` if the sparse matrix contains duplicate indices. Examples -------- >>> indices = torch.tensor([[1, 0, 0, 0, 1], [1, 1, 1, 2, 2]]) >>> val = torch.tensor([0, 1, 2, 3, 4]) >>> A = dglsp.spmatrix(indices, val) >>> A.has_duplicate()

(self)

Source from the content-addressed store, hash-verified

461 return SparseMatrix(self.c_sparse_matrix.coalesce())
462
463 def has_duplicate(self):
464 """Returns ``True`` if the sparse matrix contains duplicate indices.
465
466 Examples
467 --------
468 >>> indices = torch.tensor([[1, 0, 0, 0, 1], [1, 1, 1, 2, 2]])
469 >>> val = torch.tensor([0, 1, 2, 3, 4])
470 >>> A = dglsp.spmatrix(indices, val)
471 >>> A.has_duplicate()
472 True
473 >>> A.coalesce().has_duplicate()
474 False
475 """
476 return self.c_sparse_matrix.has_duplicate()
477
478 def is_diag(self):
479 """Returns whether the sparse matrix is a diagonal matrix."""

Callers 6

test_spspmulFunction · 0.80
test_spspdivFunction · 0.80
test_coalesceFunction · 0.80
test_has_duplicateFunction · 0.80
test_sample_rowwiseFunction · 0.80
test_sample_columnwiseFunction · 0.80

Calls

no outgoing calls

Tested by 6

test_spspmulFunction · 0.64
test_spspdivFunction · 0.64
test_coalesceFunction · 0.64
test_has_duplicateFunction · 0.64
test_sample_rowwiseFunction · 0.64
test_sample_columnwiseFunction · 0.64