<div dir="ltr"><div dir="ltr">On Mon, Dec 12, 2022 at 5:24 PM Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br></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">The description matches MATNEST (MATCOMPOSITE is for a sum or product of matrices) or parallel decompositions. Also consider the assembly style of src/snes/tutorials/ex28.c, which can create either a monolithic or block (MATNEST) matrix without extra storage or conversion costs.<br></blockquote><div><br></div><div>I will just say a few words about ex28. The idea is that if you are already calling MatSetValues() to assemble your submatrices, then</div><div>you can use MatSetValuesLocal() to remap those locations into locations in the large matrix, using a LocalToGlobalMap. This allows</div><div>you to choose either a standard AIJ matrix (which supports factorizations for example), or a MatNest object that supports fast extraction</div><div>of the blocks.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> writes:<br>
<br>
> Do you know what kind of solver works well for this problem?<br>
><br>
> You probably want to figure that out first and not worry about efficiency.<br>
><br>
> MATCOMPOSITE does what you want but not all solvers will work with it.<br>
><br>
> Where does this problem come from? We have a lot of experience and might<br>
> know something.<br>
><br>
> Mark<br>
><br>
> On Mon, Dec 12, 2022 at 1:33 PM Peder Jørgensgaard Olesen via petsc-users <<br>
> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
><br>
>> Hello<br>
>><br>
>><br>
>> I have a set of sparse matrices (A1, A2, ...) , and need to generate a<br>
>> larger matrix B with these as submatrices. I do not know the precise sparse<br>
>> layouts of the A's (only that each row has one or two non-zero values),<br>
>> and extracting *all* values to copy into B seems incredibly wasteful. How<br>
>> can I make use of the sparsity to solve this efficiently?<br>
>><br>
>><br>
>> Thanks,<br>
>><br>
>> Peder<br>
>><br>
>><br>
>><br>
>> Peder Jørgensgaard Olesen<br>
>> PhD student<br>
>> Department of Civil and Mechanical Engineering<br>
>><br>
>> <a href="mailto:pjool@mek.dtu.dk" target="_blank">pjool@mek.dtu.dk</a><br>
>> Koppels Allé<br>
>> Building 403, room 105<br>
>> 2800 Kgs. Lyngby<br>
>> <a href="http://www.dtu.dk/english" rel="noreferrer" target="_blank">www.dtu.dk/english</a><br>
>><br>
>><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>