<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Check the output of <span style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, system-ui, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important">MatMatMult().
 If your matrix product has all diagonal entries? How large is your matrix? </span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, system-ui, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important">Hong</span></div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> petsc-users <petsc-users-bounces@mcs.anl.gov> on behalf of Yang Juntao <Y.Juntao@hotmail.com><br>
<b>Sent:</b> Thursday, June 4, 2020 4:01 AM<br>
<b>To:</b> petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject:</b> [petsc-users] Slow speed to SetValues for matrix created by PETSC by mat_initial_matrix</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Hello, <br>
<br>
I computed a preconditioned matrix by MatMatMulti(), and I generated the new matrix with option MAT_INITIAL_MATRIX.
<br>
<br>
However I need to change the generated matrix by insert value 1 to half of the diagonal. MatSetValue() is used but the speed a much slower than MatSetValue with matrix setup by MatCreate() and MatSeqAIJPreallocation().
<br>
I would like to ask is it due to the preallocation setting of MAT_INITIAL_MATRIX generated matrix and how I can change it?<br>
<br>
Thanks in advance<br>
JT<br>
</div>
</span></font></div>
</body>
</html>