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

2011-05-06 Thread Barry Smith
Are the diagonals constant values, or does each row have a separate value? Barry On May 6, 2011, at 4:23 PM, Xiangdong Liang wrote: > Thanks for your response, Barry. I am going to solve A_n x = b for > different A_n's. The difference between A_n's are only the main > diagonal and the k-t

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

2011-05-06 Thread Xiangdong Liang
Thanks for your response, Barry. I am going to solve A_n x = b for different A_n's. The difference between A_n's are only the main diagonal and the k-th diagonal. I want to generate the matrix A once, and each time modify the main and k-th diagonals to get a new A_n. That's the reason I am asking

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

2011-05-06 Thread Xiangdong Liang
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 return

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

2011-05-06 Thread Barry Smith
How are you planning to use these diagonals? This might help us make suggestions as to what is a reasonable approach. Accessing diagonals is not a natural operation for sparse matrices stored by rows or columns. Barry On May 6, 2011, at 3:56 PM, Xiangdong Liang wrote: > Hello everyone,