<div dir="ltr">Typically you would use this, for which there are a few examples (at the bottom of the page).<br><br><a href="http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Mat/MatMatMult.html">http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Mat/MatMatMult.html</a><div>
<br></div><div>If that doesn't fix your problem, please set up a test case or at least give us verbose diagnostics.<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 8, 2013 at 8:26 AM, Johannes Huber <span dir="ltr"><<a href="mailto:johannes.huber@unibas.ch" target="_blank">johannes.huber@unibas.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi,<br>
I have a valgrind "invalid read" in MatGetBrowsOfAoCols_MPIAIJ in the lines<br>
 rvalues  = gen_from->values; /* holds the length of receiving row */<br>
 svalues  = gen_to->values;   /* holds the length of sending row */<br>
(and others, but that are the first). This function is called indirectly via MatMatMultSymbolic.<br>
All invalid reads apear in MatGetBrowsOfAoCols_MPIAIJ.<br>
The calling sequence for the matrix factors are<br>
  MatCreate(PETSC_COMM_WORLD,A);<br>
  MatSetSizes(A,NumLocRows,NumLocCols,PETSC_DETERMINE,PETSC_DETERMINE);<br>
  MatSetType(A,MATMPIAIJ);<br>
  MatMPIAIJSetPreallocation(A,PETSC_NULL,nnz,PETSC_NULL,onz);<br>
  MatSetValues(...);<br>
  MatAssemblyBegin(...)<br>
  MatAssemblyEnd(...)<br>
and then a call to MatMatMultSymbolic. <br>
I want the result matrix to be created. In the documentation I see, that this happens, if I pass MAT_REUSE_MATRIX as scall, but how can I pass the value, I don't the parameter.<br>
Where can I find an example for MatMatMultSymbolic / MatMatMultNumeric?<br>
Thanks,<br>
    Hannes<br>
</div>
</div>

</blockquote></div><br></div></div></div>