File: MB04DS.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 (238 lines) | stat: -rw-r--r-- 8,775 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
<HTML>
<HEAD><TITLE>MB04DS - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>

<H2><A Name="MB04DS">MB04DS</A></H2>
<H3>
Balancing a real skew-Hamiltonian matrix
</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 balance a real skew-Hamiltonian matrix

                [  A   G  ]
           S =  [       T ] ,
                [  Q   A  ]

  where A is an N-by-N matrix and G, Q are N-by-N skew-symmetric
  matrices. This involves, first, permuting S by a symplectic
  similarity transformation to isolate eigenvalues in the first
  1:ILO-1 elements on the diagonal of A; and second, applying a
  diagonal similarity transformation to rows and columns
  ILO:N, N+ILO:2*N to make the rows and columns as close in 1-norm
  as possible. Both steps are optional.

</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
      SUBROUTINE MB04DS( JOB, N, A, LDA, QG, LDQG, ILO, SCALE, INFO )
C     .. Scalar Arguments ..
      CHARACTER         JOB
      INTEGER           ILO, INFO, LDA, LDQG, N
C     .. Array Arguments ..
      DOUBLE PRECISION  A(LDA,*), QG(LDQG,*), SCALE(*)

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

<B>Mode Parameters</B>
<PRE>
  JOB     CHARACTER*1
          Specifies the operations to be performed on S:
          = 'N':  none, set ILO = 1, SCALE(I) = 1.0, I = 1 .. N;
          = 'P':  permute only;
          = 'S':  scale only;
          = 'B':  both permute and scale.

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

  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the leading N-by-N part of this array must
          contain the matrix A.
          On exit, the leading N-by-N part of this array contains
          the matrix A of the balanced skew-Hamiltonian. In
          particular, the strictly lower triangular part of the
          first ILO-1 columns of A is zero.

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

  QG      (input/output) DOUBLE PRECISION array, dimension
                         (LDQG,N+1)
          On entry, the leading N-by-N+1 part of this array must
          contain in columns 1:N the strictly lower triangular part
          of the matrix Q and in columns 2:N+1 the strictly upper
          triangular part of the matrix G. The parts containing the
          diagonal and the first supdiagonal of this array are not
          referenced.
          On exit, the leading N-by-N+1 part of this array contains
          the strictly lower and strictly upper triangular parts of
          the matrices Q and G, respectively, of the balanced
          skew-Hamiltonian. In particular, the strictly lower
          triangular part of the first ILO-1 columns of QG is zero.

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

  ILO     (output) INTEGER
          ILO-1 is the number of deflated eigenvalues in the
          balanced skew-Hamiltonian matrix.

  SCALE   (output) DOUBLE PRECISION array of dimension (N)
          Details of the permutations and scaling factors applied to
          S.  For j = 1,...,ILO-1 let P(j) = SCALE(j). If P(j) &lt;= N,
          then rows and columns P(j) and P(j)+N are interchanged
          with rows and columns j and j+N, respectively. If
          P(j) &gt; N, then row and column P(j)-N are interchanged with
          row and column j+N by a generalized symplectic
          permutation. For j = ILO,...,N the j-th element of SCALE
          contains the factor of the scaling applied to row and
          column j.

</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="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
  [1] Benner, P.
      Symplectic balancing of Hamiltonian matrices.
      SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.

</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>
*     MB04DS EXAMPLE PROGRAM TEXT
*
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        ( NIN = 5, NOUT = 6 )
      INTEGER          NMAX
      PARAMETER        ( NMAX = 100 )
      INTEGER          LDA, LDQG
      PARAMETER        ( LDA = NMAX, LDQG = NMAX )
*     .. Local Scalars ..
      CHARACTER*1      JOB
      INTEGER          I, ILO, INFO, J, N
*     .. Local Arrays ..
      DOUBLE PRECISION A(LDA, NMAX), DUMMY(1), QG(LDQG, NMAX+1),
     $                 SCALE(NMAX)
*     .. External Functions ..
      DOUBLE PRECISION DLANTR, DLAPY2
      EXTERNAL         DLANTR, DLAPY2
*     .. External Subroutines ..
      EXTERNAL         MB04DS
*     .. Executable Statements ..
      WRITE ( NOUT, FMT = 99999 )
