[petsc-users] Why can't I save a diagonal matrix into a binary file via petsc4py?
张峻溪
zhjx960203 at gmail.com
Tue Nov 19 03:35:10 CST 2024
My version is 3.22.0 from "petsc4py.__version__"
Here is the code:
```python
from petsc4py import PETSc
import numpy as np
vec1 = PETSc.Vec().createWithArray(np.arange(30))
mat1 = PETSc.Mat().createDiagonal(vec1)
mat1.assemble()
viewer = PETSc.Viewer().createBinary("abcde.bin", "w")
mat1.view(viewer)
viewer.destroy()
```
I find it runs without any error, but no file generated
However, if I convert mat1 to AIJ, it can be saved successfully
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20241119/fa04c6b9/attachment.html>
More information about the petsc-users
mailing list