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

Jed Brown jed at jedbrown.org
Tue Feb 13 07:46:35 CST 2018


Ali Kahraman <aliberkkahraman at yahoo.com> writes:

>   
> 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.

This seems like an odd thing to want.  What are you trying to do?


More information about the petsc-users mailing list