Skip to content

Commit

Permalink
Update operators.py
Browse files Browse the repository at this point in the history
  • Loading branch information
loganbvh committed Oct 2, 2023
1 parent 57c4a6f commit 0aa706e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tdgl/finite_volume/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ def _spmatrix_set_many(spmatrix, i, j, x):
i, j = spmatrix._swap(i, j)
offsets, (i, j, M, N) = _get_spmatrix_offsets_cupy(spmatrix, i, j)

Check warning on line 42 in tdgl/finite_volume/operators.py

View check run for this annotation

Codecov / codecov/patch

tdgl/finite_volume/operators.py#L41-L42

Added lines #L41 - L42 were not covered by tests

if -1 not in offsets.get():
mask = offsets > -1
spmatrix.data[offsets[mask]] = x[mask]

if mask.all():

Check warning on line 47 in tdgl/finite_volume/operators.py

View check run for this annotation

Codecov / codecov/patch

tdgl/finite_volume/operators.py#L47

Added line #L47 was not covered by tests
# only affects existing non-zero cells
spmatrix.data[offsets] = x
return

Check warning on line 49 in tdgl/finite_volume/operators.py

View check run for this annotation

Codecov / codecov/patch

tdgl/finite_volume/operators.py#L49

Added line #L49 was not covered by tests

# replace where possible
mask = offsets > -1
spmatrix.data[offsets[mask]] = x[mask]
# only insertions remain
mask = ~mask
i = i[mask]
Expand Down

0 comments on commit 0aa706e

Please sign in to comment.