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,"x.m");<br> ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD,filename,&view->viewer);CHKERRQ(ierr);<br>
ierr = PetscViewerSetFormat(view->viewer, PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); <br> ierr = VecView(x, view->viewer);CHKERRQ(ierr);<br><br> sprintf(filename,"Ax.m");<br> ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD,filename,&view->viewer);CHKERRQ(ierr);<br>
ierr = PetscViewerSetFormat(view->viewer, PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr); <br> ierr = VecView(Ax, view->viewer);CHKERRQ(ierr); <br> .....................<br><br>What kind of bug can cause this problem?<br>
<br>Thanks.<br><br>Best,<br><br>Rongliang<br>