[petsc-users] Write Non-Zero Values of MPI Matrix on an MPI Vector

Ali Kahraman aliberkkahraman at yahoo.com
Tue Feb 13 06:24:39 CST 2018


  
Dear All,
 
My problem definition is as follows,
 
I  have an MPI matrix with a random sparsity pattern i.e. I do not know how many nonzeros there are on any row unless I call MatGetRow to learn it. There are possibly unequal numbers of nonzeros on every row. I want to write all the nonzero values of this matrix onto a parallel vector. An example can be as follows. 
 
 
Imagine I have a 4x4 matrix (; denotes next row, . denotes sparse "zeros") [3 . 2 . ; .  1 .  . ; 4 5 3 2; . . . .]. I want to obtain the vector [3 2 1 4 5 3 2]. I could not find any function that does this. Any idea is appreciated.
 
My thought was to get the number of nonzeros on each process by MatGetInfo, then broadcast this to all processes so all processes know the nonzero number of each other. However, I could not find the MPI command to do this either (this may because I did not know how to look). Any help with this is also appreciated.
 
Best Regards,
 Ali Berk KahramanM.Sc. Student, Mechanical EngineeringBoğaziçi University, Istanbul, Turkey
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180213/22808e25/attachment.html>


More information about the petsc-users mailing list