<div dir="ltr"><div>I used to create matrix by calling MatCreateAIJ without knowing the exact nonzero pattern of the matrix. So I preallocate maximum nonzeros that can appear when creating a matrix.</div><div><br></div><div>After setting nonzero values by MatSetValues I call MatAssemblyBegin and MatAssemblyEnd for actual linear algebra. Now, will the unassigned, or assigned by zero preallocated slots in matrix be removed? Or Will it stay with containing zeros?</div></div>