petsc4py 3.26.0__tar.gz → 3.26.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. {petsc4py-3.26.0 → petsc4py-3.26.2}/DESCRIPTION.rst +1 -1
  2. {petsc4py-3.26.0/src/petsc4py.egg-info → petsc4py-3.26.2}/PKG-INFO +3 -3
  3. {petsc4py-3.26.0 → petsc4py-3.26.2}/conf/stubgen.py +2 -0
  4. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/apidoc.py +3 -0
  5. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/citing.rst +1 -1
  6. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/overview.rst +1 -1
  7. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DM.pyx +85 -7
  8. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/KSP.pyx +33 -0
  9. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Mat.pyx +55 -1
  10. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdm.pxi +41 -0
  11. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscksp.pxi +1 -0
  12. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscmat.pxi +1 -0
  13. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/typing.pxi +2 -0
  14. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc.pyi +8 -1
  15. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/__init__.py +1 -1
  16. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/typing.py +8 -0
  17. {petsc4py-3.26.0 → petsc4py-3.26.2/src/petsc4py.egg-info}/PKG-INFO +3 -3
  18. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_dmda.py +27 -0
  19. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_gc.py +21 -0
  20. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_ksp.py +43 -0
  21. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_mat_aij.py +47 -0
  22. {petsc4py-3.26.0 → petsc4py-3.26.2}/.cython-lint.toml +0 -0
  23. {petsc4py-3.26.0 → petsc4py-3.26.2}/.ruff.toml +0 -0
  24. {petsc4py-3.26.0 → petsc4py-3.26.2}/CHANGES.rst +0 -0
  25. {petsc4py-3.26.0 → petsc4py-3.26.2}/LICENSE.rst +0 -0
  26. {petsc4py-3.26.0 → petsc4py-3.26.2}/MANIFEST.in +0 -0
  27. {petsc4py-3.26.0 → petsc4py-3.26.2}/README.rst +0 -0
  28. {petsc4py-3.26.0 → petsc4py-3.26.2}/conf/__init__.py +0 -0
  29. {petsc4py-3.26.0 → petsc4py-3.26.2}/conf/confpetsc.py +0 -0
  30. {petsc4py-3.26.0 → petsc4py-3.26.2}/conf/cyautodoc.py +0 -0
  31. {petsc4py-3.26.0 → petsc4py-3.26.2}/conf/cythonize.py +0 -0
  32. {petsc4py-3.26.0 → petsc4py-3.26.2}/conf/cythonize.sh +0 -0
  33. {petsc4py-3.26.0 → petsc4py-3.26.2}/conf/epydoc.cfg +0 -0
  34. {petsc4py-3.26.0 → petsc4py-3.26.2}/conf/epydocify.py +0 -0
  35. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/hpddm/hpddm.py +0 -0
  36. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/hpddm/saddle_point.py +0 -0
  37. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/htool/htool.py +0 -0
  38. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/binary-io/makefile +0 -0
  39. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/binary-io/matvecio.py +0 -0
  40. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/bratu2d/bratu2d.py +0 -0
  41. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/bratu2d/bratu2df90.f90 +0 -0
  42. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/bratu2d/bratu2dnpy.py +0 -0
  43. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/bratu2d/makefile +0 -0
  44. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/bratu3d/bratu3d.py +0 -0
  45. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/bratu3d/makefile +0 -0
  46. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/dmplex/anisotropic_adaptation.py +0 -0
  47. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/dmplex/distribute_field.py +0 -0
  48. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/dmplex/isotropic_adaptation.py +0 -0
  49. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/kspsolve/makefile +0 -0
  50. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/kspsolve/petsc-cg.py +0 -0
  51. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/kspsolve/petsc-ksp.py +0 -0
  52. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/kspsolve/petsc-mat.py +0 -0
  53. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/kspsolve/test_mat_cg.py +0 -0
  54. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/kspsolve/test_mat_ksp.py +0 -0
  55. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/makefile +0 -0
  56. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/ode/bouncing_ball.py +0 -0
  57. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/ode/ce.py +0 -0
  58. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/ode/fastslowsplit.py +0 -0
  59. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/ode/heat.py +0 -0
  60. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/ode/orego.py +0 -0
  61. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/ode/rober.py +0 -0
  62. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/ode/vanderpol.py +0 -0
  63. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/perftest/App.f90 +0 -0
  64. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/perftest/App.pyf +0 -0
  65. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/perftest/driver.c +0 -0
  66. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/perftest/driver.py +0 -0
  67. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/perftest/makefile +0 -0
  68. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/perftest/makefile.f2py +0 -0
  69. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/perftest/makefile.petsc +0 -0
  70. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/petsc-examples/ksp/ex2.py +0 -0
  71. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/petsc-examples/ksp/ex23.py +0 -0
  72. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/petsc-examples/ksp/makefile +0 -0
  73. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/petsc-examples/makefile +0 -0
  74. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/poisson2d/makefile +0 -0
  75. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/poisson2d/poisson2d.py +0 -0
  76. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/poisson3d/del2lib.f90 +0 -0
  77. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/poisson3d/del2mat.h +0 -0
  78. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/poisson3d/del2mat.py +0 -0
  79. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/poisson3d/makefile +0 -0
  80. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/poisson3d/makefile.petsc +0 -0
  81. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/poisson3d/poisson3d.c +0 -0
  82. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/poisson3d/poisson3d.py +0 -0
  83. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/taosolve/chwirut.py +0 -0
  84. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/taosolve/rosenbrock.py +0 -0
  85. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-cython/Bratu3D.pyx +0 -0
  86. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-cython/Bratu3Dimpl.c +0 -0
  87. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-cython/Bratu3Dimpl.h +0 -0
  88. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-cython/makefile +0 -0
  89. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-cython/run_demo.py +0 -0
  90. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-cython/setup.py +0 -0
  91. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-f2py/.f2py_f2cmap +0 -0
  92. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-f2py/Bratu2D.F90 +0 -0
  93. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-f2py/Bratu2D.pyf +0 -0
  94. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-f2py/Bratu2Dmodule.h +0 -0
  95. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-f2py/makefile +0 -0
  96. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-f2py/run_demo.py +0 -0
  97. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-f2py/setup.py +0 -0
  98. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-swig/Bratu3D.c +0 -0
  99. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-swig/Bratu3D.h +0 -0
  100. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-swig/Bratu3D.i +0 -0
  101. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-swig/makefile +0 -0
  102. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-swig/run_demo.py +0 -0
  103. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/legacy/wrap-swig/setup.py +0 -0
  104. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/poisson2d/poisson2d.py +0 -0
  105. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/ksp.py +0 -0
  106. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/ksppython_protocol.py +0 -0
  107. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/mat.py +0 -0
  108. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/matpython_protocol.py +0 -0
  109. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/pc.py +0 -0
  110. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/pcpython_protocol.py +0 -0
  111. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/petscviewerpython_protocol.py +0 -0
  112. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/snes.py +0 -0
  113. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/snespython_protocol.py +0 -0
  114. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/tao.py +0 -0
  115. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/taopython_protocol.py +0 -0
  116. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/ts.py +0 -0
  117. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/python_types/tspython_protocol.py +0 -0
  118. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/regressor/test_regressor.py +0 -0
  119. {petsc4py-3.26.0 → petsc4py-3.26.2}/demo/regressor/test_regressor_synthetic.py +0 -0
  120. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/index.rst +0 -0
  121. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/.gitignore +0 -0
  122. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/Makefile +0 -0
  123. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/_templates/autosummary/class.rst +0 -0
  124. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/_templates/autosummary/module.rst +0 -0
  125. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/_templates/layout.html +0 -0
  126. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/conf.py +0 -0
  127. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/contributing.rst +0 -0
  128. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/documentation_standards.rst +0 -0
  129. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/index.rst +0 -0
  130. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/install.rst +0 -0
  131. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/links.txt +0 -0
  132. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/petsc_options.rst +0 -0
  133. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/petsc_python_types.rst +0 -0
  134. {petsc4py-3.26.0 → petsc4py-3.26.2}/docs/source/reference.rst +0 -0
  135. {petsc4py-3.26.0 → petsc4py-3.26.2}/pyproject.toml +0 -0
  136. {petsc4py-3.26.0 → petsc4py-3.26.2}/setup.cfg +0 -0
  137. {petsc4py-3.26.0 → petsc4py-3.26.2}/setup.py +0 -0
  138. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/cython.h +0 -0
  139. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat/cuda.h +0 -0
  140. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat/h2opus.h +0 -0
  141. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat/hip.h +0 -0
  142. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat/hpddm.h +0 -0
  143. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat/mpi.h +0 -0
  144. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat/plexexodusii.h +0 -0
  145. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat/regressor.h +0 -0
  146. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat/tao.h +0 -0
  147. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat/viennacl.h +0 -0
  148. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/compat.h +0 -0
  149. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/custom.h +0 -0
  150. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/lib-petsc/initpkg.h +0 -0
  151. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/AO.pyx +0 -0
  152. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/CAPI.pyx +0 -0
  153. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Comm.pyx +0 -0
  154. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Const.pyx +0 -0
  155. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DMComposite.pyx +0 -0
  156. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DMDA.pyx +0 -0
  157. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DMLabel.pyx +0 -0
  158. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DMPlex.pyx +0 -0
  159. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DMShell.pyx +0 -0
  160. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DMStag.pyx +0 -0
  161. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DMSwarm.pyx +0 -0
  162. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DMUtils.pyx +0 -0
  163. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DS.pyx +0 -0
  164. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/DT.pyx +0 -0
  165. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Device.pyx +0 -0
  166. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Error.pyx +0 -0
  167. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/FE.pyx +0 -0
  168. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/IS.pyx +0 -0
  169. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Log.pyx +0 -0
  170. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/MatPartitioning.pyx +0 -0
  171. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Object.pyx +0 -0
  172. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Options.pyx +0 -0
  173. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/PC.pyx +0 -0
  174. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/PETSc.pyx +0 -0
  175. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Partitioner.pyx +0 -0
  176. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Random.pyx +0 -0
  177. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Regressor.pyx +0 -0
  178. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/SF.pyx +0 -0
  179. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/SNES.pyx +0 -0
  180. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Scatter.pyx +0 -0
  181. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Section.pyx +0 -0
  182. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Space.pyx +0 -0
  183. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Sys.pyx +0 -0
  184. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/TAO.pyx +0 -0
  185. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/TS.pyx +0 -0
  186. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Vec.pyx +0 -0
  187. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/Viewer.pyx +0 -0
  188. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/arraynpy.pxi +0 -0
  189. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/cyclicgc.pxi +0 -0
  190. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/dlpack.pxi +0 -0
  191. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/libpetsc4py.pyx +0 -0
  192. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscao.pxi +0 -0
  193. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdef.pxi +0 -0
  194. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdevice.pxi +0 -0
  195. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdmcomposite.pxi +0 -0
  196. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdmda.pxi +0 -0
  197. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdmlabel.pxi +0 -0
  198. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdmplex.pxi +0 -0
  199. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdmshell.pxi +0 -0
  200. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdmstag.pxi +0 -0
  201. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdmswarm.pxi +0 -0
  202. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdmutils.pxi +0 -0
  203. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscds.pxi +0 -0
  204. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscdt.pxi +0 -0
  205. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscfe.pxi +0 -0
  206. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscis.pxi +0 -0
  207. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petsclayout.pxi +0 -0
  208. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petsclog.pxi +0 -0
  209. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscmatpartitioning.pxi +0 -0
  210. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscmem.pxi +0 -0
  211. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscmpi.pxi +0 -0
  212. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscobj.pxi +0 -0
  213. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscopt.pxi +0 -0
  214. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscpartitioner.pxi +0 -0
  215. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscpc.pxi +0 -0
  216. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscpyappctx.pxi +0 -0
  217. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscrand.pxi +0 -0
  218. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscregressor.pxi +0 -0
  219. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscsct.pxi +0 -0
  220. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscsec.pxi +0 -0
  221. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscsf.pxi +0 -0
  222. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscsnes.pxi +0 -0
  223. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscspace.pxi +0 -0
  224. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscsys.pxi +0 -0
  225. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petsctao.pxi +0 -0
  226. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscts.pxi +0 -0
  227. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscvec.pxi +0 -0
  228. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc/petscvwr.pxi +0 -0
  229. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc.pxd +0 -0
  230. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc.py +0 -0
  231. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/PETSc.pyx +0 -0
  232. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/__init__.pxd +0 -0
  233. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/__init__.pyi +0 -0
  234. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/__main__.py +0 -0
  235. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/__main__.pyi +0 -0
  236. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/include/petsc4py/numpy.h +0 -0
  237. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/include/petsc4py/petsc4py.h +0 -0
  238. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/include/petsc4py/petsc4py.i +0 -0
  239. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/include/petsc4py/pybuffer.h +0 -0
  240. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/include/petsc4py/pyscalar.h +0 -0
  241. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/lib/__init__.py +0 -0
  242. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/lib/__init__.pyi +0 -0
  243. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/lib/_pytypes/__init__.py +0 -0
  244. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/lib/_pytypes/viewer/__init__.py +0 -0
  245. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/lib/_pytypes/viewer/petscpyvista.py +0 -0
  246. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/lib/petsc.cfg +0 -0
  247. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py/py.typed +0 -0
  248. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py.egg-info/SOURCES.txt +0 -0
  249. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py.egg-info/dependency_links.txt +0 -0
  250. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py.egg-info/not-zip-safe +0 -0
  251. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py.egg-info/requires.txt +0 -0
  252. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/petsc4py.egg-info/top_level.txt +0 -0
  253. {petsc4py-3.26.0 → petsc4py-3.26.2}/src/pyapicompat.h +0 -0
  254. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/runtests.py +0 -0
  255. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_comm.py +0 -0
  256. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_device.py +0 -0
  257. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_dmcomposite.py +0 -0
  258. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_dmplex.py +0 -0
  259. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_dmshell.py +0 -0
  260. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_dmstag.py +0 -0
  261. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_dmswarm.py +0 -0
  262. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_is.py +0 -0
  263. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_ksp_py.py +0 -0
  264. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_lgmap.py +0 -0
  265. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_log.py +0 -0
  266. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_mat_dense.py +0 -0
  267. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_mat_fact.py +0 -0
  268. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_mat_py.py +0 -0
  269. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_mat_schur.py +0 -0
  270. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_matpartitioning.py +0 -0
  271. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_nsp.py +0 -0
  272. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_object.py +0 -0
  273. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_optdb.py +0 -0
  274. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_pc.py +0 -0
  275. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_pc_py.py +0 -0
  276. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_section.py +0 -0
  277. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_sf.py +0 -0
  278. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_snes.py +0 -0
  279. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_snes_py.py +0 -0
  280. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_stdout.py +0 -0
  281. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_sys.py +0 -0
  282. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_tao.py +0 -0
  283. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_tao_py.py +0 -0
  284. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_tao_with_taoterm.py +0 -0
  285. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_taoterm.py +0 -0
  286. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_ts.py +0 -0
  287. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_ts_py.py +0 -0
  288. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_vec.py +0 -0
  289. {petsc4py-3.26.0 → petsc4py-3.26.2}/test/test_viewer_py.py +0 -0
