MEPACK - Matrix Equations Package

MEPACK is a software library focused on solving dense Sylvester-like matrix equations. The library is written in Fortran and provides interfaces for C, MATLAB and GNU Octave. The development places great emphasis on the fact that the algorithms can be adapted very well to modern CPU architectures by current Fortran compilers. In addition, the algorithms are accelerated through the use of directed acyclic graphs using OpenMP to increase the utility of multicore architectures.


The solution of Sylvester-like matrix equations is a computational though task. A straight forward approach like using the equivalent standard linear systems leads to unacceptable runtimes even for small-scale problems. Avoiding this, MEPACK used the approach presented by Bartel and Stewart and extends it to a larger class of Sylvester-like equations. Furthermore, the original approach is transformed in to a block (or BLAS level-3) algorithms, which are able to achieve a better utilization of current CPUs. Since  the number of CPU-cores increased over the years, using the parallelization capabilities provided by BLAS (Basic Linear Algebra Subroutines) library are not sufficient any longer. MEPACK overcomes this issue by providing parallelized algorithms using a directed acyclic graph scheduling approach. This is implemented using OpenMP 4 statements, which allows the library to be used without special runtime environments. In order to improve the accuracy in ill-conditioned problems, MEPACK implementents the iterative refinement technique for all supported equations.



Supported Equations:

  • standard Sylvester equations: AX + XB = Y
  • discrete-time Sylvester equations: AXB + X = Y
  • Lyapunov equations: AX + AXT = Y
  • Stein equations: AXAT - X = Y
  • generalized Sylvester equations: AXB + CXD = Y
  • generalized Lyapunov equations: AXBT + BXAT = Y
  • generalized Stein equations: AXAT - BXBT = Y
  • generalized coupled Sylvester equations: (AR + LB = E, CR + LD = F)
  • dual generalized coupled Syvester equations: (AR + CL = E, RB + LD = F)

Algorithmic Features:

  • optimized BLAS level-2 solvers for problems smaller than 128x128
  • support the compiler's optimization through: local copies, vector-notation, intrisic functions
  • overhead reduction through inlining BLAS level-1 and level-2 function calls
  • OpenMP 4 enabled block algorithms with directed acyclic graph scheduling for multi-core CPUs



MEPACK 1.1.1 was released on January 26th, 2024.

Source Code, Documentation, Pre-Compiled MATLAB and Octave interfaces are available at:

Python Interface

With pyMEPACK we provide a Python interface for MEPACK. The interface is compatible to NumPy and SciPy.

The interface is available from or can be installed from pypi:

pip install pymepack




Go to Editor View