control_systems_torbox 0.2.1

Control systems toolbox
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<HTML>
<HEAD><TITLE>MB03XP - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>

<H2><A Name="MB03XP">MB03XP</A></H2>
<H3>
Computing periodic Schur decomposition and eigenvalues of a matrix product A B, with A upper Hessenberg and B upper triangular
</H3>
<A HREF ="#Specification"><B>[Specification]</B></A>
<A HREF ="#Arguments"><B>[Arguments]</B></A>
<A HREF ="#Method"><B>[Method]</B></A>
<A HREF ="#References"><B>[References]</B></A>
<A HREF ="#Comments"><B>[Comments]</B></A>
<A HREF ="#Example"><B>[Example]</B></A>

<P>
<B><FONT SIZE="+1">Purpose</FONT></B>
<PRE>
  To compute the periodic Schur decomposition and the eigenvalues of
  a product of matrices, H = A*B, with A upper Hessenberg and B
  upper triangular without evaluating any part of the product.
  Specifically, the matrices Q and Z are computed, so that

       Q' * A * Z = S,    Z' * B * Q = T

  where S is in real Schur form, and T is upper triangular.

</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
      SUBROUTINE MB03XP( JOB, COMPQ, COMPZ, N, ILO, IHI, A, LDA, B, LDB,
     $                   Q, LDQ, Z, LDZ, ALPHAR, ALPHAI, BETA, DWORK,
     $                   LDWORK, INFO )
C     .. Scalar Arguments ..
      CHARACTER          COMPQ, COMPZ, JOB
      INTEGER            IHI, ILO, INFO, LDA, LDB, LDQ, LDWORK, LDZ, N
C     .. Array Arguments ..
      DOUBLE PRECISION   A(LDA,*), ALPHAI(*), ALPHAR(*), B(LDB,*),
     $                   BETA(*), DWORK(*), Q(LDQ,*), Z(LDZ,*)

</PRE>
<A name="Arguments"><B><FONT SIZE="+1">Arguments</FONT></B></A>
<P>

<B>Mode Parameters</B>
<PRE>
  JOB     CHARACTER*1
          Indicates whether the user wishes to compute the full
          Schur form or the eigenvalues only, as follows:
          = 'E':  Compute the eigenvalues only;
          = 'S':  compute the factors S and T of the full
                  Schur form.

  COMPQ   CHARACTER*1
          Indicates whether or not the user wishes to accumulate
          the matrix Q as follows:
          = 'N':  The matrix Q is not required;
          = 'I':  Q is initialized to the unit matrix and the
                  orthogonal transformation matrix Q is returned;
          = 'V':  Q must contain an orthogonal matrix U on entry,
                  and the product U*Q is returned.

  COMPZ   CHARACTER*1
          Indicates whether or not the user wishes to accumulate
          the matrix Z as follows:
          = 'N':  The matrix Z is not required;
          = 'I':  Z is initialized to the unit matrix and the
                  orthogonal transformation matrix Z is returned;
          = 'V':  Z must contain an orthogonal matrix U on entry,
                  and the product U*Z is returned.

