Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pymepack binding for gem #2166

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Prevent git from showing duplicate names with commands like "git shortlog" (see docs/RELEASE_CHECKLIST.md)
Aleksey Maleyko <maleyko@mpi-magdeburg.mpg.de>
Aleksey Maleyko <maleyko@mpi-magdeburg.mpg.de> <alexeymaleyko@gmail.com>
Aleksey Maleyko <maleyko@mpi-magdeburg.mpg.de> almalejko <133660027+almalejko@users.noreply.github.com>
Alexandre Pasco <103425970+alexandre-pasco@users.noreply.github.com>
Art Pelling <a.pelling@tu-berlin.de> <account@artpelling.de>
Art Pelling <a.pelling@tu-berlin.de> Art J. R. Pelling <a.pelling@tu-berlin.de>
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ CI_EXTRAS= \
--extra tests \
--extra ann \
--extra slycot \
--extra pymepack \
--extra ipyparallel \
--extra mpi \
--extra gui \
Expand Down Expand Up @@ -100,7 +101,7 @@ CONDA_EXTRAS = \
--extras gui \
--extras jupyter \
--extras vtk
# dune, ngsolve, scikit-fem (no recent version) not available as conda-forge packages
# pymepack, dune, ngsolve, scikit-fem (no recent version) not available as conda-forge packages
# pytorch not available for win64
# docs-additional not needed
# gmsh is incompatible with pyside6>=6.4.3 needed for windows ci not to hang
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies = [
"pillow",
"pygments",
"qtpy>=2.3.1",
"scipy>=1.5.4",
"scipy>=1.6.0",
"typer",
]

