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
|
<HTML>
<HEAD><TITLE>MB4DLZ - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>
<H2><A Name="MB4DLZ">MB4DLZ</A></H2>
<H3>
Balancing a complex pencil, optionally avoiding large norms for the scaled (sub)matrices
</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 pair of N-by-N complex matrices (A,B). This involves,
first, permuting A and B by equivalence transformations to isolate
eigenvalues in the first 1 to ILO-1 and last IHI+1 to N elements
on the diagonal of A and B; and second, applying a diagonal
equivalence transformation to rows and columns ILO to IHI to make
the rows and columns as close in 1-norm as possible. Both steps
are optional. Balancing may reduce the 1-norms of the matrices,
and improve the accuracy of the computed eigenvalues and/or
eigenvectors in the generalized eigenvalue problem
A*x = lambda*B*x.
This routine may optionally improve the conditioning of the
scaling transformation compared to the LAPACK routine ZGGBAL.
</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
SUBROUTINE MB4DLZ( JOB, N, THRESH, A, LDA, B, LDB, ILO, IHI,
$ LSCALE, RSCALE, DWORK, IWARN, INFO )
C .. Scalar Arguments ..
CHARACTER JOB
INTEGER IHI, ILO, INFO, IWARN, LDA, LDB, N
DOUBLE PRECISION THRESH
C .. Array Arguments ..
DOUBLE PRECISION DWORK(*), LSCALE(*), RSCALE(*)
COMPLEX*16 A(LDA,*), B(LDB,*)
</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 A and B:
= 'N': none: simply set ILO = 1, LSCALE(I) = 1.0 and
RSCALE(I) = 1.0 for 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 matrices A and B. N >= 0.
THRESH (input) DOUBLE PRECISION
If JOB = 'S' or JOB = 'B', and THRESH >= 0, threshold
value for magnitude of the elements to be considered in
the scaling process: elements with magnitude less than or
equal to THRESH*MXNORM are ignored for scaling, where
MXNORM is the maximum of the 1-norms of the original
submatrices A(s,s) and B(s,s), with s = ILO:IHI.
If THRESH < 0, the subroutine finds the scaling factors
for which some conditions, detailed below, are fulfilled.
A sequence of increasing strictly positive threshold
values is used.
If THRESH = -1, the condition is that
max( norm(A(s,s),1)/norm(B(s,s),1),
norm(B(s,s),1)/norm(S(s,s),1) ) (1)
has the smallest value, for the threshold values used,
where A(s,s) and B(s,s) are the scaled submatrices.
If THRESH = -2, the norm ratio reduction (1) is tried, but
the subroutine may return IWARN = 1 and reset the scaling
factors to 1, if this seems suitable. See the description
of the argument IWARN and FURTHER COMMENTS.
If THRESH = -3, the condition is that
norm(A(s,s),1)*norm(B(s,s),1) (2)
has the smallest value for the scaled submatrices.
If THRESH = -4, the norm reduction in (2) is tried, but
the subroutine may return IWARN = 1 and reset the scaling
factors to 1, as for THRESH = -2 above.
If THRESH = -VALUE, with VALUE >= 10, the condition
numbers of the left and right scaling transformations will
be bounded by VALUE, i.e., the ratios between the largest
and smallest entries in LSCALE(s) and RSCALE(s), will be
at most VALUE. VALUE should be a power of 10.
If JOB = 'N' or JOB = 'P', the value of THRESH is
irrelevant.
A (input/output) COMPLEX*16 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 balanced matrix A.
In particular, the strictly lower triangular part of the
first ILO-1 columns and the last N-IHI rows of A is zero.
LDA INTEGER
The leading dimension of the array A. LDA >= MAX(1,N).
B (input/output) COMPLEX*16 array, dimension (LDB, N)
On entry, the leading N-by-N part of this array must
contain the matrix B.
On exit, the leading N-by-N part of this array contains
the balanced matrix B.
In particular, the strictly lower triangular part of the
first ILO-1 columns and the last N-IHI rows of B is zero.
If JOB = 'N', the arrays A and B are not referenced.
LDB INTEGER
The leading dimension of the array B. LDB >= MAX(1, N).
ILO (output) INTEGER
IHI (output) INTEGER
ILO and IHI are set to integers such that on exit
A(i,j) = 0 and B(i,j) = 0 if i > j and
j = 1,...,ILO-1 or i = IHI+1,...,N.
If JOB = 'N' or 'S', ILO = 1 and IHI = N.
LSCALE (output) DOUBLE PRECISION array, dimension (N)
Details of the permutations and scaling factors applied
to the left side of A and B. If P(j) is the index of the
row interchanged with row j, and D(j) is the scaling
factor applied to row j, then
LSCALE(j) = P(j) for j = 1,...,ILO-1
= D(j) for j = ILO,...,IHI
= P(j) for j = IHI+1,...,N.
The order in which the interchanges are made is N to
IHI+1, then 1 to ILO-1.
RSCALE (output) DOUBLE PRECISION array, dimension (N)
Details of the permutations and scaling factors applied
to the right side of A and B. If P(j) is the index of the
column interchanged with column j, and D(j) is the scaling
factor applied to column j, then
RSCALE(j) = P(j) for j = 1,...,ILO-1
= D(j) for j = ILO,...,IHI
= P(j) for j = IHI+1,...,N.
The order in which the interchanges are made is N to
IHI+1, then 1 to ILO-1.
</PRE>
<B>Workspace</B>
<PRE>
DWORK DOUBLE PRECISION array, dimension (LDWORK) where
LDWORK = 0, if JOB = 'N' or JOB = 'P', or N = 0;
LDWORK = 6*N, if (JOB = 'S' or JOB = 'B') and THRESH >= 0;
LDWORK = 8*N, if (JOB = 'S' or JOB = 'B') and THRESH < 0.
On exit, if JOB = 'S' or JOB = 'B', DWORK(1) and DWORK(2)
contain the initial 1-norms of A(s,s) and B(s,s), and
DWORK(3) and DWORK(4) contain their final 1-norms,
respectively. Moreover, DWORK(5) contains the THRESH value
used (irrelevant if IWARN = 1 or ILO = IHI).
</PRE>
<B>Warning Indicator</B>
<PRE>
IWARN INTEGER
= 0: no warning;
= 1: scaling has been requested, for THRESH = -2 or
THRESH = -4, but it most probably would not improve
the accuracy of the computed solution for a related
eigenproblem (since maximum norm increased
significantly compared to the original pencil
matrices and (very) high and/or small scaling
factors occurred). The returned scaling factors have
been reset to 1, but information about permutations,
if requested, has been preserved.
</PRE>
<B>Error Indicator</B>
<PRE>
INFO INTEGER
= 0: successful exit.
< 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>
Balancing consists of applying an equivalence transformation
to isolate eigenvalues and/or to make the 1-norms of the rows
and columns ILO,...,IHI of A and B nearly equal. If THRESH < 0,
a search is performed to find those scaling factors giving the
smallest norm ratio or product defined above (see the description
of the parameter THRESH).
Assuming JOB = 'S', let Dl and Dr be diagonal matrices containing
the vectors LSCALE and RSCALE, respectively. The returned matrices
are obtained using the equivalence transformation
Dl*A*Dr and Dl*B*Dr.
For THRESH = 0, the routine returns essentially the same results
as the LAPACK subroutine ZGGBAL [1]. Setting THRESH < 0, usually
gives better results than ZGGBAL for badly scaled matrix pencils.
</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
[1] Anderson, E., Bai, Z., Bischof, C., Demmel, J., Dongarra, J.,
Du Croz, J., Greenbaum, A., Hammarling, S., McKenney, A.,
Ostrouchov, S., and Sorensen, D.
LAPACK Users' Guide: Second Edition.
SIAM, Philadelphia, 1995.
</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE>
No rounding errors appear if JOB = 'P'.
</PRE>
<A name="Comments"><B><FONT SIZE="+1">Further Comments</FONT></B></A>
<PRE>
If THRESH = -2, the increase of the maximum norm of the scaled
submatrices, compared to the maximum norm of the initial
submatrices, is bounded by MXGAIN = 100.
If THRESH = -2, or THRESH = -4, the maximum condition number of
the scaling transformations is bounded by MXCOND = 1/SQRT(EPS),
where EPS is the machine precision (see LAPACK Library routine
DLAMCH).
</PRE>
<A name="Example"><B><FONT SIZE="+1">Example</FONT></B></A>
<P>
<B>Program Text</B>
<PRE>
* MB4DLZ EXAMPLE PROGRAM TEXT
*
* .. Parameters ..
INTEGER NIN, NOUT
PARAMETER ( NIN = 5, NOUT = 6 )
INTEGER NMAX
PARAMETER ( NMAX = 10 )
INTEGER LDA, LDB
PARAMETER ( LDA = NMAX, LDB = NMAX )
* .. Local Scalars ..
CHARACTER*1 JOB
INTEGER I, ILO, INFO, IWARN, J, N
DOUBLE PRECISION THRESH
* .. Local Arrays ..
COMPLEX*16 A(LDA, NMAX ), B( LDB, NMAX )
DOUBLE PRECISION DWORK(8*NMAX), LSCALE(NMAX), RSCALE(NMAX)
* .. External Functions ..
LOGICAL LSAME
EXTERNAL LSAME
* .. External Subroutines ..
EXTERNAL MB4DLZ
* .. 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, THRESH
IF( N.LE.0 .OR. N.GT.NMAX ) THEN
WRITE ( NOUT, FMT = 99985 ) N
ELSE
READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N )
READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,N )
CALL MB4DLZ( JOB, N, THRESH, A, LDA, B, LDB, ILO, IHI, LSCALE,
$ RSCALE, DWORK, IWARN, INFO )
IF ( INFO.NE.0 ) THEN
WRITE ( NOUT, FMT = 99998 ) INFO
ELSE
WRITE ( NOUT, FMT = 99997 )
DO 10 I = 1, N
WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N )
10 CONTINUE
WRITE ( NOUT, FMT = 99996 )
DO 40 I = 1, N
WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,N )
40 CONTINUE
WRITE ( NOUT, FMT = 99994 ) ILO
WRITE ( NOUT, FMT = 99993 ) IHI
WRITE ( NOUT, FMT = 99991 )
WRITE ( NOUT, FMT = 99992 ) ( LSCALE(I), I = 1,N )
WRITE ( NOUT, FMT = 99990 )
WRITE ( NOUT, FMT = 99992 ) ( RSCALE(I), I = 1,N )
IF ( LSAME( JOB, 'S' ) .OR. LSAME( JOB, 'B' ) ) THEN
IF ( .NOT.( THRESH.EQ.-2 .OR. THRESH.EQ.-4 ) ) THEN
WRITE ( NOUT, FMT = 99989 )
WRITE ( NOUT, FMT = 99992 ) ( DWORK(I), I = 1,2 )
WRITE ( NOUT, FMT = 99988 )
WRITE ( NOUT, FMT = 99992 ) ( DWORK(I), I = 3,4 )
WRITE ( NOUT, FMT = 99987 )
WRITE ( NOUT, FMT = 99992 ) ( DWORK(5) )
ELSE
WRITE ( NOUT, FMT = 99986 ) IWARN
END IF
END IF
END IF
END IF
*
99999 FORMAT (' MB4DLZ EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from MB4DLZ = ',I2)
99997 FORMAT (' The balanced matrix A is ')
99996 FORMAT (/' The balanced matrix B is ')
99995 FORMAT (20( 1X, G11.4, SP, F9.3, S, 'i ') )
99994 FORMAT (/' ILO = ',I4)
99993 FORMAT (/' IHI = ',I4)
99992 FORMAT (20(1X,G11.4))
99991 FORMAT (/' The permutations and left scaling factors are ')
99990 FORMAT (/' The permutations and right scaling factors are ')
99989 FORMAT (/' The initial 1-norms of the (sub)matrices are ')
99988 FORMAT (/' The final 1-norms of the (sub)matrices are ')
99987 FORMAT (/' The threshold value finally used is ')
99986 FORMAT (/' IWARN on exit from MB4DLZ = ',I2)
99985 FORMAT (/' N is out of range.',/' N = ',I5)
END
</PRE>
<B>Program Data</B>
<PRE>
MB4DLZ EXAMPLE PROGRAM DATA
4 B -3
(1,0.5) 0 -1e-12 0
0 (-2,-1) 0 0
1 (-1,-0.5) (-1,0.5) 0
(-1,0.5) -1 0 (2,-1)
(1,0.5) 0 0 0
0 (1,0.5) 0 0
0 0 (1,-0.5) 0
0 0 0 (1,-0.5)
</PRE>
<B>Program Results</B>
<PRE>
MB4DLZ EXAMPLE PROGRAM RESULTS
The balanced matrix A is
2.000 -1.000i -1.000 +0.500i 0.000 +0.000i -1.000 +0.000i
0.000 +0.000i 1.000 +0.500i -0.1000E-11 +0.000i 0.000 +0.000i
0.000 +0.000i 1.000 +0.000i -1.000 +0.500i -1.000 -0.500i
0.000 +0.000i 0.000 +0.000i 0.000 +0.000i -2.000 -1.000i
The balanced matrix B is
1.000 -0.500i 0.000 +0.000i 0.000 +0.000i 0.000 +0.000i
0.000 +0.000i 1.000 +0.500i 0.000 +0.000i 0.000 +0.000i
0.000 +0.000i 0.000 +0.000i 1.000 -0.500i 0.000 +0.000i
0.000 +0.000i 0.000 +0.000i 0.000 +0.000i 1.000 +0.500i
ILO = 2
IHI = 3
The permutations and left scaling factors are
2.000 1.000 1.000 2.000
The permutations and right scaling factors are
2.000 1.000 1.000 2.000
The initial 1-norms of the (sub)matrices are
2.118 1.118
The final 1-norms of the (sub)matrices are
2.118 1.118
The threshold value finally used is
0.2229E-12
</PRE>
<HR>
<p>
<A HREF=..\libindex.html><B>Return to index</B></A></BODY>
</HTML>
|