@@ -41,5 +41,5 @@ project.
41
41
  J. Roman, K. Rupp, P. Sanan, J Sarich, B. Smith, H. Suh,
42
42
  S. Zampini, H. Zhang, and H. Zhang, J. Zhang,
43
43
  *PETSc/TAO Users Manual*, ANL-21/39 - Revision 3.26, 2026.
44
- https://doi.org/10.2172/2998643,
44
+ https://doi.org/10.2172/17154913,
45
45
  https://petsc.org/release/docs/manual/manual.pdf
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: petsc4py
3
- Version: 3.26.0
3
+ Version: 3.26.2
4
4
  Summary: PETSc for Python
5
5
  Home-page: https://gitlab.com/petsc/petsc
6
- Download-URL: https://pypi.io/packages/source/p/petsc4py/petsc4py-3.26.0.tar.gz
6
+ Download-URL: https://pypi.io/packages/source/p/petsc4py/petsc4py-3.26.2.tar.gz
7
7
  Author: Lisandro Dalcin
8
8
  Author-email: dalcinl@gmail.com
9
9
  Maintainer: PETSc Team
@@ -74,5 +74,5 @@ project.
74
74
  J. Roman, K. Rupp, P. Sanan, J Sarich, B. Smith, H. Suh,
75
75
  S. Zampini, H. Zhang, and H. Zhang, J. Zhang,