*     Skip the heading in the data file and read the data.
      READ ( NIN, FMT = '()' )
      READ ( NIN, FMT = * )  N, JOB
      IF( N.LE.0 .OR. N.GT.NMAX ) THEN
         WRITE ( NOUT, FMT = 99994 ) N
      ELSE
         READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N )
         READ ( NIN, FMT = * ) ( ( QG(I,J), J = 1,N+1 ), I = 1,N )
         CALL MB04DS( JOB, N, A, LDA, QG, LDQG, ILO, SCALE, INFO )
         IF ( INFO.NE.0 ) THEN
            WRITE ( NOUT, FMT = 99998 ) INFO
         ELSE
            WRITE ( NOUT, FMT = 99997 )
            DO 30  I = 1, N
               WRITE (NOUT, FMT = 99995) ( A(I,J), J = 1,N )
30          CONTINUE
            WRITE ( NOUT, FMT = 99996 )
            DO 40  I = 1, N
               WRITE (NOUT, FMT = 99995) ( QG(I,J), J = 1,N+1 )
40          CONTINUE
            WRITE (NOUT, FMT = 99993)  ILO
            IF ( ILO.GT.1 ) THEN
                WRITE (NOUT, FMT = 99992) DLAPY2( DLANTR( 'Frobenius',
     $                 'Lower', 'No Unit', N-1, ILO-1, A(2,1), LDA,
     $                 DUMMY ), DLANTR( 'Frobenius', 'Lower', 'No Unit',
     $                 N-1, ILO-1, QG(2,1), LDQG, DUMMY ) )
            END IF
         END IF
      END IF
*
99999 FORMAT (' MB04DS EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from MB04DS = ',I2)
99997 FORMAT (' The balanced matrix A is ')
99996 FORMAT (/' The balanced matrix QG is ')
99995 FORMAT (20(1X,F9.4))
99994 FORMAT (/' N is out of range.',/' N = ',I5)
99993 FORMAT (/' ILO = ',I4)
99992 FORMAT (/' Norm of subdiagonal blocks: ',G7.2)
      END
</PRE>
<B>Program Data</B>
<PRE>
MB04DS EXAMPLE PROGRAM DATA
       6       B
    0.0576         0    0.5208         0    0.7275   -0.7839
    0.1901    0.0439    0.1663    0.0928    0.6756   -0.5030
    0.5962         0    0.4418         0   -0.5955    0.7176
    0.5869         0    0.3939    0.0353    0.6992   -0.0147
    0.2222         0   -0.3663         0    0.5548   -0.4608
         0         0         0         0         0    0.1338
         0         0   -0.9862   -0.4544   -0.4733    0.4435         0
         0         0         0   -0.6927    0.6641    0.4453         0
   -0.3676         0         0         0    0.0841    0.3533         0
         0         0         0         0         0    0.0877         0
    0.9561         0    0.4784         0         0         0         0
   -0.0164   -0.4514   -0.8289   -0.6831   -0.1536         0         0
</PRE>
<B>Program Results</B>
<PRE>
 MB04DS EXAMPLE PROGRAM RESULTS

 The balanced matrix A is 
    0.1338    0.4514    0.6831    0.8289    0.1536    0.0164
    0.0000    0.0439    0.0928    0.1663    0.6756    0.1901
    0.0000    0.0000    0.0353    0.3939    0.6992    0.5869
    0.0000    0.0000    0.0000    0.4418   -0.5955    0.5962
    0.0000    0.0000    0.0000   -0.3663    0.5548    0.2222
    0.0000    0.0000    0.0000    0.5208    0.7275    0.0576

 The balanced matrix QG is 
    0.0000    0.0000    0.5030    0.0147   -0.7176    0.4608    0.7839
    0.0000    0.0000    0.0000    0.6641   -0.6927    0.4453    0.9862
    0.0000    0.0000    0.0000    0.0000   -0.0841    0.0877    0.4733
    0.0000    0.0000    0.0000    0.0000    0.0000    0.3533    0.4544
    0.0000    0.0000    0.0000    0.4784    0.0000    0.0000   -0.4435
    0.0000    0.0000    0.0000    0.3676   -0.9561    0.0000    0.0000

 ILO =    4

 Norm of subdiagonal blocks: 0.0    
</PRE>

<HR>
<A HREF=support.html><B>Return to Supporting Routines index</B></A></BODY>
</HTML>