Hi,<br><br>I am having trouble with using the function MatMult in PETSc. The result of MatMult(A, x, Ax) (<b>using multiprocessors</b>) is not equal to the result of A*x computed in Matlab.<br>The format of the matrix A is AIJ and is obtained by function SNESDefaultComputeJacobian.<br>
I compute A*x in Matlab with the following A and x and compare it with Ax.<br><br>        .......................<br>        ierr = MatMult(*A, x, Ax);CHKERRQ(ierr);<br><br>        sprintf(filename,&quot;x.m&quot;);<br>        ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD,filename,&amp;view-&gt;viewer);CHKERRQ(ierr);<br>
        ierr = PetscViewerSetFormat(view-&gt;viewer, PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); <br>        ierr = VecView(x, view-&gt;viewer);CHKERRQ(ierr);<br><br>        sprintf(filename,&quot;Ax.m&quot;);<br>        ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD,filename,&amp;view-&gt;viewer);CHKERRQ(ierr);<br>
        ierr = PetscViewerSetFormat(view-&gt;viewer, PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); <br>        ierr = VecView(Ax, view-&gt;viewer);CHKERRQ(ierr);  <br>        .....................<br><br>What kind of bug can cause this problem?<br>
<br>Thanks.<br><br>Best,<br><br>Rongliang<br>