Skip to contents

Introduction

This vignette provides technical implementation details and mathematical theory underlying the rationalmatrices package. It complements the main user guide (Rational Matrices vignette) with in-depth coverage of algorithms, numerical methods, and theoretical foundations.

Topics covered:

  • Left Coprime Polynomials - Part of Analysis & Properties (#5)
  • Column Reduced Matrix - Supporting theory for Normal Forms (#4)
  • Realization Algorithms - Deep dive into Realization Algorithms (#2)
  • Operations with State-Space Realizations - Theory for State-Space Tools (#6)
  • Schur, QZ, Lyapunov - Numerical Methods (#7)
  • Reflect Poles and Zeroes - Theory for Pole/Zero Reflection (#8)

For implementation details of these topics, see the source files listed in CLAUDE.md and the main vignette.


Left Coprime Polynomials

Functional Area: Analysis & Properties (#5)

See R/is_methods.R for implementation.

A polynomial matrix cc is called left prime, if c(z)c(z) has full row rank everywhere in the complex plane. Clearly this implies that cc is square or “wide”, i.e. if cc is (m×n)(m \times n)-dimensional then mnm \leq n must hold.

A pair (a,b)(a,b) of (compatible) polynomial matrices is called left coprime if the matrix c=[a,b]c=[a,b] is left prime. This case is important for the structure of left matrix fraction descriptions. Suppose c(z)=a1b(z)c(z)=a^{-1} b(z), where aa is a square, non singular polynomial matrix. If the pair is (a,b)(a,b) is not left coprime, then we may cancel a common, non unimodular, factor and thus obtain a “simpler” representation for c(z)c(z).

We discuss two strategies for testing whether a polynomial matrix is left prime. The first approach uses a Hermite normal form (HNF) and the second one tackles this problem via a (singular) pencil.

The approach via singular pencils is numerically stable and thus is implemented in the function is.coprime(). See also the examples below.

First note that the problem is easy to tackle in the case that cc has degree zero. Here we just have to check the left kernel of the coefficient matrix of z0z^0. Also the case where cc is “tall”, i.e. the number of rows is larger than the number of columns is trivial. In this case cc clearly cannot be left prime, since the rank of c(z)c(z) is smaller than the number of rows for any zz \in \mathbb{C}.

Therefore throughout this section, we assume that cc is an (m×n)(m \times n)-dimensional polynomial matrix with degree p>0p > 0 and mnm \leq n.

Hermite Normal Form

Consider the row Hermite form obtained from elementary column operations c(z)=h(z)u(z)=h1(z)u1(z) c(z) = h(z) u(z) = h_1(z) u_1(z) where uu is an (n×n)(n \times n)-dimensional unimodular modular matrix, hh is an (m×n)(m \times n)-dimensional lower (quasi) triangular matrix.

The (m×m)(m \times m)-dimensional matrix h1h_1 is obtained from hh by selecting the first mm columns and u1u_1 consists of the first mm rows of uu. Note that h1h_1 is a square, lower triangular matrix, where the diagonal elements are either monic or zero, and if a diagonal element is non zero, then all elements to the left of this element have a lower degree.

Furthermore note that the rank of c(z)c(z) is equal to the rank of h1(z)h_1(z) for all zz \in \mathbb{C}. Therefore the rank of c(z)c(z) is less than mm if and only zz is a zero of the product of the diagonal entries: h11h22hmmh_{11} h_{22} \cdots h_{mm}. The following cases may occur

  1. All diagonal elements hiih_{ii} are constant (and hence h1=Imh_1 = I_m must hold). In this case rk(c(z))=m\mbox{rk}(c(z))=m for all zz\in \mathbb{C} and thus cc is coprime.
  2. One of the diagonal elements is zero: In this case rk(c(z))<m\mbox{rk}(c(z))<m holds for all zz\in \mathbb{C} and thus cc is not coprime.
  3. The diagonal elements are non zero and at least one of them has a degree larger than zero. In this case rk(c(z))=m\mbox{rk}(c(z))=m except for the zeroes of the polynomial (h11h22hmm)(h_{11} h_{22} \cdots h_{mm}). Also in this case, cc is not coprime.

Hence, the polynomial cc is left prime if and only if h1=Imh_1 = I_m.

Generalized Pencils

As reference for generalized pencils, see

  • (Gantmacher 1959, vol. 2, chap. XII (in particular §4 on page 35ff))
  • (Kailath 1980, 393ff)
  • (Demmel and Kågström 1993)

We first construct a pencil P(z)=(ABz)P(z)=(A-Bz) such that for any zz \in \mathbb{C} the left kernel of c(z)c(z) and of P(z)P(z) have the same dimension. This means that cc is left prime if and only if PP is left prime. Furthermore the zeroes of PP and of cc are the same.

The condition uc(z)=u(c0+c1z++cpzp)=0 u c(z) = u (c_0 + c_1 z + \cdots + c_p z^p) = 0 for zz \in \mathbb{C} and u1×m,u0u \in \mathbb{C}^{1 \times m}, u \neq 0 is equivalent to the condition that (v1,v2,,vp)(c0000In0000In)=(v1,v2,,vp)(c1cp1cpIn000In0)z (v_1,v_2,\ldots,v_p) \begin{pmatrix} c_0 & 0 & \cdots & 0 \\ 0 & I_{n} & \cdots & 0 \\ 0 & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & I_{n} \\ \end{pmatrix} = (v_1,v_2,\ldots,v_p) \begin{pmatrix} -c_1 & \cdots & -c_{p-1} & -c_p \\ I_{n} & \cdots & 0 & 0 \\ \vdots & \ddots & \vdots & \vdots \\ 0 & \cdots & I_{n} & 0 \end{pmatrix} z for v11×mv_1 \in \mathbb{C}^{1 \times m}, v10v_1 \neq 0 and vj1×nv_j\in \mathbb{C}^{1\times n} for i=2,,pi=2,\ldots ,p. This follows immediately be rewriting the above condition as v2z=v1c0+v1c1z=v1(c0+c1z)v3z2=(v2+v1c2z)z=v1(c0+c1z+c2z2)v4z3=(v3+v1c3z)z2=v1(c0+c1z+c2z2+c3z3)vpzp1=v1(c0+c1z++cp1zp1)v1cpzp=vpzp1 \begin{array}{rcl} v_2 z &=& v_1 c_0 + v_1 c_1 z = v_1 (c_0 + c_1 z) \\ v_3 z^2 &=& (v_2 + v_1 c_2 z) z = v_1 (c_0 + c_1 z + c_2 z^2) \\ v_4 z^3 &=& (v_3 + v_1 c_3 z) z^2 = v_1 (c_0 + c_1 z + c_2 z^2 + c_3 z^3) \\ & \vdots & \\ v_p z^{p-1} &=& v_1 (c_0 + c_1 z + \cdots + c_{p-1} z^{p-1}) \\ -v_1 c_p z^p &=& v_p z^{p-1} \end{array} see also Kailath (1980), page 393ff. Combining the last two equations gives 0=vpzp1+v1cpzp=v1(c0+c1z++cpzp). 0 = v_pz^{p-1} + v_1 c_p z^p = v_1 (c_0 + c_1 z + \cdots + c_{p} z^{p}).

Therefore the matrix c(z)c(z) has a non trivial left kernel if and only if the pencil P(z)=(ABz)P(z) = (A - Bz),
A=(c0000In0000In),B=(c1cp1cpIn000In0), A = \begin{pmatrix} c_0 & 0 & \cdots & 0 \\ 0 & I_{n} & \cdots & 0 \\ 0 & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & I_{n} \\ \end{pmatrix}, \quad B = \begin{pmatrix} -c_1 & \cdots & -c_{p-1} & -c_p \\ I_{n} & \cdots & 0 & 0 \\ \vdots & \ddots & \vdots & \vdots \\ 0 & \cdots & I_{n} & 0 \end{pmatrix}, has a non trivial left kernel. This implies cc is left prime if and only if PP is left prime.

Staircase Form

In order to analyze the left kernel this pencil, we transform the pencil (by multiplication with orthogonal matrices from the left and the right) into a so called staircase form. To simplify notation we set M=(m+n(p1))M=(m+n(p-1)) and N=npN = np, i.e. (M,N)(M,N) now denotes the dimension of the pencil P(z)P(z). Note that MN=mn0M-N = m-n \neq 0 in general, which means that we have to deal with non regular pencils.

The procedure described below works for an arbitary pencil, i.e. we do not impose the above special structure and we also consider the case M>NM>N.

  1. If the pencil P(z)=(ABz)P(z) = (A-Bz) is “tall”, i.e. M>NM > N, then P(z)P(z) has a non trivial left kernel for all zz \in \mathbb{C}.
    In this case PP (and the matrix cc) is not left prime.

  2. If the pencil P(z)=(ABz)P(z)=(A-Bz) is square, i.e. M=NM=N, and BB is non singular, then the zeroes of the pencil P(z)P(z) (and the zeroes of c(z)c(z)) are the eigenvalues of the matrix AB1AB^{-1}.
    In this case PP (and the matrix cc) is not left prime.

Now suppose that the right kernel of BB is N1>0N_1 > 0 dimensional. If N1=NN_1 = N, i.e. if B=0B=0, then two cases may occur:

  1. The matrix AA has full row rank.
    In this case the pencil PP (and the matrix cc) is left prime.
  2. The matrix AA does not have full row rank and hence P(z)P(z) has a non trivial left kernel for all zz \in \mathbb{C}.
    In this case PP (and the matrix cc) is not left prime.

Finally suppose that 0<N1<N0 < N_1 <N holds and let 0M1N10 \leq M_1 \leq N_1 denote the rank of the first N1N_1 columns of AVAV. Then there exists an orthogonal transformation, UU say, such that the first M1M_1 rows of the first N1N_1 columns of UAVU'AV have full rank M1M_1 and the remaining rows are zero.

Using the same symbols for the transformed pencil we get P(z)=(A11A120(MM1)×N1A22)(0M1×N1B120(MM1)×N1B22)z,A11M1×N1. P (z) = \begin{pmatrix} A_{11} & A_{12} \\ 0_{(M-M_1) \times N_1} & A_{22} \end{pmatrix} - \begin{pmatrix} 0_{M_1\times N_1} & B_{12} \\ 0_{(M-M_1) \times N_1} & B_{22} \end{pmatrix}z,\quad A_{11} \in \mathbb{R}^{M_1 \times N_1}. Clearly P(z)P(z) has full row rank if and only if the reduced pencil (A22B22z)(A_{22} - B_{22} z) has full row rank.

Now we iterate this procedure with the reduced pencil (A22B22z)(A_{22} - B_{22}z) until we end up with the following staircase form of the pencil: P(z)=(A11A1,k1A1k0Mk1×N1Ak1,k1Ak1,k0Mk×N10Mk×Nk1Akk)(0M1×N1B1,k1B1,k0Mk1×N10Mk1×Nk1Bk1,k0Mk×N10Mk×Nk1Bkk)z P (z) = \begin{pmatrix} A_{11} & \cdots & A_{1,k-1} & A_{1k} \\ \vdots & \ddots & \vdots & \vdots \\ 0_{M_{k-1} \times N_1} & \cdots & A_{k-1,k-1} & A_{k-1, k}\\ 0_{M_k \times N_1} & \cdots & 0_{M_k \times N_{k-1}} & A_{kk} \\ \end{pmatrix} - \begin{pmatrix} 0_{M_1 \times N_1} & \cdots & B_{1,k-1} & B_{1,k} \\ \vdots & \ddots & \vdots & \vdots \\ 0_{M_{k-1} \times N_1} & \cdots & 0_{M_{k-1} \times N_{k-1}} & B_{k-1,k} \\ 0_{M_k \times N_1} & \cdots & 0_{M_k \times N_{k-1}} & B_{kk} \\ \end{pmatrix} z The diagonal blocks are of dimension (Mi×Ni)(M_i\times N_i). The first (k1)(k-1) diagonal blocks of AA have full row rank (and hence 0MiNi0\leq M_i \leq N_i) and the first (k1)(k-1) diagonal block of BB are zero. Therefore P(z)P(z) has full row rank if and only if the last block (AkkBkkz)(A_{kk} - B_{kk}z) has full row rank. For this last block the following cases may occur:

  1. If (AkkBkk)(A_{kk} - B_{kk}) is “tall” (Mk>NkM_k > N_k), then P(z)P(z) has a non trivial left kernel for all zz \in \mathbb{C}.
    In this case PP (and the matrix cc) is not left prime.
  2. If the pencil (AkkBkk)(A_{kk} - B_{kk}) is square (Mk=NkM_k=N_k) and BkkB_{kk} is non singular, then the zeroes of the pencil P(z)P(z) (and the zeroes of c(z)c(z)) are the eigenvalues of the matrix AkkBkk1A_{kk}B_{kk}^{-1}.
    In this case PP (and the matrix cc) is not left prime.
  3. If BkkB_{kk} is zero and the matrix AA has full row rank, then P(z)P(z) has full row rank for all zz\in \mathbb{C}.
    In this case the pencil PP (and the matrix cc) is left prime.
  4. If BkkB_{kk} is zero and the matrix AA does not have full row rank, then P(z)P(z) has a non trivial left kernel for all zz \in \mathbb{C}.
    In this case PP (and the matrix cc) is not left prime.

The function is.coprime() uses this approach to test wether a polynomial is left prime (or a pair of polynomials is left coprime). In the default case the function just returns a boolean variable. However, if the optional argument only.answer is set to FALSE, then a list is returned which contains the above described staircase form. The list contains the following slots:

answer is TRUE, if the polynomial is prime (the pair is left coprime).
A,B hold the two matrices AA and BB (in staircase form).
m,n are two integer vectors which contain the size of the blocks (Mi)(M_i) and (Ni)(N_i) respectively.
zeroes is a vector which contains the zeroes of the pencil (the polynomial cc). In the (co-)prime case this vector is empty and if PP is rank deficient for all zz \in \mathbb{C} then zeroes = NA_real_.

Examples

We present three examples pertaining to the three different outcomes:

  • coprime polynomial matrices a(z)a(z) and b(z)b(z)
  • non-coprime polynomial matrices with a finite number of common zeros
  • non-coprime polynomial matrices with reduced rank for all zz\in\mathbb{C}

Coprime Polynomials

Two “generic” polynomials are coprime.

# Generate a random (m x m), and a random (m x n) polynomial matrix, with degree p=2
m = 2
n = 3
set.seed(1803)
a = test_polm(dim = c(m,m), degree = 2, digits = 1, random = TRUE)
b = test_polm(dim = c(m,n), degree = 2, digits = 1, random = TRUE)
Hermite Form

The Hermite form of (a(z),b(z))\left( a(z), b(z)\right) is

HNF = hnf(cbind(a,b), from_left = FALSE)
print(HNF$h, digits = 2, format = 'character')
#> ( 2 x 5 ) matrix polynomial with degree <= 0 
#>       [,1]  [,2]  [,3]  [,4]  [,5]
#> [1,]     1     0     0     0     0
#> [2,]     0     1     0     0     0

The square submatrix h1h_1 of the Hermite form hh is equal to the identity matrix, hence (a,b)(a,b) are left coprime.

Pencil

The method using the pencil gives the same answer:

  • There are no common zeros.
  • The polynomial matrices are left coprime.
out = is.coprime(a, b, debug = FALSE, only.answer = FALSE)
cat("The polynomials are left coprime: ", out$answer,"\n", 
    "The zeros of the pencil are: ", out$zeroes, sep = '')
#> The polynomials are left coprime: TRUE
#> The zeros of the pencil are:

Not coprime: Finite Number of Zeros

Here we consider an example where c(z)=[a(z),b(z)]c(z)= [a(z),b(z)] is rank deficient for some (but not all) zz\in \mathbb{C}. We generate these polynomials by multiplying them with a common (matrix) factor. We show that (at least) one singular value of c(z)c(z) evaluated at the zeros of the common factor is zero.

a0 = a
b0 = b

# Generate random common factor  with degree 1
r = test_polm(dim = c(m,m), degree = 1, digits = 1, random = TRUE)

# Generate polynomials with a common factor
a = r %r% a0
b = r %r% b0
c = cbind(a,b)

z_r = zeroes(r)
cat("The zeros of the common factor r(z) are: \n", z_r, "\n\n")
#> The zeros of the common factor r(z) are: 
#>  -0.2051932 5.377607

d = svd(unclass(zvalues(c, z = z_r[1]))[,,1])$d
cat("minimal singular value of c(z_0): ", d[m], sep="")
#> minimal singular value of c(z_0): 1.007532e-16
Hermite Form

The Hermite Form of c(z)=(a(z),b(z))c(z) = (a(z), b(z)) is

HNF = hnf(cbind(a,b), from_left = FALSE)
print(HNF$h, digits = 2, format = 'character')
#> ( 2 x 5 ) matrix polynomial with degree <= 2 
#>               [,1]                [,2]  [,3]  [,4]  [,5]
#> [1,]             1                   0     0     0     0
#> [2,]  2.49 - 0.39z  -1.1 - 5.17z + z^2     0     0     0

We calculate the zeros of c(z)=[a(z),b(z)]c(z)= [a(z),b(z)] by calculating the zeros of the diagonal elements of the square submatrix h1(z)h_1(z). Note that for this example the (1,1)(1,1) element is equal to 11.

The (common) zeros are therefore

zeroes(HNF$h[m,m])
#> [1] -0.2051932  5.3776070

Note that these zeroes are identical to the zeroes of the common factor r(z)r(z).

Pencil

The outcome for the pencil is the same as above.

out = is.coprime(a, b, debug = FALSE, only.answer = FALSE)
cat("The polynomials are left coprime: ", out$answer,"\n", 
    "The zeros of the pencil are: ", out$zeroes, sep = '')
#> The polynomials are left coprime: FALSE
#> The zeros of the pencil are: 5.377607-0.2051932

Not coprime: Everywhere Rank Deficient

Finally let us consider the case, where c(z)=(a(z),b(z))c(z) = (a(z),b(z)) is rank deficient for all zz. We generate a pair of polynomial matrices of this kind by multiplying the two polynomials a(z),b(z)a(z), b(z) (from left) with a singular common factor.

To verify that c(z)c(z) is of reduced row rank for all zz\in\mathbb{C}, we print the singular values of c(z)c(z) at a randomly selected point.

# generate a square polynomial matrix with rank one!
r = test_polm(dim = c(m,1), degree = 1, digits = 1, random = TRUE) %r% 
    test_polm(dim = c(1,m), degree = 1, digits = 1, random = TRUE) 
print(r, format = 'c')
#> ( 2 x 2 ) matrix polynomial with degree <= 2 
#>                         [,1]                     [,2]
#> [1,]   1.36 - 1.43z - 2.1z^2  -0.72 + 2.07z - 1.35z^2
#> [2,]  1.53 + 3.47z + 1.82z^2  -0.81 - 0.36z + 1.17z^2

a = r %r% a0
b = r %r% b0

# Evaluate c(z) = (a(z),b(z)) at a random point z0 and print the corresponding singular values
z0 = complex(real = rnorm(1), imaginary = rnorm(1))
d = svd( unclass(zvalues(cbind(a,b), z = z0))[,,1], nu = 0, nv = 0 )$d

cat("The singular values of c(z) \n evaluated at z0 = ", z0, "\n are: ", d, "\n\n")
#> The singular values of c(z) 
#>  evaluated at z0 =  0.3368112-0.2077692i 
#>  are:  8.087889 6.256749e-16
Hermite Form

The Hermite Form of c(z)=(a(z),b(z))c(z) = (a(z), b(z)) is

HNF = hnf(cbind(a,b), from_left = FALSE)
print(HNF$h, digits = 1, format = 'char')
#> ( 2 x 5 ) matrix polynomial with degree <= 1 
#>              [,1]  [,2]  [,3]  [,4]  [,5]
#> [1,]     -0.5 + z     0     0     0     0
#> [2,]  -0.6 - 0.9z     0     0     0     0

The matrix c(z)c(z) is rank deficient (for all zz) since h[2,2]=0h[2,2] = 0! The procedure hnf returns also an estimate of the rank of c(z)c(z) (when c(z)c(z) is considered as rational matrix). Here we get

cat(HNF$rank,'\n')
#> 1

which again means that c(z)c(z) is rank deficient for all zz \in \mathbb{C}.

Pencil

The result for pencils is the same.

out = is.coprime(a, b, debug = FALSE, only.answer = FALSE)
cat("The polynomials are left coprime: ", out$answer,"\n", 
    "The zeros of the pencil are: ", out$zeroes, sep = '')
#> The polynomials are left coprime: FALSE
#> The zeros of the pencil are: NA

Column Reduced Matrix

Functional Area: Polynomial Manipulation (#4)

See R/polm_methods.R for implementation.

Note: The functions degree (col_end_matrix) and col_reduce use different strategies to compute the column degrees (column end matrix).

  • The first two consider the elements, whereas
  • col_reduce considers the euclidean norm of the respective columns.

Let a(z)=a0+a1z++apzpa(z) = a^0 + a^1 z + \cdots + a^p z^p, ak=(aijk)a^k = (a^k_{ij}) and ajk=(a1jk,,amjk)a^k_j=(a^k_{1j}, \ldots, a^k_{mj})'. The function degree sets the degree of the jj-th column to pjp_j iff aijpj>τa^{p_j}_{ij} > \tau for at least one ii and aijkτa^{k}_{ij} \leq \tau for all ii and k>pjk>p_j. The column end matrix is constructed correspondingly. The function col_reduce sets the degree of the jj-th column to pjp_j iff ajpj>τ\|a^{p_j}_{j}\| > \tau and ajkτ\|a^{k}_{j}\| \leq \tau for all k>pjk>p_j.

Therefore one may get different results!

The basic strategy to construct a column reduced matrix (for the case that a(z)a(z) is square and non singular) is as follows. First permute the columns of a(z)a(z) such that the column degrees p1p2pmp_1 \leq p_2 \leq \cdots \leq p_m are ordered. Now suppose that the kk-th column, ckc_k say, of the column end matrix is linearly dependent from the previous columns (cjc_j, 1j<k1\leq j < k), i.e. ck=α1c1+αk1ck1c_k = \alpha_1 c_1 + \cdots \alpha_{k-1} c_{k-1}. Then we substract from the kk-th column of a(z)a(z), zpkpjαjz^{p_k-p_j}\alpha_j times the jj-th column. This operation reduces the degree of the kk-th column by one.

This procedure is repeated until the column end matrix is regular.

See also Wolovich (1974).

The coefficients αj\alpha_j are determined from an SVD of the column end matrix.

Realization Algorithms

Functional Area: Realization Algorithms (#2)

See R/as_methods.R and related functions like pseries2stsp(), pseries2lmfd() for implementation.

Impulse Response

One of the main features of the rational functions is that the Hankel matrix of the impulse response coefficients has finite rank:

H=(k1k2k2k3) H = \begin{pmatrix} k_1 & k_2 & \cdots \\ k_2 & k_3 & \cdots \\ \vdots & \vdots & \end{pmatrix} Note that the impulse response function is only well defined if the rational matrix has no pole at z=0z=0.

LMFD

We consider a (m,n)(m,n)-dimensional rational matrix in LMFD form k(z)=a1(z)b(z)=k0+k1z+k2z2+ k(z) = a^{-1}(z) b(z) = k_0 + k_1 z + k_2 z^2 + \cdots where a(z)=a0+a1z++apzpa(z)=a_0 + a_1 z + \cdots + a_p z^p and b(z)=b0+b1z++bpzpb(z)=b_0 + b_1 z +\cdots + b_p z^p. W.l.o.g we set p=qp=q. This implies a(z)(k(z)k0)=b(z)a(z)k0(a0+a1z++apzp)(k1z+k2z+)=(b0a0k0)+(b1a1k0)z++(bpapk0)zp \begin{array}{rcl} a(z)(k(z) - k_0) &=& b(z) - a(z)k_0 \\ (a_0 + a_1 z + \cdots + a_p z^p)(k_1 z + k_2 z + \cdots ) &=& (b_0-a_0k_0) + (b_1-a_1 k_0) z + \cdots + (b_p-a_p k_0) z^p \end{array} and thus i=0papikj+i=0 for j1. \sum_{i=0}^p a_{p-i} k_{j+i} = 0 \mbox{ for } j\geq 1. By the above identity it follows that the Hankel matrix HH has finite rank and that the coefficients of the polynomial a(z)a(z) are closely related to the left kernel of HH. In the following we discuss, how to construct a unique LMFD of the rational matrix k()k() via the above identity.

In order to describe the linear dependence structure of the rows of HH it is convenient to use a “double” index for the rows: Let h(i,j)1×h(i,j)\in \mathbb{R}^{1\times \infty} denote the jj-th row in the ii-th block row of HH, i.e. h(i,j)h(i,j) is the ((i1)m+j)((i-1)m+j)-th row of HH.

A selection 𝒮={(ik,jk)|k=1,,s}\mathcal{S}=\{(i_k,j_k) \,|\, k=1,\ldots ,s\} of rows of the Hankel matrix is called a nice selection, if there are no “holes” in the sense that (i,j)𝒮(i,j)\in \mathcal{S}, i>1i>1 implies that (i1,j)𝒮(i-1,j)\in \mathcal{S}. Nice selections may be described by a multi-index ν=(ν1,,νm)\nu = (\nu_1, \ldots ,\nu_m), where νj=max{i|(i,j)𝒮}\nu_j=\max \{i\,|\,(i,j)\in \mathcal{S}\}.

Suppose that HH has rank ss. In general there are many different selections of rows of HH which form a basis for the row space of HH. In the following we choose the first ss rows of HH which form a basis of the row space and denote the corresponding selection with 𝒮={(ik,jk)|k=1,,s}\mathcal{S}=\{(i_k,j_k) \,|\, k=1,\ldots ,s\}. Due to the Hankel structure of HH this is a nice selection in the above sense. The corresponding νj\nu_j’s are called Kronecker indices of the Hankel matrix (respectively of the rational matrix k()k(\cdot)). Note that the sum of the Kronecker indices is equal to the rank of HH: j=1mνj=s\sum_{j=1}^m \nu _j = s.

The row h(νj+1,j)h(\nu_j+1,j) is linearly dependent on the previous (basis) rows and therefore h(νj+1,j)+(νj+1i,l)𝒮(νj+1i,l)<(νj+1,j)ai,jlh(νj+1i,l)=0 h(\nu_j+1,j) + \sum_{\substack{(\nu_j+1-i,l) \in \mathcal{S} \\ (\nu_j+1-i,l) < (\nu_j+1,j)}} a_{i,jl} h(\nu_j+1-i,l) = 0 holds for suitably chosen coefficients ai,jla_{i,jl}. The sum runs over all basis rows previous to the row h(νj+1,j)h(\nu_j+1,j), i.e. the notation (k,l)<(i,j)(k,l) < (i,j) means (k<ik < i) or (k=ik=i and l<j)l<j)). This equation now (uniquely) defines a polynomial matrix a(z)=a0+a1z++apzpa(z) = a_0 + a_1 z + \cdots + a_p z^p, with p=maxjνjp=\max_j{\nu_j}.
Let ai,jla_{i,jl} denote the (jl)(jl)-th entry of the matrix aia_i. The entries ai,jla_{i,jl}, for (νj+1i,l)𝒮(\nu_j+1-i,l) \in \mathcal{S} and (νj+1i,l)<(νj+1,j)(\nu_j+1-i,l) < (\nu_j+1,j) are read off from the above equation, a0,jja_{0,jj} is set to one (a0,jj=1a_{0,jj}=1) and all other entries are set to zero.

By construction a(z)(k(z)k0)a(z)(k(z)-k_0) is a polynomial (with degree less than or equal to p=maxjνjp=\max_j\nu_j). In the last step we set b(z)=a(z)(k(z)k0)+a(z)k0. b(z) = a(z)(k(z)-k_0) + a(z)k_0.

By the above construction one gets a unique LMFD representation of the rational matrix k(z)k(z) with the following properties:

  • a0a_0 is a lower triangular matrix with ones on the diagonal.
  • b0=a0k0b_0 = a_0 k_0. In particular for a square rational matrix with k0=Imk_0=I_m we have b0=a0b_0=a_0.
  • the row degrees of (a(z),b(z))(a(z),b(z)) are equal to ν1,,νm\nu_1,\ldots,\nu_m,
  • the elements aij(z)a_{ij}(z) are divisible by zνijz^{\nu_{ij}}, where νij=max(νi+1νj,1)\nu_{ij} = \max(\nu_i+1-\nu_j,1) for j>ij>i and νij=max(νi+1νj,0)\nu_{ij} = \max(\nu_i+1-\nu_j,0) for j<ij<i.
  • the pair (a(z),b(z))(a(z), b(z)) is left coprime and row reduced.

A pair (a(z),b(z))(a(z),b(z)) which satisfied the above conditions is said to be in echelon canonical form.

Ho-Kalman

A quite analogous strategy may be used to construct a (unique) state space realization of a rational matrix. Suppose that the Hankel matrix HH has rank ss and that Ss×S\in \mathbb{R}^{s\times \infty} is such that SHSH is a basis for the row space of HH. Then a state space representation of the rational matrix k()k(\cdot) is obtained by a solving the following equations SH1,.=ASHH1,.=CSHSH.,1=Bk0=D, \begin{array}{rcl} SH_{-1,.} &=& A SH \\ H_{1,.} &=& C SH \\ SH_{.,1} &=& B \\ k_0 &=& D, \end{array} where H1,.=(k2k3k3k4)H1,.=(k1k2) and H,1=(k1k2) H_{-1,.} = \begin{pmatrix} k_2 & k_3 & \cdots \\ k_3 & k_4 & \cdots \\ \vdots & \vdots & \end{pmatrix} \, \quad H_{1,.} = \begin{pmatrix} k_1 & k_2 & \cdots \end{pmatrix} \, \mbox{ and } H_{,1} = \begin{pmatrix} k_1 \\ k_2 \\ \vdots \end{pmatrix}

The obtained result clearly depends on the matrix SS, i.e. on the choice of the basis of the row space of HH.

Two choices are implemented:

  • echelon form: here SS is the selection matrix which selects the first ss linearly independent rows of HH. The statespace realization obtained then is in echelon canonical form.
  • balanced form: here SS is obtained via an SVD decomposition of a finite dimensional sub matrix of HH. For more details, see …

Notes:

The above constructions for a LMFD or statespace representations also work for a finite dimensional sub matrix Hfp=(k1k2kpk2k3kp+1kfkf+1kf+p1) H_{fp} = \begin{pmatrix} k_1 & k_2 & \cdots & k_p \\ k_2 & k_3 & \cdots & k_{p+1}\\ \vdots & \vdots & & \vdots \\ k_f & k_{f+1} & \cdots & k_{f+p-1} \end{pmatrix} provided that (f,p)(f,p) is “large enough”.

For a more detailed discussion on Kronecker indices and echelon canonical forms, see Hannan and Deistler (2012).

Operations with State-Space Realizations

Functional Area: State-Space Tools (#6)

See R/arithmetic_methods.R and R/stsp_methods.R for implementation.

Addition

(C1(z1A1)1B1+D1)+(C2(z1A2)1B2+D2) (C_1 (z^{-1} - A_1)^{-1} B_1 + D_1) + (C_2 (z^{-1} - A_2)^{-1} B_2 + D_2)

$$ \left[\begin{array}{@{}cc|c@{}} A_1 & 0 & B_1 \\ 0 & A_2 & B_2 \\ \hline C_1 & C_2 & D_1 + D_2 \end{array}\right] $$

See Ops.ratm() in particular a + b.

Multiplication

(C1(z1A1)1B1+D1)(C2(z1A2)1B2+D2) (C_1 (z^{-1} - A_1)^{-1} B_1 + D_1) \cdot (C_2 (z^{-1} - A_2)^{-1} B_2 + D_2)

$$ \left[\begin{array}{@{}cc|c@{}} A_1 & B_1 C_2 & B_1 D_2 \\ 0 & A_2 & B_2 \\ \hline C_1 & D_1 C_2 & D_1 D_2 \end{array}\right] $$

See a %r% b.

Inverse

(C(z1A)1B+D)1 (C (z^{-1} - A)^{-1} B + D)^{-1}

$$ \left[\begin{array}{@{}c|c@{}} A - B D^{-1} C & BD^{-1} \\ \hline -D^{-1}C & D^{-1} \end{array}\right] $$

See Ops.ratm() in particular x^{-1}.

Bind by columns or rows

(C1(z1A1)1B1+D1)C2(z1A2)1B2+D2)) \begin{pmatrix} C_1 (z^{-1} - A_1)^{-1} B_1 + D_1) & C_2 (z^{-1} - A_2)^{-1} B_2 + D_2) \end{pmatrix}

$$ \left[\begin{array}{@{}cc|cc@{}} A_1 & 0 & B_1 & 0 \\ 0 & A_2 & 0 & B_2 \\ \hline C_1 & C_2 & D_1 & D_2 \end{array}\right] $$ See cbind.ratm().

(C1(z1A1)1B1+D1C2(z1A2)1B2+D2) \begin{pmatrix} C_1 (z^{-1} - A_1)^{-1} B_1 + D_1 \\ C_2 (z^{-1} - A_2)^{-1} B_2 + D_2 \end{pmatrix}

$$ \left[\begin{array}{@{}cc|c@{}} A_1 & 0 & B_1 \\ 0 & A_2 & B_2 \\ \hline C_1 & 0 & D_1 \\ 0 & C_2 & D_2 \end{array}\right] $$ See rbind.ratm().

Elementwise Multiplication

First consider the product of two (m×1)(m\times 1) matrices, and write the elementwise product as the product of a suitable diagonal matrix with the second factor

$$ \left[\begin{array}{@{}cccc|c@{}} A_1 & \cdots & 0 & B_1 C_{2,1} & B_1 D_{2,1} \\ \vdots & \ddots & \vdots & \vdots & \vdots \\ 0 & \cdots & A_1 & B_1 C_{2,m} & B_1 D_{2,m} \\ 0 & \cdots & 0 & A_2 & B_2 \\ \hline C_{1,1} & \cdots & 0 & D_{1,1} C_{2,1} & D_{1,1} C_{2,1} \\ \vdots & \ddots & \vdots & \vdots & \vdots \\ 0 & \cdots & C_{1,m} & D_{1,m} C_{2,m} & D_{1,m} D_{2,m} \end{array}\right] $$ where Ci,kC_{i,k} denotes the kk-th row of CiC_i and Di,kD_{i,k} is the kk-entry of the (m×1)(m\times 1)-dimensional matrix DiD_i.

It can be shown (???) that the controllability matrix of the above statespace model has rank at most (s1+s2)(s_1 + s_2). Therefore we may construct an equivalent model with state dimension (s1+s2)(s_1 + s_2).

Now we simply do this construction for all columns of the two factors a(z)a(z) and b(z)b(z) and then “column-bind” the result. The statespace realisation then has state dimension n(s1+s2)n(s_1+s_2).

For “wide” matrices (m<nm< n) we consider the transpose of the two factors. This gives statespace realisations with s=min(m,n)(s1+s2). s = \min(m,n)(s_1+s_2).

  • proof ???
  • kann man die (s1+s2)(s_1+s_2) Zustandsraum Darstellung direkt “hinschreiben”?

See Ops.ratm() in particular a * b.

Transpose

(C(z1IA)1B+D)=B(z1IA)1C+D (C(z^{-1}I - A)^{-1} B + D)' = B'(z^{-1}I - A')^{-1} C + D'

$$ \left[\begin{array}{@{}c|c@{}} A' & C' \\ \hline B' & D' \end{array}\right] $$

See t().

Hermitean Transpose

[C(z1IA)1B+D]*=B(zIA)1C+D=B[(Az)(z1IAT)]1C+D=B[(ATz1)(zI+z2AT+z3A2T+)]C+D=(A1B)[zI+z2AT+Z3A2T+)](CA1)+DBATC=(A1B)(z1IAT)1(CA1)+(DBATC) \begin{array}{rcl} [C(z^{-1}I - A)^{-1} B + D]^* &=& B' (zI - A')^{-1} C' + D' \\ &=& B' [(-A'z)(z^{-1}I -A^{-T})]^{-1}C' + D' \\ &=& B' [(-A^{-T}z^{-1})(zI + z^2A^{-T} + z^3A^{-2T} + \cdots)]C' + D' \\ &=& (-A^{-1}B)' [zI + z^2A^{-T} + Z^3A^{-2T} + \cdots)](CA^{-1})' + D' - B' A^{-T}C'\\ &=& (-A^{-1}B)' (z^{-1} I - A^{-T})^{-1}(CA^{-1})' + (D' - B' A^{-T}C')\\ \end{array}

$$ \left[\begin{array}{@{}c|c@{}} A^{-T} & (CA^{-1})' \\ \hline (-A^{-1}B)' & D' - B' A^{-T} C' \end{array}\right] $$

See Ht().

Derivative

ddz(C(z1A)1B+D)=ddz(D+CBz+CABz2+CA2Bz3+CA2Bz4+)=CB+2CABz+3CA2Bz2+4CA2Bz3+=CAB+CA2Bz+CA3Bz2+CA4Bz3+ \begin{array}{rcl} \frac{d}{dz} (C(z^{-1} - A)^{-1}B+D) &=& \frac{d}{dz}(D + CBz + CABz^2 + CA^2Bz^3 + CA^2Bz^4 + \cdots )\\ &=& CB + 2CABz + 3CA^2Bz^2 + 4CA^2Bz^3 +\cdots \\ &=& \bar{C}\bar{A}\bar{B} + \bar{C}\bar{A}^2\bar{B}z + \bar{C}\bar{A}^3\bar{B}z^2 + \bar{C}\bar{A}^4\bar{B}z^3 +\cdots \\ \end{array} with C=(C0),A=(AI0A) and B=(0B). \bar{C} = \begin{pmatrix} C & 0 \end{pmatrix},\ \bar{A} = \begin{pmatrix} A & I \\ 0 & A \end{pmatrix} \mbox{ and } \bar{B} = \begin{pmatrix} 0 \\ B \end{pmatrix}. The corresponding statespace realization is

$$ \left[\begin{array}{@{}cc|c@{}} A & I & B \\ 0 & A & AB \\ \hline CA & C & CB \end{array}\right] $$ See derivative.stsp().

Construct statespace representation of rational matrix in LMFD form

Suppose c(z)=a1(z)b(z)c(z)=a^{-1}(z) b(z) with a(z)=a0+a1z+a2z2++apzpa(z) = a_0 + a_1 z + a_2 z^2 + \cdots + a_p z^p, b(z)=b0+b1z++bqzqb(z) = b_0 + b_1 z + \cdots + b_q z^q is given. The construction, detailed below, assumes that a0a_0 is non singular and hence we rewrite the polynomial a(z)a(z) as
a(z)=Ima1za2z2apzpa(z) = I_m - a_1 z - a_2 z^2 - \cdots - a_p z^p. Furthermore we assume, w.l.o.g that p=qp=q. The powerseries expansion of c()c(\cdot) is c(z)=k0+k1z++kpzp+c(z)=k_0 + k_1 z + \cdots + k_pz^p + \cdots.

Then a statespace realization of c()c(\cdot) is $$ \left[\begin{array}{@{}cccc|c@{}} a_1 & \cdots & a_{p-1} & a_p & k_p \\ I_m & \cdots & 0 & 0 & k_{p-1} \\ \vdots& \ddots & \vdots & \vdots & \vdots \\ 0 & \cdots & I_m & 0 & k_1 \\ \hline 0 & \cdots & 0 & I_m & k_0 \end{array}\right] $$ This scheme is implemented in as.stsp.lmfd (and as.stsp.polm).

Construct statespace representation of rational matrix in RMFD form

Likewise, it is possible to write an RMFD $k(z)=d(z) c^{-1}(z) $, where c(z)=c0+c1z+c2z2++cpzpc(z) = c_0 + c_1 z + c_2 z^2 + \cdots + c_p z^p, and d(z)=d0+d1z++dqzqd(z) = d_0 + d_1 z + \cdots + d_q z^q is given. Again, we simplify the exposition by setting the non-singular c0c_0 equal to the mm-dimensional identity matrix ImI_m. In the case pqp \geq q, the state space realization of k(z)k(z) is

$$ \left[\begin{array}{@{}cccc|c@{}} c_1 & \cdots & c_{p-1} & c_p & I_m \\ I_m & \cdots & 0 & 0 & 0 \\ \vdots& \ddots & \vdots & \vdots & \vdots \\ 0 & \cdots & I_m & 0 & 0 \\ \hline d_1 & \cdots & d_{q-1} & d_q & d_0 \end{array}\right] $$ If p>qp>q, some zeros appear in the CC matrix. If p<qp<q, some zeros are padded into the AA matrix. This scheme is implemented in as.stsp.rmfd.

Schur, QZ Decomposition, Lyapunov and Riccati Equations

Functional Area: Numerical Methods (#7)

See src/lyapunov.cpp, inst/include/rationalmatrices_lyapunov.h, and R/lyapunov.R for implementation.

Lyapunov Equation

The generalized (non-symmetric) Lyapunov equation is

X=AXB*+Q X = A X B^* + Q

With a Schur factorization of AA and BB we obtain a form with triangular matrices AA, BB

(X11X12X21X22)=(A11A120A22)(X11X12X21X22)(B11*0B12*B22*)+(Q11Q12Q21Q22)=(A11X11B11*+A11X12B12*+A12X21B11*+A12X22B12*(A11X12+A12X22)B22*A22(X21B11*+X22B12*)A22X22B22*)+(Q11Q12Q21Q22) \begin{array}{rcl} \begin{pmatrix} X_{11} & X_{12} \\ X_{21} & X_{22} \end{pmatrix} &=& \begin{pmatrix} A_{11} & A_{12} \\ 0 & A_{22} \end{pmatrix} \begin{pmatrix} X_{11} & X_{12} \\ X_{21} & X_{22} \end{pmatrix} \begin{pmatrix} B_{11}^* & 0 \\ B_{12}^* & B_{22}^* \end{pmatrix} + \begin{pmatrix} Q_{11} & Q_{12} \\ Q_{21} & Q_{22} \end{pmatrix} \\ &=& \begin{pmatrix} A_{11}X_{11}B_{11}^* + A_{11}X_{12}B_{12}^* + A_{12}X_{21}B_{11}^* + A_{12}X_{22}B_{12}^* & (A_{11}X_{12}+A_{12}X_{22})B_{22}^* \\ A_{22}(X_{21}B_{11}^*+X_{22}B_{12}^*) & A_{22}X_{22}B^*_{22} \end{pmatrix} + \begin{pmatrix} Q_{11} & Q_{12} \\ Q_{21} & Q_{22} \end{pmatrix} \end{array}

  • 22-block: solve for X22X_{22}
  • 12-block: solve for X12X_{12}
  • 21-block: solve for X21X_{21}
  • continue with 11-block

we could also consider the non-square case, where AA is m×mm\times m, BB is n×nn\times n and QQ is m×nm\times n.

Balancing and Balanced Truncation

Consider a pair of Grammians P,QP,Q. We first compute the sqare roots P=MMP=MM' and Q=NNQ=NN' and then consider the SVD1 of MNM'N:

MN=UΣV=[U1,U2](Σ1100Σ22)[V1,V2] M'N = U \Sigma V' = [U_1, U_2] \begin{pmatrix} \Sigma_{11} & 0 \\ 0 & \Sigma_{22} \end{pmatrix} [V_1, V_2]' where the diagonal blocks Σ11\Sigma_{11}, Σ22\Sigma_{22} are of size (s1,s1)(s_1,s_1) and (s2,s2)(s_2,s_2) respectively. We assume that Σ11\Sigma_{11} is positive definite and set T1=Σ111/2V1NS1=MU1Σ111/2 \begin{array}{rcl} T_1 &=& \Sigma_{11}^{-1/2} V_1' N' \\ S_1 &=& M U_1\Sigma_{11}^{-1/2} \end{array} and note that T1S1=Σ111/2V1NMU1Σ111/2=Σ111/2V1VΣUMU1Σ111/2=Is1 \begin{array}{rcl} T_1 S_1 &=& \Sigma_{11}^{-1/2} V_1' N' M U_1\Sigma_{11}^{-1/2} \\ &=& \Sigma_{11}^{-1/2} V_1' V \Sigma U' M U_1\Sigma_{11}^{-1/2} = I_{s_1} \end{array} We extend these matrices to square (s×s)(s\times s) matrices T=(T1T2) and S=(S1S2) T = \begin{pmatrix} T_1 \\ T_2 \end{pmatrix} \mbox{ and } S = \begin{pmatrix} S_1 & S_2 \end{pmatrix}

such that TS=ST=IsTS=ST= I_s, i.e. S=T1S= T^{-1}. To this end we consider the SVD’s

S1T1=U1Σ11V1U1,V1s×s1,Σ11s1×s1U2V2=ÛΣ̂V̂Û,V̂,Σ̂s2×s2 \begin{array}{rclcl} S_1 T_1 &=& \bar{U}_1 \bar{\Sigma}_{11} \bar{V}_1' &&\bar{U}_1,\bar{V}_1\in \mathbb{R}^{s\times s_1},\, \bar{\Sigma}_{11} \in \mathbb{R}^{s_1 \times s_1} \\ \bar{U}_2'\bar{V}_2 &=& \hat{U}\hat{\Sigma}\hat{V}' &&\hat{U},\hat{V},\hat{\Sigma} \in \mathbb{R}^{s_2\times s_2} \end{array} and set T2=Σ̂1/2ÛU2T_2 = \hat{\Sigma}^{-1/2}\hat{U}'\bar{U}_2' and S2=V2V̂Σ̂1/2S_2 = \bar{V}_2\hat{V}\hat{\Sigma}^{-1/2}.

We now consider the transformed statespace realization $$ \left[\begin{array}{@{}c|c@{}} A & B \\ \hline C & D \end{array}\right] \; \longrightarrow \; \left[\begin{array}{@{}cc|c@{}} T_1 A S_1 & T_1 A S_2 & T_1 B \\ T_2 A S_1 & T_2 A S_2 & T_2 B \\ \hline C S_1 & C S_2 & D \end{array}\right] $$ and the Grammians are transformed as PTPTP \rightarrow TPT' and QSQSQ \rightarrow S' QS.

TM=(Σ111/2V1NMT2M)=(Σ111/2U1T2M) T M = \begin{pmatrix} \Sigma_{11}^{-1/2} V_1' N' M \\ T_2 M \end{pmatrix} = \begin{pmatrix} \Sigma_{11}^{1/2} U_1' \\ T_2 M \end{pmatrix}

SN=(Σ111/2U1MNS2N)=(Σ111/2V1S2N) S' N = \begin{pmatrix} \Sigma_{11}^{-1/2} U_1' M' N \\ S_2' N \end{pmatrix} = \begin{pmatrix} \Sigma_{11}^{1/2} V_1' \\ S_2' N \end{pmatrix} TPT=(TM)(TM)=(Σ111/2U1U1Σ111/2Σ111/2U1MT2T2MU1Σ111/2T2MMT2)=(Σ1100T2PT2) TPT' = (TM)(TM)' = \begin{pmatrix} \Sigma_{11}^{1/2} U_1' U_1 \Sigma_{11}^{1/2} & \Sigma_{11}^{1/2} U_1' M' T_2' \\ T_2 M U_1 \Sigma_{11}^{1/2} & T_2 MM' T_2' \end{pmatrix} = \begin{pmatrix} \Sigma_{11} & 0 \\ 0 & T_2 P T_2' \end{pmatrix}

SQS=(SN)(SN)=(Σ111/2V1V1Σ111/2Σ111/2V1NS2S2NV1Σ111/2S2NNS2)=(Σ1100S2QS2) S'QS = (S'N)(S'N)' = \begin{pmatrix} \Sigma_{11}^{-1/2} V_1' V_1 \Sigma_{11}^{1/2} & \Sigma_{11}^{1/2} V_1' N' S_2 \\ S_2' N V_1 \Sigma_{11}^{1/2} & S_2' NN' S_2 \end{pmatrix} = \begin{pmatrix} \Sigma_{11} & 0 \\ 0 & S_2' Q S_2 \end{pmatrix} Here we have used that T2MU1Σ111/2=T2S1Σ11=0T_2 M U_1 \Sigma_{11}^{1/2} = T_2 S_1 \Sigma_{11} = 0 and Σ111/2V1NS2=Σ11T1S2=0\Sigma_{11}^{1/2} V_1' N' S_2 = \Sigma_{11} T_1 S_2 = 0. Due to the block diagonal structure of TPTTPT' and SQSS'QS we also immediately get

TPQS=TPTSQS=(Σ11200T2PQS2) TPQS = TPT' S'QS = \begin{pmatrix} \Sigma_{11}^2 & 0 \\ 0 & T_2 P Q S_2 \end{pmatrix}

and

T2PQS2=T2MMNNS2=T2MUΣVNS2=T2MU1=0Σ11V1NS2=0+T2MU2Σ22V2NS2=T2MU2Σ22V2NS2. T_2 PQ S_2 = T_2 MM' NN' S_2 = T_2 M U\Sigma V' N'S_2 = \underbrace{T_2 M U_1}_{=0}\Sigma_{11} \underbrace{V_1' N' S_2}_{=0} + T_2 M U_2\Sigma_{22} V_2' N' S_2 = T_2 M U_2\Sigma_{22} V_2' N' S_2.

The following scenarios are of particular interest:

  • s2=0s_2=0: The model is minimal and the above procedure renders the statespace realization into balanced form.
  • s2>0s_2>0 and Σ22=0\Sigma_{22} = 0: The above procedure renders the model in a form where the controllable and observable states are clearly seperated from the non observable or non controllable states. In particular the truncated model $$ \left[\begin{array}{@{}c|c@{}} T_1 A S_1 & T_1 B \\ T_2 A S_1 & T_2 B \\ \hline C S_1 & D \end{array}\right] $$ is equivalent to the original model and it is minimal and in balanced form
  • If s2>0s_2>0 but Σ220\Sigma_{22} \neq 0 then the truncated model is just an approximation of the original model. The quality depends on the size of the neglected singular values. Note also that the truncated model is not balanced.

Note that the determination of the number of non zeroe singular values is quite tricky. (difficult due to numerics). Currently the number of non zero singular values is chosen as the number of singular values which satisfy σk>τσ1\sigma_k > \tau \sigma_1 where τ\tau is a user defined tolerance parameter.

Reflect Poles and Zeroes

Functional Area: Pole/Zero Reflection (#8)

See R/reflect_poles_zeroes.R for implementation.

All-Pass Matrices

A rational matrix k(z)k(z) is all-pass if k(z)k(1z)=k(1z)k(z)=Imk(z) k'\left(\frac{1}{z}\right) = k'\left(\frac{1}{z}\right) k(z) = I_m. If (A,B,C,D)(A,B,C,D) is a statespace realization of k(z)k(z) then the product k(z)k(1z)k(z) k'\left(\frac{1}{z}\right) has a realization given by $$ \left[\begin{array}{@{}cc|c@{}} A & -BB'A^{-T} & BD' - BB'A^{-T}C' \\ 0 & A^{-T} & A^{-T}C' \\ \hline C & -DB'A^{-T} & DD' - DB' A^{-T} C' \end{array}\right] $$

A state transformation gives

$$ \left[ \begin{array}{@{}cc|c@{}} I & X & 0 \\ 0 & I & 0 \\ \hline 0 & 0 & I \end{array} \right] \left[\begin{array}{@{}cc|c@{}} A & -BB'A^{-T} & BD' - BB'A^{-T}C' \\ 0 & A^{-T} & A^{-T}C' \\ \hline C & -DB'A^{-T} & DD' - DB' A^{-T} C' \end{array}\right] \left[ \begin{array}{@{}cc|c@{}} I & -X & 0 \\ 0 & I & 0 \\ \hline 0 & 0 & I \end{array} \right] = \left[\begin{array}{@{}cc|c@{}} A & XA^{-T}-AX-BB'A^{-T} & BD' - BB'A^{-T}C' + X A^{-T}C'\\ 0 & A^{-T} & A^{-T}C' \\ \hline C & -DB'A^{-T}-CX & DD' - DB' A^{-T} C' \end{array}\right] $$

The (1,1) block is not controllable and the (2,2) block is not observable if

XATAXBBAT=0XAXABB=0DBATCX=0[X,A1B][C,D]=0BDBBATC+XATC=0[XATBBAT,B][C,D]=0[AX,B][C,D]=0 \begin{array}{rclcrcl} XA^{-T}-AX-BB'A^{-T} &=& 0 & \Longleftrightarrow & X -AXA' - BB' &=& 0 \\ -DB'A^{-T}-CX &=& 0 & \Longleftrightarrow & [X', A^{-1}B] [C, D]' &=& 0\\ BD' - BB'A^{-T}C' + X A^{-T}C' &=& 0 & \Longleftrightarrow & [XA^{-T}-BB'A^{-T}, B][C, D]' &=& 0\\ & & & \Longleftrightarrow & [AX', B][C, D]' &=& 0\\ \end{array} Furthermore DDDBATC=D[BAT,I][C,D]=I DD' - DB' A^{-T} C' = D[B'A^{-T}, -I][C,D]' = I must hold.

It follows that we end up with the system $$ \left[\begin{array}{@{}cc|c@{}} A & 0 & 0\\ 0 & A^{-T} & A^{-T}C' \\ \hline C & 0 & I \end{array}\right] $$ whose transfer function is equal to (C0)(Iz1(A00AT))1(0ATC)+Im, \begin{pmatrix} C & 0 \end{pmatrix} \left( I z^{-1} - \begin{pmatrix} A & 0 \\ 0 & A^{-T} \end{pmatrix} \right)^{-1} \begin{pmatrix} 0 \\ A^{-T}C' \end{pmatrix} + I_m, i.e. the identity matrix as required.

In the following we need to construct an allpass matrix with given (A,B)(A,B) (or given (A,C)(A,C)).

  1. From the above Lyapunov equation X=AXA+BBX = AXA' + BB' determine XX.
  2. Determine the row space of [C,D][C,D] from the left kernel of [AX,B][AX',B]'.
  3. Determine the scaling matrix from the requirement DDDBATC=IDD' - DB' A^{-T} C' = I.

zero cancellations

Let k(z)k(z) be given. We want to find an allpass transfer function k̂(z)\hat{k}(z) such some of the poles of k(z)k(z) are cancelled in k(z)k̂(z)k(z)\hat{k}(z).

Consider the state transformation of the realization of kk̂k\hat{k}:

$$ \left[ \begin{array}{@{}ccc|c@{}} I & 0 & 0 & 0 \\ 0 & I & 0 & 0 \\ I & 0 & I & 0 \\ \hline 0 & 0 & 0 & I \end{array} \right] \left[ \begin{array}{@{}ccc|c@{}} A_{11} & A_{12} & B_{1}\hat{C} & B_{1}\hat{D} \\ A_{21} & A_{22} & B_{2}\hat{C} & B_{2}\hat{D} \\ 0 & 0 & \hat{A} & \hat{B} \\ \hline C_{1} & C_{2} & D\hat{C} & D\hat{D} \end{array} \right] \left[ \begin{array}{@{}ccc|c@{}} I & 0 & 0 & 0 \\ 0 & I & 0 & 0 \\ -I & 0 & I & 0 \\ \hline 0 & 0 & 0 & I \end{array} \right] = \left[ \begin{array}{@{}ccc|c@{}} A_{11}-B_{1}\hat{C} & A_{12} & B_{1}\hat{C} & B_{1}\hat{D}\\ A_{21}-B_{2}\hat{C} & A_{22} & B_{2}\hat{C} & B_2 \hat{D} \\ A_{11}-B_{1}\hat{C} -\hat{A} & A_{12} & \hat{A} + B_{1}\hat{C} & B_{1}\hat{D} + \hat{B} \\ \hline C_{1}-D\hat{C} & C_{2} & D\hat{C} & D\hat{D} \end{array} \right] $$ The (1,1)(1,1) block is not observable if A21B2Ĉ=0A21B2D1C1=0A11B1ĈÂ=0Â=A11B1D1C1C1DĈ=0Ĉ=D1C1 \begin{array}{rclcrcl} A_{21} - B_2 \hat{C} &=& 0 &\Longleftrightarrow& A_{21} - B_2 D^{-1} C_1 &=& 0\\ A_{11}-B_{1}\hat{C} -\hat{A} &=& 0 &\Longleftrightarrow& \hat{A} &=& A_{11} - B_1 D^{-1} C_1 \\ C_{1}-D\hat{C} &=& 0 &\Longleftrightarrow& \hat{C} &=& D^{-1} C_1 \\ \end{array}

pole cancellations

Let k(z)k(z) be given. We want to find an allpass transfer function k̂(z)\hat{k}(z) such some of the poles of k(z)k(z) are cancelled in k(z)k̂(z)k(z)\hat{k}(z).

Consider the state transformation of the realization of kk̂k\hat{k}:

$$ \left[ \begin{array}{@{}ccc|c@{}} I & 0 & -I & 0 \\ 0 & I & 0 & 0 \\ 0 & 0 & I & 0 \\ \hline 0 & 0 & 0 & I \end{array} \right] \left[ \begin{array}{@{}ccc|c@{}} A_{11} & A_{12} & B_{1}\hat{C} & B_{1}\hat{D} \\ A_{21} & A_{22} & B_{2}\hat{C} & B_{2}\hat{D} \\ 0 & 0 & \hat{A} & \hat{B} \\ \hline C_{1} & C_{2} & D\hat{C} & D\hat{D} \end{array} \right] \left[ \begin{array}{@{}ccc|c@{}} I & 0 & I & 0 \\ 0 & I & 0 & 0 \\ 0 & 0 & I & 0 \\ \hline 0 & 0 & 0 & I \end{array} \right] = \left[ \begin{array}{@{}ccc|c@{}} A_{11} & A_{12} & A_{11} + B_{1}\hat{C} - \hat{A} & B_{1}\hat{D} - \hat{B} \\ A_{21} & A_{22} & A_{21} + B_{2}\hat{C} & B_2 \hat{D} \\ 0 & 0 & \hat{A} & \hat{B} \\ \hline C_{1} & C_{2} & C_1 + D\hat{C} & D\hat{D} \end{array} \right] $$

The (1,1) block is not controllable if

A12=0A12=0Â=A11+B1Ĉ(ÂB̂D̂1Ĉ)=A11B̂=B1D̂(B̂D̂1)=B1 \begin{array}{rclcrcl} A_{12} &=& 0 & \Longleftrightarrow & A_{12} &=& 0\\ \hat{A} &=& A_{11} + B_1 \hat{C} & \Longleftrightarrow & (\hat{A} - \hat{B} \hat{D}^{-1} \hat{C}) &=& A_{11}\\ \hat{B} &=& B_1 \hat{D} & \Longleftrightarrow & (\hat{B}\hat{D}^{-1}) &=& B_{1} \end{array}

Hence the “A,BA,B” matrices of the inverse of k̂1\hat{k}^{-1} are determined.

QR Decomposition, Rank and Null Space

Functional Area: Utilities & Helpers (#10)

Supporting theory for rank computation and null space analysis in polynomial operations.

Consider the following example

tol = 1e-7
tol2 = tol/10

x = diag(c(1,tol2, tol2^2, tol2^3))
qr_x = qr(x, tol = tol)

x
#>      [,1]  [,2]  [,3]  [,4]
#> [1,]    1 0e+00 0e+00 0e+00
#> [2,]    0 1e-08 0e+00 0e+00
#> [3,]    0 0e+00 1e-16 0e+00
#> [4,]    0 0e+00 0e+00 1e-24
qr_x$rank
#> [1] 4
qr_x$pivot
#> [1] 1 2 3 4
qr.R(qr_x)
#>      [,1]   [,2]   [,3]  [,4]
#> [1,]   -1  0e+00  0e+00 0e+00
#> [2,]    0 -1e-08  0e+00 0e+00
#> [3,]    0  0e+00 -1e-16 0e+00
#> [4,]    0  0e+00  0e+00 1e-24

Is this the desired result for the rank (and the null space)? The main reason for this somewhat strange results is that qr() considers a column as zero, if and only if the projection onto the space spanned by the previous columns reduces the norm by a factor which is larger than tol.

The following example works as desired

x[1,] = 1
x[nrow(x), ncol(x)] = 1
qr_x = qr(x, tol = tol)

x
#>      [,1]  [,2]  [,3] [,4]
#> [1,]    1 1e+00 1e+00    1
#> [2,]    0 1e-08 0e+00    0
#> [3,]    0 0e+00 1e-16    0
#> [4,]    0 0e+00 0e+00    1
qr_x$rank
#> [1] 2
qr_x$pivot
#> [1] 1 4 2 3
qr.R(qr_x)
#>      [,1] [,2]   [,3]   [,4]
#> [1,]   -1   -1 -1e+00 -1e+00
#> [2,]    0   -1  0e+00  0e+00
#> [3,]    0    0 -1e-08  0e+00
#> [4,]    0    0  0e+00  1e-16

References

Demmel, James, and Bo Kågström. 1993. “The Generalized Schur Decomposition of an Arbitrary Pencil a - Lambda b; Robust Software with Error Bounds and Applications. Part II: Software and Applications.” ACM Trans. Math. Softw. 19 (2): 175–201. https://doi.org/10.1145/152613.152616.
Gantmacher, F. R. 1959. The Theory of Matrices. Vol. 2. Chelsea Publishing Company.
Hannan, Edward James, and Manfred Deistler. 2012. The Statistical Theory of Linear Systems. Classics in Applied Mathematics. Philadelphia: SIAM.
Kailath, Thomas. 1980. Linear Systems. Englewood Cliffs, New Jersey: Prentice Hall.
Wolovich, W. A. 1974. Linear Multivariable Systems. Applied Mathematical Sciences. Springer-Verlag.