Bishesh Khanal <[email protected]> writes: > Thanks Matt, but I was trying to check if there is any problem in a matrix > I created. I had my old prototype code in MATLAB where I created a matrix > by having a block of rows for each dof. So as a quick test, I wanted to > write the matrix I created in Petsc to a file and read it with matlab and > compare the two matrices, taking a difference would help me spot errors > quickly.
Just permute the matrix, either using ISCreateGeneral and MatPermute or in Matlab by creating P = [1, m+1, 2*m+1, 2, m+2, 2*m+2, ...] and then looking at A(P,P). > Please let me know if there is a quick way to do that. And if there are > better ways to track down possible errors in the matrix creation by having > better visualization of elements of the matrix created in petsc (without > going to matlab), I'd be happy to learn that too. If this is the Jacobian of something, use -snes_type test to compare what you assembled to the matrix obtained by finite differencing the residual function.
pgpK9DpNmAlNp.pgp
Description: PGP signature
