[petsc-users] Eliminating rows and columns which are zeros

Karthikeyan Chockalingam - STFC UKRI karthikeyan.chockalingam at stfc.ac.uk
Tue Jan 10 10:25:03 CST 2023


Thank you Barry. This is great!

I plan to solve using ‘-pc_type redistribute’ after applying the Dirichlet bc using

MatZeroRowsColumnsIS(A, isout, 1, x, b);


While I retrieve the solution data from x (after the solve) – can I index them using the original ordering (if I may say that)?

Kind regards,
Karthik.

From: Barry Smith <bsmith at petsc.dev>
Date: Tuesday, 10 January 2023 at 16:04
To: Chockalingam, Karthikeyan (STFC,DL,HC) <karthikeyan.chockalingam at stfc.ac.uk>
Cc: petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Eliminating rows and columns which are zeros

https://petsc.org/release/docs/manualpages/PC/PCREDISTRIBUTE/#pcredistribute   -pc_type redistribute


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.

Barry



On Jan 10, 2023, at 10:30 AM, Karthikeyan Chockalingam - STFC UKRI via petsc-users <petsc-users at mcs.anl.gov> wrote:

Hello,

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.

For instance say N=7

0 0  0  0 0 0 0
0 1 -1  0 0 0 0
0 -1 2  0 0 0 -1
0 0  0  0 0 0 0
0 0  0  0 0 0 0
0 0  0  0 0 0 0
0 0  -1 0 0 0 1

I would like to reduce it to a 3x3

1 -1 0
-1 2 -1
0 -1 1

I do know the size N.

Q1) How do I do it?
Q2) Is it better to eliminate them as it would save a lot of memory?
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?

Thank you.

Karthik.

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230110/19b50f39/attachment.html>


More information about the petsc-users mailing list