[petsc-users] Get and Set the k-th diagonal elements

Xiangdong Liang xdliang at gmail.com
Fri May 6 15:56:43 CDT 2011


Hello everyone,

I am wondering whether there is some function like MatGetDiagonal to
get the k-th diagonal (above or below the main diagonal) of the matrix
A. If I have to write my own function, what built-in function should I
use to get a particular element of A? It seems that MatGetValues
returns a block of matrix. I guess if I only extract one element once,
it would not be efficient. Any suggestions? Thanks.

Best,
Xiangdong


More information about the petsc-users mailing list