76
76
  *PETSc/TAO Users Manual*, ANL-21/39 - Revision 3.26, 2026.
77
- https://doi.org/10.2172/2998643,
77
+ https://doi.org/10.2172/17154913,
78
78
  https://petsc.org/release/docs/manual/manual.pdf
@@ -457,6 +457,8 @@ from petsc4py.typing import (
457
457
  CSRSpec,
458
458
  DMCoarsenHookFunction,
459
459
  DMRestrictHookFunction,
460
+ DMRefineHookFunction,
461
+ DMInterpolateHookFunction,
460
462
  DimsSpec,
461
463
  KSPConvergenceTestFunction,
462
464
  KSPMonitorFunction,
@@ -3,6 +3,7 @@ import sys
3
3
  import enum
4
4
  import inspect
5
5
  import textwrap
6
+ import importlib.machinery
6
7
  from sphinx.util import logging
7
8
 
8
9
  logger = logging.getLogger(__name__)
@@ -557,6 +558,8 @@ def load_module(filename, name=None):
557
558
  module = type(sys)(name)
558
559
  module.__file__ = filename
559
560
  module.__package__ = name.rsplit('.', 1)[0]
561
+ # Python 3.15 traceback formatting fails on modules with __spec__ None
562
+ module.__spec__ = importlib.machinery.ModuleSpec(name, None, origin=filename)
560
563
  old = replace_module(module)
561
564
  with open(filename) as f:
562
565
  exec(f.read(), module.__dict__) # noqa: S102
@@ -18,5 +18,5 @@ project.
18
18
  J. Roman, K. Rupp, P. Sanan, J Sarich, B. Smith, H. Suh,
19
19
  S. Zampini, H. Zhang, and H. Zhang, J. Zhang,
20
20
  *PETSc/TAO Users Manual*, ANL-21/39 - Revision 3.26, 2026.
21
- https://doi.org/10.2172/2998643,
21
+ https://doi.org/10.2172/17154913,
22
22
  https://petsc.org/release/docs/manual/manual.pdf
@@ -30,7 +30,7 @@ communication and computation.
30
30
  J. Roman, K. Rupp, P. Sanan, J Sarich, B. Smith, H. Suh,
31
31
  S. Zampini, H. Zhang, and H. Zhang, J. Zhang,
32
32
  *PETSc/TAO Users Manual*, ANL-21/39 - Revision 3.26, 2026.
33
- https://doi.org/10.2172/2998643,
33
+ https://doi.org/10.2172/17154913,
34
34
  https://petsc.org/release/docs/manual/manual.pdf
35
35
 
36
36
  .. [petsc-efficient] Satish Balay, Victor Eijkhout, William D. Gropp,
@@ -1697,6 +1697,25 @@ cdef class DM(Object):
1697
1697
  dm.dm = newdm
1698
1698
  return dm
1699
1699
 
1700
+ def interpolateHooks(self, Mat interp, DM fine) -> None:
1701
+ """Run the interpolation hooks registered on a finer `DM`.
1702
+
1703
+ Collective.
1704
+
1705
+ Parameters
1706
+ ----------
1707
+ interp
1708
+ The matrix interpolating from this `DM` to ``fine``.
1709
+ fine
1710
+ The finer `DM`.
1711
+
1712
+ See Also
1713
+ --------
1714
+ addRefineHook, petsc.DMInterpolate
1715
+
1716
+ """
1717
+ CHKERR(DMInterpolate(self.dm, interp.mat, fine.dm))
1718
+
1700
1719
  def coarsen(self, comm: Comm | None = None) -> DM:
1701
1720
  """Return a coarsened `DM` object.
1702
1721
 
@@ -2538,24 +2557,24 @@ cdef class DM(Object):
2538
2557
 
2539
2558
  def addCoarsenHook(
2540
2559
  self,
2541
- coarsenhook: DMCoarsenHookFunction,
2542
- restricthook: DMRestrictHookFunction,
2560
+ coarsenhook: DMCoarsenHookFunction | None,
2561
+ restricthook: DMRestrictHookFunction | None,
2543
2562
  args: tuple[Any, ...] | None = None,
2544
2563
  kargs: dict[str, Any] | None = None) -> None:
2545
- """Add a callback to be executed when restricting to a coarser grid.
2564
+ """Add callbacks to set up and update user-defined data on coarser ``DM`` objects.
2546
2565
 
2547
2566
  Logically collective.
2548
2567
 
2549
2568
  Parameters
2550
2569
  ----------
2551
2570
  coarsenhook
2552
- The coarsen hook function.
2571
+ The coarsen hook function. Set to `None` to omit this hook.
2553
2572
  restricthook
2554
- The restrict hook function.
2573
+ The restrict hook function. Set to `None` to omit this hook.
2555
2574
  args
2556
- Positional arguments for the hooks.
2575
+ Positional arguments for the hook.
2557
2576
  kargs
2558
- Keyword arguments for the hooks.
2577
+ Keyword arguments for the hook.
2559
2578
 
2560
2579
  See Also
2561
2580
  --------
@@ -2587,6 +2606,65 @@ cdef class DM(Object):
2587
2606
  restricthooks.append(restrictcontext)
2588
2607
  self.set_attr('__restricthooks__', restricthooks)
2589
2608
 
2609
+ def addRefineHook(
2610
+ self,
2611
+ refinehook: DMRefineHookFunction | None,
2612
+ interphook: DMInterpolateHookFunction | None,
2613
+ args: tuple[Any, ...] | None = None,
2614
+ kargs: dict[str, Any] | None = None) -> None:
2615
+ """Add callbacks to set up and update user-defined data on finer ``DM`` objects.
2616
+
2617
+ Logically collective.
2618
+
2619
+ Parameters
2620
+ ----------
2621
+ refinehook
2622
+ The refine hook function, called by `refine` with the
2623
+ coarse and the fine `DM`. Set to `None` to omit this hook.
2624
+ interphook
2625
+ The interpolate hook function, called by `interpolateHooks` with
2626
+ the coarse `DM`, the interpolation matrix and the fine `DM`. Set to
2627
+ `None` to omit this hook.
2628
+ args
2629
+ Positional arguments for the hook.
2630
+ kargs
2631
+ Keyword arguments for the hook.
2632
+
2633
+ Notes
2634
+ -----
2635
+ `refine` calls the refine hooks of the coarse `DM`, while
2636
+ `interpolateHooks` calls the interpolate hooks of the fine `DM`.
2637
+
2638
+ See Also
2639
+ --------
2640
+ interpolateHooks, refine, petsc.DMRefineHookAdd
2641
+
2642
+ """
2643
+ if args is None: args = ()
2644
+ if kargs is None: kargs = {}
2645
+
2646
+ if refinehook is not None:
2647
+ refinecontext = (refinehook, args, kargs)
2648
+
2649
+ refinehooks = self.get_attr('__refinehooks__')
2650
+ if refinehooks is None:
2651
+ refinehooks = [refinecontext]
2652
+ CHKERR(DMRefineHookAdd(self.dm, DM_PyRefineHook, NULL, <void*>NULL))
2653
+ else:
2654
+ refinehooks.append(refinecontext)
2655
+ self.set_attr('__refinehooks__', refinehooks)
2656
+
2657
+ if interphook is not None:
2658
+ interpcontext = (interphook, args, kargs)
2659
+
2660
+ interphooks = self.get_attr('__interpolatehooks__')
2661
+ if interphooks is None:
2662
+ interphooks = [interpcontext]
2663
+ CHKERR(DMRefineHookAdd(self.dm, NULL, DM_PyInterpolateHook, <void*>NULL))
2664
+ else:
2665
+ interphooks.append(interpcontext)
2666
+ self.set_attr('__interpolatehooks__', interphooks)
2667
+
2590
2668
  # --- application context ---
2591
2669
 
2592
2670
  property appctx:
@@ -2165,6 +2165,39 @@ cdef class KSP(Object):
2165
2165
  CHKERR(KSPBuildResidual(self.ksp , NULL, r.vec, &r.vec))
2166
2166
  return r
2167
2167
 
2168
+ def computeOperator(self, mat_type: Mat.Type | str | None = None) -> Mat:
2169
+ """Compute the explicit preconditioned operator.
2170
+
2171
+ Collective.
2172
+
2173
+ Parameters
2174
+ ----------
2175
+ mat_type
2176
+ The output matrix type. If `None`, use a dense matrix.
2177
+
2178
+ Returns
2179
+ -------
2180
+ Mat
2181
+ A newly created matrix owned by the caller.
2182
+
2183
+ Notes
2184
+ -----
2185
+ The operator uses the configured preconditioning side and includes
2186
+ null space removal when applicable. It is formed by applying the
2187
+ operator to columns of the identity matrix, so this computation
2188
+ is intended for relatively small systems.
2189
+
2190
+ See Also
2191
+ --------
2192
+ setPCSide, computeEigenvalues, petsc.KSPComputeOperator
2193
+
2194
+ """
2195
+ cdef PetscMatType mtype = NULL
2196
+ cdef Mat mat = Mat()
2197
+ mat_type = str2bytes(mat_type, &mtype)
2198
+ CHKERR(KSPComputeOperator(self.ksp, mtype, &mat.mat))
2199
+ return mat
2200
+
2168
2201
  def computeEigenvalues(self) -> ArrayComplex:
2169
2202
  """Compute the extreme eigenvalues for the preconditioned operator.
2170
2203
 
@@ -4542,14 +4542,68 @@ cdef class Mat(Object):
4542
4542
 
4543
4543
  Collective.
4544
4544
 
4545
+ The zeroed entries are kept in the sparsity pattern. Use `filter`
4546
+ with ``compress=True`` to remove them from it.
4547
+
4545
4548
  See Also
4546
4549
  --------
4547
- petsc.MatFilter
4550
+ filter, eliminateZeros, petsc.MatFilter
4548
4551
 
4549
4552
  """
4550
4553
  cdef PetscReal rval = asReal(tol)
4551
4554
  CHKERR(MatFilter(self.mat, rval, PETSC_FALSE, PETSC_FALSE))
4552
4555
 
4556
+ def filter(self, tol: float, compress: bool = False, keep_diagonal: bool = False) -> None:
4557
+ """Set entries with an absolute value of at most tol to zero.
4558
+
4559
+ Collective.
4560
+
4561
+ Parameters
4562
+ ----------
4563
+ tol
4564
+ The zero tolerance.
4565
+ compress
4566
+ Whether the storage should be compressed once the entries of
4567
+ at most ``tol`` are set to zero, removing them from the
4568
+ sparsity pattern rather than storing them as zeros. Ignored
4569
+ by matrix types that do not support `eliminateZeros`, such as
4570
+ dense matrices, which keep the zeroed entries.
4571
+ keep_diagonal
4572
+ If ``compress`` is `True` and the diagonal coefficient of a
4573
+ row is at most ``tol``, whether to leave it in the structure
4574
+ rather than eliminate it as well.
4575
+
4576
+ See Also
4577
+ --------
4578
+ chop, eliminateZeros, petsc.MatFilter
4579
+
4580
+ """
4581
+ cdef PetscReal rval = asReal(tol)
4582
+ cdef PetscBool ccompress = asBool(compress)
4583
+ cdef PetscBool ckeep = asBool(keep_diagonal)
4584
+ CHKERR(MatFilter(self.mat, rval, ccompress, ckeep))
4585
+
4586
+ def eliminateZeros(self, keep_diagonal: bool = False) -> None:
4587
+ """Eliminate the zero entries from the sparsity pattern.
4588
+
4589
+ Collective.
4590
+
4591
+ The matrix is modified in place, reusing the same memory.
4592
+
4593
+ Parameters
4594
+ ----------
4595
+ keep_diagonal
4596
+ If the diagonal coefficient of a row is zero, whether to
4597
+ leave it in the structure rather than eliminate it as well.
4598
+
4599
+ See Also
4600
+ --------
4601
+ filter, petsc.MatEliminateZeros
4602
+
4603
+ """
4604
+ cdef PetscBool ckeep = asBool(keep_diagonal)
4605
+ CHKERR(MatEliminateZeros(self.mat, ckeep))
4606
+
4553
4607
  def setRandom(self, Random random=None) -> None:
4554
4608
  """Set random values in the matrix.
4555
4609
 
@@ -60,6 +60,13 @@ cdef extern from * nogil:
60
60
  PetscMat,
61
61
  PetscDM,
62
62
  void*) except PETSC_ERR_PYTHON
