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

Reply via email to