[petsc-users] Getting access to matrix rows without and setting values simultaneously

Alexander Grayver agrayver at gfz-potsdam.de
Thu Jun 16 07:08:26 CDT 2011


Hi Jed,

This matrix is rather grid o values.
The operation is very simply, it's scalar. Let's say we have this matrix 
A of size MxN and I want to apply thw following operation to each 
element of the matrix:

A(i,j) = log( (A(i,j) - a(j)) /  (b(j) - A(i,j)) ),
i=0..M-1 j=0..N-1

the vectors a,b are just arrays size of N and have them on each processor.

Regards,
Alexander

On 16.06.2011 13:10, Jed Brown wrote:
> On Thu, Jun 16, 2011 at 12:59, Alexander Grayver 
> <agrayver at gfz-potsdam.de <mailto:agrayver at gfz-potsdam.de>> wrote:
>
>        ! store transformed elements
>        call
>     MatSetValues(A,1,rowidx,nvals,cols,transformedvals,INSERT_VALUES,ierr);CHKERRQ(ierr);
>        call MatRestoreRow(A,i,nvals,cols,vals,ierr);CHKERRQ(ierr);
>
>
> You can't mix these because MatGetRow() needs an assembled matrix, and 
> MatSetValues() makes the matrix be unassembled.
>
> What do you want the parallel semantics to be during this transformation?
>
> The MatGetArray() for MPIDense just gives you access to the "diagonal" 
> block.
>
> What is the high-level description of the operation you're trying to 
> do? Is this "matrix" actually being used as a linear operator, or is 
> it a grid of values?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110616/f25f4a21/attachment.htm>


More information about the petsc-users mailing list