Skip to main content

A wrapper for the MEPACK (Matrix Equation Package) library

Project description

python-mepack (pyMEPACK)

Version: 1.1.1

Copyright 2023-2024 by Martin Köhler, MPI-Magdeburg

Description

Python Interface for MEPACK

  • a Fortran software library for the solution of dense Sylvester-like matrix equations.

The pyMEPACK interfaces routines solving the following equations:

  • Standard Lyapunov equations (gelyap) $AX + XA^T = Y$
  • Standard Stein (Discrete-Time Lyapunov) equations (gestein)$AXA^T - X = Y$
  • Generalized Lyapunov equations (gglyap) $AXB^T + BXA^T = Y$
  • Generalized Stein (Discrete-Time Lyapunov) Equation (ggstein) $AXA^T - BXB^T = Y$
  • Standard Sylvester equations (gesylv) $AX + XB = Y$
  • Discrete-time Sylvester equations (gesylv2) $AXB + X = Y$
  • Generalized Sylvester equations (ggsylv) $AXB + CXD = Y$
  • Generalized coupled Sylvester equations (ggcsylv) $AR + LB = E, CR + LD = F$
  • Dual generalized coupled Sylvester equations (ggcsylv_dual) $AR + CL = E, RB + LD = F$

The library includes single and double precision solvers with iterative refinement for the above equations.

Dependencies

To install and run pyMEPACK the following components are required:

  • MEPACK Version 1.1.1
  • a BLAS and LAPACK implementation
  • Python 3.7.0 +
  • Cython 0.29.28 +
  • numpy 1.20.3 +
  • scipy 1.5.4 +
  • setuptools 59.0.0 +
  • configparser 5.2.0 +
  • parameterized 0.8.0 + (only for tests)
  • h5py 3.6.0 + (only for benchmarks)
  • slycot 0.4.0 (only for benchmarks)
  • Sphinx 5.0.2 + (for documentation)

Installation

pyMEPACK requires MEPACK to be installed on your system. See MEPACK's installation guide for detail (https://gitlab.mpi-magdeburg.mpg.de/software/mepack-release/-/blob/master/doc/install.md?ref_type=heads).

If MEPACK is not installed in a default location or the BLAS and LAPACK library are not named blas and lapack the pymepack.cfg file can be used to setup these differences. See pymepack.cfg-sample for details.

The installation of pyMEPACK is done by executing the following commands in the root directory of the project:

pip install .

or

pip install --user .

After a successful installation, pyMEPACK can be imported via import pymepack.

Documentation

Documentation of the pyMEPACK functions is accessible in the form of __doc__ strings.

HTML Documentation can be build with Sphinx inside the docs directory:

(cd ./docs && make html)

How to use pyMEPACK

The interface of pyMEPACK is very concise and easy to work with. The following code snippet solves a Lyapunov equation and computes the relative residual of the solution.

#!/usr/bin/env python3

import pymepack as pme
import numpy as np
import scipy as sp

n = 1000

# Prepare
A = np.triu(np.ones((n,n))) + np.diag(np.ones((n)))
X = np.ones((n,n))
Y = A @ X + X @ A.conj().T

# Solve
Xcomp, *_ = pme.gelyap(A, Y)

# Compute the residual
RelRes = pme.res_gelyap(A, Xcomp, Y)

print("Size = {:d} RelRes = {:e}".format(n, RelRes))

Testing

pyMEPACK contains a test suite. This is executed via

(cd /tmp && python3 -m unittest -v pymepack.tests)

The test suite cannot run from the root of source code after installation.

Test data

gelyap , gglyap , gestein and ggstein solvers, as well as their respective versions with iterative refinement are tested on examples provided in SLICOT benchmark collections, namely BB03AD and BB04AD [1,2].

All the Sylvester solvers are tested using randomization. We use numpy.random module and supply the random generator with a seed to avoid build instability. Last tested with numpy.version = 1.24.1. The non-symmetric stable matrices are constructed as in the example 4.1 in [1].

Tuning and Benchmarks

See Benchmark and Tuning.

License

pyMEPACK, like MEPACK it self, is license under GPLv3.

Authors

  • Martin Köhler, MPI Magdeburg
  • Aleksey Maleyko, MPI Magdeburg

Citation

Martin Köhler. (2024). MEPACK: Matrix Equation PACKage (1.1.1). Zenodo. https://doi.org/10.5281/zenodo.10568848

References

