[petsc-users] Why MatMult(A, x, Ax) != A*x?
Rongliang Chen
rongliang.chan at gmail.com
Sun Nov 28 14:11:50 CST 2010
Hi,
I am having trouble with using the function MatMult in PETSc. The result of
MatMult(A, x, Ax) (*using multiprocessors*) is not equal to the result of
A*x computed in Matlab.
The format of the matrix A is AIJ and is obtained by function
SNESDefaultComputeJacobian.
I compute A*x in Matlab with the following A and x and compare it with Ax.
.......................
ierr = MatMult(*A, x, Ax);CHKERRQ(ierr);
sprintf(filename,"x.m");
ierr =
PetscViewerASCIIOpen(PETSC_COMM_WORLD,filename,&view->viewer);CHKERRQ(ierr);
ierr = PetscViewerSetFormat(view->viewer,
PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr);
ierr = VecView(x, view->viewer);CHKERRQ(ierr);
sprintf(filename,"Ax.m");
ierr =
PetscViewerASCIIOpen(PETSC_COMM_WORLD,filename,&view->viewer);CHKERRQ(ierr);
ierr = PetscViewerSetFormat(view->viewer,
PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr);
ierr = VecView(Ax, view->viewer);CHKERRQ(ierr);
.....................
What kind of bug can cause this problem?
Thanks.
Best,
Rongliang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101128/1ec63fc4/attachment.htm>
More information about the petsc-users
mailing list