Expand Down Expand Up @@ -76,11 +76,15 @@ dev = [
ann = [
"torch>=1.11.0",
]
# dense matrix equation solver for system-theoretic methods and H-infinity norm calculation
# dense matrix equation solvers for system-theoretic methods and H-infinity norm calculation
# requires OpenBLAS headers and a Fortran compiler
slycot = [
"slycot>=0.5.4",
]
# dense matrix equation solvers
pymepack = [
"pymepack>=1.1.1.post2",
]
# parallelization of some MOR algorithms (e.g. greedy search) using ipyparallel
ipyparallel = [
"ipyparallel>=6.2.5",
Expand Down Expand Up @@ -130,7 +134,7 @@ scikit-fem = [
# # Meta dependencies
# install all optional dependencies, except those requiring a compiler toolchain to build
full = [
"pymor[docs_additional,tests,dev,ann,ipyparallel,gui,jupyter,vtk,gmsh,dune,ngsolve,scikit-fem]",
"pymor[docs_additional,tests,dev,ann,pymepack,ipyparallel,gui,jupyter,vtk,gmsh,dune,ngsolve,scikit-fem]",
]
# install all optional dependencies, including those requiring a compiler toolchain to build
full-compiled = [
Expand Down
8 changes: 7 additions & 1 deletion requirements-ci-current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --extra-index-url=https://download.pytorch.org/whl/cpu --extra=ann --extra=docs-additional --extra=gmsh --extra=gui --extra=ipyparallel --extra=jupyter --extra=mpi --extra=ngsolve --extra=scikit-fem --extra=slycot --extra=tests --extra=vtk --output-file=requirements-ci-current.txt --resolver=backtracking
# pip-compile --extra-index-url=https://download.pytorch.org/whl/cpu --extra=ann --extra=docs-additional --extra=gmsh --extra=gui --extra=ipyparallel --extra=jupyter --extra=mpi --extra=ngsolve --extra=pymepack --extra=scikit-fem --extra=slycot --extra=tests --extra=vtk --output-file=requirements-ci-current.txt --resolver=backtracking
#
--extra-index-url https://download.pytorch.org/whl/cpu

Expand Down Expand Up @@ -329,6 +329,7 @@ numpy==1.26.4
# matplotlib
# meshio
# pyevtk
# pymepack
# pymor (pyproject.toml)
# scikit-fem
# scipy
Expand All @@ -349,6 +350,8 @@ packaging==23.2
# sphinx
pandocfilters==1.5.1
# via nbconvert
parameterized==0.9.0
# via pymepack
parso==0.8.3
# via jedi
pexpect==4.9.0
Expand Down Expand Up @@ -400,6 +403,8 @@ pygments==2.17.2
# pymor (pyproject.toml)
# rich
# sphinx
pymepack==1.1.1.post2
# via pymor (pyproject.toml)
pyopengl==3.1.7
# via pymor (pyproject.toml)
pyparsing==3.1.1
Expand Down Expand Up @@ -481,6 +486,7 @@ scikit-fem==9.0.1
# via pymor (pyproject.toml)
scipy==1.12.0
# via
# pymepack
# pymor (pyproject.toml)
# scikit-fem
send2trash==1.8.2
Expand Down
8 changes: 7 additions & 1 deletion requirements-ci-oldest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --extra-index-url=https://download.pytorch.org/whl/cpu --extra=ann --extra=docs-additional --extra=dune --extra=gmsh --extra=gui --extra=ipyparallel --extra=jupyter --extra=mpi --extra=ngsolve --extra=scikit-fem --extra=slycot --extra=tests --extra=vtk --output-file=requirements-ci-oldest.txt --resolver=backtracking pyproject.toml requirements-ci-oldest-pins.in
# pip-compile --extra-index-url=https://download.pytorch.org/whl/cpu --extra=ann --extra=docs-additional --extra=dune --extra=gmsh --extra=gui --extra=ipyparallel --extra=jupyter --extra=mpi --extra=ngsolve --extra=pymepack --extra=scikit-fem --extra=slycot --extra=tests --extra=vtk --output-file=requirements-ci-oldest.txt --resolver=backtracking pyproject.toml requirements-ci-oldest-pins.in
#
--extra-index-url https://download.pytorch.org/whl/cpu

Expand Down Expand Up @@ -354,6 +354,7 @@ numpy==1.20.3
# matplotlib
# meshio
# pyevtk
# pymepack
# pymor (pyproject.toml)
# scikit-fem
# scipy
Expand All @@ -374,6 +375,8 @@ packaging==23.2
# sphinx
pandocfilters==1.5.1
# via nbconvert
parameterized==0.9.0
# via pymepack
parso==0.8.3
# via jedi
pexpect==4.9.0
Expand Down Expand Up @@ -429,6 +432,8 @@ pygments==2.17.2
# pymor (pyproject.toml)
# rich
# sphinx
pymepack==1.1.1.post2
# via pymor (pyproject.toml)
pyopengl==3.1.7
# via pymor (pyproject.toml)
pyparsing==3.1.1
Expand Down Expand Up @@ -516,6 +521,7 @@ scipy==1.6.0
# via
# -r requirements-ci-oldest-pins.in
# dune-xt
# pymepack
# pymor (pyproject.toml)
# scikit-fem
send2trash==1.8.2
Expand Down
35 changes: 25 additions & 10 deletions src/pymor/algorithms/lyapunov.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'cont': FrozenDict(
{
'sparse': 'lradi',
'dense': 'slycot' if config.HAVE_SLYCOT else 'scipy',
'dense': 'slycot' if config.HAVE_SLYCOT else 'pymepack' if config.HAVE_PYMEPACK else 'scipy',
}
),
'disc': FrozenDict({'dense': 'slycot' if config.HAVE_SLYCOT else 'scipy'}),
Expand Down Expand Up @@ -74,6 +74,7 @@ def solve_cont_lyap_lrcf(A, E, B, trans=False, options=None,

1. `slycot` (see :func:`pymor.bindings.slycot.solve_lyap_lrcf`),
2. `scipy` (see :func:`pymor.bindings.scipy.solve_lyap_lrcf`).
3. `pymepack` (see :func:`pymor.bindings.pymepack.solve_lyap_lrcf`),

Parameters
----------
Expand All @@ -92,11 +93,12 @@ def solve_cont_lyap_lrcf(A, E, B, trans=False, options=None,
- :func:`pymor.algorithms.lradi.lyap_lrcf_solver_options`,
- :func:`pymor.bindings.scipy.lyap_lrcf_solver_options`,
- :func:`pymor.bindings.slycot.lyap_lrcf_solver_options`,
- :func:`pymor.bindings.pymepack.lyap_lrcf_solver_options`.

default_sparse_solver_backend
Default sparse solver backend to use (lradi).
default_dense_solver_backend
Default dense solver backend to use (slycot, scipy).
Default dense solver backend to use (slycot, scipy, pymepack).

Returns
-------
Expand All @@ -118,6 +120,8 @@ def solve_cont_lyap_lrcf(A, E, B, trans=False, options=None,
from pymor.bindings.slycot import solve_lyap_lrcf as solve_lyap_impl
elif backend == 'lradi':
from pymor.algorithms.lradi import solve_lyap_lrcf as solve_lyap_impl
elif backend == 'pymepack':
from pymor.bindings.pymepack import solve_lyap_lrcf as solve_lyap_impl
else:
raise ValueError(f'Unknown solver backend ({backend}).')
return solve_lyap_impl(A, E, B, trans=trans, cont_time=True, options=options)
Expand Down Expand Up @@ -159,7 +163,8 @@ def solve_disc_lyap_lrcf(A, E, B, trans=False, options=None,
availability in the following order:

1. `slycot` (see :func:`pymor.bindings.slycot.solve_lyap_lrcf`),
2. `scipy` (see :func:`pymor.bindings.scipy.solve_lyap_lrcf`).
2. `pymepack` (see :func:`pymor.bindings.pymepack.solve_lyap_lrcf`),
3. `scipy` (see :func:`pymor.bindings.scipy.solve_lyap_lrcf`).

Parameters
----------
Expand All @@ -176,10 +181,11 @@ def solve_disc_lyap_lrcf(A, E, B, trans=False, options=None,
See:

- :func:`pymor.bindings.scipy.lyap_lrcf_solver_options`,
- :func:`pymor.bindings.slycot.lyap_lrcf_solver_options`.
- :func:`pymor.bindings.slycot.lyap_lrcf_solver_options`,
- :func:`pymor.bindings.pymepack.lyap_lrcf_solver_options`.

default_dense_solver_backend
Default dense solver backend to use (slycot, scipy).
Default dense solver backend to use (slycot, pymepack, scipy).

Returns
-------
Expand All @@ -196,6 +202,8 @@ def solve_disc_lyap_lrcf(A, E, B, trans=False, options=None,
from pymor.bindings.scipy import solve_lyap_lrcf as solve_lyap_impl
elif backend == 'slycot':
from pymor.bindings.slycot import solve_lyap_lrcf as solve_lyap_impl
elif backend == 'pymepack':
from pymor.bindings.pymepack import solve_lyap_lrcf as solve_lyap_impl
else:
raise ValueError(f'Unknown solver backend ({backend}).')
return solve_lyap_impl(A, E, B, trans=trans, cont_time=False, options=options)
Expand Down Expand Up @@ -250,6 +258,7 @@ def solve_cont_lyap_dense(A, E, B, trans=False, options=None,

1. `slycot` (see :func:`pymor.bindings.slycot.solve_lyap_dense`)
2. `scipy` (see :func:`pymor.bindings.scipy.solve_lyap_dense`)
3. `pymepack` (see :func:`pymor.bindings.pymepack.solve_lyap_dense`)

Parameters
----------
Expand All @@ -267,9 +276,10 @@ def solve_cont_lyap_dense(A, E, B, trans=False, options=None,

- :func:`pymor.bindings.scipy.lyap_dense_solver_options`,
- :func:`pymor.bindings.slycot.lyap_dense_solver_options`,
- :func:`pymor.bindings.pymepack.lyap_dense_solver_options`.

default_solver_backend
Default solver backend to use (slycot, scipy).
Default solver backend to use (slycot, scipy, pymepack).

Returns
-------
Expand All @@ -286,6 +296,8 @@ def solve_cont_lyap_dense(A, E, B, trans=False, options=None,
from pymor.bindings.scipy import solve_lyap_dense as solve_lyap_impl
elif backend == 'slycot':
from pymor.bindings.slycot import solve_lyap_dense as solve_lyap_impl
elif backend == 'pymepack':
from pymor.bindings.pymepack import solve_lyap_dense as solve_lyap_impl
else:
raise ValueError(f'Unknown solver backend ({backend}).')
return solve_lyap_impl(A, E, B, trans=trans, cont_time=True, options=options)
Expand Down Expand Up @@ -325,7 +337,8 @@ def solve_disc_lyap_dense(A, E, B, trans=False, options=None,
availability in the following order:

1. `slycot` (see :func:`pymor.bindings.slycot.solve_lyap_dense`)
2. `scipy` (see :func:`pymor.bindings.scipy.solve_lyap_dense`)
2. `pymepack` (see :func:`pymor.bindings.pymepack.solve_lyap_dense`)
3. `scipy` (see :func:`pymor.bindings.scipy.solve_lyap_dense`)

Parameters
----------
Expand All @@ -343,10 +356,11 @@ def solve_disc_lyap_dense(A, E, B, trans=False, options=None,
See:

- :func:`pymor.bindings.scipy.lyap_dense_solver_options`,
- :func:`pymor.bindings.slycot.lyap_dense_solver_options`.
- :func:`pymor.bindings.slycot.lyap_dense_solver_options`,
- :func:`pymor.bindings.pymepack.lyap_dense_solver_options`.

default_solver_backend
Default solver backend to use (slycot, scipy).
Default solver backend to use (slycot, pymepack, scipy).

Returns
-------
Expand All @@ -363,6 +377,8 @@ def solve_disc_lyap_dense(A, E, B, trans=False, options=None,
from pymor.bindings.scipy import solve_lyap_dense as solve_lyap_impl
elif backend == 'slycot':
from pymor.bindings.slycot import solve_lyap_dense as solve_lyap_impl
elif backend == 'pymepack':
from pymor.bindings.pymepack import solve_lyap_dense as solve_lyap_impl
else:
raise ValueError(f'Unknown solver backend ({backend}).')
return solve_lyap_impl(A, E, B, trans=trans, cont_time=False, options=options)
Expand All @@ -381,7 +397,6 @@ def _solve_lyap_dense_check_args(A, E, B, trans):
assert A.ndim == 2
assert not trans and B.shape[0] == A.shape[0] or trans and B.shape[1] == A.shape[0]


def _chol(A):
"""Cholesky decomposition.

Expand Down
Loading
Loading