[petsc-users] Questions about matrix operation in petsc4py

Mark Adams mfadams at lbl.gov
Mon Oct 18 09:29:04 CDT 2021


see this example:
https://github.com/JesseLu/petsc4py-tutorial/blob/master/mat_serial.py

You need to add the assembly calls

On Mon, Oct 18, 2021 at 10:06 AM Guangpu Zhu <zhugp01 at nus.edu.sg> wrote:

> Dear Sir/Madam,
>
>          My name is Guangpu Zhu, I met a problem when I tested the matrix
> operation in petsc4py.  As the following code shows, I first set all
> elements of the matrix to 2.0. Then, I try to set the diagonal elements of
> the matrix to 1.0.  However, I surprisingly found that the diagonal
> elements are still 2.0.  This question has confused me for a few days, so I
> am writing to you for help or suggestions. Attached is the test code I
> used. I would greatly appreciate it if you can kindly reply to me. Thank
> you in ad
>
>
>
> ---
> Guangpu Zhu
>
> Research Associate,  Department of Mechanical Engineering
>
> National University of Singapore
>
> Personal E-mail: zhugpupc at gmail.com
>
> Phone: (+65) 87581879
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211018/846b691e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 18308 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211018/846b691e/attachment.png>


More information about the petsc-users mailing list