Converts the matrix values to long data type. If the matrix already uses long data type, the original matrix will be returned. Returns ------- DiagMatrix The matrix with long values Examples -------- >>> indices = torch.tensor([[
(self)
| 408 | return self.to(dtype=torch.int) |
| 409 | |
| 410 | def long(self): |
| 411 | """Converts the matrix values to long data type. If the matrix already |
| 412 | uses long data type, the original matrix will be returned. |
| 413 | |
| 414 | Returns |
| 415 | ------- |
| 416 | DiagMatrix |
| 417 | The matrix with long values |
| 418 | |
| 419 | Examples |
| 420 | -------- |
| 421 | |
| 422 | >>> indices = torch.tensor([[1, 1, 2], [1, 2, 0]]) |
| 423 | >>> A = dglsp.spmatrix(indices, shape=(3, 4)) |
| 424 | >>> A.long() |
| 425 | SparseMatrix(indices=tensor([[1, 1, 2], |
| 426 | [1, 2, 0]]), |
| 427 | values=tensor([1, 1, 1]), |
| 428 | shape=(3, 4), nnz=3) |
| 429 | """ |
| 430 | return self.to(dtype=torch.long) |
| 431 | |
| 432 | def coalesce(self): |
| 433 | """Returns a coalesced sparse matrix. |
no test coverage detected