File: AB05MD.html

package info (click to toggle)
slicot 5.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,528 kB
  • sloc: fortran: 148,076; makefile: 964; sh: 57
file content (455 lines) | stat: -rw-r--r-- 16,184 bytes parent folder | download | duplicates (2)
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
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
<HTML>
<HEAD><TITLE>AB05MD - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>

<H2><A Name="AB05MD">AB05MD</A></H2>
<H3>
Cascade inter-connection of two systems in state-space form
</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 obtain the state-space model (A,B,C,D) for the cascaded
  inter-connection of two systems, each given in state-space form.

</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
      SUBROUTINE AB05MD( UPLO, OVER, N1, M1, P1, N2, P2, A1, LDA1, B1,
     $                   LDB1, C1, LDC1, D1, LDD1, A2, LDA2, B2, LDB2,
     $                   C2, LDC2, D2, LDD2, N, A, LDA, B, LDB, C, LDC,
     $                   D, LDD, DWORK, LDWORK, INFO )
C     .. Scalar Arguments ..
      CHARACTER         OVER, UPLO
      INTEGER           INFO, LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC,
     $                  LDC1, LDC2, LDD, LDD1, LDD2, LDWORK, M1, N, N1,
     $                  N2, P1, P2
C     .. Array Arguments ..
      DOUBLE PRECISION  A(LDA,*), A1(LDA1,*), A2(LDA2,*), B(LDB,*),
     $                  B1(LDB1,*), B2(LDB2,*), C(LDC,*), C1(LDC1,*),
     $                  C2(LDC2,*), D(LDD,*), D1(LDD1,*), D2(LDD2,*),
     $                  DWORK(*)

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

<B>Mode Parameters</B>
<PRE>
  UPLO    CHARACTER*1
          Indicates whether the user wishes to obtain the matrix A
          in the upper or lower block diagonal form, as follows:
          = 'U':  Obtain A in the upper block diagonal form;
          = 'L':  Obtain A in the lower block diagonal form.

  OVER    CHARACTER*1
          Indicates whether the user wishes to overlap pairs of
          arrays, as follows:
          = 'N':  Do not overlap;
          = 'O':  Overlap pairs of arrays: A1 and A, B1 and B,
                  C1 and C, and D1 and D (for UPLO = 'L'), or A2
                  and A, B2 and B, C2 and C, and D2 and D (for
                  UPLO = 'U'), i.e. the same name is effectively
                  used for each pair (for all pairs) in the routine
                  call.  In this case, setting LDA1 = LDA,
                  LDB1 = LDB, LDC1 = LDC, and LDD1 = LDD, or
                  LDA2 = LDA, LDB2 = LDB, LDC2 = LDC, and LDD2 = LDD
                  will give maximum efficiency.

