Skip to content

Commit

Permalink
Account for matrix ownership range
Browse files Browse the repository at this point in the history
Addresses usnistgov#644
  • Loading branch information
guyer committed Sep 24, 2019
1 parent 8ce1ab2 commit 34244e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fipy/matrices/petscMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,12 @@ def _ijv2csr(self, i, j, v):
i = numerix.asarray(i)
j = numerix.asarray(j)
v = numerix.asarray(v)
N = self._shape[1]
start_row, end_row = self.matrix.getOwnershipRange()

ix = numerix.lexsort([i, j])
cols = i[ix]
row_ptr = numerix.searchsorted(j[ix], numerix.arange(N + 1))
row_ptr = numerix.searchsorted(j[ix],
numerix.arange(start_row, end_row + 1))
vals = v[ix]
# note: PETSc (at least via pip) only seems to handle 32 bit addressing
return row_ptr.astype('int32'), cols.astype('int32'), vals
Expand Down

0 comments on commit 34244e0

Please sign in to comment.