Purpose
To construct, for a given system G = (A,B,C,D), a feedback matrix
F, an orthogonal transformation matrix Z, and a gain matrix V,
such that the systems
Q = (Z'*(A+B*F)*Z, Z'*B*V, (C+D*F)*Z, D*V)
and
R = (Z'*(A+B*F)*Z, Z'*B*V, F*Z, V)
provide a stable right coprime factorization of G in the form
-1
G = Q * R ,
where G, Q and R are the corresponding transfer-function matrices
and the denominator R is inner, that is, R'(-s)*R(s) = I in the
continuous-time case, or R'(1/z)*R(z) = I in the discrete-time
case. The Z matrix is not explicitly computed.
Note: G must have no controllable poles on the imaginary axis
for a continuous-time system, or on the unit circle for a
discrete-time system. If the given state-space representation
is not stabilizable, the unstabilizable part of the original
system is automatically deflated and the order of the systems
Q and R is accordingly reduced.
Specification
SUBROUTINE SB08DD( DICO, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD,
$ NQ, NR, CR, LDCR, DR, LDDR, TOL, DWORK, LDWORK,
$ IWARN, INFO )
C .. Scalar Arguments ..
CHARACTER DICO
INTEGER INFO, IWARN, LDA, LDB, LDC, LDCR, LDD, LDDR,
$ LDWORK, M, N, NQ, NR, P
DOUBLE PRECISION TOL
C .. Array Arguments ..
DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), CR(LDCR,*),
$ D(LDD,*), DR(LDDR,*), DWORK(*)
Arguments
Mode Parameters
DICO CHARACTER*1
Specifies the type of the original system as follows:
= 'C': continuous-time system;
= 'D': discrete-time system.
Input/Output Parameters
N (input) INTEGER
The dimension of the state vector, i.e. the order of the
matrix A, and also the number of rows of the matrix B and
the number of columns of the matrices C and CR. N >= 0.
M (input) INTEGER
The dimension of input vector, i.e. the number of columns
of the matrices B, D and DR and the number of rows of the
matrices CR and DR. M >= 0.
P (input) INTEGER
The dimension of output vector, i.e. the number of rows
of the matrices C and D. P >= 0.
A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
On entry, the leading N-by-N part of this array must
contain the state dynamics matrix A. The matrix A must not
have controllable eigenvalues on the imaginary axis, if
DICO = 'C', or on the unit circle, if DICO = 'D'.
On exit, the leading NQ-by-NQ part of this array contains
the leading NQ-by-NQ part of the matrix Z'*(A+B*F)*Z, the
state dynamics matrix of the numerator factor Q, in a
real Schur form. The trailing NR-by-NR part of this matrix
represents the state dynamics matrix of a minimal
realization of the denominator factor R.
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/state matrix.
On exit, the leading NQ-by-M part of this array contains
the leading NQ-by-M part of the matrix Z'*B*V, the
input/state matrix of the numerator factor Q. The last
NR rows of this matrix form the input/state matrix of
a minimal realization of the denominator factor R.
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 state/output matrix C.
On exit, the leading P-by-NQ part of this array contains
the leading P-by-NQ part of the matrix (C+D*F)*Z,
the state/output matrix of the numerator factor Q.
LDC INTEGER
The leading dimension of array C. LDC >= MAX(1,P).
D (input/output) DOUBLE PRECISION array, dimension (LDD,M)
On entry, the leading P-by-M part of this array must
contain the input/output matrix.
On exit, the leading P-by-M part of this array contains
the matrix D*V representing the input/output matrix
of the numerator factor Q.
LDD INTEGER
The leading dimension of array D. LDD >= MAX(1,P).
NQ (output) INTEGER
The order of the resulting factors Q and R.
Generally, NQ = N - NS, where NS is the number of
uncontrollable eigenvalues outside the stability region.
NR (output) INTEGER
The order of the minimal realization of the factor R.
Generally, NR is the number of controllable eigenvalues
of A outside the stability region (the number of modified
eigenvalues).
CR (output) DOUBLE PRECISION array, dimension (LDCR,N)
The leading M-by-NQ part of this array contains the
leading M-by-NQ part of the feedback matrix F*Z, which
reflects the eigenvalues of A lying outside the stable
region to values which are symmetric with respect to the
imaginary axis (if DICO = 'C') or the unit circle (if
DICO = 'D'). The last NR columns of this matrix form the
state/output matrix of a minimal realization of the
denominator factor R.
LDCR INTEGER
The leading dimension of array CR. LDCR >= MAX(1,M).
DR (output) DOUBLE PRECISION array, dimension (LDDR,M)
The leading M-by-M part of this array contains the upper
triangular matrix V of order M representing the
input/output matrix of the denominator factor R.
LDDR INTEGER
The leading dimension of array DR. LDDR >= MAX(1,M).
Tolerances
TOL DOUBLE PRECISION
The absolute tolerance level below which the elements of
B are considered zero (used for controllability tests).
If the user sets TOL <= 0, then an implicitly computed,
default tolerance, defined by TOLDEF = N*EPS*NORM(B),
is used instead, where EPS is the machine precision
(see LAPACK Library routine DLAMCH) and NORM(B) denotes
the 1-norm of B.
Workspace
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*(N+5), M*(M+2), 4*M, 4*P ).
For optimum performance LDWORK should be larger.
Warning Indicator
IWARN INTEGER
= 0: no warning;
= K: K violations of the numerical stability condition
NORM(F) <= 10*NORM(A)/NORM(B) occured during the
assignment of eigenvalues.
Error Indicator
INFO INTEGER
= 0: successful exit;
< 0: if INFO = -i, the i-th argument had an illegal
value;
= 1: the reduction of A to a real Schur form failed;
= 2: a failure was detected during the ordering of the
real Schur form of A, or in the iterative process
for reordering the eigenvalues of Z'*(A + B*F)*Z
along the diagonal;
= 3: if DICO = 'C' and the matrix A has a controllable
eigenvalue on the imaginary axis, or DICO = 'D'
and A has a controllable eigenvalue on the unit
circle.
Method
The subroutine is based on the factorization algorithm of [1].References
[1] Varga A.
A Schur method for computing coprime factorizations with inner
denominators and applications in model reduction.
Proc. ACC'93, San Francisco, CA, pp. 2130-2131, 1993.
Numerical Aspects
3 The algorithm requires no more than 14N floating point operations.Further Comments
NoneExample
Program Text
* SB08DD EXAMPLE PROGRAM TEXT
* Copyright (c) 2002-2010 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, LDCR, LDD, LDDR
PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX,
$ LDCR = MMAX, LDD = PMAX, LDDR = MMAX )
INTEGER LDWORK
PARAMETER ( LDWORK = MAX( NMAX*( NMAX + 5 ),
$ MMAX*( MMAX + 2 ),
$ 4*NMAX, 4*PMAX ) )
* .. Local Scalars ..
DOUBLE PRECISION TOL
INTEGER I, INFO, IWARN, J, M, N, NQ, NR, P
CHARACTER*1 DICO
* .. Local Arrays ..
DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX),
$ CR(LDCR,NMAX), D(LDD,MMAX), DR(LDDR,MMAX),
$ DWORK(LDWORK)
* .. External Subroutines ..
EXTERNAL SB08DD
* .. Intrinsic Functions ..
INTRINSIC MAX
* .. 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, TOL, DICO
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 )
READ ( NIN, FMT = * ) ( ( D(I,J), J = 1, M ), I = 1, P )
* Find a RCFID for (A,B,C,D).
CALL SB08DD( DICO, N, M, P, A, LDA, B, LDB, C, LDC,
$ D, LDD, NQ, NR, CR, LDCR, DR, LDDR, TOL,
$ DWORK, LDWORK, IWARN, INFO )
*
IF ( INFO.NE.0 ) THEN
WRITE ( NOUT, FMT = 99998 ) INFO
ELSE
IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99996 )
DO 20 I = 1, NQ
WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1, NQ )
20 CONTINUE
IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99993 )
DO 40 I = 1, NQ
WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M )
40 CONTINUE
IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99992 )
DO 60 I = 1, P
WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1, NQ )
60 CONTINUE
WRITE ( NOUT, FMT = 99991 )
DO 70 I = 1, P
WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1, M )
70 CONTINUE
IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99986 )
DO 80 I = NQ-NR+1, NQ
WRITE ( NOUT, FMT = 99995 )
$ ( A(I,J), J = NQ-NR+1, NQ )
80 CONTINUE
IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99985 )
DO 90 I = NQ-NR+1, NQ
WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M )
90 CONTINUE
IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99984 )
DO 100 I = 1, M
WRITE ( NOUT, FMT = 99995 )
$ ( CR(I,J), J = NQ-NR+1, NQ )
100 CONTINUE
WRITE ( NOUT, FMT = 99983 )
DO 110 I = 1, M
WRITE ( NOUT, FMT = 99995 ) ( DR(I,J), J = 1, M )
110 CONTINUE
END IF
END IF
END IF
END IF
STOP
*
99999 FORMAT (' SB08DD EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from SB08DD = ',I2)
99996 FORMAT (/' The numerator state dynamics matrix AQ is ')
99995 FORMAT (20(1X,F8.4))
99993 FORMAT (/' The numerator input/state matrix BQ is ')
99992 FORMAT (/' The numerator state/output matrix CQ is ')
99991 FORMAT (/' The numerator input/output matrix DQ 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)
99986 FORMAT (/' The denominator state dynamics matrix AR is ')
99985 FORMAT (/' The denominator input/state matrix BR is ')
99984 FORMAT (/' The denominator state/output matrix CR is ')
99983 FORMAT (/' The denominator input/output matrix DR is ')
END
Program Data
SB08DD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 1.E-10 C -0.04165 0.0000 4.9200 0.4920 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 0.0545 0.0000 0.0000 0.0000 0.0000 0.0000 -0.49200 0.004165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 0.5210 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
SB08DD EXAMPLE PROGRAM RESULTS The numerator state dynamics matrix AQ is -1.4178 -5.1682 3.2450 -0.2173 0.0564 -4.1066 -0.2336 0.9109 -1.4178 -2.1262 0.1231 0.0805 -0.4816 0.2196 0.0000 0.0000 -13.1627 0.0608 -0.0218 3.8320 0.3429 0.0000 0.0000 0.0000 -3.5957 -3.3373 0.0816 -4.1237 0.0000 0.0000 0.0000 0.0000 -12.4245 -0.3133 4.4255 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1605 -0.0772 0.0000 0.0000 0.0000 0.0000 0.0000 0.3040 -0.1605 The numerator input/state matrix BQ is 5.0302 -0.0063 0.7078 -0.0409 -11.3663 0.0051 0.1760 0.5879 -0.0265 12.2119 1.1050 0.3215 0.0066 -2.5822 The numerator state/output matrix CQ is -0.8659 0.2787 -0.3432 0.0020 0.0000 0.2325 0.0265 0.0797 -0.3951 0.0976 -0.0292 0.0062 0.8985 0.1406 -0.0165 -0.0645 0.0097 0.8032 -0.1602 0.0874 -0.5630 The numerator input/output matrix DQ is 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The denominator state dynamics matrix AR is -0.1605 -0.0772 0.3040 -0.1605 The denominator input/state matrix BR is 1.1050 0.3215 0.0066 -2.5822 The denominator state/output matrix CR is -0.2288 -0.0259 -0.0070 0.1497 The denominator input/output matrix DR is 1.0000 0.0000 0.0000 1.0000
Click here to get a compressed (gzip) tar file containing the source code of the routine, the example program, data, documentation, and related files.
Return to index