</PRE>
<B>Input/Output Parameters</B>
<PRE>
  N1      (input) INTEGER
          The number of state variables in the first system, i.e.
          the order of the matrix A1.  N1 &gt;= 0.

  M1      (input) INTEGER
          The number of input variables for the first system.
          M1 &gt;= 0.

  P1      (input) INTEGER
          The number of output variables from the first system and
          the number of input variables for the second system.
          P1 &gt;= 0.

  N2      (input) INTEGER
          The number of state variables in the second system, i.e.
          the order of the matrix A2.  N2 &gt;= 0.

  P2      (input) INTEGER
          The number of output variables from the second system.
          P2 &gt;= 0.

  A1      (input) DOUBLE PRECISION array, dimension (LDA1,N1)
          The leading N1-by-N1 part of this array must contain the
          state transition matrix A1 for the first system.

  LDA1    INTEGER
          The leading dimension of array A1.  LDA1 &gt;= MAX(1,N1).

  B1      (input) DOUBLE PRECISION array, dimension (LDB1,M1)
          The leading N1-by-M1 part of this array must contain the
          input/state matrix B1 for the first system.

  LDB1    INTEGER
          The leading dimension of array B1.  LDB1 &gt;= MAX(1,N1).

  C1      (input) DOUBLE PRECISION array, dimension (LDC1,N1)
          The leading P1-by-N1 part of this array must contain the
          state/output matrix C1 for the first system.

  LDC1    INTEGER
          The leading dimension of array C1.
          LDC1 &gt;= MAX(1,P1) if N1 &gt; 0.
          LDC1 &gt;= 1 if N1 = 0.

  D1      (input) DOUBLE PRECISION array, dimension (LDD1,M1)
          The leading P1-by-M1 part of this array must contain the
          input/output matrix D1 for the first system.

  LDD1    INTEGER
          The leading dimension of array D1.  LDD1 &gt;= MAX(1,P1).

  A2      (input) DOUBLE PRECISION array, dimension (LDA2,N2)
          The leading N2-by-N2 part of this array must contain the
          state transition matrix A2 for the second system.

  LDA2    INTEGER
          The leading dimension of array A2.  LDA2 &gt;= MAX(1,N2).

  B2      (input) DOUBLE PRECISION array, dimension (LDB2,P1)
          The leading N2-by-P1 part of this array must contain the
          input/state matrix B2 for the second system.

  LDB2    INTEGER
          The leading dimension of array B2.  LDB2 &gt;= MAX(1,N2).

  C2      (input) DOUBLE PRECISION array, dimension (LDC2,N2)
          The leading P2-by-N2 part of this array must contain the
          state/output matrix C2 for the second system.

  LDC2    INTEGER
          The leading dimension of array C2.
          LDC2 &gt;= MAX(1,P2) if N2 &gt; 0.
          LDC2 &gt;= 1 if N2 = 0.

  D2      (input) DOUBLE PRECISION array, dimension (LDD2,P1)
          The leading P2-by-P1 part of this array must contain the
          input/output matrix D2 for the second system.

  LDD2    INTEGER
          The leading dimension of array D2.  LDD2 &gt;= MAX(1,P2).

  N       (output) INTEGER
          The number of state variables (N1 + N2) in the resulting
          system, i.e. the order of the matrix A, the number of rows
          of B and the number of columns of C.

  A       (output) DOUBLE PRECISION array, dimension (LDA,N1+N2)
          The leading N-by-N part of this array contains the state
          transition matrix A for the cascaded system.
          If OVER = 'O', the array A can overlap A1, if UPLO = 'L',
          or A2, if UPLO = 'U'.

  LDA     INTEGER
          The leading dimension of array A.  LDA &gt;= MAX(1,N1+N2).

  B       (output) DOUBLE PRECISION array, dimension (LDB,M1)
          The leading N-by-M1 part of this array contains the
          input/state matrix B for the cascaded system.
          If OVER = 'O', the array B can overlap B1, if UPLO = 'L',
          or B2, if UPLO = 'U'.

  LDB     INTEGER
          The leading dimension of array B.  LDB &gt;= MAX(1,N1+N2).

  C       (output) DOUBLE PRECISION array, dimension (LDC,N1+N2)
          The leading P2-by-N part of this array contains the
          state/output matrix C for the cascaded system.
          If OVER = 'O', the array C can overlap C1, if UPLO = 'L',
          or C2, if UPLO = 'U'.

  LDC     INTEGER
          The leading dimension of array C.
          LDC &gt;= MAX(1,P2) if N1+N2 &gt; 0.
          LDC &gt;= 1 if N1+N2 = 0.

  D       (output) DOUBLE PRECISION array, dimension (LDD,M1)
          The leading P2-by-M1 part of this array contains the
          input/output matrix D for the cascaded system.
          If OVER = 'O', the array D can overlap D1, if UPLO = 'L',
          or D2, if UPLO = 'U'.

  LDD     INTEGER
          The leading dimension of array D.  LDD &gt;= MAX(1,P2).

</PRE>
<B>Workspace</B>
<PRE>
  DWORK   DOUBLE PRECISION array, dimension (LDWORK)
          The array DWORK is not referenced if OVER = 'N'.

  LDWORK  INTEGER
          The length of the array DWORK.
          LDWORK &gt;= MAX( 1, P1*MAX(N1, M1, N2, P2) ) if OVER = 'O'.
          LDWORK &gt;= 1 if OVER = '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.

