Positive-definite Lyapunov Matrix Equation Solvers

Continuous-time Lyapunov Matrix Equations

MatrixEquations.plyapcFunction
U = plyapc(A, B)

Compute U, the upper triangular factor of the solution X = UU' of the continuous Lyapunov equation

  AX + XA' + BB' = 0,

where A is a square real or complex matrix and B is a matrix with the same number of rows as A. A must have only eigenvalues with negative real parts.

U = plyapc(A', B')

Compute U, the upper triangular factor of the solution X = U'U of the continuous Lyapunov equation

  A'X + XA + B'B = 0,

where A is a square real or complex matrix and B is a matrix with the same number of columns as A. A must have only eigenvalues with negative real parts.

Example

julia> using LinearAlgebra

julia> A = [-2. 1.;-1. -2.]
2×2 Array{Float64,2}:
 -2.0   1.0
 -1.0  -2.0

julia> B = [1. 1. ;1. 2.]
2×2 Array{Float64,2}:
 1.0  1.0
 1.0  2.0

julia> U = plyapc(A,B)
2×2 UpperTriangular{Float64,Array{Float64,2}}:
 0.481812  0.801784
  ⋅        0.935414

julia> A*U*U'+U*U'*A'+B*B'
2×2 Array{Float64,2}:
 0.0          8.88178e-16
 8.88178e-16  3.55271e-15
source
U = plyapc(A, E, B)

Compute U, the upper triangular factor of the solution X = UU' of the generalized continuous Lyapunov equation

  AXE' + EXA' + BB' = 0,

where A and E are square real or complex matrices and B is a matrix with the same number of rows as A. The pencil A - λE must have only eigenvalues with negative real parts.

