Matrix operation

billy at dem.uminho.pt billy at dem.uminho.pt
Mon Feb 20 15:23:38 CST 2006


Hello,

I would like to do the following matrix-vector operation in PETSc:

h += (Diag(A) - A) * u

where A is a matrix, Diag(A) is a matrix and h, u are vectors. It is the
multiplication of a matrix with diagonals set to zero with a vector.


How can I do this in PETSc? because MatGetDiagonal gives a vector not a matrix. 


Billy.





More information about the petsc-users mailing list