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

Jed Brown jed at 59A2.org
Thu Jun 16 07:30:14 CDT 2011


On Thu, Jun 16, 2011 at 14:08, Alexander Grayver <agrayver at gfz-potsdam.de>wrote:

> This matrix is rather grid o values.
>

Okay, then you can manage it with a DA (DMDA in petsc-dev). This will give a
better parallel distribution and give you access to entries in convenient
ways (e.g. using arrays). See the section of the user's manual Structured
Grids Using Distributed Arrays.

In PETSc, the Mat type is for linear operators. A Mat might represent a
transformation from one of your grids to another. A given state on the grid
is given by a Vec, and DMDA will help you manage that.


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

This will be very easy using DMDA.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110616/dff71aea/attachment-0001.htm>


More information about the petsc-users mailing list