<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div><a href="https://petsc.org/release/docs/manualpages/PC/PCREDISTRIBUTE/#pcredistribute">https://petsc.org/release/docs/manualpages/PC/PCREDISTRIBUTE/#pcredistribute</a> -pc_type redistribute<div><br></div><div><br></div><div>It does everything for you. Note that if the right hand side for any of the "zero" rows is nonzero then the system is inconsistent and the system does not have a solution.</div><div><br></div><div>Barry</div><div><br><div><br><blockquote type="cite"><div>On Jan 10, 2023, at 10:30 AM, Karthikeyan Chockalingam - STFC UKRI via petsc-users <petsc-users@mcs.anl.gov> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; 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;"><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Hello,</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">I am assembling a MATIJ of size N, where a very large number of rows (and corresponding columns), are zeros. I would like to potentially eliminate them before the solve.</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">For instance say N=7</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; background-color: white; font-size: 9pt; font-family: Menlo; color: rgb(93, 108, 121);">0 0<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0 0 0 0</div><div style="margin: 0cm; background-color: white; font-size: 9pt; font-family: Menlo; color: rgb(93, 108, 121);">0 1 -1<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0 0 0 0</div><div style="margin: 0cm; background-color: white; font-size: 9pt; font-family: Menlo; color: rgb(93, 108, 121);">0 -1 2<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0 0 0 -1</div><div style="margin: 0cm; background-color: white; font-size: 9pt; font-family: Menlo; color: rgb(93, 108, 121);">0 0<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0 0 0 0</div><div style="margin: 0cm; background-color: white; font-size: 9pt; font-family: Menlo; color: rgb(93, 108, 121);">0 0<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0 0 0 0</div><div style="margin: 0cm; background-color: white; font-size: 9pt; font-family: Menlo; color: rgb(93, 108, 121);">0 0<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>0 0 0 0</div><div style="margin: 0cm; background-color: white; font-size: 9pt; font-family: Menlo; color: rgb(93, 108, 121);">0 0<span class="apple-converted-space"> <span class="Apple-converted-space"> </span></span>-1 0 0 0 1</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">I would like to reduce it to a 3x3</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">1 -1 0</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">-1 2 -1</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">0 -1 1</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">I do know the size N.</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Q1) How do I do it?</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Q2) Is it better to eliminate them as it would save a lot of memory?</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Q3) At the moment, I don’t know which rows (and columns) have the zero entries but with some effort I probably can find them. Should I know which rows (and columns) I am eliminating?</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Thank you.</div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;">Karthik.</div></div><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; 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;"><span style="font-size: 6pt;">This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses. </span></p></div></blockquote></div><br></div></body></html>