<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 21.03.2011 12:24, Jed Brown wrote:
<blockquote
cite="mid:AANLkTin4HEPuDRHm+=Ag+Sa8ospVSy49rhSfs2LnhJFK@mail.gmail.com"
type="cite">
<div class="gmail_quote">On Mon, Mar 21, 2011 at 12:14, 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 id=":dr">I have two matrices L and J. L is the sparse
with 2 nonzeros per row maximum (quite often there are no
values in a row at all) and J is the dense matrix. I need to
add matrix L to matrix J so that:<br>
<br>
J = J + L<br>
<br>
I try to use:<br>
call MatAYPX(J,one,L,SUBSET_NONZERO_PATTERN,ierr)</div>
</blockquote>
</div>
<br>
<div>The dispatch for this is not set up for matrices of different
type. From C, you can</div>
<div><br>
</div>
<div>#include <private/matimpl.h> /* declaration of
MatAXPY_Basic */</div>
<div>MatAXPY_Basic(J,1.0,L,SUBSET_NONZERO_PATTERN);</div>
<div><br>
</div>
<div>There is not a Fortran binding for this function, but you
could write the wrapper (basically just copy from
src/mat/utils/ftn-auto/axpyf.c). </div>
</blockquote>
Would I have to rebuild PETSc from scratch to make this wrapper
working?<br>
<br>
<blockquote
cite="mid:AANLkTin4HEPuDRHm+=Ag+Sa8ospVSy49rhSfs2LnhJFK@mail.gmail.com"
type="cite">
<div>Alternatively, the code for this is really simple, just
iterate through the rows of L and insert them into J.</div>
</blockquote>
Do you mean using MatGetOwnershipRange+MatGetSubMatrices+MatGetRow?
</body>
</html>