Jed, I'm afraid we are talking about different "grids", by the grid I meant that this matrix is 2d array, not a real grid of some physical parameters or whatever and it's also not a linear operator itself. Sorry that I possibly made you confused. It's very big and that is why I chose PETSc. I compute this matrix as a product of three other petsc matrices, one of which is also dense. Now I need this transformation to be applied and then I'm planning to use this matrix to create my operator, more precisely I need to use A'*A as the linear operator and Matrix-Free notation since A'*A is dense and even larger than original A. So I guess I need A as a matrix, since (A'*A)*v operations will be required further.
I completely understand that petsc Mat has certain field of applications and my current problem is out of it, but still I wonder if there is a way to apply a scalar operation to each element of the matrix? Could you maybe give me an idea how to implement it? Any workaround? Regards, Alexander On 16.06.2011 14:30, Jed Brown wrote: > On Thu, Jun 16, 2011 at 14:08, Alexander Grayver > <agrayver at gfz-potsdam.de <mailto: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/01389d09/attachment.htm>