[1] Benner, P., 2004. Factorized solution of Sylvester equations with applications in control. sign (H), 1, p.2.

[2] D. Kressner, V. Mehrmann, and T. Penzl. CTLEX - a Collection of Benchmark Examples for Continuous-Time Lyapunov Equations. SLICOT Working Note 1999-6, 1999.

[3] D. Kressner, V. Mehrmann, and T. Penzl. DTLEX - a Collection of Benchmark Examples for Discrete-Time Lyapunov Equations. SLICOT Working Note 1999-7, 1999.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymepack-1.1.1.post3.tar.gz (980.5 kB view details)

Uploaded Source

Built Distributions

pymepack-1.1.1.post3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.2 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

pymepack-1.1.1.post3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.2 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pymepack-1.1.1.post3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pymepack-1.1.1.post3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pymepack-1.1.1.post3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pymepack-1.1.1.post3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pymepack-1.1.1.post3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

File details

Details for the file pymepack-1.1.1.post3.tar.gz.

File metadata

  • Download URL: pymepack-1.1.1.post3.tar.gz
  • Upload date:
  • Size: 980.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for pymepack-1.1.1.post3.tar.gz
Algorithm Hash digest
SHA256 0411270393131590c89e3181958c33a443ade33106ca56a2b3e2c3aa71222338
MD5 f6fe300a26908b43d0f511b2073d47a4
BLAKE2b-256 a73652ed51e1a7de8cbf043848f3ef5711a9035c73a0454c9caa9a960763f2ad

See more details on using hashes here.

File details

Details for the file pymepack-1.1.1.post3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymepack-1.1.1.post3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdb96da8fa9af7a92694ac8ffe33923a2c4ccbbd58e28c6da2ded43c42f764cd
MD5 1fc5cac0f2202795cfa022326e297f81
BLAKE2b-256 9f6711a8516b9b36cbf2426ef9b18e6bd8fad3d8d8964774e15515484ac6d09b

See more details on using hashes here.

File details

Details for the file pymepack-1.1.1.post3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymepack-1.1.1.post3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c232525fa79e778fed436a067c65cbf5ac48ab83018d734f07f96c1c9e43363e
MD5 541fdcee86567e7e4f0e94d740dc8941
BLAKE2b-256 19509a7bf80fd71a8f4a771769810638af3e0050a6635a762ef35d527b7b626f

See more details on using hashes here.

File details

Details for the file pymepack-1.1.1.post3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymepack-1.1.1.post3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 752dc79cb8cb51c21762b0135db93c99107f2330ec2d415ee563bf7c778f64a5
MD5 989126d502a65da5e0c0c74295ae1a3f
BLAKE2b-256 6f0b060777af53aa9cb5b3b8abbebb4fcd85768765eb47b9631478b059c83a93

See more details on using hashes here.

File details

Details for the file pymepack-1.1.1.post3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymepack-1.1.1.post3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f795633e794e5eebb44fba1ef9c37c2fb992a3d1164b205aee0bd5a8b17fafcd
MD5 2003accd9b6f5a7c5fef24451b1e1ff6
BLAKE2b-256 923bb3a699fbf997e432397500bf6538b3823edaad782c966a2f2e57fbd4d245

See more details on using hashes here.

File details

Details for the file pymepack-1.1.1.post3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymepack-1.1.1.post3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69b5bece2d760a1b8d319fadb9bf57227a01d0a13d3fe1c8c97bdb875f04d3b5
MD5 29606de2f473b95a7173554acf2a5fbf
BLAKE2b-256 ab6eb68cdae37227c966d17d942bedcf496db5a128f3ee540f966127dd2b6b13

See more details on using hashes here.

File details

Details for the file pymepack-1.1.1.post3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymepack-1.1.1.post3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ee7fcd87d5ea4cc80bdca51e3a8af1e66f0fe54bc7e80fedd6ca6f24d33ea01e
MD5 21f8ecacd81cec729b1539bd11692767
BLAKE2b-256 ccf2d8c84bf063861f981d5468b6fd2ec0b5442afcfbe72a28ef3b22cfa63c18

See more details on using hashes here.

File details

Details for the file pymepack-1.1.1.post3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymepack-1.1.1.post3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cffc17c475566df7cb51658281d979fff72fc4c758d9a51539775b86e486efb5
MD5 58546ba03d465d4458624e7956a6d7b9
BLAKE2b-256 661a9d98ba98a41442718c156a6d9375eed4222d73e3cac5908f11c9a5f96a28

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page