Skip to content

Cleaned up sparse solvers code #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 29, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix some type errors.
  • Loading branch information
luisenp committed Nov 29, 2022
commit 546d68b2cf653c3df035d8f600820418b24bd81d
5 changes: 3 additions & 2 deletions theseus/optimizer/linear_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import abc

import numpy as np
import torch
from scipy.sparse import csc_matrix, csr_matrix


Expand All @@ -24,14 +25,14 @@ def __init__(
self.num_cols = num_cols
self.dtype = dtype

def csr_straight(self, val: np.ndarray) -> csr_matrix:
def csr_straight(self, val: torch.Tensor) -> csr_matrix:
return csr_matrix(
(val, self.col_ind, self.row_ptr),
(self.num_rows, self.num_cols),
dtype=self.dtype,
)

def csc_transpose(self, val: np.ndarray) -> csc_matrix:
def csc_transpose(self, val: torch.Tensor) -> csc_matrix:
return csc_matrix(
(val, self.col_ind, self.row_ptr),
(self.num_cols, self.num_rows),
Expand Down