Skip to content

Commit cd5cbad

Browse files
committed
Bugfix in MatCreateMPIAIJWithSplitArrays
1 parent 265b2dd commit cd5cbad

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/ksp.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,12 @@ function MatCreateMPIAIJWithSplitArrays_args(a::PSparseMatrix,petsc_comm,cols=re
274274
end
275275
end
276276
if ! issorted
277-
sort!(view(oj,pini:pend))
277+
# TODO a more efficient way of doing this, or avoiding the need to sort
278+
viewj = view(oj,pini:pend)
279+
viewv = view(ov,pini:pend)
280+
perm = sortperm(viewj) # Allocation here
281+
viewj .= viewj[perm]
282+
viewv .= viewv[perm]
278283
end
279284
end
280285
(petsc_comm,m,n,M,N,i,j,v,oi,oj,ov)

0 commit comments

Comments
 (0)