U = plyapc(A', E', B')

Compute U, the upper triangular factor of the solution X = U'U of the generalized continuous Lyapunov equation

  A'XE + E'XA + B'B = 0,

where A and E are square real or complex matrices and B is a matrix with the same number of columns as A. The pencil A - λE must have only eigenvalues with negative real parts.

Example

julia> using LinearAlgebra

julia> A = [-2. 1.;-1. -2.]
2×2 Array{Float64,2}:
 -2.0   1.0
 -1.0  -2.0

julia> E = [1. 0.; 1. 1.]
2×2 Array{Float64,2}:
 1.0  0.0
 1.0  1.0

julia> B = [1. 1. ;1. 2.]
2×2 Array{Float64,2}:
 1.0  1.0
 1.0  2.0

julia> U = plyapc(A,E,B)
2×2 UpperTriangular{Float64,Array{Float64,2}}:
 0.408248  0.730297
  ⋅        0.547723

julia> A*U*U'*E'+E*U*U'*A'+B*B'
2×2 Array{Float64,2}:
  0.0          -8.88178e-16
 -1.33227e-15  -2.66454e-15
source
MatrixEquations.plyapcs!Function
plyapcs!(A,R;adj = false)

Solve the positive continuous Lyapunov matrix equation

            op(A)X + Xop(A)' + op(R)*op(R)' = 0

for X = op(U)*op(U)', where op(K) = K if adj = false and op(K) = K' if adj = true. A is a square real matrix in a real Schur form or a square complex matrix in a complex Schur form and R is an upper triangular matrix. A must have only eigenvalues with negative real parts. R contains on output the solution U.

source
plyapcs!(A,E,R;adj = false)

Solve the generalized positive continuous Lyapunov matrix equation

            op(A)Xop(E)' + op(E)*Xop(A)' + op(R)*op(R)' = 0

for X = op(U)*op(U)', where op(K) = K if adj = false and op(K) = K' if adj = true. The pair (A,E) is in a generalized real/complex Schur form and R is an upper triangular matrix. The pencil A-λE must have only eigenvalues with negative real parts. R contains on output the solution U.

source

Discrete-time Lyapunov (Stein) Matrix Equations

MatrixEquations.plyapdFunction
U = plyapd(A, B)

Compute U, the upper triangular factor of the solution X = UU' of the discrete Lyapunov equation

  AXA' - X + BB' = 0,

where A is a square real or complex matrix and B is a matrix with the same number of rows as A. A must have only eigenvalues with moduli less than one.

U = plyapd(A', B')

Compute U, the upper triangular factor of the solution X = U'U of the discrete Lyapunov equation

  A'XA - X + B'B = 0,

where A is a square real or complex matrix and B is a matrix with the same number of columns as A. A must have only eigenvalues with moduli less than one.

Example

julia> using LinearAlgebra

julia> A = [-0.5 .1;-0.1 -0.5]
2×2 Array{Float64,2}:
 -0.5   0.1
 -0.1  -0.5

julia> B = [1. 1. ;1. 2.]
2×2 Array{Float64,2}:
 1.0  1.0
 1.0  2.0

julia> U = plyapd(A,B)
2×2 UpperTriangular{Float64,Array{Float64,2}}:
 0.670145  1.35277
  ⋅        2.67962

julia> A*U*U'*A'-U*U'+B*B'
2×2 Array{Float64,2}:
 -4.44089e-16  4.44089e-16
  4.44089e-16  1.77636e-15
source
U = plyapd(A, E, B)

Compute U, the upper triangular factor of the solution X = UU' of the generalized discrete Lyapunov equation

  AXA' - EXE' + BB' = 0,

where A and E are square real or complex matrices and B is a matrix with the same number of rows as A. The pencil A - λE must have only eigenvalues with moduli less than one.

U = plyapd(A', E', B')

Compute U, the upper triangular factor of the solution X = U'U of the generalized discrete Lyapunov equation

  A'XA - E'XE + B'B = 0,

where A and E are square real or complex matrices and B is a matrix with the same number of columns as A. The pencil A - λE must have only eigenvalues with moduli less than one.

Example

julia> using LinearAlgebra

julia> A = [-0.5 .1;-0.1 -0.5]
2×2 Array{Float64,2}:
 -0.5   0.1
 -0.1  -0.5

julia> E = [1. 0.; 1. 1.]
2×2 Array{Float64,2}:
 1.0  0.0
 1.0  1.0

julia> B = [1. 1. ;1. 2.]
2×2 Array{Float64,2}:
 1.0  1.0
 1.0  2.0

julia> U = plyapd(A,E,B)
2×2 UpperTriangular{Float64,Array{Float64,2}}:
 1.56276  0.416976
  ⋅       1.34062

julia> A*U*U'*A'-E*U*U'*E'+B*B'
2×2 Array{Float64,2}:
 1.77636e-15  2.22045e-15
 2.22045e-15  2.66454e-15
source
MatrixEquations.plyapds!Function
plyapds!(A, R; adj = false)

Solve the positive discrete Lyapunov matrix equation

            op(A)Xop(A)' - X + op(R)*op(R)' = 0

for X = op(U)*op(U)', where op(K) = K if adj = false and op(K) = K' if adj = true. A is a square real matrix in a real Schur form or a square complex matrix in a complex Schur form and R is an upper triangular matrix. A must have only eigenvalues with moduli less than one. R contains on output the upper triangular solution U.

source
plyapds!(A,E,R;adj = false)

Solve the generalized positive discrete Lyapunov matrix equation

            op(A)Xop(A)' - op(E)Xop(E)' + op(R)*op(R)' = 0

for X = op(U)*op(U)', where op(K) = K if adj = false and op(K) = K' if adj = true. The pair (A,E) of square real or complex matrices is in a generalized Schur form and R is an upper triangular matrix. A-λE must have only eigenvalues with moduli less than one. R contains on output the upper triangular solution U.

source

Schur Form Based Solvers

MatrixEquations.plyapsFunction
U = plyaps(A, B; disc = false)

Compute U, the upper triangular factor of the solution X = UU' of the continuous Lyapunov equation

  AX + XA' + BB' = 0,

where A is a square real or complex matrix in a real or complex Schur form, respectively, and B is a matrix with the same number of rows as A. A must have only eigenvalues with negative real parts. Only the upper Hessenberg part of A is referenced.

U = plyaps(A', B', disc = false)

Compute U, the upper triangular factor of the solution X = U'U of the continuous Lyapunov equation

  A'X + XA + B'B = 0,

where A is a square real or complex matrix in a real or complex Schur form, respectively, and B is a matrix with the same number of columns as A. A must have only eigenvalues with negative real parts. Only the upper Hessenberg part of A is referenced.

U = plyaps(A, B, disc = true)

Compute U, the upper triangular factor of the solution X = UU' of the discrete Lyapunov equation

  AXA' - X + BB' = 0,

where A is a square real or complex matrix in a real or complex Schur form, respectively, and B is a matrix with the same number of rows as A. A must have only eigenvalues with moduli less than one. Only the upper Hessenberg part of A is referenced.

U = plyaps(A', B', disc = true)

Compute U, the upper triangular factor of the solution X = U'U of the discrete Lyapunov equation

  A'XA - X + B'B = 0,

where A is a square real or complex matrix in a real or complex Schur form, respectively, and B is a matrix with the same number of columns as A. A must have only eigenvalues with moduli less than one. Only the upper Hessenberg part of A is referenced.

source
U = plyaps(A, E, B; disc = false)

Compute U, the upper triangular factor of the solution X = UU' of the generalized continuous Lyapunov equation

  AXE' + EXA' + BB' = 0,

where A and E are square real or complex matrices with the pair (A,E) in a generalied real or complex Schur form, respectively, and B is a matrix with the same number of rows as A. The pencil A - λE must have only eigenvalues with negative real parts.

U = plyaps(A', E', B', disc = false)

Compute U, the upper triangular factor of the solution X = U'U of the generalized continuous Lyapunov equation

  A'XE + E'XA + B'B = 0,

where A and E are square real or complex matrices with the pair (A,E) in a generalied real or complex Schur form, respectively, and B is a matrix with the same number of columns as A. The pencil A - λE must have only eigenvalues with negative real parts.

U = plyaps(A, E, B, disc = true)

Compute U, the upper triangular factor of the solution X = UU' of the generalized discrete Lyapunov equation

  AXA' - EXE' + BB' = 0,

where A and E are square real or complex matrices with the pair (A,E) in a generalied real or complex Schur form, respectively, and B is a matrix with the same number of rows as A. The pencil A - λE must have only eigenvalues with moduli less than one.

U = plyaps(A', E', B', disc = true)

Compute U, the upper triangular factor of the solution X = U'U of the generalized discrete Lyapunov equation

  A'XA - E'XE + B'B = 0,

where A and E are square real or complex matrices with the pair (A,E) in a generalied real or complex Schur form, respectively, and B is a matrix with the same number of columns as A. The pencil A - λE must have only eigenvalues with moduli less than one.

source