</PRE>
<B>Input/Output Parameters</B>
<PRE>
  N       (input) INTEGER
          The order of the matrices A and B. N &gt;= 0.

  ILO     (input) INTEGER
  IHI     (input) INTEGER
          It is assumed that the matrices A and B are already upper
          triangular in rows and columns 1:ILO-1 and IHI+1:N.
          The routine works primarily with the submatrices in rows
          and columns ILO to IHI, but applies the transformations to
          all the rows and columns of the matrices A and B, if
          JOB = 'S'.
          1 &lt;= ILO &lt;= max(1,N+1); min(ILO,N) &lt;= IHI &lt;= N.

  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the leading N-by-N part of this array A must
          contain the upper Hessenberg matrix A.
          On exit, if JOB = 'S', the leading N-by-N part of this
          array is upper quasi-triangular with any 2-by-2 diagonal
          blocks corresponding to a pair of complex conjugated
          eigenvalues.
          If JOB = 'E', the diagonal elements and 2-by-2 diagonal
          blocks of A will be correct, but the remaining parts of A
          are unspecified on exit.

  LDA     INTEGER
          The leading dimension of the array A.  LDA &gt;= MAX(1,N).

  B       (input/output) DOUBLE PRECISION array, dimension (LDB,N)
          On entry, the leading N-by-N part of this array B must
          contain the upper triangular matrix B.
          On exit, if JOB = 'S', the leading N-by-N part of this
          array contains the transformed upper triangular matrix.
          2-by-2 blocks in B corresponding to 2-by-2 blocks in A
          will be reduced to positive diagonal form. (I.e., if
          A(j+1,j) is non-zero, then B(j+1,j)=B(j,j+1)=0 and B(j,j)
          and B(j+1,j+1) will be positive.)
          If JOB = 'E', the elements corresponding to diagonal
          elements and 2-by-2 diagonal blocks in A will be correct,
          but the remaining parts of B are unspecified on exit.

  LDB     INTEGER
          The leading dimension of the array B.  LDB &gt;= MAX(1,N).

  Q       (input/output) DOUBLE PRECISION array, dimension (LDQ,N)
          On entry, if COMPQ = 'V', then the leading N-by-N part of
          this array must contain a matrix Q which is assumed to be
          equal to the unit matrix except for the submatrix
          Q(ILO:IHI,ILO:IHI).
          If COMPQ = 'I', Q need not be set on entry.
          On exit, if COMPQ = 'V' or COMPQ = 'I' the leading N-by-N
          part of this array contains the transformation matrix
          which produced the Schur form.
          If COMPQ = 'N', Q is not referenced.

  LDQ     INTEGER
          The leading dimension of the array Q.  LDQ &gt;= 1.
          If COMPQ &lt;&gt; 'N', LDQ &gt;= MAX(1,N).

  Z       (input/output) DOUBLE PRECISION array, dimension (LDZ,N)
          On entry, if COMPZ = 'V', then the leading N-by-N part of
          this array must contain a matrix Z which is assumed to be
          equal to the unit matrix except for the submatrix
          Z(ILO:IHI,ILO:IHI).
          If COMPZ = 'I', Z need not be set on entry.
          On exit, if COMPZ = 'V' or COMPZ = 'I' the leading N-by-N
          part of this array contains the transformation matrix
          which produced the Schur form.
          If COMPZ = 'N', Z is not referenced.

  LDZ     INTEGER
          The leading dimension of the array Z.  LDZ &gt;= 1.
          If COMPZ &lt;&gt; 'N', LDZ &gt;= MAX(1,N).

  ALPHAR  (output) DOUBLE PRECISION array, dimension (N)
  ALPHAI  (output) DOUBLE PRECISION array, dimension (N)
  BETA    (output) DOUBLE PRECISION array, dimension (N)
          The i-th (1 &lt;= i &lt;= N) computed eigenvalue is given by
          BETA(I) * ( ALPHAR(I) + sqrt(-1)*ALPHAI(I) ). If two
          eigenvalues are computed as a complex conjugate pair,
          they are stored in consecutive elements of ALPHAR, ALPHAI
          and BETA. If JOB = 'S', the eigenvalues are stored in the
          same order as on the diagonales of the Schur forms of A
          and B.

</PRE>
<B>Workspace</B>
<PRE>
  DWORK   DOUBLE PRECISION array, dimension (LDWORK)
          On exit, if INFO = 0,  DWORK(1)  returns the optimal
          value of LDWORK.
          On exit, if  INFO = -19,  DWORK(1)  returns the minimum
          value of LDWORK.

  LDWORK  INTEGER
          The length of the array DWORK.  LDWORK &gt;= MAX(1,N).

</PRE>
<B>Error Indicator</B>
<PRE>
  INFO    INTEGER
          = 0:  successful exit;
          &lt; 0:  if INFO = -i, the i-th argument had an illegal
                value;
          &gt; 0:  if INFO = i, then MB03XP failed to compute the Schur
                form in a total of 30*(IHI-ILO+1) iterations;
                elements 1:ilo-1 and i+1:n of ALPHAR, ALPHAI and
                BETA contain successfully computed eigenvalues.

</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
  The implemented algorithm is a multi-shift version of the periodic
  QR algorithm described in [1,3] with some minor modifications
  proposed in [2].

