Alexander Do you have a small code to reproduce the issue?
Below is the output using a PETSc example (src/mat/tests/ex11). The pattern is kept. kl-18448:tests szampini$ ./ex11 Mat Object: 1 MPI processes type: seqaij row 0: (0, 5.) row 1: (0, -1.) (1, 4.) (2, -1.) (6, -1.) row 2: (2, 5.) row 3: (2, -1.) (3, 4.) (4, -1.) (8, -1.) row 4: (4, 5.) row 5: (0, -1.) (5, 4.) (6, -1.) (10, -1.) row 6: (6, 5.) row 7: (2, -1.) (6, -1.) (7, 4.) (8, -1.) (12, -1.) row 8: (8, 5.) row 9: (4, -1.) (8, -1.) (9, 4.) (14, -1.) row 10: (10, 5.) row 11: (6, -1.) (10, -1.) (11, 4.) (12, -1.) (16, -1.) row 12: (12, 5.) row 13: (8, -1.) (12, -1.) (13, 4.) (14, -1.) (18, -1.) row 14: (14, 5.) row 15: (10, -1.) (15, 4.) (16, -1.) (20, -1.) row 16: (16, 5.) row 17: (12, -1.) (16, -1.) (17, 4.) (18, -1.) (22, -1.) row 18: (18, 5.) row 19: (14, -1.) (18, -1.) (19, 4.) (24, -1.) row 20: (20, 5.) row 21: (16, -1.) (20, -1.) (21, 4.) (22, -1.) row 22: (22, 5.) row 23: (18, -1.) (22, -1.) (23, 4.) (24, -1.) row 24: (19, -1.) (23, -1.) (24, 4.) kl-18448:tests szampini$ ./ex11 -keep_nonzero_pattern Mat Object: 1 MPI processes type: seqaij row 0: (0, 5.) (1, 0.) (5, 0.) row 1: (0, -1.) (1, 4.) (2, -1.) (6, -1.) row 2: (1, 0.) (2, 5.) (3, 0.) (7, 0.) row 3: (2, -1.) (3, 4.) (4, -1.) (8, -1.) row 4: (3, 0.) (4, 5.) (9, 0.) row 5: (0, -1.) (5, 4.) (6, -1.) (10, -1.) row 6: (1, 0.) (5, 0.) (6, 5.) (7, 0.) (11, 0.) row 7: (2, -1.) (6, -1.) (7, 4.) (8, -1.) (12, -1.) row 8: (3, 0.) (7, 0.) (8, 5.) (9, 0.) (13, 0.) row 9: (4, -1.) (8, -1.) (9, 4.) (14, -1.) row 10: (5, 0.) (10, 5.) (11, 0.) (15, 0.) row 11: (6, -1.) (10, -1.) (11, 4.) (12, -1.) (16, -1.) row 12: (7, 0.) (11, 0.) (12, 5.) (13, 0.) (17, 0.) row 13: (8, -1.) (12, -1.) (13, 4.) (14, -1.) (18, -1.) row 14: (9, 0.) (13, 0.) (14, 5.) (19, 0.) row 15: (10, -1.) (15, 4.) (16, -1.) (20, -1.) row 16: (11, 0.) (15, 0.) (16, 5.) (17, 0.) (21, 0.) row 17: (12, -1.) (16, -1.) (17, 4.) (18, -1.) (22, -1.) row 18: (13, 0.) (17, 0.) (18, 5.) (19, 0.) (23, 0.) row 19: (14, -1.) (18, -1.) (19, 4.) (24, -1.) row 20: (15, 0.) (20, 5.) (21, 0.) row 21: (16, -1.) (20, -1.) (21, 4.) (22, -1.) row 22: (17, 0.) (21, 0.) (22, 5.) (23, 0.) row 23: (18, -1.) (22, -1.) (23, 4.) (24, -1.) row 24: (19, -1.) (23, -1.) (24, 4.) > On Jul 15, 2021, at 4:41 PM, Alexander Lindsay <alexlindsay...@gmail.com> > wrote: > > My interpretation of the documentation page of MatZeroRows is that if I've > set MAT_KEEP_NONZERO_PATTERN to true, then my sparsity pattern shouldn't be > changed by a call to it, e.g. a->imax should not change. However, at least > for sequential matrices, MatAssemblyEnd is called with MAT_FINAL_ASSEMBLY at > the end of MatZeroRows_SeqAIJ and that does indeed change my sparsity > pattern. Is my interpretation of the documentation page wrong? > > Alex