class_docstr: Class for sparse matrix.
class_docstr_tok: ["Class","for","sparse","matrix","."]
docstr: Returns a coalesced sparse matrix.
  
  A coalesced sparse matrix satisfies the following properties:
  
    - the indices of the non-zero elements are unique,
    - the indices are sorted in lexicographical order.
  
  The coalescing process will accumulate the non-zero elements of the same
  indices by summation.
  
  The function does not support autograd.
  
  Returns
  -------
  SparseMatrix
      The coalesced sparse matrix
  
  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.coalesce()
  SparseMatrix(indices=tensor([[0, 0, 1, 1],
                               [1, 2, 1, 2]]),
               values=tensor([3, 3, 0, 4]),
               shape=(2, 3), nnz=4)
docstr_tok: ["Returns","a","coalesced","sparse","matrix",".","A","coalesced","sparse","matrix","satisfies","the","following","properties",":","-","the","indices","of","the","non-zero","elements","are","unique",",","-","the","indices","are","sorted","in","lexicographical","order",".","The","coalescing","process","will","accumulate","the","non-zero","elements","of","the","same","indices","by","summation",".","The","function","does","not","support","autograd",".","Returns","--","--","--","-","SparseMatrix","The","coalesced","sparse","matrix","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.coalesce","(",")","SparseMatrix","(","indices=tensor","(","[","[","0",",","0",",","1",",","1","]",",","[","1",",","2",",","1",",","2","]","]",")",",","values=tensor","(","[","3",",","3",",","0",",","4","]",")",",","shape=","(","2",",","3",")",",","nnz=4",")"]
code: def coalesce(self):
      """Returns a coalesced sparse matrix.
  
      A coalesced sparse matrix satisfies the following properties:
  
        - the indices of the non-zero elements are unique,
        - the indices are sorted in lexicographical order.
  
      The coalescing process will accumulate the non-zero elements of the same
      indices by summation.
  
      The function does not support autograd.
  
      Returns
      -------
      SparseMatrix
          The coalesced sparse matrix
  
      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.coalesce()
      SparseMatrix(indices=tensor([[0, 0, 1, 1],
                                   [1, 2, 1, 2]]),
                   values=tensor([3, 3, 0, 4]),
                   shape=(2, 3), nnz=4)
      """
      return SparseMatrix(self.c_sparse_matrix.coalesce())
  
imports: from typing import Optional, Tuple
  import torch
label_desc: Use image node_id 25 for calling the SparseMatrix obj's underlying member method code with example usage: obj.coalesce() and returns: SparseMatrix