</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
  [1] Bojanczyk, A.W., Golub, G.H., and Van Dooren, P.
      The periodic Schur decomposition: Algorithms and applications.
      Proc. of the SPIE Conference (F.T. Luk, Ed.), 1770, pp. 31-42,
      1992.

  [2] Kressner, D.
      An efficient and reliable implementation of the periodic QZ
      algorithm. Proc. of the IFAC Workshop on Periodic Control
      Systems, pp. 187-192, 2001.

  [3] Van Loan, C.
      Generalized Singular Values with Algorithms and Applications.
      Ph. D. Thesis, University of Michigan, 1973.

</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE>
  The algorithm requires O(N**3) floating point operations and is
  backward stable.

</PRE>

<A name="Comments"><B><FONT SIZE="+1">Further Comments</FONT></B></A>
<PRE>
  None
</PRE>

<A name="Example"><B><FONT SIZE="+1">Example</FONT></B></A>
<P>
<B>Program Text</B>
<PRE>
*     MB03XP EXAMPLE PROGRAM TEXT
*
*     .. Parameters ..
      DOUBLE PRECISION ZERO, ONE
      PARAMETER        ( ZERO = 0.0D0, ONE = 1.0D0 )
      INTEGER          NIN, NOUT
      PARAMETER        ( NIN = 5, NOUT = 6 )
      INTEGER          NMAX
      PARAMETER        ( NMAX = 200 )
      INTEGER          LDA, LDB, LDQ, LDRES, LDZ, LDWORK
      PARAMETER        ( LDA = NMAX, LDB = NMAX, LDQ = NMAX,
     $                   LDRES = NMAX, LDWORK = NMAX, LDZ = NMAX )
*     .. Local Scalars ..
      INTEGER          I, IHI, ILO, INFO, J, N
*     .. Local Arrays ..
      DOUBLE PRECISION A(LDA,NMAX), ALPHAI(NMAX), ALPHAR(NMAX),
     $                 B(LDA,NMAX), BETA(NMAX), DWORK(LDWORK),
     $                 Q(LDQ,NMAX), RES(LDRES,3*NMAX), Z(LDZ,NMAX)
*     .. External Functions ..
      DOUBLE PRECISION DLANGE
      EXTERNAL         DLANGE
*     .. External Subroutines ..
      EXTERNAL         DGEMM, MB03XP
*     .. Executable Statements ..
      WRITE ( NOUT, FMT = 99999 )
*     Skip the heading in the data file and read the data.
      READ ( NIN, FMT = '()' )
      READ ( NIN, FMT = * )  N, ILO, IHI
      IF( N.LE.0 .OR. N.GT.NMAX ) THEN
         WRITE ( NOUT, FMT = 99990 ) N
      ELSE
         READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N )
         CALL DLACPY( 'All', N, N, A, LDA, RES(1,N+1), LDRES )
         READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,N )
         CALL DLACPY( 'All', N, N, B, LDB, RES(1,2*N+1), LDRES )
         CALL MB03XP( 'S', 'I', 'I', N, ILO, IHI, A, LDA, B, LDB, Q,
     $                LDQ, Z, LDZ, ALPHAR, ALPHAI, BETA, DWORK, LDWORK,
     $                INFO )
         IF ( INFO.NE.0 ) THEN
            WRITE ( NOUT, FMT = 99998 ) INFO
         ELSE
            WRITE ( NOUT, FMT = 99996 )
            DO 10  I = 1, N
               WRITE (NOUT, FMT = 99991) ( A(I,J), J = 1,N )
10          CONTINUE
            CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE,
     $                  RES(1,N+1), LDRES, Z, LDZ, ZERO, RES, LDRES )
            CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, -ONE,
     $                  Q, LDQ, A, LDA, ONE, RES, LDRES )
            WRITE ( NOUT, FMT = 99989 ) DLANGE( 'Frobenius', N, N, RES,
     $                                          LDRES, DWORK )
            WRITE ( NOUT, FMT = 99995 )
            DO 20  I = 1, N
               WRITE (NOUT, FMT = 99991) ( B(I,J), J = 1,N )
