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 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509
|
<HTML>
<HEAD><TITLE>SB02SD - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>
<H2><A Name="SB02SD">SB02SD</A></H2>
<H3>
Estimating conditioning and forward error bound for the solution of discrete-time Riccati equation
</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 estimate the conditioning and compute an error bound on the
solution of the real discrete-time matrix algebraic Riccati
equation (see FURTHER COMMENTS)
-1
X = op(A)'*X*(I_n + G*X) *op(A) + Q, (1)
where op(A) = A or A' (A**T) and Q, G are symmetric (Q = Q**T,
G = G**T). The matrices A, Q and G are N-by-N and the solution X
is N-by-N.
</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
SUBROUTINE SB02SD( JOB, FACT, TRANA, UPLO, LYAPUN, N, A, LDA, T,
$ LDT, U, LDU, G, LDG, Q, LDQ, X, LDX, SEPD,
$ RCOND, FERR, IWORK, DWORK, LDWORK, INFO )
C .. Scalar Arguments ..
CHARACTER FACT, JOB, LYAPUN, TRANA, UPLO
INTEGER INFO, LDA, LDG, LDQ, LDT, LDU, LDWORK, LDX, N
DOUBLE PRECISION FERR, RCOND, SEPD
C .. Array Arguments ..
INTEGER IWORK( * )
DOUBLE PRECISION A( LDA, * ), DWORK( * ), G( LDG, * ),
$ Q( LDQ, * ), T( LDT, * ), U( LDU, * ),
$ X( LDX, * )
</PRE>
<A name="Arguments"><B><FONT SIZE="+1">Arguments</FONT></B></A>
<P>
<B>Mode Parameters</B>
<PRE>
JOB CHARACTER*1
Specifies the computation to be performed, as follows:
= 'C': Compute the reciprocal condition number only;
= 'E': Compute the error bound only;
= 'B': Compute both the reciprocal condition number and
the error bound.
FACT CHARACTER*1
Specifies whether or not the real Schur factorization of
the matrix Ac = inv(I_n + G*X)*A (if TRANA = 'N'), or
Ac = A*inv(I_n + X*G) (if TRANA = 'T' or 'C'), is supplied
on entry, as follows:
= 'F': On entry, T and U (if LYAPUN = 'O') contain the
factors from the real Schur factorization of the
matrix Ac;
= 'N': The Schur factorization of Ac will be computed
and the factors will be stored in T and U (if
LYAPUN = 'O').
TRANA CHARACTER*1
Specifies the form of op(A) to be used, as follows:
= 'N': op(A) = A (No transpose);
= 'T': op(A) = A**T (Transpose);
= 'C': op(A) = A**T (Conjugate transpose = Transpose).
UPLO CHARACTER*1
Specifies which part of the symmetric matrices Q and G is
to be used, as follows:
= 'U': Upper triangular part;
= 'L': Lower triangular part.
LYAPUN CHARACTER*1
Specifies whether or not the original Lyapunov equations
should be solved in the iterative estimation process,
as follows:
= 'O': Solve the original Lyapunov equations, updating
the right-hand sides and solutions with the
matrix U, e.g., RHS <-- U'*RHS*U;
= 'R': Solve reduced Lyapunov equations only, without
updating the right-hand sides and solutions.
</PRE>
<B>Input/Output Parameters</B>
<PRE>
N (input) INTEGER
The order of the matrices A, X, Q, and G. N >= 0.
A (input) DOUBLE PRECISION array, dimension (LDA,N)
If FACT = 'N' or LYAPUN = 'O', the leading N-by-N part of
this array must contain the matrix A.
If FACT = 'F' and LYAPUN = 'R', A is not referenced.
LDA INTEGER
The leading dimension of the array A.
LDA >= max(1,N), if FACT = 'N' or LYAPUN = 'O';
LDA >= 1, if FACT = 'F' and LYAPUN = 'R'.
T (input or output) DOUBLE PRECISION array, dimension
(LDT,N)
If FACT = 'F', then T is an input argument and on entry,
the leading N-by-N upper Hessenberg part of this array
must contain the upper quasi-triangular matrix T in Schur
canonical form from a Schur factorization of Ac (see
argument FACT).
If FACT = 'N', then T is an output argument and on exit,
if INFO = 0 or INFO = N+1, the leading N-by-N upper
Hessenberg part of this array contains the upper quasi-
triangular matrix T in Schur canonical form from a Schur
factorization of Ac (see argument FACT).
LDT INTEGER
The leading dimension of the array T. LDT >= max(1,N).
U (input or output) DOUBLE PRECISION array, dimension
(LDU,N)
If LYAPUN = 'O' and FACT = 'F', then U is an input
argument and on entry, the leading N-by-N part of this
array must contain the orthogonal matrix U from a real
Schur factorization of Ac (see argument FACT).
If LYAPUN = 'O' and FACT = 'N', then U is an output
argument and on exit, if INFO = 0 or INFO = N+1, it
contains the orthogonal N-by-N matrix from a real Schur
factorization of Ac (see argument FACT).
If LYAPUN = 'R', the array U is not referenced.
LDU INTEGER
The leading dimension of the array U.
LDU >= 1, if LYAPUN = 'R';
LDU >= MAX(1,N), if LYAPUN = 'O'.
G (input) DOUBLE PRECISION array, dimension (LDG,N)
If UPLO = 'U', the leading N-by-N upper triangular part of
this array must contain the upper triangular part of the
matrix G.
If UPLO = 'L', the leading N-by-N lower triangular part of
this array must contain the lower triangular part of the
matrix G. _
Matrix G should correspond to G in the "reduced" Riccati
equation (with matrix T, instead of A), if LYAPUN = 'R'.
See METHOD.
LDG INTEGER
The leading dimension of the array G. LDG >= max(1,N).
Q (input) DOUBLE PRECISION array, dimension (LDQ,N)
If UPLO = 'U', the leading N-by-N upper triangular part of
this array must contain the upper triangular part of the
matrix Q.
If UPLO = 'L', the leading N-by-N lower triangular part of
this array must contain the lower triangular part of the
matrix Q. _
Matrix Q should correspond to Q in the "reduced" Riccati
equation (with matrix T, instead of A), if LYAPUN = 'R'.
See METHOD.
LDQ INTEGER
The leading dimension of the array Q. LDQ >= max(1,N).
X (input) DOUBLE PRECISION array, dimension (LDX,N)
The leading N-by-N part of this array must contain the
symmetric solution matrix of the original Riccati
equation (with matrix A), if LYAPUN = 'O', or of the
"reduced" Riccati equation (with matrix T), if
LYAPUN = 'R'. See METHOD.
LDX INTEGER
The leading dimension of the array X. LDX >= max(1,N).
SEPD (output) DOUBLE PRECISION
If JOB = 'C' or JOB = 'B', the estimated quantity
sepd(op(Ac),op(Ac)').
If N = 0, or X = 0, or JOB = 'E', SEPD is not referenced.
RCOND (output) DOUBLE PRECISION
If JOB = 'C' or JOB = 'B', an estimate of the reciprocal
condition number of the discrete-time Riccati equation.
If N = 0 or X = 0, RCOND is set to 1 or 0, respectively.
If JOB = 'E', RCOND is not referenced.
FERR (output) DOUBLE PRECISION
If JOB = 'E' or JOB = 'B', an estimated forward error
bound for the solution X. If XTRUE is the true solution,
FERR bounds the magnitude of the largest entry in
(X - XTRUE) divided by the magnitude of the largest entry
in X.
If N = 0 or X = 0, FERR is set to 0.
If JOB = 'C', FERR is not referenced.
</PRE>
<B>Workspace</B>
<PRE>
IWORK INTEGER array, dimension (N*N)
DWORK DOUBLE PRECISION array, dimension (LDWORK)
On exit, if INFO = 0 or INFO = N+1, DWORK(1) returns the
optimal value of LDWORK.
LDWORK INTEGER
The dimension of the array DWORK.
Let LWA = N*N, if LYAPUN = 'O';
LWA = 0, otherwise,
and LWN = N, if LYAPUN = 'R' and JOB = 'E' or 'B';
LWN = 0, otherwise.
If FACT = 'N', then
LDWORK = MAX(LWA + 5*N, MAX(3,2*N*N) + N*N),
if JOB = 'C';
LDWORK = MAX(LWA + 5*N, MAX(3,2*N*N) + 2*N*N + LWN),
if JOB = 'E' or 'B'.
If FACT = 'F', then
LDWORK = MAX(3,2*N*N) + N*N, if JOB = 'C';
LDWORK = MAX(3,2*N*N) + 2*N*N + LWN,
if JOB = 'E' or 'B'.
For good performance, LDWORK must generally be larger.
If LDWORK = -1, then a workspace query is assumed;
the routine only calculates the optimal size of the
DWORK array, returns this value as the first entry of
the DWORK array, and no error message related to LDWORK
is issued by XERBLA.
</PRE>
<B>Error Indicator</B>
<PRE>
INFO INTEGER
= 0: successful exit;
< 0: if INFO = -i, the i-th argument had an illegal
value;
> 0: if INFO = i, i <= N, the QR algorithm failed to
complete the reduction of the matrix Ac to Schur
canonical form (see LAPACK Library routine DGEES);
on exit, the matrix T(i+1:N,i+1:N) contains the
partially converged Schur form, and DWORK(i+1:N) and
DWORK(N+i+1:2*N) contain the real and imaginary
parts, respectively, of the converged eigenvalues;
this error is unlikely to appear;
= N+1: if T has almost reciprocal eigenvalues; perturbed
values were used to solve Lyapunov equations, but
the matrix T, if given (for FACT = 'F'), is
unchanged.
</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
The condition number of the Riccati equation is estimated as
cond = ( norm(Theta)*norm(A) + norm(inv(Omega))*norm(Q) +
norm(Pi)*norm(G) ) / norm(X),
where Omega, Theta and Pi are linear operators defined by
Omega(W) = op(Ac)'*W*op(Ac) - W,
Theta(W) = inv(Omega(op(W)'*X*op(Ac) + op(Ac)'X*op(W))),
Pi(W) = inv(Omega(op(Ac)'*X*W*X*op(Ac))),
and Ac = inv(I_n + G*X)*A (if TRANA = 'N'), or
Ac = A*inv(I_n + X*G) (if TRANA = 'T' or 'C').
Note that the Riccati equation (1) is equivalent to
X = op(Ac)'*X*op(Ac) + op(Ac)'*X*G*X*op(Ac) + Q, (2)
and to
_ _ _ _ _ _
X = op(T)'*X*op(T) + op(T)'*X*G*X*op(T) + Q, (3)
_ _ _
where X = U'*X*U, Q = U'*Q*U, and G = U'*G*U, with U the
orthogonal matrix reducing Ac to a real Schur form, T = U'*Ac*U.
The routine estimates the quantities
sepd(op(Ac),op(Ac)') = 1 / norm(inv(Omega)),
norm(Theta) and norm(Pi) using 1-norm condition estimator.
The forward error bound is estimated using a practical error bound
similar to the one proposed in [2].
</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
[1] Ghavimi, A.R. and Laub, A.J.
Backward error, sensitivity, and refinement of computed
solutions of algebraic Riccati equations.
Numerical Linear Algebra with Applications, vol. 2, pp. 29-49,
1995.
[2] Higham, N.J.
Perturbation theory and backward error for AX-XB=C.
BIT, vol. 33, pp. 124-136, 1993.
[3] Petkov, P.Hr., Konstantinov, M.M., and Mehrmann, V.
DGRSVX and DMSRIC: Fortran 77 subroutines for solving
continuous-time matrix algebraic Riccati equations with
condition and accuracy estimates.
Preprint SFB393/98-16, Fak. f. Mathematik, Tech. Univ.
Chemnitz, May 1998.
</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE> 3
The algorithm requires 0(N ) operations.
The accuracy of the estimates obtained depends on the solution
accuracy and on the properties of the 1-norm estimator.
</PRE>
<A name="Comments"><B><FONT SIZE="+1">Further Comments</FONT></B></A>
<PRE>
The option LYAPUN = 'R' may occasionally produce slightly worse
or better estimates, and it is much faster than the option 'O'.
When SEPD is computed and it is zero, the routine returns
immediately, with RCOND and FERR (if requested) set to 0 and 1,
respectively. In this case, the equation is singular.
Let B be an N-by-M matrix (if TRANA = 'N') or an M-by-N matrix
(if TRANA = 'T' or 'C'), let R be an M-by-M symmetric positive
definite matrix (R = R**T), and denote G = op(B)*inv(R)*op(B)'.
Then, the Riccati equation (1) is equivalent to the standard
discrete-time matrix algebraic Riccati equation
X = op(A)'*X*op(A) - (4)
-1
op(A)'*X*op(B)*(R + op(B)'*X*op(B)) *op(B)'*X*op(A) + Q.
By symmetry, the equation (1) is also equivalent to
-1
X = op(A)'*(I_n + X*G) *X*op(A) + Q.
</PRE>
<A name="Example"><B><FONT SIZE="+1">Example</FONT></B></A>
<P>
<B>Program Text</B>
<PRE>
* SB02SD EXAMPLE PROGRAM TEXT
*
* .. Parameters ..
INTEGER NIN, NOUT
PARAMETER ( NIN = 5, NOUT = 6 )
INTEGER NMAX
PARAMETER ( NMAX = 20 )
INTEGER LDA, LDG, LDQ, LDT, LDU, LDX
PARAMETER ( LDA = NMAX, LDG = NMAX, LDQ = NMAX, LDT = NMAX,
$ LDU = NMAX, LDX = NMAX )
INTEGER LIWORK
PARAMETER ( LIWORK = NMAX*NMAX )
INTEGER LDWORK
PARAMETER ( LDWORK = 8*NMAX*NMAX + 10*NMAX )
DOUBLE PRECISION ZERO, ONE
PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
* .. Local Scalars ..
DOUBLE PRECISION FERR, RCND, RCOND, SEPD
INTEGER I, INFO1, INFO2, INFO3, IS, IU, IW, J, N, N2,
$ SDIM
CHARACTER*1 FACT, JOB, JOBS, LYAPUN, TRANA, TRANAT, UPLO
* .. Local Arrays ..
LOGICAL BWORK(2*NMAX)
INTEGER IWORK(LIWORK)
DOUBLE PRECISION A(LDA,NMAX), AS(LDA,NMAX), DWORK(LDWORK),
$ G(LDG,NMAX), Q(LDQ,NMAX), T(LDT,NMAX),
$ U(LDU,NMAX), X(LDX,NMAX)
* .. External Functions ..
LOGICAL LSAME, SELECT
EXTERNAL LSAME, SELECT
* .. External Subroutines ..
EXTERNAL DGEES, DGESV, DLACPY, DLASET, DSWAP, DSYMM,
$ MA02AD, MA02ED, MB01RU, SB02MD, SB02SD
* .. 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, FACT, TRANA, UPLO, LYAPUN
IF ( N.LT.0 .OR. N.GT.NMAX ) THEN
WRITE ( NOUT, FMT = 99993 ) N
ELSE
READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N )
READ ( NIN, FMT = * ) ( ( Q(I,J), J = 1,N ), I = 1,N )
READ ( NIN, FMT = * ) ( ( G(I,J), J = 1,N ), I = 1,N )
CALL DLACPY( 'Full', N, N, A, LDA, AS, LDA )
CALL DLACPY( UPLO, N, N, Q, LDQ, X, LDX )
N2 = 2*N
IS = 2*N2 + 1
IU = IS + N2*N2
IW = IU + N2*N2
* Solve the discrete-time Riccati equation.
CALL SB02MD( 'discrete', 'direct', UPLO, 'no scaling',
$ 'stable', N, AS, LDA, G, LDG, X, LDX, RCND,
$ DWORK(1), DWORK(N2+1), DWORK(IS), N2, DWORK(IU),
$ N2, IWORK, DWORK(IW), LDWORK-IW+1, BWORK, INFO1 )
*
IF ( INFO1.EQ.0 ) THEN
WRITE ( NOUT, FMT = 99995 )
DO 10 I = 1, N
WRITE ( NOUT, FMT = 99994 ) ( X(I,J), J = 1,N )
10 CONTINUE
IF ( LSAME( FACT, 'F' ) .OR. LSAME( LYAPUN, 'R' ) ) THEN
CALL DLASET( 'Full', N, N, ZERO, ONE, DWORK, N )
CALL DSYMM( 'Left', UPLO, N, N, ONE, G, LDG, X, LDX,
$ ONE, DWORK, N )
IF ( LSAME( TRANA, 'N' ) ) THEN
* Compute Ac = inv(I_n + G*X)*A.
CALL DLACPY( 'Full', N, N, A, LDA, T, LDT )
CALL DGESV( N, N, DWORK, N, IWORK, T, LDT, INFO3 )
ELSE
* Compute Ac = A*inv(I_n + X*G)
CALL MA02AD( 'Full', N, N, A, LDA, T, LDT )
CALL DGESV( N, N, DWORK, N, IWORK, T, LDT, INFO3 )
DO 20 J = 2, N
CALL DSWAP( J-1, T(1,J), 1, T(J,1), LDT )
20 CONTINUE
END IF
* Compute the Schur factorization of Ac.
JOBS = 'V'
CALL DGEES( JOBS, 'Not ordered', SELECT, N, T, LDT, SDIM,
$ DWORK(1), DWORK(N+1), U, LDU, DWORK(2*N+1),
$ LDWORK-2*N, BWORK, INFO3 )
IF( INFO3.NE.0 ) THEN
WRITE ( NOUT, FMT = 99996 ) INFO3
STOP
END IF
END IF
*
IF ( LSAME( LYAPUN, 'R' ) ) THEN
IF( LSAME( TRANA, 'N' ) ) THEN
TRANAT = 'T'
ELSE
TRANAT = 'N'
END IF
*
CALL MB01RU( UPLO, TRANAT, N, N, ZERO, ONE, X, LDX,
$ U, LDU, X, LDX, DWORK, N*N, INFO2 )
CALL MA02ED( UPLO, N, X, LDX )
CALL MB01RU( UPLO, TRANAT, N, N, ZERO, ONE, G, LDG,
$ U, LDU, G, LDG, DWORK, N*N, INFO2 )
CALL MB01RU( UPLO, TRANAT, N, N, ZERO, ONE, Q, LDQ,
$ U, LDU, Q, LDQ, DWORK, N*N, INFO2 )
END IF
* Estimate the condition and error bound on the solution.
CALL SB02SD( JOB, FACT, TRANA, UPLO, LYAPUN, N, A, LDA, T,
$ LDT, U, LDU, G, LDG, Q, LDQ, X, LDX, SEPD,
$ RCOND, FERR, IWORK, DWORK, LDWORK, INFO2 )
*
IF ( INFO2.NE.0 ) THEN
WRITE ( NOUT, FMT = 99997 ) INFO2
END IF
IF ( INFO2.EQ.0 .OR. INFO2.EQ.N+1 ) THEN
WRITE ( NOUT, FMT = 99992 ) SEPD
WRITE ( NOUT, FMT = 99991 ) RCOND
WRITE ( NOUT, FMT = 99990 ) FERR
END IF
ELSE
WRITE ( NOUT, FMT = 99998 ) INFO1
END IF
END IF
STOP
*
99999 FORMAT (' SB02SD EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from SB02MD =',I2)
99997 FORMAT (' INFO on exit from SB02SD =',I2)
99996 FORMAT (' INFO on exit from DGEES =',I2)
99995 FORMAT (' The solution matrix X is')
99994 FORMAT (20(1X,F8.4))
99993 FORMAT (/' N is out of range.',/' N = ',I5)
99992 FORMAT (/' Estimated separation = ',F8.4)
99991 FORMAT (/' Estimated reciprocal condition number = ',F8.4)
99990 FORMAT (/' Estimated error bound = ',F8.4)
END
</PRE>
<B>Program Data</B>
<PRE>
SB02SD EXAMPLE PROGRAM DATA
2 B N N U O
2.0 -1.0
1.0 0.0
0.0 0.0
0.0 1.0
1.0 0.0
0.0 0.0
</PRE>
<B>Program Results</B>
<PRE>
SB02SD EXAMPLE PROGRAM RESULTS
The solution matrix X is
-0.7691 1.2496
1.2496 -2.3306
Estimated separation = 0.4456
Estimated reciprocal condition number = 0.1445
Estimated error bound = 0.0000
</PRE>
<HR>
<p>
<A HREF=..\libindex.html><B>Return to index</B></A></BODY>
</HTML>
|