63
+ ctypedef PetscErrorCode (*PetscDMRefineHook)(PetscDM,
64
+ PetscDM,
65
+ void*) except PETSC_ERR_PYTHON
66
+ ctypedef PetscErrorCode (*PetscDMInterpolateHook)(PetscDM,
67
+ PetscMat,
68
+ PetscDM,
69
+ void*) except PETSC_ERR_PYTHON
63
70
 
64
71
  PetscErrorCode DMCreate(MPI_Comm, PetscDM*)
65
72
  PetscErrorCode DMClone(PetscDM, PetscDM*)
@@ -142,6 +149,7 @@ cdef extern from * nogil:
142
149
  PetscErrorCode DMConvert(PetscDM, PetscDMType, PetscDM*)
143
150
  PetscErrorCode DMRefine(PetscDM, MPI_Comm, PetscDM*)
144
151
  PetscErrorCode DMCoarsen(PetscDM, MPI_Comm, PetscDM*)
152
+ PetscErrorCode DMInterpolate(PetscDM, PetscMat, PetscDM)
145
153
  PetscErrorCode DMRefineHierarchy(PetscDM, PetscInt, PetscDM[])
146
154
  PetscErrorCode DMCoarsenHierarchy(PetscDM, PetscInt, PetscDM[])
147
155
  PetscErrorCode DMGetRefineLevel(PetscDM, PetscInt*)