20          CONTINUE
            CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE,
     $                  RES(1,2*N+1), LDRES, Q, LDQ, ZERO, RES, LDRES )
            CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, -ONE,
     $                  Z, LDZ, B, LDB, ONE, RES, LDRES )
            WRITE ( NOUT, FMT = 99988 ) DLANGE( 'Frobenius', N, N, RES,
     $                                          LDRES, DWORK )
            WRITE ( NOUT, FMT = 99994 )
            DO 30  I = 1, N
               WRITE (NOUT, FMT = 99991) ( Q(I,J), J = 1,N )
30          CONTINUE
            CALL DGEMM( 'Transpose', 'No Transpose', N, N, N, ONE, Q,
     $                  LDQ, Q, LDQ, ONE, RES, LDRES )
            DO 40  I = 1, N
               RES(I,I) = RES(I,I) - ONE
40          CONTINUE
            WRITE ( NOUT, FMT = 99987 ) DLANGE( 'Frobenius', N, N, RES,
     $                                          LDRES, DWORK )
            WRITE ( NOUT, FMT = 99993 )
            DO 50  I = 1, N
               WRITE (NOUT, FMT = 99991) ( Z(I,J), J = 1,N )
50          CONTINUE
            CALL DGEMM( 'Transpose', 'No Transpose', N, N, N, ONE, Z,
     $                  LDZ, Z, LDZ, ONE, RES, LDRES )
            DO 60 I = 1, N
               RES(I,I) = RES(I,I) - ONE
60          CONTINUE
            WRITE ( NOUT, FMT = 99986 ) DLANGE( 'Frobenius', N, N, RES,
     $                                          LDRES, DWORK )
            WRITE ( NOUT, FMT = 99992 )
            DO 70  I = 1, N
               WRITE ( NOUT, FMT = 99991 )
     $                 ALPHAR(I), ALPHAI(I), BETA(I)
70          CONTINUE
         END IF
      END IF
*
      STOP
*
99999 FORMAT (' MB03XP EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from MB03XP = ',I2)
99996 FORMAT (' The reduced matrix A is ')
99995 FORMAT (/' The reduced matrix B is ')
99994 FORMAT (/' The orthogonal factor Q is ')
99993 FORMAT (/' The orthogonal factor Z is ')
99992 FORMAT (/4X,'ALPHAR',4X,'ALPHAI',4X,'BETA')
99991 FORMAT (1000(1X,F9.4))
99990 FORMAT (/' N is out of range.',/' N = ',I5)
99989 FORMAT (/' Residual: || A*Z - Q*S ||_F = ',G7.2)
99988 FORMAT (/' Residual: || B*Q - Z*T ||_F = ',G7.2)
99987 FORMAT (/' Orthogonality of Q: || Q''*Q - I ||_F = ',G7.2)
99986 FORMAT (/' Orthogonality of Z: || Z''*Z - I ||_F = ',G7.2)
      END
</PRE>
<B>Program Data</B>
<PRE>
MB03XP EXAMPLE PROGRAM DATA
        8       1       8
    0.9708   -1.1156   -0.0884   -0.2684    0.2152    0.0402    0.0333    0.5141
   -1.6142    2.8635    1.0420   -0.2295   -0.3560    0.4885    0.1026   -0.0164
         0    1.1138    0.3509   -0.0963    0.0875    0.2158    0.2444   -0.2838
         0         0   -0.5975    0.1021   -0.1026   -0.0062   -0.2646   -0.0745
         0         0         0    0.6181    0.1986    0.3612   -0.1750    0.3332
         0         0         0         0   -0.7387   -0.5201    0.0713    0.0501
         0         0         0         0         0   -0.2677   -0.4918   -0.2838
         0         0         0         0         0         0    0.3011    0.3389
    0.9084    0.1739    0.5915    0.8729    0.8188    0.1911    0.4122    0.5527
         0    0.1708    0.1197    0.2379    0.4302    0.4225    0.9016    0.4001
         0         0    0.0381    0.6458    0.8903    0.8560    0.0056    0.1988
         0         0         0    0.9669    0.7349    0.4902    0.2974    0.6252
         0         0         0         0    0.6873    0.8159    0.0492    0.7334
         0         0         0         0         0    0.4608    0.6932    0.3759
         0         0         0         0         0         0    0.6501    0.0099
         0         0         0         0         0         0         0    0.4199
