<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=""><div class=""><br class=""></div> I don't understand. Why do you wish the new matrix-matrix product vector to have the same nonzero pattern as the basic dm matrix? <div class=""><br class=""></div><div class=""> If you multiple two dm matrices together it will generally have a larger stencil then the dm matrix but this is normal and the new product matrix handles it correctly. You should not copy this new "larger" matrix into a dm matrix. When you do MatAXPY() or MatAYPX() you should put the result into the product matrix, not the dm matrix and you can use SUBSET_NONZERO_PATTERN to make it reasonably efficient.<div class=""><br class=""></div><div class=""> Barry</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 12, 2021, at 10:31 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Thu, Aug 12, 2021 at 10:44 AM Alfredo J Duarte Gomez <<a href="mailto:aduarteg@utexas.edu" class="">aduarteg@utexas.edu</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="">Good morning,<div class=""><br class=""></div><div class="">I am currently having some trouble in the creation of some matrices.</div><div class=""><br class=""></div><div class="">I am using structured dmda objects to create matrices using the DMCreate() function.</div><div class=""><br class=""></div><div class="">One of these matrices will be the result of a matrix-matrix product of two of these dm matrices.</div><div class=""><br class=""></div><div class="">I know that the matrix product will have more nonzero entries or at least a bigger stencil than the original dm matrices, however I accounted for that when I set the DMDA stencil width in the initial creation.</div></div></blockquote><div class=""><br class=""></div><div class="">By default, we put zeros into those locations, so you would expand that stencil when doing MatMatMult(). You can use</div><div class=""><br class=""></div><div class=""> -dm_preallocate_only</div><div class=""><br class=""></div><div class="">to prevent the zeros from being included. However, then your target matrix would not have those locations, so you would</div><div class="">need to turn that off before creating the product matrix, or you could just make two DMDA with different stencils, since they</div><div class="">are really small. This later solutions sounds cleaner to me.</div><div class=""><br class=""></div><div class=""> Thanks,</div><div class=""><br class=""></div><div class=""> Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class="">The problem is that even with that, the resulting matrix-matrix product has a bigger stencil as evidenced by failure in subsequent matrix copy/addition operations using SAME_NONZERO_PATTERN.</div><div class=""><br class=""></div><div class="">Judging by the difference of the nonzero entries I believe that initial zero entries (the ones I initialized to eventually hold this expaned stencil) on the original dm matrices are being combined to further expand the stencil of the product matrix. </div><div class=""><br class=""></div><div class="">Is there any way of getting a matrix-matrix product that will keep the same nonzero pattern as the dm matrices?</div><div class=""><br class=""></div><div class="">I have tried both MatMatMult() and the MatProductCreate() sequence so far, but both produce nonzero patterns that do not match the dm nonzero pattern.</div><div class=""><br class=""></div><div class="">Thank you,</div><div class=""><br class=""></div><div class="">-Alfredo</div><div class=""><br class=""></div><div class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><font face="arial, sans-serif" class="">Alfredo Duarte</font><div class=""><font face="arial, sans-serif" class="">Graduate Research Assistant</font></div><div class=""><font face="arial, sans-serif" class="">The University of Texas at Austin</font></div></div></div></div></div></div></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></div></body></html>