[petsc-users] set the diagonal for zero row
Hoang Giang Bui
hgbk2008 at gmail.com
Mon Aug 10 03:57:52 CDT 2015
Dear list
What is the best way to search for complete zero rows of the matrix and
set the diagonal to 1.0? In my thinking, the solution would be:
+ extract the max absolute values of each row by using MatGetRowMaxAbs
+ Compare the value with some tolerance and put into the zero row list
+ Extract the diagonal of the matrix by MatGetDiagonal
+ modify the vector of diagonal
+ set the diagonal back by using MatDiagonalSet
THis seem to be overly complicated. Is there an all-in-one solution,
similar to MatZeroRowsColumns?
Best regards
Giang
More information about the petsc-users
mailing list