Hi, VecSetSizes(vec, PETSC_DECIDE, n); MatSetSizes(mat, PETSC_DECIDE, PETSC_DECIDE, n,n); If the matrix is square can I conclude that the vec and mat have the same distribution. Thanks Yixun