when 1 processor is used, the matrix M in PCComputeExplicitOperator(pc,&amp;M) uses MATSEQDENSE type. Now, I want to use MATSEQAIJ, I change the codes as follows:<br>1563      if (size == 1) {<br>1564    //05/01/08<br>1565        //ierr = MatSetType(*mat,MATSEQDENSE);CHKERRQ(ierr);<br>
1566        //ierr = MatSeqDenseSetPreallocation(*mat,PETSC_NULL);CHKERRQ(ierr);<br>1567        ierr = MatSetType(*mat,MATSEQAIJ);CHKERRQ(ierr);<br>1568        ierr = MatSeqAIJSetPreallocation(*mat,0,PETSC_NULL);CHKERRQ(ierr);<br>
1569 <br>    1570      } else {<br>1571        ierr = MatSetType(*mat,MATMPIAIJ);CHKERRQ(ierr);<br>1572        ierr = MatMPIAIJSetPreallocation(*mat,0,PETSC_NULL,0,PETSC_NULL);CHKERRQ(ierr);<br>1573      }<br><br>PCApply is fast when running. However, &nbsp;MatSetValues() is very&nbsp;very slow when some  arraies need to set. I  find that the problem likely lies in <br>
           MatSeqXAIJReallocateAIJ(A,A-&gt;rmap.n,1,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar) in MatSetValues_SeqAIJ()  after debugging&nbsp;the&nbsp;codes. <br>I&nbsp;can&#39;t&nbsp;further&nbsp;figure&nbsp;out&nbsp;where&nbsp;is&nbsp;the&nbsp;problem.&nbsp;Because&nbsp;it&nbsp;is&nbsp;difficult&nbsp;to&nbsp;debug.&nbsp;Could&nbsp;you&nbsp;give&nbsp;me&nbsp;some&nbsp;advice?&nbsp;thanks&nbsp;a&nbsp;lot.&nbsp;<br>
<br>the version of PETSc is 2.3.3-p8.<br><br>thanks a lot.<br><br>Regards,<br>Yujie<br><br><br><br><br>