[petsc-users] Zero entries of a sparse matrix in a block-wise style
Jed Brown
jed at jedbrown.org
Fri Jul 26 16:45:00 CDT 2019
Mingchang Ding <dmcvamos at udel.edu> writes:
>> It appears that you are calling MatZeroRows with rows = {0, info.mx-1},
>> which will only affect the first and last rows. The other entries are
>> how you have assembled them (with the matrix-matrix product).
>
> Yes. I think so. Is there anyway I can fill in the rows array with all the first and last DOF rows index efficiently instead of only filling in one row index at one time?
for (dof=0; dof<info.dof; dof++) rows[nrows++] = j*info.dof + dof;
(make sure to allocate the rows[] array to be large enough.
More information about the petsc-users
mailing list