Skip to content

Commit

Permalink
pycodestyle updates
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjasa committed Oct 16, 2023
1 parent 8bdf903 commit fba061d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _add_output_configure(self, name, units, shape, desc='', src=None, rate=Fals
# Extend the data and indices using the CSR attributes of mat
jac_data.extend(mat.data)
jac_indices.extend(mat.indices + s * input_num_nodes)

# For every non-zero row in mat, update jac's indptr
new_indptr = mat.indptr[1:] + s * len(mat.data)
jac_indptr.extend(new_indptr)
Expand All @@ -168,7 +168,8 @@ def _add_output_configure(self, name, units, shape, desc='', src=None, rate=Fals
jac_indptr[-1] = len(jac_data)

# Construct the sparse jac matrix in CSR format
jac = sp.csr_matrix((jac_data, jac_indices, jac_indptr), shape=(output_num_nodes * size, input_num_nodes * size))
jac = sp.csr_matrix((jac_data, jac_indices, jac_indptr),
shape=(output_num_nodes * size, input_num_nodes * size))

# Now, if you want to get the row and column indices of the non-zero entries in the jac matrix:
jac_rows, jac_cols = jac.nonzero()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _add_output_configure(self, name, units, shape, desc='', src=None, rate=Fals
# Extend the data and indices using the CSR attributes of mat
jac_data.extend(mat.data)
jac_indices.extend(mat.indices + s * input_num_nodes)

# For every non-zero row in mat, update jac's indptr
new_indptr = mat.indptr[1:] + s * len(mat.data)
jac_indptr.extend(new_indptr)
Expand All @@ -168,7 +168,8 @@ def _add_output_configure(self, name, units, shape, desc='', src=None, rate=Fals
jac_indptr[-1] = len(jac_data)

# Construct the sparse jac matrix in CSR format
jac = sp.csr_matrix((jac_data, jac_indices, jac_indptr), shape=(output_num_nodes * size, input_num_nodes * size))
jac = sp.csr_matrix((jac_data, jac_indices, jac_indptr),
shape=(output_num_nodes * size, input_num_nodes * size))

# Now, if you want to get the row and column indices of the non-zero entries in the jac matrix:
jac_rows, jac_cols = jac.nonzero()
Expand Down

0 comments on commit fba061d

Please sign in to comment.