dgl.sparse.DiagMatrix.inv

DiagMatrix.inv()dgl.sparse.diag_matrix.DiagMatrix

Returns the inverse of the diagonal matrix.

This function only supports square matrices with scalar nonzero values.

Returns

Inverse of the diagonal matrix

Return type

DiagMatrix

Examples

>>> val = torch.arange(1, 4).float()
>>> D = dglsp.diag(val)
>>> D = D.inv()
DiagMatrix(val=tensor([1.0000, 0.5000, 0.3333]),
           shape=(3, 3))