</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
  After cascaded inter-connection of the two systems

  X1'     = A1*X1 + B1*U
  V       = C1*X1 + D1*U

  X2'     = A2*X2 + B2*V
  Y       = C2*X2 + D2*V

  (where  '  denotes differentiation with respect to time)

  the following state-space model will be obtained:

  X'      = A*X + B*U
  Y       = C*X + D*U

  where matrix  A  has the form   ( A1     0 ),
                                  ( B2*C1  A2)

        matrix  B  has the form  (  B1   ),
                                 ( B2*D1 )

        matrix  C  has the form  ( D2*C1  C2 ) and

        matrix  D  has the form  ( D2*D1 ).

  This form is returned by the routine when UPLO = 'L'.  Note that
  when A1 and A2 are block lower triangular, the resulting state
  matrix is also block lower triangular.

  By applying a similarity transformation to the system above,
  using the matrix  ( 0  I ),  where  I  is the identity matrix of
                    ( J  0 )
  order  N2,  and  J  is the identity matrix of order  N1,  the
  system matrices become

        A = ( A2  B2*C1 ),
            ( 0     A1  )

        B = ( B2*D1 ),
            (  B1   )

        C = ( C2  D2*C1 ) and

        D = ( D2*D1 ).

  This form is returned by the routine when UPLO = 'U'.  Note that
  when A1 and A2 are block upper triangular (for instance, in the
  real Schur form), the resulting state matrix is also block upper
  triangular.

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

</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE>
  The algorithm requires P1*(N1+M1)*(N2+P2) operations.

</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>
*     AB05MD EXAMPLE PROGRAM TEXT
*
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        ( NIN = 5, NOUT = 6 )
      INTEGER          N1MAX, N2MAX, NMAX, M1MAX, P1MAX, P2MAX
      PARAMETER        ( N1MAX = 20, N2MAX = 20, NMAX = N1MAX+N2MAX,
     $                   M1MAX = 20, P1MAX = 20, P2MAX = 20 )
      INTEGER          LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, LDC1,
     $                 LDC2, LDD, LDD1, LDD2, LDWORK
      PARAMETER        ( LDA = NMAX, LDA1 = N1MAX, LDA2 = N2MAX,
     $                   LDB = NMAX,LDB1 = N1MAX, LDB2 = N2MAX,
     $                   LDC = P2MAX, LDC1 = P1MAX, LDC2 = P2MAX,
     $                   LDD = P2MAX, LDD1 = P1MAX, LDD2 = P2MAX,
     $                   LDWORK = P1MAX*N1MAX )
*     .. Local Scalars ..
      CHARACTER*1      OVER, UPLO
      INTEGER          I, INFO, J, M1, N, N1, N2, P1, P2
*     .. Local Arrays ..
      DOUBLE PRECISION A(LDA,NMAX), A1(LDA1,N1MAX), A2(LDA2,N2MAX),
     $                 B(LDB,M1MAX), B1(LDB1,M1MAX), B2(LDB2,P1MAX),
     $                 C(LDC,NMAX), C1(LDC1,N1MAX), C2(LDC2,N2MAX),
     $                 D(LDD,M1MAX), D1(LDD1,M1MAX), D2(LDD2,P1MAX),
     $                 DWORK(LDWORK)
*     .. External Subroutines ..
      EXTERNAL         AB05MD
*     .. Executable Statements ..
*
      UPLO = 'Lower'
      OVER = 'N'
      WRITE ( NOUT, FMT = 99999 )
*     Skip the heading in the data file and read the data.
      READ ( NIN, FMT = '()' )
      READ ( NIN, FMT = * ) N1, M1, P1, N2, P2
      IF ( N1.LE.0 .OR. N1.GT.N1MAX ) THEN
         WRITE ( NOUT, FMT = 99992 ) N1
      ELSE
         READ ( NIN, FMT = * ) ( ( A1(I,J), J = 1,N1 ), I = 1,N1 )
         IF ( M1.LE.0 .OR. M1.GT.M1MAX ) THEN
            WRITE ( NOUT, FMT = 99991 ) M1
         ELSE
            READ ( NIN, FMT = * ) ( ( B1(I,J), I = 1,N1 ), J = 1,M1 )
            IF ( P1.LE.0 .OR. P1.GT.P1MAX ) THEN
               WRITE ( NOUT, FMT = 99990 ) P1
            ELSE
               READ ( NIN, FMT = * ) ( ( C1(I,J), J = 1,N1 ), I = 1,P1 )
               READ ( NIN, FMT = * ) ( ( D1(I,J), J = 1,M1 ), I = 1,P1 )
               IF ( N2.LE.0 .OR. N2.GT.N2MAX ) THEN
                  WRITE ( NOUT, FMT = 99989 ) N2
               ELSE
                  READ ( NIN, FMT = * )
     $                 ( ( A2(I,J), J = 1,N2 ), I = 1,N2 )
                  READ ( NIN, FMT = * )
     $                 ( ( B2(I,J), I = 1,N2 ), J = 1,P1 )
                  IF ( P2.LE.0 .OR. P2.GT.P2MAX ) THEN
                     WRITE ( NOUT, FMT = 99988 ) P2
                  ELSE
                     READ ( NIN, FMT = * )
     $                    ( ( C2(I,J), J = 1,N2 ), I = 1,P2 )
                     READ ( NIN, FMT = * )
     $                    ( ( D2(I,J), J = 1,P1 ), I = 1,P2 )
*                    Find the state-space model (A,B,C,D).
                     CALL AB05MD( UPLO, OVER, N1, M1, P1, N2, P2, A1,
     $                            LDA1, B1, LDB1, C1, LDC1, D1, LDD1,
     $                            A2, LDA2, B2, LDB2, C2, LDC2, D2,
     $                            LDD2, N, A, LDA, B, LDB, C, LDC, D,
     $                            LDD, DWORK, LDWORK, INFO )
*
                     IF ( INFO.NE.0 ) THEN
                        WRITE ( NOUT, FMT = 99998 ) INFO
                     ELSE
                        WRITE ( NOUT, FMT = 99997 )
                        DO 20 I = 1, N
                           WRITE ( NOUT, FMT = 99996 )
     $                           ( A(I,J), J = 1,N )
   20                   CONTINUE
                        WRITE ( NOUT, FMT = 99995 )
                        DO 40 I = 1, N
                           WRITE ( NOUT, FMT = 99996 )
     $                           ( B(I,J), J = 1,M1 )
   40                   CONTINUE
                        WRITE ( NOUT, FMT = 99994 )
                        DO 60 I = 1, P2
                           WRITE ( NOUT, FMT = 99996 )
     $                           ( C(I,J), J = 1,N )
   60                   CONTINUE
                        WRITE ( NOUT, FMT = 99993 )
                        DO 80 I = 1, P2
                           WRITE ( NOUT, FMT = 99996 )
     $                           ( D(I,J), J = 1,M1 )
   80                   CONTINUE
                     END IF
                  END IF
               END IF
            END IF
         END IF
      END IF
      STOP
*
99999 FORMAT (' AB05MD EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from AB05MD = ',I2)
99997 FORMAT (' The state transition matrix of the cascaded system is ')
99996 FORMAT (20(1X,F8.4))
99995 FORMAT (/' The input/state matrix of the cascaded system is ')
99994 FORMAT (/' The state/output matrix of the cascaded system is ')
99993 FORMAT (/' The input/output matrix of the cascaded system is ')
99992 FORMAT (/' N1 is out of range.',/' N1 = ',I5)
99991 FORMAT (/' M1 is out of range.',/' M1 = ',I5)
99990 FORMAT (/' P1 is out of range.',/' P1 = ',I5)
99989 FORMAT (/' N2 is out of range.',/' N2 = ',I5)
99988 FORMAT (/' P2 is out of range.',/' P2 = ',I5)
      END
</PRE>
<B>Program Data</B>
<PRE>
 AB05MD EXAMPLE PROGRAM DATA
   3     2     2     3     2
   1.0   0.0  -1.0
   0.0  -1.0   1.0
   1.0   1.0   2.0
   1.0   1.0   0.0
   2.0   0.0   1.0
   3.0  -2.0   1.0
   0.0   1.0   0.0
   1.0   0.0
   0.0   1.0
  -3.0   0.0   0.0
   1.0   0.0   1.0
   0.0  -1.0   2.0
   0.0  -1.0   0.0
   1.0   0.0   2.0
   1.0   1.0   0.0
   1.0   1.0  -1.0
   1.0   1.0
   0.0   1.0
</PRE>
<B>Program Results</B>
<PRE>
 AB05MD EXAMPLE PROGRAM RESULTS

 The state transition matrix of the cascaded system is 
   1.0000   0.0000  -1.0000   0.0000   0.0000   0.0000
   0.0000  -1.0000   1.0000   0.0000   0.0000   0.0000
   1.0000   1.0000   2.0000   0.0000   0.0000   0.0000
   0.0000   1.0000   0.0000  -3.0000   0.0000   0.0000
  -3.0000   2.0000  -1.0000   1.0000   0.0000   1.0000
   0.0000   2.0000   0.0000   0.0000  -1.0000   2.0000

 The input/state matrix of the cascaded system is 
   1.0000   2.0000
   1.0000   0.0000
   0.0000   1.0000
   0.0000   1.0000
  -1.0000   0.0000
   0.0000   2.0000

 The state/output matrix of the cascaded system is 
   3.0000  -1.0000   1.0000   1.0000   1.0000   0.0000
   0.0000   1.0000   0.0000   1.0000   1.0000  -1.0000

 The input/output matrix of the cascaded system is 
   1.0000   1.0000
   0.0000   1.0000
</PRE>

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