**Purpose**

To reduce the system state matrix A to an ordered upper real Schur form by using an orthogonal similarity transformation A <-- U'*A*U and to apply the transformation to the matrices B and C: B <-- U'*B and C <-- C*U. The leading block of the resulting A has eigenvalues in a suitably defined domain of interest.

SUBROUTINE TB01LD( DICO, STDOM, JOBA, N, M, P, ALPHA, A, LDA, B, $ LDB, C, LDC, NDIM, U, LDU, WR, WI, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBA, STDOM INTEGER INFO, LDA, LDB, LDC, LDU, LDWORK, M, N, NDIM, P DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), U(LDU,*), $ WI(*), WR(*)

**Mode Parameters**

DICO CHARACTER*1 Specifies the type of the system as follows: = 'C': continuous-time system; = 'D': discrete-time system. STDOM CHARACTER*1 Specifies whether the domain of interest is of stability type (left part of complex plane or inside of a circle) or of instability type (right part of complex plane or outside of a circle) as follows: = 'S': stability type domain; = 'U': instability type domain. JOBA CHARACTER*1 Specifies the shape of the state dynamics matrix on entry as follows: = 'S': A is in an upper real Schur form; = 'G': A is a general square dense matrix.

N (input) INTEGER The order of the state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs, or of columns of B. M >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. ALPHA (input) DOUBLE PRECISION. Specifies the boundary of the domain of interest for the eigenvalues of A. For a continuous-time system (DICO = 'C'), ALPHA is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), ALPHA >= 0 represents the boundary value for the moduli of eigenvalues. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the unreduced state dynamics matrix A. If JOBA = 'S' then A must be a matrix in real Schur form. On exit, the leading N-by-N part of this array contains the ordered real Schur matrix U' * A * U with the elements below the first subdiagonal set to zero. The leading NDIM-by-NDIM part of A has eigenvalues in the domain of interest and the trailing (N-NDIM)-by-(N-NDIM) part has eigenvalues outside the domain of interest. The domain of interest for lambda(A), the eigenvalues of A, is defined by the parameters ALPHA, DICO and STDOM as follows: For a continuous-time system (DICO = 'C'): Real(lambda(A)) < ALPHA if STDOM = 'S'; Real(lambda(A)) > ALPHA if STDOM = 'U'; For a discrete-time system (DICO = 'D'): Abs(lambda(A)) < ALPHA if STDOM = 'S'; Abs(lambda(A)) > ALPHA if STDOM = 'U'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix U' * B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix C * U. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). NDIM (output) INTEGER The number of eigenvalues of A lying inside the domain of interest for eigenvalues. U (output) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array contains the orthogonal transformation matrix used to reduce A to the real Schur form and/or to reorder the diagonal blocks of real Schur form of A. The first NDIM columns of U form an orthogonal basis for the invariant subspace of A corresponding to the first NDIM eigenvalues. LDU INTEGER The leading dimension of array U. LDU >= max(1,N). WR, WI (output) DOUBLE PRECISION arrays, dimension (N) WR and WI contain the real and imaginary parts, respectively, of the computed eigenvalues of A. The eigenvalues will be in the same order that they appear on the diagonal of the output real Schur form of A. Complex conjugate pairs of eigenvalues will appear consecutively with the eigenvalue having the positive imaginary part first.

DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LDWORK >= MAX(1,N) if JOBA = 'S'; LDWORK >= MAX(1,3*N) if JOBA = 'G'. For optimum performance LDWORK should be larger.

INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the QR algorithm failed to compute all the eigenvalues of A; = 2: a failure occured during the ordering of the real Schur form of A.

Matrix A is reduced to an ordered upper real Schur form using an orthogonal similarity transformation A <-- U'*A*U. This transformation is determined so that the leading block of the resulting A has eigenvalues in a suitably defined domain of interest. Then, the transformation is applied to the matrices B and C: B <-- U'*B and C <-- C*U.

3 The algorithm requires about 14N floating point operations.

None

**Program Text**

* TB01LD EXAMPLE PROGRAM TEXT * Copyright (c) 2002-2017 NICONET e.V. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDU PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDU = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX ) * .. Local Scalars .. CHARACTER*1 DICO, JOBA, STDOM INTEGER I, INFO, J, M, N, NDIM, P DOUBLE PRECISION ALPHA * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), U(LDU,NMAX), WI(NMAX), WR(NMAX) * .. External Subroutines .. EXTERNAL TB01LD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, ALPHA, DICO, STDOM, JOBA IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed ssr for (A,B,C). CALL TB01LD( DICO, STDOM, JOBA, N, M, P, ALPHA, $ A, LDA, B, LDB, C, LDC, NDIM, U, LDU, $ WR, WI, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99987 ) NDIM WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99994 ) WR(I), WI(I) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( U(I,J), J = 1,N ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01LD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01LD = ',I2) 99997 FORMAT (/' The eigenvalues of state dynamics matrix A are ') 99996 FORMAT (/' The transformed state dynamics matrix U''*A*U is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT ( ' (',F8.4,', ',F8.4,' )') 99993 FORMAT (/' The transformed input/state matrix U''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*U is ') 99991 FORMAT (/' The similarity transformation matrix U is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The number of eigenvalues in the domain of interest =', $ I5 ) END

TB01LD EXAMPLE PROGRAM DATA (Continuous system) 5 2 3 -1.0 C U G -0.04165 4.9200 -4.9200 0 0 -1.387944 -3.3300 0 0 0 0.5450 0 0 -0.5450 0 0 0 4.9200 -0.04165 4.9200 0 0 0 -1.387944 -3.3300 0 0 3.3300 0 0 0 0 0 0 3.3300 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0

TB01LD EXAMPLE PROGRAM RESULTS The number of eigenvalues in the domain of interest = 2 The eigenvalues of state dynamics matrix A are ( -0.7483, 2.9940 ) ( -0.7483, -2.9940 ) ( -1.6858, 2.0311 ) ( -1.6858, -2.0311 ) ( -1.8751, 0.0000 ) The transformed state dynamics matrix U'*A*U is -0.7483 -8.6406 0.0000 0.0000 1.1745 1.0374 -0.7483 0.0000 0.0000 -2.1164 0.0000 0.0000 -1.6858 5.5669 0.0000 0.0000 0.0000 -0.7411 -1.6858 0.0000 0.0000 0.0000 0.0000 0.0000 -1.8751 The transformed input/state matrix U'*B is -0.5543 0.5543 -1.6786 1.6786 -0.8621 -0.8621 2.1912 2.1912 -1.5555 1.5555 The transformed state/output matrix C*U is 0.6864 -0.0987 0.6580 0.2589 -0.1381 -0.0471 0.6873 0.0000 0.0000 -0.7249 -0.6864 0.0987 0.6580 0.2589 0.1381 The similarity transformation matrix U is 0.6864 -0.0987 0.6580 0.2589 -0.1381 -0.1665 -0.5041 -0.2589 0.6580 -0.4671 -0.0471 0.6873 0.0000 0.0000 -0.7249 -0.6864 0.0987 0.6580 0.2589 0.1381 0.1665 0.5041 -0.2589 0.6580 0.4671