<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
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.<br>
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. <br>
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.<br>
So I guess I need A as a matrix, since (A'*A)*v operations will be
required further. <br>
<br>
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? <br>
Could you maybe give me an idea how to implement it? Any workaround?<br>
<br>
Regards,<br>
Alexander<br>
<br>
On 16.06.2011 14:30, Jed Brown wrote:
<blockquote
cite="mid:BANLkTin2iMFPb8JmujWFKybrMkDwu-h4Vw@mail.gmail.com"
type="cite">
<div class="gmail_quote">On Thu, Jun 16, 2011 at 14:08, Alexander
Grayver <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:agrayver@gfz-potsdam.de">agrayver@gfz-potsdam.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">This matrix is rather
grid o values.<br>
</div>
</blockquote>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div> </div>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"> 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:<br>
<br>
A(i,j) = log( (A(i,j) - a(j)) / (b(j) - A(i,j)) ), <br>
i=0..M-1 j=0..N-1<br>
<br>
the vectors a,b are just arrays size of N and have them on
each processor. </div>
</blockquote>
</div>
<br>
<div>This will be very easy using DMDA.</div>
</blockquote>
<br>
</body>
</html>