Skip to content

Commit

Permalink
Merge commit '5fa534a'
Browse files Browse the repository at this point in the history
  • Loading branch information
duembgen committed Jan 11, 2024
2 parents eb471e1 + 5fa534a commit abdd3cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ __pycache__/

*.ipynb
*.egg-info/
.coverage
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
""" Usage example for PolyMatrix class. """
""" Usage example for PolyMatrix class. """

from poly_matrix import PolyMatrix
import numpy as np
Expand Down
10 changes: 6 additions & 4 deletions poly_matrix/poly_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,12 @@ def get_matrix_sparse(self, variables=None, output_type="coo", verbose=False):
), f"Variable size does not match input matrix size, variables: {(variable_dict['i'][key_i], variable_dict['j'][key_j])}, matrix: {values.shape}"
# generate list of indices for sparse mat input
rows, cols = np.nonzero(values)

i_list += list(rows + indices_i[key_i])
j_list += list(cols + indices_j[key_j])
data_list += list(values[rows, cols])
i_list = np.append(i_list, rows + indices_i[key_i])
j_list = np.append(j_list, cols + indices_j[key_j])
data_list = np.append(data_list, values[rows,cols])

if verbose:
print(f"Filling took {time.time() - t1:.2}s.")

shape = get_shape(variable_dict["i"], variable_dict["j"])

Expand Down

0 comments on commit abdd3cb

Please sign in to comment.