@@ -210,6 +218,7 @@ cdef extern from * nogil:
210
218
  PetscErrorCode DMSNESSetJacobian(PetscDM, PetscSNESJacobianFunction, void*)
211
219
 
212
220
  PetscErrorCode DMCoarsenHookAdd(PetscDM, PetscDMCoarsenHook, PetscDMRestrictHook, void*)
221
+ PetscErrorCode DMRefineHookAdd(PetscDM, PetscDMRefineHook, PetscDMInterpolateHook, void*)
213
222
 
214
223
  # --------------------------------------------------------------------
215
224
 
@@ -316,4 +325,36 @@ cdef PetscErrorCode DM_PyRestrictHook(
316
325
  (hookop, args, kargs) = hook
317
326
  hookop(Fine, Mrestrict, Rscale, Inject, Coarse, *args, **kargs)
318
327
  return PETSC_SUCCESS
328
+
329
+ cdef PetscErrorCode DM_PyRefineHook(
330
+ PetscDM coarse,
331
+ PetscDM fine,
332
+ void *ctx,
333
+ ) except PETSC_ERR_PYTHON with gil:
334
+
335
+ cdef DM Coarse = ref_DM(coarse)
336
+ cdef DM Fine = ref_DM(fine)
337
+ cdef object hooks = Coarse.get_attr('__refinehooks__')
338
+ assert hooks is not None and type(hooks) is list
339
+ for hook in hooks:
340
+ (hookop, args, kargs) = hook
341
+ hookop(Coarse, Fine, *args, **kargs)
342
+ return PETSC_SUCCESS
343
+
344
+ cdef PetscErrorCode DM_PyInterpolateHook(
345
+ PetscDM coarse,
346
+ PetscMat minterp,
347
+ PetscDM fine,
348
+ void *ctx,
349
+ ) except PETSC_ERR_PYTHON with gil:
350
+
351
+ cdef DM Coarse = ref_DM(coarse)
352
+ cdef Mat Minterp = ref_Mat(minterp)
353
+ cdef DM Fine = ref_DM(fine)
354
+ cdef object hooks = Fine.get_attr('__interpolatehooks__')
355
+ assert hooks is not None and type(hooks) is list
356
+ for hook in hooks:
357
+ (hookop, args, kargs) = hook
358
+ hookop(Coarse, Minterp, Fine, *args, **kargs)
359
+ return PETSC_SUCCESS
319
360
  # -----------------------------------------------------------------------------
@@ -179,6 +179,7 @@ cdef extern from * nogil:
179
179
  PetscErrorCode KSPGetInitialGuessKnoll(PetscKSP, PetscBool*)
180
180
  PetscErrorCode KSPSetUseFischerGuess(PetscKSP, PetscInt, PetscInt)
181
181
 
182
+ PetscErrorCode KSPComputeOperator(PetscKSP, PetscMatType, PetscMat*)
182
183
  PetscErrorCode KSPGetComputeEigenvalues(PetscKSP, PetscBool*)
183
184
  PetscErrorCode KSPSetComputeEigenvalues(PetscKSP, PetscBool)
184
185
  PetscErrorCode KSPGetComputeSingularValues(PetscKSP, PetscBool*)
@@ -344,6 +344,7 @@ cdef extern from * nogil:
344
344
  PetscErrorCode MatScale(PetscMat, PetscScalar)
345
345
  PetscErrorCode MatShift(PetscMat, PetscScalar)
346
346
  PetscErrorCode MatFilter(PetscMat, PetscReal, PetscBool, PetscBool)
347
+ PetscErrorCode MatEliminateZeros(PetscMat, PetscBool)
347
348
  PetscErrorCode MatSetRandom(PetscMat, PetscRandom)
348
349
  PetscErrorCode MatAXPY(PetscMat, PetscScalar, PetscMat, PetscMatStructure)
349
350
  PetscErrorCode MatAYPX(PetscMat, PetscScalar, PetscMat, PetscMatStructure)
@@ -53,6 +53,8 @@ cdef MatHtoolKernelFunction
53
53
 
54
54
  cdef DMCoarsenHookFunction
55
55
  cdef DMRestrictHookFunction
56
+ cdef DMRefineHookFunction
57
+ cdef DMInterpolateHookFunction
56
58
 
57
59
  # --- KSP ---
58
60
 
@@ -69,6 +69,8 @@ from petsc4py.typing import (
69
69
  CSRSpec,
70
70
  DMCoarsenHookFunction,
71
71
  DMRestrictHookFunction,
72
+ DMRefineHookFunction,
73
+ DMInterpolateHookFunction,
72
74
  DimsSpec,
73
75
  KSPConvergenceTestFunction,
74
76
  KSPMonitorFunction,
@@ -1302,6 +1304,8 @@ class Mat(Object):
1302
1304
  def scale(self, alpha: Scalar) -> None: ...
1303
1305
  def shift(self, alpha: Scalar) -> None: ...
1304
1306
  def chop(self, tol: float) -> None: ...
1307
+ def filter(self, tol: float, compress: bool = False, keep_diagonal: bool = False) -> None: ...
1308
+ def eliminateZeros(self, keep_diagonal: bool = False) -> None: ...
1305
1309
  def setRandom(self, random: Random | None = None) -> None: ...
1306
1310
  def axpy(self, alpha: Scalar, X: Mat, structure: Structure | None = None) -> None: ...
1307
1311
  def aypx(self, alpha: Scalar, X: Mat, structure: Structure | None = None) -> None: ...
@@ -1910,6 +1914,7 @@ class KSP(Object):
1910
1914
  def getWorkVecs(self, right: int | None = None, left: int | None = None) -> tuple[list[Vec], list[Vec]] | list[Vec] | None: ...
1911
1915
  def buildSolution(self, x: Vec | None = None) -> Vec: ...
1912
1916
  def buildResidual(self, r: Vec | None = None) -> Vec: ...
1917
+ def computeOperator(self, mat_type: Mat.Type | str | None = None) -> Mat: ...
1913
1918
  def computeEigenvalues(self) -> ArrayComplex: ...
1914
1919
  def computeExtremeSingularValues(self) -> tuple[float, float]: ...
1915
1920
  def setGMRESRestart(self, restart: int) -> None: ...
@@ -2846,6 +2851,7 @@ class DM(Object):
2846
2851
  def createRestriction(self, dm: DM) -> Mat: ...
2847
2852
  def convert(self, dm_type: DM.Type | str) -> DM: ...
2848
2853
  def refine(self, comm: Comm | None = None) -> DM: ...
2854
+ def interpolateHooks(self, interp: Mat, fine: DM) -> None: ...
2849
2855
  def coarsen(self, comm: Comm | None = None) -> DM: ...
2850
2856
  def refineHierarchy(self, nlevels: int) -> list: ...
2851
2857
  def coarsenHierarchy(self, nlevels: int) -> list: ...
@@ -2884,7 +2890,8 @@ class DM(Object):
2884
2890
  def createFieldDecomposition(self) -> tuple[list, list, list]: ...
2885
2891
  def setSNESFunction(self, function: SNESFunction, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
2886
2892
  def setSNESJacobian(self, jacobian: SNESJacobianFunction, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
2887
- def addCoarsenHook(self, coarsenhook: DMCoarsenHookFunction, restricthook: DMRestrictHookFunction, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
2893
+ def addCoarsenHook(self, coarsenhook: DMCoarsenHookFunction | None, restricthook: DMRestrictHookFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
2894
+ def addRefineHook(self, refinehook: DMRefineHookFunction | None, interphook: DMInterpolateHookFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
2888
2895
  appctx: object
2889
2896
  ds: DS
2890
2897
 
@@ -16,7 +16,7 @@ communications.
16
16
  """
17
17
 
18
18
  __author__ = 'Lisandro Dalcin'
19
- __version__ = '3.26.0'
19
+ __version__ = '3.26.2'
20
20
  __credits__ = 'PETSc Team <petsc-maint@mcs.anl.gov>'
21
21
 
22
22
 
@@ -55,6 +55,8 @@ __all__ = [
55
55
  'MatHtoolKernelFunction',
56
56
  'DMCoarsenHookFunction',
57
57
  'DMRestrictHookFunction',
58
+ 'DMRefineHookFunction',
59
+ 'DMInterpolateHookFunction',
58
60
  'KSPRHSFunction',
59
61
  'KSPCreateOperatorsFunction',
60
62
  'KSPComputeOperatorsFunction',
@@ -337,6 +339,12 @@ DMCoarsenHookFunction = Callable[[DM, DM], None]
337
339
  DMRestrictHookFunction = Callable[[DM, Mat, Vec, Mat, DM], None]
338
340
  """`PETSc.DM` restriction hook callback."""
339
341
 
342
+ DMRefineHookFunction = Callable[[DM, DM], None]
343
+ """`PETSc.DM` refinement hook callback."""
344
+
345
+ DMInterpolateHookFunction = Callable[[DM, Mat, DM], None]
346
+ """`PETSc.DM` interpolation hook callback."""
347
+
340
348
  # --- KSP ---
341
349
 
342
350
  KSPRHSFunction = Callable[[KSP, Vec], None]
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: petsc4py
3
- Version: 3.26.0
3
+ Version: 3.26.2
4
4
  Summary: PETSc for Python
5
5
  Home-page: https://gitlab.com/petsc/petsc
6
- Download-URL: https://pypi.io/packages/source/p/petsc4py/petsc4py-3.26.0.tar.gz
6
+ Download-URL: https://pypi.io/packages/source/p/petsc4py/petsc4py-3.26.2.tar.gz
7
7
  Author: Lisandro Dalcin
8
8
  Author-email: dalcinl@gmail.com
9
9
  Maintainer: PETSc Team
@@ -74,5 +74,5 @@ project.
74
74
  J. Roman, K. Rupp, P. Sanan, J Sarich, B. Smith, H. Suh,
75
75
  S. Zampini, H. Zhang, and H. Zhang, J. Zhang,
76
76
  *PETSc/TAO Users Manual*, ANL-21/39 - Revision 3.26, 2026.
77
- https://doi.org/10.2172/2998643,
77
+ https://doi.org/10.2172/17154913,
78
78
  https://petsc.org/release/docs/manual/manual.pdf
@@ -269,6 +269,33 @@ class BaseTestDA:
269
269
  for item in levels:
270
270
  self.assertTrue(isinstance(item, PETSc.DM))
271
271
 
272
+ def testRefineHook(self):
273
+ calls = []
274
+
275
+ def refinehook(coarse, fine, a, c=0):
276
+ calls.append((coarse, fine, a, c))
277
+
278
+ self.da.addRefineHook(refinehook, None, args=('a',), kargs={'c': 1})
279
+ fine = self.da.refine()
280
+ self.assertEqual(calls, [(self.da, fine, 'a', 1)])
281
+ calls.clear()
282
+ fine.destroy()
283
+
284
+ def testInterpolateHook(self):
285
+ calls = []
286
+
287
+ def interphook(coarse, interp, fine, a, c=0):
288
+ calls.append((coarse, interp, fine, a, c))
289
+
290
+ fine = self.da.refine()
291
+ fine.addRefineHook(None, interphook, args=('a',), kargs={'c': 1})
292
+ interp, _ = self.da.createInterpolation(fine)
293
+ self.da.interpolateHooks(interp, fine)
294
+ self.assertEqual(calls, [(self.da, interp, fine, 'a', 1)])
295
+ calls.clear()
296
+ interp.destroy()
297
+ fine.destroy()
298
+
272
299
  def testCreateInterpolation(self):
273
300
  da = self.da
274
301
  if da.dim == 1:
@@ -119,6 +119,27 @@ class TestGCTSSubType(TestGCTS):
119
119
  self.obj.setAppCtx(self.obj)
120
120
 
121
121
 
122
+ class Context:
123
+ def __init__(self, obj):
124
+ self.obj = obj
125
+
126
+
127
+ class TestGarbageCleanupCycle(unittest.TestCase):
128
+ def testNestedContexts(self):
129
+ contexts = []
130
+ obj = PETSc.Vec().create(comm=PETSc.COMM_WORLD)
131
+ for _ in range(3):
132
+ context = Context(obj)
133
+ contexts.append(weakref.ref(context))
134
+ obj = PETSc.Mat().createPython(
135
+ (1, 1), context=context, comm=PETSc.COMM_WORLD
136
+ )
137
+ del context
138
+ del obj
139
+ PETSc.garbage_cleanup(PETSc.COMM_WORLD)
140
+ self.assertTrue(all(context() is None for context in contexts))
141
+
142
+
122
143
  # --------------------------------------------------------------------
123
144
 
124
145
  if __name__ == '__main__':
@@ -1,6 +1,7 @@
1
1
  # --------------------------------------------------------------------
2
2
 
3
3
  from petsc4py import PETSc
4
+ import numpy as np
4
5
  import unittest
5
6
  from sys import getrefcount
6
7
 
@@ -122,6 +123,48 @@ class BaseTestKSP:
122
123
  vec.destroy()
123
124
  A.destroy()
124
125
 
126
+ def testComputeOperator(self):
127
+ ksp = self.ksp
128
+ A = PETSc.Mat().createAIJ([3, 3], nnz=3, comm=ksp.comm)
129
+ A.setValues([0, 1, 2], [0, 1, 2], [[2, -1, 0], [-1, 3, -1], [0, -1, 4]])
130
+ A.assemble()
131
+ ksp.setOperators(A)
132
+ ksp.setUp()
133
+ pc = ksp.getPC()
134
+ x, expected = A.createVecs()
135
+ x.setRandom()
136
+ work = x.duplicate()
137
+ actual = x.duplicate()
138
+ side = ksp.getPCSide()
139
+ if side == PETSc.PC.Side.LEFT:
140
+ A.mult(x, work)
141
+ pc.apply(work, expected)
142
+ elif side == PETSc.PC.Side.RIGHT:
143
+ pc.apply(x, work)
144
+ A.mult(work, expected)
145
+ else:
146
+ pc.applySymmetricRight(x, work)
147
+ A.mult(work, actual)
148
+ pc.applySymmetricLeft(actual, expected)
149
+ for mat_type in (None, PETSc.Mat.Type.DENSE, PETSc.Mat.Type.AIJ):
150
+ with self.subTest(mat=mat_type):
151
+ op = ksp.computeOperator(mat_type)
152
+ self.assertEqual(op.getSize(), A.getSize())
153
+ expected_type = mat_type or 'dense'
154
+ self.assertTrue(op.getType().endswith(expected_type))
155
+ self.assertEqual(op.getRefCount(), 1)
156
+ op.mult(x, actual)
157
+ actual.axpy(-1, expected)
158
+ relative_error = actual.norm() / expected.norm()
159
+ self.assertLess(relative_error, 10 * np.finfo(PETSc.RealType).eps)
160
+ op.destroy()
161
+ actual.destroy()
162
+ work.destroy()
163
+ expected.destroy()
164
+ x.destroy()
165
+ pc.destroy()
166
+ A.destroy()
167
+
125
168
  def testSolve(self, solve_only=False):
126
169
  A = PETSc.Mat().create(PETSc.COMM_SELF)
127
170
  A.setSizes([3, 3])
@@ -296,6 +296,53 @@ class BaseTestMatAnyAIJ:
296
296
  self.assertTrue(np.allclose(aj[ai[i] : ai[i + 1]], cols))
297
297
  self.assertTrue(np.allclose(av[ai[i] : ai[i + 1]], vals))
298
298
 
299
+ def _get_values_csr(self):
300
+ if 'sbaij' in self.A.getType():
301
+ opt = PETSc.Mat.Option.GETROW_UPPERTRIANGULAR
302
+ self.A.setOption(opt, True)
303
+ return self.A.getValuesCSR()
304
+
305
+ def _assemble_with_small_entries(self):
306
+ if self.A.getType() == PETSc.Mat.Type.IS:
307
+ self.skipTest('MATIS does not support MatGetRow()')
308
+ tol = 50 * np.finfo(PETSc.RealType).eps
309
+ self.vals[::2] = 0.1 * tol
310
+ self._preallocate()
311
+ self._set_values_ijv()
312
+ self.A.assemble()
313
+ return tol, self._get_values_csr()
314
+
315
+ def testChop(self):
316
+ tol, (_, aj, av) = self._assemble_with_small_entries()
317
+ self.A.chop(tol)
318
+ _, aj2, av2 = self._get_values_csr()
319
+ self.assertTrue(np.array_equal(aj, aj2))
320
+ self.assertTrue(np.allclose(av2, np.where(abs(av) > tol, av, 0)))
321
+
322
+ def testFilter(self):
323
+ tol, (_, aj, av) = self._assemble_with_small_entries()
324
+ self.A.filter(tol)
325
+ _, aj2, av2 = self._get_values_csr()
326
+ self.assertTrue(np.array_equal(aj, aj2))
327
+ self.assertTrue(np.allclose(av2, np.where(abs(av) > tol, av, 0)))
328
+
329
+ def testFilterCompress(self):
330
+ if 'crl' in self.A.getType():
331
+ self.skipTest('AIJCRL does not support compressing the pattern')
332
+ tol, (_, aj, av) = self._assemble_with_small_entries()
333
+ self.A.filter(tol, compress=True)
334
+ _, aj2, av2 = self._get_values_csr()
335
+ self.assertTrue(np.array_equal(aj2, aj[abs(av) > tol]))
336
+ self.assertTrue(np.allclose(av2, av[abs(av) > tol]))
337
+
338
+ def testEliminateZeros(self):
339
+ tol, (_, aj, av) = self._assemble_with_small_entries()
340
+ self.A.chop(tol)
341
+ self.A.eliminateZeros()
342
+ _, aj2, av2 = self._get_values_csr()
343
+ self.assertTrue(np.array_equal(aj2, aj[abs(av) > tol]))
344
+ self.assertTrue(np.allclose(av2, av[abs(av) > tol]))
345
+
299
346
  def testConvertToSAME(self):
300
347
  self._preallocate()
301
348
  self._set_values_ijv()