<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>this give a seg. fault. 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"> </div>

<div name="quoted-content">
<div>What happens if you try to preallocate C matrix (in the same way as A and B) and use MatMatMult with MAT_REUSE_MATRIX?
<div> </div>

<div>Hong (Mr.)
<div> 
<blockquote>
<div>On Mar 5, 2019, at 6:19 PM, Marius Buerkle via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" onclick="parent.window.location.href='mailto:petsc-users@mcs.anl.gov'; return false;" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:</div>
 

<div>
<div>
<div style="font-family: Verdana;font-size: 12.0px;">
<div>
<p><span style="font-size: 11.0pt;"><span style="line-height: normal;"><span style="font-family: Calibri , sans-serif;"><span style="font-size: 12.0pt;"><span style="font-family: "Times New Roman" , serif;">Hi,</span></span></span></span></span></p>

<div> </div>

<p><span style="font-size: 11.0pt;"><span style="line-height: normal;"><span style="font-family: Calibri , sans-serif;"><span style="font-size: 12.0pt;"><span style="font-family: "Times New Roman" , serif;">I have a question regarding MatMatMult for MPIDENSE matrices. I have two dense matrices A and B for which I set the number up the number of local rows each processor owns manually (same for A and B) when creating them with MatCreateDense (which is different from what PETSC_DECIDE what do). When I calculate A*B=C using MatMatMult with MAT_INITIAL_MATRIX the resulting matrix C has a different distribution of the rows among the processes. Is this normal? I would have expected that C inherits the local row structure from A and B. </span></span><span style="font-size: 12.0pt;"><span style="font-family: "Yu Mincho" , serif;">Later</span></span><span style="font-size: 12.0pt;"><span style="font-family: "Times New Roman" , serif;"> on, I want to multiply C let’s say with A which gives then accordingly an error that the local size is not conform. </span></span></span></span></span></p>

<p><span style="font-size: 11.0pt;"><span style="line-height: normal;"><span style="font-family: Calibri , sans-serif;"><span style="font-size: 12.0pt;"><span style="font-family: "Times New Roman" , serif;">If on the other hand A is MATMPIAIJ then C has the same local row structure.</span></span></span></span></span></p>

<div> </div>

<p><span style="font-size: 11.0pt;"><span style="line-height: normal;"><span style="font-family: Calibri , sans-serif;"><span style="font-size: 12.0pt;"><span style="font-family: "Times New Roman" , serif;">Best,</span></span></span></span></span></p>

<p><span style="font-size: 11.0pt;"><span style="line-height: normal;"><span style="font-family: Calibri , sans-serif;"><span style="font-size: 12.0pt;"><span style="font-family: "Times New Roman" , serif;">Marius</span></span></span></span></span></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>