<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div> When the sparse matrices have the same nonzero structure then you also just get access to the two arrays as in the dense case.</div><div><br class=""></div><div> For two general sparse you can look at the code for MatAXPY and do the same thing but with multiply.</div><div><br class=""></div><div> Barry</div><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 11, 2020, at 10:31 PM, Zhang, Hong via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-family: Calibri, sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important;" class="">Marius,</span></div><hr tabindex="-1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline-block; width: 949.609375px;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span><div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class=""></div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div style="font-family: Verdana; font-size: 12px;" class=""><div class="">Ok I see, it is not so important I was just wondering. Presently I only need it for dense matrices, fow now I am just using <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatDenseGetArray.html" class="">MatDenseGetArray</a> on both matrices and multiply both arrays pointwise, which is ok I guess. For non-dense matrices it may be more complicated.</div><div class=""><br class=""></div></div></div><blockquote style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><div class=""><div style="font-family: Verdana; font-size: 12px;" class=""><div class="">This is a good approach for sequential and parallel MatDense matrices.</div></div></div></blockquote><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div style="font-family: Verdana; font-size: 12px;" class=""><div class="">Hong</div><div class=""><br class=""></div><div class=""> <div class=""><div name="x_quote" style="margin: 10px 5px 5px 10px; padding: 10px 0px 10px 10px; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(195, 217, 229); word-wrap: break-word;" class=""><div style="margin: 0px 0px 10px;" class=""><br class=""><b class="">Von:</b> "Zhang, Hong" <<a href="mailto:hzhang@mcs.anl.gov" class="">hzhang@mcs.anl.gov</a>><br class=""><b class="">An:</b> "Marius Buerkle" <<a href="mailto:mbuerkle@web.de" class="">mbuerkle@web.de</a>>, "PETSc users list" <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>><br class=""><b class="">Betreff:</b> Re: [petsc-users] componentwise matrix multiplication</div><div name="x_quoted-content" class=""><div class=""><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="color: rgb(50, 49, 48); font-family: Verdana; font-size: 12px;" class="">Marius,</span></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="color: rgb(50, 49, 48); font-family: Verdana; font-size: 12px; background-color: rgb(255, 255, 255); display: inline;" class="">No. You may write one yourself. Let us know what matrix format do you have. We'll make suggestion to you.</span></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span style="color: rgb(50, 49, 48); font-family: Verdana; font-size: 12px; background-color: rgb(255, 255, 255); display: inline;" class="">Hong</span></div><hr style="display: inline-block; width: 923.15625px;" class=""><div id="x_divRplyFwdMsg" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span>petsc-users <<a href="mailto:petsc-users-bounces@mcs.anl.gov" class="">petsc-users-bounces@mcs.anl.gov</a>> on behalf of Marius Buerkle <<a href="mailto:mbuerkle@web.de" class="">mbuerkle@web.de</a>><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Monday, August 10, 2020 7:50 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>PETSc users list <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>[petsc-users] componentwise matrix multiplication</font><div class=""> </div></div><div class=""><div style="font-family: Verdana; font-size: 12px;" class=""><div class="">Hi,</div><div class=""> </div><div class="">Is there a componentwise matrix multiplication, similar to VecPointwiseMult ?</div><div class=""> </div><div class="">Best,</div><div class="">Marius</div></div></div></div></div></div></div></div></div></div></div></blockquote></div><br class=""></body></html>