[petsc-users] multiply a mpibaij matrix by its block diagonal inverse

Xiangdong epscodes at gmail.com
Tue Feb 13 17:21:04 CST 2018


Hello everyone,

I have a block sparse matrices A created from the DMDA3d. Before passing
the matrix to ksp solver, I want to apply a transformation to this matrix:
namely A:= invdiag(A)*A. Here invdiag(A) is the inverse of the block
diagonal of A. What is the best way to get the transformed matrix?

At this moment, I created a new mat IDA=inv(diag(A)) by looping through
each row and call MatMatMult to get B=invdiag(A)*A, then destroy the
temporary matrix B. However, I prefer the in-place transformation if
possible, namely, without the additional matrix B for memory saving purpose.

Do you have any suggestion on compute invdiag(A)*A for mpibaij matrix?

Thanks for your help.

Best,
Xiangdong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180213/e42e7261/attachment.html>


More information about the petsc-users mailing list