Check the output of MatMatMult(). If your matrix product has all diagonal entries? How large is your matrix? Hong
________________________________ From: petsc-users <[email protected]> on behalf of Yang Juntao <[email protected]> Sent: Thursday, June 4, 2020 4:01 AM To: [email protected] <[email protected]> Subject: [petsc-users] Slow speed to SetValues for matrix created by PETSC by mat_initial_matrix Hello, I computed a preconditioned matrix by MatMatMulti(), and I generated the new matrix with option MAT_INITIAL_MATRIX. However I need to change the generated matrix by insert value 1 to half of the diagonal. MatSetValue() is used but the speed a much slower than MatSetValue with matrix setup by MatCreate() and MatSeqAIJPreallocation(). I would like to ask is it due to the preallocation setting of MAT_INITIAL_MATRIX generated matrix and how I can change it? Thanks in advance JT