</PRE>
<B>Program Results</B>
<PRE>
 MB03XP EXAMPLE PROGRAM RESULTS

 The reduced matrix A is 
   -0.6290   -0.1397   -0.0509    0.1603   -0.3248    0.2381    0.0694    0.0103
    1.5112   -3.4273   -0.4485   -0.4357   -0.3456    0.4619    0.5998    0.5654
    0.0000    0.0000    0.0547   -0.4360    0.1714   -0.2103   -0.0900   -0.4011
    0.0000    0.0000    0.6623    0.2038    0.2796   -0.2629    0.3837    0.2382
    0.0000    0.0000    0.0000    0.0000   -0.6315    0.2071   -0.0174   -0.3538
    0.0000    0.0000    0.0000    0.0000    0.0000   -0.5850   -0.1813    0.2435
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000   -0.7884    0.1535
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.2832

 Residual: || A*Z - Q*S ||_F = .60E-14

 The reduced matrix B is 
   -0.9231    0.0000   -0.9834    0.1805    0.4428    0.3655   -0.4300    0.8498
    0.0000   -0.1837   -0.1873    0.0681    0.8412   -0.0556    0.0538    0.6113
    0.0000    0.0000   -1.8997    0.0000    0.5651   -0.2785    0.2882    1.0458
    0.0000    0.0000    0.0000   -0.2602    0.3527   -0.0020   -0.3396    0.2739
    0.0000    0.0000    0.0000    0.0000    0.8521   -0.0164    0.2115    0.5446
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0283   -0.5128    0.0153
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.4153    0.4587
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.5894

 Residual: || B*Q - Z*T ||_F = .55E-14

 The orthogonal factor Q is 
   -0.5333    0.3661   -0.1179    0.0264    0.0026    0.7527    0.0018    0.0189
    0.0583   -0.8833   -0.0666   -0.0007    0.0017    0.4603    0.0050    0.0092
   -0.8414   -0.2927    0.0347    0.0452   -0.0005   -0.4498   -0.0269    0.0001
    0.0077    0.0046   -0.5687   -0.4810    0.0227   -0.0708   -0.6500    0.1312
    0.0598    0.0059   -0.6128    0.7656    0.1348   -0.0863    0.0038    0.0954
   -0.0242   -0.0016   -0.4295   -0.4163    0.3871   -0.0709    0.6964   -0.0417
    0.0027    0.0001    0.3109    0.0620    0.8615    0.0378   -0.2267    0.3231
    0.0012    0.0000    0.0188   -0.0514   -0.2987   -0.0172    0.2010    0.9312

 Orthogonality of Q: || Q'*Q - I ||_F = .63E-14

 The orthogonal factor Z is 
    0.9957   -0.0786    0.0397   -0.0032    0.0006    0.0227    0.0104    0.0123
    0.0764    0.9956    0.0200    0.0073   -0.0009    0.0389    0.0263    0.0193
   -0.0062    0.0235    0.6714   -0.0229    0.0271   -0.4461   -0.5354   -0.2486
   -0.0445   -0.0437    0.6098    0.4197   -0.0656    0.6125    0.1248    0.2302
   -0.0242   -0.0148    0.4049   -0.6041    0.2808   -0.1328    0.5972    0.1311
    0.0096    0.0037   -0.0183    0.6539    0.5114   -0.4136    0.3620   -0.0913
   -0.0019   -0.0004   -0.1055   -0.1544    0.7891    0.2944   -0.4436    0.2426
   -0.0005    0.0000   -0.0039    0.0826   -0.1786   -0.3853   -0.1119    0.8946

 Orthogonality of Z: || Z'*Z - I ||_F = .78E-14

    ALPHAR    ALPHAI    BETA
    0.4723    0.1464    1.2811
    0.4723   -0.1464    1.2811
   -0.0318    0.1527    2.4691
   -0.0318   -0.1527    2.4691
   -0.6315    0.0000    0.8521
   -0.5850    0.0000    0.0283
   -0.7884    0.0000    0.4153
    0.2832    0.0000    0.5894
</PRE>

<HR>
<p>
<A HREF=..\libindex.html><B>Return to index</B></A></BODY>
</HTML>