pax_global_header 0000666 0000000 0000000 00000000064 14560147231 0014515 g ustar 00root root 0000000 0000000 52 comment=a037f7eb76134d45e7d222b7f017d5cbd16eb731 SLICOT-SLICOT-Reference-a037f7e/ 0000775 0000000 0000000 00000000000 14560147231 0016017 5 ustar 00root root 0000000 0000000 SLICOT-SLICOT-Reference-a037f7e/Contributors.md 0000664 0000000 0000000 00000003506 14560147231 0021042 0 ustar 00root root 0000000 0000000 Contributors and financial support The development of the SLICOT Library (Subroutine Library In COntrol Theory) owe much to many people. We especially thank all those who have contributed routines to the Library, including E. Barth, Th. Beelen, P. Benner, C. Benson, R. Byers, R. Dekeyser, F. Delebecque, M. Denham, F. Dumortier, A. Emami-Naeini, Da-Wei Gu, A. Geurts, S. Hammarling, G. van den Hurk, B. Kågström, C. Kliman, M. Konstantinov, D. Kressner, A. Laub, A. Markovsky, C. Paige, Th. Penzl, P. Petkov, E. S. Quintana-Orti, G. Quintana-Orti, P.A. Regalia, A. Riedel, R. Schneider, V. Sima, D.M. Sima, S. Steer, F. Svaricek, M. Vanbegin, P. Van Dooren, S. Van Huffel, A. Varga, M. Verhaegen, M. Voigt, L. Westin, H. Willemsen, T. Williams, and H. Xu. The precursor of SLICOT was the version derived in the early eighties by the integration of SLICE and SYCOT, as a result of a cooperation between the Numerical Algorithms Group (NAG) from Oxford (UK) and Working Group on Software (WGS) - a Benelux cooperation. This SLICOT version, commercialized by NAG, had two releases, in 1991 and 1993. Later, WGS, NAG, and German Aerospace Center (DLR) in Oberpfaffenhofen, Germany, decided to make SLICOT freely available, and the first public release (Release 3) of SLICOT in 1997 was based entirely on the freeware BLAS and LAPACK subroutines. SLICOT was developed and maintained by NICONET (Numerics In COntrol NETwork), then later by Niconet e.V. The initial work for library conversion to a public version and further extension was supported by the European Community BRITE-EURAM III Thematic Networks Programme NICONET (project BRRT–CT97-5040, 1997-2002). Further developments were mainly supported by several grants of the German Science Foundation (2004-2009), and by The MathWorks (starting with 2008). All this support is highly acknowledged. SLICOT-SLICOT-Reference-a037f7e/Installation.md 0000664 0000000 0000000 00000010111 14560147231 0020774 0 ustar 00root root 0000000 0000000 # SLICOT Software Installation and Updating This file describes how to install and update the **SLICOT** Library, and how to run the example programs. The essential source code and documentation for the **SLICOT** software is stored in the **SLICOT** Library root directory, **`slicot`**, and its subdirectories (**`benchmark_data`**, **`doc`**, **`examples`**, **`src`** and **`src_aux`**). The object and/or executable files can be built using the information given in this file. **SLICOT** routines make calls to subprograms from the state-of-the-art packages **LAPACK** (Linear Algebra Package) and **BLAS** (Basic Linear Algebra Subprograms). Fortran source code and prebuilt, Fortran-based **LAPACK** and **BLAS** libraries are freely downloadable from https://netlib.org. However, for maximum efficiency it is recommended to use machine-specific, optimized versions whenever possible. Template make files are provided to help building the **SLICOT** Library object file, and to link and run the available example programs calling the **SLICOT** Library routines. In order to use these make files on a specific Unix-like or Windows platform, some changes might be needed in the files **`make*.inc`** and **`makefile*`** stored in the **SLICOT** (sub-)directories, **`slicot`**, **`examples`**, **`src`** and **`src_aux`**. The file named **`make.inc`** and the files **`makefile`** have been used on Windows platforms with Intel Fortran compilers. The files named **`make_Unix.inc`** and **`makefile_Unix`** are templates for Unix-like machines, including Linux, with gfortran compiler. Denote by <**slicotroot**> the path to the **`slicot`** directory, which can be, e.g., **`c:\slicot`**, on Windows platforms. (The last (sub)directory name in <**slicotroot**> is **`slicot`**.) The changes in **`make*.inc`** might define the specific machine (platform) identifier, the compiler, linker, and archiver flags, and the location and names of the **LAPACK** and **BLAS** libraries, which the program files should be linked to. Some details are given in the **`make*.inc`** files. After performing the necessary changes, as suggested in the comments of the make files, the other needed **SLICOT**-related files can be generated automatically with the command **`make`** (or **`nmake`**, for Windows platforms) issued from the directory **`slicot`** of <**slicotroot**>. The first execution of **`(n)make`** will create the following files - the **SLICOT** Library object files **`*.o`** (for Unix machines), or **`*.obj`** (for Windows machines), in the subdirectories **`src`** and **`src_aux`** of **`slicot`**; - the library files **`slicot.a`** and **`lpkaux.a`**, or **`slicot.lib`** and **`lpkaux.lib`**, respectively, in the directory **`slicot`**; the libraries **`lpkaux.a`** or **`lpkaux.lib`** contain the object files for two **LAPACK** deprecated subroutines, **`dlatzm.f`** and **`zlatzm.f`**, which are called by few **SLICOT** routines. - the example programs object and executable files, in the subdirectory **`examples`**; - the files **`*.exa`**, with the results computed on the local machine, with the same name as for the files with data (**`*.dat`**) and reference results (**`*.res`**), also in the subdirectory **`examples`**. The subsequent executions of **`(n)make`** will update the files if changes have been performed (assuming that the object and executable files have been preserved on their subdirectories). The files **`*.exa`**, with the computed results may be compared with the reference results. Several types of differences could be noticed, including possible sign changes for some elements, or even different values in some columns and/or rows of the computed matrices. For instance, the matrices of similarity or equivalence transformations could differ from a platform/compiler to another. This does not usually mean that the computed results are wrong. More details for executing other tasks, e.g., cleaning the subdirectories **`src`** and **`examples`**, are given in the files **`makefile* included in directory **`slicot`** and in the subdirectories **`src`** and **`examples`**. SLICOT-SLICOT-Reference-a037f7e/LICENSE 0000664 0000000 0000000 00000002752 14560147231 0017032 0 ustar 00root root 0000000 0000000 BSD 3-Clause License Copyright (c) 2020, SLICOT All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SLICOT-SLICOT-Reference-a037f7e/README.md 0000664 0000000 0000000 00000006134 14560147231 0017302 0 ustar 00root root 0000000 0000000 # SLICOT Library [](https://doi.org/10.5281/zenodo.6463090) [](https://github.com/SLICOT/SLICOT-Reference/blob/main/LICENSE) **SLICOT** - _Subroutine Library In COntrol Theory_ - is a general purpose basic mathematical library for control theoretical computations. The library provides tools to perform essential system analysis and synthesis tasks. The main emphasis in SLICOT is on numerical reliability of implemented algorithms and the numerical robustness and efficiency of routines. Providing algorithmic flexibility and the use of rigorous implementation and documentation standards are other SLICOT features. The SLICOT Library is available as standard Fortran 77 code in double precision. Each user-callable subroutine for control computations is accompanied by an example program which illustrates the use of the subroutine and can act as a template for the user's own routines. The SLICOT Library is organized by chapters, sections and subsections. The following chapters are currently included: A : Analysis Routines B : Benchmark and Test Problems D : Data Analysis F : Filtering I : Identification M : Mathematical Routines N : Nonlinear Systems (not yet available, except for some auxiliary routines for Wiener systems) S : Synthesis Routines T : Transformation Routines U : Utility Routines SLICOT Library Root Directory contains few, basic files for the SLICOT Library distribution and generation. When distributed, SLICOT software comes with several filled-in subdirectories (benchmark_data, doc, examples, src, and src_aux), and the following files in this root directory: - this file, README.md, - the contributors to the library and financial support, Contributors.md, - the license file, LICENSE, and - the main SLICOT Library documentation index, libindex.html. After software installation, this directory will also contain the library files slicot.a and lpkaux.a, or slicot.lib and lpkaux.lib, for Unix or Windows platforms, respectively. The library files could then be linked in applications programs, as usual. Specific examples are contained in the directory examples. The on-line documentation of the SLICOT user's callable routines is accessible via the main SLICOT Library documentation index, libindex.html. This file also contains a link to the documentation of the lower-level, support routines. The SLICOT Library is built on LAPACK (Linear Algebra PACKage) and BLAS (Basic Linear Algebra Subprograms) collections. Therefore, these packages should be available on the platform used. Basic References: 1. P. Benner, V. Mehrmann, V. Sima, S. Van Huffel, and A. Varga, "SLICOT - A Subroutine Library in Systems and Control Theory", Applied and Computational Control, Signals, and Circuits (Birkhauser), Vol. 1, Ch. 10, pp. 505-546, 1999. 2. S. Van Huffel, V. Sima, A. Varga, S. Hammarling, and F. Delebecque, "Development of High Performance Numerical Software for Control", IEEE Control Systems Magazine, Vol. 24, Nr. 1, Feb., pp. 60-76, 2004. SLICOT-SLICOT-Reference-a037f7e/ReleaseNotes.md 0000664 0000000 0000000 00000060223 14560147231 0020735 0 ustar 00root root 0000000 0000000 # SLICOT Library Release Notes ## Version v5.9 Version v5.9 of the **SLICOT** Library includes 11 new routines and 9 updated routines, in comparison to Version v5.8 of the library. **New Routines** **`AB13HD:`** Computes the L_infinity-norm of a standard or descriptor system using structure-preserving eigenvalue computations. **`MA01DD:`** Computes an approximate symmetric chordal metric, d = min{ |a - b|, |1/a - 1/b| } for two complex numbers `a` and `b`, given by real and imaginary parts. **`MA01DZ:`** Computes an approximate symmetric chordal metric `d` for two, possibly infinite, complex numbers `a` and `b`, given by fractions with non-negative denominators. **`MA02RD:`** Sorts the elements of a vector in increasing or decreasing order, and rearranges the elements of another vector using the same permutations. **`MA02SD:`** Computes the smallest nonzero absolute value of the elements of a real matrix. **`MB04RD:`** Reduces a real matrix pair `(A,B)` in generalized real Schur form to a block-diagonal form using well-conditioned non-orthogonal equivalence transformations. The condition numbers of the transformations used for reduction are roughly bounded by `PMAX`, where `PMAX >= 1` is a given real value. The transformations are optionally postmultiplied in two given matrices `X` and `Y`. The generalized Schur form is optionally ordered, so that clustered eigenvalues are grouped in the same block. **`MB04RS:`** Attempts to solve the generalized real Sylvester equation A * R - L * B = scale * C, (1) D * R - L * E = scale * F, using Level 1 and Level 2 BLAS, but aborts the calculations when the absolute value of an element of `R` or `L` is greater than a given real number `PMAX >= 1`. **`MB04RT:`** Attempts to solve the generalized real Sylvester equation (1) using Level 3 BLAS, but aborts the calculations when the absolute value of an element of `R` or `L` is greater than a given real number `PMAX >= 1`. **`MB04RV:`** Attempts to solve the generalized complex Sylvester equation (1) using Level 1 and Level 2 BLAS, but aborts the calculations when the absolute value of an element of `R` or `L` is greater than a given real number `PMAX >= 1`. **`MB04RW:`** Attempts to solve the generalized complex Sylvester equation (1) using Level 3 BLAS, but aborts the calculations when the absolute value of an element of `R` or `L` is greater than a given real number `PMAX >= 1`. **`MB04RZ:`** Reduces a complex matrix pair `(A,B)` in generalized complex Schur form to a block-diagonal form using well-conditioned non-unitary equivalence transformations. The condition numbers of the transformations used for reduction are roughly bounded by `PMAX`, where `PMAX >= 1` is a given real value. The transformations are optionally postmultiplied in two given matrices `X` and `Y`. The generalized Schur form is optionally ordered, so that clustered eigenvalues are grouped in the same block. **Updated Routines** **`AB13DX:`** Replaced `CWORK` and `LCWORK` by `ZWORK` and `LZWORK`, respectively, to agree to the **SLICOT** standards. Made several cosmetical changes. **`AB13ID:`** Placed the lines defining the external subroutines after the lines defining the external functions, to agree to the **SLICOT** standard. Replaced `TOLDEF` by `ZERO` in the `MB03OD` call with `LDWORK = -1`. Changed the tests for checking if the estimated rank might be incorrect. The test for setting the value 1 to `IWARN` has been modified for better significance and `IWARN` parameter description has been updated. The submatrix `R22` has also been set to zero. Used a safeguard against the huge workspace size returned by some implementations of the LAPACK routine `ZGESVD`. Made several cosmetical changes. **`MA02JD:`** Placed the lines defining the external subroutines after the lines defining the external functions, to agree to the **SLICOT** standard. **`MA02JZ:`** Placed the lines defining the external subroutines after the lines defining the external functions, to agree to the **SLICOT** standard. **`MB02SZ:`** Replaced the references to the `DCABS1` routine, which is not available in some `BLAS` implementations, to equivalent references to a locally defined statement functions. **`MB4DLZ:`** Replaced the references to the `DCABS1` routine, which is not available in some `BLAS` implementations, to equivalent references to a locally defined statement functions. **`SB03OD:`** Inserted a call to `DGERQF` for computing the optimal workspace when `TRANS = 'T'`. Without this call, an error could appear when `M > N`. **`SB03OZ:`** Inserted a call to `ZGERQF` for computing the optimal workspace when `TRANS = 'C'`. Without this call, an error could appear when `M > N`. **`TG01JD:`** Replaced the argument `ZERO` of the `TG01AD` call in the line 385 by a value computed based on the norms of the system matrices. **Updated makefile** The files **`makefile`** and **`makefile_Unix`** in the **`src`** sub-directory have been updated to include the new routines. **New and Updated Documentation Files** Documentation files have been included for the new routines, and the existing documentation files have been updated when needed. ## Version v5.8, Update 1 **Updated Routines** **`MB01PD:`** Removed `SAVE` statement and variable `FIRST` to get a thread safe version. **`MB03VY:`** Set `A( ILO, ILO, J )` to 1 if `IHI = ILO` in the loop labelled 20. **`MB04BD`**: Changed some part of finding the number of infinite eigenvalues (replaced `DE(1,2)` by `DE(1,3)` in the line 495, and replaced `NINF = MAX( I, J )` by `NINF = MAX( I, J )/2` in the line 513). **`MB04BP`**: Changed some part of finding the number of infinite eigenvalues (replaced `DE(1,2)` by `DE(1,3)` in the line 509, and replaced `NINF = MAX( I, J )` by `NINF = MAX( I, J )/2` in the line 527). Called **`MB04BD`** internally, if on entry `INFO = 0` or if `INFO < 0` and `M` is sufficiently small (`M <= NX`, with parameter `NX` set to 250). Updated the documentation file, **`MB04BP.html`**. **Updated makefile** The files **`makefile`** in the **`examples`** and **`src`** sub-directories have been updated, by alphabetically ordering the names, and adding the missing ones. **New files** Added **`make.inc`** and **`makefile`** in the **`slicot`** directory for Windows platform with Intel Fortran compilers. Added **`make_Unix.inc`** in **`slicot`** directory and **`makefile_Unix`** in **`slicot`** directory and subdirectories **`examples`** and **`src`**, for Unix-like platfoms with gfortran compiler. Added the file **`Installation.txt`** in the **`slicot`** directory. ## Version v5.8 Version v5.8 of the **SLICOT** Library includes 18 new routines and 14 routines with more or few changes in the operational part of the source code, in comparison to Version v5.7 of the library. Moreover, the (comment) lines referring to the version number have been removed in all routines, example programs, and documentation files. **New Routines** **`MA02AZ:`** (Conjugate) transposes all or part of a two-dimensional complex matrix. **`MB01UY:`** Computes one of the matrix products `T := alpha*op(T)*A`, or `T := alpha*A*op(T)`, where `alpha` is a scalar, `A` is an `M-by-N` matrix, `T` is a triangular matrix, and `op(T)` is either `T` or `T'` (the transpose of `T`). A block-row/column algorithm is used, if possible. The result overwrites the array `T`. **`MB01UZ:`** Computes one of the matrix products `T := alpha*op(T)*A`, or `T := alpha*A*op(T)`, where `alpha` is a scalar, `A` is an `M-by-N` complex matrix, `T` is a complex triangular matrix, and `op(T)` is `T`, or `T'` (the transpose of `T`), or `conj(T')` (the conjugate transpose of `T`). A block-row/column algorithm is used, if possible. The result overwrites the array `T`. **`MB03RW:`** Solves the Sylvester equation `-A*X + X*B = C`, where `A` and `B` are complex `M-by-M` and `N-by-N` matrices, respectively, in Schur form. This routine is intended to be called only by **SLICOT** Library routine `MB03RZ`. For efficiency purposes, the computations are aborted when the absolute value of an element of `X` is greater than a given value `PMAX`. **`MB03RZ:`** Reduces an upper triangular complex matrix `A` (Schur form) to a block-diagonal form using well-conditioned non-unitary similarity transformations. The condition numbers of the transformations used for reduction are roughly bounded by `PMAX`, where `PMAX` is a given value. The transformations are optionally postmultiplied in a given matrix `X`. The Schur form is optionally ordered, so that clustered eigenvalues are grouped in the same block. **`MB03VW:`** Reduces the general product `A(:,:,1)^S(1) * A(:,:,2)^S(2) * ... * A(:,:,K)^S(K)` to upper Hessenberg-triangular form, where `A` is `N-by-N-by-K` and `S` is the signature array with values 1 or -1 (as exponents). The `H`-th matrix of `A` is reduced to upper Hessenberg form while the other matrices are triangularized. Optionally, all or part of the transformation matrices are accumulated or updated. **`SB03OS:`** Solves for `X = op(U)^H * op(U)` either the stable non-negative definite continuous-time Lyapunov equation H 2 H op(S) *X + X*op(S) = -scale *op(R) *op(R), or the convergent non-negative definite discrete-time Lyapunov equation H 2 H op(S) *X*op(S) - X = -scale *op(R) *op(R), where `op(K) = K` or `K^H` (the conjugate transpose of the matrix `K`), `S`, `R`, and `U` are `N-by-N` upper triangular matrices, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in `X`. **`SB03OZ:`** Solves for `X = op(U)^H * op(U)` either the stable non-negative definite continuous-time Lyapunov equation H 2 H op(A) *X + X*op(A) = -scale *op(B) *op(B), or the convergent non-negative definite discrete-time Lyapunov equation H 2 H op(A) *X*op(A) - X = -scale *op(B) *op(B), where `op(K) = K` or `K^H` (the conjugate transpose of the matrix `K`), `A` is an `N-by-N` matrix, `op(B)` is an `M-by-N` matrix, `U` is an upper triangular matrix containing the Cholesky factor of the solution matrix `X`, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in `X`. **`SG03BR:`** Computes the parameters for the complex Givens rotation (`c` real, `s` complex) to annihilate the second element of a complex vector of length two. The first element of the rotated vector may be complex. This is a safer implementation of the previous **SLICOT** routine `SG03BY`. It is an adaptation for real double precision computations of the LAPACK routine `ZLARTG`. **`SG03BS:`** Computes the Cholesky factor `U` of the matrix `X`, `X = op(U)^H * op(U)`, which is the solution of the generalized `d`-stable discrete-time Lyapunov equation H H 2 H A * X * A - E * X * E = - SCALE * B * B, or the conjugate transposed equation H H 2 H A * X * A - E * X * E = - SCALE * B * B , respectively, where `A`, `E`, `B`, and `U` are complex `N-by-N` matrices, and `SCALE` is an output scale factor, set less than or equal to 1 to avoid overflow in `X`. The Cholesky factor `U` of the solution is computed without first finding `X`. The pencil `A - lambda * E` must be in complex generalized Schur form (`A` and `E` are upper triangular and the diagonal elements of `E` are non-negative real numbers). Moreover, it must be `d`-stable, i.e., the moduli of its eigenvalues must be less than one. `B` must be an upper triangular matrix with real non-negative entries on its main diagonal. The resulting matrix `U` is upper triangular. The entries on its main diagonal are non-negative. **`SG03BT:`** Computes the Cholesky factor `U` of the matrix `X`, `X = op(U)^H * op(U)`, which is the solution of the generalized `c`-stable continuous-time Lyapunov equation H H 2 H A * X * E + E * X * A = - SCALE * B * B, or the conjugate transposed equation H H 2 H A * X * E + E * X * A = - SCALE * B * B , respectively, where `A`, `E`, `B`, and `U` are complex `N-by-N` matrices, and `SCALE` is an output scale factor, set less than or equal to 1 to avoid overflow in `X`. The Cholesky factor `U` of the solution is computed without first finding `X`. The pencil `A - lambda * E` must be in complex generalized Schur form (`A` and `E` are upper triangular and the diagonal elements of `E` are non-negative real numbers). Moreover, it must be `c`-stable, i.e., its eigenvalues must have negative real parts. `B` must be an upper triangular matrix with real non-negative entries on its main diagonal. The resulting matrix `U` is upper triangular. The entries on its main diagonal are non-negative. **`SG03BZ:`** Computes the Cholesky factor `U` of the matrix `X`, `op(U)^H * op(U)`, which is the solution of either the generalized `c`-stable continuous-time Lyapunov equation H H 2 H op(A) * X * op(E) + op(E) * X * op(A) = - SCALE * op(B) * op(B), or the generalized `d`-stable discrete-time Lyapunov equation H H 2 H op(A) * X * op(A) - op(E) * X * op(E) = - SCALE * op(B) * op(B), without first finding `X` and without the need to form the matrix `op(B)^H * op(B)`. `op(K)` is either `K` or `K^H` for `K = A`, `B`, `E`, `U`. `A` and `E` are `N-by-N` matrices, `op(B)` is an `M-by-N` matrix. The resulting matrix `U` is an `N-by-N` upper triangular matrix with non-negative entries on its main diagonal. `SCALE` is an output scale factor set to avoid overflow in `U`. **`TG01KD, TG01KZ:`** Compute for a single-input single-output descriptor system, `(A, E, B, C)`, with `E` upper triangular, a transformed system, `(Q'*A*Z, Q'*E*Z, Q'*B, C*Z)`, via an orthogonal/unitary equivalence transformation, so that `Q'*B` has only the first element nonzero and `Q'*E*Z` remains upper triangular. `TG01KZ` is the complex version. **`TG01OA, TG01OB:`** Compute for a single-input single-output descriptor system, `(A, E, B, C)`, with `E` upper triangular, a transformed system, `(Q'*A*Z, Q'*E*Z, Q'*B, C*Z)`, via an orthogonal/unitary equivalence transformation, so that `Q'*B` has only the first element nonzero and `Q'*E*Z` remains upper triangular. `TG01OA` is the real version and `TG01OB` is the complex version. `A`, `B`, `C` are stored in an array as the block elements `(2,2)`, `(2,1)`, and `(1,2)`, respectively, and `Q` and `Z` are not accumulated. These are the main differences with **SLICOT** Library routines `TG01KD` and `TG01KZ`. **`TG01OD, TG01OZ:`** Compute for a single-input single-output descriptor system, `(A, E, B, C)`, with `E` nonsingular, a reduced system with a "sufficiently" large feedthrough variable, using `TG01OA/TG01OB`. **Updated Routines** **`AB13MD:`** Computed the correct upper bound on the structured singular value for a 1-by-1 real matrix and a real uncertainty. Replaced `DFLOAT` by `DBLE` in line `834` to avoid a trouble with an Apple Silicon compiler. **`MA02EZ:`** A new option, `SKEW = 'G'`, has been added that allows to suitably deal with the diagonal of a general square triangular matrix. This option is needed in the new routines `MB01UZ`, `SG03BS`, and `SG03BT`. Moreover, the internal loop index `J` has been modified from `2` to `I` or `I+1`, to reduce the number of cycles to the minimum values. **`MB03RD:`** Replaced `PMAX*PMAX` by `PMAX` in the comments; the `PMAX` value agrees to the condition number for the optimally scaled transformations used. **`MB04BD:`** Made a correction (in comments) of the indices of the `1-by-1` or `2-by-2` quadruple diagonal blocks stored in `DWORK`. Increased `I2X2` by `1` if a `2x2` quadruple of diagonal blocks is found to have real eigenvalues (in order to check them externally). These are stored as `2x2` quadruple blocks in DWORK in that case. Made two corrections of the pointers to the locations in `DWORK` storing the quadruples with unreliable eigenvalues. **`SB03OD:`** Many changes have been made to improve the routine, the main ones being summarized below: - Added code segments to control overflow. In essence, two scaling strategies are included. One strategy scales `A` and `B` if the maximum absolute value of their elements are outside a range `[SMLNUM,BIGNUM]`, where `SMLNUM = sqrt( SAFMIN )/EPS`, `BIGNUM = 1/SMLNUM`, `SAFMIN` is the safe minimum, and `EPS` is the machine accuracy. The second strategy, invoked for continuous-time equations, scales `A` and `B` if the maximum absolute values of `A` and `B` differ too much, or their minimum (maximum) is too large (small, respectively); specifically, this scaling is performed if `MN < MX*SMLNUM`, or `MX < SMLNUM`, or `MN > BIGNUM`, where `MN` and `MX` are the minimum and maximum, respectively, of the maximum absolute values of `A` and `B`. Both strategies are effective and ensure the same accuracy of the results, but the second strategy reduces the number of instances when the output scaling factor, `SCALE`, is strictly smaller than `1`. Scaling of `B` is done before computing its initial `QR` or `RQ` factorization if the maximum absolute value of its elements is greater than `1/SAFMIN`; otherwise, it is done after `QR/RQ` factorization. The implementation checks out first the conditions for the second scaling strategy. - The auxiliary routine `SB03OU` is no longer called, and all its computations, and additional ones, are performed by `SB03OD`. Two `QR` or `RQ` factorizations for `B` and `R*Q` or `Q'*R`, respectively (where `R` is the triangular factor of the first factorization) are done only if `M > 7*N/6`; otherwise, a single `QR` or `RQ` factorization is used. - The new routine `MB01UY` is called by `SB03OD` to compute the product `R*Q` or `Q*R`, overwriting the array containing `R`; as large block-row or block-column operations as possible (depending on the workspace length) are used. - More BLAS 3 `DGEMM` operations are used when updating the given `B` as `B*Q` or `Q'*B`, using again as large block-row or block-column as possible. The previous version used BLAS 2 `DGEMV` calls if the workspace length was smaller than `N*M`. - The eigenvalues of `A` are computed even if `A` is given in the real Schur form, by calling the LAPACK routine `DLANV2`. This way, the stability of `A` can be checked out also for the option `FACT = 'F'`. - The case when `Q` is an identity matrix is detected, to avoid its use in multiplications. - The postponed scaling of transformed `B` is dealt with separately for the cases `TRANS = 'N'` and `TRANS = 'T'`. - The minimal workspace size has been reduced by `min(N,M)`. The improvements allowed to reduce the computation times comparing to the previous version of this routine, sometimes by `10%`, or even `20%`. Many changes in the comments have also been performed. **`SB03OT:`** Deleted the lines 509-512 involving a test of the variable `TEMP` (compared to `SMIN`), which proved to be unnecessary. **`SB03OY:`** Replaced the definition of `SMIN` in the lines 211-212 by `SMLNUM`. The former definition set `SMIN` to a too large value for equations with elements of big magnitude, and the results were bad. **`SG03BD:`** Many changes have been made to improve the routine, the main ones being summarized below: - Added code segments to control overflow. In essence, two scaling strategies are included. One strategy scales `A`, `E`, and `B` if the maximum absolute value of their elements are outside a range `[SMLNUM,BIGNUM]`, where `SMLNUM = sqrt( SAFMIN )/EPS`, `BIGNUM = 1/SMLNUM`, `SAFMIN` is the safe minimum, and `EPS` is the machine accuracy. The second strategy scales `A`, `E`, and `B` if the maximum absolute values of `A`, `E`, and `B` differ too much, or if their minimum (maximum) is too large (small, respectively); specifically, this scaling is performed if `MN < MX*SMLNUM`, or `MX < SMLNUM`, or `MN > BIGNUM`, where `MN` and `MX` are the minimum and maximum, respectively, of the maximum absolute values of `A`, `E`, and `B`. Both strategies are effective and ensure the same accuracy of the results, but the second strategy reduces the number of instances when the output scaling factor, `SCALE`, is strictly smaller than `1`. Scaling of `B` is done before computing its initial `QR` or `RQ` factorization if the maximum absolute value of its elements is greater than `1/SAFMIN`; otherwise, it is done after `QR/RQ` factorization. The implementation checks out first the conditions for the second scaling strategy. The scaling factors of `E` may be set equal to those for `A`, to preserve stability in the discrete-time case. - Modified the sequences for the transformation of the right hand side, to use BLAS 3 `DGEMM` calls (possibly in a loop, if workspace is not large enough). - Used the new routine, `MB01UY`, for transforming the solution back by block-row or block-column operations. The result overwrites the array storing the upper triangular part of the reduced equation solution. - The call of `DGGES` in the sequence to find the optimal workspace is omitted if `A` and `E` are given in generalized Schur form. - Avoided the back transformation operations with the matrices `Q` and `Z`, if they are identity. - Made some additional comments on the output contents of `A`, `E`, `Q`, and `Z` arrays, as well as on the input contents of `Q` and `Z` arrays when `FACT = 'F'`. **`SG03BU:`** Safer computation of the 1-by-1 diagonal blocks of the solution. Replaced loops of `DSCAL` calls by calls to the LAPACK routine `DLASCL`. Replaced the calls to BLAS 1 routine `DROTG` by calls to the safer LAPACK routine `DLARTG`. **`SG03BV:`** Safer computation of the 1-by-1 diagonal blocks of the solution, to avoid overflows for badly scaled equations. Replaced loops of `DSCAL` calls by calls to the LAPACK routine `DLASCL`. Replaced the calls to BLAS 1 routine `DROTG` by calls to the safer LAPACK routine `DLARTG`. **`SG03BW:`** Replaced the calls to the **SLICOT** routines `MB02UV` and `MB02UU` by calls to the equivalent LAPACK routines `DGETC2` and `DGESC2`, respectively. Replaced loops of `DSCAL` calls by calls to the LAPACK routine `DLASCL`. Replaced some loops of assignment statements by calls to `DCOPY`. **`SG03BX:`** The code has practically been rewritten. Although the source code of the new version is somewhat longer than of the previous version, the object code was reduced to about a half of the initial one. - Replaced all `2-by-2` local arrays by the needed scalars, and replaced the calls to the BLAS routines `DGEMM` and `DGEMV` involving these arrays by the necessary scalar operations, made in a compact manner. In particular, all rotations are applied directly, updating only the needed elements. When possible, two rotations are applied at once (from the left and right). Also, only the necessary elements of the matrices M1 and M2 of the reduced equations are now computed. - Replaced the calls to the **SLICOT** routine `SG03BY` by calls to the new, safer routine `SG03BR`. - Added a sequence of code to standardize the matrix `E`, i.e., to become diagonal with `E(1,1)` non-negative; then recomputed the shift. - Safer computation of the `1-by-1` diagonal blocks of the solution, to avoid overflows for badly scaled equations. - Used simpler formulas and computations when numerically appropriate, but more sophisticated ones are invoked when needed. - When `E(1,1)` is not very small for discrete-time equation, an alternative approach is employed for computing the trailing diagonal element of the solution; this approach factors a rank-one Hermitian matrix by solving a special symmetric eigenvalue problem. The eigenvector corresponding to eigenvalue `1` is quickly found. **`TB01MD, TB01ND:`** Moved the sequence for initializing `U` before the Quick Return section, to set `U` to identity also for the case `M = 0` or `P = 0`, respectively. **`TB01ND:`** Added the condition `P <= N`, since the observer Hessenberg form is not defined for `P > N`. ## Version v5.7 This is the first version uploaded to GitHub under a BSD-3-Clause license. SLICOT-SLICOT-Reference-a037f7e/benchmark_data/ 0000775 0000000 0000000 00000000000 14560147231 0020742 5 ustar 00root root 0000000 0000000 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB01103.dat 0000664 0000000 0000000 00000000754 14560147231 0022312 0 ustar 00root root 0000000 0000000 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.890D+00 3.900D-01 -5.530D+00 0.000D+00 -3.400D-02 -2.980D+00 2.430D+00 3.400D-02 -1.100D-03 -9.900D-01 -2.100D-01 0.000D+00 0.000D+00 3.600D-01 -1.600D+00 -9.500D-01 -3.200D-02 3.000D-02 0.000D+00 2.313D+00 2.727D+00 6.880D-01 2.300D-02 2.727D+00 4.271D+00 1.148D+00 3.230D-01 6.880D-01 1.148D+00 3.130D-01 1.020D-01 2.300D-02 3.230D-01 1.020D-01 8.300D-02 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB01104.dat 0000664 0000000 0000000 00000003311 14560147231 0022303 0 ustar 00root root 0000000 0000000 -9.910D-01 5.290D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.220D-01 -1.051D+00 5.960D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.220D-01 -1.118D+00 5.960D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.220D-01 -1.548D+00 7.180D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.220D-01 -1.640D+00 7.990D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.220D-01 -1.721D+00 9.010D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.220D-01 -1.823D+00 1.021D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.220D-01 -1.943D+00 3.840D-03 -2.880D-03 4.000D-03 -3.040D-03 3.760D-02 -2.800D-03 3.080D-03 -2.320D-03 2.360D-03 -3.320D-03 2.880D-03 -3.820D-03 3.080D-03 -4.120D-03 3.000D-03 -3.960D-03 1.000D+00 0.000D+00 0.000D+00 0.000D+00 5.000D-01 0.000D+00 0.000D+00 1.000D-01 0.000D+00 1.000D+00 0.000D+00 0.000D+00 1.000D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 5.000D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.000D-01 1.000D-01 0.000D+00 0.000D+00 1.000D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.000D-01 0.000D+00 0.000D+00 1.000D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D-01 0.000D+00 1.000D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D-01 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB01105.dat 0000664 0000000 0000000 00000002440 14560147231 0022306 0 ustar 00root root 0000000 0000000 -4.019D+00 5.120D+00 0.000D+00 0.000D+00 -2.082D+00 0.000D+00 0.000D+00 0.000D+00 8.700D-01 -3.460D-01 9.860D-01 0.000D+00 0.000D+00 -2.340D+00 0.000D+00 0.000D+00 0.000D+00 9.700D-01 -7.909D+00 1.5407D+01 -4.069D+00 0.000D+00 -6.450D+00 0.000D+00 0.000D+00 0.000D+00 2.680D+00 -2.1816D+01 3.5606D+01 -3.390D-01 -3.870D+00 -1.780D+01 0.000D+00 0.000D+00 0.000D+00 7.390D+00 -6.0196D+01 9.8188D+01 -7.907D+00 3.400D-01 -5.3008D+01 0.000D+00 0.000D+00 0.000D+00 2.040D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.400D+01 -1.472D+02 0.000D+00 5.320D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.400D+01 -1.472D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.280D+01 0.000D+00 -3.160D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.280D+01 0.000D+00 0.000D+00 1.880D+01 -3.160D+01 1.000D-02 -1.100D-02 -1.510D-01 3.000D-03 -2.100D-02 0.000D+00 9.000D-03 -5.900D-02 0.000D+00 2.400D-02 -1.620D-01 0.000D+00 6.800D-02 -4.450D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB01106.dat 0000664 0000000 0000000 00000032221 14560147231 0022307 0 ustar 00root root 0000000 0000000 -4.328D+00 1.714D-01 5.376D+00 4.016D+02 -7.246D+02 -1.933D+00 1.020D+00 -9.820D-01 9.990D-01 1.521D+00 -4.062D+00 9.567D+00 1.008D+01 -6.017D-01 -1.312D-01 9.602D-02 -4.570D-02 0.000D+00 -4.516D+02 0.000D+00 0.000D+00 -1.058D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -4.402D-01 -5.643D+00 1.275D+02 -2.335D+02 -4.343D+02 2.659D+01 2.040D+00 -2.592D+00 1.132D+01 1.090D+01 -4.071D+00 -5.739D-02 -6.063D-01 -7.488D-02 -5.936D-01 -9.602D-02 1.114D-01 0.000D+00 -5.461D+02 0.000D+00 0.000D+00 -6.575D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.038D+00 6.073D+00 -1.650D+02 -4.483D+00 1.049D+03 -8.245D+01 -5.314D+00 5.097D+00 -9.389D-03 1.352D-01 5.638D+00 2.246D-02 1.797D-01 2.407D-02 1.100D+00 2.743D-02 2.153D-01 0.000D+00 1.362D+03 0.000D+00 0.000D+00 1.346D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.304D-01 -1.086D-01 1.313D+02 -5.783D+02 1.020D+02 -9.240D+00 -1.146D+00 -2.408D+00 -3.081D+00 -4.529D+00 5.707D+00 -2.346D-01 -2.111D+00 -2.460D-01 -4.686D-01 -3.223D-01 3.262D-01 0.000D+00 2.080D+02 0.000D+00 0.000D+00 -2.888D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 8.476D-03 -1.563D-02 5.602D-02 1.573D+00 -1.005D+01 1.952D-01 -8.804D-03 -2.110D-02 2.090D-03 -5.256D-02 -4.077D-02 -9.182D-03 -5.178D-02 3.425D-02 4.995D-03 -1.256D-02 9.948D-03 0.000D+00 -9.839D+01 0.000D+00 0.000D+00 5.069D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 8.350D-01 -1.249D-02 -3.567D-02 -6.074D-01 3.765D+01 -1.979D+01 -1.813D-01 -2.952D-02 -1.953D-02 -1.622D-01 -6.439D-03 -2.346D-02 -2.201D-01 -2.514D-02 -3.749D-03 -3.351D-02 2.728D-02 0.000D+00 7.162D+01 0.000D+00 0.000D+00 9.608D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.768D-01 -1.264D-02 -9.683D-02 -3.567D-01 8.024D+01 -8.239D-02 -2.047D+01 -3.928D-02 1.878D-02 -2.129D-01 -9.337D-03 -3.144D-02 -2.919D-01 -3.370D-02 8.873D-02 -4.458D-02 1.716D-02 0.000D+00 7.171D+01 0.000D+00 0.000D+00 8.571D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -9.696D-02 8.666D-01 1.687D+01 1.051D+00 -1.023D+02 2.966D+01 5.943D-01 -1.997D+01 2.253D-02 1.701D-01 8.371D-03 2.645D-02 2.560D-01 2.835D-02 -3.749D-02 3.635D-02 -7.741D-02 0.000D+00 -1.412D+02 0.000D+00 0.000D+00 -8.215D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.785D-03 -1.636D-02 1.847D-01 2.169D-01 -8.420D+00 7.003D-01 5.666D-02 6.623D+00 -4.999D+01 6.760D-02 3.946D+01 4.991D-03 8.983D-02 5.349D-03 0.000D+00 1.372D-02 3.855D-02 0.000D+00 -7.710D+00 0.000D+00 0.000D+00 -4.371D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.298D-04 -2.430D-04 2.718D-03 3.214D-03 -1.246D-01 1.037D-02 8.395D-04 9.812D-02 -6.666D-01 -6.657D-01 5.847D-01 6.654D-05 1.347D-03 7.131D-05 0.000D+00 2.057D-04 5.707D-04 0.000D+00 -1.144D-01 0.000D+00 0.000D+00 -6.359D-04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.207D+00 -6.717D+00 2.626D+01 1.249D+01 -1.269D+03 1.030D+02 7.480D+00 3.684D+01 2.854D-01 2.332D+00 -4.765D+01 3.406D-01 3.065D+00 3.624D-01 -4.343D-01 4.681D-01 5.727D+00 0.000D+00 -1.745D+03 0.000D+00 0.000D+00 -8.940D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.730D-02 -4.539D-01 -5.272D+01 1.988D+02 -2.809D+01 2.243D+00 1.794D-01 9.750D+00 -9.627D+00 -9.557D+00 3.848D+01 -5.001D+01 1.011D-01 1.203D-02 -4.686D-02 1.715D-02 1.392D-01 0.000D+00 -2.430D+01 0.000D+00 0.000D+00 -2.736D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.206D-03 -2.017D-02 -2.343D+00 8.835D+00 -1.248D+00 9.975D-02 8.059D-03 4.333D-01 -4.278D-01 -4.245D-01 1.710D+00 -2.000D+00 -1.996D+00 5.349D-04 -1.999D-03 7.544D-04 6.172D-03 0.000D+00 -1.082D+00 0.000D+00 0.000D+00 -1.183D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.613D-01 -2.469D-01 -2.405D+01 2.338D+01 1.483D+02 1.638D+00 1.385D-01 4.488D+00 -4.414D+00 -4.354D+00 1.766D+01 -3.113D+00 -3.018D+00 -1.977D+01 -4.999D-02 1.509D-02 6.777D-02 0.000D+00 1.660D+01 0.000D+00 0.000D+00 3.980D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.244D-02 3.020D-02 -1.198D-01 -4.821D-02 5.575D+00 -4.525D-01 1.981D+01 1.249D-01 -1.127D-03 -6.760D-03 1.835D-02 -9.981D-04 -1.347D-02 -1.070D-03 -2.000D+01 -2.057D-03 1.880D-03 0.000D+00 9.147D+00 0.000D+00 0.000D+00 -8.241D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.653D+00 1.831D+00 -3.822D+00 1.134D+02 3.414D+02 -2.734D+01 -2.040D+00 -6.166D-01 5.004D-01 -1.437D-01 -2.416D+00 -1.073D-01 -1.078D+00 3.053D+01 1.989D+01 -5.016D+01 1.677D-01 0.000D+00 4.358D+02 0.000D+00 0.000D+00 -5.994D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -5.000D+02 -6.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.600D+03 -7.080D+02 -1.0672D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.200D+04 -5.240D+03 -1.500D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 3.330D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.330D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.450D-01 6.450D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.940D-01 -8.940D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.060D-01 -1.860D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.000D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 3.600D+03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.200D+04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 4.865D-01 -6.741D-01 5.392D+00 9.542D+01 2.403D+01 1.052D+01 8.190D-01 -4.492D-01 5.195D-01 8.437D-01 -1.863D+00 5.709D-02 4.815D-01 3.428D+00 2.161D+00 7.681D-02 -6.777D-02 0.000D+00 -4.205D+02 0.000D+00 0.000D+00 3.297D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.383D-02 2.789D-06 0.000D+00 0.000D+00 -1.081D-02 -5.545D-05 4.722D-05 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.282D-04 0.000D+00 3.353D-01 0.000D+00 0.000D+00 6.804D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 7.418D-05 5.496D-06 4.790D-06 1.478D-04 -1.504D-02 -6.503D-05 8.820D-05 4.999D-06 3.434D-06 2.727D-05 1.128D-06 4.002D-06 3.673D-05 4.290D-06 -4.958D-06 5.609D-06 1.030D-06 0.000D+00 -1.193D-02 0.000D+00 0.000D+00 -5.806D-03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.538D-05 1.201D-04 -2.579D-03 -1.609D-04 1.618D-02 -1.071D-03 -9.561D-05 -5.503D-06 -3.732D-06 -2.996D-05 -1.234D-06 -4.380D-06 -4.024D-05 -4.721D-06 5.324D-06 -6.103D-06 8.109D-06 0.000D+00 2.328D-02 0.000D+00 0.000D+00 1.178D-04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB012091.dat 0000664 0000000 0000000 00000024414 14560147231 0022401 0 ustar 00root root 0000000 0000000 0.1015D+00 -0.1977D+02 0.1977D+02 0.1015D+00 -0.23202D-01 -0.92543D-01 0.92543D-01 -0.23202D-01 -0.3165D+00 -0.1433D+02 0.1433D+02 -0.3165D+00 -0.3892D+00 -0.2229D+02 0.2229D+02 -0.3892D+00 -0.9883D+00 -0.3616D+02 0.3616D+02 -0.9883D+00 -0.1342D+01 -0.2547D+01 0.2457D+01 -0.1342D+01 -0.2312D+01 -0.2151D+02 0.2151D+02 -0.2312D+01 -0.2792D+01 -0.2671D+02 0.2671D+02 -0.2792D+01 -0.2796D+01 -0.6379D+02 0.6379D+02 -0.2796D+01 -0.3332D+01 -0.5637D+02 0.5637D+02 -0.3332D+01 -0.3418D+01 -0.8867D+02 0.8867D+02 -0.3418D+01 -0.4441D+01 -0.6945D+02 0.6945D+02 -0.4441D+01 -0.5108D+01 -0.5339D+02 0.5339D+02 -0.5108D+01 -0.5199D+01 -0.5064D+02 0.5064D+02 -0.5199D+01 -0.5670D+01 -0.9296D+02 0.9296D+02 -0.5670D+01 -0.6197D+01 -0.4000D+02 0.4000D+02 -0.6197D+01 -0.8177D+01 -0.1661D+02 0.1661D+02 -0.8177D+01 -0.8221D+01 -0.1391D+03 0.1391D+03 -0.8221D+01 -0.1035D+02 -0.1630D+03 0.1630D+03 -0.1035D+02 -0.1172D+02 -0.1093D+03 0.1093D+03 -0.1172D+02 -0.1179D+02 -0.3046D+03 0.3046D+03 -0.1179D+02 -0.3327D+02 0.000D+00 0.000D+00 -0.2212D+03 -0.197D+04 0.6796D+01 -0.1334D+00 -0.1429D+04 0.1803D+02 -0.1517D+00 0.000D+00 -0.3158D+01 0.000D+00 0.000D+00 -0.2665D+04 0.7196D+01 -0.1568D+00 -0.2222D+04 -0.2684D+01 -0.50292D-01 0.000D+00 0.1779D+01 0.000D+00 0.000D+00 0.5869D+03 0.17334D-02 -0.43119D-04 0.119D+03 0.48611D-03 -7.4279D-06 0.000D+00 0.53132D-02 0.000D+00 0.000D+00 -0.5011D+03 0.41488D-02 -0.80848D-04 -0.1059D+03 0.10274D-02 -0.11816D-04 0.000D+00 0.80111D-02 0.000D+00 0.000D+00 0.1345D+03 -0.2690D+00 0.49694D-02 -0.1468D+03 -0.7097D+00 0.12317-02 0.000D+00 0.1066D+00 0.000D+00 0.000D+00 -0.1645D+03 0.4627D+00 -0.84320D-02 0.1960D+03 0.1345D+01 -0.39645D-02 0.000D+00 -0.4078D+00 0.000D+00 0.000D+00 0.6085D+03 -0.1835D+01 0.36978D-01 0.1751D+03 -0.1082D+01 0.11391D-01 0.000D+00 0.1001D+00 0.000D+00 0.000D+00 -0.7754D+02 0.1595D+00 -0.20525D-02 0.9616D+01 0.6370D+00 -0.28823D-02 0.000D+00 -0.1571D+00 0.000D+00 0.000D+00 -0.1117D+04 0.4615D+01 -0.84286D-01 -0.3414D+02 0.6425D+01 -0.49071D-01 0.000D+00 -0.1060D+01 0.000D+00 0.000D+00 0.1790D+04 -0.3752D+01 0.71871D-01 -0.2227D+03 0.1899D+01 -0.15192D-01 0.000D+00 0.4854D+00 0.000D+00 0.000D+00 -0.13858D+05 0.5550D+00 -0.12727D-01 -0.2014D+04 -0.50439D-01 0.10263D-02 0.000D+00 -0.2733D+01 0.000D+00 0.000D+00 0.15010D+05 -0.3138D+01 0.65016D-01 0.2668D+04 -0.1060D+01 0.11647D-01 0.000D+00 0.2067D+01 0.000D+00 0.000D+00 -0.21697D+05 0.6146D+02 -0.1286D+01 -0.3652D+04 0.5074D+01 -0.1277D+00 0.000D+00 0.3001D+01 0.000D+00 0.000D+00 0.19966D+05 -0.5356D+02 0.1121D+01 0.2881D+04 -0.2677D+02 0.2540D+00 0.000D+00 0.3544D+01 0.000D+00 0.000D+00 -0.2861D+04 0.1314D+02 -0.2426D+00 -0.1080D+04 0.4849D+02 -0.3712D+00 0.000D+00 -0.7199D+01 0.000D+00 0.000D+00 0.6583D+04 -0.1932D+02 0.3841D+00 -0.3883D+04 -0.1293D+02 0.10825D-01 0.000D+00 0.7207D+01 0.000D+00 0.000D+00 -0.2212D+04 -0.1228D+02 0.1229D+00 -0.1647D+04 -0.5130D+01 0.20187D-01 0.000D+00 0.6186D+00 0.000D+00 0.000D+00 0.6321D+04 -0.2717D+02 0.2049D+00 -0.1045D+04 -0.1559D+02 0.64588D-01 0.000D+00 0.1076D+01 0.000D+00 0.000D+00 0.13964D+05 -0.1724D+02 0.35851D-01 0.5620D+03 -0.2548D+02 0.1072D+00 0.000D+00 0.2821D+01 0.000D+00 0.000D+00 0.2382D+04 -0.2008D+02 0.3605D+00 0.9026D+03 -0.1623D+01 0.77575D-01 0.000D+00 -0.7866D+00 0.000D+00 0.000D+00 -0.3037D+03 0.2624D+01 -0.1208D+00 0.1129D+04 0.4399D+01 -0.27240D-01 0.000D+00 -0.1111D+00 0.000D+00 0.000D+00 0.5428D+03 0.5789D+00 0.1194D+00 -0.1258D+04 -0.6993D+01 0.29297D-01 0.000D+00 0.1509D+01 0.000D+00 0.000D+00 -0.5271D+03 -0.3601D+02 0.3072D+00 -0.1267D+04 0.7583D+01 -0.65626D-02 0.000D+00 -0.3659D+00 0.000D+00 0.000D+00 0.2658D+04 0.3812D+01 -0.37101D-01 -0.4911D+02 -0.4347D+01 -0.84969D-02 0.000D+00 0.8635D+00 0.000D+00 0.000D+00 0.25341D+05 -0.3645D+02 0.4514D+00 0.4360D+04 -0.1313D+03 0.8394D+00 0.000D+00 0.7433D+01 0.000D+00 0.000D+00 0.6538D+04 -0.2856D+02 0.3244D+00 0.3790D+04 0.9071D+02 -0.3495D+00 0.000D+00 -0.1536D+02 0.000D+00 0.000D+00 0.42048D+05 -0.5943D+02 0.7558D+00 0.2501D+04 -0.1739D+02 0.1113D+00 0.000D+00 0.4570D+01 0.000D+00 0.000D+00 0.2106D+03 -0.3951D+02 0.5076D+00 -0.4704D+03 -0.1875D+02 0.1395D+00 0.000D+00 -0.2771D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.1251D+01 0.000D+00 0.000D+00 0.9942D+03 0.1357D+02 -0.21971D-01 0.8284D+03 0.1290D+02 -0.36967D-01 0.000D+00 -0.5031D+00 0.000D+00 0.000D+00 0.7692D+03 0.1060D+02 -0.92043D-01 0.810D+03 0.1907D+02 -0.81012D-01 0.000D+00 -0.4524D+00 0.000D+00 0.000D+00 0.42702D+05 -0.1207D+03 0.1940D+01 -0.3077D+04 0.3590D+02 -0.2467D+00 0.000D+00 -0.1592D+01 0.000D+00 0.000D+00 -0.76982D+05 0.1406D+03 -0.2796D+01 -0.3483D+03 -0.3856D+02 0.1981D+00 0.000D+00 0.1956D+01 0.000D+00 0.000D+00 -0.2888D+03 -0.9428D+00 0.23831D-01 -0.1499D+04 0.9758D+00 -0.41943D-01 0.000D+00 -0.5981D+01 0.000D+00 0.000D+00 -0.2237D+04 0.8455D+01 -0.1565D+00 -0.6578D+04 0.4950D+02 -0.4980D+00 0.000D+00 -0.1088D+02 0.000D+00 0.000D+00 -0.16942D+05 0.9443D+02 -0.1144D+01 -0.6089D+02 0.2221D+00 -0.11955D-01 0.000D+00 -0.1121D+01 0.000D+00 0.000D+00 -0.12513D+05 0.6802D+02 -0.6821D+00 -0.2937D+02 0.4639D+00 -0.99611D-02 0.000D+00 0.1532D+00 0.000D+00 0.000D+00 0.5748D+04 -0.3578D+02 0.2067D+00 -0.3931D+02 -0.6830D+00 0.78189D-02 0.000D+00 -0.4254D+00 0.000D+00 0.000D+00 -0.14657D+05 0.2168D+03 -0.6615D+00 0.1234D+03 0.9043D+01 -0.87434D-01 0.000D+00 -0.7886D+00 0.000D+00 0.000D+00 -0.4089D+04 -0.2581D+03 -0.1059D+01 0.3303D+02 -0.2040D+01 0.23536D-01 0.000D+00 -0.1053D+00 0.000D+00 0.000D+00 0.7940D+04 0.309D+03 0.1175D+01 0.6104D+02 0.2311D+01 -0.28729D-01 0.000D+00 -0.2007D+01 0.000D+00 0.000D+00 0.9582D+04 0.3730D+02 -0.31126D-01 0.1409D+03 0.2627D+01 -0.18542D-01 0.000D+00 0.1886D+00 0.000D+00 0.000D+00 0.9474D+04 0.4140D+02 -0.50827D-01 0.1563D+03 0.3098D+01 -0.22171D-01 0.000D+00 0.92049D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -.1707D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.3783D+02 0.000D+00 0.000D+00 0.000D+00 0.100D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.100D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.800D+06 -0.608D+05 -0.1060D+04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.160D+08 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.100D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.100D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.800D+06 -0.608D+05 -0.106D+04 0.000D+00 0.000D+00 0.000D+00 -0.160D+08 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.2668D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.100D+01 -0.1033D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.200D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.200D+02 -2.804D+02 -1.892D+02 5.494D+01 6.424D+01 1.512D+02 9.386D+01 1.599D+02 7.045D+01 -1.180D+02 -2.986D+01 1.028D+02 1.018D+02 6.202D+00 -1.980D+01 -2.041D+02 -1.685D+02 3.807D+01 1.706D+01 2.375D+02 2.533D+02 7.799D+00 9.762D+01 -2.915D+01 5.759D+00 -3.332D+01 -7.012D+00 -1.035D+02 -1.396D+02 -1.590D+02 -3.260D+02 2.870D+02 1.471D+01 -1.149D+01 9.388D+01 2.032D+02 -1.189D+00 1.220D+00 1.539D+00 8.601D-01 3.222D+00 6.416D+00 6.052D-01 -5.647D-01 -9.782D+01 -1.384D+00 -1.0116D+04 -9.214D+03 1.9756D+04 2.1545D+04 1.3993D+04 1.7694D+04 -2.984D+03 -3.842D+03 -1.7279D+04 1.314D+03 3.2923D+04 3.3817D+04 -1.082D+03 3.076D+03 -3.8871D+04 -3.6494D+04 -7.038D+03 1.1182D+04 8.002D+03 1.035D+04 -5.7674D+04 -5.852D+04 -9.678D+03 -1.7572D+04 -4.136D+03 -4.930D+02 1.527D+02 -2.391D+03 -5.4007D+04 1.4065D+04 -1.8204D+04 -4.219D+03 -1.617D+03 4.2055D+04 3.361D+04 9.583D+01 -5.303D+02 -4.239D+02 -8.047D+01 5.805D+02 6.674D+02 -2.059D+01 2.840D+01 -3.2517D+04 -1.345D+03 -3.5918D+04 -1.8298D+04 1.444D+03 2.675D+03 1.6733D+04 7.989D+03 3.4725D+04 1.1489D+04 3.528D+03 9.170D+03 3.849D+03 3.825D+03 -3.369D+03 -1.0423D+04 -4.762D+03 -1.033D+03 -8.833D-01 4.619D+03 3.448D+03 1.303D+03 -1.6288D+04 9.174D+02 -6.520D+03 -4.420D+03 1.3953D+04 1.0935D+04 -1.2971D+04 2.265D+03 -6.697D+03 -6.6463D+04 5.9803D+04 -4.749D+03 -3.525D+03 -6.148D+03 2.489D+04 1.376D+02 -1.595D+03 -2.912D+03 -2.036D+02 2.433D+03 3.134D+03 -1.706D+02 2.024D+02 -1.4519D+04 -6.912D+02 -1.008D+00 -5.628D+00 2.226D+01 2.473D+01 5.633D+00 1.759D+01 6.685D+00 -1.131D+00 -1.783D+01 -4.323D+00 3.701D+01 3.872D+01 -4.403D+00 -3.027D+00 -2.742D+01 -2.376D+01 -1.345D+01 2.659D+00 -4.980D+01 -4.830D+01 -3.752D+01 -3.655D+01 3.951D+00 -4.938D+00 6.345D+00 5.479D+00 2.588D+01 3.474D+01 -6.223D+01 -1.069D+01 1.005D+01 -1.666D+01 -2.834D+00 5.584D+01 2.873D+01 2.784D-01 -1.598D+00 -2.559D+00 -3.003D-01 1.781D+00 2.065D+00 -1.941D-01 2.183D-01 -3.576D+01 -1.258D+00 8.616D+03 -5.767D+02 1.146D+03 1.214D+03 -8.700D+02 3.613D+03 -3.028D+03 1.084D+03 8.362D+03 5.560D+03 1.935D+03 2.152D+03 8.302D+02 -8.823D+02 1.1555D+04 9.656D+03 6.609D+02 2.046D+03 8.408D+03 7.455D+03 -6.012D+03 -5.724D+03 -3.113D+03 -2.967D+03 1.288D+03 5.832D+02 -6.625D+03 -5.544D+03 -2.987D+03 2.461D+03 -3.217D+03 2.832D+03 3.242D+02 7.562D+03 -1.2172D+04 9.422D+00 -2.731D+01 5.400D-01 -7.739D-01 1.479D+01 5.506D+00 -2.632D+00 2.610D+00 1.184D+03 -3.855D+01 -3.685D+03 1.359D+03 5.464D+02 6.059D+02 7.167D+01 -1.539D+03 2.550D+03 -5.998D+02 2.060D+03 1.803D+03 7.868D+02 9.115D+02 -8.997D+02 -5.404D+02 -1.427D+03 -1.640D+03 -6.931D+02 3.405D+03 1.955D+03 5.308D+02 -1.239D+03 -1.711D+03 -5.337D+03 -5.925D+03 7.784D+03 6.242D+03 -8.377D+03 -2.130D+03 -2.052D+03 8.424D+03 -8.033D+03 1.596D+02 -1.013D+03 -4.374D+03 9.713D+03 -4.164D+01 -7.796D+00 2.011D+01 2.514D+01 5.685D+01 -2.029D+02 1.613D+00 1.493D+00 -7.454D+03 -4.712D+02 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB012092.dat 0000664 0000000 0000000 00000020625 14560147231 0022402 0 ustar 00root root 0000000 0000000 0.1015D+00 -0.1977D+02 0.1977D+02 0.1015D+00 -0.23202D-01 -0.92543D-01 0.92543D-01 -0.23202D-01 -0.3165D+00 -0.1433D+02 0.1433D+02 -0.3165D+00 -0.3892D+00 -0.2229D+02 0.2229D+02 -0.3892D+00 -0.9883D+00 -0.3616D+02 0.3616D+02 -0.9883D+00 -0.1342D+01 -0.2547D+01 0.2457D+01 -0.1342D+01 -0.2312D+01 -0.2151D+02 0.2151D+02 -0.2312D+01 -0.2792D+01 -0.2671D+02 0.2671D+02 -0.2792D+01 -0.2796D+01 -0.6379D+02 0.6379D+02 -0.2796D+01 -0.3332D+01 -0.5637D+02 0.5637D+02 -0.3332D+01 -0.3418D+01 -0.8867D+02 0.8867D+02 -0.3418D+01 -0.4441D+01 -0.6945D+02 0.6945D+02 -0.4441D+01 -0.5108D+01 -0.5339D+02 0.5339D+02 -0.5108D+01 -0.5199D+01 -0.5064D+02 0.5064D+02 -0.5199D+01 -0.5670D+01 -0.9296D+02 0.9296D+02 -0.5670D+01 -0.6197D+01 -0.4000D+02 0.4000D+02 -0.6197D+01 -0.8177D+01 -0.1661D+02 0.1661D+02 -0.8177D+01 -0.8221D+01 -0.1391D+03 0.1391D+03 -0.8221D+01 -0.1035D+02 -0.1630D+03 0.1630D+03 -0.1035D+02 -0.1172D+02 -0.1093D+03 0.1093D+03 -0.1172D+02 -0.1179D+02 -0.3046D+03 0.3046D+03 -0.1179D+02 -0.3327D+02 0.000D+00 0.000D+00 -0.2212D+03 -0.197D+04 0.6796D+01 -0.1334D+00 -0.1429D+04 0.1803D+02 -0.1517D+00 0.000D+00 -0.3158D+01 0.000D+00 0.000D+00 -0.2665D+04 0.7196D+01 -0.1568D+00 -0.2222D+04 -0.2684D+01 -0.50292D-01 0.000D+00 0.1779D+01 0.000D+00 0.000D+00 0.5869D+03 0.17334D-02 -0.43119D-04 0.119D+03 0.48611D-03 -7.4279D-06 0.000D+00 0.53132D-02 0.000D+00 0.000D+00 -0.5011D+03 0.41488D-02 -0.80848D-04 -0.1059D+03 0.10274D-02 -0.11816D-04 0.000D+00 0.80111D-02 0.000D+00 0.000D+00 0.1345D+03 -0.2690D+00 0.49694D-02 -0.1468D+03 -0.7097D+00 0.12317-02 0.000D+00 0.1066D+00 0.000D+00 0.000D+00 -0.1645D+03 0.4627D+00 -0.84320D-02 0.1960D+03 0.1345D+01 -0.39645D-02 0.000D+00 -0.4078D+00 0.000D+00 0.000D+00 0.6085D+03 -0.1835D+01 0.36978D-01 0.1751D+03 -0.1082D+01 0.11391D-01 0.000D+00 0.1001D+00 0.000D+00 0.000D+00 -0.7754D+02 0.1595D+00 -0.20525D-02 0.9616D+01 0.6370D+00 -0.28823D-02 0.000D+00 -0.1571D+00 0.000D+00 0.000D+00 -0.1117D+04 0.4615D+01 -0.84286D-01 -0.3414D+02 0.6425D+01 -0.49071D-01 0.000D+00 -0.1060D+01 0.000D+00 0.000D+00 0.1790D+04 -0.3752D+01 0.71871D-01 -0.2227D+03 0.1899D+01 -0.15192D-01 0.000D+00 0.4854D+00 0.000D+00 0.000D+00 -0.13858D+05 0.5550D+00 -0.12727D-01 -0.2014D+04 -0.50439D-01 0.10263D-02 0.000D+00 -0.2733D+01 0.000D+00 0.000D+00 0.15010D+05 -0.3138D+01 0.65016D-01 0.2668D+04 -0.1060D+01 0.11647D-01 0.000D+00 0.2067D+01 0.000D+00 0.000D+00 -0.21697D+05 0.6146D+02 -0.1286D+01 -0.3652D+04 0.5074D+01 -0.1277D+00 0.000D+00 0.3001D+01 0.000D+00 0.000D+00 0.19966D+05 -0.5356D+02 0.1121D+01 0.2881D+04 -0.2677D+02 0.2540D+00 0.000D+00 0.3544D+01 0.000D+00 0.000D+00 -0.2861D+04 0.1314D+02 -0.2426D+00 -0.1080D+04 0.4849D+02 -0.3712D+00 0.000D+00 -0.7199D+01 0.000D+00 0.000D+00 0.6583D+04 -0.1932D+02 0.3841D+00 -0.3883D+04 -0.1293D+02 0.10825D-01 0.000D+00 0.7207D+01 0.000D+00 0.000D+00 -0.2212D+04 -0.1228D+02 0.1229D+00 -0.1647D+04 -0.5130D+01 0.20187D-01 0.000D+00 0.6186D+00 0.000D+00 0.000D+00 0.6321D+04 -0.2717D+02 0.2049D+00 -0.1045D+04 -0.1559D+02 0.64588D-01 0.000D+00 0.1076D+01 0.000D+00 0.000D+00 0.13964D+05 -0.1724D+02 0.35851D-01 0.5620D+03 -0.2548D+02 0.1072D+00 0.000D+00 0.2821D+01 0.000D+00 0.000D+00 0.2382D+04 -0.2008D+02 0.3605D+00 0.9026D+03 -0.1623D+01 0.77575D-01 0.000D+00 -0.7866D+00 0.000D+00 0.000D+00 -0.3037D+03 0.2624D+01 -0.1208D+00 0.1129D+04 0.4399D+01 -0.27240D-01 0.000D+00 -0.1111D+00 0.000D+00 0.000D+00 0.5428D+03 0.5789D+00 0.1194D+00 -0.1258D+04 -0.6993D+01 0.29297D-01 0.000D+00 0.1509D+01 0.000D+00 0.000D+00 -0.5271D+03 -0.3601D+02 0.3072D+00 -0.1267D+04 0.7583D+01 -0.65626D-02 0.000D+00 -0.3659D+00 0.000D+00 0.000D+00 0.2658D+04 0.3812D+01 -0.37101D-01 -0.4911D+02 -0.4347D+01 -0.84969D-02 0.000D+00 0.8635D+00 0.000D+00 0.000D+00 0.25341D+05 -0.3645D+02 0.4514D+00 0.4360D+04 -0.1313D+03 0.8394D+00 0.000D+00 0.7433D+01 0.000D+00 0.000D+00 0.6538D+04 -0.2856D+02 0.3244D+00 0.3790D+04 0.9071D+02 -0.3495D+00 0.000D+00 -0.1536D+02 0.000D+00 0.000D+00 0.42048D+05 -0.5943D+02 0.7558D+00 0.2501D+04 -0.1739D+02 0.1113D+00 0.000D+00 0.4570D+01 0.000D+00 0.000D+00 0.2106D+03 -0.3951D+02 0.5076D+00 -0.4704D+03 -0.1875D+02 0.1395D+00 0.000D+00 -0.2771D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.1251D+01 0.000D+00 0.000D+00 0.9942D+03 0.1357D+02 -0.21971D-01 0.8284D+03 0.1290D+02 -0.36967D-01 0.000D+00 -0.5031D+00 0.000D+00 0.000D+00 0.7692D+03 0.1060D+02 -0.92043D-01 0.810D+03 0.1907D+02 -0.81012D-01 0.000D+00 -0.4524D+00 0.000D+00 0.000D+00 0.42702D+05 -0.1207D+03 0.1940D+01 -0.3077D+04 0.3590D+02 -0.2467D+00 0.000D+00 -0.1592D+01 0.000D+00 0.000D+00 -0.76982D+05 0.1406D+03 -0.2796D+01 -0.3483D+03 -0.3856D+02 0.1981D+00 0.000D+00 0.1956D+01 0.000D+00 0.000D+00 -0.2888D+03 -0.9428D+00 0.23831D-01 -0.1499D+04 0.9758D+00 -0.41943D-01 0.000D+00 -0.5981D+01 0.000D+00 0.000D+00 -0.2237D+04 0.8455D+01 -0.1565D+00 -0.6578D+04 0.4950D+02 -0.4980D+00 0.000D+00 -0.1088D+02 0.000D+00 0.000D+00 -0.16942D+05 0.9443D+02 -0.1144D+01 -0.6089D+02 0.2221D+00 -0.11955D-01 0.000D+00 -0.1121D+01 0.000D+00 0.000D+00 -0.12513D+05 0.6802D+02 -0.6821D+00 -0.2937D+02 0.4639D+00 -0.99611D-02 0.000D+00 0.1532D+00 0.000D+00 0.000D+00 0.5748D+04 -0.3578D+02 0.2067D+00 -0.3931D+02 -0.6830D+00 0.78189D-02 0.000D+00 -0.4254D+00 0.000D+00 0.000D+00 -0.14657D+05 0.2168D+03 -0.6615D+00 0.1234D+03 0.9043D+01 -0.87434D-01 0.000D+00 -0.7886D+00 0.000D+00 0.000D+00 -0.4089D+04 -0.2581D+03 -0.1059D+01 0.3303D+02 -0.2040D+01 0.23536D-01 0.000D+00 -0.1053D+00 0.000D+00 0.000D+00 0.7940D+04 0.309D+03 0.1175D+01 0.6104D+02 0.2311D+01 -0.28729D-01 0.000D+00 -0.2007D+01 0.000D+00 0.000D+00 0.9582D+04 0.3730D+02 -0.31126D-01 0.1409D+03 0.2627D+01 -0.18542D-01 0.000D+00 0.1886D+00 0.000D+00 0.000D+00 0.9474D+04 0.4140D+02 -0.50827D-01 0.1563D+03 0.3098D+01 -0.22171D-01 0.000D+00 0.92049D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -.1707D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.3783D+02 0.000D+00 0.000D+00 0.000D+00 0.100D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.100D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.800D+06 -0.608D+05 -0.1060D+04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.160D+08 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.100D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.100D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.800D+06 -0.608D+05 -0.106D+04 0.000D+00 0.000D+00 0.000D+00 -0.160D+08 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.2668D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.100D+01 -0.1033D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.200D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -0.200D+02 0.44247D-04 0.43403D-04 0.49713D-04 0.45556D-04 -0.41311D-05 0.79201D-05 0.72496D-05 -0.67385D-04 -0.18236D-03 0.20657D-04 0.13194D-03 -0.15849D-03 -0.67655D-04 -0.87358D-05 -0.98119D-04 0.31119D-04 -0.57479D-04 0.31600D-03 -0.57750D-03 0.710D-03 -0.96843D-04 0.29934D-04 0.54014D-03 -0.47620D-03 -0.41630D-05 -0.21609D-03 -0.10541D-03 -0.31883D-04 -0.15062D-03 -0.27714D-03 -0.24361D-03 0.27990D-04 -0.16592D-03 0.12748D-04 -0.20762D-04 -0.12546D-03 -0.44360D-04 -0.10147D-04 0.15343D-03 0.21956D-04 -0.29386D-04 0.65513D-04 0.61813D-04 0.19995D-04 0.89674D-05 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.3592D+02 -0.1246D+02 -0.5332D+00 -0.5659D+00 -0.9664D+00 0.1275D+02 -0.2145D+02 0.6822D+01 0.3388D+02 0.170D+02 -0.1380D+00 -0.8803D+00 0.5465D+01 -0.1614D+01 0.5518D+02 0.3010D+02 -0.4878D+01 0.1436D+02 0.6254D+02 0.5518D+02 -0.1388D+03 -0.1044D+03 0.6831D+01 -0.1178D+02 -0.5504D+02 -0.3066D+02 0.1402D+01 -0.3033D+02 0.4869D+01 -0.7428D+02 0.7414D+02 0.1630D+02 0.3118D+01 0.8728D+01 -0.7453D+02 0.1460D+01 -0.3334D+01 -0.7367D+01 -0.1032D+01 0.2867D+01 0.6583D+01 -0.1361D+01 0.1350D+01 0.1071D+02 -0.2591D+02 0.4852D+02 -0.7932D+01 0.79915D-01 -2.5618D+04 -0.1674D+03 0.2213D+00 0.000D+00 0.1880D+01 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB01404.dat 0000664 0000000 0000000 00000027014 14560147231 0022314 0 ustar 00root root 0000000 0000000 2.9550D+00 3.5220D+00 5.7100D-01 5.7480D-01 3.5260D+00 4.6870D+00 1.0930D+01 2.9280D+01 4.0600D+01 6.3200D+01 1.6250D+02 1.4820D+02 1.0950D+02 1.5150D+02 1.3660D+02 9.3210D+01 1.3600D+02 2.1390D+02 1.3590D+02 6.2020D+01 1.3590D+02 2.1390D+02 1.3600D+02 9.3210D+01 1.3660D+02 1.5150D+02 1.0950D+02 1.4820D+02 1.6250D+02 6.3200D+01 4.0600D+01 2.9280D+01 1.4930D+01 1.3900D+01 1.6310D+01 8.1750D+00 1.3920D+01 6.6290D+01 9.3490D+01 5.6390D+01 8.6550D+01 1.4250D+02 1.4250D+02 1.4250D+02 1.2870D+02 1.3550D+03 1.5450D+03 1.1330D+03 1.1450D+03 8.0850D+02 7.0230D+02 1.1610D+03 1.7350D+03 1.0810D+03 1.0790D+03 1.7330D+03 1.1610D+03 7.0230D+02 8.0850D+02 1.1450D+03 1.1330D+03 1.5450D+03 1.3550D+03 1.2930D+02 1.4330D+02 1.4290D+02 1.4290D+02 9.1940D+01 2.0530D+01 1.5440D+01 5.1350D+01 7.7030D+01 5.6390D+01 8.6550D+01 1.4250D+02 1.4250D+02 1.4250D+02 1.2870D+02 1.3550D+03 1.5450D+03 1.1330D+03 1.1450D+03 8.0850D+02 7.0230D+02 1.1610D+03 1.7350D+03 1.0810D+03 1.0790D+03 1.7330D+03 1.1610D+03 7.0230D+02 8.0850D+02 1.1450D+03 1.1330D+03 1.5450D+03 1.3550D+03 1.2930D+02 1.4330D+02 1.4290D+02 1.4290D+02 9.1940D+01 2.0530D+01 1.5440D+01 5.1350D+01 7.7030D+01 5.6390D+01 8.6550D+01 1.4250D+02 1.4250D+02 1.4250D+02 1.2870D+02 1.3550D+03 1.5450D+03 1.1330D+03 1.1450D+03 8.0850D+02 7.0230D+02 1.1610D+03 1.7350D+03 1.0810D+03 1.0790D+03 1.7330D+03 1.0800D+03 6.2140D+02 8.0850D+02 1.1450D+03 1.1330D+03 1.5450D+03 1.3550D+03 1.2930D+02 1.4330D+02 1.4290D+02 1.4290D+02 9.1940D+01 2.0530D+01 1.5440D+01 5.1350D+01 7.7030D+01 5.3430D+01 2.8930D+01 2.8700D+01 1.2170D+01 1.0490D+01 2.0910D+01 1.4170D+01 1.8100D+01 1.9340D+02 3.5800D+02 3.6550D+02 2.1500D+02 5.7920D+01 5.8830D+01 5.8710D+01 5.2240D+02 1.1110D+03 1.2360D+03 1.2360D+03 1.2360D+03 1.2360D+03 1.2360D+03 1.2360D+03 1.2360D+03 1.2360D+03 1.2360D+03 1.1110D+03 5.3110D+02 7.5980D+01 5.2150D+01 7.8270D+01 7.3890D+01 1.3490D+01 2.3640D+01 1.9960D+01 1.5250D+01 2.5600D+01 2.0250D+01 1.7600D+01 1.4670D+01 1.3860D+01 1.6420D+01 1.0730D+01 1.9540D+02 1.9510D+02 4.5050D+00 4.5050D+00 2.0150D+02 2.0180D+02 1.0770D+01 2.2210D+01 2.0810D+01 9.8920D+00 5.9760D+00 2.2660D+01 4.7660D+01 5.8400D+01 5.8400D+01 5.8400D+01 4.6450D+01 1.8090D+01 2.7010D+00 2.6630D+00 1.1830D+00 3.7580D-01 3.7890D-01 1.0910D+00 2.8540D+00 2.6890D+00 1.1020D+00 3.9100D+00 6.7180D+00 3.3590D+00 1.9238D+02 3.6315D+01 4.7517D+01 1.6335D+02 1.5109D+02 4.3267D+01 1.8937D+02 3.7326D+01 1.7896D+01 1.7413D+02 6.7660D+00 1.5201D+02 1.9613D+02 1.6710D+02 4.8820D+01 1.9540D+02 1.9285D+02 4.6122D+01 2.6812D+01 1.5125D+02 6.8707D+00 2.2951D+01 1.6795D+02 1.8293D+02 1.7276D+02 1.4878D+01 4.9082D+01 1.8801D+02 1.8919D+02 1.8591D+02 1.6766D+02 1.5213D+01 3.5992D+01 1.8050D+02 1.6060D+02 8.4097D+00 1.2996D+01 1.6170D+02 1.8851D+02 1.7533D+02 2.7095D+01 1.8518D+02 1.9239D+02 1.1417D+01 3.5198D+01 6.6343D+00 1.9885D+02 3.3450D+01 2.6675D+01 4.3575D+01 1.6747D+02 1.9831D+02 2.6289D+01 1.6667D+02 1.7021D+02 1.5372D+02 9.0594D+00 1.7020D+02 1.7937D+02 2.5006D+01 4.1631D+01 1.7030D+02 1.6682D+02 1.9183D+02 1.9064D+02 2.3481D+01 1.7817D+02 1.9702D+02 1.9335D+02 1.8920D-01 3.0443D+01 3.0077D+01 3.5862D+01 1.9506D+01 1.9847D+02 1.5119D+01 1.8239D+02 4.6140D+01 1.5540D+02 1.8506D+02 1.7753D+02 1.8612D+02 1.7412D+02 1.9733D+02 2.6134D+01 9.9049D+00 1.2642D+01 1.8329D+02 2.4384D+01 1.7840D+02 2.5351D+01 1.9118D+02 1.7983D+02 1.9718D+02 1.7521D+01 1.6172D+02 1.5284D+02 1.6681D+02 1.5863D+02 1.6305D+02 1.5817D+02 2.1338D+01 1.7823D+02 1.6406D+02 5.4544D+00 4.5576D+00 6.2370D-02 4.3802D+00 3.1098D+01 1.7249D+02 2.8568D+01 6.6547D+00 5.8487D+00 1.3915D+01 1.8036D+02 1.6810D+02 1.5310D+02 4.1672D+01 2.7644D+01 1.7064D+01 1.6678D+02 1.9801D+02 1.5956D+01 4.2715D+01 1.5400D+02 1.0345D+01 3.8248D+00 4.3148D+01 1.9073D+02 3.2006D+01 8.3148D+00 1.7662D+02 6.4585D+00 2.8963D+01 1.8543D+02 4.2003D+01 1.9418D+02 4.2220D+00 4.2741D+01 1.5159D+02 1.7658D+02 1.9738D+02 2.3626D+01 1.5592D+02 4.5147D+01 8.0555D+00 2.6912D+01 1.5229D+02 1.8645D+02 1.3804D+01 1.8003D+02 4.7601D+01 7.9650D-01 4.4751D+00 4.7443D+01 1.6274D+02 1.2855D+01 1.6873D+02 1.9893D+02 1.5587D+02 1.6137D+02 1.8996D+02 4.7426D+01 2.7964D+01 1.8297D+02 3.9547D+01 1.0834D+01 1.8350D+02 4.9398D+01 3.6386D+01 7.3201D+00 1.7057D+02 6.3739D+00 4.0509D+00 1.5037D+02 1.6899D+02 1.9244D+02 3.9725D+01 2.0234D+01 4.5742D+01 1.3059D+01 4.1785D+01 1.6869D+02 1.7463D+02 1.2709D+01 4.2516D+01 3.4237D+01 1.5519D+02 1.9222D+02 1.8793D+02 1.6793D+02 1.9464D+02 1.6068D+02 3.7760D+01 2.4005D+01 1.1795D+01 3.1123D+01 1.7377D+02 1.5560D-01 1.6782D+02 1.9981D+02 1.6626D+02 1.5660D+02 4.5001D+01 1.2195D+01 1.5192D+02 1.9770D+02 1.9470D+02 3.2964D+01 1.9621D+02 1.5796D+02 1.1174D+00 2.6801D+00 2.7096D+00 1.2350D+00 2.9470D+00 2.6230D+00 2.7711D+00 1.2201D+00 2.5364D+00 2.9768D+00 2.9783D+00 2.7861D+00 2.5543D+00 2.8597D+00 1.4500D+00 1.0907D+00 1.3592D+00 2.9970D+00 1.4492D+00 1.1918D+00 2.8851D+00 2.5735D+00 2.7799D+00 1.0970D+00 1.2393D+00 1.2415D+00 1.3658D+00 2.5831D+00 2.7609D+00 1.0859D+00 1.1270D+00 1.2696D+00 2.8901D+00 2.6439D+00 1.0347D+00 1.4846D+00 1.1322D+00 1.0912D+00 1.2275D+00 2.7355D+00 2.8856D+00 2.8081D+00 1.1063D+00 2.8387D+00 1.3266D+00 1.2365D+00 2.9889D+00 2.9255D+00 2.6296D+00 1.4455D+00 1.2367D+00 1.0633D+00 2.8015D+00 2.6669D+00 2.9680D+00 2.8141D+00 2.9371D+00 1.0517D+00 2.6601D+00 2.7449D+00 1.0258D+00 1.4307D+00 2.9317D+00 1.1359D+00 1.3285D+00 2.8134D+00 1.3040D+00 1.3049D+00 2.6290D+00 2.8316D+00 2.9673D+00 1.2211D+00 2.5416D+00 1.0901D+00 2.6388D+00 1.4560D+00 1.3363D+00 1.0081D+00 1.3459D+00 1.0743D+00 1.0016D+00 1.3541D+00 2.9660D+00 1.3737D+00 1.2595D+00 2.7387D+00 2.8745D+00 1.4971D+00 2.8246D+00 1.1113D+00 2.6093D+00 1.4248D+00 2.7140D+00 1.0152D+00 1.1875D+00 2.7333D+00 2.5131D+00 2.9279D+00 1.2667D+00 1.0718D+00 2.7685D+00 1.4374D+00 1.1874D+00 1.4937D+00 1.4818D+00 1.3820D+00 2.9445D+00 2.6594D+00 1.3545D+00 1.4864D+00 1.4257D+00 2.7693D+00 2.9487D+00 2.6158D+00 2.7605D+00 1.3918D+00 2.8155D+00 1.0879D+00 2.7937D+00 1.1873D+00 2.7189D+00 2.9178D+00 1.2006D+00 2.9836D+00 1.0986D+00 1.0130D+00 1.4041D+00 1.3504D+00 1.2546D+00 1.4850D+00 2.7999D+00 2.7611D+00 2.8130D+00 1.3885D+00 1.4319D+00 1.3827D+00 2.8198D+00 1.0304D+00 2.9609D+00 2.9144D+00 1.3731D+00 1.3285D+00 1.0274D+00 2.7656D+00 2.8193D+00 2.9153D+00 1.2339D+00 2.5363D+00 1.0626D+00 2.7146D+00 2.9224D+00 2.6348D+00 2.5823D+00 1.4515D+00 2.7762D+00 1.0200D+00 1.2205D+00 2.6964D+00 1.1805D+00 1.1392D+00 1.3832D+00 1.0066D+00 2.7906D+00 2.8989D+00 1.4231D+00 1.1972D+00 1.3212D+00 2.6349D+00 1.4823D+00 1.4615D+00 2.9703D+00 2.7019D+00 1.3364D+00 1.3257D+00 1.2995D+00 1.2982D+00 2.5427D+00 2.7056D+00 2.9918D+00 2.5784D+00 1.2453D+00 1.1891D+00 2.5660D+00 1.3947D+00 1.3114D+00 1.4196D+00 2.5289D+00 1.4400D+00 2.6184D+00 2.5096D+00 1.0799D+00 1.0875D+00 2.5014D+00 1.2124D+00 2.9088D+00 1.3743D+00 1.3992D+00 2.6545D+00 2.8616D+00 2.7189D+00 1.1648D+00 2.9727D+00 2.7438D+00 2.9488D+00 1.4140D+00 1.1471D+00 1.0455D+00 1.4344D+00 2.9155D+00 1.1845D+00 3.8230D+09 5.0550D+08 7.5320D+10 5.0010D+08 1.8880D+09 1.0960D+09 6.4730D+09 7.6840D+09 7.4120D+09 2.1430D+10 2.1330D+10 4.0640D+10 3.8010D+10 2.3310D+10 3.7550D+10 5.6830D+10 2.1700D+10 2.1480D+10 2.7780D+10 2.7780D+10 2.1480D+10 2.1700D+10 5.6830D+10 3.7550D+10 2.3310D+10 3.8010D+10 4.0640D+10 2.1330D+10 2.1430D+10 7.4120D+09 7.6840D+09 1.6030D+10 2.9380D+10 3.4270D+09 3.4720D+09 7.4930D+11 2.0610D+09 1.0800D+10 7.7840D+09 2.4630D+09 1.0040D+10 1.0740D+10 1.1270D+10 1.1270D+10 7.4090D+10 8.0430D+10 4.4560D+10 1.5910D+11 1.1590D+11 2.2600D+11 2.8050D+11 9.0800D+10 1.3200D+11 6.2130D+10 1.3200D+11 9.0800D+10 2.8050D+11 2.2600D+11 1.1590D+11 1.5910D+11 4.4560D+10 8.0430D+10 7.4090D+10 1.1170D+10 1.1230D+10 1.0710D+10 1.0010D+10 1.3900D+09 7.4930D+11 1.8500D+09 1.0760D+10 7.7840D+09 2.4630D+09 1.0040D+10 1.0740D+10 1.1270D+10 1.1270D+10 7.4090D+10 8.0430D+10 4.4560D+10 1.5910D+11 1.1590D+11 2.2600D+11 2.8050D+11 9.0800D+10 1.3200D+11 6.2130D+10 1.3200D+11 9.0800D+10 2.8050D+11 2.2600D+11 1.1590D+11 1.5910D+11 4.4560D+10 8.0430D+10 7.4090D+10 1.1170D+10 1.1230D+10 1.0710D+10 1.0010D+10 1.3900D+09 7.4930D+11 1.8500D+09 1.0760D+10 7.7840D+09 2.4630D+09 1.0040D+10 1.0740D+10 1.1270D+10 1.1270D+10 7.4090D+10 8.0430D+10 4.4560D+10 1.5910D+11 1.1590D+11 2.2600D+11 2.8050D+11 9.0800D+10 1.3200D+11 6.2130D+10 1.3200D+11 9.0800D+10 5.9210D+11 2.2600D+11 1.1590D+11 1.5910D+11 4.4560D+10 8.0430D+10 7.4090D+10 1.1170D+10 1.1230D+10 1.0710D+10 1.0010D+10 1.3900D+09 7.4930D+11 1.8500D+09 1.0760D+10 7.8800D+09 2.3340D+09 3.2290D+09 2.3780D+09 7.5850D+11 2.7580D+09 2.7580D+09 1.0270D+10 3.4830D+09 8.6900D+09 8.6900D+09 8.3510D+09 1.8540D+10 9.6190D+09 9.6190D+09 9.6580D+09 1.3790D+11 1.5710D+10 1.5710D+10 1.5710D+10 1.5710D+10 1.5710D+10 1.5710D+10 1.5710D+10 1.5710D+10 1.5710D+10 1.5710D+10 1.3790D+11 7.4480D+09 7.4480D+09 1.5730D+10 9.6950D+09 5.0360D+09 1.0060D+10 1.4130D+09 7.4050D+11 1.8510D+09 1.6340D+10 1.7200D+10 4.0690D+09 4.7160D+09 4.7160D+09 4.2200D+09 3.6810D+10 5.4540D+09 3.6810D+10 9.5120D+09 3.6810D+10 5.4540D+09 3.6810D+10 4.2200D+09 3.0270D+09 1.4630D+10 5.8490D+09 9.9690D+08 1.7970D+09 8.6870D+08 8.6870D+08 8.6870D+08 8.6870D+08 1.3720D+09 4.9440D+08 5.3780D+08 3.5650D+08 5.2500D+08 6.2470D+10 5.2060D+08 4.0390D+08 1.1870D+09 3.0910D+08 3.0910D+08 2.3870D+08 2.3870D+08 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB02105.dat 0000664 0000000 0000000 00000000360 14560147231 0022306 0 ustar 00root root 0000000 0000000 .998D+00 .670D-01 .000D+00 .000D+00 -.670D-01 .998D+00 .000D+00 .000D+00 .000D+00 .000D+00 .998D+00 .153D+00 .000D+00 .000D+00 -.153D+00 .998D+00 .330D-02 .200D-01 .100D+00 -.700D-03 .400D-01 .730D-02 -.280D-02 .100D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB02106.dat 0000664 0000000 0000000 00000000440 14560147231 0022306 0 ustar 00root root 0000000 0000000 .98475D+00 -.79903D-01 .90540D-03 -.10765D-02 .41588D-01 .99899D+00 -.35855D-01 .12684D-01 -.54662D+00 .44916D-01 -.32991D+00 .19318D+00 .26624D+01 -.10045D+00 -.92455D+00 -.26325D+00 .37112D-02 .73610D-03 -.87051D-01 .93411D-05 -.119844D+01 -.41378D-03 -.31927D+01 .92535D-03 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB02107.dat 0000664 0000000 0000000 00000000553 14560147231 0022314 0 ustar 00root root 0000000 0000000 -.6000D+00 -.2200D+01 -.3600D+01 -.5400018D+01 .1000D+01 .6000D+00 .8000D+00 .3399982D+01 .0000D+00 .1000D+01 .1800D+01 .3799982D+01 .0000D+00 .0000D+00 .0000D+00 -.999982D+00 .1000D+01 -.1000D+01 -.1000D+01 -.1000D+01 .0000D+00 .1000D+01 -.1000D+01 -.1000D+01 .0000D+00 .0000D+00 .1000D+01 -.1000D+01 .0000D+00 .0000D+00 .0000D+00 .1000D+01 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB02108.dat 0000664 0000000 0000000 00000000644 14560147231 0022316 0 ustar 00root root 0000000 0000000 .95407D+00 .19643D-01 .35970D-02 .67300D-03 .19000D-03 .40849D+00 .41317D+00 .16084D+00 .44679D-01 .11971D-01 .12217D+00 .26326D+00 .36149D+00 .15930D+00 .12383D+00 .41118D-01 .12858D+00 .27209D+00 .21442D+00 .40976D+00 .13050D-02 .58080D-02 .18750D-01 .36162D-01 .94280D+00 .43400D-03 -.12200D-03 .26606D-01 -.10453D-01 .37530D-01 -.55100D-01 .36076D-01 -.66000D-01 .46170D-02 -.91480D-02 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB02110.dat 0000664 0000000 0000000 00000002246 14560147231 0022307 0 ustar 00root root 0000000 0000000 8.701D-1 1.350D-1 1.159D-2 5.014D-4 -3.722D-2 3.484D-4 0.000D0 4.242D-3 7.249D-3 7.655D-2 8.974D-1 1.272D-2 5.504D-4 -4.016D-2 3.743D-4 0.000D0 4.530D-3 7.499D-3 -1.272D-1 3.575D-1 8.170D-1 1.455D-3 -1.028D-1 9.870D-4 0.000D0 1.185D-2 1.872D-2 -3.635D-1 6.339D-1 7.491D-2 7.966D-1 -2.735D-1 2.653D-3 0.000D0 3.172D-2 4.882D-2 -9.600D-1 1.6459D0 -1.289D-1 -5.597D-3 7.142D-2 7.108D-3 0.000D0 8.452D-2 1.259D-1 -6.644D-1 1.1296D-1 -8.889D-2 -3.854D-3 8.447D-2 1.360D-2 0.000D0 1.443D-1 1.016D-1 -4.102D-1 6.930D-1 -5.471D-2 -2.371D-3 6.649D-2 1.249D-2 1.063D-4 9.997D-2 6.967D-2 -1.799D-1 3.017D-1 -2.393D-2 -1.035D-3 6.059D-2 2.216D-2 0.000D0 2.139D-1 3.554D-2 -3.451D-1 5.804D-1 -4.596D-2 -1.989D-3 1.056D-1 1.986D-2 0.000D0 2.191D-1 2.152D-1 4.760D-4 -5.701D-5 -8.368D-3 8.790D-5 -4.773D-4 -2.730D-4 1.482D-4 -1.312D-3 8.876D-4 3.892D-4 -3.513D-3 2.480D-3 1.034D-3 -9.275D-3 6.680D-3 7.203D-4 -6.159D-3 3.834D-3 4.454D-4 -3.683D-3 2.029D-3 1.971D-4 -1.554D-3 6.937D-4 3.773D-4 -3.028D-3 1.469D-3 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB02111.dat 0000664 0000000 0000000 00000002633 14560147231 0022310 0 ustar 00root root 0000000 0000000 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .1000D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .1000D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .1000D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .1000D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .2220D+00 .7780D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .4000D+00 .0000D+00 .6000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .1372D+01 -.470000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .1000D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.1500D+02 .0000D+00 .0000D+00 .0000D+00 .1000D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.7000D+01 .5357D+01 .3943D+01 .0000D+00 .1000D+01 .1000D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0980D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BB02113.dat 0000664 0000000 0000000 00000014724 14560147231 0022316 0 ustar 00root root 0000000 0000000 .0000D+00 -.4607D+00 .0000D+00 .0045D+00 .0000D+00 .1304D+00 .0000D+00 .0731D+00 .0000D+00 .0608D+00 .0000D+00 .0178D+00 .0000D+00 .0067D+00 .0000D+00 -.0090D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .1000D+01 .14269D+01 .0000D+00 .0034D+00 .0000D+00 -.1702D+00 .0000D+00 -.0728D+00 .0000D+00 -.0527D+00 .0000D+00 -.0595D+00 .0000D+00 .0011D+00 .0000D+00 .0065D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0179D+00 .0000D+00 -.1242D+00 .0000D+00 -.1065D+00 .0000D+00 -.0351D+00 .0000D+00 -.0603D+00 .0000D+00 -.0939D+00 .0000D+00 .0004D+00 .0000D+00 .0693D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.0090D+00 .1000D+01 .10126D+01 .0000D+00 .2113D+00 .0000D+00 .0411D+00 .0000D+00 .0543D+00 .0000D+00 .0521D+00 .0000D+00 .0013D+00 .0000D+00 -.0728D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0406D+00 .0000D+00 -.2096D+00 .0000D+00 -.0777D+00 .0000D+00 .0492D+00 .0000D+00 -.0334D+00 .0000D+00 -.0421D+00 .0000D+00 -.0082D+00 .0000D+00 -.1448D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.0431D+00 .0000D+00 .1458D+00 .1000D+01 .11320D+01 .0000D+00 -.0392D+00 .0000D+00 .0343D+00 .0000D+00 .0290D+00 .0000D+00 .0002D+00 .0000D+00 .1535D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .1253D+00 .0000D+00 .1610D+00 .0000D+00 .0953D+00 .0000D+00 -.6278D+00 .0000D+00 -.0066D+00 .0000D+00 .0144D+00 .0000D+00 .0047D+00 .0000D+00 .1116D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.1222D+00 .0000D+00 -.2340D+00 .0000D+00 -.0159D+00 .1000D+01 .15797D+01 .0000D+00 .0551D+00 .0000D+00 -.0192D+00 .0000D+00 -.0004D+00 .0000D+00 -.1173D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0086D+00 .0000D+00 -.1020D+00 .0000D+00 -.1038D+00 .0000D+00 .0057D+00 .0000D+00 .1812D+00 .0000D+00 -.0301D+00 .0000D+00 .0048D+00 .0000D+00 -.0517D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.0094D+00 .0000D+00 .1284D+00 .0000D+00 .0851D+00 .0000D+00 -.0079D+00 .1000D+01 .7771D+00 .0000D+00 .0253D+00 .0000D+00 .0081D+00 .0000D+00 .0529D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0095D+00 .0000D+00 -.0669D+00 .0000D+00 -.0342D+00 .0000D+00 .0658D+00 .0000D+00 -.0341D+00 .0000D+00 .2095D+00 .0000D+00 .0107D+00 .0000D+00 .0923D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0237D+00 .0000D+00 .0813D+00 .0000D+00 .0268D+00 .0000D+00 -.0848D+00 .0000D+00 .0164D+00 .1000D+01 .6173D+00 .0000D+00 -.0138D+00 .0000D+00 -.0945D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0189D+00 .0000D+00 -.3275D+00 .0000D+00 -.1496D+00 .0000D+00 .0689D+00 .0000D+00 -.1201D+00 .0000D+00 .1359D+00 .0000D+00 .3119D+00 .0000D+00 -.0085D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.0059D+00 .0000D+00 .2417D+00 .0000D+00 .1944D+00 .0000D+00 -.0739D+00 .0000D+00 .3157D+00 .0000D+00 .1776D+00 .1000D+01 .3995D+00 .0000D+00 .0516D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.0373D+00 .0000D+00 .0986D+00 .0000D+00 -.1332D+00 .0000D+00 .0657D+00 .0000D+00 -.0546D+00 .0000D+00 .0440D+00 .0000D+00 -.0111D+00 .0000D+00 -.0391D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0610D+00 .0000D+00 -.0931D+00 .0000D+00 .1297D+00 .0000D+00 -.0714D+00 .0000D+00 .0254D+00 .0000D+00 -.0848D+00 .0000D+00 .0055D+00 .1000D+01 0.10233D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.1228D+00 .0000D+00 .20351D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .1000D+01 .8965D+00 .0000D+00 .30747D+01 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 -.0041D+00 .0000D+00 .2600D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0000D+00 .0042D+00 .1000D+01 .1704D+00 -.0026D+00 .1205D+00 -.0022D+00 -.0603D+00 .0091D+00 -.0362D+00 .0010D+00 -.0096D+00 .0038D+00 -.0378D+00 .0004D+00 .0019D+00 -.0025D+00 .0800D+00 -.0014D+00 -.0647D+00 .0188D+00 .0001D+00 -.0011D+00 .0399D+00 .0034D+00 -.0165D+00 .0057D+00 .0087D+00 -.0014D+00 .0547D+00 -.0205D+00 -.0001D+00 .0070D+00 -.0005D+00 -.0004D+00 .0105D+00 .0056D+00 -.0131D+00 -.0014D+00 .0023D+00 -.0086D+00 .0656D+00 .0191D+00 -.0307D+00 -.0617D+00 .0095D+00 -.0101D+00 .2088D+00 -.0095D+00 -.0300D+00 .0038D+00 .0086D+00 -.0033D+00 -.0021D+00 -.0294D+00 -.0086D+00 .0035D+00 -.0007D+00 .0013D+00 .0050D+00 .0187D+00 -.0022D+00 -.0013D+00 .0002D+00 .0081D+00 .0446D+00 -.0092D+00 .0964D+00 .0258D+00 -.0081D+00 .0244D+00 .1400D+00 .0039D+00 -.5574D+00 -.0419D+00 .0152D+00 .0147D+00 -.1752D+00 -.0013D+00 -.12201D+01 -.0057D+00 -.0014D+00 .0103D+00 .2547D+00 .0006D+00 .19353D+01 -.0402D+00 .0117D+00 .0008D+00 .1287D+00 .0077D+00 -.1102D+00 .0106D+00 .0075D+00 .0006D+00 .0210D+00 .0002D+00 .0126D+00 .0066D+00 .0004D+00 .0000D+00 .0901D+00 -.0152D+00 .0000D+00 -.2026D+00 .0000D+00 .0000D+00 .0810D+00 .0026D+00 .0000D+00 -.0255D+00 .0000D+00 .0000D+00 .0544D+00 .0011D+00 .0000D+00 -.0037D+00 .0000D+00 .0000D+00 -.0668D+00 -.0035D+00 .0000D+00 .0039D+00 .0000D+00 .000D+00 .100D+01 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .100D+01 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .100D+01 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .100D+01 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .100D+01 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .000D+00 .100D+01 .000D+00 .000D+00 .200D+01 .100D+01 .300D+01 .300D+01 .400D+01 .100D+01 .100D+00 .100D+00 .100D+02 .100D+00 .100D+02 .100D+01 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01103.dat 0000664 0000000 0000000 00000000450 14560147231 0022305 0 ustar 00root root 0000000 0000000 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.890D+00 3.900D-01 -5.530D+00 0.000D+00 -3.400D-02 -2.980D+00 2.430D+00 3.400D-02 -1.100D-03 -9.900D-01 -2.100D-01 0.000D+00 0.000D+00 3.600D-01 -1.600D+00 -9.500D-01 -3.200D-02 3.000D-02 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01104.dat 0000664 0000000 0000000 00000001711 14560147231 0022307 0 ustar 00root root 0000000 0000000 -9.910D-01 5.290D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.220D-01 -1.051D+00 5.960D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.220D-01 -1.118D+00 5.960D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.220D-01 -1.548D+00 7.180D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.220D-01 -1.640D+00 7.990D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.220D-01 -1.721D+00 9.010D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.220D-01 -1.823D+00 1.021D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.220D-01 -1.943D+00 3.840D-03 -2.880D-03 4.000D-03 -3.040D-03 3.760D-02 -2.800D-03 3.080D-03 -2.320D-03 2.360D-03 -3.320D-03 2.880D-03 -3.820D-03 3.080D-03 -4.120D-03 3.000D-03 -3.960D-03 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01105.dat 0000664 0000000 0000000 00000002440 14560147231 0022310 0 ustar 00root root 0000000 0000000 -4.019D+00 5.120D+00 0.000D+00 0.000D+00 -2.082D+00 0.000D+00 0.000D+00 0.000D+00 8.700D-01 -3.460D-01 9.860D-01 0.000D+00 0.000D+00 -2.340D+00 0.000D+00 0.000D+00 0.000D+00 9.700D-01 -7.909D+00 1.5407D+01 -4.069D+00 0.000D+00 -6.450D+00 0.000D+00 0.000D+00 0.000D+00 2.680D+00 -2.1816D+01 3.5606D+01 -3.390D-01 -3.870D+00 -1.780D+01 0.000D+00 0.000D+00 0.000D+00 7.390D+00 -6.0196D+01 9.8188D+01 -7.907D+00 3.400D-01 -5.3008D+01 0.000D+00 0.000D+00 0.000D+00 2.040D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.400D+01 -1.472D+02 0.000D+00 5.320D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.400D+01 -1.472D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.280D+01 0.000D+00 -3.160D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.280D+01 0.000D+00 0.000D+00 1.880D+01 -3.160D+01 1.000D-02 -1.100D-02 -1.510D-01 3.000D-03 -2.100D-02 0.000D+00 9.000D-03 -5.900D-02 0.000D+00 2.400D-02 -1.620D-01 0.000D+00 6.800D-02 -4.450D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01106.dat 0000664 0000000 0000000 00000032221 14560147231 0022311 0 ustar 00root root 0000000 0000000 -4.328D+00 1.714D-01 5.376D+00 4.016D+02 -7.246D+02 -1.933D+00 1.020D+00 -9.820D-01 9.990D-01 1.521D+00 -4.062D+00 9.567D+00 1.008D+01 -6.017D-01 -1.312D-01 9.602D-02 -4.570D-02 0.000D+00 -4.516D+02 0.000D+00 0.000D+00 -1.058D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -4.402D-01 -5.643D+00 1.275D+02 -2.335D+02 -4.343D+02 2.659D+01 2.040D+00 -2.592D+00 1.132D+01 1.090D+01 -4.071D+00 -5.739D-02 -6.063D-01 -7.488D-02 -5.936D-01 -9.602D-02 1.114D-01 0.000D+00 -5.461D+02 0.000D+00 0.000D+00 -6.575D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.038D+00 6.073D+00 -1.650D+02 -4.483D+00 1.049D+03 -8.245D+01 -5.314D+00 5.097D+00 -9.389D-03 1.352D-01 5.638D+00 2.246D-02 1.797D-01 2.407D-02 1.100D+00 2.743D-02 2.153D-01 0.000D+00 1.362D+03 0.000D+00 0.000D+00 1.346D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.304D-01 -1.086D-01 1.313D+02 -5.783D+02 1.020D+02 -9.240D+00 -1.146D+00 -2.408D+00 -3.081D+00 -4.529D+00 5.707D+00 -2.346D-01 -2.111D+00 -2.460D-01 -4.686D-01 -3.223D-01 3.262D-01 0.000D+00 2.080D+02 0.000D+00 0.000D+00 -2.888D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 8.476D-03 -1.563D-02 5.602D-02 1.573D+00 -1.005D+01 1.952D-01 -8.804D-03 -2.110D-02 2.090D-03 -5.256D-02 -4.077D-02 -9.182D-03 -5.178D-02 3.425D-02 4.995D-03 -1.256D-02 9.948D-03 0.000D+00 -9.839D+01 0.000D+00 0.000D+00 5.069D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 8.350D-01 -1.249D-02 -3.567D-02 -6.074D-01 3.765D+01 -1.979D+01 -1.813D-01 -2.952D-02 -1.953D-02 -1.622D-01 -6.439D-03 -2.346D-02 -2.201D-01 -2.514D-02 -3.749D-03 -3.351D-02 2.728D-02 0.000D+00 7.162D+01 0.000D+00 0.000D+00 9.608D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.768D-01 -1.264D-02 -9.683D-02 -3.567D-01 8.024D+01 -8.239D-02 -2.047D+01 -3.928D-02 1.878D-02 -2.129D-01 -9.337D-03 -3.144D-02 -2.919D-01 -3.370D-02 8.873D-02 -4.458D-02 1.716D-02 0.000D+00 7.171D+01 0.000D+00 0.000D+00 8.571D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -9.696D-02 8.666D-01 1.687D+01 1.051D+00 -1.023D+02 2.966D+01 5.943D-01 -1.997D+01 2.253D-02 1.701D-01 8.371D-03 2.645D-02 2.560D-01 2.835D-02 -3.749D-02 3.635D-02 -7.741D-02 0.000D+00 -1.412D+02 0.000D+00 0.000D+00 -8.215D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.785D-03 -1.636D-02 1.847D-01 2.169D-01 -8.420D+00 7.003D-01 5.666D-02 6.623D+00 -4.999D+01 6.760D-02 3.946D+01 4.991D-03 8.983D-02 5.349D-03 0.000D+00 1.372D-02 3.855D-02 0.000D+00 -7.710D+00 0.000D+00 0.000D+00 -4.371D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.298D-04 -2.430D-04 2.718D-03 3.214D-03 -1.246D-01 1.037D-02 8.395D-04 9.812D-02 -6.666D-01 -6.657D-01 5.847D-01 6.654D-05 1.347D-03 7.131D-05 0.000D+00 2.057D-04 5.707D-04 0.000D+00 -1.144D-01 0.000D+00 0.000D+00 -6.359D-04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.207D+00 -6.717D+00 2.626D+01 1.249D+01 -1.269D+03 1.030D+02 7.480D+00 3.684D+01 2.854D-01 2.332D+00 -4.765D+01 3.406D-01 3.065D+00 3.624D-01 -4.343D-01 4.681D-01 5.727D+00 0.000D+00 -1.745D+03 0.000D+00 0.000D+00 -8.940D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.730D-02 -4.539D-01 -5.272D+01 1.988D+02 -2.809D+01 2.243D+00 1.794D-01 9.750D+00 -9.627D+00 -9.557D+00 3.848D+01 -5.001D+01 1.011D-01 1.203D-02 -4.686D-02 1.715D-02 1.392D-01 0.000D+00 -2.430D+01 0.000D+00 0.000D+00 -2.736D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.206D-03 -2.017D-02 -2.343D+00 8.835D+00 -1.248D+00 9.975D-02 8.059D-03 4.333D-01 -4.278D-01 -4.245D-01 1.710D+00 -2.000D+00 -1.996D+00 5.349D-04 -1.999D-03 7.544D-04 6.172D-03 0.000D+00 -1.082D+00 0.000D+00 0.000D+00 -1.183D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.613D-01 -2.469D-01 -2.405D+01 2.338D+01 1.483D+02 1.638D+00 1.385D-01 4.488D+00 -4.414D+00 -4.354D+00 1.766D+01 -3.113D+00 -3.018D+00 -1.977D+01 -4.999D-02 1.509D-02 6.777D-02 0.000D+00 1.660D+01 0.000D+00 0.000D+00 3.980D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.244D-02 3.020D-02 -1.198D-01 -4.821D-02 5.575D+00 -4.525D-01 1.981D+01 1.249D-01 -1.127D-03 -6.760D-03 1.835D-02 -9.981D-04 -1.347D-02 -1.070D-03 -2.000D+01 -2.057D-03 1.880D-03 0.000D+00 9.147D+00 0.000D+00 0.000D+00 -8.241D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.653D+00 1.831D+00 -3.822D+00 1.134D+02 3.414D+02 -2.734D+01 -2.040D+00 -6.166D-01 5.004D-01 -1.437D-01 -2.416D+00 -1.073D-01 -1.078D+00 3.053D+01 1.989D+01 -5.016D+01 1.677D-01 0.000D+00 4.358D+02 0.000D+00 0.000D+00 -5.994D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -5.000D+02 -6.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.600D+03 -7.080D+02 -1.0672D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.200D+04 -5.240D+03 -1.500D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 3.330D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.330D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.450D-01 6.450D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.940D-01 -8.940D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.060D-01 -1.860D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.000D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 3.600D+03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.200D+04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 4.865D-01 -6.741D-01 5.392D+00 9.542D+01 2.403D+01 1.052D+01 8.190D-01 -4.492D-01 5.195D-01 8.437D-01 -1.863D+00 5.709D-02 4.815D-01 3.428D+00 2.161D+00 7.681D-02 -6.777D-02 0.000D+00 -4.205D+02 0.000D+00 0.000D+00 3.297D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.383D-02 2.789D-06 0.000D+00 0.000D+00 -1.081D-02 -5.545D-05 4.722D-05 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.282D-04 0.000D+00 3.353D-01 0.000D+00 0.000D+00 6.804D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 7.418D-05 5.496D-06 4.790D-06 1.478D-04 -1.504D-02 -6.503D-05 8.820D-05 4.999D-06 3.434D-06 2.727D-05 1.128D-06 4.002D-06 3.673D-05 4.290D-06 -4.958D-06 5.609D-06 1.030D-06 0.000D+00 -1.193D-02 0.000D+00 0.000D+00 -5.806D-03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.538D-05 1.201D-04 -2.579D-03 -1.609D-04 1.618D-02 -1.071D-03 -9.561D-05 -5.503D-06 -3.732D-06 -2.996D-05 -1.234D-06 -4.380D-06 -4.024D-05 -4.721D-06 5.324D-06 -6.103D-06 8.109D-06 0.000D+00 2.328D-02 0.000D+00 0.000D+00 1.178D-04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01107.dat 0000664 0000000 0000000 00000003471 14560147231 0022317 0 ustar 00root root 0000000 0000000 -1.400D-02 4.300D-03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.500D-03 -1.380D-02 4.600D-03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.000D-04 0.000D+00 9.500D-03 -1.410D-02 6.300D-03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.000D-04 0.000D+00 0.000D+00 9.500D-03 -1.580D-02 1.100D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.500D-03 -3.120D-02 1.500D-02 2.200D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.020D-02 -3.520D-02 2.200D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.020D-02 -4.220D-02 2.800D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.020D-02 -4.820D-02 3.700D-02 0.000D+00 2.000D-04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.020D-02 -5.720D-02 4.200D-02 5.000D-04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.020D-02 -4.830D-02 5.000D-04 2.550D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.550D-02 -1.850D-02 0.000D+00 0.000D+00 0.000D+00 5.000D-06 -4.000D-05 2.500D-03 2.000D-06 -2.000D-05 5.000D-03 1.000D-06 -1.000D-05 5.000D-03 0.000D+00 0.000D+00 5.000D-03 0.000D+00 0.000D+00 5.000D-03 -5.000D-06 1.000D-05 5.000D-03 -1.000D-05 3.000D-05 5.000D-03 -4.000D-05 5.000D-06 2.500D-03 -2.000D-05 2.000D-06 2.500D-03 4.600D-04 4.600D-04 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01108.dat 0000664 0000000 0000000 00000002421 14560147231 0022312 0 ustar 00root root 0000000 0000000 -3.930D+00 -3.150D-03 0.000D+00 0.000D+00 0.000D+00 4.030D-05 0.000D+00 0.000D+00 0.000D+00 3.680D+02 -3.050D+00 3.030D+00 0.000D+00 0.000D+00 -3.770D-03 0.000D+00 0.000D+00 0.000D+00 2.740D+01 7.870D-02 -5.960D-02 0.000D+00 0.000D+00 -2.810D-04 0.000D+00 0.000D+00 0.000D+00 -6.470D-02 -5.200D-05 0.000D+00 -2.550D-01 -3.350D-06 3.600D-07 6.330D-05 1.940D-04 0.000D+00 3.850D+03 1.730D+01 -1.280D+01 -1.260D+04 -2.910D+00 -1.050D-01 1.270D+01 4.310D+01 0.000D+00 2.240D+04 1.800D+01 0.000D+00 -3.560D+01 -1.040D-04 -4.140D-01 9.000D+01 5.690D+01 0.000D+00 0.000D+00 0.000D+00 2.340D-03 0.000D+00 0.000D+00 2.220D-04 -2.030D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.270D+00 1.000D-03 7.860D-05 0.000D+00 -7.170D-02 0.000D+00 -2.200D+00 -1.770D-03 0.000D+00 -8.440D+00 -1.110D-04 1.380D-05 1.490D-03 6.020D-03 -1.000D-10 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.560D+00 0.000D+00 0.000D+00 0.000D+00 -5.130D-06 0.000D+00 8.280D+00 -1.500D+00 3.950D-02 0.000D+00 1.780D+00 0.000D+00 2.330D+00 0.000D+00 0.000D+00 0.000D+00 -2.450D-02 2.840D-03 0.000D+00 2.940D-05 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01109.dat 0000664 0000000 0000000 00000112452 14560147231 0022321 0 ustar 00root root 0000000 0000000 1.015D-01 -1.977D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.970D+03 6.796D+00 -1.334D-01 -1.429D+03 1.803D+01 -1.517D-01 0.000D+00 -3.158D+00 0.000D+00 0.000D+00 1.977D+01 1.015D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.665D+03 7.196D+00 -1.568D-01 -2.222D+03 -2.684D+00 -5.0292D-02 0.000D+00 1.779D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.3202D-02 -9.2543D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.869D+02 1.7334D-03 -4.3119D-05 1.190D+02 4.8611D-04 -7.4279D-06 0.000D+00 5.3132D-03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.2543D-02 -2.3202D-02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -5.011D+02 4.1488D-03 -8.0848D-05 -1.059D+02 1.0274D-03 -1.1816D-05 0.000D+00 8.0111D-03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.165D-01 -1.433D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.345D+02 -2.690D-01 4.9694D-03 -1.468D+02 -7.097D-01 1.2317D-03 0.000D+00 1.066D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.433D+01 -3.165D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.645D+02 4.627D-01 -8.432D-03 1.960D+02 1.345D+00 -3.9645D-03 0.000D+00 -4.078D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.892D-01 -2.229D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.085D+02 -1.835D+00 3.6978D-02 1.751D+02 -1.082D+00 1.1391D-02 0.000D+00 1.001D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.229D+01 -3.892D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -7.754D+01 1.595D-01 -2.0525D-03 9.616D+00 6.370D-01 -2.8823D-03 0.000D+00 -1.571D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -9.883D-01 -3.616D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.117D+03 4.615D+00 -8.4286D-02 -3.414D+01 6.425D+00 -4.9071D-02 0.000D+00 -1.060D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 3.616D+01 -9.883D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.790D+03 -3.752D+00 7.1871D-02 -2.227D+02 1.899D+00 -1.5192D-02 0.000D+00 4.854D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.342D+00 -2.547D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.3858D+04 5.550D-01 -1.2727D-02 -2.014D+03 -5.0439D-02 1.0263D-03 0.000D+00 -2.733D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.457D+00 -1.342D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.501D+04 -3.138D+00 6.5016D-02 2.668D+03 -1.060D+00 1.1647D-02 0.000D+00 2.067D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.312D+00 -2.151D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.1697D+04 6.146D+01 -1.286D+00 -3.652D+03 5.074D+00 -1.277D-01 0.000D+00 3.001D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.151D+01 -2.312D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.9966D+04 -5.356D+01 1.121D+00 2.881D+03 -2.677D+01 2.540D-01 0.000D+00 3.544D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.792D+00 -2.671D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.861D+03 1.314D+01 -2.426D-01 -1.080D+03 4.849D+01 -3.712D-01 0.000D+00 -7.199D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.671D+01 -2.792D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.583D+03 -1.932D+01 3.841D-01 -3.883D+03 -1.293D+01 1.0825D-02 0.000D+00 7.207D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.796D+00 -6.379D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.212D+03 -1.228D+01 1.229D-01 -1.647D+03 -5.130D+00 2.0187D-02 0.000D+00 6.186D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.379D+01 -2.796D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.321D+03 -2.717D+01 2.049D-01 -1.045D+03 -1.559D+01 6.4588D-02 0.000D+00 1.076D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.332D+00 -5.637D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.3964D+04 -1.724D+01 3.5851D-02 5.620D+02 -2.548D+01 1.072D-01 0.000D+00 2.821D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.637D+01 -3.332D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.382D+03 -2.008D+01 3.605D-01 9.026D+02 -1.623D+00 7.7575D-02 0.000D+00 -7.866D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.418D+00 -8.867D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.037D+02 2.624D+00 -1.208D-01 1.129D+03 4.399D+00 -2.724D-02 0.000D+00 -1.111D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 8.867D+01 -3.418D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.428D+02 5.789D-01 1.194D-01 -1.258D+03 -6.993D+00 2.9297D-02 0.000D+00 1.509D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -4.441D+00 -6.945D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -5.271D+02 -3.601D+01 3.072D-01 -1.267D+03 7.583D+00 -6.5626D-03 0.000D+00 -3.659D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.945D+01 -4.441D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.658D+03 3.812D+00 -3.7101D-02 -4.911D+01 -4.347D+00 -8.4969D-03 0.000D+00 8.635D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -5.108D+00 -5.339D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.5341D+04 -3.645D+01 4.514D-01 4.360D+03 -1.313D+02 8.394D-01 0.000D+00 7.433D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.339D+01 -5.108D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 6.538D+03 -2.856D+01 3.244D-01 3.790D+03 9.071D+01 -3.495D-01 0.000D+00 -1.536D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -5.199D+00 -5.064D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 4.2048D+04 -5.943D+01 7.558D-01 2.501D+03 -1.739D+01 1.113D-01 0.000D+00 4.570D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.064D+01 -5.199D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.106D+02 -3.951D+01 5.076D-01 -4.704D+02 -1.875D+01 1.395D-01 0.000D+00 -2.771D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -5.301D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.251D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -5.670D+00 -9.296D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.942D+02 1.357D+01 -2.1971D-02 8.284D+02 1.290D+01 -3.6967D-02 0.000D+00 -5.031D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 9.296D+01 -5.670D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 7.692D+02 1.060D+01 -9.2043D-02 8.100D+02 1.907D+01 -8.1012D-02 0.000D+00 -4.524D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -6.197D+00 -4.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 4.2702D+04 -1.207D+02 1.940D+00 -3.077D+03 3.590D+01 -2.467D-01 0.000D+00 -1.592D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 4.000D+01 -6.197D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -7.6982D+04 1.406D+02 -2.796D+00 -3.483D+02 -3.856D+01 1.981D-01 0.000D+00 1.956D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.177D+00 -1.661D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.888D+02 -9.428D-01 2.3831D-02 -1.499D+03 9.758D-01 -4.1943D-02 0.000D+00 -5.981D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.661D+01 -8.177D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.237D+03 8.455D+00 -1.565D-01 -6.578D+03 4.950D+01 -4.980D-01 0.000D+00 -1.088D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.221D+00 -1.391D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.6942D+04 9.443D+01 -1.144D+00 -6.089D+01 2.221D-01 -1.1955D-02 0.000D+00 -1.121D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.391D+02 -8.221D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.2513D+04 6.802D+01 -6.821D-01 -2.937D+01 4.639D-01 -9.9611D-03 0.000D+00 1.532D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.035D+01 -1.630D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 5.748D+03 -3.578D+01 2.067D-01 -3.931D+01 -6.830D-01 7.8189D-03 0.000D+00 -4.254D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.630D+02 -1.035D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.4657D+04 2.168D+02 -6.615D-01 1.234D+02 9.043D+00 -8.7434D-02 0.000D+00 -7.886D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.172D+01 -1.093D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -4.089D+03 -2.581D+02 -1.059D+00 3.303D+01 -2.040D+00 2.3536D-02 0.000D+00 -1.053D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.093D+02 -1.172D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 7.940D+03 3.090D+02 1.175D+00 6.104D+01 2.311D+00 -2.8729D-02 0.000D+00 -2.007D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.179D+01 -3.046D+02 0.000D+00 0.000D+00 9.582D+03 3.730D+01 -3.1126D-02 1.409D+02 2.627D+00 -1.8542D-02 0.000D+00 1.886D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 3.046D+02 -1.179D+01 0.000D+00 0.000D+00 9.474D+03 4.140D+01 -5.0827D-02 1.563D+02 3.098D+00 -2.2171D-02 0.000D+00 9.2049D-03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.327D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.707D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.212D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.783D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.000D+05 -6.080D+04 -1.060D+03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.600D+07 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.000D+05 -6.080D+04 -1.060D+03 0.000D+00 0.000D+00 0.000D+00 -1.600D+07 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.668D-01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 -1.033D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.000D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 8.000D+05 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 8.000D+05 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 4.4247D-05 4.3403D-05 4.9713D-05 4.5556D-05 -4.1311D-06 7.9201D-06 7.2496D-06 -6.7385D-05 -1.8236D-04 2.0657D-05 1.3194D-04 -1.5849D-04 -6.7655D-05 -8.7358D-06 -9.8119D-05 3.1119D-05 -5.7479D-05 3.160D-04 -5.775D-04 7.100D-04 -9.6843D-05 2.9934D-05 5.4014D-04 -4.762D-04 -4.163D-06 -2.1609D-04 -1.0541D-04 -3.1883D-05 -1.5062D-04 -2.7714D-04 -2.4361D-04 2.799D-05 -1.6592D-04 1.2748D-05 -2.0762D-05 -1.2546D-04 -4.436D-05 -1.0147D-05 1.5343D-04 2.1956D-05 -2.9386D-05 6.5513D-05 6.1813D-05 1.9995D-05 8.9674D-06 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 3.592D+01 -1.246D+01 -5.332D-01 -5.659D-01 -9.664D-01 1.275D+01 -2.145D+01 6.822D+00 3.388D+01 1.700D+01 -1.380D-01 -8.803D-01 5.465D+00 -1.614D+00 5.518D+01 3.010D+01 -4.878D+00 1.436D+01 6.254D+01 5.518D+01 -1.388D+02 -1.044D+02 6.831D+00 -1.178D+01 -5.504D+01 -3.066D+01 1.402D+00 -3.033D+01 4.869D+00 -7.428D+01 7.414D+01 1.630D+01 3.118D+00 8.728D+00 -7.453D+01 1.460D+00 -3.334D+00 -7.367D+00 -1.032D+00 2.867D+00 6.583D+00 -1.361D+00 1.350D+00 1.071D+01 -2.591D+01 4.852D+01 -7.932D+00 7.9915D-02 -2.5618D+04 -1.674D+02 2.213D-01 0.000D+00 1.880D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01110.dat 0000664 0000000 0000000 00000001701 14560147231 0022303 0 ustar 00root root 0000000 0000000 0.000D+00 8.500D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.500D+01 -1.200D+02 -4.100D+03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 3.300D+01 0.000D+00 -3.300D+01 0.000D+00 -7.000D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.400D+03 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.600D+03 -4.500D+02 -1.100D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 8.100D+01 0.000D+00 -1.000D+00 0.000D+00 -9.000D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.100D+02 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.200D+01 -1.100D+00 -2.200D+01 0.000D+00 0.000D+00 4.600D+00 9.900D+04 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01203.dat 0000664 0000000 0000000 00000001774 14560147231 0022320 0 ustar 00root root 0000000 0000000 -3.270D-01 -6.394D+01 -1.5596D+02 -1.000D+00 -2.370D-01 3.260D-01 -2.085D+02 9.093D+01 3.910D-01 -1.3029D+02 -1.865D+02 -1.420D+00 -3.370D-01 3.500D-01 -2.7238D+02 7.506D+01 -6.880D-01 -6.1927D+02 -5.529D+02 -2.270D+00 -4.290D-01 6.500D-01 -6.5111D+02 2.8344D+02 -7.380D-01 -6.5157D+02 -6.0418D+02 -2.750D+00 -5.320D-01 6.600D-01 -9.1364D+02 2.505D+02 -8.860D-01 -1.06885D+03 -1.00439D+03 -3.380D+00 -5.820D-01 7.900D-01 -1.92645D+03 4.0296D+02 -1.364D+00 -9.282D+01 -1.2846D+02 -4.680D+00 -8.700D-02 1.360D+00 -1.8426D+02 7.643D+01 -3.330D-01 -1.6324D+02 -1.5332D+02 -6.660D-01 -1.240D-01 2.980D-01 -2.4775D+02 6.377D+01 -3.370D-01 -2.2403D+02 -2.2872D+02 -6.630D-01 -1.120D-01 3.190D-01 -3.7575D+02 1.174D+02 -3.690D-01 -2.5371D+02 -2.4987D+02 -8.000D-01 -1.350D-01 3.300D-01 -5.0059D+02 1.0376D+02 -4.020D-01 -2.772D+02 -4.1935D+02 -8.840D-01 -1.660D-01 3.600D-01 -7.9618D+02 1.7859D+02 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD012051.dat 0000664 0000000 0000000 00000000145 14560147231 0022372 0 ustar 00root root 0000000 0000000 0.000D+00 1.000D+00 9.800D+00 0.000D+00 0.000D+00 1.000D+00 1.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD012052.dat 0000664 0000000 0000000 00000000612 14560147231 0022372 0 ustar 00root root 0000000 0000000 0.000D+00 1.000D+00 0.000D+00 0.000D+00 9.800D+00 0.000D+00 -9.800D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 -9.800D+00 0.000D+00 2.940D+01 0.000D+00 0.000D+00 0.000D+00 1.000D+00 -2.000D+00 0.000D+00 0.000D+00 -2.000D+00 5.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD012053.dat 0000664 0000000 0000000 00000001566 14560147231 0022404 0 ustar 00root root 0000000 0000000 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 2.940D+01 -1.960D+01 -3.6285D-16 0.000D+00 0.000D+00 0.000D+00 -2.940D+01 3.920D+01 -9.800D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.960D+01 1.960D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.6667D+00 -2.6667D+00 1.000D+00 -2.3333D+00 4.8333D+00 -3.500D+00 6.6667D-01 -2.6667D+00 4.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD012054.dat 0000664 0000000 0000000 00000003006 14560147231 0022374 0 ustar 00root root 0000000 0000000 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 3.920D+01 -2.940D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.920D+01 5.880D+01 -1.960D+01 -3.6285D-16 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -4.3521D-15 -2.940D+01 3.920D+01 -9.800D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.960D+01 1.960D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.750D+00 -2.750D+00 1.000D+00 6.4185D-17 -2.500D+00 5.1667D+00 -3.6667D+00 1.000D+00 7.500D-01 -3.0833D+00 4.8333D+00 -3.500D+00 3.5586D-17 6.6667D-01 -2.6667D+00 4.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD012055.dat 0000664 0000000 0000000 00000004552 14560147231 0022404 0 ustar 00root root 0000000 0000000 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 4.900D+01 -3.920D+01 -4.5686D-15 1.0878D-15 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -4.900D+01 7.840D+01 -2.940D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -3.663D-14 -3.920D+01 5.880D+01 -1.960D+01 -3.6285D-16 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.224D-14 -1.3056D-14 -2.940D+01 3.920D+01 -9.800D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.960D+01 1.960D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.800D+00 -2.800D+00 1.000D+00 3.116D-16 -2.2755D-16 -2.600D+00 5.350D+00 -3.750D+00 1.000D+00 3.0015D-16 8.000D-01 -3.300D+00 5.1667D+00 -3.6667D+00 1.000D+00 5.1282D-16 7.500D-01 -3.0833D+00 4.8333D+00 -3.500D+00 5.3006D-17 -1.2003D-17 6.6667D-01 -2.6667D+00 4.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD012056.dat 0000664 0000000 0000000 00000006641 14560147231 0022406 0 ustar 00root root 0000000 0000000 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 5.880D+01 -4.900D+01 2.9028D-15 -1.6328D-15 5.4427D-16 -1.0086D-32 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -5.880D+01 9.800D+01 -3.920D+01 -4.8961D-15 5.4401D-16 2.0127D-32 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -4.900D+01 7.840D+01 -2.940D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -2.031D-14 2.0491D-14 -3.920D+01 5.880D+01 -1.960D+01 -3.6285D-16 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.1968D-14 -1.5504D-14 5.4401D-15 -2.940D+01 3.920D+01 -9.800D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.1755D-15 -1.6323D-15 2.176D-15 -1.0885D-15 -1.960D+01 1.960D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.8333D+00 -2.8333D+00 1.000D+00 -3.0442D-16 1.2911D-16 -1.0963D-16 -2.6667D+00 5.4667D+00 -3.800D+00 1.000D+00 6.7758D-17 4.2643D-16 8.3333D-01 -3.4333D+00 5.350D+00 -3.750D+00 1.000D+00 -7.5488D-16 -5.5618D-16 8.000D-01 -3.300D+00 5.1667D+00 -3.6667D+00 1.000D+00 4.3692D-16 -9.2492D-16 7.500D-01 -3.0833D+00 4.8333D+00 -3.500D+00 1.1031D-16 -1.6825D-16 2.2085D-17 6.6667D-01 -2.6667D+00 4.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD012057.dat 0000664 0000000 0000000 00000022531 14560147231 0022403 0 ustar 00root root 0000000 0000000 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 9.800D+01 -8.820D+01 -1.7383D-15 -3.7188D-18 -6.5249D-15 5.4388D-15 1.3084D-31 -1.6316D-15 5.4388D-16 -1.0042D-32 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -9.800D+01 1.764D+02 -7.840D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.088D-14 -8.820D+01 1.568D+02 -6.860D+01 6.5281D-15 -1.088D-14 4.3521D-15 1.4495D-30 -4.8318D-31 8.9449D-48 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.5855D-14 -3.637D-14 -7.840D+01 1.372D+02 -5.880D+01 3.4194D-14 -1.9585D-14 3.2649D-15 -1.0883D-15 2.0172D-32 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.1062D-13 1.0699D-13 -2.5751D-14 -6.860D+01 1.176D+02 -4.900D+01 1.5959D-14 -4.8969D-15 1.6323D-15 4.0225D-32 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.088D-13 -9.7922D-14 1.3056D-14 -7.6177D-15 -5.880D+01 9.800D+01 -3.920D+01 -1.3056D-14 4.3521D-15 -8.0569D-32 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -8.1596D-15 6.5289D-15 -8.1601D-15 -5.4454D-16 3.1009D-14 -4.900D+01 7.840D+01 -2.940D+01 -4.8961D-15 8.0569D-32 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -4.9868D-14 4.2342D-14 3.9892D-15 -1.4506D-15 -1.8859D-14 2.9013D-14 -3.920D+01 5.880D+01 -1.960D+01 3.6285D-16 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.720D-14 -2.3256D-14 0.000D+00 0.000D+00 8.1601D-15 -9.5202D-15 -4.3521D-15 -2.940D+01 3.920D+01 -9.800D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 -1.960D+01 1.960D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.900D+00 -2.900D+00 1.000D+00 2.1959D-16 -2.8176D-16 4.8626D-16 -1.0559D-16 -2.5389D-16 7.9671D-17 3.8476D-17 -2.800D+00 5.6889D+00 -3.8889D+00 1.000D+00 -8.3224D-16 3.5204D-16 -3.3739D-16 5.2418D-16 8.8172D-17 -2.6452D-16 9.000D-01 -3.6778D+00 5.6528D+00 -3.875D+00 1.000D+00 -2.5226D-15 1.571D-15 -8.8962D-16 -9.7319D-17 2.9196D-16 -5.123D-16 8.8889D-01 -3.6389D+00 5.6071D+00 -3.8571D+00 1.000D+00 -3.6967D-15 1.8224D-15 -2.0082D-16 4.7207D-17 -2.359D-15 3.7146D-15 8.750D-01 -3.5893D+00 5.5476D+00 -3.8333D+00 1.000D+00 -2.3237D-15 4.6098D-16 -5.5013D-16 2.660D-15 -4.0482D-15 2.3538D-15 8.5714D-01 -3.5238D+00 5.4667D+00 -3.800D+00 1.000D+00 2.8896D-16 1.029D-15 -5.623D-16 8.7784D-16 -5.4097D-16 -7.1966D-16 8.3333D-01 -3.4333D+00 5.350D+00 -3.750D+00 1.000D+00 -1.6135D-15 -8.0494D-16 1.1525D-15 -2.2138D-16 3.3885D-16 -1.0433D-15 8.000D-01 -3.300D+00 5.1667D+00 -3.6667D+00 1.000D+00 5.2901D-16 -7.6095D-16 1.7267D-16 -1.0799D-16 4.590D-16 -1.2346D-16 7.500D-01 -3.0833D+00 4.8333D+00 -3.500D+00 -3.7739D-17 1.578D-17 5.5573D-17 -9.0729D-18 -4.6091D-17 7.8485D-17 -2.2627D-16 6.6667D-01 -2.6667D+00 4.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 1.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01206.dat 0000664 0000000 0000000 00000000567 14560147231 0022322 0 ustar 00root root 0000000 0000000 -8.950D-01 -2.860D-01 -4.367D+00 -9.180D-01 1.080D-01 -9.180D-01 -7.700D-01 -3.350D-01 -3.394D+00 -1.627D+00 1.700D-01 -1.627D+00 -5.970D-01 -3.720D-01 -3.651D+00 -7.920D-01 1.030D-01 -7.920D-01 -2.980D-01 -2.790D-01 -4.370D+00 -7.730D-01 1.160D-01 -7.730D-01 -4.540D-01 -4.330D-01 -4.005D+00 -8.070D-01 9.700D-02 -8.070D-01 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD01304.dat 0000664 0000000 0000000 00000026122 14560147231 0022314 0 ustar 00root root 0000000 0000000 2.955D+00 1.9238D+02 1.1174D+00 3.823D+09 3.522D+00 3.6315D+01 2.6801D+00 5.055D+08 5.710D-01 4.7517D+01 2.7096D+00 7.532D+10 5.748D-01 1.6335D+02 1.235D+00 5.001D+08 3.526D+00 1.5109D+02 2.947D+00 1.888D+09 4.687D+00 4.3267D+01 2.623D+00 1.096D+09 1.093D+01 1.8937D+02 2.7711D+00 6.473D+09 2.928D+01 3.7326D+01 1.2201D+00 7.684D+09 4.060D+01 1.7896D+01 2.5364D+00 7.412D+09 6.320D+01 1.7413D+02 2.9768D+00 2.143D+10 1.625D+02 6.766D+00 2.9783D+00 2.133D+10 1.482D+02 1.5201D+02 2.7861D+00 4.064D+10 1.095D+02 1.9613D+02 2.5543D+00 3.801D+10 1.515D+02 1.671D+02 2.8597D+00 2.331D+10 1.366D+02 4.882D+01 1.450D+00 3.755D+10 9.321D+01 1.954D+02 1.0907D+00 5.683D+10 1.360D+02 1.9285D+02 1.3592D+00 2.170D+10 2.139D+02 4.6122D+01 2.997D+00 2.148D+10 1.359D+02 2.6812D+01 1.4492D+00 2.778D+10 6.202D+01 1.5125D+02 1.1918D+00 2.778D+10 1.359D+02 6.8707D+00 2.8851D+00 2.148D+10 2.139D+02 2.2951D+01 2.5735D+00 2.170D+10 1.360D+02 1.6795D+02 2.7799D+00 5.683D+10 9.321D+01 1.8293D+02 1.097D+00 3.755D+10 1.366D+02 1.7276D+02 1.2393D+00 2.331D+10 1.515D+02 1.4878D+01 1.2415D+00 3.801D+10 1.095D+02 4.9082D+01 1.3658D+00 4.064D+10 1.482D+02 1.8801D+02 2.5831D+00 2.133D+10 1.625D+02 1.8919D+02 2.7609D+00 2.143D+10 6.320D+01 1.8591D+02 1.0859D+00 7.412D+09 4.060D+01 1.6766D+02 1.127D+00 7.684D+09 2.928D+01 1.5213D+01 1.2696D+00 1.603D+10 1.493D+01 3.5992D+01 2.8901D+00 2.938D+10 1.390D+01 1.805D+02 2.6439D+00 3.427D+09 1.631D+01 1.606D+02 1.0347D+00 3.472D+09 8.175D+00 8.4097D+00 1.4846D+00 7.493D+11 1.392D+01 1.2996D+01 1.1322D+00 2.061D+09 6.629D+01 1.617D+02 1.0912D+00 1.080D+10 9.349D+01 1.8851D+02 1.2275D+00 7.784D+09 5.639D+01 1.7533D+02 2.7355D+00 2.463D+09 8.655D+01 2.7095D+01 2.8856D+00 1.004D+10 1.425D+02 1.8518D+02 2.8081D+00 1.074D+10 1.425D+02 1.9239D+02 1.1063D+00 1.127D+10 1.425D+02 1.1417D+01 2.8387D+00 1.127D+10 1.287D+02 3.5198D+01 1.3266D+00 7.409D+10 1.355D+03 6.6343D+00 1.2365D+00 8.043D+10 1.545D+03 1.9885D+02 2.9889D+00 4.456D+10 1.133D+03 3.345D+01 2.9255D+00 1.591D+11 1.145D+03 2.6675D+01 2.6296D+00 1.159D+11 8.085D+02 4.3575D+01 1.4455D+00 2.260D+11 7.023D+02 1.6747D+02 1.2367D+00 2.805D+11 1.161D+03 1.9831D+02 1.0633D+00 9.080D+10 1.735D+03 2.6289D+01 2.8015D+00 1.320D+11 1.081D+03 1.6667D+02 2.6669D+00 6.213D+10 1.079D+03 1.7021D+02 2.968D+00 1.320D+11 1.733D+03 1.5372D+02 2.8141D+00 9.080D+10 1.161D+03 9.0594D+00 2.9371D+00 2.805D+11 7.023D+02 1.702D+02 1.0517D+00 2.260D+11 8.085D+02 1.7937D+02 2.6601D+00 1.159D+11 1.145D+03 2.5006D+01 2.7449D+00 1.591D+11 1.133D+03 4.1631D+01 1.0258D+00 4.456D+10 1.545D+03 1.703D+02 1.4307D+00 8.043D+10 1.355D+03 1.6682D+02 2.9317D+00 7.409D+10 1.293D+02 1.9183D+02 1.1359D+00 1.117D+10 1.433D+02 1.9064D+02 1.3285D+00 1.123D+10 1.429D+02 2.3481D+01 2.8134D+00 1.071D+10 1.429D+02 1.7817D+02 1.304D+00 1.001D+10 9.194D+01 1.9702D+02 1.3049D+00 1.390D+09 2.053D+01 1.9335D+02 2.629D+00 7.493D+11 1.544D+01 1.892D-01 2.8316D+00 1.850D+09 5.135D+01 3.0443D+01 2.9673D+00 1.076D+10 7.703D+01 3.0077D+01 1.2211D+00 7.784D+09 5.639D+01 3.5862D+01 2.5416D+00 2.463D+09 8.655D+01 1.9506D+01 1.0901D+00 1.004D+10 1.425D+02 1.9847D+02 2.6388D+00 1.074D+10 1.425D+02 1.5119D+01 1.456D+00 1.127D+10 1.425D+02 1.8239D+02 1.3363D+00 1.127D+10 1.287D+02 4.614D+01 1.0081D+00 7.409D+10 1.355D+03 1.554D+02 1.3459D+00 8.043D+10 1.545D+03 1.8506D+02 1.0743D+00 4.456D+10 1.133D+03 1.7753D+02 1.0016D+00 1.591D+11 1.145D+03 1.8612D+02 1.3541D+00 1.159D+11 8.085D+02 1.7412D+02 2.966D+00 2.260D+11 7.023D+02 1.9733D+02 1.3737D+00 2.805D+11 1.161D+03 2.6134D+01 1.2595D+00 9.080D+10 1.735D+03 9.9049D+00 2.7387D+00 1.320D+11 1.081D+03 1.2642D+01 2.8745D+00 6.213D+10 1.079D+03 1.8329D+02 1.4971D+00 1.320D+11 1.733D+03 2.4384D+01 2.8246D+00 9.080D+10 1.161D+03 1.784D+02 1.1113D+00 2.805D+11 7.023D+02 2.5351D+01 2.6093D+00 2.260D+11 8.085D+02 1.9118D+02 1.4248D+00 1.159D+11 1.145D+03 1.7983D+02 2.714D+00 1.591D+11 1.133D+03 1.9718D+02 1.0152D+00 4.456D+10 1.545D+03 1.7521D+01 1.1875D+00 8.043D+10 1.355D+03 1.6172D+02 2.7333D+00 7.409D+10 1.293D+02 1.5284D+02 2.5131D+00 1.117D+10 1.433D+02 1.6681D+02 2.9279D+00 1.123D+10 1.429D+02 1.5863D+02 1.2667D+00 1.071D+10 1.429D+02 1.6305D+02 1.0718D+00 1.001D+10 9.194D+01 1.5817D+02 2.7685D+00 1.390D+09 2.053D+01 2.1338D+01 1.4374D+00 7.493D+11 1.544D+01 1.7823D+02 1.1874D+00 1.850D+09 5.135D+01 1.6406D+02 1.4937D+00 1.076D+10 7.703D+01 5.4544D+00 1.4818D+00 7.784D+09 5.639D+01 4.5576D+00 1.382D+00 2.463D+09 8.655D+01 6.237D-02 2.9445D+00 1.004D+10 1.425D+02 4.3802D+00 2.6594D+00 1.074D+10 1.425D+02 3.1098D+01 1.3545D+00 1.127D+10 1.425D+02 1.7249D+02 1.4864D+00 1.127D+10 1.287D+02 2.8568D+01 1.4257D+00 7.409D+10 1.355D+03 6.6547D+00 2.7693D+00 8.043D+10 1.545D+03 5.8487D+00 2.9487D+00 4.456D+10 1.133D+03 1.3915D+01 2.6158D+00 1.591D+11 1.145D+03 1.8036D+02 2.7605D+00 1.159D+11 8.085D+02 1.681D+02 1.3918D+00 2.260D+11 7.023D+02 1.531D+02 2.8155D+00 2.805D+11 1.161D+03 4.1672D+01 1.0879D+00 9.080D+10 1.735D+03 2.7644D+01 2.7937D+00 1.320D+11 1.081D+03 1.7064D+01 1.1873D+00 6.213D+10 1.079D+03 1.6678D+02 2.7189D+00 1.320D+11 1.733D+03 1.9801D+02 2.9178D+00 9.080D+10 1.080D+03 1.5956D+01 1.2006D+00 5.921D+11 6.214D+02 4.2715D+01 2.9836D+00 2.260D+11 8.085D+02 1.540D+02 1.0986D+00 1.159D+11 1.145D+03 1.0345D+01 1.013D+00 1.591D+11 1.133D+03 3.8248D+00 1.4041D+00 4.456D+10 1.545D+03 4.3148D+01 1.3504D+00 8.043D+10 1.355D+03 1.9073D+02 1.2546D+00 7.409D+10 1.293D+02 3.2006D+01 1.485D+00 1.117D+10 1.433D+02 8.3148D+00 2.7999D+00 1.123D+10 1.429D+02 1.7662D+02 2.7611D+00 1.071D+10 1.429D+02 6.4585D+00 2.813D+00 1.001D+10 9.194D+01 2.8963D+01 1.3885D+00 1.390D+09 2.053D+01 1.8543D+02 1.4319D+00 7.493D+11 1.544D+01 4.2003D+01 1.3827D+00 1.850D+09 5.135D+01 1.9418D+02 2.8198D+00 1.076D+10 7.703D+01 4.222D+00 1.0304D+00 7.880D+09 5.343D+01 4.2741D+01 2.9609D+00 2.334D+09 2.893D+01 1.5159D+02 2.9144D+00 3.229D+09 2.870D+01 1.7658D+02 1.3731D+00 2.378D+09 1.217D+01 1.9738D+02 1.3285D+00 7.585D+11 1.049D+01 2.3626D+01 1.0274D+00 2.758D+09 2.091D+01 1.5592D+02 2.7656D+00 2.758D+09 1.417D+01 4.5147D+01 2.8193D+00 1.027D+10 1.810D+01 8.0555D+00 2.9153D+00 3.483D+09 1.934D+02 2.6912D+01 1.2339D+00 8.690D+09 3.580D+02 1.5229D+02 2.5363D+00 8.690D+09 3.655D+02 1.8645D+02 1.0626D+00 8.351D+09 2.150D+02 1.3804D+01 2.7146D+00 1.854D+10 5.792D+01 1.8003D+02 2.9224D+00 9.619D+09 5.883D+01 4.7601D+01 2.6348D+00 9.619D+09 5.871D+01 7.965D-01 2.5823D+00 9.658D+09 5.224D+02 4.4751D+00 1.4515D+00 1.379D+11 1.111D+03 4.7443D+01 2.7762D+00 1.571D+10 1.236D+03 1.6274D+02 1.020D+00 1.571D+10 1.236D+03 1.2855D+01 1.2205D+00 1.571D+10 1.236D+03 1.6873D+02 2.6964D+00 1.571D+10 1.236D+03 1.9893D+02 1.1805D+00 1.571D+10 1.236D+03 1.5587D+02 1.1392D+00 1.571D+10 1.236D+03 1.6137D+02 1.3832D+00 1.571D+10 1.236D+03 1.8996D+02 1.0066D+00 1.571D+10 1.236D+03 4.7426D+01 2.7906D+00 1.571D+10 1.236D+03 2.7964D+01 2.8989D+00 1.571D+10 1.111D+03 1.8297D+02 1.4231D+00 1.379D+11 5.311D+02 3.9547D+01 1.1972D+00 7.448D+09 7.598D+01 1.0834D+01 1.3212D+00 7.448D+09 5.215D+01 1.835D+02 2.6349D+00 1.573D+10 7.827D+01 4.9398D+01 1.4823D+00 9.695D+09 7.389D+01 3.6386D+01 1.4615D+00 5.036D+09 1.349D+01 7.3201D+00 2.9703D+00 1.006D+10 2.364D+01 1.7057D+02 2.7019D+00 1.413D+09 1.996D+01 6.3739D+00 1.3364D+00 7.405D+11 1.525D+01 4.0509D+00 1.3257D+00 1.851D+09 2.560D+01 1.5037D+02 1.2995D+00 1.634D+10 2.025D+01 1.6899D+02 1.2982D+00 1.720D+10 1.760D+01 1.9244D+02 2.5427D+00 4.069D+09 1.467D+01 3.9725D+01 2.7056D+00 4.716D+09 1.386D+01 2.0234D+01 2.9918D+00 4.716D+09 1.642D+01 4.5742D+01 2.5784D+00 4.220D+09 1.073D+01 1.3059D+01 1.2453D+00 3.681D+10 1.954D+02 4.1785D+01 1.1891D+00 5.454D+09 1.951D+02 1.6869D+02 2.566D+00 3.681D+10 4.505D+00 1.7463D+02 1.3947D+00 9.512D+09 4.505D+00 1.2709D+01 1.3114D+00 3.681D+10 2.015D+02 4.2516D+01 1.4196D+00 5.454D+09 2.018D+02 3.4237D+01 2.5289D+00 3.681D+10 1.077D+01 1.5519D+02 1.440D+00 4.220D+09 2.221D+01 1.9222D+02 2.6184D+00 3.027D+09 2.081D+01 1.8793D+02 2.5096D+00 1.463D+10 9.892D+00 1.6793D+02 1.0799D+00 5.849D+09 5.976D+00 1.9464D+02 1.0875D+00 9.969D+08 2.266D+01 1.6068D+02 2.5014D+00 1.797D+09 4.766D+01 3.776D+01 1.2124D+00 8.687D+08 5.840D+01 2.4005D+01 2.9088D+00 8.687D+08 5.840D+01 1.1795D+01 1.3743D+00 8.687D+08 5.840D+01 3.1123D+01 1.3992D+00 8.687D+08 4.645D+01 1.7377D+02 2.6545D+00 1.372D+09 1.809D+01 1.556D-01 2.8616D+00 4.944D+08 2.701D+00 1.6782D+02 2.7189D+00 5.378D+08 2.663D+00 1.9981D+02 1.1648D+00 3.565D+08 1.183D+00 1.6626D+02 2.9727D+00 5.250D+08 3.758D-01 1.566D+02 2.7438D+00 6.247D+10 3.789D-01 4.5001D+01 2.9488D+00 5.206D+08 1.091D+00 1.2195D+01 1.414D+00 4.039D+08 2.854D+00 1.5192D+02 1.1471D+00 1.187D+09 2.689D+00 1.977D+02 1.0455D+00 3.091D+08 1.102D+00 1.947D+02 1.4344D+00 3.091D+08 3.910D+00 3.2964D+01 2.9155D+00 2.387D+08 6.718D+00 1.9621D+02 1.1845D+00 2.387D+08 3.359D+00 1.5796D+02 0.000D+00 0.000D+00 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD02106.dat 0000664 0000000 0000000 00000000364 14560147231 0022315 0 ustar 00root root 0000000 0000000 9.98D-1 6.70D-2 0.00D0 0.00D0 -6.70D-2 9.98D-1 0.00D0 0.00D0 0.00D0 0.00D0 9.98D-1 1.53D-1 0.00D0 0.00D0 -1.53D-1 9.98D-1 3.30D-3 2.00D-2 1.00D-1 -7.00D-4 4.00D-2 7.30D-3 -2.80D-3 1.00D-1 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD02107.dat 0000664 0000000 0000000 00000000450 14560147231 0022312 0 ustar 00root root 0000000 0000000 9.8475D-1 -7.9903D-2 9.0540D-4 -1.0765D-3 4.1588D-2 9.9899D-1 -3.5855D-2 1.2684D-2 -5.4662D-1 4.4916D-2 -3.2991D-1 1.9318D-1 2.6624D0 -1.0045D-1 -9.2455D-1 -2.6325D-1 3.7112D-3 7.3610D-4 -8.7051D-2 9.3411D-6 -1.19844D0 -4.1378D-4 -3.1927D0 9.2535D-4 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD02108.dat 0000664 0000000 0000000 00000000514 14560147231 0022314 0 ustar 00root root 0000000 0000000 -6.0D-01 -2.2D0 -3.6D0 -5.400018D0 1.0D0 6.0D-01 8.0D-01 3.399982D0 0.0D0 1.0D0 1.8D0 3.799982D0 0.0D0 0.0D0 0.0D0 -9.99982D-1 1.0D0 -1.0D0 -1.0D0 -1.0D0 0.0D0 1.0D0 -1.0D0 -1.0D0 0.0D0 0.0D0 1.0D0 -1.0D0 0.0D0 0.0D0 0.0D0 1.0D0 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD02109.dat 0000664 0000000 0000000 00000000656 14560147231 0022324 0 ustar 00root root 0000000 0000000 9.5407D-1 1.9643D-2 3.5970D-3 6.7300D-4 1.9000D-4 4.0849D-1 4.1317D-1 1.6084D-1 4.4679D-2 1.1971D-2 1.2217D-1 2.6326D-1 3.6149D-1 1.5930D-1 1.2383D-1 4.1118D-2 1.2858D-1 2.7209D-1 2.1442D-1 4.0976D-1 1.3050D-3 5.8080D-3 1.8750D-2 3.6162D-2 9.4280D-1 4.3400D-4 -1.2200D-4 2.6606D-2 -1.0453D-2 3.7530D-2 -5.5100D-2 3.6076D-2 -6.6000D-2 4.6170D-3 -9.1480D-3 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD02111.dat 0000664 0000000 0000000 00000002246 14560147231 0022312 0 ustar 00root root 0000000 0000000 8.701D-1 1.350D-1 1.159D-2 5.014D-4 -3.722D-2 3.484D-4 0.000D0 4.242D-3 7.249D-3 7.655D-2 8.974D-1 1.272D-2 5.504D-4 -4.016D-2 3.743D-4 0.000D0 4.530D-3 7.499D-3 -1.272D-1 3.575D-1 8.170D-1 1.455D-3 -1.028D-1 9.870D-4 0.000D0 1.185D-2 1.872D-2 -3.635D-1 6.339D-1 7.491D-2 7.966D-1 -2.735D-1 2.653D-3 0.000D0 3.172D-2 4.882D-2 -9.600D-1 1.6459D0 -1.289D-1 -5.597D-3 7.142D-2 7.108D-3 0.000D0 8.452D-2 1.259D-1 -6.644D-1 1.1296D-1 -8.889D-2 -3.854D-3 8.447D-2 1.360D-2 0.000D0 1.443D-1 1.016D-1 -4.102D-1 6.930D-1 -5.471D-2 -2.371D-3 6.649D-2 1.249D-2 1.063D-4 9.997D-2 6.967D-2 -1.799D-1 3.017D-1 -2.393D-2 -1.035D-3 6.059D-2 2.216D-2 0.000D0 2.139D-1 3.554D-2 -3.451D-1 5.804D-1 -4.596D-2 -1.989D-3 1.056D-1 1.986D-2 0.000D0 2.191D-1 2.152D-1 4.760D-4 -5.701D-5 -8.368D-3 8.790D-5 -4.773D-4 -2.730D-4 1.482D-4 -1.312D-3 8.876D-4 3.892D-4 -3.513D-3 2.480D-3 1.034D-3 -9.275D-3 6.680D-3 7.203D-4 -6.159D-3 3.834D-3 4.454D-4 -3.683D-3 2.029D-3 1.971D-4 -1.554D-3 6.937D-4 3.773D-4 -3.028D-3 1.469D-3 SLICOT-SLICOT-Reference-a037f7e/benchmark_data/BD02112.dat 0000664 0000000 0000000 00000000271 14560147231 0022307 0 ustar 00root root 0000000 0000000 0.000D+00 0.000D+00 0.000D+00 -2.230D-01 1.850D+00 -5.420D-01 2.830D+01 2.040D+02 6.870D+01 -5.210D+00 -8.430D-01 -2.850D-01 -1.010D-01 -6.750D+00 -2.460D-01 SLICOT-SLICOT-Reference-a037f7e/doc/ 0000775 0000000 0000000 00000000000 14560147231 0016564 5 ustar 00root root 0000000 0000000 SLICOT-SLICOT-Reference-a037f7e/doc/AB01MD.html 0000664 0000000 0000000 00000024307 14560147231 0020324 0 ustar 00root root 0000000 0000000
Purpose
To find a controllable realization for the linear time-invariant single-input system dX/dt = A * X + B * U, where A is an N-by-N matrix and B is an N element vector which are reduced by this routine to orthogonal canonical form using (and optionally accumulating) orthogonal similarity transformations.Specification
SUBROUTINE AB01MD( JOBZ, N, A, LDA, B, NCONT, Z, LDZ, TAU, TOL, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBZ INTEGER INFO, LDA, LDZ, LDWORK, N, NCONT DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(*), DWORK(*), TAU(*), Z(LDZ,*)Arguments
Mode Parameters
JOBZ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Z the orthogonal similarity transformations for reducing the system, as follows: = 'N': Do not form Z and do not store the orthogonal transformations; = 'F': Do not form Z, but store the orthogonal transformations in the factored form; = 'I': Z is initialized to the unit matrix and the orthogonal transformation matrix Z is returned.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading NCONT-by-NCONT upper Hessenberg part of this array contains the canonical form of the state dynamics matrix, given by Z' * A * Z, of a controllable realization for the original system. The elements below the first subdiagonal are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (N) On entry, the original input/state vector B. On exit, the leading NCONT elements of this array contain canonical form of the input/state vector, given by Z' * B, with all elements but B(1) set to zero. NCONT (output) INTEGER The order of the controllable state-space representation. Z (output) DOUBLE PRECISION array, dimension (LDZ,N) If JOBZ = 'I', then the leading N-by-N part of this array contains the matrix of accumulated orthogonal similarity transformations which reduces the given system to orthogonal canonical form. If JOBZ = 'F', the elements below the diagonal, with the array TAU, represent the orthogonal transformation matrix as a product of elementary reflectors. The transformation matrix can then be obtained by calling the LAPACK Library routine DORGQR. If JOBZ = 'N', the array Z is not referenced and can be supplied as a dummy array (i.e. set parameter LDZ = 1 and declare this array to be Z(1,1) in the calling program). LDZ INTEGER The leading dimension of array Z. If JOBZ = 'I' or JOBZ = 'F', LDZ >= MAX(1,N); if JOBZ = 'N', LDZ >= 1. TAU (output) DOUBLE PRECISION array, dimension (N) The elements of TAU contain the scalar factors of the elementary reflectors used in the reduction of B and A.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining the controllability of (A,B). If the user sets TOL > 0, then the given value of TOL is used as an absolute tolerance; elements with absolute value less than TOL are considered neglijible. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS*MAX( NORM(A), NORM(B) ) is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The Householder matrix which reduces all but the first element of vector B to zero is found and this orthogonal similarity transformation is applied to the matrix A. The resulting A is then reduced to upper Hessenberg form by a sequence of Householder transformations. Finally, the order of the controllable state- space representation (NCONT) is determined by finding the position of the first sub-diagonal element of A which is below an appropriate zero threshold, either TOL or TOLDEF (see parameter TOL); if NORM(B) is smaller than this threshold, NCONT is set to zero, and no computations for reducing the system to orthogonal canonical form are performed.References
[1] Konstantinov, M.M., Petkov, P.Hr. and Christov, N.D. Orthogonal Invariants and Canonical Forms for Linear Controllable Systems. Proc. 8th IFAC World Congress, Kyoto, 1, pp. 49-54, 1981. [2] Hammarling, S.J. Notes on the use of orthogonal similarity transformations in control. NPL Report DITC 8/82, August 1982. [3] Paige, C.C Properties of numerical algorithms related to computing controllability. IEEE Trans. Auto. Contr., AC-26, pp. 130-138, 1981.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
NoneExample
Program Text
* AB01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDZ PARAMETER ( LDA = NMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, N, NCONT CHARACTER*1 JOBZ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(NMAX), DWORK(LDWORK), TAU(NMAX), $ Z(LDZ,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL AB01MD, DORGQR * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, TOL, JOBZ IF ( N.LE.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 = * ) ( B(I), I = 1,N ) * Find a controllable realization for the given system. CALL AB01MD( JOBZ, N, A, LDA, B, NCONT, Z, LDZ, TAU, TOL, $ DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NCONT DO 20 I = 1, NCONT WRITE ( NOUT, FMT = 99994 ) ( A(I,J), J = 1,NCONT ) 20 CONTINUE WRITE ( NOUT, FMT = 99996 ) ( B(I), I = 1,NCONT ) IF ( LSAME( JOBZ, 'F' ) ) $ CALL DORGQR( N, N, N, Z, LDZ, TAU, DWORK, LDWORK, INFO ) IF ( LSAME( JOBZ, 'F' ).OR.LSAME( JOBZ, 'I' ) ) THEN WRITE ( NOUT, FMT = 99995 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( Z(I,J), J = 1,N ) 40 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' AB01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB01MD = ',I2) 99997 FORMAT (' The order of the controllable state-space representati', $ 'on = ',I2,//' The state dynamics matrix A of a controlla', $ 'ble realization is ') 99996 FORMAT (/' The input/state vector B of a controllable realizatio', $ 'n is ',/(1X,F8.4)) 99995 FORMAT (/' The similarity transformation matrix Z is ') 99994 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
AB01MD EXAMPLE PROGRAM DATA 3 0.0 I 1.0 2.0 0.0 4.0 -1.0 0.0 0.0 0.0 1.0 1.0 0.0 1.0Program Results
AB01MD EXAMPLE PROGRAM RESULTS The order of the controllable state-space representation = 3 The state dynamics matrix A of a controllable realization is 1.0000 1.4142 0.0000 2.8284 -1.0000 2.8284 0.0000 1.4142 1.0000 The input/state vector B of a controllable realization is -1.4142 0.0000 0.0000 The similarity transformation matrix Z is -0.7071 0.0000 -0.7071 0.0000 -1.0000 0.0000 -0.7071 0.0000 0.7071
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB01ND.html 0000664 0000000 0000000 00000032461 14560147231 0020325 0 ustar 00root root 0000000 0000000
Purpose
To find a controllable realization for the linear time-invariant multi-input system dX/dt = A * X + B * U, where A and B are N-by-N and N-by-M matrices, respectively, which are reduced by this routine to orthogonal canonical form using (and optionally accumulating) orthogonal similarity transformations. Specifically, the pair (A, B) is reduced to the pair (Ac, Bc), Ac = Z' * A * Z, Bc = Z' * B, given by [ Acont * ] [ Bcont ] Ac = [ ], Bc = [ ], [ 0 Auncont ] [ 0 ] and [ A11 A12 . . . A1,p-1 A1p ] [ B1 ] [ A21 A22 . . . A2,p-1 A2p ] [ 0 ] [ 0 A32 . . . A3,p-1 A3p ] [ 0 ] Acont = [ . . . . . . . ], Bc = [ . ], [ . . . . . . ] [ . ] [ . . . . . ] [ . ] [ 0 0 . . . Ap,p-1 App ] [ 0 ] where the blocks B1, A21, ..., Ap,p-1 have full row ranks and p is the controllability index of the pair. The size of the block Auncont is equal to the dimension of the uncontrollable subspace of the pair (A, B).Specification
SUBROUTINE AB01ND( JOBZ, N, M, A, LDA, B, LDB, NCONT, INDCON, $ NBLK, Z, LDZ, TAU, TOL, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER JOBZ INTEGER INDCON, INFO, LDA, LDB, LDWORK, LDZ, M, N, NCONT DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), TAU(*), Z(LDZ,*) INTEGER IWORK(*), NBLK(*)Arguments
Mode Parameters
JOBZ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Z the orthogonal similarity transformations for reducing the system, as follows: = 'N': Do not form Z and do not store the orthogonal transformations; = 'F': Do not form Z, but store the orthogonal transformations in the factored form; = 'I': Z is initialized to the unit matrix and the orthogonal transformation matrix Z is returned.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs, or of columns of B. M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading NCONT-by-NCONT part contains the upper block Hessenberg state dynamics matrix Acont in Ac, given by Z' * A * Z, of a controllable realization for the original system. The elements below the first block- subdiagonal are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading NCONT-by-M part of this array contains the transformed input matrix Bcont in Bc, given by Z' * B, with all elements but the first block set to zero. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). NCONT (output) INTEGER The order of the controllable state-space representation. INDCON (output) INTEGER The controllability index of the controllable part of the system representation. NBLK (output) INTEGER array, dimension (N) The leading INDCON elements of this array contain the the orders of the diagonal blocks of Acont. Z (output) DOUBLE PRECISION array, dimension (LDZ,N) If JOBZ = 'I', then the leading N-by-N part of this array contains the matrix of accumulated orthogonal similarity transformations which reduces the given system to orthogonal canonical form. If JOBZ = 'F', the elements below the diagonal, with the array TAU, represent the orthogonal transformation matrix as a product of elementary reflectors. The transformation matrix can then be obtained by calling the LAPACK Library routine DORGQR. If JOBZ = 'N', the array Z is not referenced and can be supplied as a dummy array (i.e. set parameter LDZ = 1 and declare this array to be Z(1,1) in the calling program). LDZ INTEGER The leading dimension of array Z. If JOBZ = 'I' or JOBZ = 'F', LDZ >= MAX(1,N); if JOBZ = 'N', LDZ >= 1. TAU (output) DOUBLE PRECISION array, dimension (N) The elements of TAU contain the scalar factors of the elementary reflectors used in the reduction of B and A.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determination when transforming (A, B). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N, 3*M). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Matrix B is first QR-decomposed and the appropriate orthogonal similarity transformation applied to the matrix A. Leaving the first rank(B) states unchanged, the remaining lower left block of A is then QR-decomposed and the new orthogonal matrix, Q1, is also applied to the right of A to complete the similarity transformation. By continuing in this manner, a completely controllable state-space pair (Acont, Bcont) is found for the given (A, B), where Acont is upper block Hessenberg with each subdiagonal block of full row rank, and Bcont is zero apart from its (independent) first rank(B) rows. NOTE that the system controllability indices are easily calculated from the dimensions of the blocks of Acont.References
[1] Konstantinov, M.M., Petkov, P.Hr. and Christov, N.D. Orthogonal Invariants and Canonical Forms for Linear Controllable Systems. Proc. 8th IFAC World Congress, Kyoto, 1, pp. 49-54, 1981. [2] Paige, C.C. Properties of numerical algorithms related to computing controllablity. IEEE Trans. Auto. Contr., AC-26, pp. 130-138, 1981. [3] Petkov, P.Hr., Konstantinov, M.M., Gu, D.W. and Postlethwaite, I. Optimal Pole Assignment Design of Linear Multi-Input Systems. Leicester University, Report 99-11, May 1996.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
If the system matrices A and B are badly scaled, it would be useful to scale them with SLICOT routine TB01ID, before calling the routine.Example
Program Text
* AB01ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDZ = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX, 3*MMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, INDCON, J, M, N, NCONT CHARACTER*1 JOBZ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), DWORK(LDWORK), $ TAU(NMAX), Z(LDZ,NMAX) INTEGER IWORK(LIWORK), NBLK(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL AB01ND, DORGQR * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, TOL, JOBZ 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 ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) * Find a controllable ssr for the given system. CALL AB01ND( JOBZ, N, M, A, LDA, B, LDB, NCONT, INDCON, $ NBLK, Z, LDZ, TAU, TOL, IWORK, DWORK, LDWORK, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NCONT WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NCONT WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NCONT ) 20 CONTINUE WRITE ( NOUT, FMT = 99994 ) ( NBLK(I), I = 1,INDCON ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NCONT WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) INDCON IF ( LSAME( JOBZ, 'F' ) ) $ CALL DORGQR( N, N, N, Z, LDZ, TAU, DWORK, LDWORK, $ INFO ) IF ( LSAME( JOBZ, 'F' ).OR.LSAME( JOBZ, 'I' ) ) THEN WRITE ( NOUT, FMT = 99991 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB01ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB01ND = ',I2) 99997 FORMAT (' The order of the controllable state-space representati', $ 'on = ',I2) 99996 FORMAT (/' The transformed state dynamics matrix of a controllab', $ 'le realization is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' and the dimensions of its diagonal blocks are ', $ /20(1X,I2)) 99993 FORMAT (/' The transformed input/state matrix B of a controllabl', $ 'e realization is ') 99992 FORMAT (/' The controllability index of the transformed system r', $ 'epresentation = ',I2) 99991 FORMAT (/' The similarity transformation matrix Z is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
AB01ND EXAMPLE PROGRAM DATA 3 2 0.0 I -1.0 0.0 0.0 -2.0 -2.0 -2.0 -1.0 0.0 -3.0 1.0 0.0 0.0 0.0 2.0 1.0Program Results
AB01ND EXAMPLE PROGRAM RESULTS The order of the controllable state-space representation = 2 The transformed state dynamics matrix of a controllable realization is -3.0000 2.2361 0.0000 -1.0000 and the dimensions of its diagonal blocks are 2 The transformed input/state matrix B of a controllable realization is 0.0000 -2.2361 1.0000 0.0000 The controllability index of the transformed system representation = 1 The similarity transformation matrix Z is 0.0000 1.0000 0.0000 -0.8944 0.0000 -0.4472 -0.4472 0.0000 0.8944
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB01OD.html 0000664 0000000 0000000 00000036361 14560147231 0020331 0 ustar 00root root 0000000 0000000
Purpose
To reduce the matrices A and B using (and optionally accumulating) state-space and input-space transformations U and V respectively, such that the pair of matrices Ac = U' * A * U, Bc = U' * B * V are in upper "staircase" form. Specifically, [ Acont * ] [ Bcont ] Ac = [ ], Bc = [ ], [ 0 Auncont ] [ 0 ] and [ A11 A12 . . . A1,p-1 A1p ] [ B1 ] [ A21 A22 . . . A2,p-1 A2p ] [ 0 ] [ 0 A32 . . . A3,p-1 A3p ] [ 0 ] Acont = [ . . . . . . . ], Bc = [ . ], [ . . . . . . ] [ . ] [ . . . . . ] [ . ] [ 0 0 . . . Ap,p-1 App ] [ 0 ] where the blocks B1, A21, ..., Ap,p-1 have full row ranks and p is the controllability index of the pair. The size of the block Auncont is equal to the dimension of the uncontrollable subspace of the pair (A, B). The first stage of the reduction, the "forward" stage, accomplishes the reduction to the orthogonal canonical form (see SLICOT library routine AB01ND). The blocks B1, A21, ..., Ap,p-1 are further reduced in a second, "backward" stage to upper triangular form using RQ factorization. Each of these stages is optional.Specification
SUBROUTINE AB01OD( STAGES, JOBU, JOBV, N, M, A, LDA, B, LDB, U, $ LDU, V, LDV, NCONT, INDCON, KSTAIR, TOL, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBU, JOBV, STAGES INTEGER INDCON, INFO, LDA, LDB, LDU, LDV, LDWORK, M, N, $ NCONT DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*), KSTAIR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), U(LDU,*), V(LDV,*)Arguments
Mode Parameters
STAGES CHARACTER*1 Specifies the reduction stages to be performed as follows: = 'F': Perform the forward stage only; = 'B': Perform the backward stage only; = 'A': Perform both (all) stages. JOBU CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix U the state-space transformations as follows: = 'N': Do not form U; = 'I': U is internally initialized to the unit matrix (if STAGES <> 'B'), or updated (if STAGES = 'B'), and the orthogonal transformation matrix U is returned. JOBV CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix V the input-space transformations as follows: = 'N': Do not form V; = 'I': V is initialized to the unit matrix and the orthogonal transformation matrix V is returned. JOBV is not referenced if STAGES = 'F'.Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The actual input dimension. M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state transition matrix A to be transformed. If STAGES = 'B', A should be in the orthogonal canonical form, as returned by SLICOT library routine AB01ND. On exit, the leading N-by-N part of this array contains the transformed state transition matrix U' * A * U. The leading NCONT-by-NCONT part contains the upper block Hessenberg state matrix Acont in Ac, given by U' * A * U, of a controllable realization for the original system. The elements below the first block-subdiagonal are set to zero. If STAGES <> 'F', the subdiagonal blocks of A are triangularized by RQ factorization, and the annihilated elements are explicitly zeroed. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B to be transformed. If STAGES = 'B', B should be in the orthogonal canonical form, as returned by SLICOT library routine AB01ND. On exit with STAGES = 'F', the leading N-by-M part of this array contains the transformed input matrix U' * B, with all elements but the first block set to zero. On exit with STAGES <> 'F', the leading N-by-M part of this array contains the transformed input matrix U' * B * V, with all elements but the first block set to zero and the first block in upper triangular form. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). U (input/output) DOUBLE PRECISION array, dimension (LDU,N) If STAGES <> 'B' or JOBU = 'N', then U need not be set on entry. If STAGES = 'B' and JOBU = 'I', then, on entry, the leading N-by-N part of this array must contain the transformation matrix U that reduced the pair to the orthogonal canonical form. On exit, if JOBU = 'I', the leading N-by-N part of this array contains the transformation matrix U that performed the specified reduction. If JOBU = 'N', the array U is not referenced and can be supplied as a dummy array (i.e. set parameter LDU = 1 and declare this array to be U(1,1) in the calling program). LDU INTEGER The leading dimension of array U. If JOBU = 'I', LDU >= MAX(1,N); if JOBU = 'N', LDU >= 1. V (output) DOUBLE PRECISION array, dimension (LDV,M) If JOBV = 'I', then the leading M-by-M part of this array contains the transformation matrix V. If STAGES = 'F', or JOBV = 'N', the array V is not referenced and can be supplied as a dummy array (i.e. set parameter LDV = 1 and declare this array to be V(1,1) in the calling program). LDV INTEGER The leading dimension of array V. If STAGES <> 'F' and JOBV = 'I', LDV >= MAX(1,M); if STAGES = 'F' or JOBV = 'N', LDV >= 1. NCONT (input/output) INTEGER The order of the controllable state-space representation. NCONT is input only if STAGES = 'B'. INDCON (input/output) INTEGER The number of stairs in the staircase form (also, the controllability index of the controllable part of the system representation). INDCON is input only if STAGES = 'B'. KSTAIR (input/output) INTEGER array, dimension (N) The leading INDCON elements of this array contain the dimensions of the stairs, or, also, the orders of the diagonal blocks of Acont. KSTAIR is input if STAGES = 'B', and output otherwise.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determination when transforming (A, B). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL is not referenced if STAGES = 'B'.Workspace
IWORK INTEGER array, dimension (M) IWORK is not referenced if STAGES = 'B'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. If STAGES <> 'B', LDWORK >= MAX(1, N + MAX(N,3*M)); If STAGES = 'B', LDWORK >= MAX(1, M + MAX(N,M)). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Staircase reduction of the pencil [B|sI - A] is used. Orthogonal transformations U and V are constructed such that |B |sI-A * . . . * * | | 1| 11 . . . | | | A sI-A . . . | | | 21 22 . . . | | | . . * * | [U'BV|sI - U'AU] = |0 | 0 . . | | | A sI-A * | | | p,p-1 pp | | | | |0 | 0 0 sI-A | | | p+1,p+1| where the i-th diagonal block of U'AU has dimension KSTAIR(i), for i = 1,...,p. The value of p is returned in INDCON. The last block contains the uncontrollable modes of the (A,B)-pair which are also the generalized eigenvalues of the above pencil. The complete reduction is performed in two stages. The first, forward stage accomplishes the reduction to the orthogonal canonical form. The second, backward stage consists in further reduction to triangular form by applying left and right orthogonal transformations.References
[1] Van Dooren, P. The generalized eigenvalue problem in linear system theory. IEEE Trans. Auto. Contr., AC-26, pp. 111-129, 1981. [2] Miminis, G. and Paige, C. An algorithm for pole assignment of time-invariant multi-input linear systems. Proc. 21st IEEE CDC, Orlando, Florida, 1, pp. 62-67, 1982.Numerical Aspects
The algorithm requires O((N + M) x N**2) operations and is backward stable (see [1]).Further Comments
If the system matrices A and B are badly scaled, it would be useful to scale them with SLICOT routine TB01ID, before calling the routine.Example
Program Text
* AB01OD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDU, LDV PARAMETER ( LDA = NMAX, LDB = NMAX, LDU = NMAX, $ LDV = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX + MAX( NMAX, 3*MMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INDCON, INFO, J, M, N, NCONT CHARACTER*1 JOBU, JOBV, STAGES * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), DWORK(LDWORK), $ U(LDU,NMAX), V(LDV,MMAX) INTEGER IWORK(LIWORK), KSTAIR(NMAX) * .. External Subroutines .. EXTERNAL AB01OD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, TOL, STAGES, JOBU, JOBV IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), I = 1,N ), J = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) * Reduce the matrices A and B to upper "staircase" form. CALL AB01OD( STAGES, JOBU, JOBV, N, M, A, LDA, B, LDB, U, $ LDU, V, LDV, NCONT, INDCON, KSTAIR, TOL, IWORK, $ 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 = 99995 ) ( A(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) INDCON WRITE ( NOUT, FMT = 99993 ) ( KSTAIR(I), I = 1,INDCON ) END IF END IF END IF STOP * 99999 FORMAT (' AB01OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB01OD = ',I2) 99997 FORMAT (' The transformed state transition matrix is ') 99996 FORMAT (/' The transformed input matrix is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' The number of stairs in the staircase form = ',I3,/) 99993 FORMAT (' The dimensions of the stairs are ',/(20(I3,2X))) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
AB01OD EXAMPLE PROGRAM DATA 5 2 0.0 F N N 17.0 24.0 1.0 8.0 15.0 23.0 5.0 7.0 14.0 16.0 4.0 6.0 13.0 20.0 22.0 10.0 12.0 19.0 21.0 3.0 11.0 18.0 25.0 2.0 9.0 -1.0 -4.0 4.0 9.0 -9.0 -16.0 16.0 25.0 -25.0 -36.0Program Results
AB01OD EXAMPLE PROGRAM RESULTS The transformed state transition matrix is 12.8848 3.2345 11.8211 3.3758 -0.8982 4.4741 -12.5544 5.3509 5.9403 1.4360 14.4576 7.6855 23.1452 26.3872 -29.9557 0.0000 1.4805 27.4668 22.6564 -0.0072 0.0000 0.0000 -30.4822 0.6745 18.8680 The transformed input matrix is 31.1199 47.6865 3.2480 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The number of stairs in the staircase form = 3 The dimensions of the stairs are 2 2 1
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB04MD.html 0000664 0000000 0000000 00000024404 14560147231 0020325 0 ustar 00root root 0000000 0000000
Purpose
To perform a transformation on the parameters (A,B,C,D) of a system, which is equivalent to a bilinear transformation of the corresponding transfer function matrix.Specification
SUBROUTINE AB04MD( TYPE, N, M, P, ALPHA, BETA, A, LDA, B, LDB, C, $ LDC, D, LDD, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TYPE INTEGER INFO, LDA, LDB, LDC, LDD, LDWORK, M, N, P DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), DWORK(*)Arguments
Mode Parameters
TYPE CHARACTER*1 Indicates the type of the original system and the transformation to be performed as follows: = 'D': discrete-time -> continuous-time; = 'C': continuous-time -> discrete-time.Input/Output Parameters
N (input) INTEGER The order of the state matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. ALPHA, (input) DOUBLE PRECISION BETA Parameters specifying the bilinear transformation. Recommended values for stable systems: ALPHA = 1, BETA = 1. ALPHA <> 0, BETA <> 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state matrix A of the original system. On exit, the leading N-by-N part of this array contains _ the state matrix A of the transformed system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B of the original system. On exit, the leading N-by-M part of this array contains _ the input matrix B of the transformed system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C of the original system. On exit, the leading P-by-N part of this array contains _ the output matrix C of the transformed system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the input/output matrix D for the original system. On exit, the leading P-by-M part of this array contains _ the input/output matrix D of the transformed system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P).Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N). For optimum performance LDWORK >= MAX(1,N*NB), where NB is the optimal blocksize.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix (ALPHA*I + A) is exactly singular; = 2: if the matrix (BETA*I - A) is exactly singular.Method
The parameters of the discrete-time system are transformed into the parameters of the continuous-time system (TYPE = 'D'), or vice-versa (TYPE = 'C') by the transformation: 1. Discrete -> continuous _ -1 A = beta*(alpha*I + A) * (A - alpha*I) _ -1 B = sqrt(2*alpha*beta) * (alpha*I + A) * B _ -1 C = sqrt(2*alpha*beta) * C * (alpha*I + A) _ -1 D = D - C * (alpha*I + A) * B which is equivalent to the bilinear transformation z - alpha z -> s = beta --------- . z + alpha of one transfer matrix onto the other. 2. Continuous -> discrete _ -1 A = alpha*(beta*I - A) * (beta*I + A) _ -1 B = sqrt(2*alpha*beta) * (beta*I - A) * B _ -1 C = sqrt(2*alpha*beta) * C * (beta*I - A) _ -1 D = D + C * (beta*I - A) * B which is equivalent to the bilinear transformation beta + s s -> z = alpha -------- . beta - s of one transfer matrix onto the other.References
[1] Al-Saggaf, U.M. and Franklin, G.F. Model reduction via balanced realizations: a extension and frequency weighting techniques. IEEE Trans. Autom. Contr., AC-33, pp. 687-692, 1988.Numerical Aspects
3 The time taken is approximately proportional to N . The accuracy depends mainly on the condition number of the matrix to be inverted.Further Comments
NoneExample
Program Text
* AB04MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, BETA INTEGER I, INFO, J, M, N, P CHARACTER*1 TYPE * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK) INTEGER IWORK(NMAX) * .. External Subroutines .. EXTERNAL AB04MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TYPE, ALPHA, BETA IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), I = 1,N ), J = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99991 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), I = 1,P ), J = 1,N ) READ ( NIN, FMT = * ) ( ( D(I,J), I = 1,P ), J = 1,M ) * Transform the parameters (A,B,C,D). CALL AB04MD( TYPE, N, M, P, ALPHA, BETA, A, LDA, B, LDB, $ C, LDC, D, LDD, IWORK, 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,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( D(I,J), J = 1,M ) 80 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB04MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB04MD = ',I2) 99997 FORMAT (' The transformed state matrix is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The transformed input matrix is ') 99994 FORMAT (/' The transformed output matrix is ') 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' P is out of range.',/' P = ',I5) 99990 FORMAT (/' The transformed input/output matrix is ') ENDProgram Data
AB04MD EXAMPLE PROGRAM DATA 2 2 2 C 1.0D0 1.0D0 1.0 0.5 0.5 1.0 0.0 -1.0 1.0 0.0 -1.0 0.0 0.0 1.0 1.0 0.0 0.0 -1.0Program Results
AB04MD EXAMPLE PROGRAM RESULTS The transformed state matrix is -1.0000 -4.0000 -4.0000 -1.0000 The transformed input matrix is 2.8284 0.0000 0.0000 -2.8284 The transformed output matrix is 0.0000 2.8284 -2.8284 0.0000 The transformed input/output matrix is -1.0000 0.0000 0.0000 -3.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB05MD.html 0000664 0000000 0000000 00000037470 14560147231 0020335 0 ustar 00root root 0000000 0000000
Purpose
To obtain the state-space model (A,B,C,D) for the cascaded inter-connection of two systems, each given in state-space form.Specification
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(*)Arguments
Mode Parameters
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.Input/Output Parameters
N1 (input) INTEGER The number of state variables in the first system, i.e. the order of the matrix A1. N1 >= 0. M1 (input) INTEGER The number of input variables for the first system. M1 >= 0. P1 (input) INTEGER The number of output variables from the first system and the number of input variables for the second system. P1 >= 0. N2 (input) INTEGER The number of state variables in the second system, i.e. the order of the matrix A2. N2 >= 0. P2 (input) INTEGER The number of output variables from the second system. P2 >= 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 >= 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 >= 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 >= MAX(1,P1) if N1 > 0. LDC1 >= 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 >= 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 >= 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 >= 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 >= MAX(1,P2) if N2 > 0. LDC2 >= 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 >= 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 >= 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 >= 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 >= MAX(1,P2) if N1+N2 > 0. LDC >= 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 >= MAX(1,P2).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) The array DWORK is not referenced if OVER = 'N'. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, P1*MAX(N1, M1, N2, P2) ) if OVER = 'O'. LDWORK >= 1 if OVER = 'N'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
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.References
NoneNumerical Aspects
The algorithm requires P1*(N1+M1)*(N2+P2) operations.Further Comments
NoneExample
Program Text
* 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) ENDProgram Data
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.0Program Results
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
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB05ND.html 0000664 0000000 0000000 00000036422 14560147231 0020332 0 ustar 00root root 0000000 0000000
Purpose
To obtain the state-space model (A,B,C,D) for the feedback inter-connection of two systems, each given in state-space form.Specification
SUBROUTINE AB05ND( OVER, N1, M1, P1, N2, ALPHA, 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, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER OVER INTEGER INFO, LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, $ LDC1, LDC2, LDD, LDD1, LDD2, LDWORK, M1, N, N1, $ N2, P1 DOUBLE PRECISION ALPHA C .. Array Arguments .. INTEGER IWORK(*) 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(*)Arguments
Mode Parameters
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, 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 will give maximum efficiency.Input/Output Parameters
N1 (input) INTEGER The number of state variables in the first system, i.e. the order of the matrix A1. N1 >= 0. M1 (input) INTEGER The number of input variables for the first system and the number of output variables from the second system. M1 >= 0. P1 (input) INTEGER The number of output variables from the first system and the number of input variables for the second system. P1 >= 0. N2 (input) INTEGER The number of state variables in the second system, i.e. the order of the matrix A2. N2 >= 0. ALPHA (input) DOUBLE PRECISION A coefficient multiplying the transfer-function matrix (or the output equation) of the second system. ALPHA = +1 corresponds to positive feedback, and ALPHA = -1 corresponds to negative feedback. 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 >= 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 >= 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 >= MAX(1,P1) if N1 > 0. LDC1 >= 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 >= 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 >= 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 >= MAX(1,N2). C2 (input) DOUBLE PRECISION array, dimension (LDC2,N2) The leading M1-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 >= MAX(1,M1) if N2 > 0. LDC2 >= 1 if N2 = 0. D2 (input) DOUBLE PRECISION array, dimension (LDD2,P1) The leading M1-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 >= MAX(1,M1). N (output) INTEGER The number of state variables (N1 + N2) in the connected 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 connected system. The array A can overlap A1 if OVER = 'O'. LDA INTEGER The leading dimension of array A. LDA >= 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 connected system. The array B can overlap B1 if OVER = 'O'. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N1+N2). C (output) DOUBLE PRECISION array, dimension (LDC,N1+N2) The leading P1-by-N part of this array contains the state/output matrix C for the connected system. The array C can overlap C1 if OVER = 'O'. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P1) if N1+N2 > 0. LDC >= 1 if N1+N2 = 0. D (output) DOUBLE PRECISION array, dimension (LDD,M1) The leading P1-by-M1 part of this array contains the input/output matrix D for the connected system. The array D can overlap D1 if OVER = 'O'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P1).Workspace
IWORK INTEGER array, dimension (P1) DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. If OVER = 'N', LDWORK >= MAX(1, P1*P1, M1*M1, N1*P1), and if OVER = 'O', LDWORK >= MAX(1, N1*P1 + MAX( P1*P1, M1*M1, N1*P1) ), if M1 <= N*N2; LDWORK >= MAX(1, N1*P1 + MAX( P1*P1, M1*(M1+1), N1*P1) ), if M1 > N*N2.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value. > 0: if INFO = i, 1 <= i <= P1, the system is not completely controllable. That is, the matrix (I + ALPHA*D1*D2) is exactly singular (the element U(i,i) of the upper triangular factor of LU factorization is exactly zero), possibly due to rounding errors.Method
After feedback inter-connection of the two systems, X1' = A1*X1 + B1*U1 Y1 = C1*X1 + D1*U1 X2' = A2*X2 + B2*U2 Y2 = C2*X2 + D2*U2 (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 U = U1 + alpha*Y2, X = ( X1 ), Y = Y1 = U2, ( X2 ) matrix A has the form ( A1 - alpha*B1*E12*D2*C1 - alpha*B1*E12*C2 ), ( B2*E21*C1 A2 - alpha*B2*E21*D1*C2 ) matrix B has the form ( B1*E12 ), ( B2*E21*D1 ) matrix C has the form ( E21*C1 - alpha*E21*D1*C2 ), matrix D has the form ( E21*D1 ), E21 = ( I + alpha*D1*D2 )-INVERSE and E12 = ( I + alpha*D2*D1 )-INVERSE = I - alpha*D2*E21*D1. Taking N1 = 0 and/or N2 = 0 on the routine call will solve the constant plant and/or constant feedback cases.References
NoneNumerical Aspects
NoneFurther Comments
NoneExample
Program Text
* AB05ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER N1MAX, N2MAX, NMAX, M1MAX, P1MAX PARAMETER ( N1MAX = 20, N2MAX = 20, NMAX = N1MAX+N2MAX, $ M1MAX = 20, P1MAX = 20 ) INTEGER LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, LDC1, $ LDC2, LDD, LDD1, LDD2 PARAMETER ( LDA = NMAX, LDA1 = N1MAX, LDA2 = N2MAX, $ LDB = NMAX, LDB1 = N1MAX, LDB2 = N2MAX, $ LDC = P1MAX, LDC1 = P1MAX, LDC2 = M1MAX, $ LDD = P1MAX, LDD1 = P1MAX, LDD2 = M1MAX ) INTEGER LDWORK PARAMETER ( LDWORK = P1MAX*P1MAX ) DOUBLE PRECISION ONE PARAMETER ( ONE=1.0D0 ) * .. Local Scalars .. CHARACTER*1 OVER INTEGER I, INFO, J, M1, N, N1, N2, P1 DOUBLE PRECISION ALPHA * .. Local Arrays .. INTEGER IWORK(P1MAX) 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 AB05ND * .. Executable Statements .. * OVER = 'N' ALPHA = ONE 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 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 ) READ ( NIN, FMT = * ) $ ( ( C2(I,J), J = 1,N2 ), I = 1,M1 ) READ ( NIN, FMT = * ) $ ( ( D2(I,J), J = 1,P1 ), I = 1,M1 ) * Find the state-space model (A,B,C,D). CALL AB05ND( OVER, N1, M1, P1, N2, ALPHA, 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, IWORK, 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, P1 WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 80 I = 1, P1 WRITE ( NOUT, FMT = 99996 ) ( D(I,J), J = 1,M1 ) 80 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' AB05ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB05ND = ',I2) 99997 FORMAT (' The state transition matrix of the connected system is') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The input/state matrix of the connected system is ') 99994 FORMAT (/' The state/output matrix of the connected system is ') 99993 FORMAT (/' The input/output matrix of the connected 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) ENDProgram Data
AB05ND EXAMPLE PROGRAM DATA 3 2 2 3 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.0Program Results
AB05ND EXAMPLE PROGRAM RESULTS The state transition matrix of the connected system is -0.5000 -0.2500 -1.5000 -1.2500 -1.2500 0.7500 -1.5000 -0.2500 0.5000 -0.2500 -0.2500 -0.2500 1.0000 0.5000 2.0000 -0.5000 -0.5000 0.5000 0.0000 0.5000 0.0000 -3.5000 -0.5000 0.5000 -1.5000 1.2500 -0.5000 1.2500 0.2500 1.2500 0.0000 1.0000 0.0000 -1.0000 -2.0000 3.0000 The input/state matrix of the connected system is 0.5000 0.7500 0.5000 -0.2500 0.0000 0.5000 0.0000 0.5000 -0.5000 0.2500 0.0000 1.0000 The state/output matrix of the connected system is 1.5000 -1.2500 0.5000 -0.2500 -0.2500 -0.2500 0.0000 0.5000 0.0000 -0.5000 -0.5000 0.5000 The input/output matrix of the connected system is 0.5000 -0.2500 0.0000 0.5000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB05OD.html 0000664 0000000 0000000 00000035177 14560147231 0020341 0 ustar 00root root 0000000 0000000
Purpose
To obtain the state-space model (A,B,C,D) for rowwise concatenation (parallel inter-connection on outputs, with separate inputs) of two systems, each given in state-space form.Specification
SUBROUTINE AB05OD( OVER, N1, M1, P1, N2, M2, ALPHA, A1, LDA1, B1, $ LDB1, C1, LDC1, D1, LDD1, A2, LDA2, B2, LDB2, $ C2, LDC2, D2, LDD2, N, M, A, LDA, B, LDB, C, $ LDC, D, LDD, INFO ) C .. Scalar Arguments .. CHARACTER OVER INTEGER INFO, LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, $ LDC1, LDC2, LDD, LDD1, LDD2, M, M1, M2, N, N1, $ N2, P1 DOUBLE PRECISION ALPHA 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,*)Arguments
Mode Parameters
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, 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 will give maximum efficiency.Input/Output Parameters
N1 (input) INTEGER The number of state variables in the first system, i.e. the order of the matrix A1. N1 >= 0. M1 (input) INTEGER The number of input variables for the first system. M1 >= 0. P1 (input) INTEGER The number of output variables from each system. P1 >= 0. N2 (input) INTEGER The number of state variables in the second system, i.e. the order of the matrix A2. N2 >= 0. M2 (input) INTEGER The number of input variables for the second system. M2 >= 0. ALPHA (input) DOUBLE PRECISION A coefficient multiplying the transfer-function matrix (or the output equation) of the second system. 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 >= 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 >= 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 >= MAX(1,P1) if N1 > 0. LDC1 >= 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 >= 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 >= MAX(1,N2). B2 (input) DOUBLE PRECISION array, dimension (LDB2,M2) The leading N2-by-M2 part of this array must contain the input/state matrix B2 for the second system. LDB2 INTEGER The leading dimension of array B2. LDB2 >= MAX(1,N2). C2 (input) DOUBLE PRECISION array, dimension (LDC2,N2) The leading P1-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 >= MAX(1,P1) if N2 > 0. LDC2 >= 1 if N2 = 0. D2 (input) DOUBLE PRECISION array, dimension (LDD2,M2) The leading P1-by-M2 part of this array must contain the input/output matrix D2 for the second system. LDD2 INTEGER The leading dimension of array D2. LDD2 >= MAX(1,P1). N (output) INTEGER The number of state variables (N1 + N2) in the connected system, i.e. the order of the matrix A, the number of rows of B and the number of columns of C. M (output) INTEGER The number of input variables (M1 + M2) for the connected system, i.e. the number of columns of B and D. 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 connected system. The array A can overlap A1 if OVER = 'O'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N1+N2). B (output) DOUBLE PRECISION array, dimension (LDB,M1+M2) The leading N-by-M part of this array contains the input/state matrix B for the connected system. The array B can overlap B1 if OVER = 'O'. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N1+N2). C (output) DOUBLE PRECISION array, dimension (LDC,N1+N2) The leading P1-by-N part of this array contains the state/output matrix C for the connected system. The array C can overlap C1 if OVER = 'O'. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P1) if N1+N2 > 0. LDC >= 1 if N1+N2 = 0. D (output) DOUBLE PRECISION array, dimension (LDD,M1+M2) The leading P1-by-M part of this array contains the input/output matrix D for the connected system. The array D can overlap D1 if OVER = 'O'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P1).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
After rowwise concatenation (parallel inter-connection with separate inputs) of the two systems, X1' = A1*X1 + B1*U Y1 = C1*X1 + D1*U X2' = A2*X2 + B2*V Y2 = C2*X2 + D2*V (where ' denotes differentiation with respect to time), with the output equation for the second system multiplied by a scalar alpha, the following state-space model will be obtained: X' = A*X + B*(U) (V) Y = C*X + D*(U) (V) where matrix A has the form ( A1 0 ), ( 0 A2 ) matrix B has the form ( B1 0 ), ( 0 B2 ) matrix C has the form ( C1 alpha*C2 ) and matrix D has the form ( D1 alpha*D2 ).References
NoneNumerical Aspects
NoneFurther Comments
NoneExample
Program Text
* AB05OD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER N1MAX, N2MAX, NMAX, M1MAX, M2MAX, MMAX, P1MAX PARAMETER ( N1MAX = 20, N2MAX = 20, NMAX = N1MAX+N2MAX, $ M1MAX = 20, M2MAX = 20, MMAX = M1MAX+M2MAX, $ P1MAX = 20 ) INTEGER LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, LDC1, $ LDC2, LDD, LDD1, LDD2 PARAMETER ( LDA = NMAX, LDA1 = N1MAX, LDA2 = N2MAX, $ LDB = NMAX, LDB1 = N1MAX, LDB2 = N2MAX, $ LDC = P1MAX, LDC1 = P1MAX, LDC2 = P1MAX, $ LDD = P1MAX, LDD1 = P1MAX, LDD2 = P1MAX ) DOUBLE PRECISION ONE PARAMETER ( ONE=1.0D0 ) * .. Local Scalars .. CHARACTER*1 OVER INTEGER I, INFO, J, M, M1, M2, N, N1, N2, P1 DOUBLE PRECISION ALPHA * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), A1(LDA1,N1MAX), A2(LDA2,N2MAX), $ B(LDB,MMAX), B1(LDB1,M1MAX), B2(LDB2,M2MAX), $ C(LDC,NMAX), C1(LDC1,N1MAX), C2(LDC2,N2MAX), $ D(LDD,MMAX), D1(LDD1,M1MAX), D2(LDD2,M2MAX) * .. External Subroutines .. EXTERNAL AB05OD * .. Executable Statements .. * OVER = 'N' ALPHA = ONE 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, M2 IF ( N1.LE.0 .OR. N1.GT.N1MAX ) THEN WRITE ( NOUT, FMT = 99993 ) 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 = 99992 ) 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 = 99991 ) 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 = 99990 ) N2 ELSE READ ( NIN, FMT = * ) $ ( ( A2(I,J), J = 1,N2 ), I = 1,N2 ) IF ( M2.LE.0 .OR. M2.GT.M2MAX ) THEN WRITE ( NOUT, FMT = 99989 ) M2 ELSE READ ( NIN, FMT = * ) $ ( ( B2(I,J), I = 1,N2 ), J = 1,M2 ) READ ( NIN, FMT = * ) $ ( ( C2(I,J), J = 1,N2 ), I = 1,P1 ) READ ( NIN, FMT = * ) $ ( ( D2(I,J), J = 1,M2 ), I = 1,P1 ) * Find the state-space model (A,B,C,D). CALL AB05OD( OVER, N1, M1, P1, N2, M2, ALPHA, A1, $ LDA1, B1, LDB1, C1, LDC1, D1, LDD1, $ A2, LDA2, B2, LDB2, C2, LDC2, D2, $ LDD2, N, M, A, LDA, B, LDB, C, LDC, $ D, LDD, 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,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, P1 WRITE ( NOUT, FMT = 99996 ) $ ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 80 I = 1, P1 WRITE ( NOUT, FMT = 99996 ) $ ( D(I,J), J = 1,M ) 80 CONTINUE END IF END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' AB05OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB05OD = ',I2) 99997 FORMAT (' The state transition matrix of the connected system is') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The input/state matrix of the connected system is ') 99994 FORMAT (/' The state/output matrix of the connected system is ') 99993 FORMAT (/' The input/output matrix of the connected 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) ENDProgram Data
AB05OD 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.0Program Results
AB05OD EXAMPLE PROGRAM RESULTS The state transition matrix of the connected 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 0.0000 0.0000 -3.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 -1.0000 2.0000 The input/state matrix of the connected system is 1.0000 2.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 0.0000 2.0000 The state/output matrix of the connected system is 3.0000 -2.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 connected system is 1.0000 0.0000 1.0000 1.0000 0.0000 1.0000 0.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB05PD.html 0000664 0000000 0000000 00000032545 14560147231 0020336 0 ustar 00root root 0000000 0000000
Purpose
To compute the state-space model G = (A,B,C,D) corresponding to the sum G = G1 + alpha*G2, where G1 = (A1,B1,C1,D1) and G2 = (A2,B2,C2,D2). G, G1, and G2 are the transfer-function matrices of the corresponding state-space models.Specification
SUBROUTINE AB05PD( OVER, N1, M, P, N2, ALPHA, 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, INFO) C .. Scalar Arguments .. CHARACTER OVER INTEGER INFO, LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, $ LDC1, LDC2, LDD, LDD1, LDD2, M, N, N1, N2, P DOUBLE PRECISION ALPHA 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,*)Arguments
Mode Parameters
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, 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 will give maximum efficiency.Input/Output Parameters
N1 (input) INTEGER The number of state variables in the first system, i.e. the order of the matrix A1, the number of rows of B1 and the number of columns of C1. N1 >= 0. M (input) INTEGER The number of input variables of the two systems, i.e. the number of columns of matrices B1, D1, B2 and D2. M >= 0. P (input) INTEGER The number of output variables of the two systems, i.e. the number of rows of matrices C1, D1, C2 and D2. P >= 0. N2 (input) INTEGER The number of state variables in the second system, i.e. the order of the matrix A2, the number of rows of B2 and the number of columns of C2. N2 >= 0. ALPHA (input) DOUBLE PRECISION The coefficient multiplying G2. 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 >= MAX(1,N1). B1 (input) DOUBLE PRECISION array, dimension (LDB1,M) The leading N1-by-M part of this array must contain the input/state matrix B1 for the first system. LDB1 INTEGER The leading dimension of array B1. LDB1 >= MAX(1,N1). C1 (input) DOUBLE PRECISION array, dimension (LDC1,N1) The leading P-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 >= MAX(1,P) if N1 > 0. LDC1 >= 1 if N1 = 0. D1 (input) DOUBLE PRECISION array, dimension (LDD1,M) The leading P-by-M part of this array must contain the input/output matrix D1 for the first system. LDD1 INTEGER The leading dimension of array D1. LDD1 >= MAX(1,P). 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 >= MAX(1,N2). B2 (input) DOUBLE PRECISION array, dimension (LDB2,M) The leading N2-by-M part of this array must contain the input/state matrix B2 for the second system. LDB2 INTEGER The leading dimension of array B2. LDB2 >= MAX(1,N2). C2 (input) DOUBLE PRECISION array, dimension (LDC2,N2) The leading P-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 >= MAX(1,P) if N2 > 0. LDC2 >= 1 if N2 = 0. D2 (input) DOUBLE PRECISION array, dimension (LDD2,M) The leading P-by-M part of this array must contain the input/output matrix D2 for the second system. LDD2 INTEGER The leading dimension of array D2. LDD2 >= MAX(1,P). 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 resulting system. The array A can overlap A1 if OVER = 'O'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N1+N2). B (output) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array contains the input/state matrix B for the resulting system. The array B can overlap B1 if OVER = 'O'. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N1+N2). C (output) DOUBLE PRECISION array, dimension (LDC,N1+N2) The leading P-by-N part of this array contains the state/output matrix C for the resulting system. The array C can overlap C1 if OVER = 'O'. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P) if N1+N2 > 0. LDC >= 1 if N1+N2 = 0. D (output) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array contains the input/output matrix D for the resulting system. The array D can overlap D1 if OVER = 'O'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrices of the resulting systems are determined as: ( A1 0 ) ( B1 ) A = ( ) , B = ( ) , ( 0 A2 ) ( B2 ) C = ( C1 alpha*C2 ) , D = D1 + alpha*D2 .References
NoneNumerical Aspects
NoneFurther Comments
NoneExample
Program Text
* AB05PD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER N1MAX, N2MAX, NMAX, MMAX, PMAX PARAMETER ( N1MAX = 20, N2MAX = 20, NMAX = N1MAX+N2MAX, $ MMAX = 20, PMAX = 20 ) INTEGER LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, LDC1, $ LDC2, LDD, LDD1, LDD2 PARAMETER ( LDA = NMAX, LDA1 = N1MAX, LDA2 = N2MAX, $ LDB = NMAX, LDB1 = N1MAX, LDB2 = N2MAX, $ LDC = PMAX, LDC1 = PMAX, LDC2 = PMAX, $ LDD = PMAX, LDD1 = PMAX, LDD2 = PMAX ) * .. Local Scalars .. CHARACTER*1 OVER INTEGER I, INFO, J, M, N, N1, N2, P DOUBLE PRECISION ALPHA * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), A1(LDA1,N1MAX), A2(LDA2,N2MAX), $ B(LDB,MMAX), B1(LDB1,MMAX), B2(LDB2,MMAX), $ C(LDC,NMAX), C1(LDC1,N1MAX), C2(LDC2,N2MAX), $ D(LDD,MMAX), D1(LDD1,MMAX), D2(LDD2,MMAX) * .. External Subroutines .. EXTERNAL AB05PD * .. Executable Statements .. * OVER = 'N' WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N1, M, P, N2, ALPHA 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 ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) M ELSE READ ( NIN, FMT = * ) ( ( B1(I,J), I = 1,N1 ), J = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99990 ) P ELSE READ ( NIN, FMT = * ) ( ( C1(I,J), J = 1,N1 ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D1(I,J), J = 1,M ), I = 1,P ) 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,M ) READ ( NIN, FMT = * ) $ ( ( C2(I,J), J = 1,N2 ), I = 1,P ) READ ( NIN, FMT = * ) $ ( ( D2(I,J), J = 1,M ), I = 1,P ) * Find the state-space model (A,B,C,D). CALL AB05PD( OVER, N1, M, P, N2, ALPHA, 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, 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,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99996 ) $ ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) $ ( D(I,J), J = 1,M ) 80 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' AB05PD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB05PD = ',I2) 99997 FORMAT (' The state transition matrix of the connected system is') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The input/state matrix of the connected system is ') 99994 FORMAT (/' The state/output matrix of the connected system is ') 99993 FORMAT (/' The input/output matrix of the connected system is ') 99992 FORMAT (/' N1 is out of range.',/' N1 = ',I5) 99991 FORMAT (/' M is out of range.',/' M = ',I5) 99990 FORMAT (/' P is out of range.',/' P = ',I5) 99989 FORMAT (/' N2 is out of range.',/' N2 = ',I5) ENDProgram Data
AB05PD EXAMPLE PROGRAM DATA 3 2 2 3 1.0D0 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.0Program Results
AB05PD EXAMPLE PROGRAM RESULTS The state transition matrix of the connected 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 0.0000 0.0000 -3.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 -1.0000 2.0000 The input/state matrix of the connected 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 connected system is 3.0000 -2.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 connected system is 2.0000 1.0000 0.0000 2.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB05QD.html 0000664 0000000 0000000 00000036435 14560147231 0020341 0 ustar 00root root 0000000 0000000
Purpose
To append two systems G1 and G2 in state-space form together. If G1 = (A1,B1,C1,D1) and G2 = (A2,B2,C2,D2) are the state-space models of the given two systems having the transfer-function matrices G1 and G2, respectively, this subroutine constructs the state-space model G = (A,B,C,D) which corresponds to the transfer-function matrix ( G1 0 ) G = ( ) ( 0 G2 )Specification
SUBROUTINE AB05QD( OVER, N1, M1, P1, N2, M2, P2, A1, LDA1, B1, $ LDB1, C1, LDC1, D1, LDD1, A2, LDA2, B2, LDB2, $ C2, LDC2, D2, LDD2, N, M, P, A, LDA, B, LDB, $ C, LDC, D, LDD, INFO ) C .. Scalar Arguments .. CHARACTER OVER INTEGER INFO, LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, $ LDC1, LDC2, LDD, LDD1, LDD2, M, M1, M2, N, N1, $ N2, P, 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,*)Arguments
Mode Parameters
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, 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 will give maximum efficiency.Input/Output Parameters
N1 (input) INTEGER The number of state variables in the first system, i.e. the order of the matrix A1, the number of rows of B1 and the number of columns of C1. N1 >= 0. M1 (input) INTEGER The number of input variables in the first system, i.e. the number of columns of matrices B1 and D1. M1 >= 0. P1 (input) INTEGER The number of output variables in the first system, i.e. the number of rows of matrices C1 and D1. P1 >= 0. N2 (input) INTEGER The number of state variables in the second system, i.e. the order of the matrix A2, the number of rows of B2 and the number of columns of C2. N2 >= 0. M2 (input) INTEGER The number of input variables in the second system, i.e. the number of columns of matrices B2 and D2. M2 >= 0. P2 (input) INTEGER The number of output variables in the second system, i.e. the number of rows of matrices C2 and D2. P2 >= 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 >= 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 >= 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 >= MAX(1,P1) if N1 > 0. LDC1 >= 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 >= 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 >= MAX(1,N2). B2 (input) DOUBLE PRECISION array, dimension (LDB2,M2) The leading N2-by-M2 part of this array must contain the input/state matrix B2 for the second system. LDB2 INTEGER The leading dimension of array B2. LDB2 >= 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 >= MAX(1,P2) if N2 > 0. LDC2 >= 1 if N2 = 0. D2 (input) DOUBLE PRECISION array, dimension (LDD2,M2) The leading P2-by-M2 part of this array must contain the input/output matrix D2 for the second system. LDD2 INTEGER The leading dimension of array D2. LDD2 >= 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. M (output) INTEGER The number of input variables (M1 + M2) in the resulting system, i.e. the number of columns of B and D. P (output) INTEGER The number of output variables (P1 + P2) of the resulting system, i.e. the number of rows of C and D. 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 resulting system. The array A can overlap A1 if OVER = 'O'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N1+N2). B (output) DOUBLE PRECISION array, dimension (LDB,M1+M2) The leading N-by-M part of this array contains the input/state matrix B for the resulting system. The array B can overlap B1 if OVER = 'O'. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N1+N2). C (output) DOUBLE PRECISION array, dimension (LDC,N1+N2) The leading P-by-N part of this array contains the state/output matrix C for the resulting system. The array C can overlap C1 if OVER = 'O'. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P1+P2) if N1+N2 > 0. LDC >= 1 if N1+N2 = 0. D (output) DOUBLE PRECISION array, dimension (LDD,M1+M2) The leading P-by-M part of this array contains the input/output matrix D for the resulting system. The array D can overlap D1 if OVER = 'O'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P1+P2).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrices of the resulting systems are determined as: ( A1 0 ) ( B1 0 ) A = ( ) , B = ( ) , ( 0 A2 ) ( 0 B2 ) ( C1 0 ) ( D1 0 ) C = ( ) , D = ( ) . ( 0 C2 ) ( 0 D2 )References
NoneFurther Comments
NoneExample
Program Text
* AB05QD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER N1MAX, N2MAX, NMAX, M1MAX, M2MAX, MMAX, P1MAX, $ P2MAX, PMAX PARAMETER ( N1MAX = 20, N2MAX = 20, NMAX = N1MAX+N2MAX, $ M1MAX = 20, M2MAX = 20, MMAX = M1MAX+M2MAX, $ P1MAX = 20, P2MAX = 20, PMAX = P1MAX+P2MAX ) INTEGER LDA, LDA1, LDA2, LDB, LDB1, LDB2, LDC, LDC1, $ LDC2, LDD, LDD1, LDD2 PARAMETER ( LDA = NMAX, LDA1 = N1MAX, LDA2 = N2MAX, $ LDB = NMAX, LDB1 = N1MAX, LDB2 = N2MAX, $ LDC = PMAX, LDC1 = P1MAX, LDC2 = P1MAX, $ LDD = PMAX, LDD1 = P1MAX, LDD2 = P1MAX ) DOUBLE PRECISION ONE PARAMETER ( ONE=1.0D0 ) * .. Local Scalars .. CHARACTER*1 OVER INTEGER I, INFO, J, M, M1, M2, N, N1, N2, P, P1, P2 * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), A1(LDA1,N1MAX), A2(LDA2,N2MAX), $ B(LDB,MMAX), B1(LDB1,M1MAX), B2(LDB2,M2MAX), $ C(LDC,NMAX), C1(LDC1,N1MAX), C2(LDC2,N2MAX), $ D(LDD,MMAX), D1(LDD1,M1MAX), D2(LDD2,M2MAX) * .. External Subroutines .. EXTERNAL AB05QD * .. Executable Statements .. * 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, M2, 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 ) IF ( M2.LE.0 .OR. M2.GT.M2MAX ) THEN WRITE ( NOUT, FMT = 99988 ) M2 ELSE READ ( NIN, FMT = * ) $ ( ( B2(I,J), I = 1,N2 ), J = 1,M2 ) IF ( P2.LE.0 .OR. P2.GT.P2MAX ) THEN WRITE ( NOUT, FMT = 99987 ) P2 ELSE READ ( NIN, FMT = * ) $ ( ( C2(I,J), J = 1,N2 ), I = 1,P2 ) READ ( NIN, FMT = * ) $ ( ( D2(I,J), J = 1,M2 ), I = 1,P2 ) * Find the state-space model (A,B,C,D). CALL AB05QD( OVER, N1, M1, P1, N2, M2, P2, A1, $ LDA1, B1, LDB1, C1, LDC1, D1, LDD1, $ A2, LDA2, B2, LDB2, C2, LDC2, D2, $ LDD2, N, M, P, A, LDA, B, LDB, C, $ LDC, D, LDD, 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,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99996 ) $ ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) $ ( D(I,J), J = 1,M ) 80 CONTINUE END IF END IF END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' AB05QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB05QD = ',I2) 99997 FORMAT (' The state transition matrix of the connected system is') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The input/state matrix of the connected system is ') 99994 FORMAT (/' The state/output matrix of the connected system is ') 99993 FORMAT (/' The input/output matrix of the connected 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 (/' M2 is out of range.',/' M2 = ',I5) 99987 FORMAT (/' P2 is out of range.',/' P2 = ',I5) ENDProgram Data
AB05QD EXAMPLE PROGRAM DATA 3 2 2 3 2 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.0Program Results
AB05QD EXAMPLE PROGRAM RESULTS The state transition matrix of the connected 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 0.0000 0.0000 -3.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 -1.0000 2.0000 The input/state matrix of the connected system is 1.0000 2.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 0.0000 2.0000 The state/output matrix of the connected system is 3.0000 -2.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 -1.0000 The input/output matrix of the connected system is 1.0000 0.0000 0.0000 0.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
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB05RD.html 0000664 0000000 0000000 00000037203 14560147231 0020334 0 ustar 00root root 0000000 0000000
Purpose
To construct for a given state space system (A,B,C,D) the closed- loop system (Ac,Bc,Cc,Dc) corresponding to the mixed output and state feedback control law u = alpha*F*y + beta*K*x + G*v z = H*y.Specification
SUBROUTINE AB05RD( FBTYPE, JOBD, N, M, P, MV, PZ, ALPHA, BETA, A, $ LDA, B, LDB, C, LDC, D, LDD, F, LDF, K, LDK, $ G, LDG, H, LDH, RCOND, BC, LDBC, CC, LDCC, $ DC, LDDC, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER FBTYPE, JOBD INTEGER INFO, LDA, LDB, LDBC, LDC, LDCC, LDD, LDDC, $ LDF, LDG, LDH, LDK, LDWORK, M, MV, N, P, PZ DOUBLE PRECISION ALPHA, BETA, RCOND C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), BC(LDBC,*), C(LDC,*), $ CC(LDCC,*), D(LDD,*), DC(LDDC,*), DWORK(*), $ F(LDF,*), G(LDG,*), H(LDH,*), K(LDK,*)Arguments
Mode Parameters
FBTYPE CHARACTER*1 Specifies the type of the feedback law as follows: = 'I': Unitary output feedback (F = I); = 'O': General output feedback. JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model: = 'D': D is present; = 'Z': D is assumed a zero matrix.Input/Output Parameters
N (input) INTEGER The dimension of state vector x, i.e. the order of the matrix A, the number of rows of B and the number of columns of C. N >= 0. M (input) INTEGER The dimension of input vector u, i.e. the number of columns of matrices B and D, and the number of rows of F. M >= 0. P (input) INTEGER The dimension of output vector y, i.e. the number of rows of matrices C and D, and the number of columns of F. P >= 0 and P = M if FBTYPE = 'I'. MV (input) INTEGER The dimension of the new input vector v, i.e. the number of columns of matrix G. MV >= 0. PZ (input) INTEGER. The dimension of the new output vector z, i.e. the number of rows of matrix H. PZ >= 0. ALPHA (input) DOUBLE PRECISION The coefficient alpha in the output feedback law. BETA (input) DOUBLE PRECISION. The coefficient beta in the state feedback law. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the system state transition matrix A. On exit, the leading N-by-N part of this array contains the state matrix Ac of the closed-loop system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the system input matrix B. On exit, the leading N-by-M part of this array contains the intermediary input matrix B1 (see METHOD). LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the system output matrix C. On exit, the leading P-by-N part of this array contains the intermediary output matrix C1+BETA*D1*K (see METHOD). LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P) if N > 0. LDC >= 1 if N = 0. D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, if JOBD = 'D', the leading P-by-M part of this array must contain the system direct input/output transmission matrix D. On exit, the leading P-by-M part of this array contains the intermediary direct input/output transmission matrix D1 (see METHOD). The array D is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P) if JOBD = 'D'. LDD >= 1 if JOBD = 'Z'. F (input) DOUBLE PRECISION array, dimension (LDF,P) If FBTYPE = 'O', the leading M-by-P part of this array must contain the output feedback matrix F. If FBTYPE = 'I', then the feedback matrix is assumed to be an M x M order identity matrix. The array F is not referenced if FBTYPE = 'I' or ALPHA = 0. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M) if FBTYPE = 'O' and ALPHA <> 0. LDF >= 1 if FBTYPE = 'I' or ALPHA = 0. K (input) DOUBLE PRECISION array, dimension (LDK,N) The leading M-by-N part of this array must contain the state feedback matrix K. The array K is not referenced if BETA = 0. LDK INTEGER The leading dimension of the array K. LDK >= MAX(1,M) if BETA <> 0. LDK >= 1 if BETA = 0. G (input) DOUBLE PRECISION array, dimension (LDG,MV) The leading M-by-MV part of this array must contain the system input scaling matrix G. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,M). H (input) DOUBLE PRECISION array, dimension (LDH,P) The leading PZ-by-P part of this array must contain the system output scaling matrix H. LDH INTEGER The leading dimension of the array H. LDH >= MAX(1,PZ). RCOND (output) DOUBLE PRECISION The reciprocal condition number of the matrix I - alpha*D*F. BC (output) DOUBLE PRECISION array, dimension (LDBC,MV) The leading N-by-MV part of this array contains the input matrix Bc of the closed-loop system. LDBC INTEGER The leading dimension of array BC. LDBC >= MAX(1,N). CC (output) DOUBLE PRECISION array, dimension (LDCC,N) The leading PZ-by-N part of this array contains the system output matrix Cc of the closed-loop system. LDCC INTEGER The leading dimension of array CC. LDCC >= MAX(1,PZ) if N > 0. LDCC >= 1 if N = 0. DC (output) DOUBLE PRECISION array, dimension (LDDC,MV) If JOBD = 'D', the leading PZ-by-MV part of this array contains the direct input/output transmission matrix Dc of the closed-loop system. The array DC is not referenced if JOBD = 'Z'. LDDC INTEGER The leading dimension of array DC. LDDC >= MAX(1,PZ) if JOBD = 'D'. LDDC >= 1 if JOBD = 'Z'.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= MAX(1,2*P) if JOBD = 'D'. LIWORK >= 1 if JOBD = 'Z'. IWORK is not referenced if JOBD = 'Z'. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= wspace, where wspace = MAX( 1, M, P*MV, P*P + 4*P ) if JOBD = 'D', wspace = MAX( 1, M ) if JOBD = 'Z'. For best performance, LDWORK >= MAX( wspace, N*M, N*P ).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix I - alpha*D*F is numerically singular.Method
The matrices of the closed-loop system have the expressions: Ac = A1 + beta*B1*K, Bc = B1*G, Cc = H*(C1 + beta*D1*K), Dc = H*D1*G, where A1 = A + alpha*B*F*E*C, B1 = B + alpha*B*F*E*D, C1 = E*C, D1 = E*D, with E = (I - alpha*D*F)**-1.Numerical Aspects
The accuracy of computations basically depends on the conditioning of the matrix I - alpha*D*F. If RCOND is very small, it is likely that the computed results are inaccurate.Further Comments
NoneExample
Program Text
* AB05RD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, MVMAX, PMAX, PZMAX PARAMETER ( NMAX = 20, MMAX = 20, MVMAX = 20, $ PMAX = 20, PZMAX = 20 ) INTEGER LDA, LDB, LDBC, LDC, LDCC, LDD, LDDC, LDF, LDG, $ LDH, LDK, LDWORK, LIWORK PARAMETER ( LDA = NMAX, LDB = NMAX, LDBC = NMAX, $ LDC = PMAX, LDCC = PZMAX, $ LDD = PMAX, LDDC = PZMAX, LDF = MMAX, $ LDG = MMAX, LDH = PZMAX, LDK = MMAX, $ LDWORK = MAX( MMAX, PMAX*MVMAX, $ PMAX*PMAX + 4*PMAX ), LIWORK = 2*PMAX ) * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) * .. Local Scalars .. LOGICAL LJOBD, OUTPF CHARACTER*1 FBTYPE, JOBD INTEGER I, INFO, J, M, MV, N, P, PZ DOUBLE PRECISION ALPHA, BETA, RCOND * .. Local Arrays .. INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), BC(LDBC,MVMAX), $ C(LDC,NMAX), CC(LDCC,NMAX), $ D(LDD,MMAX), DC(LDDC,MVMAX), DWORK(LDWORK), $ F(LDF,PMAX), G(LDG,MVMAX), H(LDH,PMAX), $ K(LDK,NMAX) * .. External functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL AB05RD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, MV, PZ, ALPHA, BETA, FBTYPE, JOBD OUTPF = LSAME( FBTYPE, 'O' ) LJOBD = LSAME( JOBD, 'D' ) IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( BETA.NE.ZERO ) $ READ ( NIN, FMT = * ) ( ( K(I,J), J = 1,N ), I = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99990 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) IF ( LJOBD ) $ READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) IF ( OUTPF.AND.ALPHA.NE.ZERO ) $ READ ( NIN, FMT = * ) ( ( F(I,J), J = 1,P ), I = 1,M ) IF ( MV.LE.0 .OR. MV.GT.MVMAX ) THEN WRITE ( NOUT, FMT = 99989 ) MV ELSE READ ( NIN, FMT = * ) $ ( ( G(I,J), J = 1,MV ), I = 1,M ) IF ( PZ.LE.0 .OR. PZ.GT.PZMAX ) THEN WRITE ( NOUT, FMT = 99988 ) PZ ELSE READ ( NIN, FMT = * ) $ ( ( H(I,J), J = 1,P ), I = 1,PZ ) * Find the state-space model (A,B,C,D). CALL AB05RD( FBTYPE, JOBD, N, M, P, MV, PZ, ALPHA, $ BETA, A, LDA, B, LDB, C, LDC, D, LDD, $ F, LDF, K, LDK, G, LDG, H, LDH, RCOND, $ BC, LDBC, CC, LDCC, DC, LDDC, IWORK, $ DWORK, LDWORK, INFO ) * WRITE ( NOUT, FMT = 99987 ) RCOND 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 ) $ ( BC(I,J), J = 1,MV ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, PZ WRITE ( NOUT, FMT = 99996 ) $ ( CC(I,J), J = 1,N ) 60 CONTINUE IF ( LJOBD ) THEN WRITE ( NOUT, FMT = 99993 ) DO 80 I = 1, PZ WRITE ( NOUT, FMT = 99996 ) $ ( DC(I,J), J = 1,MV ) 80 CONTINUE END IF END IF END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' AB05RD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB05RD = ',I2) 99997 FORMAT (' The state transition matrix of the closed-loop system is $') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The input/state matrix of the closed-loop system is ') 99994 FORMAT (/' The state/output matrix of the closed-loop system is ') 99993 FORMAT (/' The input/output matrix of the closed-loop system is ') 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' M is out of range.',/' M = ',I5) 99990 FORMAT (/' P is out of range.',/' P = ',I5) 99989 FORMAT (/' MV is out of range.',/' MV = ',I5) 99988 FORMAT (/' PZ is out of range.',/' PZ = ',I5) 99987 FORMAT ( ' The reciprocal condition number of the matrix ', $ ' I - alpha*D*F is',F8.4,/1X) ENDProgram Data
AB05RD EXAMPLE PROGRAM DATA 3 2 2 2 2 1.0 1.0 O D 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 2.0 1.0 0.0 1.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 1.0 2.0 3.0 4.0 1.0 1.0 0.0 1.0 4.0 3.0 2.0 1.0Program Results
AB05RD EXAMPLE PROGRAM RESULTS The reciprocal condition number of the matrix I - alpha*D*F is 0.2000 The state transition matrix of the closed-loop system is -4.8333 0.1667 -2.8333 -0.8333 0.1667 0.1667 -1.5000 0.5000 1.5000 The input/state matrix of the closed-loop system is -0.5000 -0.8333 0.5000 0.1667 -0.5000 -0.5000 The state/output matrix of the closed-loop system is 1.1667 -1.8333 -0.8333 1.8333 -1.1667 -0.1667 The input/output matrix of the closed-loop system is 0.5000 -0.8333 0.5000 -0.1667
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB05SD.html 0000664 0000000 0000000 00000014774 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To construct for a given state space system (A,B,C,D) the closed- loop system (Ac,Bc,Cc,Dc) corresponding to the output feedback control law u = alpha*F*y + v.Specification
SUBROUTINE AB05SD( FBTYPE, JOBD, N, M, P, ALPHA, A, LDA, B, LDB, $ C, LDC, D, LDD, F, LDF, RCOND, IWORK, DWORK, $ LDWORK, INFO) C .. Scalar Arguments .. CHARACTER FBTYPE, JOBD INTEGER INFO, LDA, LDB, LDC, LDD, LDF, LDWORK, M, N, P DOUBLE PRECISION ALPHA, RCOND C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), F(LDF,*)Arguments
Mode Parameters
FBTYPE CHARACTER*1 Specifies the type of the feedback law as follows: = 'I': Unitary output feedback (F = I); = 'O': General output feedback. JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model: = 'D': D is present; = 'Z': D is assumed a zero matrix.Input/Output Parameters
N (input) INTEGER The number of state variables, i.e. the order of the matrix A, the number of rows of B and the number of columns of C. N >= 0. M (input) INTEGER The number of input variables, i.e. the number of columns of matrices B and D, and the number of rows of F. M >= 0. P (input) INTEGER The number of output variables, i.e. the number of rows of matrices C and D, and the number of columns of F. P >= 0 and P = M if FBTYPE = 'I'. ALPHA (input) DOUBLE PRECISION The coefficient alpha in the output feedback law. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the system state transition matrix A. On exit, the leading N-by-N part of this array contains the state matrix Ac of the closed-loop system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the system input matrix B. On exit, the leading N-by-M part of this array contains the input matrix Bc of the closed-loop system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the system output matrix C. On exit, the leading P-by-N part of this array contains the output matrix Cc of the closed-loop system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P) if N > 0. LDC >= 1 if N = 0. D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the system direct input/output transmission matrix D. On exit, if JOBD = 'D', the leading P-by-M part of this array contains the direct input/output transmission matrix Dc of the closed-loop system. The array D is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P) if JOBD = 'D'. LDD >= 1 if JOBD = 'Z'. F (input) DOUBLE PRECISION array, dimension (LDF,P) If FBTYPE = 'O', the leading M-by-P part of this array must contain the output feedback matrix F. If FBTYPE = 'I', then the feedback matrix is assumed to be an M x M order identity matrix. The array F is not referenced if FBTYPE = 'I' or ALPHA = 0. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M) if FBTYPE = 'O' and ALPHA <> 0. LDF >= 1 if FBTYPE = 'I' or ALPHA = 0. RCOND (output) DOUBLE PRECISION The reciprocal condition number of the matrix I - alpha*D*F.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= MAX(1,2*P) if JOBD = 'D'. LIWORK >= 1 if JOBD = 'Z'. IWORK is not referenced if JOBD = 'Z'. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= wspace, where wspace = MAX( 1, M, P*P + 4*P ) if JOBD = 'D', wspace = MAX( 1, M ) if JOBD = 'Z'. For best performance, LDWORK >= MAX( wspace, N*M, N*P ).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix I - alpha*D*F is numerically singular.Method
The matrices of the closed-loop system have the expressions: Ac = A + alpha*B*F*E*C, Bc = B + alpha*B*F*E*D, Cc = E*C, Dc = E*D, where E = (I - alpha*D*F)**-1.Numerical Aspects
The accuracy of computations basically depends on the conditioning of the matrix I - alpha*D*F. If RCOND is very small, it is likely that the computed results are inaccurate.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB07MD.html 0000664 0000000 0000000 00000017650 14560147231 0020335 0 ustar 00root root 0000000 0000000
Purpose
To find the dual of a given state-space representation.Specification
SUBROUTINE AB07MD( JOBD, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ INFO ) C .. Scalar Arguments .. CHARACTER JOBD INTEGER INFO, LDA, LDB, LDC, LDD, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*)Arguments
Mode Parameters
JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model: = 'D': D is present; = 'Z': D is assumed a zero matrix.Input/Output Parameters
N (input) INTEGER The order of the state-space representation. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading N-by-N part of this array contains the dual state dynamics matrix A'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, the leading N-by-P part of this array contains the dual input/state matrix C'. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, the leading M-by-N part of this array contains the dual state/output matrix B'. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P) if N > 0. LDC >= 1 if N = 0. D (input/output) DOUBLE PRECISION array, dimension (LDD,MAX(M,P)) On entry, if JOBD = 'D', the leading P-by-M part of this array must contain the original direct transmission matrix D. On exit, if JOBD = 'D', the leading M-by-P part of this array contains the dual direct transmission matrix D'. The array D is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,M,P) if JOBD = 'D'. LDD >= 1 if JOBD = 'Z'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
If the given state-space representation is the M-input/P-output (A,B,C,D), its dual is simply the P-input/M-output (A',C',B',D').References
NoneNumerical Aspects
NoneFurther Comments
NoneExample
Program Text
* AB07MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = MAXMP, $ LDD = MAXMP ) * .. Local Scalars .. CHARACTER*1 JOBD INTEGER I, INFO, J, M, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAXMP), C(LDC,NMAX), $ D(LDD,MAXMP) * .. External functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL AB07MD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOBD IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99990 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find the dual of the ssr (A,B,C,D). CALL AB07MD( JOBD, N, M, P, A, LDA, B, LDB, C, LDC, D, $ LDD, 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,P ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,N ) 60 CONTINUE IF ( LSAME( JOBD, 'D' ) ) THEN WRITE ( NOUT, FMT = 99993 ) DO 80 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( D(I,J), J = 1,P ) 80 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' AB07MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB07MD = ',I2) 99997 FORMAT (' The dual state dynamics matrix is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The dual input/state matrix is ') 99994 FORMAT (/' The dual state/output matrix is ') 99993 FORMAT (/' The dual direct transmission matrix is ') 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' M is out of range.',/' M = ',I5) 99990 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
AB07MD EXAMPLE PROGRAM DATA 3 1 2 D 1.0 2.0 0.0 4.0 -1.0 0.0 0.0 0.0 1.0 1.0 0.0 1.0 0.0 1.0 -1.0 0.0 0.0 1.0 0.0 1.0Program Results
AB07MD EXAMPLE PROGRAM RESULTS The dual state dynamics matrix is 1.0000 4.0000 0.0000 2.0000 -1.0000 0.0000 0.0000 0.0000 1.0000 The dual input/state matrix is 0.0000 0.0000 1.0000 0.0000 -1.0000 1.0000 The dual state/output matrix is 1.0000 0.0000 1.0000 The dual direct transmission matrix is 0.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB07ND.html 0000664 0000000 0000000 00000021150 14560147231 0020324 0 ustar 00root root 0000000 0000000
Purpose
To compute the inverse (Ai,Bi,Ci,Di) of a given system (A,B,C,D).Specification
SUBROUTINE AB07ND( N, M, A, LDA, B, LDB, C, LDC, D, LDD, RCOND, $ IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION RCOND INTEGER INFO, LDA, LDB, LDC, LDD, LDWORK, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*) INTEGER IWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the state matrix A. N >= 0. M (input) INTEGER The number of system inputs and outputs. M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state matrix A of the original system. On exit, the leading N-by-N part of this array contains the state matrix Ai of the inverse system. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B of the original system. On exit, the leading N-by-M part of this array contains the input matrix Bi of the inverse system. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the output matrix C of the original system. On exit, the leading M-by-N part of this array contains the output matrix Ci of the inverse system. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading M-by-M part of this array must contain the feedthrough matrix D of the original system. On exit, the leading M-by-M part of this array contains the feedthrough matrix Di of the inverse system. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,M). RCOND (output) DOUBLE PRECISION The estimated reciprocal condition number of the feedthrough matrix D of the original system.Workspace
IWORK INTEGER array, dimension (2*M) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or M+1, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,4*M). For good performance, LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = i: the matrix D is exactly singular; the (i,i) diagonal element is zero, i <= M; RCOND was set to zero; = M+1: the matrix D is numerically singular, i.e., RCOND is less than the relative machine precision, EPS (see LAPACK Library routine DLAMCH). The calculations have been completed, but the results could be very inaccurate.Method
The matrices of the inverse system are computed with the formulas: -1 -1 -1 -1 Ai = A - B*D *C, Bi = -B*D , Ci = D *C, Di = D .Numerical Aspects
The accuracy depends mainly on the condition number of the matrix D to be inverted. The estimated reciprocal condition number is returned in RCOND.Further Comments
NoneExample
Program Text
* AB07ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = MMAX, $ LDD = MMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 4*MMAX ) * .. Local Scalars .. INTEGER I, INFO, J, M, N DOUBLE PRECISION RCOND * .. Local Arrays .. INTEGER IWORK(2*MMAX) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK) * .. External Subroutines .. EXTERNAL AB07ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,M ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,M ) * Find the inverse of the ssr (A,B,C,D). CALL AB07ND( N, M, A, LDA, B, LDB, C, LDC, D, LDD, RCOND, $ IWORK, 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,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 80 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( D(I,J), J = 1,M ) 80 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' AB07ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB07ND = ',I2) 99997 FORMAT (' The state dynamics matrix of the inverse system is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The input/state matrix of the inverse system is ') 99994 FORMAT (/' The state/output matrix of the inverse system is ') 99993 FORMAT (/' The feedthrough matrix of the inverse system is ') 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
AB07ND EXAMPLE PROGRAM DATA 3 2 1.0 2.0 0.0 4.0 -1.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 0.0 0.0 1.0 -1.0 0.0 0.0 1.0 4.0 0.0 0.0 1.0Program Results
AB07ND EXAMPLE PROGRAM RESULTS The state dynamics matrix of the inverse system is 1.0000 1.7500 0.2500 4.0000 -1.0000 -1.0000 0.0000 -0.2500 1.2500 The input/state matrix of the inverse system is -0.2500 0.0000 0.0000 -1.0000 -0.2500 0.0000 The state/output matrix of the inverse system is 0.0000 0.2500 -0.2500 0.0000 0.0000 1.0000 The feedthrough matrix of the inverse system is 0.2500 0.0000 0.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB08MD.html 0000664 0000000 0000000 00000013172 14560147231 0020331 0 ustar 00root root 0000000 0000000
Purpose
To compute the normal rank of the transfer-function matrix of a state-space model (A,B,C,D).Specification
SUBROUTINE AB08MD( EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ RANK, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL INTEGER INFO, LDA, LDB, LDC, LDD, LDWORK, M, N, P, RANK DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), DWORK(*)Arguments
Mode Parameters
EQUIL CHARACTER*1 Specifies whether the user wishes to balance the compound matrix (see METHOD) as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
N (input) INTEGER The number of state variables, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state dynamics matrix A of the system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B of the system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the state/output matrix C of the system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct transmission matrix D of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). RANK (output) INTEGER The normal rank of the transfer-function matrix.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL to be less than SQRT((N+P)*(N+M))*EPS then the tolerance is taken as SQRT((N+P)*(N+M))*EPS, where EPS is the machine precision (see LAPACK Library Routine DLAMCH).Workspace
IWORK INTEGER array, dimension (2*N+MAX(M,P)+1) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= (N+P)*(N+M) + MAX( MIN(P,M) + MAX(3*M-1,N), 1, MIN(P,N) + MAX(3*P-1,N+P,N+M) ) For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine reduces the (N+P)-by-(M+N) compound matrix (B A) (D C) to one with the same invariant zeros and with D of full row rank. The normal rank of the transfer-function matrix is the rank of D.References
[1] Svaricek, F. Computation of the Structural Invariants of Linear Multivariable Systems with an Extended Version of the Program ZEROS. System & Control Letters, 6, pp. 261-266, 1985. [2] Emami-Naeini, A. and Van Dooren, P. Computation of Zeros of Linear Multivariable Systems. Automatica, 18, pp. 415-430, 1982.Numerical Aspects
The algorithm is backward stable (see [2] and [1]).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB08MZ.html 0000664 0000000 0000000 00000013304 14560147231 0020354 0 ustar 00root root 0000000 0000000
Purpose
To compute the normal rank of the transfer-function matrix of a state-space model (A,B,C,D).Specification
SUBROUTINE AB08MZ( EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ RANK, TOL, IWORK, DWORK, ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL INTEGER INFO, LDA, LDB, LDC, LDD, LZWORK, M, N, P, RANK DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) COMPLEX*16 A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), ZWORK(*) DOUBLE PRECISION DWORK(*)Arguments
Mode Parameters
EQUIL CHARACTER*1 Specifies whether the user wishes to balance the compound matrix (see METHOD) as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
N (input) INTEGER The number of state variables, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input) COMPLEX*16 array, dimension (LDA,N) The leading N-by-N part of this array must contain the state dynamics matrix A of the system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) COMPLEX*16 array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B of the system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) COMPLEX*16 array, dimension (LDC,N) The leading P-by-N part of this array must contain the state/output matrix C of the system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) COMPLEX*16 array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct transmission matrix D of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). RANK (output) INTEGER The normal rank of the transfer-function matrix.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL to be less than SQRT((N+P)*(N+M))*EPS then the tolerance is taken as SQRT((N+P)*(N+M))*EPS, where EPS is the machine precision (see LAPACK Library Routine DLAMCH).Workspace
IWORK INTEGER array, dimension (2*N+MAX(M,P)+1) DWORK DOUBLE PRECISION array, dimension (2*MAX(M,P)) ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. LZWORK INTEGER The length of the array ZWORK. LZWORK >= (N+P)*(N+M) + MAX(MIN(P,M) + MAX(3*M-1,N), 1, MIN(P,N) + MAX(3*P-1,N+P,N+M)) For optimum performance LZWORK should be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine reduces the (N+P)-by-(M+N) compound matrix (B A) (D C) to one with the same invariant zeros and with D of full row rank. The normal rank of the transfer-function matrix is the rank of D.References
[1] Svaricek, F. Computation of the Structural Invariants of Linear Multivariable Systems with an Extended Version of the Program ZEROS. System & Control Letters, 6, pp. 261-266, 1985. [2] Emami-Naeini, A. and Van Dooren, P. Computation of Zeros of Linear Multivariable Systems. Automatica, 18, pp. 415-430, 1982.Numerical Aspects
The algorithm is backward stable (see [2] and [1]).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB08ND.html 0000664 0000000 0000000 00000046311 14560147231 0020333 0 ustar 00root root 0000000 0000000
Purpose
To construct for a linear multivariable system described by a state-space model (A,B,C,D) a regular pencil (A - lambda*B ) which f f has the invariant zeros of the system as generalized eigenvalues. The routine also computes the orders of the infinite zeros and the right and left Kronecker indices of the system (A,B,C,D).Specification
SUBROUTINE AB08ND( EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ NU, RANK, DINFZ, NKROR, NKROL, INFZ, KRONR, $ KRONL, AF, LDAF, BF, LDBF, TOL, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL INTEGER DINFZ, INFO, LDA, LDAF, LDB, LDBF, LDC, LDD, $ LDWORK, M, N, NKROL, NKROR, NU, P, RANK DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INFZ(*), IWORK(*), KRONL(*), KRONR(*) DOUBLE PRECISION A(LDA,*), AF(LDAF,*), B(LDB,*), BF(LDBF,*), $ C(LDC,*), D(LDD,*), DWORK(*)Arguments
Mode Parameters
EQUIL CHARACTER*1 Specifies whether the user wishes to balance the compound matrix (see METHOD) as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
N (input) INTEGER The number of state variables, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state dynamics matrix A of the system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B of the system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the state/output matrix C of the system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct transmission matrix D of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NU (output) INTEGER The number of (finite) invariant zeros. RANK (output) INTEGER The normal rank of the transfer function matrix. DINFZ (output) INTEGER The maximum degree of infinite elementary divisors. NKROR (output) INTEGER The number of right Kronecker indices. NKROL (output) INTEGER The number of left Kronecker indices. INFZ (output) INTEGER array, dimension (N) The leading DINFZ elements of INFZ contain information on the infinite elementary divisors as follows: the system has INFZ(i) infinite elementary divisors of degree i, where i = 1,2,...,DINFZ. KRONR (output) INTEGER array, dimension (MAX(N,M)+1) The leading NKROR elements of this array contain the right Kronecker (column) indices. KRONL (output) INTEGER array, dimension (MAX(N,P)+1) The leading NKROL elements of this array contain the left Kronecker (row) indices. AF (output) DOUBLE PRECISION array, dimension (LDAF,N+MIN(P,M)) The leading NU-by-NU part of this array contains the coefficient matrix A of the reduced pencil. The remainder f of the leading (N+M)-by-(N+MIN(P,M)) part is used as internal workspace. LDAF INTEGER The leading dimension of array AF. LDAF >= MAX(1,N+M). BF (output) DOUBLE PRECISION array, dimension (LDBF,N+M) The leading NU-by-NU part of this array contains the coefficient matrix B of the reduced pencil. The f remainder of the leading (N+P)-by-(N+M) part is used as internal workspace. LDBF INTEGER The leading dimension of array BF. LDBF >= MAX(1,N+P).Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL to be less than SQRT((N+P)*(N+M))*EPS then the tolerance is taken as SQRT((N+P)*(N+M))*EPS, where EPS is the machine precision (see LAPACK Library Routine DLAMCH).Workspace
IWORK INTEGER array, dimension (MAX(M,P)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, MIN(P,M) + MAX(3*M-1,N), MIN(P,N) + MAX(3*P-1,N+P,N+M), MIN(M,N) + MAX(3*M-1,N+M) ). An upper bound is MAX(s,N) + MAX(3*s-1,N+s), with s = MAX(M,P). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine extracts from the system matrix of a state-space system (A,B,C,D) a regular pencil A - lambda*B which has the f f invariant zeros of the system as generalized eigenvalues as follows: (a) construct the (N+P)-by-(N+M) compound matrix (B A); (D C) (b) reduce the above system to one with the same invariant zeros and with D of full row rank; (c) pertranspose the system; (d) reduce the system to one with the same invariant zeros and with D square invertible; (e) perform a unitary transformation on the columns of (A - lambda*I B) in order to reduce it to ( C D) (A - lambda*B X) ( f f ), with Y and B square invertible; ( 0 Y) f (f) compute the right and left Kronecker indices of the system (A,B,C,D), which together with the orders of the infinite zeros (determined by steps (a) - (e)) constitute the complete set of structural invariants under strict equivalence transformations of a linear system.References
[1] Svaricek, F. Computation of the Structural Invariants of Linear Multivariable Systems with an Extended Version of the Program ZEROS. System & Control Letters, 6, pp. 261-266, 1985. [2] Emami-Naeini, A. and Van Dooren, P. Computation of Zeros of Linear Multivariable Systems. Automatica, 18, pp. 415-430, 1982.Numerical Aspects
The algorithm is backward stable (see [2] and [1]).Further Comments
In order to compute the invariant zeros of the system explicitly, a call to this routine may be followed by a call to the LAPACK Library routine DGGEV with A = A , B = B and N = NU. f f If RANK = 0, the routine DGEEV can be used (since B = I). fExample
Program Text
* AB08ND EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MPMAX PARAMETER ( MPMAX = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC, LDD, LDAF, LDBF, LDQ, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDAF = NMAX+MPMAX, $ LDBF = NMAX+PMAX, LDQ = 1, LDZ = 1 ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( MAX( MPMAX+1, NMAX ) + $ MAX( 3*(MPMAX+1), NMAX+MPMAX ), $ 8*NMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER DINFZ, I, INFO, J, M, N, NINFZ, NKROL, NKROR, $ NU, P, RANK CHARACTER*1 EQUIL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), AF(LDAF,NMAX+PMAX), ALFI(NMAX), $ ALFR(NMAX), B(LDB,MMAX), BETA(NMAX), $ BF(LDBF,MMAX+NMAX), C(LDC,NMAX), D(LDD,MMAX), $ DWORK(LDWORK), Q(LDQ,1), Z(LDZ,1) INTEGER INFZ(NMAX), IWORK(MPMAX+1), KRONL(NMAX+1), $ KRONR(NMAX+1) * .. External Subroutines .. EXTERNAL AB08ND, DGEGV * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, EQUIL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99972 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99971 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99970 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Check the observability and compute the ordered set of * the observability indices (call the routine with M = 0). CALL AB08ND( EQUIL, N, 0, P, A, LDA, B, LDB, C, LDC, D, $ LDD, NU, RANK, DINFZ, NKROR, NKROL, INFZ, $ KRONR, KRONL, AF, LDAF, BF, LDBF, TOL, $ IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) ( KRONL(I), I = 1,P ) IF ( NU.EQ.0 ) THEN WRITE ( NOUT, FMT = 99993 ) ELSE WRITE ( NOUT, FMT = 99992 ) N - NU WRITE ( NOUT, FMT = 99991 ) WRITE ( NOUT, FMT = 99990 ) DO 20 I = 1, NU WRITE ( NOUT, FMT = 99989 ) $ ( AF(I,J), J = 1,NU ) 20 CONTINUE END IF END IF * Check the controllability and compute the ordered set of * the controllability indices (call the routine with P = 0) CALL AB08ND( EQUIL, N, M, 0, A, LDA, B, LDB, C, LDC, D, $ LDD, NU, RANK, DINFZ, NKROR, NKROL, INFZ, $ KRONR, KRONL, AF, LDAF, BF, LDBF, TOL, $ IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99988 ) ( KRONR(I), I = 1,M ) IF ( NU.EQ.0 ) THEN WRITE ( NOUT, FMT = 99987 ) ELSE WRITE ( NOUT, FMT = 99986 ) N - NU WRITE ( NOUT, FMT = 99985 ) WRITE ( NOUT, FMT = 99990 ) DO 40 I = 1, NU WRITE ( NOUT, FMT = 99989 ) $ ( AF(I,J), J = 1,NU ) 40 CONTINUE END IF END IF * Compute the structural invariants of the given system. CALL AB08ND( EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, D, $ LDD, NU, RANK, DINFZ, NKROR, NKROL, INFZ, $ KRONR, KRONL, AF, LDAF, BF, LDBF, TOL, $ IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99984 ) NU IF ( NU.GT.0 ) THEN * Compute the invariant zeros of the given system. * Workspace: need 8*NU. WRITE ( NOUT, FMT = 99983 ) CALL DGEGV( 'No vectors', 'No vectors', NU, AF, $ LDAF, BF, LDBF, ALFR, ALFI, BETA, Q, $ LDQ, Z, LDZ, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99981 ) DO 60 I = 1, NU IF ( ALFI(I).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99980 ) $ ALFR(I)/BETA(I) ELSE WRITE ( NOUT, FMT = 99979 ) $ ALFR(I)/BETA(I), $ ALFI(I)/BETA(I) END IF 60 CONTINUE WRITE ( NOUT, FMT = 99982 ) END IF END IF NINFZ = 0 DO 80 I = 1, DINFZ IF ( INFZ(I).GT.0 ) THEN NINFZ = NINFZ + INFZ(I)*I END IF 80 CONTINUE WRITE ( NOUT, FMT = 99978 ) NINFZ IF ( NINFZ.GT.0 ) THEN DO 100 I = 1, DINFZ WRITE ( NOUT, FMT = 99977 ) INFZ(I), I 100 CONTINUE END IF WRITE ( NOUT, FMT = 99976 ) NKROR IF ( NKROR.GT.0 ) WRITE ( NOUT, FMT = 99975 ) $ ( KRONR(I), I = 1,NKROR ) WRITE ( NOUT, FMT = 99974 ) NKROL IF ( NKROL.GT.0 ) WRITE ( NOUT, FMT = 99973 ) $ ( KRONL(I), I = 1,NKROL ) END IF END IF END IF END IF * STOP * 99999 FORMAT (' AB08ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB08ND = ',I2) 99997 FORMAT (' INFO on exit from DGEGV = ',I2) 99994 FORMAT (' The left Kronecker indices of (A,C) are ',/(20(I3,2X))) 99993 FORMAT (/' The system (A,C) is completely observable ') 99992 FORMAT (/' The dimension of the observable subspace = ',I3) 99991 FORMAT (/' The output decoupling zeros are the eigenvalues of th', $ 'e matrix AF. ') 99990 FORMAT (/' The matrix AF is ') 99989 FORMAT (20(1X,F8.4)) 99988 FORMAT (//' The right Kronecker indices of (A,B) are ',/(20(I3,2X) $ )) 99987 FORMAT (/' The system (A,B) is completely controllable ') 99986 FORMAT (/' The dimension of the controllable subspace = ',I3) 99985 FORMAT (/' The input decoupling zeros are the eigenvalues of the', $ ' matrix AF. ') 99984 FORMAT (//' The number of finite invariant zeros = ',I3) 99983 FORMAT (/' The finite invariant zeros are ') 99982 FORMAT (/' which correspond to the generalized eigenvalues of (l', $ 'ambda*BF - AF).') 99981 FORMAT (/' real part imag part ') 99980 FORMAT (1X,F9.4) 99979 FORMAT (1X,F9.4,6X,F9.4) 99978 FORMAT (//' The number of infinite zeros = ',I3) 99977 FORMAT ( I4,' infinite zero(s) of order ',I3) 99976 FORMAT (/' The number of right Kronecker indices = ',I3) 99975 FORMAT (/' Right Kronecker (column) indices of (A,B,C,D) are ', $ /(20(I3,2X))) 99974 FORMAT (/' The number of left Kronecker indices = ',I3) 99973 FORMAT (/' The left Kronecker (row) indices of (A,B,C,D) are ', $ /(20(I3,2X))) 99972 FORMAT (/' N is out of range.',/' N = ',I5) 99971 FORMAT (/' M is out of range.',/' M = ',I5) 99970 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
AB08ND EXAMPLE PROGRAM DATA 6 2 3 0.0 N 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 3.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0 3.0 0.0 -1.0 -1.0 0.0 1.0 -1.0 0.0 0.0 0.0 1.0 -1.0 -1.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0Program Results
AB08ND EXAMPLE PROGRAM RESULTS The left Kronecker indices of (A,C) are 1 2 2 The dimension of the observable subspace = 5 The output decoupling zeros are the eigenvalues of the matrix AF. The matrix AF is -1.0000 The right Kronecker indices of (A,B) are 2 3 The dimension of the controllable subspace = 5 The input decoupling zeros are the eigenvalues of the matrix AF. The matrix AF is -4.0000 The number of finite invariant zeros = 2 The finite invariant zeros are real part imag part 2.0000 -1.0000 which correspond to the generalized eigenvalues of (lambda*BF - AF). The number of infinite zeros = 2 The orders of the infinite zeros are 1 1 The number of right Kronecker indices = 0 The number of left Kronecker indices = 1 The left Kronecker (row) indices of (A,B,C,D) are 2
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB08NW.html 0000664 0000000 0000000 00000050050 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To extract from the system pencil ( A-lambda*I B ) S(lambda) = ( ) ( C D ) a regular pencil Af-lambda*Ef which has the finite Smith zeros of S(lambda) as generalized eigenvalues. The routine also computes the orders of the infinite Smith zeros and determines the singular and infinite Kronecker structure of the system pencil, i.e., the right and left Kronecker indices, and the multiplicities of the infinite eigenvalues.Specification
SUBROUTINE AB08NW( EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ NFZ, NRANK, NIZ, DINFZ, NKROR, NINFE, NKROL, $ INFZ, KRONR, INFE, KRONL, E, LDE, TOL, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL INTEGER DINFZ, INFO, LDA, LDB, LDC, LDD, LDE, LDWORK, $ M, N, NFZ, NINFE, NIZ, NKROL, NKROR, NRANK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INFE(*), INFZ(*), IWORK(*), KRONL(*), KRONR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), E(LDE,*)Arguments
Mode Parameters
EQUIL CHARACTER*1 Specifies whether the user wishes to balance the system matrix as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
N (input) INTEGER. The order of the square matrix A, the number of rows of the matrix B, and number of columns of the matrix C. N >= 0. M (input) INTEGER. The number of columns of the matrix B. M >= 0. P (input) INTEGER. The number of rows of the matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A of the system. On exit, the leading NFZ-by-NFZ part of this array contains the matrix Af of the reduced pencil. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix B of the system. On exit, this matrix does not contain useful information. LDB INTEGER The leading dimension of the array B. LDB >= 1, and LDB >= MAX(1,N), if M > 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C of the system. On exit, this matrix does not contain useful information. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct transmission matrix D of the system. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,P). NFZ (output) INTEGER The number of finite zeros. NRANK (output) INTEGER The normal rank of the system pencil. NIZ (output) INTEGER The number of infinite zeros. DINFZ (output) INTEGER The maximal multiplicity of infinite Smith zeros. NKROR (output) INTEGER The number of right Kronecker indices. NINFE (output) INTEGER The number of elementary infinite blocks. NKROL (output) INTEGER The number of left Kronecker indices. INFZ (output) INTEGER array, dimension (N+1) The leading DINFZ elements of INFZ contain information on the infinite elementary divisors as follows: the system has INFZ(i) infinite elementary divisors in the Smith form of degree i, where i = 1,2,...,DINFZ. KRONR (output) INTEGER array, dimension (N+1) The leading NKROR elements of this array contain the right Kronecker (column) indices. INFE (output) INTEGER array, dimension (N+1) The leading NINFE elements of INFE contain the multiplicities of infinite eigenvalues. KRONL (output) INTEGER array, dimension (N+1) The leading NKROL elements of this array contain the left Kronecker (row) indices. E (output) DOUBLE PRECISION array, dimension (LDE,N) The leading NFZ-by-NFZ part of this array contains the matrix Ef of the reduced pencil. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then an implicitly computed, default tolerance TOLDEF = MAX(N+P,N+M)**2*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (MAX(M,P)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if MAX(N,M,P) = 0; otherwise, LDWORK >= MAX( MIN(P,M) + M + MAX(2*M,N) - 1, MIN(P,N) + MAX(N + MAX(P,M), 3*P - 1 ) ) + MAX(P+N,M+N)*MAX(P+N,M+N). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine extracts from the system matrix of a state space system, (A-lambda*I,B,C,D), a regular pencil Af-lambda*Ef, which has the finite zeros of the system as generalized eigenvalues. The procedure has the following main computational steps: (a) construct the (N+P)-by-(M+N) system pencil S(lambda) = (B A)-lambda*( 0 I ); (D C) ( 0 0 ) (b) reduce S(lambda) to S1(lambda) with the same finite zeros and right Kronecker structure, but with D of full row rank; (c) reduce the pencil S1(lambda) to S2(lambda) with the same finite zeros and with D square invertible; (d) perform a unitary transformation on the columns of S2(lambda) = (A-lambda*I B), in order to reduce it to ( C D) (Af-lambda*Ef X), with Y and Ef square invertible; ( 0 Y) (e) compute the right and left Kronecker indices of the system matrix, which, together with the multiplicities of the finite and infinite eigenvalues, constitute the complete set of structural invariants under strict equivalence transformations of a linear system.References
[1] Svaricek, F. Computation of the Structural Invariants of Linear Multivariable Systems with an Extended Version of the Program ZEROS. System & Control Letters, 6, pp. 261-266, 1985. [2] Emami-Naeini, A. and Van Dooren, P. Computation of Zeros of Linear Multivariable Systems. Automatica, 18, pp. 415-430, 1982.Numerical Aspects
The algorithm is backward stable (see [2] and [1]).Further Comments
In order to compute the finite Smith zeros of the system explicitly, a call to this routine may be followed by a call to the LAPACK Library routine DGGEV.Example
Program Text
* AB08NW EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MPMAX PARAMETER ( MPMAX = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC, LDD, LDE, LDQ, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDE = NMAX, LDQ = 1, LDZ = 1 ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( MAX( MIN( PMAX, MMAX ) + MMAX + $ MAX( 2*MMAX, NMAX ) - 1, $ MIN( PMAX, NMAX ) + $ MAX( NMAX + MPMAX, $ 3*PMAX - 1 ) ) + $ ( NMAX + MPMAX )**2, 8*NMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER DINFZ, I, INFO, J, M, N, NFZ, NINFE, NIZ, NKROL, $ NKROR, NRANK, P CHARACTER*1 EQUIL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALFI(NMAX), ALFR(NMAX), $ AS(LDA,NMAX), B(LDB,MMAX), BS(LDB,MMAX), $ BETA(NMAX), C(LDC,NMAX), CS(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), E(LDE,NMAX), $ Q(LDQ,1), Z(LDZ,1) INTEGER INFE(NMAX+1), INFZ(NMAX+1), IWORK(MPMAX), $ KRONL(NMAX+1), KRONR(NMAX+1) * .. External Subroutines .. EXTERNAL AB08NW, DLACPY, DGEGV * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, EQUIL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99972 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99971 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99970 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Save the matrices A, B, and C. CALL DLACPY( 'Full', N, N, A, LDA, AS, LDA ) CALL DLACPY( 'Full', N, M, B, LDB, BS, LDB ) CALL DLACPY( 'Full', P, N, C, LDC, CS, LDC ) * Check the observability and compute the ordered set of * the observability indices (call the routine with M = 0). CALL AB08NW( EQUIL, N, 0, P, A, LDA, B, LDB, C, LDC, D, $ LDD, NFZ, NRANK, NIZ, DINFZ, NKROR, NINFE, $ NKROL, INFZ, KRONR, INFE, KRONL, E, LDE, $ TOL, IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) ( KRONL(I), I = 1,P ) IF ( NFZ.EQ.0 ) THEN WRITE ( NOUT, FMT = 99993 ) ELSE WRITE ( NOUT, FMT = 99992 ) N - NFZ WRITE ( NOUT, FMT = 99991 ) WRITE ( NOUT, FMT = 99990 ) DO 20 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 20 CONTINUE END IF END IF * Restore the matrices A and C. CALL DLACPY( 'Full', N, N, AS, LDA, A, LDA ) CALL DLACPY( 'Full', P, N, CS, LDC, C, LDC ) * Check the controllability and compute the ordered set of * the controllability indices (call the routine with P = 0) CALL AB08NW( EQUIL, N, M, 0, A, LDA, B, LDB, C, LDC, D, $ LDD, NFZ, NRANK, NIZ, DINFZ, NKROR, NINFE, $ NKROL, INFZ, KRONR, INFE, KRONL, E, LDE, $ TOL, IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99988 ) ( KRONR(I), I = 1,M ) IF ( NFZ.EQ.0 ) THEN WRITE ( NOUT, FMT = 99987 ) ELSE WRITE ( NOUT, FMT = 99986 ) N - NFZ WRITE ( NOUT, FMT = 99985 ) WRITE ( NOUT, FMT = 99990 ) DO 40 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 40 CONTINUE END IF END IF * Restore the matrices A and B. CALL DLACPY( 'Full', N, N, AS, LDA, A, LDA ) CALL DLACPY( 'Full', N, M, BS, LDB, B, LDB ) * Compute the structural invariants of the given system. CALL AB08NW( EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, D, $ LDD, NFZ, NRANK, NIZ, DINFZ, NKROR, NINFE, $ NKROL, INFZ, KRONR, INFE, KRONL, E, LDE, $ TOL, IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99984 ) NFZ IF ( NFZ.GT.0 ) THEN * Compute the invariant zeros of the given system. * Workspace: need 8*NFZ. WRITE ( NOUT, FMT = 99983 ) CALL DGEGV( 'No vectors', 'No vectors', NFZ, A, $ LDA, E, LDE, ALFR, ALFI, BETA, Q, $ LDQ, Z, LDZ, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99981 ) DO 60 I = 1, NFZ IF ( ALFI(I).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99980 ) $ ALFR(I)/BETA(I) ELSE WRITE ( NOUT, FMT = 99979 ) $ ALFR(I)/BETA(I), $ ALFI(I)/BETA(I) END IF 60 CONTINUE WRITE ( NOUT, FMT = 99982 ) END IF END IF WRITE ( NOUT, FMT = 99978 ) NIZ IF ( NIZ.GT.0 ) THEN DO 100 I = 1, DINFZ WRITE ( NOUT, FMT = 99977 ) INFZ(I), I 100 CONTINUE END IF WRITE ( NOUT, FMT = 99976 ) NKROR IF ( NKROR.GT.0 ) WRITE ( NOUT, FMT = 99975 ) $ ( KRONR(I), I = 1,NKROR ) WRITE ( NOUT, FMT = 99974 ) NKROL IF ( NKROL.GT.0 ) WRITE ( NOUT, FMT = 99973 ) $ ( KRONL(I), I = 1,NKROL ) IF ( NINFE.GT.0 ) WRITE ( NOUT, FMT = 99969 ) $ ( INFE(I), I = 1,NINFE ) END IF END IF END IF END IF * STOP * 99999 FORMAT (' AB08NW EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB08NW = ',I2) 99997 FORMAT (' INFO on exit from DGEGV = ',I2) 99994 FORMAT (' The left Kronecker indices of (A,C) are ',/(20(I3,2X))) 99993 FORMAT (/' The system (A,C) is completely observable ') 99992 FORMAT (/' The dimension of the observable subspace = ',I3) 99991 FORMAT (/' The output decoupling zeros are the eigenvalues of th', $ 'e matrix AF. ') 99990 FORMAT (/' The matrix AF is ') 99989 FORMAT (20(1X,F8.4)) 99988 FORMAT (//' The right Kronecker indices of (A,B) are ',/(20(I3,2X) $ )) 99987 FORMAT (/' The system (A,B) is completely controllable ') 99986 FORMAT (/' The dimension of the controllable subspace = ',I3) 99985 FORMAT (/' The input decoupling zeros are the eigenvalues of the', $ ' matrix AF. ') 99984 FORMAT (//' The number of finite invariant zeros = ',I3) 99983 FORMAT (/' The finite invariant zeros are ') 99982 FORMAT (/' which correspond to the generalized eigenvalues of (l', $ 'ambda*EF - AF).') 99981 FORMAT (/' real part imag part ') 99980 FORMAT (1X,F9.4) 99979 FORMAT (1X,F9.4,6X,F9.4) 99978 FORMAT (//' The number of infinite zeros = ',I3) 99977 FORMAT ( I4,' infinite zero(s) of order ',I3) 99976 FORMAT (/' The number of right Kronecker indices = ',I3) 99975 FORMAT (/' Right Kronecker (column) indices of (A,B,C,D) are ', $ /(20(I3,2X))) 99974 FORMAT (/' The number of left Kronecker indices = ',I3) 99973 FORMAT (/' The left Kronecker (row) indices of (A,B,C,D) are ', $ /(20(I3,2X))) 99972 FORMAT (/' N is out of range.',/' N = ',I5) 99971 FORMAT (/' M is out of range.',/' M = ',I5) 99970 FORMAT (/' P is out of range.',/' P = ',I5) 99969 FORMAT (/' Multiplicities of infinite eigenvalues',/(20(I3,2X))) ENDProgram Data
AB08NW EXAMPLE PROGRAM DATA 6 2 3 0.0 N 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 3.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0 3.0 0.0 -1.0 -1.0 0.0 1.0 -1.0 0.0 0.0 0.0 1.0 -1.0 -1.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0Program Results
AB08NW EXAMPLE PROGRAM RESULTS The left Kronecker indices of (A,C) are 1 2 2 The dimension of the observable subspace = 5 The output decoupling zeros are the eigenvalues of the matrix AF. The matrix AF is -1.0000 The right Kronecker indices of (A,B) are 2 3 The dimension of the controllable subspace = 5 The input decoupling zeros are the eigenvalues of the matrix AF. The matrix AF is -4.0000 The number of finite invariant zeros = 2 The finite invariant zeros are real part imag part 2.0000 -1.0000 which correspond to the generalized eigenvalues of (lambda*EF - AF). The number of infinite zeros = 2 2 infinite zero(s) of order 1 The number of right Kronecker indices = 0 The number of left Kronecker indices = 1 The left Kronecker (row) indices of (A,B,C,D) are 2 Multiplicities of infinite eigenvalues 2 2
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB08NX.html 0000664 0000000 0000000 00000015073 14560147231 0020360 0 ustar 00root root 0000000 0000000
Purpose
To extract from the (N+P)-by-(M+N) system ( B A ) ( D C ) an (NU+MU)-by-(M+NU) "reduced" system ( B' A') ( D' C') having the same transmission zeros but with D' of full row rank.Specification
SUBROUTINE AB08NX( N, M, P, RO, SIGMA, SVLMAX, ABCD, LDABCD, $ NINFZ, INFZ, KRONL, MU, NU, NKROL, TOL, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDABCD, LDWORK, M, MU, N, NINFZ, NKROL, $ NU, P, RO, SIGMA DOUBLE PRECISION SVLMAX, TOL C .. Array Arguments .. INTEGER INFZ(*), IWORK(*), KRONL(*) DOUBLE PRECISION ABCD(LDABCD,*), DWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The number of state variables. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. RO (input/output) INTEGER On entry, = P for the original system; = MAX(P-M, 0) for the pertransposed system. On exit, RO contains the last computed rank. SIGMA (input/output) INTEGER On entry, = 0 for the original system; = M for the pertransposed system. On exit, SIGMA contains the last computed value sigma in the algorithm. SVLMAX (input) DOUBLE PRECISION During each reduction step, the rank-revealing QR factorization of a matrix stops when the estimated minimum singular value is smaller than TOL * MAX(SVLMAX,EMSV), where EMSV is the estimated maximum singular value. SVLMAX >= 0. ABCD (input/output) DOUBLE PRECISION array, dimension (LDABCD,M+N) On entry, the leading (N+P)-by-(M+N) part of this array must contain the compound input matrix of the system. On exit, the leading (NU+MU)-by-(M+NU) part of this array contains the reduced compound input matrix of the system. LDABCD INTEGER The leading dimension of array ABCD. LDABCD >= MAX(1,N+P). NINFZ (input/output) INTEGER On entry, the currently computed number of infinite zeros. It should be initialized to zero on the first call. NINFZ >= 0. On exit, the number of infinite zeros. INFZ (input/output) INTEGER array, dimension (N) On entry, INFZ(i) must contain the current number of infinite zeros of degree i, where i = 1,2,...,N, found in the previous call(s) of the routine. It should be initialized to zero on the first call. On exit, INFZ(i) contains the number of infinite zeros of degree i, where i = 1,2,...,N. KRONL (input/output) INTEGER array, dimension (N+1) On entry, this array must contain the currently computed left Kronecker (row) indices found in the previous call(s) of the routine. It should be initialized to zero on the first call. On exit, the leading NKROL elements of this array contain the left Kronecker (row) indices. MU (output) INTEGER The normal rank of the transfer function matrix of the original system. NU (output) INTEGER The dimension of the reduced system matrix and the number of (finite) invariant zeros if D' is invertible. NKROL (output) INTEGER The number of left Kronecker indices.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. NOTE that when SVLMAX > 0, the estimated ranks could be less than those defined above (see SVLMAX).Workspace
IWORK INTEGER array, dimension (MAX(M,P)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, MIN(P,M) + MAX(3*M-1,N), MIN(P,N) + MAX(3*P-1,N+P,N+M) ). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Svaricek, F. Computation of the Structural Invariants of Linear Multivariable Systems with an Extended Version of the Program ZEROS. System & Control Letters, 6, pp. 261-266, 1985. [2] Emami-Naeini, A. and Van Dooren, P. Computation of Zeros of Linear Multivariable Systems. Automatica, 18, pp. 415-430, 1982.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To extract from the (N+P)-by-(M+N) system pencil ( B A-lambda*I ) ( D C ) an (NR+PR)-by-(M+NR) "reduced" system pencil, ( Br Ar-lambda*I ), ( Dr Cr ) having the same transmission zeros, but with Dr of full row rank.Specification
SUBROUTINE AB08NY( FIRST, N, M, P, SVLMAX, ABCD, LDABCD, NINFZ, $ NR, PR, DINFZ, NKRONL, INFZ, KRONL, TOL, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. LOGICAL FIRST INTEGER DINFZ, INFO, LDABCD, LDWORK, M, N, NINFZ, $ NKRONL, NR, P, PR DOUBLE PRECISION SVLMAX, TOL C .. Array Arguments .. INTEGER INFZ(*), IWORK(*), KRONL(*) DOUBLE PRECISION ABCD(LDABCD,*), DWORK(*)Arguments
Mode Parameters
FIRST LOGICAL Specifies if AB08NY is called first time, or it is called for an already reduced system, with D of full column rank, with the last M rows in upper triangular form: FIRST = .TRUE. : first time called; FIRST = .FALSE. : not first time called.Input/Output Parameters
N (input) INTEGER The number of rows of the matrix B, the number of columns of the matrix C, and the order of the square matrix A. N >= 0. M (input) INTEGER The number of columns of the matrices B and D. M >= 0. M <= P, if FIRST = .FALSE. P (input) INTEGER The number of rows of the matrices C and D. P >= 0. SVLMAX (input) DOUBLE PRECISION An estimate of the largest singular value of the original matrix ABCD (for instance, the Frobenius norm of ABCD). SVLMAX >= 0. ABCD (input/output) DOUBLE PRECISION array, dimension (LDABCD,M+N) On entry, the leading (N+P)-by-(M+N) part of this array must contain the compound matrix ( B A ), ( D C ) where A is an N-by-N matrix, B is an N-by-M matrix, C is a P-by-N matrix, and D is a P-by-M matrix. If FIRST = .FALSE., then D must be a full column rank matrix, with the last M rows in an upper triangular form. On exit, the leading (NR+PR)-by-(M+NR) part of this array contains the reduced compound matrix ( Br Ar ), ( Dr Cr ) where Ar is an NR-by-NR matrix, Br is an NR-by-M matrix, Cr is a PR-by-NR matrix, and Dr is a PR-by-M full row rank left upper-trapezoidal matrix, with the first PR columns in an upper triangular form. LDABCD INTEGER The leading dimension of the array ABCD. LDABCD >= MAX(1,N+P). NINFZ (input/output) INTEGER On entry, the currently computed number of infinite zeros. It should be initialized to zero on the first call. NINFZ >= 0. If FIRST = .FALSE., then NINFZ is not modified. On exit, the number of infinite zeros. NR (output) INTEGER The order of the reduced matrix Ar; also, the number of rows of the reduced matrix Br and the number of columns of the reduced matrix Cr. If Dr is invertible, NR is also the number of finite Smith zeros. PR (output) INTEGER The normal rank of the transfer-function matrix of the original system; also, the number of rows of the reduced matrices Cr and Dr. DINFZ (output) INTEGER The maximal multiplicity of infinite zeros. DINFZ = 0 if FIRST = .FALSE. . NKRONL (output) INTEGER The maximal dimension of left elementary Kronecker blocks. INFZ (output) INTEGER array, dimension (N) INFZ(i) contains the number of infinite zeros of degree i, where i = 1,2,...,DINFZ. INFZ is not referenced if FIRST = .FALSE. . KRONL (output) INTEGER array, dimension (N+1) KRONL(i) contains the number of left elementary Kronecker blocks of dimension i-by-(i-1), where i = 1,2,...,NKRONL.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. NOTE that when SVLMAX > 0, the estimated ranks could be less than those defined above (see SVLMAX). If the user sets TOL to be less than or equal to zero, then the tolerance is taken as (N+P)*(N+M)*EPS, where EPS is the machine precision (see LAPACK Library Routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (MAX(M,P)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if MIN(P, MAX(N,M)) = 0; otherwise, LDWORK >= MAX( MIN(P,M) + M + MAX(2*M,N) - 1, MIN(P,N) + MAX(N + MAX( P, M), 3*P - 1 ) ). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Svaricek, F. Computation of the Structural Invariants of Linear Multivariable Systems with an Extended Version of the Program ZEROS. System & Control Letters, 6, pp. 261-266, 1985. [2] Emami-Naeini, A. and Van Dooren, P. Computation of Zeros of Linear Multivariable Systems. Automatica, 18, pp. 415-430, 1982.Numerical Aspects
The algorithm is numerically backward stable and requires 0( (P+N)*(M+N)*N ) floating point operations.Further Comments
The number of infinite zeros is computed (if FIRST = .TRUE.) as DINFZ NINFZ = Sum (INFZ(i)*i . i=1 Note that each infinite zero of multiplicity k corresponds to an infinite eigenvalue of multiplicity k+1. The multiplicities of the infinite eigenvalues can be determined from PR, DINFZ and INFZ(i), i = 1, ..., DINFZ, as follows: DINFZ - there are PR - Sum (INFZ(i)) simple infinite eigenvalues; i=1 - there are INFZ(i) infinite eigenvalues with multiplicity i+1, for i = 1, ..., DINFZ. The left Kronecker indices are: [ 0 0 ... 0 | 1 1 ... 1 | .... | NKRONL ... NKRONL ] |<- KRONL(1) ->|<- KRONL(2) ->| |<- KRONL(NKRONL) ->|Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct for a linear multivariable system described by a state-space model (A,B,C,D) a regular pencil (A - lambda*B ) which f f has the invariant zeros of the system as generalized eigenvalues. The routine also computes the orders of the infinite zeros and the right and left Kronecker indices of the system (A,B,C,D).Specification
SUBROUTINE AB08NZ( EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ NU, RANK, DINFZ, NKROR, NKROL, INFZ, KRONR, $ KRONL, AF, LDAF, BF, LDBF, TOL, IWORK, DWORK, $ ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL INTEGER DINFZ, INFO, LDA, LDAF, LDB, LDBF, LDC, LDD, $ LZWORK, M, N, NKROL, NKROR, NU, P, RANK DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INFZ(*), IWORK(*), KRONL(*), KRONR(*) COMPLEX*16 A(LDA,*), AF(LDAF,*), B(LDB,*), BF(LDBF,*), $ C(LDC,*), D(LDD,*), ZWORK(*) DOUBLE PRECISION DWORK(*)Arguments
Mode Parameters
EQUIL CHARACTER*1 Specifies whether the user wishes to balance the compound matrix (see METHOD) as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
N (input) INTEGER The number of state variables, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input) COMPLEX*16 array, dimension (LDA,N) The leading N-by-N part of this array must contain the state dynamics matrix A of the system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) COMPLEX*16 array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B of the system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) COMPLEX*16 array, dimension (LDC,N) The leading P-by-N part of this array must contain the state/output matrix C of the system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) COMPLEX*16 array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct transmission matrix D of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NU (output) INTEGER The number of (finite) invariant zeros. RANK (output) INTEGER The normal rank of the transfer function matrix. DINFZ (output) INTEGER The maximum degree of infinite elementary divisors. NKROR (output) INTEGER The number of right Kronecker indices. NKROL (output) INTEGER The number of left Kronecker indices. INFZ (output) INTEGER array, dimension (N) The leading DINFZ elements of INFZ contain information on the infinite elementary divisors as follows: the system has INFZ(i) infinite elementary divisors of degree i, where i = 1,2,...,DINFZ. KRONR (output) INTEGER array, dimension (MAX(N,M)+1) The leading NKROR elements of this array contain the right Kronecker (column) indices. KRONL (output) INTEGER array, dimension (MAX(N,P)+1) The leading NKROL elements of this array contain the left Kronecker (row) indices. AF (output) COMPLEX*16 array, dimension (LDAF,N+MIN(P,M)) The leading NU-by-NU part of this array contains the coefficient matrix A of the reduced pencil. The remainder f of the leading (N+M)-by-(N+MIN(P,M)) part is used as internal workspace. LDAF INTEGER The leading dimension of array AF. LDAF >= MAX(1,N+M). BF (output) COMPLEX*16 array, dimension (LDBF,N+M) The leading NU-by-NU part of this array contains the coefficient matrix B of the reduced pencil. The f remainder of the leading (N+P)-by-(N+M) part is used as internal workspace. LDBF INTEGER The leading dimension of array BF. LDBF >= MAX(1,N+P).Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL to be less than SQRT((N+P)*(N+M))*EPS then the tolerance is taken as SQRT((N+P)*(N+M))*EPS, where EPS is the machine precision (see LAPACK Library Routine DLAMCH).Workspace
IWORK INTEGER array, dimension (MAX(M,P)) DWORK DOUBLE PRECISION array, dimension (MAX(N,2*MAX(P,M))) ZWORK DOUBLE PRECISION array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. LZWORK INTEGER The length of the array ZWORK. LZWORK >= MAX( 1, MIN(P,M) + MAX(3*M-1,N), MIN(P,N) + MAX(3*P-1,N+P,N+M), MIN(M,N) + MAX(3*M-1,N+M) ). An upper bound is MAX(s,N) + MAX(3*s-1,N+s), with s = MAX(M,P). For optimum performance LZWORK should be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine extracts from the system matrix of a state-space system (A,B,C,D) a regular pencil A - lambda*B which has the f f invariant zeros of the system as generalized eigenvalues as follows: (a) construct the (N+P)-by-(N+M) compound matrix (B A); (D C) (b) reduce the above system to one with the same invariant zeros and with D of full row rank; (c) pertranspose the system; (d) reduce the system to one with the same invariant zeros and with D square invertible; (e) perform a unitary transformation on the columns of (A - lambda*I B) in order to reduce it to ( C D) (A - lambda*B X) ( f f ), with Y and B square invertible; ( 0 Y) f (f) compute the right and left Kronecker indices of the system (A,B,C,D), which together with the orders of the infinite zeros (determined by steps (a) - (e)) constitute the complete set of structural invariants under strict equivalence transformations of a linear system.References
[1] Svaricek, F. Computation of the Structural Invariants of Linear Multivariable Systems with an Extended Version of the Program ZEROS. System & Control Letters, 6, pp. 261-266, 1985. [2] Emami-Naeini, A. and Van Dooren, P. Computation of Zeros of Linear Multivariable Systems. Automatica, 18, pp. 415-430, 1982.Numerical Aspects
The algorithm is backward stable (see [2] and [1]).Further Comments
In order to compute the invariant zeros of the system explicitly, a call to this routine may be followed by a call to the LAPACK Library routine ZGGEV with A = A , B = B and N = NU. f f If RANK = 0, the routine ZGEEV can be used (since B = I). fExample
Program Text
* AB08NZ EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 10, MMAX = 10, PMAX = 10 ) INTEGER MPMAX PARAMETER ( MPMAX = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC, LDD, LDAF, LDBF, LDQ, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDAF = NMAX+MPMAX, $ LDBF = NMAX+PMAX, LDQ = 1, LDZ = 1 ) INTEGER LDWORK PARAMETER ( LDWORK = 8*NMAX ) INTEGER LZWORK PARAMETER ( LZWORK = $ MAX( MIN( PMAX, MMAX ) + $ MAX( 3*MMAX - 1, NMAX ), $ MIN( PMAX, NMAX ) + $ MAX( 3*PMAX, NMAX+PMAX, NMAX+MMAX ), $ MIN( MMAX, NMAX ) + $ MAX( 3*MMAX, NMAX+MMAX ), 1 ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER DINFZ, I, INFO, J, M, N, NINFZ, NKROL, NKROR, $ NU, P, RANK CHARACTER*1 EQUIL * .. Local Arrays .. COMPLEX*16 A(LDA,NMAX), AF(LDAF,NMAX+PMAX), ALPHA(NMAX), $ B(LDB,MMAX), BETA(NMAX), BF(LDBF,MMAX+NMAX), $ C(LDC,NMAX), D(LDD,MMAX), Q(LDQ,1), Z(LDZ,1), $ ZWORK(LZWORK) DOUBLE PRECISION DWORK(LDWORK) INTEGER INFZ(NMAX), IWORK(MPMAX+1), KRONL(NMAX+1), $ KRONR(NMAX+1) * .. External Subroutines .. EXTERNAL AB08NZ, ZGEGV * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, EQUIL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99972 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99971 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99970 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Check the observability and compute the ordered set of * the observability indices (call the routine with M = 0). CALL AB08NZ( EQUIL, N, 0, P, A, LDA, B, LDB, C, LDC, D, $ LDD, NU, RANK, DINFZ, NKROR, NKROL, INFZ, $ KRONR, KRONL, AF, LDAF, BF, LDBF, TOL, $ IWORK, DWORK, ZWORK, LZWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) ( KRONL(I), I = 1,P ) IF ( NU.EQ.0 ) THEN WRITE ( NOUT, FMT = 99993 ) ELSE WRITE ( NOUT, FMT = 99992 ) N - NU WRITE ( NOUT, FMT = 99991 ) WRITE ( NOUT, FMT = 99990 ) DO 20 I = 1, NU WRITE ( NOUT, FMT = 99989 ) $ ( AF(I,J), J = 1,NU ) 20 CONTINUE END IF END IF * Check the controllability and compute the ordered set of * the controllability indices (call the routine with P = 0) CALL AB08NZ( EQUIL, N, M, 0, A, LDA, B, LDB, C, LDC, D, $ LDD, NU, RANK, DINFZ, NKROR, NKROL, INFZ, $ KRONR, KRONL, AF, LDAF, BF, LDBF, TOL, $ IWORK, DWORK, ZWORK, LZWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99988 ) ( KRONR(I), I = 1,M ) IF ( NU.EQ.0 ) THEN WRITE ( NOUT, FMT = 99987 ) ELSE WRITE ( NOUT, FMT = 99986 ) N - NU WRITE ( NOUT, FMT = 99985 ) WRITE ( NOUT, FMT = 99990 ) DO 40 I = 1, NU WRITE ( NOUT, FMT = 99989 ) $ ( AF(I,J), J = 1,NU ) 40 CONTINUE END IF END IF * Compute the structural invariants of the given system. CALL AB08NZ( EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, D, $ LDD, NU, RANK, DINFZ, NKROR, NKROL, INFZ, $ KRONR, KRONL, AF, LDAF, BF, LDBF, TOL, $ IWORK, DWORK, ZWORK, LZWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99984 ) NU IF ( NU.GT.0 ) THEN * Compute the invariant zeros of the given system. * Complex Workspace: need 2*NU. * Real Workspace: need 8*NU. WRITE ( NOUT, FMT = 99983 ) CALL ZGEGV( 'No vectors', 'No vectors', NU, AF, $ LDAF, BF, LDBF, ALPHA, BETA, Q, LDQ, $ Z, LDZ, ZWORK, LZWORK, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99981 ) DO 60 I = 1, NU WRITE ( NOUT, FMT = 99980 ) ALPHA(I)/BETA(I) 60 CONTINUE WRITE ( NOUT, FMT = 99982 ) END IF END IF NINFZ = 0 DO 80 I = 1, DINFZ IF ( INFZ(I).GT.0 ) THEN NINFZ = NINFZ + INFZ(I)*I END IF 80 CONTINUE WRITE ( NOUT, FMT = 99978 ) NINFZ IF ( NINFZ.GT.0 ) THEN DO 100 I = 1, DINFZ WRITE ( NOUT, FMT = 99977 ) INFZ(I), I 100 CONTINUE END IF WRITE ( NOUT, FMT = 99976 ) NKROR IF ( NKROR.GT.0 ) WRITE ( NOUT, FMT = 99975 ) $ ( KRONR(I), I = 1,NKROR ) WRITE ( NOUT, FMT = 99974 ) NKROL IF ( NKROL.GT.0 ) WRITE ( NOUT, FMT = 99973 ) $ ( KRONL(I), I = 1,NKROL ) END IF END IF END IF END IF * STOP * 99999 FORMAT (' AB08NZ EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB08NZ = ',I2) 99997 FORMAT (' INFO on exit from ZGEGV = ',I2) 99994 FORMAT (' The left Kronecker indices of (A,C) are ',/(20(I3,2X))) 99993 FORMAT (/' The system (A,C) is completely observable ') 99992 FORMAT (/' The dimension of the observable subspace = ',I3) 99991 FORMAT (/' The output decoupling zeros are the eigenvalues of th', $ 'e matrix AF. ') 99990 FORMAT (/' The matrix AF is ') 99989 FORMAT (20(1X,F9.4,SP,F9.4,S,'i ')) 99988 FORMAT (//' The right Kronecker indices of (A,B) are ',/(20(I3,2X) $ )) 99987 FORMAT (/' The system (A,B) is completely controllable ') 99986 FORMAT (/' The dimension of the controllable subspace = ',I3) 99985 FORMAT (/' The input decoupling zeros are the eigenvalues of the', $ ' matrix AF. ') 99984 FORMAT (//' The number of finite invariant zeros = ',I3) 99983 FORMAT (/' The finite invariant zeros are ') 99982 FORMAT (/' which correspond to the generalized eigenvalues of (l', $ 'ambda*BF - AF).') 99981 FORMAT (/' real part imag part ') 99980 FORMAT (1X,F9.4,SP,F9.4,S,'i ') 99978 FORMAT (//' The number of infinite zeros = ',I3) 99977 FORMAT ( I4,' infinite zero(s) of order ',I3) 99976 FORMAT (/' The number of right Kronecker indices = ',I3) 99975 FORMAT (/' Right Kronecker (column) indices of (A,B,C,D) are ', $ /(20(I3,2X))) 99974 FORMAT (/' The number of left Kronecker indices = ',I3) 99973 FORMAT (/' The left Kronecker (row) indices of (A,B,C,D) are ', $ /(20(I3,2X))) 99972 FORMAT (/' N is out of range.',/' N = ',I5) 99971 FORMAT (/' M is out of range.',/' M = ',I5) 99970 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
AB08NZ EXAMPLE PROGRAM DATA 6 2 3 0.0 N (1.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (1.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (3.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (-4.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (-1.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (3.0,0.0) (0.0,0.0) (-1.0,0.0) (-1.0,0.0) (0.0,0.0) (1.0,0.0) (-1.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (1.0,0.0) (-1.0,0.0) (-1.0,0.0) (1.0,0.0) (0.0,0.0) (0.0,0.0) (1.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (1.0,0.0) (0.0,0.0) (1.0,0.0) (0.0,0.0) (1.0,0.0) (0.0,0.0) (0.0,0.0) (1.0,0.0) (0.0,0.0) (0.0,0.0) (1.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0)Program Results
AB08NZ EXAMPLE PROGRAM RESULTS The left Kronecker indices of (A,C) are 1 2 2 The dimension of the observable subspace = 5 The output decoupling zeros are the eigenvalues of the matrix AF. The matrix AF is -1.0000 +0.0000i The right Kronecker indices of (A,B) are 2 3 The dimension of the controllable subspace = 5 The input decoupling zeros are the eigenvalues of the matrix AF. The matrix AF is -4.0000 +0.0000i The number of finite invariant zeros = 2 The finite invariant zeros are real part imag part 2.0000 +0.0000i -1.0000 +0.0000i which correspond to the generalized eigenvalues of (lambda*BF - AF). The number of infinite zeros = 2 The orders of the infinite zeros are 1 1 The number of right Kronecker indices = 0 The number of left Kronecker indices = 1 The left Kronecker (row) indices of (A,B,C,D) are 2
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09AD.html 0000664 0000000 0000000 00000034222 14560147231 0020315 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr) for a stable original state-space representation (A,B,C) by using either the square-root or the balancing-free square-root Balance & Truncate (B & T) model reduction method.Specification
SUBROUTINE AB09AD( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, A, LDA, $ B, LDB, C, LDC, HSV, TOL, IWORK, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOB, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDWORK, M, N, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root Balance & Truncate method; = 'N': use the balancing-free square-root Balance & Truncate method. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(NR,NMIN), where NR is the desired order on entry and NMIN is the order of a minimal realization of the given system; NMIN is determined as the number of Hankel singular values greater than N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(A,B,C) is the Hankel norm of the system (computed in HSV(1)); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL,N*EPS*HNORM(A,B,C)). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the Hankel singular values of the original system ordered decreasingly. HSV(1) is the Hankel norm of the system.Tolerances
TOL DOUBLE PRECISION If ORDSEL = 'A', TOL contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL = c*HNORM(A,B,C), where c is a constant in the interval [0.00001,0.001], and HNORM(A,B,C) is the Hankel-norm of the given system (computed in HSV(1)). For computing a minimal realization, the recommended value is TOL = N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH). This value is used by default if TOL <= 0 on entry. If ORDSEL = 'F', the value of TOL is ignored.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = 0, if JOB = 'B'; LIWORK = N, if JOB = 'N'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*(2*N+MAX(N,M,P)+5)+N*(N+1)/2). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than the order of a minimal realization of the given system. In this case, the resulting NR is set automatically to a value corresponding to the order of a minimal realization of the system.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to the real Schur form failed; = 2: the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D'); = 3: the computation of Hankel singular values failed.Method
Let be the stable linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09AD determines for the given system (1), the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) (2) such that HSV(NR) <= INFNORM(G-Gr) <= 2*[HSV(NR+1) + ... + HSV(N)], where G and Gr are transfer-function matrices of the systems (A,B,C) and (Ar,Br,Cr), respectively, and INFNORM(G) is the infinity-norm of G. If JOB = 'B', the square-root Balance & Truncate method of [1] is used and, for DICO = 'C', the resulting model is balanced. By setting TOL <= 0, the routine can be used to compute balanced minimal state-space realizations of stable systems. If JOB = 'N', the balancing-free square-root version of the Balance & Truncate method [2] is used. By setting TOL <= 0, the routine can be used to compute minimal state-space realizations of stable systems.References
[1] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987. [2] Varga A. Efficient minimal realization procedure based on balancing. Proc. of IMACS/IFAC Symp. MCTS, Lille, France, May 1991, A. El Moudui, P. Borne, S. G. Tzafestas (Eds.), Vol. 2, pp. 42-46.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* AB09AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( 2*NMAX + 5 + $ MAX( NMAX, MMAX, PMAX ) ) + $ ( NMAX*( NMAX + 1 ) )/2 ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, IWARN, J, M, N, NR, P CHARACTER*1 DICO, EQUIL, JOB, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, TOL, DICO, JOB, EQUIL, ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find a reduced ssr for (A,B,C). CALL AB09AD( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, $ A, LDA, B, LDB, C, LDC, HSV, TOL, IWORK, $ DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,N ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09AD = ',I2) 99997 FORMAT (' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values HSV are') ENDProgram Data
AB09AD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0 1.E-1 C N N A -0.04165 0.0000 4.9200 -4.9200 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 -0.5450 0.0000 0.0000 0.0000 0.0000 0.0000 4.9200 -0.04165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000Program Results
AB09AD EXAMPLE PROGRAM RESULTS The order of reduced model = 5 The Hankel singular values HSV are 2.5139 2.0846 1.9178 0.7666 0.5473 0.0253 0.0246 The reduced state dynamics matrix Ar is 1.3451 5.0399 0.0000 0.0000 4.5315 -4.0214 -3.6604 0.0000 0.0000 -0.9056 0.0000 0.0000 0.5124 1.7910 0.0000 0.0000 0.0000 -4.2167 -2.9900 0.0000 1.2402 1.6416 0.0000 0.0000 -0.0586 The reduced input/state matrix Br is -0.3857 0.3857 -3.1753 3.1753 -0.7447 -0.7447 -3.6872 -3.6872 1.8197 -1.8197 The reduced state/output matrix Cr is -0.6704 0.1828 -0.6582 0.2222 -0.0104 0.1089 0.4867 0.0000 0.0000 0.8651 0.6704 -0.1828 -0.6582 0.2222 0.0104
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09AX.html 0000664 0000000 0000000 00000023630 14560147231 0020342 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr) for a stable original state-space representation (A,B,C) by using either the square-root or the balancing-free square-root Balance & Truncate model reduction method. The state dynamics matrix A of the original system is an upper quasi-triangular matrix in real Schur canonical form. The matrices of the reduced order system are computed using the truncation formulas: Ar = TI * A * T , Br = TI * B , Cr = C * T .Specification
SUBROUTINE AB09AX( DICO, JOB, ORDSEL, N, M, P, NR, A, LDA, B, LDB, $ C, LDC, HSV, T, LDT, TI, LDTI, TOL, IWORK, $ DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOB, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDT, LDTI, LDWORK, $ M, N, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), HSV(*), $ T(LDT,*), TI(LDTI,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root Balance & Truncate method; = 'N': use the balancing-free square-root Balance & Truncate method. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(NR,NMIN), where NR is the desired order on entry and NMIN is the order of a minimal realization of the given system; NMIN is determined as the number of Hankel singular values greater than N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(A,B,C) is the Hankel norm of the system (computed in HSV(1)); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL,N*EPS*HNORM(A,B,C)). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A in a real Schur canonical form. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the Hankel singular values of the original system ordered decreasingly. HSV(1) is the Hankel norm of the system. T (output) DOUBLE PRECISION array, dimension (LDT,N) If INFO = 0 and NR > 0, the leading N-by-NR part of this array contains the right truncation matrix T. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N). TI (output) DOUBLE PRECISION array, dimension (LDTI,N) If INFO = 0 and NR > 0, the leading NR-by-N part of this array contains the left truncation matrix TI. LDTI INTEGER The leading dimension of array TI. LDTI >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION If ORDSEL = 'A', TOL contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL = c*HNORM(A,B,C), where c is a constant in the interval [0.00001,0.001], and HNORM(A,B,C) is the Hankel-norm of the given system (computed in HSV(1)). For computing a minimal realization, the recommended value is TOL = N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH). This value is used by default if TOL <= 0 on entry. If ORDSEL = 'F', the value of TOL is ignored.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = 0, if JOB = 'B', or LIWORK = N, if JOB = 'N'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*(MAX(N,M,P)+5) + N*(N+1)/2). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than the order of a minimal realization of the given system. In this case, the resulting NR is set automatically to a value corresponding to the order of a minimal realization of the system.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D'); = 2: the computation of Hankel singular values failed.Method
Let be the stable linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09AX determines for the given system (1), the matrices of a reduced NR order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) (2) such that HSV(NR) <= INFNORM(G-Gr) <= 2*[HSV(NR+1) + ... + HSV(N)], where G and Gr are transfer-function matrices of the systems (A,B,C) and (Ar,Br,Cr), respectively, and INFNORM(G) is the infinity-norm of G. If JOB = 'B', the square-root Balance & Truncate method of [1] is used and, for DICO = 'C', the resulting model is balanced. By setting TOL <= 0, the routine can be used to compute balanced minimal state-space realizations of stable systems. If JOB = 'N', the balancing-free square-root version of the Balance & Truncate method [2] is used. By setting TOL <= 0, the routine can be used to compute minimal state-space realizations of stable systems.References
[1] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987. [2] Varga A. Efficient minimal realization procedure based on balancing. Proc. of IMACS/IFAC Symp. MCTS, Lille, France, May 1991, A. El Moudui, P. Borne, S. G. Tzafestas (Eds.), Vol. 2, pp. 42-46.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for a stable original state-space representation (A,B,C,D) by using either the square-root or the balancing-free square-root Singular Perturbation Approximation (SPA) model reduction method.Specification
SUBROUTINE AB09BD( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, A, LDA, $ B, LDB, C, LDC, D, LDD, HSV, TOL1, TOL2, IWORK, $ DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOB, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDWORK, $ M, N, NR, P DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root SPA method; = 'N': use the balancing-free square-root SPA method. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(NR,NMIN), where NR is the desired order on entry and NMIN is the order of a minimal realization of the given system; NMIN is determined as the number of Hankel singular values greater than N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(A,B,C) is the Hankel norm of the system (computed in HSV(1)); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL1,N*EPS*HNORM(A,B,C)). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the Hankel singular values of the original system ordered decreasingly. HSV(1) is the Hankel norm of the system.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL1 = c*HNORM(A,B,C), where c is a constant in the interval [0.00001,0.001], and HNORM(A,B,C) is the Hankel-norm of the given system (computed in HSV(1)). For computing a minimal realization, the recommended value is TOL1 = N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH). This value is used by default if TOL1 <= 0 on entry. If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the given system. The recommended value is TOL2 = N*EPS*HNORM(A,B,C). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0, then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (MAX(1,2*N)) On exit with INFO = 0, IWORK(1) contains the order of the minimal realization of the system. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*(2*N+MAX(N,M,P)+5)+N*(N+1)/2). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than the order of a minimal realization of the given system. In this case, the resulting NR is set automatically to a value corresponding to the order of a minimal realization of the system.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to the real Schur form failed; = 2: the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D'); = 3: the computation of Hankel singular values failed.Method
Let be the stable linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09BD determines for the given system (1), the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t) (2) such that HSV(NR) <= INFNORM(G-Gr) <= 2*[HSV(NR+1) + ... + HSV(N)], where G and Gr are transfer-function matrices of the systems (A,B,C,D) and (Ar,Br,Cr,Dr), respectively, and INFNORM(G) is the infinity-norm of G. If JOB = 'B', the balancing-based square-root SPA method of [1] is used and the resulting model is balanced. If JOB = 'N', the balancing-free square-root SPA method of [2] is used. By setting TOL1 = TOL2, the routine can be used to compute Balance & Truncate approximations.References
[1] Liu Y. and Anderson B.D.O. Singular Perturbation Approximation of Balanced Systems, Int. J. Control, Vol. 50, pp. 1379-1405, 1989. [2] Varga A. Balancing-free square-root algorithm for computing singular perturbation approximations. Proc. 30-th IEEE CDC, Brighton, Dec. 11-13, 1991, Vol. 2, pp. 1062-1065.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* AB09BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 2*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( 2*NMAX + 5 + $ MAX( NMAX, MMAX, PMAX ) ) + $ ( NMAX*( NMAX + 1 ) )/2 ) * .. Local Scalars .. DOUBLE PRECISION TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, N, NR, P CHARACTER*1 DICO, EQUIL, JOB, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09BD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, TOL1, TOL2, DICO, JOB, EQUIL, $ ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find a reduced ssr for (A,B,C). CALL AB09BD( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, $ A, LDA, B, LDB, C, LDC, D, LDD, HSV, TOL1, $ TOL2, IWORK, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,N ) IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09BD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09BD = ',I2) 99997 FORMAT (' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values are') ENDProgram Data
AB09BD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0 1.E-1 1.E-14 C N N A -0.04165 0.0000 4.9200 -4.9200 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 -0.5450 0.0000 0.0000 0.0000 0.0000 0.0000 4.9200 -0.04165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
AB09BD EXAMPLE PROGRAM RESULTS The order of reduced model = 5 The Hankel singular values are 2.5139 2.0846 1.9178 0.7666 0.5473 0.0253 0.0246 The reduced state dynamics matrix Ar is 1.3960 5.1248 0.0000 0.0000 4.4331 -4.1411 -3.8605 0.0000 0.0000 -0.6738 0.0000 0.0000 0.5847 1.9230 0.0000 0.0000 0.0000 -4.3823 -3.2922 0.0000 1.3261 1.7851 0.0000 0.0000 -0.2249 The reduced input/state matrix Br is -0.2901 0.2901 -3.4004 3.4004 -0.6379 -0.6379 -3.9315 -3.9315 1.9813 -1.9813 The reduced state/output matrix Cr is -0.6570 0.2053 -0.6416 0.2526 -0.0364 0.1094 0.4875 0.0000 0.0000 0.8641 0.6570 -0.2053 -0.6416 0.2526 0.0364 The reduced input/output matrix Dr is 0.0498 -0.0007 0.0010 -0.0010 -0.0007 0.0498
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09BX.html 0000664 0000000 0000000 00000025142 14560147231 0020343 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for a stable original state-space representation (A,B,C,D) by using either the square-root or the balancing-free square-root Singular Perturbation Approximation (SPA) model reduction method. The state dynamics matrix A of the original system is an upper quasi-triangular matrix in real Schur canonical form. The matrices of a minimal realization are computed using the truncation formulas: Am = TI * A * T , Bm = TI * B , Cm = C * T . (1) Am, Bm, Cm and D serve further for computing the SPA of the given system.Specification
SUBROUTINE AB09BX( DICO, JOB, ORDSEL, N, M, P, NR, A, LDA, B, LDB, $ C, LDC, D, LDD, HSV, T, LDT, TI, LDTI, TOL1, $ TOL2, IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOB, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDT, LDTI, $ LDWORK, M, N, NR, P DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*), T(LDT,*), TI(LDTI,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root SPA method; = 'N': use the balancing-free square-root SPA method. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(NR,NMIN), where NR is the desired order on entry and NMIN is the order of a minimal realization of the given system; NMIN is determined as the number of Hankel singular values greater than N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(A,B,C) is the Hankel norm of the system (computed in HSV(1)); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL1,N*EPS*HNORM(A,B,C)). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A in a real Schur canonical form. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the Hankel singular values of the original system ordered decreasingly. HSV(1) is the Hankel norm of the system. T (output) DOUBLE PRECISION array, dimension (LDT,N) If INFO = 0 and NR > 0, the leading N-by-NR part of this array contains the right truncation matrix T in (1). LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N). TI (output) DOUBLE PRECISION array, dimension (LDTI,N) If INFO = 0 and NR > 0, the leading NR-by-N part of this array contains the left truncation matrix TI in (1). LDTI INTEGER The leading dimension of array TI. LDTI >= MAX(1,N).Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL1 = c*HNORM(A,B,C), where c is a constant in the interval [0.00001,0.001], and HNORM(A,B,C) is the Hankel-norm of the given system (computed in HSV(1)). For computing a minimal realization, the recommended value is TOL1 = N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH). This value is used by default if TOL1 <= 0 on entry. If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the given system. The recommended value is TOL2 = N*EPS*HNORM(A,B,C). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0, then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (MAX(1,2*N)) On exit with INFO = 0, IWORK(1) contains the order of the minimal realization of the system. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*(MAX(N,M,P)+5) + N*(N+1)/2). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than the order of a minimal realization of the given system. In this case, the resulting NR is set automatically to a value corresponding to the order of a minimal realization of the system.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D'); = 2: the computation of Hankel singular values failed.Method
Let be the stable linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t) (2) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09BX determines for the given system (1), the matrices of a reduced NR order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t) (3) such that HSV(NR) <= INFNORM(G-Gr) <= 2*[HSV(NR+1) + ... + HSV(N)], where G and Gr are transfer-function matrices of the systems (A,B,C,D) and (Ar,Br,Cr,Dr), respectively, and INFNORM(G) is the infinity-norm of G. If JOB = 'B', the balancing-based square-root SPA method of [1] is used and the resulting model is balanced. If JOB = 'N', the balancing-free square-root SPA method of [2] is used. By setting TOL1 = TOL2, the routine can be also used to compute Balance & Truncate approximations.References
[1] Liu Y. and Anderson B.D.O. Singular Perturbation Approximation of Balanced Systems, Int. J. Control, Vol. 50, pp. 1379-1405, 1989. [2] Varga A. Balancing-free square-root algorithm for computing singular perturbation approximations. Proc. 30-th IEEE CDC, Brighton, Dec. 11-13, 1991, Vol. 2, pp. 1062-1065.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for a stable original state-space representation (A,B,C,D) by using the optimal Hankel-norm approximation method in conjunction with square-root balancing.Specification
SUBROUTINE AB09CD( DICO, EQUIL, ORDSEL, N, M, P, NR, A, LDA, B, $ LDB, C, LDC, D, LDD, HSV, TOL1, TOL2, IWORK, $ DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDWORK, $ M, N, NR, P DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(MAX(0,NR-KR+1),NMIN), where KR is the multiplicity of the Hankel singular value HSV(NR+1), NR is the desired order on entry, and NMIN is the order of a minimal realization of the given system; NMIN is determined as the number of Hankel singular values greater than N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(A,B,C) is the Hankel norm of the system (computed in HSV(1)); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL1,N*EPS*HNORM(A,B,C)). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system in a real Schur form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the Hankel singular values of the original system ordered decreasingly. HSV(1) is the Hankel norm of the system.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL1 = c*HNORM(A,B,C), where c is a constant in the interval [0.00001,0.001], and HNORM(A,B,C) is the Hankel-norm of the given system (computed in HSV(1)). For computing a minimal realization, the recommended value is TOL1 = N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH). This value is used by default if TOL1 <= 0 on entry. If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the given system. The recommended value is TOL2 = N*EPS*HNORM(A,B,C). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0, then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = MAX(1,M), if DICO = 'C'; LIWORK = MAX(1,N,M), if DICO = 'D'. On exit, if INFO = 0, IWORK(1) contains NMIN, the order of the computed minimal realization. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( LDW1, LDW2 ), where LDW1 = N*(2*N+MAX(N,M,P)+5) + N*(N+1)/2, LDW2 = N*(M+P+2) + 2*M*P + MIN(N,M) + MAX( 3*M+1, MIN(N,M)+P ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than the order of a minimal realization of the given system. In this case, the resulting NR is set automatically to a value corresponding to the order of a minimal realization of the system.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to the real Schur form failed; = 2: the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D'); = 3: the computation of Hankel singular values failed; = 4: the computation of stable projection failed; = 5: the order of computed stable projection differs from the order of Hankel-norm approximation.Method
Let be the stable linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09CD determines for the given system (1), the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t) (2) such that HSV(NR) <= INFNORM(G-Gr) <= 2*[HSV(NR+1) + ... + HSV(N)], where G and Gr are transfer-function matrices of the systems (A,B,C,D) and (Ar,Br,Cr,Dr), respectively, and INFNORM(G) is the infinity-norm of G. The optimal Hankel-norm approximation method of [1], based on the square-root balancing projection formulas of [2], is employed.References
[1] Glover, K. All optimal Hankel norm approximation of linear multivariable systems and their L-infinity error bounds. Int. J. Control, Vol. 36, pp. 1145-1193, 1984. [2] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987.Numerical Aspects
The implemented methods rely on an accuracy enhancing square-root technique. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* AB09CD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( NMAX, MMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX*( 2*NMAX + $ MAX( NMAX, MMAX, PMAX ) + 5 ) + $ ( NMAX*( NMAX + 1 ) )/2, $ NMAX*( MMAX + PMAX + 2 ) + $ 2*MMAX*PMAX + $ MIN( NMAX, MMAX ) + MAX( 3*MMAX + 1, $ MIN( NMAX, MMAX ) + PMAX ) ) ) * .. Local Scalars .. DOUBLE PRECISION TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, N, NR, P CHARACTER*1 DICO, EQUIL, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09CD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, TOL1, TOL2, DICO, EQUIL, ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find a reduced ssr for (A,B,C). CALL AB09CD( DICO, EQUIL, ORDSEL, N, M, P, NR, $ A, LDA, B, LDB, C, LDC, D, LDD, HSV, TOL1, $ TOL2, IWORK, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,N ) IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09CD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09CD = ',I2) 99997 FORMAT (' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values are') ENDProgram Data
AB09CD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0 1.E-1 1.E-14 C N A -0.04165 0.0000 4.9200 -4.9200 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 -0.5450 0.0000 0.0000 0.0000 0.0000 0.0000 4.9200 -0.04165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
AB09CD EXAMPLE PROGRAM RESULTS The order of reduced model = 5 The Hankel singular values are 2.5139 2.0846 1.9178 0.7666 0.5473 0.0253 0.0246 The reduced state dynamics matrix Ar is -0.5038 -5.3070 -3.2250 0.0000 0.0000 1.8355 -0.5038 -2.6289 0.0000 0.0000 0.0000 0.0000 -1.5171 0.0000 0.0000 0.0000 0.0000 0.0000 -1.2925 -9.0718 0.0000 0.0000 0.0000 0.5047 -1.2925 The reduced input/state matrix Br is -1.5343 1.5343 -0.3614 0.3614 -1.1096 1.1096 -4.5325 -4.5325 -0.7396 -0.7396 The reduced state/output matrix Cr is 1.8971 -0.3055 -2.1124 0.4421 -2.1023 -0.0394 1.1112 -0.3119 0.0000 0.0000 -1.8971 0.3055 2.1124 0.4421 -2.1023 The reduced input/output matrix Dr is 0.0126 -0.0126 0.0005 -0.0005 -0.0126 0.0126
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09CX.html 0000664 0000000 0000000 00000023523 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for a stable original state-space representation (A,B,C,D) by using the optimal Hankel-norm approximation method in conjunction with square-root balancing. The state dynamics matrix A of the original system is an upper quasi-triangular matrix in real Schur canonical form.Specification
SUBROUTINE AB09CX( DICO, ORDSEL, N, M, P, NR, A, LDA, B, LDB, $ C, LDC, D, LDD, HSV, TOL1, TOL2, IWORK, $ DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDWORK, $ M, N, NR, P DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(MAX(0,NR-KR+1),NMIN), where KR is the multiplicity of the Hankel singular value HSV(NR+1), NR is the desired order on entry, and NMIN is the order of a minimal realization of the given system; NMIN is determined as the number of Hankel singular values greater than N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(A,B,C) is the Hankel norm of the system (computed in HSV(1)); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL1,N*EPS*HNORM(A,B,C)). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A in a real Schur canonical form. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system in a real Schur form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the Hankel singular values of the original system ordered decreasingly. HSV(1) is the Hankel norm of the system.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL1 = c*HNORM(A,B,C), where c is a constant in the interval [0.00001,0.001], and HNORM(A,B,C) is the Hankel-norm of the given system (computed in HSV(1)). For computing a minimal realization, the recommended value is TOL1 = N*EPS*HNORM(A,B,C), where EPS is the machine precision (see LAPACK Library Routine DLAMCH). This value is used by default if TOL1 <= 0 on entry. If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the given system. The recommended value is TOL2 = N*EPS*HNORM(A,B,C). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0, then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = MAX(1,M), if DICO = 'C'; LIWORK = MAX(1,N,M), if DICO = 'D'. On exit, if INFO = 0, IWORK(1) contains NMIN, the order of the computed minimal realization. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( LDW1,LDW2 ), where LDW1 = N*(2*N+MAX(N,M,P)+5) + N*(N+1)/2, LDW2 = N*(M+P+2) + 2*M*P + MIN(N,M) + MAX( 3*M+1, MIN(N,M)+P ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than the order of a minimal realization of the given system. In this case, the resulting NR is set automatically to a value corresponding to the order of a minimal realization of the system.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D'); = 2: the computation of Hankel singular values failed; = 3: the computation of stable projection failed; = 4: the order of computed stable projection differs from the order of Hankel-norm approximation.Method
Let be the stable linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09CX determines for the given system (1), the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t) (2) such that HSV(NR) <= INFNORM(G-Gr) <= 2*[HSV(NR+1) + ... + HSV(N)], where G and Gr are transfer-function matrices of the systems (A,B,C,D) and (Ar,Br,Cr,Dr), respectively, and INFNORM(G) is the infinity-norm of G. The optimal Hankel-norm approximation method of [1], based on the square-root balancing projection formulas of [2], is employed.References
[1] Glover, K. All optimal Hankel norm approximation of linear multivariable systems and their L-infinity error bounds. Int. J. Control, Vol. 36, pp. 1145-1193, 1984. [2] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987.Numerical Aspects
The implemented methods rely on an accuracy enhancing square-root technique. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a reduced order model by using singular perturbation approximation formulas.Specification
SUBROUTINE AB09DD( DICO, N, M, P, NR, A, LDA, B, LDB, C, LDC, $ D, LDD, RCOND, IWORK, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO INTEGER INFO, LDA, LDB, LDC, LDD, M, N, NR, P DOUBLE PRECISION RCOND C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), DWORK(*) INTEGER IWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system.Input/Output Parameters
N (input) INTEGER The dimension of the state vector, i.e. the order of the matrix A; also the number of rows of matrix B and the number of columns of the matrix C. N >= 0. M (input) INTEGER The dimension of input vector, i.e. the number of columns of matrices B and D. M >= 0. P (input) INTEGER The dimension of output vector, i.e. the number of rows of matrices C and D. P >= 0. NR (input) INTEGER The order of the reduced order system. N >= NR >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix of the original system. On exit, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix of the original system. On exit, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix of the original system. On exit, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the input/output matrix of the original system. On exit, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. If NR = 0 and the given system is stable, then D contains the steady state gain of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). RCOND (output) DOUBLE PRECISION The reciprocal condition number of the matrix A22-g*I (see METHOD).Workspace
IWORK INTEGER array, dimension (2*(N-NR)) DWORK DOUBLE PRECISION array, dimension (4*(N-NR))Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix A22-g*I (see METHOD) is numerically singular.Method
Given the system (A,B,C,D), partition the system matrices as ( A11 A12 ) ( B1 ) A = ( ) , B = ( ) , C = ( C1 C2 ), ( A21 A22 ) ( B2 ) where A11 is NR-by-NR, B1 is NR-by-M, C1 is P-by-NR, and the other submatrices have appropriate dimensions. The matrices of the reduced order system (Ar,Br,Cr,Dr) are computed according to the following residualization formulas: -1 -1 Ar = A11 + A12*(g*I-A22) *A21 , Br = B1 + A12*(g*I-A22) *B2 -1 -1 Cr = C1 + C2*(g*I-A22) *A21 , Dr = D + C2*(g*I-A22) *B2 where g = 0 if DICO = 'C' and g = 1 if DICO = 'D'.Further Comments
NoneExample
Program Text
* AB09DD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 2*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 4*NMAX ) * .. Local Scalars .. DOUBLE PRECISION RCOND INTEGER I, INFO, J, M, N, NR, P CHARACTER*1 DICO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09DD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, DICO IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find a reduced ssr for (A,B,C). CALL AB09DD( DICO, N, M, P, NR, A, LDA, B, LDB, C, LDC, $ D, LDD, RCOND, IWORK, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) RCOND IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09DD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09DD = ',I2) 99997 FORMAT (' The computed reciprocal condition number = ',1PD12.5) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
AB09DD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 5 C -0.04165 4.9200 -4.9200 0 0 0 0 0 -3.3300 0 0 0 3.3300 0 0.5450 0 0 -0.5450 0 0 0 0 0 4.9200 -0.04165 4.9200 0 0 0 0 0 0 -3.3300 0 3.3300 -5.2100 0 0 0 0 -12.5000 0 0 0 0 -5.2100 0 0 -12.5000 0 0 0 0 0 0 0 0 0 0 12.5000 0 0 12.5000 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0Program Results
AB09DD EXAMPLE PROGRAM RESULTS The computed reciprocal condition number = 1.00000D+00 The reduced state dynamics matrix Ar is -0.0416 4.9200 -4.9200 0.0000 0.0000 -1.3879 -3.3300 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 -0.5450 0.0000 0.0000 0.0000 4.9200 -0.0416 4.9200 0.0000 0.0000 0.0000 -1.3879 -3.3300 The reduced input/state matrix Br is 0.0000 0.0000 3.3300 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 The reduced state/output matrix Cr is 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 The reduced input/output matrix Dr is 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09ED.html 0000664 0000000 0000000 00000044643 14560147231 0020331 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for an original state-space representation (A,B,C,D) by using the optimal Hankel-norm approximation method in conjunction with square-root balancing for the ALPHA-stable part of the system.Specification
SUBROUTINE AB09ED( DICO, EQUIL, ORDSEL, N, M, P, NR, ALPHA, $ A, LDA, B, LDB, C, LDC, D, LDD, NS, HSV, TOL1, $ TOL2, IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDWORK, $ M, N, NR, NS, P DOUBLE PRECISION ALPHA, TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), NR is set as follows: if ORDSEL = 'F', NR is equal to NU+MIN(MAX(0,NR-NU-KR+1),NMIN), where KR is the multiplicity of the Hankel singular value HSV(NR-NU+1), NR is the desired order on entry, and NMIN is the order of a minimal realization of the ALPHA-stable part of the given system; NMIN is determined as the number of Hankel singular values greater than NS*EPS*HNORM(As,Bs,Cs), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(As,Bs,Cs) is the Hankel norm of the ALPHA-stable part of the given system (computed in HSV(1)); if ORDSEL = 'A', NR is the sum of NU and the number of Hankel singular values greater than MAX(TOL1,NS*EPS*HNORM(As,Bs,Cs)). ALPHA (input) DOUBLE PRECISION Specifies the ALPHA-stability boundary for the eigenvalues of the state dynamics matrix A. For a continuous-time system (DICO = 'C'), ALPHA <= 0 is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), 0 <= ALPHA <= 1 represents the boundary value for the moduli of eigenvalues. The ALPHA-stability domain does not include the boundary. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system in a real Schur form. The resulting A has a block-diagonal form with two blocks. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), the leading NU-by-NU block contains the unreduced part of A corresponding to ALPHA-unstable eigenvalues. The trailing (NR+NS-N)-by-(NR+NS-N) block contains the reduced part of A corresponding to ALPHA-stable eigenvalues. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NS (output) INTEGER The dimension of the ALPHA-stable subsystem. HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, the leading NS elements of HSV contain the Hankel singular values of the ALPHA-stable part of the original system ordered decreasingly. HSV(1) is the Hankel norm of the ALPHA-stable subsystem.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL1 = c*HNORM(As,Bs,Cs), where c is a constant in the interval [0.00001,0.001], and HNORM(As,Bs,Cs) is the Hankel-norm of the ALPHA-stable part of the given system (computed in HSV(1)). If TOL1 <= 0 on entry, the used default value is TOL1 = NS*EPS*HNORM(As,Bs,Cs), where NS is the number of ALPHA-stable eigenvalues of A and EPS is the machine precision (see LAPACK Library Routine DLAMCH). This value is appropriate to compute a minimal realization of the ALPHA-stable part. If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the ALPHA-stable part of the given system. The recommended value is TOL2 = NS*EPS*HNORM(As,Bs,Cs). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0, then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = MAX(1,M), if DICO = 'C'; LIWORK = MAX(1,N,M), if DICO = 'D'. On exit, if INFO = 0, IWORK(1) contains NMIN, the order of the computed minimal realization. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( LDW1, LDW2 ), where LDW1 = N*(2*N + MAX(N,M,P) + 5) + N*(N+1)/2, LDW2 = N*(M+P+2) + 2*M*P + MIN(N,M) + MAX( 3*M+1, MIN(N,M)+P ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than NSMIN, the sum of the order of the ALPHA-unstable part and the order of a minimal realization of the ALPHA-stable part of the given system. In this case, the resulting NR is set equal to NSMIN. = 2: with ORDSEL = 'F', the selected order NR is less than the order of the ALPHA-unstable part of the given system. In this case NR is set equal to the order of the ALPHA-unstable part.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the computation of the ordered real Schur form of A failed; = 2: the separation of the ALPHA-stable/unstable diagonal blocks failed because of very close eigenvalues; = 3: the computed ALPHA-stable part is just stable, having stable eigenvalues very near to the imaginary axis (if DICO = 'C') or to the unit circle (if DICO = 'D'); = 4: the computation of Hankel singular values failed; = 5: the computation of stable projection in the Hankel-norm approximation algorithm failed; = 6: the order of computed stable projection in the Hankel-norm approximation algorithm differs from the order of Hankel-norm approximation.Method
Let be the following linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09ED determines for the given system (1), the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t) (2) such that HSV(NR+NS-N) <= INFNORM(G-Gr) <= 2*[HSV(NR+NS-N+1)+...+HSV(NS)], where G and Gr are transfer-function matrices of the systems (A,B,C,D) and (Ar,Br,Cr,Dr), respectively, and INFNORM(G) is the infinity-norm of G. The following procedure is used to reduce a given G: 1) Decompose additively G as G = G1 + G2 such that G1 = (As,Bs,Cs,D) has only ALPHA-stable poles and G2 = (Au,Bu,Cu,0) has only ALPHA-unstable poles. 2) Determine G1r, a reduced order approximation of the ALPHA-stable part G1. 3) Assemble the reduced model Gr as Gr = G1r + G2. To reduce the ALPHA-stable part G1, the optimal Hankel-norm approximation method of [1], based on the square-root balancing projection formulas of [2], is employed.References
[1] Glover, K. All optimal Hankel norm approximation of linear multivariable systems and their L-infinity error bounds. Int. J. Control, Vol. 36, pp. 1145-1193, 1984. [2] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987.Numerical Aspects
The implemented methods rely on an accuracy enhancing square-root technique. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* AB09ED EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( NMAX, MMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX*( 2*NMAX + $ MAX( NMAX, MMAX, PMAX ) + $ 5 ) + ( NMAX*( NMAX + 1 ) )/2, $ NMAX*( MMAX + PMAX + 2 ) + $ 2*MMAX*PMAX + MIN( NMAX, MMAX ) + $ MAX( 3*MMAX + 1, $ MIN( NMAX, MMAX ) + $ PMAX ) ) ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, N, NR, NS, P CHARACTER*1 DICO, EQUIL, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09ED * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, ALPHA, TOL1, TOL2, $ DICO, EQUIL, ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find a reduced ssr for (A,B,C,D). CALL AB09ED( DICO, EQUIL, ORDSEL, N, M, P, NR, ALPHA, $ A, LDA, B, LDB, C, LDC, D, LDD, NS, HSV, $ TOL1, TOL2, IWORK, DWORK, LDWORK, $ IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1, NS ) IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09ED EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09ED = ',I2) 99997 FORMAT (' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of ALPHA-stable part are') ENDProgram Data
AB09ED EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0 -0.6D0 1.E-1 1.E-14 C N A -0.04165 0.0000 4.9200 -4.9200 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 -0.5450 0.0000 0.0000 0.0000 0.0000 0.0000 4.9200 -0.04165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
AB09ED EXAMPLE PROGRAM RESULTS The order of reduced model = 5 The Hankel singular values of ALPHA-stable part are 1.9178 0.8621 0.7666 0.0336 0.0246 The reduced state dynamics matrix Ar is -0.5181 -1.1084 0.0000 0.0000 0.0000 8.8157 -0.5181 0.0000 0.0000 0.0000 0.0000 0.0000 -1.2769 7.3264 0.0000 0.0000 0.0000 -0.6203 -1.2769 0.0000 0.0000 0.0000 0.0000 0.0000 -1.5496 The reduced input/state matrix Br is -1.2837 1.2837 -0.7522 0.7522 3.2016 3.2016 -0.7640 -0.7640 1.3415 -1.3415 The reduced state/output matrix Cr is -0.1380 -0.6445 -0.6247 -2.0857 -0.8964 0.6246 0.0196 0.0000 0.0000 0.6131 0.1380 0.6445 -0.6247 -2.0857 0.8964 The reduced input/output matrix Dr is 0.0168 -0.0168 0.0008 -0.0008 -0.0168 0.0168
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09FD.html 0000664 0000000 0000000 00000045240 14560147231 0020324 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr) for an original state-space representation (A,B,C) by using either the square-root or the balancing-free square-root Balance & Truncate (B & T) model reduction method in conjunction with stable coprime factorization techniques.Specification
SUBROUTINE AB09FD( DICO, JOBCF, FACT, JOBMR, EQUIL, ORDSEL, N, M, $ P, NR, ALPHA, A, LDA, B, LDB, C, LDC, NQ, HSV, $ TOL1, TOL2, IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, FACT, JOBCF, JOBMR, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDWORK, M, N, NQ, $ NR, P DOUBLE PRECISION ALPHA, TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBCF CHARACTER*1 Specifies whether left or right coprime factorization is to be used as follows: = 'L': use left coprime factorization; = 'R': use right coprime factorization. FACT CHARACTER*1 Specifies the type of coprime factorization to be computed as follows: = 'S': compute a coprime factorization with prescribed stability degree ALPHA; = 'I': compute a coprime factorization with inner denominator. JOBMR CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root Balance & Truncate method; = 'N': use the balancing-free square-root Balance & Truncate method. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(NR,NQ,NMIN), where NR is the desired order on entry, NQ is the order of the computed coprime factorization of the given system, and NMIN is the order of a minimal realization of the extended system (see METHOD); NMIN is determined as the number of Hankel singular values greater than NQ*EPS*HNORM(Ge), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(Ge) is the Hankel norm of the extended system (computed in HSV(1)); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL1,NQ*EPS*HNORM(Ge)). ALPHA (input) DOUBLE PRECISION If FACT = 'S', the desired stability degree for the factors of the coprime factorization (see SLICOT Library routines SB08ED/SB08FD). ALPHA < 0 for a continuous-time system (DICO = 'C'), and 0 <= ALPHA < 1 for a discrete-time system (DICO = 'D'). If FACT = 'I', ALPHA is not used. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). NQ (output) INTEGER The order of the computed extended system Ge (see METHOD). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the NQ Hankel singular values of the extended system Ge ordered decreasingly (see METHOD).Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced extended system. For model reduction, the recommended value is TOL1 = c*HNORM(Ge), where c is a constant in the interval [0.00001,0.001], and HNORM(Ge) is the Hankel-norm of the extended system (computed in HSV(1)). The value TOL1 = NQ*EPS*HNORM(Ge) is used by default if TOL1 <= 0 on entry, where EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The absolute tolerance level below which the elements of B or C are considered zero (used for controllability or observability tests). If the user sets TOL2 <= 0, then an implicitly computed, default tolerance TOLDEF is used: TOLDEF = N*EPS*NORM(C'), if JOBCF = 'L', or TOLDEF = N*EPS*NORM(B), if JOBCF = 'R', where EPS is the machine precision, and NORM(.) denotes the 1-norm of a matrix.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = PM, if JOBMR = 'B', LIWORK = MAX(N,PM), if JOBMR = 'N', where PM = P, if JOBCF = 'L', PM = M, if JOBCF = 'R'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,LW1) if JOBCF = 'L' and FACT = 'S', LDWORK >= MAX(1,LW2) if JOBCF = 'L' and FACT = 'I', LDWORK >= MAX(1,LW3) if JOBCF = 'R' and FACT = 'S', LDWORK >= MAX(1,LW4) if JOBCF = 'R' and FACT = 'I', where LW1 = N*(2*MAX(M,P) + P) + MAX(M,P)*(MAX(M,P) + P) + MAX( N*P+MAX(N*(N+5), 5*P, 4*M), LWR ), LW2 = N*(2*MAX(M,P) + P) + MAX(M,P)*(MAX(M,P) + P) + MAX( N*P+MAX(N*(N+5), P*(P+2), 4*P, 4*M), LWR ), LW3 = (N+M)*(M+P) + MAX( 5*M, 4*P, LWR ), LW4 = (N+M)*(M+P) + MAX( M*(M+2), 4*M, 4*P, LWR ), and LWR = 2*N*N + N*(MAX(N,M+P)+5) + N*(N+1)/2. For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 10*K+I: I = 1: with ORDSEL = 'F', the selected order NR is greater than the order of the computed coprime factorization of the given system. In this case, the resulting NR is set automatically to a value corresponding to the order of a minimal realization of the system; K > 0: K violations of the numerical stability condition occured when computing the coprime factorization using pole assignment (see SLICOT Library routines SB08CD/SB08ED, SB08DD/SB08FD).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to a real Schur form failed; = 2: a failure was detected during the ordering of the real Schur form of A, or in the iterative process for reordering the eigenvalues of Z'*(A + H*C)*Z (or Z'*(A + B*F)*Z) along the diagonal; see SLICOT Library routines SB08CD/SB08ED (or SB08DD/SB08FD); = 3: the matrix A has an observable or controllable eigenvalue on the imaginary axis if DICO = 'C' or on the unit circle if DICO = 'D'; = 4: the computation of Hankel singular values failed.Method
Let be the linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system, and let G be the corresponding transfer-function matrix. The subroutine AB09FD determines the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) (2) with the transfer-function matrix Gr, by using the balanced-truncation model reduction method in conjunction with a left coprime factorization (LCF) or a right coprime factorization (RCF) technique: 1. Compute the appropriate stable coprime factorization of G: -1 -1 G = R *Q (LCF) or G = Q*R (RCF). 2. Perform the model reduction algorithm on the extended system ( Q ) Ge = ( Q R ) (LCF) or Ge = ( R ) (RCF) to obtain a reduced extended system with reduced factors ( Qr ) Ger = ( Qr Rr ) (LCF) or Ger = ( Rr ) (RCF). 3. Recover the reduced system from the reduced factors as -1 -1 Gr = Rr *Qr (LCF) or Gr = Qr*Rr (RCF). The approximation error for the extended system satisfies HSV(NR) <= INFNORM(Ge-Ger) <= 2*[HSV(NR+1) + ... + HSV(NQ)], where INFNORM(G) is the infinity-norm of G. If JOBMR = 'B', the square-root Balance & Truncate method of [1] is used for model reduction. If JOBMR = 'N', the balancing-free square-root version of the Balance & Truncate method [2] is used for model reduction. If FACT = 'S', the stable coprime factorization with prescribed stability degree ALPHA is computed by using the algorithm of [3]. If FACT = 'I', the stable coprime factorization with inner denominator is computed by using the algorithm of [4].References
[1] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987. [2] Varga A. Efficient minimal realization procedure based on balancing. Proc. of IMACS/IFAC Symp. MCTS, Lille, France, May 1991, A. El Moudui, P. Borne, S. G. Tzafestas (Eds.), Vol. 2, pp. 42-46, 1991. [3] Varga A. Coprime factors model reduction method based on square-root balancing-free techniques. System Analysis, Modelling and Simulation, Vol. 11, pp. 303-311, 1993. [4] Varga A. A Schur method for computing coprime factorizations with inner denominators and applications in model reduction. Proc. ACC'93, San Francisco, CA, pp. 2130-2131, 1993.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* AB09FD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( NMAX, MMAX, PMAX ) ) * The formula below uses that NMAX = MMAX = PMAX. INTEGER LDWORK PARAMETER ( LDWORK = 10*NMAX*NMAX + 5*NMAX ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, N, NQ, NR, P CHARACTER*1 DICO, EQUIL, FACT, JOBCF, JOBMR, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09FD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, ALPHA, TOL1, TOL2, $ DICO, JOBCF, FACT, JOBMR, EQUIL, ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1, N ), I = 1, N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1, N ), I = 1, P ) * Find a reduced ssr for (A,B,C). CALL AB09FD( DICO, JOBCF, FACT, JOBMR, EQUIL, ORDSEL, $ N, M, P, NR, ALPHA, A, LDA, B, LDB, C, LDC, $ NQ, HSV, TOL1, TOL2, IWORK, DWORK, LDWORK, $ IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1, NQ ) IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1, NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1, NR ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09FD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09FD = ',I2) 99997 FORMAT (' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of coprime factors are') ENDProgram Data
AB08FD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0 -1.e-1 .1 1.E-10 C L I B S A -0.04165 0.0000 4.9200 0.4920 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 0.0545 0.0000 0.0000 0.0000 0.0000 0.0000 -0.49200 0.004165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 0.5210 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000Program Results
AB09FD EXAMPLE PROGRAM RESULTS The order of reduced model = 5 The Hankel singular values of coprime factors are 13.6047 9.4106 1.7684 0.7456 0.6891 0.0241 0.0230 The reduced state dynamics matrix Ar is 0.0520 -0.1491 0.0037 -0.0232 0.0168 0.2340 0.2618 0.0010 -0.0153 -0.0318 0.1197 0.0075 -0.5752 2.0119 -0.7779 0.1571 -0.2019 -2.1282 -2.1192 -0.3618 0.0368 -0.4810 0.8395 -0.2790 -2.8796 The reduced input/state matrix Br is 1.0454 0.5860 -0.0489 -1.9194 -1.4282 0.0541 -1.6144 -0.7533 0.5916 -1.9242 The reduced state/output matrix Cr is 0.4368 0.1122 -1.2917 1.5888 -0.6354 1.1170 0.3963 0.6115 0.1249 -0.0859 0.0756 -1.8904 0.0144 0.7964 1.9085
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09GD.html 0000664 0000000 0000000 00000050230 14560147231 0020320 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for an original state-space representation (A,B,C,D) by using either the square-root or the balancing-free square-root Singular Perturbation Approximation (SPA) model reduction method in conjunction with stable coprime factorization techniques.Specification
SUBROUTINE AB09GD( DICO, JOBCF, FACT, JOBMR, EQUIL, ORDSEL, N, M, $ P, NR, ALPHA, A, LDA, B, LDB, C, LDC, D, LDD, $ NQ, HSV, TOL1, TOL2, TOL3, IWORK, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, FACT, JOBCF, JOBMR, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDWORK, M, N, $ NQ, NR, P DOUBLE PRECISION ALPHA, TOL1, TOL2, TOL3 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBCF CHARACTER*1 Specifies whether left or right coprime factorization is to be used as follows: = 'L': use left coprime factorization; = 'R': use right coprime factorization. FACT CHARACTER*1 Specifies the type of coprime factorization to be computed as follows: = 'S': compute a coprime factorization with prescribed stability degree ALPHA; = 'I': compute a coprime factorization with inner denominator. JOBMR CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root Balance & Truncate method; = 'N': use the balancing-free square-root Balance & Truncate method. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(NR,NQ,NMIN), where NR is the desired order on entry, NQ is the order of the computed coprime factorization of the given system, and NMIN is the order of a minimal realization of the extended system (see METHOD); NMIN is determined as the number of Hankel singular values greater than NQ*EPS*HNORM(Ge), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(Ge) is the Hankel norm of the extended system (computed in HSV(1)); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL1,NQ*EPS*HNORM(Ge)). ALPHA (input) DOUBLE PRECISION If FACT = 'S', the desired stability degree for the factors of the coprime factorization (see SLICOT Library routines SB08ED/SB08FD). ALPHA < 0 for a continuous-time system (DICO = 'C'), and 0 <= ALPHA < 1 for a discrete-time system (DICO = 'D'). If FACT = 'I', ALPHA is not used. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NQ (output) INTEGER The order of the computed extended system Ge (see METHOD). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the NQ Hankel singular values of the extended system Ge ordered decreasingly (see METHOD).Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced extended system. For model reduction, the recommended value is TOL1 = c*HNORM(Ge), where c is a constant in the interval [0.00001,0.001], and HNORM(Ge) is the Hankel-norm of the extended system (computed in HSV(1)). The value TOL1 = NQ*EPS*HNORM(Ge) is used by default if TOL1 <= 0 on entry, where EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the extended system Ge (see METHOD). The recommended value is TOL2 = NQ*EPS*HNORM(Ge). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0, then TOL2 <= TOL1. TOL3 DOUBLE PRECISION The absolute tolerance level below which the elements of B or C are considered zero (used for controllability or observability tests by the coprime factorization method). If the user sets TOL3 <= 0, then an implicitly computed, default tolerance TOLDEF is used: TOLDEF = N*EPS*NORM(C'), if JOBCF = 'L', or TOLDEF = N*EPS*NORM(B), if JOBCF = 'R', where EPS is the machine precision, and NORM(.) denotes the 1-norm of a matrix.Workspace
IWORK INTEGER array, dimension (MAX(1,2*N,PM)) where PM = P, if JOBCF = 'L', PM = M, if JOBCF = 'R'. On exit with INFO = 0, IWORK(1) contains the order of the minimal realization of the system. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,LW1) if JOBCF = 'L' and FACT = 'S', LDWORK >= MAX(1,LW2) if JOBCF = 'L' and FACT = 'I', LDWORK >= MAX(1,LW3) if JOBCF = 'R' and FACT = 'S', LDWORK >= MAX(1,LW4) if JOBCF = 'R' and FACT = 'I', where LW1 = N*(2*MAX(M,P) + P) + MAX(M,P)*(MAX(M,P) + P) + MAX( N*P+MAX(N*(N+5), 5*P, 4*M), LWR ), LW2 = N*(2*MAX(M,P) + P) + MAX(M,P)*(MAX(M,P) + P) + MAX( N*P+MAX(N*(N+5), P*(P+2), 4*P, 4*M), LWR ), LW3 = (N+M)*(M+P) + MAX( 5*M, 4*P, LWR ), LW4 = (N+M)*(M+P) + MAX( M*(M+2), 4*M, 4*P, LWR ), and LWR = 2*N*N + N*(MAX(N,M+P)+5) + N*(N+1)/2. For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 10*K+I: I = 1: with ORDSEL = 'F', the selected order NR is greater than the order of the computed coprime factorization of the given system. In this case, the resulting NR is set automatically to a value corresponding to the order of a minimal realization of the system; K > 0: K violations of the numerical stability condition occured when computing the coprime factorization using pole assignment (see SLICOT Library routines SB08CD/SB08ED, SB08DD/SB08FD).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to a real Schur form failed; = 2: a failure was detected during the ordering of the real Schur form of A, or in the iterative process for reordering the eigenvalues of Z'*(A + H*C)*Z (or Z'*(A + B*F)*Z) along the diagonal; see SLICOT Library routines SB08CD/SB08ED (or SB08DD/SB08FD); = 3: the matrix A has an observable or controllable eigenvalue on the imaginary axis if DICO = 'C' or on the unit circle if DICO = 'D'; = 4: the computation of Hankel singular values failed.Method
Let be the linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system, and let G be the corresponding transfer-function matrix. The subroutine AB09GD determines the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t) (2) with the transfer-function matrix Gr, by using the singular perturbation approximation (SPA) method in conjunction with a left coprime factorization (LCF) or a right coprime factorization (RCF) technique: 1. Compute the appropriate stable coprime factorization of G: -1 -1 G = R *Q (LCF) or G = Q*R (RCF). 2. Perform the model reduction algorithm on the extended system ( Q ) Ge = ( Q R ) (LCF) or Ge = ( R ) (RCF) to obtain a reduced extended system with reduced factors ( Qr ) Ger = ( Qr Rr ) (LCF) or Ger = ( Rr ) (RCF). 3. Recover the reduced system from the reduced factors as -1 -1 Gr = Rr *Qr (LCF) or Gr = Qr*Rr (RCF). The approximation error for the extended system satisfies HSV(NR) <= INFNORM(Ge-Ger) <= 2*[HSV(NR+1) + ... + HSV(NQ)], where INFNORM(G) is the infinity-norm of G. If JOBMR = 'B', the balancing-based square-root SPA method of [1] is used for model reduction. If JOBMR = 'N', the balancing-free square-root SPA method of [2] is used for model reduction. By setting TOL1 = TOL2, the routine can be used to compute Balance & Truncate approximations. If FACT = 'S', the stable coprime factorization with prescribed stability degree ALPHA is computed by using the algorithm of [3]. If FACT = 'I', the stable coprime factorization with inner denominator is computed by using the algorithm of [4].References
[1] Liu Y. and Anderson B.D.O. Singular Perturbation Approximation of Balanced Systems. Int. J. Control, Vol. 50, pp. 1379-1405, 1989. [2] Varga A. Balancing-free square-root algorithm for computing singular perturbation approximations. Proc. 30-th IEEE CDC, Brighton, Dec. 11-13, 1991, Vol. 2, pp. 1062-1065. [3] Varga A. Coprime factors model reduction method based on square-root balancing-free techniques. System Analysis, Modelling and Simulation, Vol. 11, pp. 303-311, 1993. [4] Varga A. A Schur method for computing coprime factorizations with inner denominators and applications in model reduction. Proc. ACC'93, San Francisco, CA, pp. 2130-2131, 1993.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* AB09GD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 2*NMAX, MMAX, PMAX ) ) * The formula below uses that NMAX = MMAX = PMAX. INTEGER LDWORK PARAMETER ( LDWORK = 10*NMAX*NMAX + 5*NMAX ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, TOL1, TOL2, TOL3 INTEGER I, INFO, IWARN, J, M, N, NQ, NR, P CHARACTER*1 DICO, EQUIL, FACT, JOBCF, JOBMR, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09GD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, ALPHA, TOL1, TOL2, TOL3, $ DICO, JOBCF, FACT, JOBMR, EQUIL, ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1, N ), I = 1, N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1, N ), I = 1, P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1, M ), I = 1, P ) * Find a reduced ssr for (A,B,C,D). CALL AB09GD( DICO, JOBCF, FACT, JOBMR, EQUIL, ORDSEL, $ N, M, P, NR, ALPHA, A, LDA, B, LDB, C, LDC, $ D, LDD, NQ, HSV, TOL1, TOL2, TOL3, IWORK, $ DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1, NQ ) IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1, NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1, NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1, M ) 80 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09GD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09GD = ',I2) 99997 FORMAT (' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of coprime factors are') ENDProgram Data
AB08GD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0 -1.e-1 .1 1.E-10 1.E-10 C L I B S A -0.04165 0.0000 4.9200 0.4920 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 0.0545 0.0000 0.0000 0.0000 0.0000 0.0000 -0.49200 0.004165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 0.5210 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
AB09GD EXAMPLE PROGRAM RESULTS The order of reduced model = 5 The Hankel singular values of coprime factors are 13.6047 9.4106 1.7684 0.7456 0.6891 0.0241 0.0230 The reduced state dynamics matrix Ar is 0.0521 -0.1491 0.0032 -0.0242 0.0181 0.2341 0.2615 0.0009 -0.0171 -0.0362 0.1170 0.0076 -0.5471 2.0904 -0.8098 0.1675 -0.2122 -2.2113 -2.4097 -0.4139 0.0390 -0.5061 0.8787 -0.3166 -3.2955 The reduced input/state matrix Br is 1.0449 0.5863 -0.0490 -1.9210 -1.3930 0.0540 -1.7206 -0.8039 0.6358 -2.0542 The reduced state/output matrix Cr is 0.4331 0.1125 -1.2534 1.6965 -0.6773 1.1171 0.3963 0.6102 0.1213 -0.0841 0.0736 -1.8815 0.0134 0.8457 2.0413 The reduced input/output matrix Dr is 0.0480 0.0003 -0.0017 0.0001 0.0005 0.0460
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09HD.html 0000664 0000000 0000000 00000055047 14560147231 0020334 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for an original state-space representation (A,B,C,D) by using the stochastic balancing approach in conjunction with the square-root or the balancing-free square-root Balance & Truncate (B&T) or Singular Perturbation Approximation (SPA) model reduction methods for the ALPHA-stable part of the system.Specification
SUBROUTINE AB09HD( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, ALPHA, $ BETA, A, LDA, B, LDB, C, LDC, D, LDD, NS, HSV, $ TOL1, TOL2, IWORK, DWORK, LDWORK, BWORK, IWARN, $ INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOB, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDWORK, $ M, N, NR, NS, P DOUBLE PRECISION ALPHA, BETA, TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*) LOGICAL BWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root Balance & Truncate method; = 'F': use the balancing-free square-root Balance & Truncate method; = 'S': use the square-root Singular Perturbation Approximation method; = 'P': use the balancing-free square-root Singular Perturbation Approximation method. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. P <= M if BETA = 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), NR is set as follows: if ORDSEL = 'F', NR is equal to NU+MIN(MAX(0,NR-NU),NMIN), where NR is the desired order on entry, and NMIN is the order of a minimal realization of the ALPHA-stable part of the given system; NMIN is determined as the number of Hankel singular values greater than NS*EPS, where EPS is the machine precision (see LAPACK Library Routine DLAMCH); if ORDSEL = 'A', NR is the sum of NU and the number of Hankel singular values greater than MAX(TOL1,NS*EPS); NR can be further reduced to ensure that HSV(NR-NU) > HSV(NR+1-NU). ALPHA (input) DOUBLE PRECISION Specifies the ALPHA-stability boundary for the eigenvalues of the state dynamics matrix A. For a continuous-time system (DICO = 'C'), ALPHA <= 0 is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), 0 <= ALPHA <= 1 represents the boundary value for the moduli of eigenvalues. The ALPHA-stability domain does not include the boundary. BETA (input) DOUBLE PRECISION BETA > 0 specifies the absolute/relative error weighting parameter. A large positive value of BETA favours the minimization of the absolute approximation error, while a small value of BETA is appropriate for the minimization of the relative error. BETA = 0 means a pure relative error method and can be used only if rank(D) = P. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. The resulting A has a block-diagonal form with two blocks. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), the leading NU-by-NU block contains the unreduced part of A corresponding to ALPHA-unstable eigenvalues in an upper real Schur form. The trailing (NR+NS-N)-by-(NR+NS-N) block contains the reduced part of A corresponding to ALPHA-stable eigenvalues. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NS (output) INTEGER The dimension of the ALPHA-stable subsystem. HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, the leading NS elements of HSV contain the Hankel singular values of the phase system corresponding to the ALPHA-stable part of the original system. The Hankel singular values are ordered decreasingly.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value of TOL1 lies in the interval [0.00001,0.001]. If TOL1 <= 0 on entry, the used default value is TOL1 = NS*EPS, where NS is the number of ALPHA-stable eigenvalues of A and EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL1 is ignored. TOL1 < 1. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the phase system (see METHOD) corresponding to the ALPHA-stable part of the given system. The recommended value is TOL2 = NS*EPS. This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0 and ORDSEL = 'A', then TOL2 <= TOL1. TOL2 < 1.Workspace
IWORK INTEGER array, dimension (MAX(1,2*N)) On exit with INFO = 0, IWORK(1) contains the order of the minimal realization of the system. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK and DWORK(2) contains RCOND, the reciprocal condition number of the U11 matrix from the expression used to compute the solution X = U21*inv(U11) of the Riccati equation for spectral factorization. A small value RCOND indicates possible ill-conditioning of the respective Riccati equation. LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*N*N + MB*(N+P) + MAX( 2, N*(MAX(N,MB,P)+5), 2*N*P+MAX(P*(MB+2),10*N*(N+1) ) ), where MB = M if BETA = 0 and MB = M+P if BETA > 0. For optimum performance LDWORK should be larger. BWORK LOGICAL array, dimension 2*NWarning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than NSMIN, the sum of the order of the ALPHA-unstable part and the order of a minimal realization of the ALPHA-stable part of the given system; in this case, the resulting NR is set equal to NSMIN; = 2: with ORDSEL = 'F', the selected order NR corresponds to repeated singular values for the ALPHA-stable part, which are neither all included nor all excluded from the reduced model; in this case, the resulting NR is automatically decreased to exclude all repeated singular values; = 3: with ORDSEL = 'F', the selected order NR is less than the order of the ALPHA-unstable part of the given system; in this case NR is set equal to the order of the ALPHA-unstable part.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the computation of the ordered real Schur form of A failed; = 2: the reduction of the Hamiltonian matrix to real Schur form failed; = 3: the reordering of the real Schur form of the Hamiltonian matrix failed; = 4: the Hamiltonian matrix has less than N stable eigenvalues; = 5: the coefficient matrix U11 in the linear system X*U11 = U21 to determine X is singular to working precision; = 6: BETA = 0 and D has not a maximal row rank; = 7: the computation of Hankel singular values failed; = 8: the separation of the ALPHA-stable/unstable diagonal blocks failed because of very close eigenvalues; = 9: the resulting order of reduced stable part is less than the number of unstable zeros of the stable part.Method
Let be the following linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t), (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09HD determines for the given system (1), the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t), (2) such that INFNORM[inv(conj(W))*(G-Gr)] <= (1+HSV(NR+NS-N+1)) / (1-HSV(NR+NS-N+1)) + ... + (1+HSV(NS)) / (1-HSV(NS)) - 1, where G and Gr are transfer-function matrices of the systems (A,B,C,D) and (Ar,Br,Cr,Dr), respectively, W is the right, minimum phase spectral factor satisfying G1*conj(G1) = conj(W)* W, (3) G1 is the NS-order ALPHA-stable part of G, and INFNORM(G) is the infinity-norm of G. HSV(1), ... , HSV(NS) are the Hankel-singular values of the stable part of the phase system (Ap,Bp,Cp) with the transfer-function matrix P = inv(conj(W))*G1. If BETA > 0, then the model reduction is performed on [G BETA*I] instead of G. This is the recommended approach to be used when D has not a maximal row rank or when a certain balance between relative and absolute approximation errors is desired. For increasingly large values of BETA, the obtained reduced system assymptotically approaches that computed by using the Balance & Truncate or Singular Perturbation Approximation methods. Note: conj(G) denotes either G'(-s) for a continuous-time system or G'(1/z) for a discrete-time system. inv(G) is the inverse of G. The following procedure is used to reduce a given G: 1) Decompose additively G as G = G1 + G2, such that G1 = (As,Bs,Cs,D) has only ALPHA-stable poles and G2 = (Au,Bu,Cu) has only ALPHA-unstable poles. 2) Determine G1r, a reduced order approximation of the ALPHA-stable part G1 using the balancing stochastic method in conjunction with either the B&T [1,2] or SPA methods [3]. 3) Assemble the reduced model Gr as Gr = G1r + G2. Note: The employed stochastic truncation algorithm [2,3] has the property that right half plane zeros of G1 remain as right half plane zeros of G1r. Thus, the order can not be chosen smaller than the sum of the number of unstable poles of G and the number of unstable zeros of G1. The reduction of the ALPHA-stable part G1 is done as follows. If JOB = 'B', the square-root stochastic Balance & Truncate method of [1] is used. For an ALPHA-stable continuous-time system (DICO = 'C'), the resulting reduced model is stochastically balanced. If JOB = 'F', the balancing-free square-root version of the stochastic Balance & Truncate method [1] is used to reduce the ALPHA-stable part G1. If JOB = 'S', the stochastic balancing method is used to reduce the ALPHA-stable part G1, in conjunction with the square-root version of the Singular Perturbation Approximation method [3,4]. If JOB = 'P', the stochastic balancing method is used to reduce the ALPHA-stable part G1, in conjunction with the balancing-free square-root version of the Singular Perturbation Approximation method [3,4].References
[1] Varga A. and Fasol K.H. A new square-root balancing-free stochastic truncation model reduction algorithm. Proc. 12th IFAC World Congress, Sydney, 1993. [2] Safonov M. G. and Chiang R. Y. Model reduction for robust control: a Schur relative error method. Int. J. Adapt. Contr. Sign. Proc., vol. 2, pp. 259-272, 1988. [3] Green M. and Anderson B. D. O. Generalized balanced stochastic truncation. Proc. 29-th CDC, Honolulu, Hawaii, pp. 476-481, 1990. [4] Varga A. Balancing-free square-root algorithm for computing singular perturbation approximations. Proc. 30-th IEEE CDC, Brighton, Dec. 11-13, 1991, Vol. 2, pp. 1062-1065.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. The effectiveness of the accuracy enhancing technique depends on the accuracy of the solution of a Riccati equation. An ill-conditioned Riccati solution typically results when [D BETA*I] is nearly rank deficient. 3 The algorithm requires about 100N floating point operations.Further Comments
NoneExample
Program Text
* AB09HD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LBWORK, LIWORK PARAMETER ( LBWORK = 2*NMAX, LIWORK = 2*NMAX ) INTEGER LDWORK, MBMAX PARAMETER ( MBMAX = MMAX + PMAX ) PARAMETER ( LDWORK = 2*NMAX*NMAX + MBMAX*(NMAX+PMAX) + $ MAX( NMAX*(MAX( NMAX, MMAX, PMAX) + 5), $ 2*NMAX*PMAX + MAX( PMAX*(MBMAX+2), $ 10*NMAX*(NMAX+1) ) ) ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, BETA, TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, N, NR, NS, P CHARACTER*1 DICO, EQUIL, JOB, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), HSV(NMAX) LOGICAL BWORK(LBWORK) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09HD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, ALPHA, BETA, TOL1, TOL2, $ DICO, JOB, EQUIL, ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find a reduced ssr for (A,B,C,D). CALL AB09HD( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, $ ALPHA, BETA, A, LDA, B, LDB, C, LDC, D, LDD, $ NS, HSV, TOL1, TOL2, IWORK, DWORK, LDWORK, $ BWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,NS ) IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09HD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09HD = ',I2) 99997 FORMAT (' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The stochastic Hankel singular values of ALPHA-stable' $ ,' part are') ENDProgram Data
AB09HD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0 0.0 1.0 0.1E0 0.0 C F N A -0.04165 0.0000 4.9200 -4.9200 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 -0.5450 0.0000 0.0000 0.0000 0.0000 0.0000 4.9200 -0.04165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
AB09HD EXAMPLE PROGRAM RESULTS The order of reduced model = 5 The stochastic Hankel singular values of ALPHA-stable part are 0.8803 0.8506 0.8038 0.4494 0.3973 0.0214 0.0209 The reduced state dynamics matrix Ar is 1.2729 0.0000 6.5947 0.0000 -3.4229 0.0000 0.8169 0.0000 2.4821 0.0000 -2.9889 0.0000 -2.9028 0.0000 -0.3692 0.0000 -3.3921 0.0000 -3.1126 0.0000 -1.4767 0.0000 -2.0339 0.0000 -0.6107 The reduced input/state matrix Br is 0.1331 -0.1331 -0.0862 -0.0862 -2.6777 2.6777 -3.5767 -3.5767 -2.3033 2.3033 The reduced state/output matrix Cr is -0.6907 -0.6882 0.0779 0.0958 -0.0038 0.0676 0.0000 0.6532 0.0000 -0.7522 0.6907 -0.6882 -0.0779 0.0958 0.0038 The reduced input/output matrix Dr is 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09HX.html 0000664 0000000 0000000 00000031375 14560147231 0020356 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for an original stable state-space representation (A,B,C,D) by using the stochastic balancing approach in conjunction with the square-root or the balancing-free square-root Balance & Truncate (B&T) or Singular Perturbation Approximation (SPA) model reduction methods. The state dynamics matrix A of the original system is an upper quasi-triangular matrix in real Schur canonical form and D must be full row rank. For the B&T approach, the matrices of the reduced order system are computed using the truncation formulas: Ar = TI * A * T , Br = TI * B , Cr = C * T . (1) For the SPA approach, the matrices of a minimal realization (Am,Bm,Cm) are computed using the truncation formulas: Am = TI * A * T , Bm = TI * B , Cm = C * T . (2) Am, Bm, Cm and D serve further for computing the SPA of the given system.Specification
SUBROUTINE AB09HX( DICO, JOB, ORDSEL, N, M, P, NR, A, LDA, B, LDB, $ C, LDC, D, LDD, HSV, T, LDT, TI, LDTI, TOL1, $ TOL2, IWORK, DWORK, LDWORK, BWORK, IWARN, $ INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOB, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDT, LDTI, $ LDWORK, M, N, NR, P DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*), T(LDT,*), TI(LDTI,*) LOGICAL BWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root Balance & Truncate method; = 'F': use the balancing-free square-root Balance & Truncate method; = 'S': use the square-root Singular Perturbation Approximation method; = 'P': use the balancing-free square-root Singular Perturbation Approximation method. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. M >= P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(NR,NMIN), where NR is the desired order on entry and NMIN is the order of a minimal realization of the given system; NMIN is determined as the number of Hankel singular values greater than N*EPS, where EPS is the machine precision (see LAPACK Library Routine DLAMCH); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL1,N*EPS). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A in a real Schur canonical form. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the Hankel singular values, ordered decreasingly, of the phase system. All singular values are less than or equal to 1. T (output) DOUBLE PRECISION array, dimension (LDT,N) If INFO = 0 and NR > 0, the leading N-by-NR part of this array contains the right truncation matrix T in (1), for the B&T approach, or in (2), for the SPA approach. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N). TI (output) DOUBLE PRECISION array, dimension (LDTI,N) If INFO = 0 and NR > 0, the leading NR-by-N part of this array contains the left truncation matrix TI in (1), for the B&T approach, or in (2), for the SPA approach. LDTI INTEGER The leading dimension of array TI. LDTI >= MAX(1,N).Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value lies in the interval [0.00001,0.001]. If TOL1 <= 0 on entry, the used default value is TOL1 = N*EPS, where EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the phase system (see METHOD) corresponding to the given system. The recommended value is TOL2 = N*EPS. This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0 and ORDSEL = 'A', then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (MAX(1,2*N)) On exit with INFO = 0, IWORK(1) contains the order of the minimal realization of the system. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK and DWORK(2) contains RCOND, the reciprocal condition number of the U11 matrix from the expression used to compute the solution X = U21*inv(U11) of the Riccati equation for spectral factorization. A small value RCOND indicates possible ill-conditioning of the respective Riccati equation. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 2, N*(MAX(N,M,P)+5), 2*N*P+MAX(P*(M+2),10*N*(N+1) ) ). For optimum performance LDWORK should be larger. BWORK LOGICAL array, dimension 2*NWarning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than the order of a minimal realization of the given system. In this case, the resulting NR is set automatically to a value corresponding to the order of a minimal realization of the system.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D'), or it is not in a real Schur form; = 2: the reduction of Hamiltonian matrix to real Schur form failed; = 3: the reordering of the real Schur form of the Hamiltonian matrix failed; = 4: the Hamiltonian matrix has less than N stable eigenvalues; = 5: the coefficient matrix U11 in the linear system X*U11 = U21, used to determine X, is singular to working precision; = 6: the feedthrough matrix D has not a full row rank P; = 7: the computation of Hankel singular values failed.Method
Let be the stable linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t), (3) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09HX determines for the given system (3), the matrices of a reduced NR-rder system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t), (4) such that HSV(NR) <= INFNORM(G-Gr) <= 2*[HSV(NR+1) + ... + HSV(N)], where G and Gr are transfer-function matrices of the systems (A,B,C,D) and (Ar,Br,Cr,Dr), respectively, and INFNORM(G) is the infinity-norm of G. If JOB = 'B', the square-root stochastic Balance & Truncate method of [1] is used and the resulting model is balanced. If JOB = 'F', the balancing-free square-root version of the stochastic Balance & Truncate method [1] is used. If JOB = 'S', the stochastic balancing method, in conjunction with the square-root version of the Singular Perturbation Approximation method [2,3] is used. If JOB = 'P', the stochastic balancing method, in conjunction with the balancing-free square-root version of the Singular Perturbation Approximation method [2,3] is used. By setting TOL1 = TOL2, the routine can be also used to compute Balance & Truncate approximations.References
[1] Varga A. and Fasol K.H. A new square-root balancing-free stochastic truncation model reduction algorithm. Proc. of 12th IFAC World Congress, Sydney, 1993. [2] Liu Y. and Anderson B.D.O. Singular Perturbation Approximation of balanced systems. Int. J. Control, Vol. 50, pp. 1379-1405, 1989. [3] Varga A. Balancing-free square-root algorithm for computing singular perturbation approximations. Proc. 30-th IEEE CDC, Brighton, Dec. 11-13, 1991, Vol. 2, pp. 1062-1065.Numerical Aspects
The implemented method relies on accuracy enhancing square-root or balancing-free square-root methods. The effectiveness of the accuracy enhancing technique depends on the accuracy of the solution of a Riccati equation. Ill-conditioned Riccati solution typically results when D is nearly rank deficient. 3 The algorithm requires about 100N floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the Cholesky factors Su and Ru of the controllability Grammian P = Su*Su' and observability Grammian Q = Ru'*Ru, respectively, satisfying A*P + P*A' + scalec^2*B*B' = 0, (1) A'*Q + Q*A + scaleo^2*Cw'*Cw = 0, (2) where Cw = Hw - Bw'*X, Hw = inv(Dw)*C, Bw = (B*D' + P*C')*inv(Dw'), D*D' = Dw*Dw' (Dw upper triangular), and, with Aw = A - Bw*Hw, X is the stabilizing solution of the Riccati equation Aw'*X + X*Aw + Hw'*Hw + X*Bw*Bw'*X = 0. (3) The P-by-M matrix D must have full row rank. Matrix A must be stable and in a real Schur form.Specification
SUBROUTINE AB09HY( N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ SCALEC, SCALEO, S, LDS, R, LDR, IWORK, $ DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDR, LDS, LDWORK, M, N, $ P DOUBLE PRECISION SCALEC, SCALEO C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), R(LDR,*), S(LDS,*) LOGICAL BWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. M >= P >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the stable state dynamics matrix A in a real Schur canonical form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B, corresponding to the Schur matrix A. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the state/output matrix C, corresponding to the Schur matrix A. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the full row rank input/output matrix D. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). SCALEC (output) DOUBLE PRECISION Scaling factor for the controllability Grammian in (1). SCALEO (output) DOUBLE PRECISION Scaling factor for the observability Grammian in (2). S (output) DOUBLE PRECISION array, dimension (LDS,N) The leading N-by-N upper triangular part of this array contains the Cholesky factor Su of the cotrollability Grammian P = Su*Su' satisfying (1). LDS INTEGER The leading dimension of array S. LDS >= MAX(1,N). R (output) DOUBLE PRECISION array, dimension (LDR,N) The leading N-by-N upper triangular part of this array contains the Cholesky factor Ru of the observability Grammian Q = Ru'*Ru satisfying (2). LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N).Workspace
IWORK INTEGER array, dimension (2*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK and DWORK(2) contains RCOND, the reciprocal condition number of the U11 matrix from the expression used to compute X = U21*inv(U11). A small value RCOND indicates possible ill-conditioning of the Riccati equation (3). LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 2, N*(MAX(N,M,P)+5), 2*N*P+MAX(P*(M+2),10*N*(N+1) ) ). For optimum performance LDWORK should be larger. BWORK LOGICAL array, dimension 2*NError Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the state matrix A is not stable or is not in a real Schur form; = 2: the reduction of Hamiltonian matrix to real Schur form failed; = 3: the reordering of the real Schur form of the Hamiltonian matrix failed; = 4: the Hamiltonian matrix has less than N stable eigenvalues; = 5: the coefficient matrix U11 in the linear system X*U11 = U21, used to determine X, is singular to working precision; = 6: the feedthrough matrix D has not a full row rank P.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for an original state-space representation (A,B,C,D) by using the frequency weighted square-root or balancing-free square-root Balance & Truncate (B&T) or Singular Perturbation Approximation (SPA) model reduction methods. The algorithm tries to minimize the norm of the frequency-weighted error ||V*(G-Gr)*W|| where G and Gr are the transfer-function matrices of the original and reduced order models, respectively, and V and W are frequency-weighting transfer-function matrices. V and W must not have poles on the imaginary axis for a continuous-time system or on the unit circle for a discrete-time system. If G is unstable, only the ALPHA-stable part of G is reduced. In case of possible pole-zero cancellations in V*G and/or G*W, the absolute values of parameters ALPHAO and/or ALPHAC must be different from 1.Specification
SUBROUTINE AB09ID( DICO, JOBC, JOBO, JOB, WEIGHT, EQUIL, ORDSEL, $ N, M, P, NV, PV, NW, MW, NR, ALPHA, ALPHAC, $ ALPHAO, A, LDA, B, LDB, C, LDC, D, LDD, $ AV, LDAV, BV, LDBV, CV, LDCV, DV, LDDV, $ AW, LDAW, BW, LDBW, CW, LDCW, DW, LDDW, $ NS, HSV, TOL1, TOL2, IWORK, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOB, JOBC, JOBO, ORDSEL, WEIGHT INTEGER INFO, IWARN, LDA, LDAV, LDAW, LDB, LDBV, LDBW, $ LDC, LDCV, LDCW, LDD, LDDV, LDDW, LDWORK, M, MW, $ N, NR, NS, NV, NW, P, PV DOUBLE PRECISION ALPHA, ALPHAC, ALPHAO, TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), AV(LDAV,*), AW(LDAW,*), $ B(LDB,*), BV(LDBV,*), BW(LDBW,*), $ C(LDC,*), CV(LDCV,*), CW(LDCW,*), $ D(LDD,*), DV(LDDV,*), DW(LDDW,*), DWORK(*), $ HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBC CHARACTER*1 Specifies the choice of frequency-weighted controllability Grammian as follows: = 'S': choice corresponding to a combination method [4] of the approaches of Enns [1] and Lin-Chiu [2,3]; = 'E': choice corresponding to the stability enhanced modified combination method of [4]. JOBO CHARACTER*1 Specifies the choice of frequency-weighted observability Grammian as follows: = 'S': choice corresponding to a combination method [4] of the approaches of Enns [1] and Lin-Chiu [2,3]; = 'E': choice corresponding to the stability enhanced modified combination method of [4]. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root Balance & Truncate method; = 'F': use the balancing-free square-root Balance & Truncate method; = 'S': use the square-root Singular Perturbation Approximation method; = 'P': use the balancing-free square-root Singular Perturbation Approximation method. WEIGHT CHARACTER*1 Specifies the type of frequency weighting, as follows: = 'N': no weightings are used (V = I, W = I); = 'L': only left weighting V is used (W = I); = 'R': only right weighting W is used (V = I); = 'B': both left and right weightings V and W are used. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NV (input) INTEGER The order of the matrix AV. Also the number of rows of the matrix BV and the number of columns of the matrix CV. NV represents the dimension of the state vector of the system with the transfer-function matrix V. NV >= 0. PV (input) INTEGER The number of rows of the matrices CV and DV. PV >= 0. PV represents the dimension of the output vector of the system with the transfer-function matrix V. NW (input) INTEGER The order of the matrix AW. Also the number of rows of the matrix BW and the number of columns of the matrix CW. NW represents the dimension of the state vector of the system with the transfer-function matrix W. NW >= 0. MW (input) INTEGER The number of columns of the matrices BW and DW. MW >= 0. MW represents the dimension of the input vector of the system with the transfer-function matrix W. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), NR is set as follows: if ORDSEL = 'F', NR is equal to NU+MIN(MAX(0,NR-NU),NMIN), where NR is the desired order on entry, NMIN is the number of frequency-weighted Hankel singular values greater than NS*EPS*S1, EPS is the machine precision (see LAPACK Library Routine DLAMCH) and S1 is the largest Hankel singular value (computed in HSV(1)); NR can be further reduced to ensure HSV(NR-NU) > HSV(NR+1-NU); if ORDSEL = 'A', NR is the sum of NU and the number of Hankel singular values greater than MAX(TOL1,NS*EPS*S1). ALPHA (input) DOUBLE PRECISION Specifies the ALPHA-stability boundary for the eigenvalues of the state dynamics matrix A. For a continuous-time system (DICO = 'C'), ALPHA <= 0 is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), 0 <= ALPHA <= 1 represents the boundary value for the moduli of eigenvalues. The ALPHA-stability domain does not include the boundary. ALPHAC (input) DOUBLE PRECISION Combination method parameter for defining the frequency-weighted controllability Grammian (see METHOD); ABS(ALPHAC) <= 1. ALPHAO (input) DOUBLE PRECISION Combination method parameter for defining the frequency-weighted observability Grammian (see METHOD); ABS(ALPHAO) <= 1. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. The resulting A has a block-diagonal form with two blocks. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), the leading NU-by-NU block contains the unreduced part of A corresponding to ALPHA-unstable eigenvalues. The trailing (NR+NS-N)-by-(NR+NS-N) block contains the reduced part of A corresponding to ALPHA-stable eigenvalues. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). AV (input/output) DOUBLE PRECISION array, dimension (LDAV,NV) On entry, if WEIGHT = 'L' or 'B', the leading NV-by-NV part of this array must contain the state matrix AV of the system with the transfer-function matrix V. On exit, if WEIGHT = 'L' or 'B', MIN(N,M,P) > 0 and INFO = 0, the leading NVR-by-NVR part of this array contains the state matrix of a minimal realization of V in a real Schur form. NVR is returned in IWORK(2). AV is not referenced if WEIGHT = 'R' or 'N', or MIN(N,M,P) = 0. LDAV INTEGER The leading dimension of array AV. LDAV >= MAX(1,NV), if WEIGHT = 'L' or 'B'; LDAV >= 1, if WEIGHT = 'R' or 'N'. BV (input/output) DOUBLE PRECISION array, dimension (LDBV,P) On entry, if WEIGHT = 'L' or 'B', the leading NV-by-P part of this array must contain the input matrix BV of the system with the transfer-function matrix V. On exit, if WEIGHT = 'L' or 'B', MIN(N,M,P) > 0 and INFO = 0, the leading NVR-by-P part of this array contains the input matrix of a minimal realization of V. BV is not referenced if WEIGHT = 'R' or 'N', or MIN(N,M,P) = 0. LDBV INTEGER The leading dimension of array BV. LDBV >= MAX(1,NV), if WEIGHT = 'L' or 'B'; LDBV >= 1, if WEIGHT = 'R' or 'N'. CV (input/output) DOUBLE PRECISION array, dimension (LDCV,NV) On entry, if WEIGHT = 'L' or 'B', the leading PV-by-NV part of this array must contain the output matrix CV of the system with the transfer-function matrix V. On exit, if WEIGHT = 'L' or 'B', MIN(N,M,P) > 0 and INFO = 0, the leading PV-by-NVR part of this array contains the output matrix of a minimal realization of V. CV is not referenced if WEIGHT = 'R' or 'N', or MIN(N,M,P) = 0. LDCV INTEGER The leading dimension of array CV. LDCV >= MAX(1,PV), if WEIGHT = 'L' or 'B'; LDCV >= 1, if WEIGHT = 'R' or 'N'. DV (input) DOUBLE PRECISION array, dimension (LDDV,P) If WEIGHT = 'L' or 'B', the leading PV-by-P part of this array must contain the feedthrough matrix DV of the system with the transfer-function matrix V. DV is not referenced if WEIGHT = 'R' or 'N', or MIN(N,M,P) = 0. LDDV INTEGER The leading dimension of array DV. LDDV >= MAX(1,PV), if WEIGHT = 'L' or 'B'; LDDV >= 1, if WEIGHT = 'R' or 'N'. AW (input/output) DOUBLE PRECISION array, dimension (LDAW,NW) On entry, if WEIGHT = 'R' or 'B', the leading NW-by-NW part of this array must contain the state matrix AW of the system with the transfer-function matrix W. On exit, if WEIGHT = 'R' or 'B', MIN(N,M,P) > 0 and INFO = 0, the leading NWR-by-NWR part of this array contains the state matrix of a minimal realization of W in a real Schur form. NWR is returned in IWORK(3). AW is not referenced if WEIGHT = 'L' or 'N', or MIN(N,M,P) = 0. LDAW INTEGER The leading dimension of array AW. LDAW >= MAX(1,NW), if WEIGHT = 'R' or 'B'; LDAW >= 1, if WEIGHT = 'L' or 'N'. BW (input/output) DOUBLE PRECISION array, dimension (LDBW,MW) On entry, if WEIGHT = 'R' or 'B', the leading NW-by-MW part of this array must contain the input matrix BW of the system with the transfer-function matrix W. On exit, if WEIGHT = 'R' or 'B', MIN(N,M,P) > 0 and INFO = 0, the leading NWR-by-MW part of this array contains the input matrix of a minimal realization of W. BW is not referenced if WEIGHT = 'L' or 'N', or MIN(N,M,P) = 0. LDBW INTEGER The leading dimension of array BW. LDBW >= MAX(1,NW), if WEIGHT = 'R' or 'B'; LDBW >= 1, if WEIGHT = 'L' or 'N'. CW (input/output) DOUBLE PRECISION array, dimension (LDCW,NW) On entry, if WEIGHT = 'R' or 'B', the leading M-by-NW part of this array must contain the output matrix CW of the system with the transfer-function matrix W. On exit, if WEIGHT = 'R' or 'B', MIN(N,M,P) > 0 and INFO = 0, the leading M-by-NWR part of this array contains the output matrix of a minimal realization of W. CW is not referenced if WEIGHT = 'L' or 'N', or MIN(N,M,P) = 0. LDCW INTEGER The leading dimension of array CW. LDCW >= MAX(1,M), if WEIGHT = 'R' or 'B'; LDCW >= 1, if WEIGHT = 'L' or 'N'. DW (input) DOUBLE PRECISION array, dimension (LDDW,MW) If WEIGHT = 'R' or 'B', the leading M-by-MW part of this array must contain the feedthrough matrix DW of the system with the transfer-function matrix W. DW is not referenced if WEIGHT = 'L' or 'N', or MIN(N,M,P) = 0. LDDW INTEGER The leading dimension of array DW. LDDW >= MAX(1,M), if WEIGHT = 'R' or 'B'; LDDW >= 1, if WEIGHT = 'L' or 'N'. NS (output) INTEGER The dimension of the ALPHA-stable subsystem. HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, the leading NS elements of this array contain the frequency-weighted Hankel singular values, ordered decreasingly, of the ALPHA-stable part of the original system.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL1 = c*S1, where c is a constant in the interval [0.00001,0.001], and S1 is the largest frequency-weighted Hankel singular value of the ALPHA-stable part of the original system (computed in HSV(1)). If TOL1 <= 0 on entry, the used default value is TOL1 = NS*EPS*S1, where NS is the number of ALPHA-stable eigenvalues of A and EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the ALPHA-stable part of the given system. The recommended value is TOL2 = NS*EPS*S1. This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0 and ORDSEL = 'A', then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension ( MAX( 3, LIWRK1, LIWRK2, LIWRK3 ) ), where LIWRK1 = 0, if JOB = 'B'; LIWRK1 = N, if JOB = 'F'; LIWRK1 = 2*N, if JOB = 'S' or 'P'; LIWRK2 = 0, if WEIGHT = 'R' or 'N' or NV = 0; LIWRK2 = NV+MAX(P,PV), if WEIGHT = 'L' or 'B' and NV > 0; LIWRK3 = 0, if WEIGHT = 'L' or 'N' or NW = 0; LIWRK3 = NW+MAX(M,MW), if WEIGHT = 'R' or 'B' and NW > 0. On exit, if INFO = 0, IWORK(1) contains the order of a minimal realization of the stable part of the system, IWORK(2) and IWORK(3) contain the actual orders of the state space realizations of V and W, respectively. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( LMINL, LMINR, LRCF, 2*N*N + MAX( 1, LLEFT, LRIGHT, 2*N*N+5*N, N*MAX(M,P) ) ), where LMINL = 0, if WEIGHT = 'R' or 'N' or NV = 0; otherwise, LMINL = MAX(LLCF,NV+MAX(NV,3*P)) if P = PV; LMINL = MAX(P,PV)*(2*NV+MAX(P,PV))+ MAX(LLCF,NV+MAX(NV,3*P,3*PV)) if P <> PV; LRCF = 0, and LMINR = 0, if WEIGHT = 'L' or 'N' or NW = 0; otherwise, LMINR = NW+MAX(NW,3*M) if M = MW; LMINR = 2*NW*MAX(M,MW)+NW+MAX(NW,3*M,3*MW) if M <> MW; LLCF = PV*(NV+PV)+PV*NV+MAX(NV*(NV+5), PV*(PV+2), 4*PV, 4*P); LRCF = MW*(NW+MW)+MAX(NW*(NW+5),MW*(MW+2),4*MW,4*M) LLEFT = (N+NV)*(N+NV+MAX(N+NV,PV)+5) if WEIGHT = 'L' or 'B' and PV > 0; LLEFT = N*(P+5) if WEIGHT = 'R' or 'N' or PV = 0; LRIGHT = (N+NW)*(N+NW+MAX(N+NW,MW)+5) if WEIGHT = 'R' or 'B' and MW > 0; LRIGHT = N*(M+5) if WEIGHT = 'L' or 'N' or MW = 0. For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than NSMIN, the sum of the order of the ALPHA-unstable part and the order of a minimal realization of the ALPHA-stable part of the given system; in this case, the resulting NR is set equal to NSMIN; = 2: with ORDSEL = 'F', the selected order NR corresponds to repeated singular values for the ALPHA-stable part, which are neither all included nor all excluded from the reduced model; in this case, the resulting NR is automatically decreased to exclude all repeated singular values; = 3: with ORDSEL = 'F', the selected order NR is less than the order of the ALPHA-unstable part of the given system; in this case NR is set equal to the order of the ALPHA-unstable part. = 10+K: K violations of the numerical stability condition occured during the assignment of eigenvalues in the SLICOT Library routines SB08CD and/or SB08DD.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the computation of the ordered real Schur form of A failed; = 2: the separation of the ALPHA-stable/unstable diagonal blocks failed because of very close eigenvalues; = 3: the reduction to a real Schur form of the state matrix of a minimal realization of V failed; = 4: a failure was detected during the ordering of the real Schur form of the state matrix of a minimal realization of V or in the iterative process to compute a left coprime factorization with inner denominator; = 5: if DICO = 'C' and the matrix AV has an observable eigenvalue on the imaginary axis, or DICO = 'D' and AV has an observable eigenvalue on the unit circle; = 6: the reduction to a real Schur form of the state matrix of a minimal realization of W failed; = 7: a failure was detected during the ordering of the real Schur form of the state matrix of a minimal realization of W or in the iterative process to compute a right coprime factorization with inner denominator; = 8: if DICO = 'C' and the matrix AW has a controllable eigenvalue on the imaginary axis, or DICO = 'D' and AW has a controllable eigenvalue on the unit circle; = 9: the computation of eigenvalues failed; = 10: the computation of Hankel singular values failed.Method
Let G be the transfer-function matrix of the original linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t), (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09ID determines the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t), (2) such that the corresponding transfer-function matrix Gr minimizes the norm of the frequency-weighted error V*(G-Gr)*W, (3) where V and W are transfer-function matrices without poles on the imaginary axis in continuous-time case or on the unit circle in discrete-time case. The following procedure is used to reduce G: 1) Decompose additively G, of order N, as G = G1 + G2, such that G1 = (A1,B1,C1,D) has only ALPHA-stable poles and G2 = (A2,B2,C2,0), of order NU, has only ALPHA-unstable poles. 2) Compute for G1 a B&T or SPA frequency-weighted approximation G1r of order NR-NU using the combination method or the modified combination method of [4]. 3) Assemble the reduced model Gr as Gr = G1r + G2. For the frequency-weighted reduction of the ALPHA-stable part, several methods described in [4] can be employed in conjunction with the combination method and modified combination method proposed in [4]. If JOB = 'B', the square-root B&T method is used. If JOB = 'F', the balancing-free square-root version of the B&T method is used. If JOB = 'S', the square-root version of the SPA method is used. If JOB = 'P', the balancing-free square-root version of the SPA method is used. For each of these methods, left and right truncation matrices are determined using the Cholesky factors of an input frequency-weighted controllability Grammian P and an output frequency-weighted observability Grammian Q. P and Q are computed from the controllability Grammian Pi of G*W and the observability Grammian Qo of V*G. Using special realizations of G*W and V*G, Pi and Qo are computed in the partitioned forms Pi = ( P11 P12 ) and Qo = ( Q11 Q12 ) , ( P12' P22 ) ( Q12' Q22 ) where P11 and Q11 are the leading N-by-N parts of Pi and Qo, respectively. Let P0 and Q0 be non-negative definite matrices defined below -1 P0 = P11 - ALPHAC**2*P12*P22 *P21 , -1 Q0 = Q11 - ALPHAO**2*Q12*Q22 *Q21. The frequency-weighted controllability and observability Grammians, P and Q, respectively, are defined as follows: P = P0 if JOBC = 'S' (standard combination method [4]); P = P1 >= P0 if JOBC = 'E', where P1 is the controllability Grammian defined to enforce stability for a modified combination method of [4]; Q = Q0 if JOBO = 'S' (standard combination method [4]); Q = Q1 >= Q0 if JOBO = 'E', where Q1 is the observability Grammian defined to enforce stability for a modified combination method of [4]. If JOBC = JOBO = 'S' and ALPHAC = ALPHAO = 0, the choice of Grammians corresponds to the method of Enns [1], while if ALPHAC = ALPHAO = 1, the choice of Grammians corresponds to the method of Lin and Chiu [2,3]. If JOBC = 'S' and ALPHAC = 1, no pole-zero cancellations must occur in G*W. If JOBO = 'S' and ALPHAO = 1, no pole-zero cancellations must occur in V*G. The presence of pole-zero cancellations leads to meaningless results and must be avoided. The frequency-weighted Hankel singular values HSV(1), ...., HSV(N) are computed as the square roots of the eigenvalues of the product P*Q.References
[1] Enns, D. Model reduction with balanced realizations: An error bound and a frequency weighted generalization. Proc. 23-th CDC, Las Vegas, pp. 127-132, 1984. [2] Lin, C.-A. and Chiu, T.-Y. Model reduction via frequency-weighted balanced realization. Control Theory and Advanced Technology, vol. 8, pp. 341-351, 1992. [3] Sreeram, V., Anderson, B.D.O and Madievski, A.G. New results on frequency weighted balanced reduction technique. Proc. ACC, Seattle, Washington, pp. 4004-4009, 1995. [4] Varga, A. and Anderson, B.D.O. Square-root balancing-free methods for the frequency-weighted balancing related model reduction. (report in preparation)Numerical Aspects
The implemented methods rely on accuracy enhancing square-root techniques.Further Comments
NoneExample
Program Text
* AB09ID EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, MWMAX, NMAX, NVMAX, NWMAX, PMAX, PVMAX PARAMETER ( MMAX = 20, MWMAX = 20, $ NMAX = 20, NVMAX = 20, NWMAX = 20, $ PMAX = 20, PVMAX = 20 ) INTEGER LDA, LDAV, LDAW, LDB, LDBV, LDBW, $ LDC, LDCV, LDCW, LDD, LDDV, LDDW PARAMETER ( LDA = NMAX, LDAV = NVMAX, LDAW = NWMAX, $ LDB = NMAX, LDBV = NVMAX, LDBW = NWMAX, $ LDC = PMAX, LDCV = PVMAX, LDCW = MMAX, $ LDD = PMAX, LDDV = PVMAX, LDDW = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 2*NMAX, $ NVMAX + MAX( PMAX, PVMAX ), $ NWMAX + MAX( MMAX, MWMAX ) ) ) INTEGER LDW1, LDW2, LDW3, LDW4, LDW5, LDW6, LDW7, LDW8, $ LDWORK PARAMETER ( LDW1 = NMAX + NVMAX, LDW2 = NMAX + NWMAX, $ LDW3 = MAX( LDW1*( LDW1 + MAX( LDW1, PVMAX ) + $ 5 ), NMAX*( PMAX + 5 ) ), $ LDW4 = MAX( LDW2*( LDW2 + MAX( LDW2, MWMAX ) + $ 5 ), NMAX*( MMAX + 5 ) ), $ LDW5 = PVMAX*( NVMAX + PVMAX ) + PVMAX*NVMAX + $ MAX( NVMAX*( NVMAX + 5 ), 4*PVMAX, $ PVMAX*( PVMAX + 2 ), 4*PMAX ), $ LDW6 = MAX( PMAX, PVMAX )*( 2*NVMAX + $ MAX( PMAX, PVMAX ) ) + $ MAX( LDW5, NVMAX + $ MAX( NVMAX, 3*PMAX, 3*PVMAX ) $ ), $ LDW7 = MAX( NWMAX + MAX( NWMAX, 3*MMAX ), $ 2*NWMAX*MAX( MMAX, MWMAX ) + $ NWMAX + MAX( NWMAX, 3*MMAX, $ 3*MWMAX ) ), $ LDW8 = MWMAX*( NWMAX + MWMAX ) + $ MAX( NWMAX*( NWMAX + 5 ), 4*MWMAX, $ MWMAX*( MWMAX + 2 ), 4*MMAX ) ) PARAMETER ( LDWORK = MAX( LDW6, LDW7, LDW8, $ 2*NMAX*NMAX + $ MAX( 1, LDW3, LDW4, $ 2*NMAX*NMAX + 5*NMAX, $ NMAX*MAX( MMAX, PMAX ) ) ) $ ) * .. Local Scalars .. LOGICAL LEFTW, RIGHTW DOUBLE PRECISION ALPHA, ALPHAC, ALPHAO, TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, MW, N, NR, NS, NV, NW, P, $ PV CHARACTER*1 DICO, EQUIL, JOB, JOBC, JOBO, ORDSEL, WEIGHT * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), AV(LDAV,NVMAX), AW(LDAW,NWMAX), $ B(LDB,MMAX), BV(LDBV,PMAX), BW(LDBW,MWMAX), $ C(LDC,NMAX), CV(LDCV,NVMAX), CW(LDCW,NWMAX), $ D(LDD,MMAX), DV(LDDV,PMAX), DW(LDDW,MWMAX), $ DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL AB09ID * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NV, PV, NW, MW, NR, $ ALPHA, ALPHAC, ALPHAO, TOL1, TOL2, $ DICO, JOBC, JOBO, JOB, WEIGHT, $ EQUIL, ORDSEL LEFTW = LSAME( WEIGHT, 'L' ) .OR. LSAME( WEIGHT, 'B' ) RIGHTW = LSAME( WEIGHT, 'R' ) .OR. LSAME( WEIGHT, 'B' ) 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 ) IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) IF( LEFTW ) THEN IF( NV.LT.0 .OR. NV.GT.NVMAX ) THEN WRITE ( NOUT, FMT = 99986 ) NV ELSE IF( NV.GT.0 ) THEN READ ( NIN, FMT = * ) $ ( ( AV(I,J), J = 1,NV ), I = 1,NV ) READ ( NIN, FMT = * ) $ ( ( BV(I,J), J = 1,P ), I = 1,NV ) IF( PV.LE.0 .OR. PV.GT.PVMAX ) THEN WRITE ( NOUT, FMT = 99985 ) PV ELSE READ ( NIN, FMT = * ) $ ( ( CV(I,J), J = 1,NV ), I = 1,PV ) END IF END IF IF( PV.LE.0 .OR. PV.GT.PVMAX ) THEN WRITE ( NOUT, FMT = 99985 ) PV ELSE READ ( NIN, FMT = * ) $ ( ( DV(I,J), J = 1,P ), I = 1,PV ) END IF END IF END IF IF( RIGHTW ) THEN IF( NW.LT.0 .OR. NW.GT.NWMAX ) THEN WRITE ( NOUT, FMT = 99984 ) NW ELSE IF( NW.GT.0 ) THEN READ ( NIN, FMT = * ) $ ( ( AW(I,J), J = 1,NW ), I = 1,NW ) IF( MW.LE.0 .OR. MW.GT.MWMAX ) THEN WRITE ( NOUT, FMT = 99983 ) MW ELSE READ ( NIN, FMT = * ) $ ( ( BW(I,J), J = 1,MW ), I = 1,NW ) END IF READ ( NIN, FMT = * ) $ ( ( CW(I,J), J = 1,NW ), I = 1,M ) END IF IF( MW.LE.0 .OR. MW.GT.MWMAX ) THEN WRITE ( NOUT, FMT = 99983 ) MW ELSE READ ( NIN, FMT = * ) $ ( ( DW(I,J), J = 1,MW ), I = 1,M ) END IF END IF END IF * Find a reduced ssr for (A,B,C,D). CALL AB09ID( DICO, JOBC, JOBO, JOB, WEIGHT, EQUIL, $ ORDSEL, N, M, P, NV, PV, NW, MW, NR, ALPHA, $ ALPHAC, ALPHAO, A, LDA, B, LDB, C, LDC, D, $ LDD, AV, LDAV, BV, LDBV, CV, LDCV, DV, LDDV, $ AW, LDAW, BW, LDBW, CW, LDCW, DW, LDDW, $ NS, HSV, TOL1, TOL2, IWORK, DWORK, LDWORK, $ IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( IWARN.NE.0) WRITE ( NOUT, FMT = 99982 ) IWARN WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1, NS ) IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09ID EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09ID = ',I2) 99997 FORMAT (/' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of weighted ALPHA-stable', $ ' part are') 99986 FORMAT (/' NV is out of range.',/' NV = ',I5) 99985 FORMAT (/' PV is out of range.',/' PV = ',I5) 99984 FORMAT (/' NW is out of range.',/' NW = ',I5) 99983 FORMAT (/' MW is out of range.',/' MW = ',I5) 99982 FORMAT (' IWARN on exit from AB09ID = ',I2) ENDProgram Data
AB09ID EXAMPLE PROGRAM DATA (Continuous system) 3 1 1 6 1 0 0 2 0.0 0.0 0.0 0.1E0 0.0 C S S F L S F -26.4000 6.4023 4.3868 32.0000 0 0 0 8.0000 0 16 0 0 9.2994 1.1624 0.1090 0 -1.0000 0 4.0000 -9.2994 -1.1624 -0.1090 0 2.0000 0 -9.2994 -1.1624 -0.1090 0 0 -3.0000 -9.2994 -1.1624 -0.1090 16.0000 16.0000 16.0000 -26.4000 6.4023 4.3868 0 0 0 32.0000 0 0 0 0 0 0 8.0000 0 1 1 1 0 0 0 1 1 1 0 0 0 0Program Results
AB09ID EXAMPLE PROGRAM RESULTS The order of reduced model = 2 The Hankel singular values of weighted ALPHA-stable part are 3.8253 0.2005 The reduced state dynamics matrix Ar is 9.1900 0.0000 0.0000 -34.5297 The reduced input/state matrix Br is 11.9593 16.9329 The reduced state/output matrix Cr is 2.8955 6.9152 The reduced input/output matrix Dr is 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09IX.html 0000664 0000000 0000000 00000032551 14560147231 0020354 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for an original state-space representation (A,B,C,D) by using the square-root or balancing-free square-root Balance & Truncate (B&T) or Singular Perturbation Approximation (SPA) model reduction methods. The computation of truncation matrices TI and T is based on the Cholesky factor S of a controllability Grammian P = S*S' and the Cholesky factor R of an observability Grammian Q = R'*R, where S and R are given upper triangular matrices. For the B&T approach, the matrices of the reduced order system are computed using the truncation formulas: Ar = TI * A * T , Br = TI * B , Cr = C * T . (1) For the SPA approach, the matrices of a minimal realization (Am,Bm,Cm) are computed using the truncation formulas: Am = TI * A * T , Bm = TI * B , Cm = C * T . (2) Am, Bm, Cm and D serve further for computing the SPA of the given system.Specification
SUBROUTINE AB09IX( DICO, JOB, FACT, ORDSEL, N, M, P, NR, $ SCALEC, SCALEO, A, LDA, B, LDB, C, LDC, D, LDD, $ TI, LDTI, T, LDT, NMINR, HSV, TOL1, TOL2, $ IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, JOB, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDT, LDTI, $ LDWORK, M, N, NMINR, NR, P DOUBLE PRECISION SCALEC, SCALEO, TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*), T(LDT,*), TI(LDTI,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root B&T method; = 'F': use the balancing-free square-root B&T method; = 'S': use the square-root SPA method; = 'P': use the balancing-free square-root SPA method. FACT CHARACTER*1 Specifies whether or not, on entry, the matrix A is in a real Schur form, as follows: = 'S': A is in a real Schur form; = 'N': A is a general dense square matrix. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. NR is set as follows: if ORDSEL = 'F', NR is equal to MIN(NR,NMINR), where NR is the desired order on entry and NMINR is the number of the Hankel singular values greater than N*EPS*S1, where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and S1 is the largest Hankel singular value (computed in HSV(1)); NR can be further reduced to ensure HSV(NR) > HSV(NR+1); if ORDSEL = 'A', NR is equal to the number of Hankel singular values greater than MAX(TOL1,N*EPS*S1). SCALEC (input) DOUBLE PRECISION Scaling factor for the Cholesky factor S of the controllability Grammian, i.e., S/SCALEC is used to compute the Hankel singular values. SCALEC > 0. SCALEO (input) DOUBLE PRECISION Scaling factor for the Cholesky factor R of the observability Grammian, i.e., R/SCALEO is used to compute the Hankel singular values. SCALEO > 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. If FACT = 'S', A is in a real Schur form. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, if JOB = 'S' or JOB = 'P', the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0 and JOB = 'S' or JOB = 'P', the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. If JOB = 'B' or JOB = 'F', this array is not referenced. LDD INTEGER The leading dimension of array D. LDD >= 1, if JOB = 'B' or JOB = 'F'; LDD >= MAX(1,P), if JOB = 'S' or JOB = 'P'. TI (input/output) DOUBLE PRECISION array, dimension (LDTI,N) On entry, the leading N-by-N upper triangular part of this array must contain the Cholesky factor S of a controllability Grammian P = S*S'. On exit, if INFO = 0, and NR > 0, the leading NMINR-by-N part of this array contains the left truncation matrix TI in (1), for the B&T approach, or in (2), for the SPA approach. LDTI INTEGER The leading dimension of array TI. LDTI >= MAX(1,N). T (input/output) DOUBLE PRECISION array, dimension (LDT,N) On entry, the leading N-by-N upper triangular part of this array must contain the Cholesky factor R of an observability Grammian Q = R'*R. On exit, if INFO = 0, and NR > 0, the leading N-by-NMINR part of this array contains the right truncation matrix T in (1), for the B&T approach, or in (2), for the SPA approach. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N). NMINR (output) INTEGER The number of Hankel singular values greater than MAX(TOL2,N*EPS*S1). Note: If S and R are the Cholesky factors of the controllability and observability Grammians of the original system (A,B,C,D), respectively, then NMINR is the order of a minimal realization of the original system. HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the Hankel singular values, ordered decreasingly. The Hankel singular values are singular values of the product R*S.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of the reduced system. For model reduction, the recommended value lies in the interval [0.00001,0.001]. If TOL1 <= 0 on entry, the used default value is TOL1 = N*EPS*S1, where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and S1 is the largest Hankel singular value (computed in HSV(1)). If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the system. The recommended value is TOL2 = N*EPS*S1. This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0, and ORDSEL = 'A', then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (LIWORK), where LIWORK = 0, if JOB = 'B'; LIWORK = N, if JOB = 'F'; LIWORK = 2*N, if JOB = 'S' or 'P'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, 2*N*N + 5*N, N*MAX(M,P) ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than NMINR, the order of a minimal realization of the given system; in this case, the resulting NR is set automatically to NMINR; = 2: with ORDSEL = 'F', the selected order NR corresponds to repeated singular values, which are neither all included nor all excluded from the reduced model; in this case, the resulting NR is set automatically to the largest value such that HSV(NR) > HSV(NR+1).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the computation of Hankel singular values failed.Method
Let be the stable linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t), (3) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09IX determines for the given system (3), the matrices of a reduced NR order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t), (4) by using the square-root or balancing-free square-root Balance & Truncate (B&T) or Singular Perturbation Approximation (SPA) model reduction methods. The projection matrices TI and T are determined using the Cholesky factors S and R of a controllability Grammian P and an observability Grammian Q. The Hankel singular values HSV(1), ...., HSV(N) are computed as singular values of the product R*S. If JOB = 'B', the square-root Balance & Truncate technique of [1] is used. If JOB = 'F', the balancing-free square-root version of the Balance & Truncate technique [2] is used. If JOB = 'S', the square-root version of the Singular Perturbation Approximation method [3,4] is used. If JOB = 'P', the balancing-free square-root version of the Singular Perturbation Approximation method [3,4] is used.References
[1] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987. [2] Varga A. Efficient minimal realization procedure based on balancing. Proc. of IMACS/IFAC Symp. MCTS, Lille, France, May 1991, A. El Moudni, P. Borne, S. G. Tzafestas (Eds.), Vol. 2, pp. 42-46. [3] Liu Y. and Anderson B.D.O. Singular Perturbation Approximation of balanced systems. Int. J. Control, Vol. 50, pp. 1379-1405, 1989. [4] Varga A. Balancing-free square-root algorithm for computing singular perturbation approximations. Proc. 30-th CDC, Brighton, Dec. 11-13, 1991, Vol. 2, pp. 1062-1065.Numerical Aspects
The implemented method relies on accuracy enhancing square-root or balancing-free square-root methods.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute for given state-space representations (A,B,C,0), (AV,BV,CV,DV), and (AW,BW,CW,DW) of the transfer-function matrices G, V and W, respectively, the Cholesky factors of the frequency-weighted controllability and observability Grammians corresponding to a frequency-weighted model reduction problem. G, V and W must be stable transfer-function matrices with the state matrices A, AV, and AW in real Schur form. It is assumed that the state space realizations (AV,BV,CV,DV) and (AW,BW,CW,DW) are minimal. In case of possible pole-zero cancellations in forming V*G and/or G*W, the parameters for the choice of frequency-weighted Grammians ALPHAO and/or ALPHAC, respectively, must be different from 1.Specification
SUBROUTINE AB09IY( DICO, JOBC, JOBO, WEIGHT, N, M, P, NV, PV, $ NW, MW, ALPHAC, ALPHAO, A, LDA, B, LDB, C, LDC, $ AV, LDAV, BV, LDBV, CV, LDCV, DV, LDDV, $ AW, LDAW, BW, LDBW, CW, LDCW, DW, LDDW, $ SCALEC, SCALEO, S, LDS, R, LDR, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBC, JOBO, WEIGHT INTEGER INFO, LDA, LDAV, LDAW, LDB, LDBV, LDBW, $ LDC, LDCV, LDCW, LDDV, LDDW, LDR, LDS, LDWORK, $ M, MW, N, NV, NW, P, PV DOUBLE PRECISION ALPHAC, ALPHAO, SCALEC, SCALEO C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), AV(LDAV,*), AW(LDAW,*), $ B(LDB,*), BV(LDBV,*), BW(LDBW,*), $ C(LDC,*), CV(LDCV,*), CW(LDCW,*), $ DV(LDDV,*), DW(LDDW,*), $ DWORK(*), R(LDR,*), S(LDS,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the systems as follows: = 'C': G, V and W are continuous-time systems; = 'D': G, V and W are discrete-time systems. JOBC CHARACTER*1 Specifies the choice of frequency-weighted controllability Grammian as follows: = 'S': choice corresponding to a combination method [4] of the approaches of Enns [1] and Lin-Chiu [2,3]; = 'E': choice corresponding to the stability enhanced modified combination method of [4]. JOBO CHARACTER*1 Specifies the choice of frequency-weighted observability Grammian as follows: = 'S': choice corresponding to a combination method [4] of the approaches of Enns [1] and Lin-Chiu [2,3]; = 'E': choice corresponding to the stability enhanced modified combination method of [4]. WEIGHT CHARACTER*1 Specifies the type of frequency weighting, as follows: = 'N': no weightings are used (V = I, W = I); = 'L': only left weighting V is used (W = I); = 'R': only right weighting W is used (V = I); = 'B': both left and right weightings V and W are used.Input/Output Parameters
N (input) INTEGER The order of the state-space representation of G, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of columns of the matrix B and the number of rows of the matrices CW and DW. M >= 0. M represents the dimension of the input vector of the system with the transfer-function matrix G and also the dimension of the output vector of the system with the transfer-function matrix W. P (input) INTEGER The number of rows of the matrix C and the number of columns of the matrices BV and DV. P >= 0. P represents the dimension of the output vector of the system with the transfer-function matrix G and also the dimension of the input vector of the system with the transfer-function matrix V. NV (input) INTEGER The order of the matrix AV. Also the number of rows of the matrix BV and the number of columns of the matrix CV. NV represents the dimension of the state vector of the system with the transfer-function matrix V. NV >= 0. PV (input) INTEGER The number of rows of the matrices CV and DV. PV >= 0. PV represents the dimension of the output vector of the system with the transfer-function matrix V. NW (input) INTEGER The order of the matrix AW. Also the number of rows of the matrix BW and the number of columns of the matrix CW. NW represents the dimension of the state vector of the system with the transfer-function matrix W. NW >= 0. MW (input) INTEGER The number of columns of the matrices BW and DW. MW >= 0. MW represents the dimension of the input vector of the system with the transfer-function matrix W. ALPHAC (input) DOUBLE PRECISION Combination method parameter for defining the frequency-weighted controllability Grammian (see METHOD); ABS(ALPHAC) <= 1. ALPHAO (input) DOUBLE PRECISION Combination method parameter for defining the frequency-weighted observability Grammian (see METHOD); ABS(ALPHAO) <= 1. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A (of the system with the transfer-function matrix G) in a real Schur form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the state/output matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). AV (input) DOUBLE PRECISION array, dimension (LDAV,NV) If WEIGHT = 'L' or 'B', the leading NV-by-NV part of this array must contain the state matrix AV (of the system with the transfer-function matrix V) in a real Schur form. AV is not referenced if WEIGHT = 'R' or 'N'. LDAV INTEGER The leading dimension of array AV. LDAV >= MAX(1,NV), if WEIGHT = 'L' or 'B'; LDAV >= 1, if WEIGHT = 'R' or 'N'. BV (input) DOUBLE PRECISION array, dimension (LDBV,P) If WEIGHT = 'L' or 'B', the leading NV-by-P part of this array must contain the input matrix BV of the system with the transfer-function matrix V. BV is not referenced if WEIGHT = 'R' or 'N'. LDBV INTEGER The leading dimension of array BV. LDBV >= MAX(1,NV), if WEIGHT = 'L' or 'B'; LDBV >= 1, if WEIGHT = 'R' or 'N'. CV (input) DOUBLE PRECISION array, dimension (LDCV,NV) If WEIGHT = 'L' or 'B', the leading PV-by-NV part of this array must contain the output matrix CV of the system with the transfer-function matrix V. CV is not referenced if WEIGHT = 'R' or 'N'. LDCV INTEGER The leading dimension of array CV. LDCV >= MAX(1,PV), if WEIGHT = 'L' or 'B'; LDCV >= 1, if WEIGHT = 'R' or 'N'. DV (input) DOUBLE PRECISION array, dimension (LDDV,P) If WEIGHT = 'L' or 'B', the leading PV-by-P part of this array must contain the feedthrough matrix DV of the system with the transfer-function matrix V. DV is not referenced if WEIGHT = 'R' or 'N'. LDDV INTEGER The leading dimension of array DV. LDDV >= MAX(1,PV), if WEIGHT = 'L' or 'B'; LDDV >= 1, if WEIGHT = 'R' or 'N'. AW (input) DOUBLE PRECISION array, dimension (LDAW,NW) If WEIGHT = 'R' or 'B', the leading NW-by-NW part of this array must contain the state matrix AW (of the system with the transfer-function matrix W) in a real Schur form. AW is not referenced if WEIGHT = 'L' or 'N'. LDAW INTEGER The leading dimension of array AW. LDAW >= MAX(1,NW), if WEIGHT = 'R' or 'B'; LDAW >= 1, if WEIGHT = 'L' or 'N'. BW (input) DOUBLE PRECISION array, dimension (LDBW,MW) If WEIGHT = 'R' or 'B', the leading NW-by-MW part of this array must contain the input matrix BW of the system with the transfer-function matrix W. BW is not referenced if WEIGHT = 'L' or 'N'. LDBW INTEGER The leading dimension of array BW. LDBW >= MAX(1,NW), if WEIGHT = 'R' or 'B'; LDBW >= 1, if WEIGHT = 'L' or 'N'. CW (input) DOUBLE PRECISION array, dimension (LDCW,NW) If WEIGHT = 'R' or 'B', the leading M-by-NW part of this array must contain the output matrix CW of the system with the transfer-function matrix W. CW is not referenced if WEIGHT = 'L' or 'N'. LDCW INTEGER The leading dimension of array CW. LDCW >= MAX(1,M), if WEIGHT = 'R' or 'B'; LDCW >= 1, if WEIGHT = 'L' or 'N'. DW (input) DOUBLE PRECISION array, dimension (LDDW,MW) If WEIGHT = 'R' or 'B', the leading M-by-MW part of this array must contain the feedthrough matrix DW of the system with the transfer-function matrix W. DW is not referenced if WEIGHT = 'L' or 'N'. LDDW INTEGER The leading dimension of array DW. LDDW >= MAX(1,M), if WEIGHT = 'R' or 'B'; LDDW >= 1, if WEIGHT = 'L' or 'N'. SCALEC (output) DOUBLE PRECISION Scaling factor for the controllability Grammian in (1) or (3). See METHOD. SCALEO (output) DOUBLE PRECISION Scaling factor for the observability Grammian in (2) or (4). See METHOD. S (output) DOUBLE PRECISION array, dimension (LDS,N) The leading N-by-N upper triangular part of this array contains the Cholesky factor S of the frequency-weighted cotrollability Grammian P = S*S'. See METHOD. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,N). R (output) DOUBLE PRECISION array, dimension (LDR,N) The leading N-by-N upper triangular part of this array contains the Cholesky factor R of the frequency-weighted observability Grammian Q = R'*R. See METHOD. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, LLEFT, LRIGHT ), where LLEFT = (N+NV)*(N+NV+MAX(N+NV,PV)+5) if WEIGHT = 'L' or 'B' and PV > 0; LLEFT = N*(P+5) if WEIGHT = 'R' or 'N' or PV = 0; LRIGHT = (N+NW)*(N+NW+MAX(N+NW,MW)+5) if WEIGHT = 'R' or 'B' and MW > 0; LRIGHT = N*(M+5) if WEIGHT = 'L' or 'N' or MW = 0. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the state matrices A and/or AV are not stable or not in a real Schur form; = 2: if the state matrices A and/or AW are not stable or not in a real Schur form; = 3: eigenvalues computation failure.Method
Let Pi = Si*Si' and Qo = Ro'*Ro be the Cholesky factored controllability and observability Grammians satisfying in the continuous-time case Ai*Pi + Pi*Ai' + scalec^2*Bi*Bi' = 0, (1) Ao'*Qo + Qo*Ao + scaleo^2*Co'*Co = 0, (2) and in the discrete-time case Ai*Pi*Ai' - Pi + scalec^2*Bi*Bi' = 0, (3) Ao'*Qo*Ao - Qo + scaleo^2*Co'*Co = 0, (4) where Ai = ( A B*Cw ) , Bi = ( B*Dw ) , ( 0 Aw ) ( Bw ) Ao = ( A 0 ) , Co = ( Dv*C Cv ) . ( Bv*C Av ) Consider the partitioned Grammians Pi = ( P11 P12 ) and Qo = ( Q11 Q12 ) , ( P12' P22 ) ( Q12' Q22 ) where P11 and Q11 are the leading N-by-N parts of Pi and Qo, respectively, and let P0 and Q0 be non-negative definite matrices defined in the combination method [4] -1 P0 = P11 - ALPHAC**2*P12*P22 *P21 , -1 Q0 = Q11 - ALPHAO**2*Q12*Q22 *Q21. The frequency-weighted controllability and observability Grammians, P and Q, respectively, are defined as follows: P = P0 if JOBC = 'S' (standard combination method [4]); P = P1 >= P0 if JOBC = 'E', where P1 is the controllability Grammian defined to enforce stability for a modified combination method of [4]; Q = Q0 if JOBO = 'S' (standard combination method [4]); Q = Q1 >= Q0 if JOBO = 'E', where Q1 is the observability Grammian defined to enforce stability for a modified combination method of [4]. If JOBC = JOBO = 'S' and ALPHAC = ALPHAO = 0, the choice of Grammians corresponds to the method of Enns [1], while if ALPHAC = ALPHAO = 1, the choice of Grammians corresponds to the method of Lin and Chiu [2,3]. The routine computes directly the Cholesky factors S and R such that P = S*S' and Q = R'*R according to formulas developed in [4]. No matrix inversions are involved.References
[1] Enns, D. Model reduction with balanced realizations: An error bound and a frequency weighted generalization. Proc. CDC, Las Vegas, pp. 127-132, 1984. [2] Lin, C.-A. and Chiu, T.-Y. Model reduction via frequency-weighted balanced realization. Control Theory and Advanced Technology, vol. 8, pp. 341-351, 1992. [3] Sreeram, V., Anderson, B.D.O and Madievski, A.G. New results on frequency weighted balanced reduction technique. Proc. ACC, Seattle, Washington, pp. 4004-4009, 1995. [4] Varga, A. and Anderson, B.D.O. Square-root balancing-free methods for the frequency-weighted balancing related model reduction. (report in preparation)Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for an original state-space representation (A,B,C,D) by using the frequency weighted optimal Hankel-norm approximation method. The Hankel norm of the weighted error op(V)*(G-Gr)*op(W) is minimized, where G and Gr are the transfer-function matrices of the original and reduced systems, respectively, V and W are invertible transfer-function matrices representing the left and right frequency weights, and op(X) denotes X, inv(X), conj(X) or conj(inv(X)). V and W are specified by their state space realizations (AV,BV,CV,DV) and (AW,BW,CW,DW), respectively. When minimizing ||V*(G-Gr)*W||, V and W must be antistable. When minimizing inv(V)*(G-Gr)*inv(W), V and W must have only antistable zeros. When minimizing conj(V)*(G-Gr)*conj(W), V and W must be stable. When minimizing conj(inv(V))*(G-Gr)*conj(inv(W)), V and W must be minimum-phase. If the original system is unstable, then the frequency weighted Hankel-norm approximation is computed only for the ALPHA-stable part of the system. For a transfer-function matrix G, conj(G) denotes the conjugate of G given by G'(-s) for a continuous-time system or G'(1/z) for a discrete-time system.Specification
SUBROUTINE AB09JD( JOBV, JOBW, JOBINV, DICO, EQUIL, ORDSEL, $ N, NV, NW, M, P, NR, ALPHA, A, LDA, B, LDB, $ C, LDC, D, LDD, AV, LDAV, BV, LDBV, $ CV, LDCV, DV, LDDV, AW, LDAW, BW, LDBW, $ CW, LDCW, DW, LDDW, NS, HSV, TOL1, TOL2, $ IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOBINV, JOBV, JOBW, ORDSEL INTEGER INFO, IWARN, LDA, LDAV, LDAW, LDB, LDBV, LDBW, $ LDC, LDCV, LDCW, LDD, LDDV, LDDW, LDWORK, M, N, $ NR, NS, NV, NW, P DOUBLE PRECISION ALPHA, TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), AV(LDAV,*), AW(LDAW,*), $ B(LDB,*), BV(LDBV,*), BW(LDBW,*), $ C(LDC,*), CV(LDCV,*), CW(LDCW,*), $ D(LDD,*), DV(LDDV,*), DW(LDDW,*), DWORK(*), $ HSV(*)Arguments
Mode Parameters
JOBV CHARACTER*1 Specifies the left frequency-weighting as follows: = 'N': V = I; = 'V': op(V) = V; = 'I': op(V) = inv(V); = 'C': op(V) = conj(V); = 'R': op(V) = conj(inv(V)). JOBW CHARACTER*1 Specifies the right frequency-weighting as follows: = 'N': W = I; = 'W': op(W) = W; = 'I': op(W) = inv(W); = 'C': op(W) = conj(W); = 'R': op(W) = conj(inv(W)). JOBINV CHARACTER*1 Specifies the computational approach to be used as follows: = 'N': use the inverse free descriptor system approach; = 'I': use the inversion based standard approach; = 'A': switch automatically to the inverse free descriptor approach in case of badly conditioned feedthrough matrices in V or W (see METHOD). DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e., the order of the matrix A. N >= 0. NV (input) INTEGER The order of the realization of the left frequency weighting V, i.e., the order of the matrix AV. NV >= 0. NW (input) INTEGER The order of the realization of the right frequency weighting W, i.e., the order of the matrix AW. NW >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), NR is set as follows: if ORDSEL = 'F', NR is equal to NU+MIN(MAX(0,NR-NU-KR+1),NMIN), where KR is the multiplicity of the Hankel singular value HSV(NR-NU+1), NR is the desired order on entry, and NMIN is the order of a minimal realization of the ALPHA-stable part of the given system; NMIN is determined as the number of Hankel singular values greater than NS*EPS*HNORM(As,Bs,Cs), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(As,Bs,Cs) is the Hankel norm of the ALPHA-stable part of the weighted system (computed in HSV(1)); if ORDSEL = 'A', NR is the sum of NU and the number of Hankel singular values greater than MAX(TOL1,NS*EPS*HNORM(As,Bs,Cs)). ALPHA (input) DOUBLE PRECISION Specifies the ALPHA-stability boundary for the eigenvalues of the state dynamics matrix A. For a continuous-time system (DICO = 'C'), ALPHA <= 0 is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), 0 <= ALPHA <= 1 represents the boundary value for the moduli of eigenvalues. The ALPHA-stability domain does not include the boundary. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system in a real Schur form. The resulting A has a block-diagonal form with two blocks. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), the leading NU-by-NU block contains the unreduced part of A corresponding to ALPHA-unstable eigenvalues. The trailing (NR+NS-N)-by-(NR+NS-N) block contains the reduced part of A corresponding to ALPHA-stable eigenvalues. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). AV (input/output) DOUBLE PRECISION array, dimension (LDAV,NV) On entry, if JOBV <> 'N', the leading NV-by-NV part of this array must contain the state matrix AV of a state space realization of the left frequency weighting V. On exit, if JOBV <> 'N', and INFO = 0, the leading NV-by-NV part of this array contains the real Schur form of AV. AV is not referenced if JOBV = 'N'. LDAV INTEGER The leading dimension of the array AV. LDAV >= MAX(1,NV), if JOBV <> 'N'; LDAV >= 1, if JOBV = 'N'. BV (input/output) DOUBLE PRECISION array, dimension (LDBV,P) On entry, if JOBV <> 'N', the leading NV-by-P part of this array must contain the input matrix BV of a state space realization of the left frequency weighting V. On exit, if JOBV <> 'N', and INFO = 0, the leading NV-by-P part of this array contains the transformed input matrix BV corresponding to the transformed AV. BV is not referenced if JOBV = 'N'. LDBV INTEGER The leading dimension of the array BV. LDBV >= MAX(1,NV), if JOBV <> 'N'; LDBV >= 1, if JOBV = 'N'. CV (input/output) DOUBLE PRECISION array, dimension (LDCV,NV) On entry, if JOBV <> 'N', the leading P-by-NV part of this array must contain the output matrix CV of a state space realization of the left frequency weighting V. On exit, if JOBV <> 'N', and INFO = 0, the leading P-by-NV part of this array contains the transformed output matrix CV corresponding to the transformed AV. CV is not referenced if JOBV = 'N'. LDCV INTEGER The leading dimension of the array CV. LDCV >= MAX(1,P), if JOBV <> 'N'; LDCV >= 1, if JOBV = 'N'. DV (input) DOUBLE PRECISION array, dimension (LDDV,P) If JOBV <> 'N', the leading P-by-P part of this array must contain the feedthrough matrix DV of a state space realization of the left frequency weighting V. DV is not referenced if JOBV = 'N'. LDDV INTEGER The leading dimension of the array DV. LDDV >= MAX(1,P), if JOBV <> 'N'; LDDV >= 1, if JOBV = 'N'. AW (input/output) DOUBLE PRECISION array, dimension (LDAW,NW) On entry, if JOBW <> 'N', the leading NW-by-NW part of this array must contain the state matrix AW of a state space realization of the right frequency weighting W. On exit, if JOBW <> 'N', and INFO = 0, the leading NW-by-NW part of this array contains the real Schur form of AW. AW is not referenced if JOBW = 'N'. LDAW INTEGER The leading dimension of the array AW. LDAW >= MAX(1,NW), if JOBW <> 'N'; LDAW >= 1, if JOBW = 'N'. BW (input/output) DOUBLE PRECISION array, dimension (LDBW,M) On entry, if JOBW <> 'N', the leading NW-by-M part of this array must contain the input matrix BW of a state space realization of the right frequency weighting W. On exit, if JOBW <> 'N', and INFO = 0, the leading NW-by-M part of this array contains the transformed input matrix BW corresponding to the transformed AW. BW is not referenced if JOBW = 'N'. LDBW INTEGER The leading dimension of the array BW. LDBW >= MAX(1,NW), if JOBW <> 'N'; LDBW >= 1, if JOBW = 'N'. CW (input/output) DOUBLE PRECISION array, dimension (LDCW,NW) On entry, if JOBW <> 'N', the leading M-by-NW part of this array must contain the output matrix CW of a state space realization of the right frequency weighting W. On exit, if JOBW <> 'N', and INFO = 0, the leading M-by-NW part of this array contains the transformed output matrix CW corresponding to the transformed AW. CW is not referenced if JOBW = 'N'. LDCW INTEGER The leading dimension of the array CW. LDCW >= MAX(1,M), if JOBW <> 'N'; LDCW >= 1, if JOBW = 'N'. DW (input) DOUBLE PRECISION array, dimension (LDDW,M) If JOBW <> 'N', the leading M-by-M part of this array must contain the feedthrough matrix DW of a state space realization of the right frequency weighting W. DW is not referenced if JOBW = 'N'. LDDW INTEGER The leading dimension of the array DW. LDDW >= MAX(1,M), if JOBW <> 'N'; LDDW >= 1, if JOBW = 'N'. NS (output) INTEGER The dimension of the ALPHA-stable subsystem. HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, the leading NS elements of this array contain the Hankel singular values, ordered decreasingly, of the projection G1s of op(V)*G1*op(W) (see METHOD), where G1 is the ALPHA-stable part of the original system.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL1 = c*HNORM(G1s), where c is a constant in the interval [0.00001,0.001], and HNORM(G1s) is the Hankel-norm of the projection G1s of op(V)*G1*op(W) (see METHOD), computed in HSV(1). If TOL1 <= 0 on entry, the used default value is TOL1 = NS*EPS*HNORM(G1s), where NS is the number of ALPHA-stable eigenvalues of A and EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL1 is ignored. TOL1 < 1. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the ALPHA-stable part of the given system. The recommended value is TOL2 = NS*EPS*HNORM(G1s). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0 and ORDSEL = 'A', then TOL2 <= TOL1. TOL2 < 1.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = MAX(1,M,c,d), if DICO = 'C', LIWORK = MAX(1,N,M,c,d), if DICO = 'D', where c = 0, if JOBV = 'N', c = MAX(2*P,NV+P+N+6,2*NV+P+2), if JOBV <> 'N', d = 0, if JOBW = 'N', d = MAX(2*M,NW+M+N+6,2*NW+M+2), if JOBW <> 'N'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( LDW1, LDW2, LDW3, LDW4 ), where for NVP = NV+P and NWM = NW+M we have LDW1 = 0 if JOBV = 'N' and LDW1 = 2*NVP*(NVP+P) + P*P + MAX( 2*NVP*NVP + MAX( 11*NVP+16, P*NVP ), NVP*N + MAX( NVP*N+N*N, P*N, P*M ) ) if JOBV <> 'N', LDW2 = 0 if JOBW = 'N' and LDW2 = 2*NWM*(NWM+M) + M*M + MAX( 2*NWM*NWM + MAX( 11*NWM+16, M*NWM ), NWM*N + MAX( NWM*N+N*N, M*N, P*M ) ) if JOBW <> 'N', LDW3 = N*(2*N + MAX(N,M,P) + 5) + N*(N+1)/2, LDW4 = N*(M+P+2) + 2*M*P + MIN(N,M) + MAX( 3*M+1, MIN(N,M)+P ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than NSMIN, the sum of the order of the ALPHA-unstable part and the order of a minimal realization of the ALPHA-stable part of the given system. In this case, the resulting NR is set equal to NSMIN. = 2: with ORDSEL = 'F', the selected order NR is less than the order of the ALPHA-unstable part of the given system. In this case NR is set equal to the order of the ALPHA-unstable part.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the computation of the ordered real Schur form of A failed; = 2: the separation of the ALPHA-stable/unstable diagonal blocks failed because of very close eigenvalues; = 3: the reduction of AV to a real Schur form failed; = 4: the reduction of AW to a real Schur form failed; = 5: the reduction to generalized Schur form of the descriptor pair corresponding to the inverse of V failed; = 6: the reduction to generalized Schur form of the descriptor pair corresponding to the inverse of W failed; = 7: the computation of Hankel singular values failed; = 8: the computation of stable projection in the Hankel-norm approximation algorithm failed; = 9: the order of computed stable projection in the Hankel-norm approximation algorithm differs from the order of Hankel-norm approximation; = 10: the reduction of AV-BV*inv(DV)*CV to a real Schur form failed; = 11: the reduction of AW-BW*inv(DW)*CW to a real Schur form failed; = 12: the solution of the Sylvester equation failed because the poles of V (if JOBV = 'V') or of conj(V) (if JOBV = 'C') are not distinct from the poles of G1 (see METHOD); = 13: the solution of the Sylvester equation failed because the poles of W (if JOBW = 'W') or of conj(W) (if JOBW = 'C') are not distinct from the poles of G1 (see METHOD); = 14: the solution of the Sylvester equation failed because the zeros of V (if JOBV = 'I') or of conj(V) (if JOBV = 'R') are not distinct from the poles of G1sr (see METHOD); = 15: the solution of the Sylvester equation failed because the zeros of W (if JOBW = 'I') or of conj(W) (if JOBW = 'R') are not distinct from the poles of G1sr (see METHOD); = 16: the solution of the generalized Sylvester system failed because the zeros of V (if JOBV = 'I') or of conj(V) (if JOBV = 'R') are not distinct from the poles of G1sr (see METHOD); = 17: the solution of the generalized Sylvester system failed because the zeros of W (if JOBW = 'I') or of conj(W) (if JOBW = 'R') are not distinct from the poles of G1sr (see METHOD); = 18: op(V) is not antistable; = 19: op(W) is not antistable; = 20: V is not invertible; = 21: W is not invertible.Method
Let G be the transfer-function matrix of the original linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t), (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09JD determines the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t), (2) such that the corresponding transfer-function matrix Gr minimizes the Hankel-norm of the frequency-weighted error op(V)*(G-Gr)*op(W). (3) For minimizing (3) with op(V) = V and op(W) = W, V and W are assumed to have poles distinct from those of G, while with op(V) = conj(V) and op(W) = conj(W), conj(V) and conj(W) are assumed to have poles distinct from those of G. For minimizing (3) with op(V) = inv(V) and op(W) = inv(W), V and W are assumed to have zeros distinct from the poles of G, while with op(V) = conj(inv(V)) and op(W) = conj(inv(W)), conj(V) and conj(W) are assumed to have zeros distinct from the poles of G. Note: conj(G) = G'(-s) for a continuous-time system and conj(G) = G'(1/z) for a discrete-time system. The following procedure is used to reduce G (see [1]): 1) Decompose additively G as G = G1 + G2, such that G1 = (A1,B1,C1,D) has only ALPHA-stable poles and G2 = (A2,B2,C2,0) has only ALPHA-unstable poles. 2) Compute G1s, the projection of op(V)*G1*op(W) containing the poles of G1, using explicit formulas [4] or the inverse-free descriptor system formulas of [5]. 3) Determine G1sr, the optimal Hankel-norm approximation of G1s, of order r. 4) Compute G1r, the projection of inv(op(V))*G1sr*inv(op(W)) containing the poles of G1sr, using explicit formulas [4] or the inverse-free descriptor system formulas of [5]. 5) Assemble the reduced model Gr as Gr = G1r + G2. To reduce the weighted ALPHA-stable part G1s at step 3, the optimal Hankel-norm approximation method of [2], based on the square-root balancing projection formulas of [3], is employed. The optimal weighted approximation error satisfies HNORM[op(V)*(G-Gr)*op(W)] >= S(r+1), where S(r+1) is the (r+1)-th Hankel singular value of G1s, the transfer-function matrix computed at step 2 of the above procedure, and HNORM(.) denotes the Hankel-norm.References
[1] Latham, G.A. and Anderson, B.D.O. Frequency-weighted optimal Hankel-norm approximation of stable transfer functions. Systems & Control Letters, Vol. 5, pp. 229-236, 1985. [2] Glover, K. All optimal Hankel norm approximation of linear multivariable systems and their L-infinity error bounds. Int. J. Control, Vol. 36, pp. 1145-1193, 1984. [3] Tombs, M.S. and Postlethwaite, I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987. [4] Varga, A. Explicit formulas for an efficient implementation of the frequency-weighting model reduction approach. Proc. 1993 European Control Conference, Groningen, NL, pp. 693-696, 1993. [5] Varga, A. Efficient and numerically reliable implementation of the frequency-weighted Hankel-norm approximation model reduction approach. Proc. 2001 ECC, Porto, Portugal, 2001.Numerical Aspects
The implemented methods rely on an accuracy enhancing square-root technique.Further Comments
NoneExample
Program Text
* AB09JD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX, NVMAX, NVPMAX, NWMAX, NWMMAX, PMAX PARAMETER ( MMAX = 20, NMAX = 20, NVMAX = 10, NWMAX = 10, $ PMAX = 20, NVPMAX = NVMAX + PMAX, $ NWMMAX = NWMAX + MMAX ) INTEGER LDA, LDAV, LDAW, LDB, LDBV, LDBW, $ LDC, LDCV, LDCW, LDD, LDDV, LDDW PARAMETER ( LDA = NMAX, LDAV = NVMAX, LDAW = NWMAX, $ LDB = NMAX, LDBV = NVMAX, LDBW = NWMAX, $ LDC = PMAX, LDCV = PMAX, LDCW = MMAX, $ LDD = PMAX, LDDV = PMAX, LDDW = MMAX ) INTEGER LIW1, LIW2, LIW3, LIWORK PARAMETER ( LIW1 = 2*MAX( MMAX, PMAX ), $ LIW2 = MAX( NVPMAX, NWMMAX ) + NMAX + 6, $ LIW3 = MAX( 2*NVMAX + PMAX + 2, $ 2*NWMAX + MMAX + 2 ) ) PARAMETER ( LIWORK = MAX( LIW1, LIW2, LIW3 ) ) INTEGER LDW1, LDW2, LDW3, LDW4, LDWORK PARAMETER ( LDW1 = 2*NVPMAX*( NVPMAX + PMAX ) + PMAX*PMAX + $ MAX( 2*NVPMAX*NVPMAX + $ MAX( 11*NVPMAX + 16, PMAX*NVPMAX ), $ NVPMAX*NMAX + $ MAX( NVPMAX*NMAX + NMAX*NMAX, $ PMAX*NMAX, PMAX*MMAX ) ) ) PARAMETER ( LDW2 = 2*NWMMAX*( NWMMAX + MMAX ) + MMAX*MMAX + $ MAX( 2*NWMMAX*NWMMAX + $ MAX( 11*NWMMAX + 16, MMAX*NWMMAX ), $ NWMMAX*NMAX + $ MAX( NWMMAX*NMAX + NMAX*NMAX, $ MMAX*NMAX, PMAX*MMAX ) ) ) PARAMETER ( LDW3 = NMAX*( 2*NMAX + MAX( NMAX, MMAX, PMAX ) $ + 5 ) + ( NMAX*( NMAX + 1 ) )/2 ) PARAMETER ( LDW4 = NMAX*( MMAX + PMAX + 2 ) + 2*MMAX*PMAX + $ MIN( NMAX, MMAX ) + $ MAX( 3*MMAX + 1, $ MIN( NMAX, MMAX ) + PMAX ) ) PARAMETER ( LDWORK = MAX( LDW1, LDW2, LDW3, LDW4 ) ) * .. Local Scalars .. LOGICAL LEFTW, RIGHTW DOUBLE PRECISION ALPHA, TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, N, NR, NS, NV, NW, P CHARACTER*1 DICO, EQUIL, JOBINV, JOBV, JOBW, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), AV(LDAV,NVMAX), AW(LDAW,NWMAX), $ B(LDB,MMAX), BV(LDBV,PMAX), BW(LDBW,MMAX), $ C(LDC,NMAX), CV(LDCV,NVMAX), CW(LDCW,NWMAX), $ D(LDD,MMAX), DV(LDDV,PMAX), DW(LDDW,MMAX), $ DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL AB09JD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NV, NW, NR, ALPHA, TOL1, TOL2, $ JOBV, JOBW, JOBINV, DICO, EQUIL, ORDSEL LEFTW = .NOT.LSAME( JOBV, 'N' ) RIGHTW = .NOT.LSAME( JOBW, 'N' ) 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 ) IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) IF( LEFTW ) THEN IF( NV.LT.0 .OR. NV.GT.NVMAX ) THEN WRITE ( NOUT, FMT = 99986 ) NV ELSE IF( NV.GT.0 ) THEN READ ( NIN, FMT = * ) $ ( ( AV(I,J), J = 1,NV ), I = 1,NV ) READ ( NIN, FMT = * ) $ ( ( BV(I,J), J = 1,P ), I = 1,NV ) READ ( NIN, FMT = * ) $ ( ( CV(I,J), J = 1,NV ), I = 1,P ) END IF IF( LEFTW ) $ READ ( NIN, FMT = * ) $ ( ( DV(I,J), J = 1,P ), I = 1,P ) END IF END IF IF( RIGHTW ) THEN IF( NW.LT.0 .OR. NW.GT.NWMAX ) THEN WRITE ( NOUT, FMT = 99985 ) NW ELSE IF( NW.GT.0 ) THEN READ ( NIN, FMT = * ) $ ( ( AW(I,J), J = 1,NW ), I = 1,NW ) READ ( NIN, FMT = * ) $ ( ( BW(I,J), J = 1,M ), I = 1,NW ) READ ( NIN, FMT = * ) $ ( ( CW(I,J), J = 1,NW ), I = 1,M ) END IF READ ( NIN, FMT = * ) $ ( ( DW(I,J), J = 1,M ), I = 1,M ) END IF END IF * Find a reduced ssr for (A,B,C,D). CALL AB09JD( JOBV, JOBW, JOBINV, DICO, EQUIL, ORDSEL, N, $ NV, NW, M, P, NR, ALPHA, A, LDA, B, LDB, $ C, LDC, D, LDD, AV, LDAV, BV, LDBV, $ CV, LDCV, DV, LDDV, AW, LDAW, BW, LDBW, $ CW, LDCW, DW, LDDW, NS, HSV, TOL1, TOL2, $ IWORK, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( IWARN.NE.0 ) WRITE ( NOUT, FMT = 99994 ) IWARN WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1, NS ) IF( NR.GT.0 ) THEN WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE END IF WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09JD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09JD = ',I2) 99997 FORMAT (/' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' IWARN on exit from AB09JD = ',I2) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of weighted ALPHA-stable', $ ' part are') 99986 FORMAT (/' NV is out of range.',/' NV = ',I5) 99985 FORMAT (/' NW is out of range.',/' NW = ',I5) ENDProgram Data
AB09JD EXAMPLE PROGRAM DATA (Continuous system) 6 1 1 2 0 0 0.0 1.E-1 1.E-14 V N I C S A -3.8637 -7.4641 -9.1416 -7.4641 -3.8637 -1.0000 1.0000 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 1.0000 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0.2000 -1.0000 1.0000 0 1 0 -1.8000 0 1Program Results
AB09JD EXAMPLE PROGRAM RESULTS The order of reduced model = 4 The Hankel singular values of weighted ALPHA-stable part are 2.6790 2.1589 0.8424 0.1929 0.0219 0.0011 The reduced state dynamics matrix Ar is -0.2391 0.3072 1.1630 1.1967 -2.9709 -0.2391 2.6270 3.1027 0.0000 0.0000 -0.5137 -1.2842 0.0000 0.0000 0.1519 -0.5137 The reduced input/state matrix Br is -1.0497 -3.7052 0.8223 0.7435 The reduced state/output matrix Cr is -0.4466 0.0143 -0.4780 -0.2013 The reduced input/output matrix Dr is 0.0219
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09JV.html 0000664 0000000 0000000 00000034137 14560147231 0020355 0 ustar 00root root 0000000 0000000
Purpose
To construct a state-space representation (A,BS,CS,DS) of the projection of V*G or conj(V)*G containing the poles of G, from the state-space representations (A,B,C,D) and (AV-lambda*EV,BV,CV,DV), of the transfer-function matrices G and V, respectively. G is assumed to be a stable transfer-function matrix and the state matrix A must be in a real Schur form. When computing the stable projection of V*G, it is assumed that G and V have completely distinct poles. When computing the stable projection of conj(V)*G, it is assumed that G and conj(V) have completely distinct poles. Note: For a transfer-function matrix G, conj(G) denotes the conjugate of G given by G'(-s) for a continuous-time system or G'(1/z) for a discrete-time system.Specification
SUBROUTINE AB09JV( JOB, DICO, JOBEV, STBCHK, N, M, P, NV, PV, $ A, LDA, B, LDB, C, LDC, D, LDD, AV, LDAV, $ EV, LDEV, BV, LDBV, CV, LDCV, DV, LDDV, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOB, JOBEV, STBCHK INTEGER INFO, LDA, LDAV, LDB, LDBV, LDC, LDCV, $ LDD, LDDV, LDEV, LDWORK, M, N, NV, P, PV C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), AV(LDAV,*), B(LDB,*), BV(LDBV,*), $ C(LDC,*), CV(LDCV,*), D(LDD,*), DV(LDDV,*), $ DWORK(*), EV(LDEV,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the projection to be computed as follows: = 'V': compute the projection of V*G containing the poles of G; = 'C': compute the projection of conj(V)*G containing the poles of G. DICO CHARACTER*1 Specifies the type of the systems as follows: = 'C': G and V are continuous-time systems; = 'D': G and V are discrete-time systems. JOBEV CHARACTER*1 Specifies whether EV is a general square or an identity matrix as follows: = 'G': EV is a general square matrix; = 'I': EV is the identity matrix. STBCHK CHARACTER*1 Specifies whether stability/antistability of V is to be checked as follows: = 'C': check stability if JOB = 'C' or antistability if JOB = 'V'; = 'N': do not check stability or antistability.Input/Output Parameters
N (input) INTEGER The dimension of the state vector of the system with the transfer-function matrix G. N >= 0. M (input) INTEGER The dimension of the input vector of the system with the transfer-function matrix G. M >= 0. P (input) INTEGER The dimension of the output vector of the system with the transfer-function matrix G, and also the dimension of the input vector if JOB = 'V', or of the output vector if JOB = 'C', of the system with the transfer-function matrix V. P >= 0. NV (input) INTEGER The dimension of the state vector of the system with the transfer-function matrix V. NV >= 0. PV (input) INTEGER The dimension of the output vector, if JOB = 'V', or of the input vector, if JOB = 'C', of the system with the transfer-function matrix V. PV >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the system with the transfer-function matrix G in a real Schur form. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B of the system with the transfer-function matrix G. The matrix BS is equal to B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C of the system with the transfer-function matrix G. On exit, if INFO = 0, the leading PV-by-N part of this array contains the output matrix CS of the projection of V*G, if JOB = 'V', or of conj(V)*G, if JOB = 'C'. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P,PV). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the feedthrough matrix D of the system with the transfer-function matrix G. On exit, if INFO = 0, the leading PV-by-M part of this array contains the feedthrough matrix DS of the projection of V*G, if JOB = 'V', or of conj(V)*G, if JOB = 'C'. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,P,PV). AV (input/output) DOUBLE PRECISION array, dimension (LDAV,NV) On entry, the leading NV-by-NV part of this array must contain the state matrix AV of the system with the transfer-function matrix V. On exit, if INFO = 0, the leading NV-by-NV part of this array contains a condensed matrix as follows: if JOBEV = 'I', it contains the real Schur form of AV; if JOBEV = 'G' and JOB = 'V', it contains a quasi-upper triangular matrix representing the real Schur matrix in the real generalized Schur form of the pair (AV,EV); if JOBEV = 'G', JOB = 'C' and DICO = 'C', it contains a quasi-upper triangular matrix corresponding to the generalized real Schur form of the pair (AV',EV'); if JOBEV = 'G', JOB = 'C' and DICO = 'D', it contains an upper triangular matrix corresponding to the generalized real Schur form of the pair (EV',AV'). LDAV INTEGER The leading dimension of the array AV. LDAV >= MAX(1,NV). EV (input/output) DOUBLE PRECISION array, dimension (LDEV,NV) On entry, if JOBEV = 'G', the leading NV-by-NV part of this array must contain the descriptor matrix EV of the system with the transfer-function matrix V. If JOBEV = 'I', EV is assumed to be an identity matrix and is not referenced. On exit, if INFO = 0 and JOBEV = 'G', the leading NV-by-NV part of this array contains a condensed matrix as follows: if JOB = 'V', it contains an upper triangular matrix corresponding to the real generalized Schur form of the pair (AV,EV); if JOB = 'C' and DICO = 'C', it contains an upper triangular matrix corresponding to the generalized real Schur form of the pair (AV',EV'); if JOB = 'C' and DICO = 'D', it contains a quasi-upper triangular matrix corresponding to the generalized real Schur form of the pair (EV',AV'). LDEV INTEGER The leading dimension of the array EV. LDEV >= MAX(1,NV), if JOBEV = 'G'; LDEV >= 1, if JOBEV = 'I'. BV (input/output) DOUBLE PRECISION array, dimension (LDBV,MBV), where MBV = P, if JOB = 'V', and MBV = PV, if JOB = 'C'. On entry, the leading NV-by-MBV part of this array must contain the input matrix BV of the system with the transfer-function matrix V. On exit, if INFO = 0, the leading NV-by-MBV part of this array contains Q'*BV, where Q is the orthogonal matrix that reduces AV to the real Schur form or the left orthogonal matrix used to reduce the pair (AV,EV), (AV',EV') or (EV',AV') to the generalized real Schur form. LDBV INTEGER The leading dimension of the array BV. LDBV >= MAX(1,NV). CV (input/output) DOUBLE PRECISION array, dimension (LDCV,NV) On entry, the leading PCV-by-NV part of this array must contain the output matrix CV of the system with the transfer-function matrix V, where PCV = PV, if JOB = 'V', or PCV = P, if JOB = 'C'. On exit, if INFO = 0, the leading PCV-by-NV part of this array contains CV*Q, where Q is the orthogonal matrix that reduces AV to the real Schur form, or CV*Z, where Z is the right orthogonal matrix used to reduce the pair (AV,EV), (AV',EV') or (EV',AV') to the generalized real Schur form. LDCV INTEGER The leading dimension of the array CV. LDCV >= MAX(1,PV) if JOB = 'V'; LDCV >= MAX(1,P) if JOB = 'C'. DV (input) DOUBLE PRECISION array, dimension (LDDV,MBV), where MBV = P, if JOB = 'V', and MBV = PV, if JOB = 'C'. The leading PCV-by-MBV part of this array must contain the feedthrough matrix DV of the system with the transfer-function matrix V, where PCV = PV, if JOB = 'V', or PCV = P, if JOB = 'C'. LDDV INTEGER The leading dimension of the array DV. LDDV >= MAX(1,PV) if JOB = 'V'; LDDV >= MAX(1,P) if JOB = 'C'.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = 0, if JOBEV = 'I'; LIWORK = NV+N+6, if JOBEV = 'G'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= LW1, if JOBEV = 'I', LDWORK >= LW2, if JOBEV = 'G', where LW1 = MAX( 1, NV*(NV+5), NV*N + MAX( a, PV*N, PV*M ) ) a = 0, if DICO = 'C' or JOB = 'V', a = 2*NV, if DICO = 'D' and JOB = 'C'; LW2 = MAX( 2*NV*NV + MAX( 11*NV+16, P*NV, PV*NV ), NV*N + MAX( NV*N+N*N, PV*N, PV*M ) ). For good performance, LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of the pair (AV,EV) to the real generalized Schur form failed (JOBEV = 'G'), or the reduction of the matrix AV to the real Schur form failed (JOBEV = 'I); = 2: the solution of the Sylvester equation failed because the matrix A and the pencil AV-lambda*EV have common eigenvalues (if JOB = 'V'), or the pencil -AV-lambda*EV and A have common eigenvalues (if JOB = 'C' and DICO = 'C'), or the pencil AV-lambda*EV has an eigenvalue which is the reciprocal of one of eigenvalues of A (if JOB = 'C' and DICO = 'D'); = 3: the solution of the Sylvester equation failed because the matrices A and AV have common eigenvalues (if JOB = 'V'), or the matrices A and -AV have common eigenvalues (if JOB = 'C' and DICO = 'C'), or the matrix A has an eigenvalue which is the reciprocal of one of eigenvalues of AV (if JOB = 'C' and DICO = 'D'); = 4: JOB = 'V' and the pair (AV,EV) has not completely unstable generalized eigenvalues, or JOB = 'C' and the pair (AV,EV) has not completely stable generalized eigenvalues.Method
If JOB = 'V', the matrices of the stable projection of V*G are computed as BS = B, CS = CV*X + DV*C, DS = DV*D, where X satisfies the generalized Sylvester equation AV*X - EV*X*A + BV*C = 0. If JOB = 'C', the matrices of the stable projection of conj(V)*G are computed using the following formulas: - for a continuous-time system, the matrices BS, CS and DS of the stable projection are computed as BS = B, CS = BV'*X + DV'*C, DS = DV'*D, where X satisfies the generalized Sylvester equation AV'*X + EV'*X*A + CV'*C = 0. - for a discrete-time system, the matrices BS, CS and DS of the stable projection are computed as BS = B, CS = BV'*X*A + DV'*C, DS = DV'*D + BV'*X*B, where X satisfies the generalized Sylvester equation EV'*X - AV'*X*A = CV'*C.References
[1] Varga, A. Efficient and numerically reliable implementation of the frequency-weighted Hankel-norm approximation model reduction approach. Proc. 2001 ECC, Porto, Portugal, 2001. [2] Zhou, K. Frequency-weighted H-infinity norm and optimal Hankel norm model reduction. IEEE Trans. Autom. Control, vol. 40, pp. 1687-1699, 1995.Numerical Aspects
The implemented methods rely on numerically stable algorithms.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct a state-space representation (A,BS,CS,DS) of the projection of G*W or G*conj(W) containing the poles of G, from the state-space representations (A,B,C,D) and (AW-lambda*EW,BW,CW,DW), of the transfer-function matrices G and W, respectively. G is assumed to be a stable transfer-function matrix and the state matrix A must be in a real Schur form. When computing the stable projection of G*W, it is assumed that G and W have completely distinct poles. When computing the stable projection of G*conj(W), it is assumed that G and conj(W) have completely distinct poles. Note: For a transfer-function matrix G, conj(G) denotes the conjugate of G given by G'(-s) for a continuous-time system or G'(1/z) for a discrete-time system.Specification
SUBROUTINE AB09JW( JOB, DICO, JOBEW, STBCHK, N, M, P, NW, MW, $ A, LDA, B, LDB, C, LDC, D, LDD, AW, LDAW, $ EW, LDEW, BW, LDBW, CW, LDCW, DW, LDDW, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOB, JOBEW, STBCHK INTEGER INFO, LDA, LDAW, LDB, LDBW, LDC, LDCW, $ LDD, LDDW, LDEW, LDWORK, M, MW, N, NW, P C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), AW(LDAW,*), B(LDB,*), BW(LDBW,*), $ C(LDC,*), CW(LDCW,*), D(LDD,*), DW(LDDW,*), $ DWORK(*), EW(LDEW,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the projection to be computed as follows: = 'W': compute the projection of G*W containing the poles of G; = 'C': compute the projection of G*conj(W) containing the poles of G. DICO CHARACTER*1 Specifies the type of the systems as follows: = 'C': G and W are continuous-time systems; = 'D': G and W are discrete-time systems. JOBEW CHARACTER*1 Specifies whether EW is a general square or an identity matrix as follows: = 'G': EW is a general square matrix; = 'I': EW is the identity matrix. STBCHK CHARACTER*1 Specifies whether stability/antistability of W is to be checked as follows: = 'C': check stability if JOB = 'C' or antistability if JOB = 'W'; = 'N': do not check stability or antistability.Input/Output Parameters
N (input) INTEGER The dimension of the state vector of the system with the transfer-function matrix G. N >= 0. M (input) INTEGER The dimension of the input vector of the system with the transfer-function matrix G, and also the dimension of the output vector if JOB = 'W', or of the input vector if JOB = 'C', of the system with the transfer-function matrix W. M >= 0. P (input) INTEGER The dimension of the output vector of the system with the transfer-function matrix G. P >= 0. NW (input) INTEGER The dimension of the state vector of the system with the transfer-function matrix W. NW >= 0. MW (input) INTEGER The dimension of the input vector, if JOB = 'W', or of the output vector, if JOB = 'C', of the system with the transfer-function matrix W. MW >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the system with the transfer-function matrix G in a real Schur form. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,MW)) On entry, the leading N-by-M part of this array must contain the input matrix B of the system with the transfer-function matrix G. On exit, if INFO = 0, the leading N-by-MW part of this array contains the input matrix BS of the projection of G*W, if JOB = 'W', or of G*conj(W), if JOB = 'C'. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the output/state matrix C of the system with the transfer-function matrix G. The matrix CS is equal to C. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,MW)) On entry, the leading P-by-M part of this array must contain the feedthrough matrix D of the system with the transfer-function matrix G. On exit, if INFO = 0, the leading P-by-MW part of this array contains the feedthrough matrix DS of the projection of G*W, if JOB = 'W', or of G*conj(W), if JOB = 'C'. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,P). AW (input/output) DOUBLE PRECISION array, dimension (LDAW,NW) On entry, the leading NW-by-NW part of this array must contain the state matrix AW of the system with the transfer-function matrix W. On exit, if INFO = 0, the leading NW-by-NW part of this array contains a condensed matrix as follows: if JOBEW = 'I', it contains the real Schur form of AW; if JOBEW = 'G' and JOB = 'W', it contains a quasi-upper triangular matrix representing the real Schur matrix in the real generalized Schur form of the pair (AW,EW); if JOBEW = 'G', JOB = 'C' and DICO = 'C', it contains a quasi-upper triangular matrix corresponding to the generalized real Schur form of the pair (AW',EW'); if JOBEW = 'G', JOB = 'C' and DICO = 'D', it contains an upper triangular matrix corresponding to the generalized real Schur form of the pair (EW',AW'). LDAW INTEGER The leading dimension of the array AW. LDAW >= MAX(1,NW). EW (input/output) DOUBLE PRECISION array, dimension (LDEW,NW) On entry, if JOBEW = 'G', the leading NW-by-NW part of this array must contain the descriptor matrix EW of the system with the transfer-function matrix W. If JOBEW = 'I', EW is assumed to be an identity matrix and is not referenced. On exit, if INFO = 0 and JOBEW = 'G', the leading NW-by-NW part of this array contains a condensed matrix as follows: if JOB = 'W', it contains an upper triangular matrix corresponding to the real generalized Schur form of the pair (AW,EW); if JOB = 'C' and DICO = 'C', it contains an upper triangular matrix corresponding to the generalized real Schur form of the pair (AW',EW'); if JOB = 'C' and DICO = 'D', it contains a quasi-upper triangular matrix corresponding to the generalized real Schur form of the pair (EW',AW'). LDEW INTEGER The leading dimension of the array EW. LDEW >= MAX(1,NW), if JOBEW = 'G'; LDEW >= 1, if JOBEW = 'I'. BW (input/output) DOUBLE PRECISION array, dimension (LDBW,MBW), where MBW = MW, if JOB = 'W', and MBW = M, if JOB = 'C'. On entry, the leading NW-by-MBW part of this array must contain the input matrix BW of the system with the transfer-function matrix W. On exit, if INFO = 0, the leading NW-by-MBW part of this array contains Q'*BW, where Q is the orthogonal matrix that reduces AW to the real Schur form or the left orthogonal matrix used to reduce the pair (AW,EW), (AW',EW') or (EW',AW') to the generalized real Schur form. LDBW INTEGER The leading dimension of the array BW. LDBW >= MAX(1,NW). CW (input/output) DOUBLE PRECISION array, dimension (LDCW,NW) On entry, the leading PCW-by-NW part of this array must contain the output matrix CW of the system with the transfer-function matrix W, where PCW = M if JOB = 'W' or PCW = MW if JOB = 'C'. On exit, if INFO = 0, the leading PCW-by-NW part of this array contains CW*Q, where Q is the orthogonal matrix that reduces AW to the real Schur form, or CW*Z, where Z is the right orthogonal matrix used to reduce the pair (AW,EW), (AW',EW') or (EW',AW') to the generalized real Schur form. LDCW INTEGER The leading dimension of the array CW. LDCW >= MAX(1,PCW), where PCW = M if JOB = 'W', or PCW = MW if JOB = 'C'. DW (input) DOUBLE PRECISION array, dimension (LDDW,MBW), where MBW = MW if JOB = 'W', and MBW = M if JOB = 'C'. The leading PCW-by-MBW part of this array must contain the feedthrough matrix DW of the system with the transfer-function matrix W, where PCW = M if JOB = 'W', or PCW = MW if JOB = 'C'. LDDW INTEGER LDDW >= MAX(1,PCW), where PCW = M if JOB = 'W', or PCW = MW if JOB = 'C'.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = 0, if JOBEW = 'I'; LIWORK = NW+N+6, if JOBEW = 'G'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= LW1, if JOBEW = 'I', LDWORK >= LW2, if JOBEW = 'G', where LW1 = MAX( 1, NW*(NW+5), NW*N + MAX( a, N*MW, P*MW ) ) a = 0, if DICO = 'C' or JOB = 'W', a = 2*NW, if DICO = 'D' and JOB = 'C'; LW2 = MAX( 2*NW*NW + MAX( 11*NW+16, NW*M, MW*NW ), NW*N + MAX( NW*N+N*N, MW*N, P*MW ) ). For good performance, LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of the pair (AW,EW) to the real generalized Schur form failed (JOBEW = 'G'), or the reduction of the matrix AW to the real Schur form failed (JOBEW = 'I); = 2: the solution of the Sylvester equation failed because the matrix A and the pencil AW-lambda*EW have common eigenvalues (if JOB = 'W'), or the pencil -AW-lambda*EW and A have common eigenvalues (if JOB = 'C' and DICO = 'C'), or the pencil AW-lambda*EW has an eigenvalue which is the reciprocal of one of eigenvalues of A (if JOB = 'C' and DICO = 'D'); = 3: the solution of the Sylvester equation failed because the matrices A and AW have common eigenvalues (if JOB = 'W'), or the matrices A and -AW have common eigenvalues (if JOB = 'C' and DICO = 'C'), or the matrix A has an eigenvalue which is the reciprocal of one of eigenvalues of AW (if JOB = 'C' and DICO = 'D'); = 4: JOB = 'W' and the pair (AW,EW) has not completely unstable generalized eigenvalues, or JOB = 'C' and the pair (AW,EW) has not completely stable generalized eigenvalues.Method
If JOB = 'W', the matrices of the stable projection of G*W are computed as BS = B*DW + Y*BW, CS = C, DS = D*DW, where Y satisfies the generalized Sylvester equation -A*Y*EW + Y*AW + B*CW = 0. If JOB = 'C', the matrices of the stable projection of G*conj(W) are computed using the following formulas: - for a continuous-time system, the matrices BS, CS and DS of the stable projection are computed as BS = B*DW' + Y*CW', CS = C, DS = D*DW', where Y satisfies the generalized Sylvester equation A*Y*EW' + Y*AW' + B*BW' = 0. - for a discrete-time system, the matrices BS, CS and DS of the stable projection are computed as BS = B*DW' + A*Y*CW', CS = C, DS = D*DW' + C*Y*CW', where Y satisfies the generalized Sylvester equation Y*EW' - A*Y*AW' = B*BW'.References
[1] Varga, A. Efficient and numerically reliable implementation of the frequency-weighted Hankel-norm approximation model reduction approach. Proc. 2001 ECC, Porto, Portugal, 2001. [2] Zhou, K. Frequency-weighted H-infinity norm and optimal Hankel norm model reduction. IEEE Trans. Autom. Control, vol. 40, pp. 1687-1699, 1995.Numerical Aspects
The implemented methods rely on numerically stable algorithms.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To check stability/antistability of finite eigenvalues with respect to a given stability domain.Specification
SUBROUTINE AB09JX( DICO, STDOM, EVTYPE, N, ALPHA, ER, EI, ED, $ TOLINF, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EVTYPE, STDOM INTEGER INFO, N DOUBLE PRECISION ALPHA, TOLINF C .. Array Arguments .. DOUBLE PRECISION ED(*), EI(*), ER(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the stability domain as follows: = 'C': for a continuous-time system; = 'D': for a discrete-time system. STDOM CHARACTER*1 Specifies whether the domain of interest is of stability type (left part of complex plane or inside of a circle) or of instability type (right part of complex plane or outside of a circle) as follows: = 'S': stability type domain; = 'U': instability type domain. EVTYPE CHARACTER*1 Specifies whether the eigenvalues arise from a standard or a generalized eigenvalue problem as follows: = 'S': standard eigenvalue problem; = 'G': generalized eigenvalue problem; = 'R': reciprocal generalized eigenvalue problem.Input/Output Parameters
N (input) INTEGER The dimension of vectors ER, EI and ED. N >= 0. ALPHA (input) DOUBLE PRECISION Specifies the boundary of the domain of interest for the eigenvalues. For a continuous-time system (DICO = 'C'), ALPHA is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), ALPHA >= 0 represents the boundary value for the moduli of eigenvalues. ER, EI, (input) DOUBLE PRECISION arrays, dimension (N) ED If EVTYPE = 'S', ER(j) + EI(j)*i, j = 1,...,N, are the eigenvalues of a real matrix. ED is not referenced and is implicitly considered as a vector having all elements equal to one. If EVTYPE = 'G' or EVTYPE = 'R', (ER(j) + EI(j)*i)/ED(j), j = 1,...,N, are the generalized eigenvalues of a pair of real matrices. If ED(j) is zero, then the j-th generalized eigenvalue is infinite. Complex conjugate pairs of eigenvalues must appear consecutively.Tolerances
TOLINF DOUBLE PRECISION If EVTYPE = 'G' or 'R', TOLINF contains the tolerance for detecting infinite generalized eigenvalues. 0 <= TOLINF < 1.Error Indicator
INFO INTEGER = 0: successful exit, i.e., all eigenvalues lie within the domain of interest defined by DICO, STDOM and ALPHA; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: some eigenvalues lie outside the domain of interest defined by DICO, STDOM and ALPHA.Method
The domain of interest for an eigenvalue lambda is defined by the parameters ALPHA, DICO and STDOM as follows: - for a continuous-time system (DICO = 'C'): Real(lambda) < ALPHA if STDOM = 'S'; Real(lambda) > ALPHA if STDOM = 'U'; - for a discrete-time system (DICO = 'D'): Abs(lambda) < ALPHA if STDOM = 'S'; Abs(lambda) > ALPHA if STDOM = 'U'. If EVTYPE = 'R', the same conditions apply for 1/lambda.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for an original state-space representation (A,B,C,D) by using the frequency weighted optimal Hankel-norm approximation method. The Hankel norm of the weighted error V*(G-Gr)*W or conj(V)*(G-Gr)*conj(W) is minimized, where G and Gr are the transfer-function matrices of the original and reduced systems, respectively, and V and W are the transfer-function matrices of the left and right frequency weights, specified by their state space realizations (AV,BV,CV,DV) and (AW,BW,CW,DW), respectively. When minimizing the weighted error V*(G-Gr)*W, V and W must be antistable transfer-function matrices. When minimizing conj(V)*(G-Gr)*conj(W), V and W must be stable transfer-function matrices. Additionally, V and W must be invertible transfer-function matrices, with the feedthrough matrices DV and DW invertible. If the original system is unstable, then the frequency weighted Hankel-norm approximation is computed only for the ALPHA-stable part of the system. For a transfer-function matrix G, conj(G) denotes the conjugate of G given by G'(-s) for a continuous-time system or G'(1/z) for a discrete-time system.Specification
SUBROUTINE AB09KD( JOB, DICO, WEIGHT, EQUIL, ORDSEL, N, NV, NW, M, $ P, NR, ALPHA, A, LDA, B, LDB, C, LDC, D, LDD, $ AV, LDAV, BV, LDBV, CV, LDCV, DV, LDDV, $ AW, LDAW, BW, LDBW, CW, LDCW, DW, LDDW, $ NS, HSV, TOL1, TOL2, IWORK, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOB, ORDSEL, WEIGHT INTEGER INFO, IWARN, LDA, LDAV, LDAW, LDB, LDBV, LDBW, $ LDC, LDCV, LDCW, LDD, LDDV, LDDW, LDWORK, M, N, $ NR, NS, NV, NW, P DOUBLE PRECISION ALPHA, TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), AV(LDAV,*), AW(LDAW,*), $ B(LDB,*), BV(LDBV,*), BW(LDBW,*), $ C(LDC,*), CV(LDCV,*), CW(LDCW,*), $ D(LDD,*), DV(LDDV,*), DW(LDDW,*), DWORK(*), $ HSV(*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the frequency-weighting problem as follows: = 'N': solve min||V*(G-Gr)*W||_H; = 'C': solve min||conj(V)*(G-Gr)*conj(W)||_H. DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. WEIGHT CHARACTER*1 Specifies the type of frequency weighting, as follows: = 'N': no weightings are used (V = I, W = I); = 'L': only left weighting V is used (W = I); = 'R': only right weighting W is used (V = I); = 'B': both left and right weightings V and W are used. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e., the order of the matrix A. N >= 0. NV (input) INTEGER The order of the realization of the left frequency weighting V, i.e., the order of the matrix AV. NV >= 0. NW (input) INTEGER The order of the realization of the right frequency weighting W, i.e., the order of the matrix AW. NW >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), NR is set as follows: if ORDSEL = 'F', NR is equal to NU+MIN(MAX(0,NR-NU-KR+1),NMIN), where KR is the multiplicity of the Hankel singular value HSV(NR-NU+1), NR is the desired order on entry, and NMIN is the order of a minimal realization of the ALPHA-stable part of the given system; NMIN is determined as the number of Hankel singular values greater than NS*EPS*HNORM(As,Bs,Cs), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(As,Bs,Cs) is the Hankel norm of the ALPHA-stable part of the weighted system (computed in HSV(1)); if ORDSEL = 'A', NR is the sum of NU and the number of Hankel singular values greater than MAX(TOL1,NS*EPS*HNORM(As,Bs,Cs)). ALPHA (input) DOUBLE PRECISION Specifies the ALPHA-stability boundary for the eigenvalues of the state dynamics matrix A. For a continuous-time system (DICO = 'C'), ALPHA <= 0 is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), 0 <= ALPHA <= 1 represents the boundary value for the moduli of eigenvalues. The ALPHA-stability domain does not include the boundary. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system in a real Schur form. The resulting A has a block-diagonal form with two blocks. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), the leading NU-by-NU block contains the unreduced part of A corresponding to ALPHA-unstable eigenvalues. The trailing (NR+NS-N)-by-(NR+NS-N) block contains the reduced part of A corresponding to ALPHA-stable eigenvalues. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). AV (input/output) DOUBLE PRECISION array, dimension (LDAV,NV) On entry, if WEIGHT = 'L' or 'B', the leading NV-by-NV part of this array must contain the state matrix AV of a state space realization of the left frequency weighting V. On exit, if WEIGHT = 'L' or 'B', and INFO = 0, the leading NV-by-NV part of this array contains a real Schur form of the state matrix of a state space realization of the inverse of V. AV is not referenced if WEIGHT = 'R' or 'N'. LDAV INTEGER The leading dimension of the array AV. LDAV >= MAX(1,NV), if WEIGHT = 'L' or 'B'; LDAV >= 1, if WEIGHT = 'R' or 'N'. BV (input/output) DOUBLE PRECISION array, dimension (LDBV,P) On entry, if WEIGHT = 'L' or 'B', the leading NV-by-P part of this array must contain the input matrix BV of a state space realization of the left frequency weighting V. On exit, if WEIGHT = 'L' or 'B', and INFO = 0, the leading NV-by-P part of this array contains the input matrix of a state space realization of the inverse of V. BV is not referenced if WEIGHT = 'R' or 'N'. LDBV INTEGER The leading dimension of the array BV. LDBV >= MAX(1,NV), if WEIGHT = 'L' or 'B'; LDBV >= 1, if WEIGHT = 'R' or 'N'. CV (input/output) DOUBLE PRECISION array, dimension (LDCV,NV) On entry, if WEIGHT = 'L' or 'B', the leading P-by-NV part of this array must contain the output matrix CV of a state space realization of the left frequency weighting V. On exit, if WEIGHT = 'L' or 'B', and INFO = 0, the leading P-by-NV part of this array contains the output matrix of a state space realization of the inverse of V. CV is not referenced if WEIGHT = 'R' or 'N'. LDCV INTEGER The leading dimension of the array CV. LDCV >= MAX(1,P), if WEIGHT = 'L' or 'B'; LDCV >= 1, if WEIGHT = 'R' or 'N'. DV (input/output) DOUBLE PRECISION array, dimension (LDDV,P) On entry, if WEIGHT = 'L' or 'B', the leading P-by-P part of this array must contain the feedthrough matrix DV of a state space realization of the left frequency weighting V. On exit, if WEIGHT = 'L' or 'B', and INFO = 0, the leading P-by-P part of this array contains the feedthrough matrix of a state space realization of the inverse of V. DV is not referenced if WEIGHT = 'R' or 'N'. LDDV INTEGER The leading dimension of the array DV. LDDV >= MAX(1,P), if WEIGHT = 'L' or 'B'; LDDV >= 1, if WEIGHT = 'R' or 'N'. AW (input/output) DOUBLE PRECISION array, dimension (LDAW,NW) On entry, if WEIGHT = 'R' or 'B', the leading NW-by-NW part of this array must contain the state matrix AW of a state space realization of the right frequency weighting W. On exit, if WEIGHT = 'R' or 'B', and INFO = 0, the leading NW-by-NW part of this array contains a real Schur form of the state matrix of a state space realization of the inverse of W. AW is not referenced if WEIGHT = 'L' or 'N'. LDAW INTEGER The leading dimension of the array AW. LDAW >= MAX(1,NW), if WEIGHT = 'R' or 'B'; LDAW >= 1, if WEIGHT = 'L' or 'N'. BW (input/output) DOUBLE PRECISION array, dimension (LDBW,M) On entry, if WEIGHT = 'R' or 'B', the leading NW-by-M part of this array must contain the input matrix BW of a state space realization of the right frequency weighting W. On exit, if WEIGHT = 'R' or 'B', and INFO = 0, the leading NW-by-M part of this array contains the input matrix of a state space realization of the inverse of W. BW is not referenced if WEIGHT = 'L' or 'N'. LDBW INTEGER The leading dimension of the array BW. LDBW >= MAX(1,NW), if WEIGHT = 'R' or 'B'; LDBW >= 1, if WEIGHT = 'L' or 'N'. CW (input/output) DOUBLE PRECISION array, dimension (LDCW,NW) On entry, if WEIGHT = 'R' or 'B', the leading M-by-NW part of this array must contain the output matrix CW of a state space realization of the right frequency weighting W. On exit, if WEIGHT = 'R' or 'B', and INFO = 0, the leading M-by-NW part of this array contains the output matrix of a state space realization of the inverse of W. CW is not referenced if WEIGHT = 'L' or 'N'. LDCW INTEGER The leading dimension of the array CW. LDCW >= MAX(1,M), if WEIGHT = 'R' or 'B'; LDCW >= 1, if WEIGHT = 'L' or 'N'. DW (input/output) DOUBLE PRECISION array, dimension (LDDW,M) On entry, if WEIGHT = 'R' or 'B', the leading M-by-M part of this array must contain the feedthrough matrix DW of a state space realization of the right frequency weighting W. On exit, if WEIGHT = 'R' or 'B', and INFO = 0, the leading M-by-M part of this array contains the feedthrough matrix of a state space realization of the inverse of W. DW is not referenced if WEIGHT = 'L' or 'N'. LDDW INTEGER The leading dimension of the array DW. LDDW >= MAX(1,M), if WEIGHT = 'R' or 'B'; LDDW >= 1, if WEIGHT = 'L' or 'N'. NS (output) INTEGER The dimension of the ALPHA-stable subsystem. HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, the leading NS elements of this array contain the Hankel singular values, ordered decreasingly, of the ALPHA-stable part of the weighted original system. HSV(1) is the Hankel norm of the ALPHA-stable weighted subsystem.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL1 = c*HNORM(As,Bs,Cs), where c is a constant in the interval [0.00001,0.001], and HNORM(As,Bs,Cs) is the Hankel-norm of the ALPHA-stable part of the weighted original system (computed in HSV(1)). If TOL1 <= 0 on entry, the used default value is TOL1 = NS*EPS*HNORM(As,Bs,Cs), where NS is the number of ALPHA-stable eigenvalues of A and EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the ALPHA-stable part of the given system. The recommended value is TOL2 = NS*EPS*HNORM(As,Bs,Cs). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0 and ORDSEL = 'A', then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = MAX(1,M,c), if DICO = 'C', LIWORK = MAX(1,N,M,c), if DICO = 'D', where c = 0, if WEIGHT = 'N', c = 2*P, if WEIGHT = 'L', c = 2*M, if WEIGHT = 'R', c = MAX(2*M,2*P), if WEIGHT = 'B'. On exit, if INFO = 0, IWORK(1) contains NMIN, the order of the computed minimal realization. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( LDW1, LDW2, LDW3, LDW4 ), where LDW1 = 0 if WEIGHT = 'R' or 'N' and LDW1 = MAX( NV*(NV+5), NV*N + MAX( a, P*N, P*M ) ) if WEIGHT = 'L' or WEIGHT = 'B', LDW2 = 0 if WEIGHT = 'L' or 'N' and LDW2 = MAX( NW*(NW+5), NW*N + MAX( b, M*N, P*M ) ) if WEIGHT = 'R' or WEIGHT = 'B', with a = 0, b = 0, if DICO = 'C' or JOB = 'N', a = 2*NV, b = 2*NW, if DICO = 'D' and JOB = 'C'; LDW3 = N*(2*N + MAX(N,M,P) + 5) + N*(N+1)/2, LDW4 = N*(M+P+2) + 2*M*P + MIN(N,M) + MAX( 3*M+1, MIN(N,M)+P ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than NSMIN, the sum of the order of the ALPHA-unstable part and the order of a minimal realization of the ALPHA-stable part of the given system; in this case, the resulting NR is set equal to NSMIN; = 2: with ORDSEL = 'F', the selected order NR is less than the order of the ALPHA-unstable part of the given system; in this case NR is set equal to the order of the ALPHA-unstable part.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the computation of the ordered real Schur form of A failed; = 2: the separation of the ALPHA-stable/unstable diagonal blocks failed because of very close eigenvalues; = 3: the reduction of AV or AV-BV*inv(DV)*CV to a real Schur form failed; = 4: the reduction of AW or AW-BW*inv(DW)*CW to a real Schur form failed; = 5: JOB = 'N' and AV is not antistable, or JOB = 'C' and AV is not stable; = 6: JOB = 'N' and AW is not antistable, or JOB = 'C' and AW is not stable; = 7: the computation of Hankel singular values failed; = 8: the computation of stable projection in the Hankel-norm approximation algorithm failed; = 9: the order of computed stable projection in the Hankel-norm approximation algorithm differs from the order of Hankel-norm approximation; = 10: DV is singular; = 11: DW is singular; = 12: the solution of the Sylvester equation failed because the zeros of V (if JOB = 'N') or of conj(V) (if JOB = 'C') are not distinct from the poles of G1sr (see METHOD); = 13: the solution of the Sylvester equation failed because the zeros of W (if JOB = 'N') or of conj(W) (if JOB = 'C') are not distinct from the poles of G1sr (see METHOD).Method
Let G be the transfer-function matrix of the original linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t), (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09KD determines the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t), (2) such that the corresponding transfer-function matrix Gr minimizes the Hankel-norm of the frequency-weighted error V*(G-Gr)*W, (3) or conj(V)*(G-Gr)*conj(W). (4) For minimizing (3), V and W are assumed to be antistable, while for minimizing (4), V and W are assumed to be stable transfer- function matrices. Note: conj(G) = G'(-s) for a continuous-time system and conj(G) = G'(1/z) for a discrete-time system. The following procedure is used to reduce G (see [1]): 1) Decompose additively G as G = G1 + G2, such that G1 = (A1,B1,C1,D) has only ALPHA-stable poles and G2 = (A2,B2,C2,0) has only ALPHA-unstable poles. 2) Compute G1s, the stable projection of V*G1*W or conj(V)*G1*conj(W), using explicit formulas [4]. 3) Determine G1sr, the optimal Hankel-norm approximation of G1s of order r. 4) Compute G1r, the stable projection of either inv(V)*G1sr*inv(W) or conj(inv(V))*G1sr*conj(inv(W)), using explicit formulas [4]. 5) Assemble the reduced model Gr as Gr = G1r + G2. To reduce the weighted ALPHA-stable part G1s at step 3, the optimal Hankel-norm approximation method of [2], based on the square-root balancing projection formulas of [3], is employed. The optimal weighted approximation error satisfies HNORM[V*(G-Gr)*W] = S(r+1), or HNORM[conj(V)*(G-Gr)*conj(W)] = S(r+1), where S(r+1) is the (r+1)-th Hankel singular value of G1s, the transfer-function matrix computed at step 2 of the above procedure, and HNORM(.) denotes the Hankel-norm.References
[1] Latham, G.A. and Anderson, B.D.O. Frequency-weighted optimal Hankel-norm approximation of stable transfer functions. Systems & Control Letters, Vol. 5, pp. 229-236, 1985. [2] Glover, K. All optimal Hankel norm approximation of linear multivariable systems and their L-infinity error bounds. Int. J. Control, Vol. 36, pp. 1145-1193, 1984. [3] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987. [4] Varga A. Explicit formulas for an efficient implementation of the frequency-weighting model reduction approach. Proc. 1993 European Control Conference, Groningen, NL, pp. 693-696, 1993.Numerical Aspects
The implemented methods rely on an accuracy enhancing square-root technique. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* AB09KD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX, NVMAX, NWMAX, PMAX PARAMETER ( MMAX = 20, NMAX = 20, NVMAX = 10, NWMAX = 10, $ PMAX = 20 ) INTEGER LDA, LDAV, LDAW, LDB, LDBV, LDBW, $ LDC, LDCV, LDCW, LDD, LDDV, LDDW PARAMETER ( LDA = NMAX, LDAV = NVMAX, LDAW = NWMAX, $ LDB = NMAX, LDBV = NVMAX, LDBW = NWMAX, $ LDC = PMAX, LDCV = PMAX, LDCW = MMAX, $ LDD = PMAX, LDDV = PMAX, LDDW = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 2*MAX( MMAX, PMAX ) ) INTEGER LDW1, LDW2, LDW3, LDW4, LDWORK PARAMETER ( LDW1 = MAX( NVMAX*( NVMAX + 5 ), NVMAX*NMAX + $ MAX( 2*NVMAX, PMAX*NMAX, PMAX*MMAX ) )) PARAMETER ( LDW2 = MAX( NWMAX*( NWMAX + 5 ), NWMAX*NMAX + $ MAX( 2*NWMAX, MMAX*NMAX, PMAX*MMAX ) )) PARAMETER ( LDW3 = NMAX*( 2*NMAX + MAX( NMAX, MMAX, PMAX ) $ + 5 ) + ( NMAX*( NMAX + 1 ) )/2 ) PARAMETER ( LDW4 = NMAX*( MMAX + PMAX + 2 ) + 2*MMAX*PMAX + $ MIN( NMAX, MMAX ) + $ MAX( 3*MMAX + 1, $ MIN( NMAX, MMAX ) + PMAX ) ) PARAMETER ( LDWORK = MAX( LDW1, LDW2, LDW3, LDW4 ) ) * .. Local Scalars .. LOGICAL LEFTW, RIGHTW DOUBLE PRECISION ALPHA, TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, N, NR, NS, NV, NW, P CHARACTER*1 DICO, EQUIL, JOB, ORDSEL, WEIGHT * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), AV(LDAV,NVMAX), AW(LDAW,NWMAX), $ B(LDB,MMAX), BV(LDBV,PMAX), BW(LDBW,MMAX), $ C(LDC,NMAX), CV(LDCV,NVMAX), CW(LDCW,NWMAX), $ D(LDD,MMAX), DV(LDDV,PMAX), DW(LDDW,MMAX), $ DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL AB09KD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NV, NW, NR, ALPHA, TOL1, TOL2, $ JOB, DICO, WEIGHT, EQUIL, ORDSEL LEFTW = LSAME( WEIGHT, 'L' ) .OR. LSAME( WEIGHT, 'B' ) RIGHTW = LSAME( WEIGHT, 'R' ) .OR. LSAME( WEIGHT, 'B' ) 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 ) IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF( P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) IF( LEFTW .OR. NV.GT.0 ) THEN IF( NV.LT.0 .OR. NV.GT.NVMAX ) THEN WRITE ( NOUT, FMT = 99986 ) NV ELSE IF( NV.GT.0 ) THEN READ ( NIN, FMT = * ) $ ( ( AV(I,J), J = 1,NV ), I = 1,NV ) READ ( NIN, FMT = * ) $ ( ( BV(I,J), J = 1,P ), I = 1, NV ) READ ( NIN, FMT = * ) $ ( ( CV(I,J), J = 1,NV ), I = 1,P ) END IF IF( LEFTW ) READ ( NIN, FMT = * ) $ ( ( DV(I,J), J = 1,P ), I = 1,P ) END IF END IF IF( RIGHTW ) THEN IF( NW.LT.0 .OR. NW.GT.NWMAX ) THEN WRITE ( NOUT, FMT = 99985 ) NW ELSE IF( NW.GT.0 ) THEN READ ( NIN, FMT = * ) $ ( ( AW(I,J), J = 1,NW ), I = 1,NW ) READ ( NIN, FMT = * ) $ ( ( BW(I,J), J = 1,M ), I = 1, NW ) READ ( NIN, FMT = * ) $ ( ( CW(I,J), J = 1,NW ), I = 1,M ) END IF READ ( NIN, FMT = * ) $ ( ( DW(I,J), J = 1,M ), I = 1,M ) END IF END IF * Find a reduced ssr for (A,B,C,D). CALL AB09KD( JOB, DICO, WEIGHT, EQUIL, ORDSEL, N, NV, NW, $ M, P, NR, ALPHA, A, LDA, B, LDB, C, LDC, $ D, LDD, AV, LDAV, BV, LDBV, CV, LDCV, $ DV, LDDV, AW, LDAW, BW, LDBW, CW, LDCW, $ DW, LDDW, NS, HSV, TOL1, TOL2, IWORK, $ DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( IWARN.NE.0) WRITE ( NOUT, FMT = 99984 ) IWARN WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1, NS ) IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09KD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09KD = ',I2) 99997 FORMAT (/' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of weighted ALPHA-stable', $ ' part are') 99986 FORMAT (/' NV is out of range.',/' NV = ',I5) 99985 FORMAT (/' NW is out of range.',/' NW = ',I5) 99984 FORMAT (' IWARN on exit from AB09KD = ',I2) ENDProgram Data
AB09KD EXAMPLE PROGRAM DATA (Continuous system) 6 1 1 2 0 0 0.0 1.E-1 1.E-14 N C L S A -3.8637 -7.4641 -9.1416 -7.4641 -3.8637 -1.0000 1.0000 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 1.0000 0 0 0 0 0 0 1.0000 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0.2000 -1.0000 1.0000 0 1 0 -1.8000 0 1Program Results
AB09KD EXAMPLE PROGRAM RESULTS The order of reduced model = 4 The Hankel singular values of weighted ALPHA-stable part are 2.6790 2.1589 0.8424 0.1929 0.0219 0.0011 The reduced state dynamics matrix Ar is -0.2391 0.3072 1.1630 1.1967 -2.9709 -0.2391 2.6270 3.1027 0.0000 0.0000 -0.5137 -1.2842 0.0000 0.0000 0.1519 -0.5137 The reduced input/state matrix Br is -1.0497 -3.7052 0.8223 0.7435 The reduced state/output matrix Cr is -0.4466 0.0143 -0.4780 -0.2013 The reduced input/output matrix Dr is 0.0219
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09KX.html 0000664 0000000 0000000 00000036664 14560147231 0020367 0 ustar 00root root 0000000 0000000
Purpose
To construct a state-space representation (A,BS,CS,DS) of the stable projection of V*G*W or conj(V)*G*conj(W) from the state-space representations (A,B,C,D), (AV,BV,CV,DV), and (AW,BW,CW,DW) of the transfer-function matrices G, V and W, respectively. G is assumed to be a stable transfer-function matrix and the state matrix A must be in a real Schur form. When computing the stable projection of V*G*W, V and W are assumed to be completely unstable transfer-function matrices. When computing the stable projection of conj(V)*G*conj(W), V and W are assumed to be stable transfer-function matrices. For a transfer-function matrix G, conj(G) denotes the conjugate of G given by G'(-s) for a continuous-time system or G'(1/z) for a discrete-time system.Specification
SUBROUTINE AB09KX( JOB, DICO, WEIGHT, N, NV, NW, M, P, $ A, LDA, B, LDB, C, LDC, D, LDD, $ AV, LDAV, BV, LDBV, CV, LDCV, DV, LDDV, $ AW, LDAW, BW, LDBW, CW, LDCW, DW, LDDW, $ DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOB, WEIGHT INTEGER INFO, IWARN, LDA, LDAV, LDAW, LDB, LDBV, LDBW, $ LDC, LDCV, LDCW, LDD, LDDV, LDDW, LDWORK, M, N, $ NV, NW, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ AV(LDAV,*), BV(LDBV,*), CV(LDCV,*), DV(LDDV,*), $ AW(LDAW,*), BW(LDBW,*), CW(LDCW,*), DW(LDDW,*), $ DWORK(*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies which projection to be computed as follows: = 'N': compute the stable projection of V*G*W; = 'C': compute the stable projection of conj(V)*G*conj(W). DICO CHARACTER*1 Specifies the type of the systems as follows: = 'C': G, V and W are continuous-time systems; = 'D': G, V and W are discrete-time systems. WEIGHT CHARACTER*1 Specifies the type of frequency weighting, as follows: = 'N': no weightings are used (V = I, W = I); = 'L': only left weighting V is used (W = I); = 'R': only right weighting W is used (V = I); = 'B': both left and right weightings V and W are used.Input/Output Parameters
N (input) INTEGER The order of the matrix A. Also the number of rows of the matrix B and the number of columns of the matrix C. N represents the dimension of the state vector of the system with the transfer-function matrix G. N >= 0. NV (input) INTEGER The order of the matrix AV. Also the number of rows of the matrix BV and the number of columns of the matrix CV. NV represents the dimension of the state vector of the system with the transfer-function matrix V. NV >= 0. NW (input) INTEGER The order of the matrix AW. Also the number of rows of the matrix BW and the number of columns of the matrix CW. NW represents the dimension of the state vector of the system with the transfer-function matrix W. NW >= 0. M (input) INTEGER The number of columns of the matrices B, D, BW and DW and number of rows of the matrices CW and DW. M >= 0. M represents the dimension of input vectors of the systems with the transfer-function matrices G and W and also the dimension of the output vector of the system with the transfer-function matrix W. P (input) INTEGER The number of rows of the matrices C, D, CV and DV and the number of columns of the matrices BV and DV. P >= 0. P represents the dimension of output vectors of the systems with the transfer-function matrices G and V and also the dimension of the input vector of the system with the transfer-function matrix V. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the system with the transfer-function matrix G in a real Schur form. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B of the system with the transfer-function matrix G. On exit, if INFO = 0, the leading N-by-M part of this array contains the input matrix BS of the stable projection of V*G*W if JOB = 'N', and of conj(V)*G*conj(W) if JOB = 'C'. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C of the system with the transfer-function matrix G. On exit, if INFO = 0, the leading P-by-N part of this array contains the output matrix CS of the stable projection of V*G*W if JOB = 'N', and of conj(V)*G*conj(W) if JOB = 'C'. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the feedthrough matrix D of the system with the transfer-function matrix G. On exit, if INFO = 0, the leading P-by-M part of this array contains the feedthrough matrix DS of the stable projection of V*G*W if JOB = 'N', and of conj(V)*G*conj(W) if JOB = 'C'. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,P). AV (input/output) DOUBLE PRECISION array, dimension (LDAV,NV) On entry, if WEIGHT = 'L' or 'B', the leading NV-by-NV part of this array must contain the state matrix AV of the system with the transfer-function matrix V. On exit, if WEIGHT = 'L' or 'B', and INFO = 0, the leading NV-by-NV part of this array contains a real Schur form of AV. AV is not referenced if WEIGHT = 'R' or 'N'. LDAV INTEGER The leading dimension of the array AV. LDAV >= MAX(1,NV), if WEIGHT = 'L' or 'B'; LDAV >= 1, if WEIGHT = 'R' or 'N'. BV (input/output) DOUBLE PRECISION array, dimension (LDBV,P) On entry, if WEIGHT = 'L' or 'B', the leading NV-by-P part of this array must contain the input matrix BV of the system with the transfer-function matrix V. On exit, if WEIGHT = 'L' or 'B', and INFO = 0, the leading NV-by-P part of this array contains the transformed input matrix BV. BV is not referenced if WEIGHT = 'R' or 'N'. LDBV INTEGER The leading dimension of the array BV. LDBV >= MAX(1,NV), if WEIGHT = 'L' or 'B'; LDBV >= 1, if WEIGHT = 'R' or 'N'. CV (input/output) DOUBLE PRECISION array, dimension (LDCV,NV) On entry, if WEIGHT = 'L' or 'B', the leading P-by-NV part of this array must contain the output matrix CV of the system with the transfer-function matrix V. On exit, if WEIGHT = 'L' or 'B', and INFO = 0, the leading P-by-NV part of this array contains the transformed output matrix CV. CV is not referenced if WEIGHT = 'R' or 'N'. LDCV INTEGER The leading dimension of the array CV. LDCV >= MAX(1,P), if WEIGHT = 'L' or 'B'; LDCV >= 1, if WEIGHT = 'R' or 'N'. DV (input) DOUBLE PRECISION array, dimension (LDDV,P) If WEIGHT = 'L' or 'B', the leading P-by-P part of this array must contain the feedthrough matrix DV of the system with the transfer-function matrix V. DV is not referenced if WEIGHT = 'R' or 'N'. LDDV INTEGER The leading dimension of the array DV. LDDV >= MAX(1,P), if WEIGHT = 'L' or 'B'; LDDV >= 1, if WEIGHT = 'R' or 'N'. AW (input/output) DOUBLE PRECISION array, dimension (LDAW,NW) On entry, if WEIGHT = 'R' or 'B', the leading NW-by-NW part of this array must contain the state matrix AW of the system with the transfer-function matrix W. On exit, if WEIGHT = 'R' or 'B', and INFO = 0, the leading NW-by-NW part of this array contains a real Schur form of AW. AW is not referenced if WEIGHT = 'L' or 'N'. LDAW INTEGER The leading dimension of the array AW. LDAW >= MAX(1,NW), if WEIGHT = 'R' or 'B'; LDAW >= 1, if WEIGHT = 'L' or 'N'. BW (input/output) DOUBLE PRECISION array, dimension (LDBW,M) On entry, if WEIGHT = 'R' or 'B', the leading NW-by-M part of this array must contain the input matrix BW of the system with the transfer-function matrix W. On exit, if WEIGHT = 'R' or 'B', and INFO = 0, the leading NW-by-M part of this array contains the transformed input matrix BW. BW is not referenced if WEIGHT = 'L' or 'N'. LDBW INTEGER The leading dimension of the array BW. LDBW >= MAX(1,NW), if WEIGHT = 'R' or 'B'; LDBW >= 1, if WEIGHT = 'L' or 'N'. CW (input/output) DOUBLE PRECISION array, dimension (LDCW,NW) On entry, if WEIGHT = 'R' or 'B', the leading M-by-NW part of this array must contain the output matrix CW of the system with the transfer-function matrix W. On exit, if WEIGHT = 'R' or 'B', and INFO = 0, the leading M-by-NW part of this array contains the transformed output matrix CW. CW is not referenced if WEIGHT = 'L' or 'N'. LDCW INTEGER The leading dimension of the array CW. LDCW >= MAX(1,M), if WEIGHT = 'R' or 'B'; LDCW >= 1, if WEIGHT = 'L' or 'N'. DW (input) DOUBLE PRECISION array, dimension (LDDW,M) If WEIGHT = 'R' or 'B', the leading M-by-M part of this array must contain the feedthrough matrix DW of the system with the transfer-function matrix W. DW is not referenced if WEIGHT = 'L' or 'N'. LDDW INTEGER The leading dimension of the array DW. LDDW >= MAX(1,M), if WEIGHT = 'R' or 'B'; LDDW >= 1, if WEIGHT = 'L' or 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, LDW1, LDW2 ), where LDW1 = 0 if WEIGHT = 'R' or 'N' and LDW1 = MAX( NV*(NV+5), NV*N + MAX( a, P*N, P*M ) ) if WEIGHT = 'L' or WEIGHT = 'B', LDW2 = 0 if WEIGHT = 'L' or 'N' and LDW2 = MAX( NW*(NW+5), NW*N + MAX( b, M*N, P*M ) ) if WEIGHT = 'R' or WEIGHT = 'B', a = 0, b = 0, if DICO = 'C' or JOB = 'N', a = 2*NV, b = 2*NW, if DICO = 'D' and JOB = 'C'. For good performance, LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: JOB = 'N' and AV is not completely unstable, or JOB = 'C' and AV is not stable; = 2: JOB = 'N' and AW is not completely unstable, or JOB = 'C' and AW is not stable; = 3: both above conditions appear.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of AV to a real Schur form failed; = 2: the reduction of AW to a real Schur form failed; = 3: the solution of the Sylvester equation failed because the matrices A and AV have common eigenvalues (if JOB = 'N'), or -AV and A have common eigenvalues (if JOB = 'C' and DICO = 'C'), or AV has an eigenvalue which is the reciprocal of one of the eigenvalues of A (if JOB = 'C' and DICO = 'D'); = 4: the solution of the Sylvester equation failed because the matrices A and AW have common eigenvalues (if JOB = 'N'), or -AW and A have common eigenvalues (if JOB = 'C' and DICO = 'C'), or AW has an eigenvalue which is the reciprocal of one of the eigenvalues of A (if JOB = 'C' and DICO = 'D').Method
The matrices of the stable projection of V*G*W are computed as BS = B*DW + Y*BW, CS = CV*X + DV*C, DS = DV*D*DW, where X and Y satisfy the continuous-time Sylvester equations AV*X - X*A + BV*C = 0, -A*Y + Y*AW + B*CW = 0. The matrices of the stable projection of conj(V)*G*conj(W) are computed using the explicit formulas established in [1]. For a continuous-time system, the matrices BS, CS and DS of the stable projection are computed as BS = B*DW' + Y*CW', CS = BV'*X + DV'*C, DS = DV'*D*DW', where X and Y satisfy the continuous-time Sylvester equations AV'*X + X*A + CV'*C = 0, A*Y + Y*AW' + B*BW' = 0. For a discrete-time system, the matrices BS, CS and DS of the stable projection are computed as BS = B*DW' + A*Y*CW', CS = BV'*X*A + DV'*C, DS = DV'*D*DW' + BV'*X*B*DW' + DV'*C*Y*CW' + BV'*X*A*Y*CW', where X and Y satisfy the discrete-time Sylvester equations AV'*X*A + CV'*C = X, A*Y*AW' + B*BW' = Y.References
[1] Varga A. Explicit formulas for an efficient implementation of the frequency-weighting model reduction approach. Proc. 1993 European Control Conference, Groningen, NL, pp. 693-696, 1993.Numerical Aspects
The implemented methods rely on numerically stable algorithms.Further Comments
The matrix A must be stable, but its stability is not checked by this routine.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a reduced order model (Ar,Br,Cr) for an original state-space representation (A,B,C) by using either the square-root or the balancing-free square-root Balance & Truncate (B & T) model reduction method for the ALPHA-stable part of the system.Specification
SUBROUTINE AB09MD( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, ALPHA, $ A, LDA, B, LDB, C, LDC, NS, HSV, TOL, IWORK, $ DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOB, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDWORK, M, N, NR, $ NS, P DOUBLE PRECISION ALPHA, TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root Balance & Truncate method; = 'N': use the balancing-free square-root Balance & Truncate method. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), NR is set as follows: if ORDSEL = 'F', NR is equal to NU+MIN(MAX(0,NR-NU),NMIN), where NR is the desired order on entry, and NMIN is the order of a minimal realization of the ALPHA-stable part of the given system; NMIN is determined as the number of Hankel singular values greater than NS*EPS*HNORM(As,Bs,Cs), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(As,Bs,Cs) is the Hankel norm of the ALPHA-stable part of the given system (computed in HSV(1)); if ORDSEL = 'A', NR is the sum of NU and the number of Hankel singular values greater than MAX(TOL,NS*EPS*HNORM(As,Bs,Cs)). ALPHA (input) DOUBLE PRECISION Specifies the ALPHA-stability boundary for the eigenvalues of the state dynamics matrix A. For a continuous-time system (DICO = 'C'), ALPHA <= 0 is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), 0 <= ALPHA <= 1 represents the boundary value for the moduli of eigenvalues. The ALPHA-stability domain does not include the boundary. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. The resulting A has a block-diagonal form with two blocks. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), the leading NU-by-NU block contains the unreduced part of A corresponding to ALPHA-unstable eigenvalues in an upper real Schur form. The trailing (NR+NS-N)-by-(NR+NS-N) block contains the reduced part of A corresponding to ALPHA-stable eigenvalues. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). NS (output) INTEGER The dimension of the ALPHA-stable subsystem. HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, the leading NS elements of HSV contain the Hankel singular values of the ALPHA-stable part of the original system ordered decreasingly. HSV(1) is the Hankel norm of the ALPHA-stable subsystem.Tolerances
TOL DOUBLE PRECISION If ORDSEL = 'A', TOL contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL = c*HNORM(As,Bs,Cs), where c is a constant in the interval [0.00001,0.001], and HNORM(As,Bs,Cs) is the Hankel-norm of the ALPHA-stable part of the given system (computed in HSV(1)). If TOL <= 0 on entry, the used default value is TOL = NS*EPS*HNORM(As,Bs,Cs), where NS is the number of ALPHA-stable eigenvalues of A and EPS is the machine precision (see LAPACK Library Routine DLAMCH). This value is appropriate to compute a minimal realization of the ALPHA-stable part. If ORDSEL = 'F', the value of TOL is ignored.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = 0, if JOB = 'B'; LIWORK = N, if JOB = 'N'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*(2*N+MAX(N,M,P)+5) + N*(N+1)/2). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than NSMIN, the sum of the order of the ALPHA-unstable part and the order of a minimal realization of the ALPHA-stable part of the given system. In this case, the resulting NR is set equal to NSMIN. = 2: with ORDSEL = 'F', the selected order NR is less than the order of the ALPHA-unstable part of the given system. In this case NR is set equal to the order of the ALPHA-unstable part.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the computation of the ordered real Schur form of A failed; = 2: the separation of the ALPHA-stable/unstable diagonal blocks failed because of very close eigenvalues; = 3: the computation of Hankel singular values failed.Method
Let be the following linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09MD determines for the given system (1), the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) (2) such that HSV(NR+NS-N) <= INFNORM(G-Gr) <= 2*[HSV(NR+NS-N+1)+...+HSV(NS)], where G and Gr are transfer-function matrices of the systems (A,B,C) and (Ar,Br,Cr), respectively, and INFNORM(G) is the infinity-norm of G. The following procedure is used to reduce a given G: 1) Decompose additively G as G = G1 + G2 such that G1 = (As,Bs,Cs) has only ALPHA-stable poles and G2 = (Au,Bu,Cu) has only ALPHA-unstable poles. 2) Determine G1r, a reduced order approximation of the ALPHA-stable part G1. 3) Assemble the reduced model Gr as Gr = G1r + G2. To reduce the ALPHA-stable part G1, if JOB = 'B', the square-root Balance & Truncate method of [1] is used, and for an ALPHA-stable continuous-time system (DICO = 'C'), the resulting reduced model is balanced. For ALPHA-stable systems, setting TOL < 0, the routine can be used to compute balanced minimal state-space realizations. If JOB = 'N', the balancing-free square-root version of the Balance & Truncate method [2] is used to reduce the ALPHA-stable part G1.References
[1] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987. [2] Varga A. Efficient minimal realization procedure based on balancing. Proc. of IMACS/IFAC Symp. MCTS, Lille, France, May 1991, A. El Moudui, P. Borne, S. G. Tzafestas (Eds.), Vol. 2, pp. 42-46.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* AB09MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( 2*NMAX + $ MAX( NMAX, MMAX, PMAX ) + 5 ) + $ ( NMAX*( NMAX + 1 ) )/2 ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, TOL INTEGER I, INFO, IWARN, J, M, N, NR, NS, P CHARACTER*1 DICO, EQUIL, JOB, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09MD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, ALPHA, TOL, DICO, JOB, EQUIL, $ ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find a reduced ssr for (A,B,C). CALL AB09MD( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, $ ALPHA, A, LDA, B, LDB, C, LDC, NS, HSV, $ TOL, IWORK, DWORK, LDWORK, IWARN, INFO) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,NS ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09MD = ',I2) 99997 FORMAT (' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of ALPHA-stable part are') ENDProgram Data
AB09MD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0 -.6D0 1.D-1 C N N A -0.04165 0.0000 4.9200 -4.9200 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 -0.5450 0.0000 0.0000 0.0000 0.0000 0.0000 4.9200 -0.04165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000Program Results
AB09MD EXAMPLE PROGRAM RESULTS The order of reduced model = 5 The Hankel singular values of ALPHA-stable part are 1.9178 0.8621 0.7666 0.0336 0.0246 The reduced state dynamics matrix Ar is -0.5181 -1.1084 0.0000 0.0000 0.0000 8.8157 -0.5181 0.0000 0.0000 0.0000 0.0000 0.0000 0.5124 0.0000 1.7910 0.0000 0.0000 0.0000 -1.4460 0.0000 0.0000 0.0000 -4.2167 0.0000 -2.9900 The reduced input/state matrix Br is -1.2837 1.2837 -0.7522 0.7522 -0.7447 -0.7447 1.9275 -1.9275 -3.6872 -3.6872 The reduced state/output matrix Cr is -0.1380 -0.6445 -0.6582 -0.5771 0.2222 0.6246 0.0196 0.0000 0.4131 0.0000 0.1380 0.6445 -0.6582 0.5771 0.2222
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB09ND.html 0000664 0000000 0000000 00000043531 14560147231 0020335 0 ustar 00root root 0000000 0000000
Purpose
To compute a reduced order model (Ar,Br,Cr,Dr) for an original state-space representation (A,B,C,D) by using either the square-root or the balancing-free square-root Singular Perturbation Approximation (SPA) model reduction method for the ALPHA-stable part of the system.Specification
SUBROUTINE AB09ND( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, ALPHA, $ A, LDA, B, LDB, C, LDC, D, LDD, NS, HSV, TOL1, $ TOL2, IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOB, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDWORK, $ M, N, NR, NS, P DOUBLE PRECISION ALPHA, TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOB CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root SPA method; = 'N': use the balancing-free square-root SPA method. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NR is fixed; = 'A': the resulting order NR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NR (input/output) INTEGER On entry with ORDSEL = 'F', NR is the desired order of the resulting reduced order system. 0 <= NR <= N. On exit, if INFO = 0, NR is the order of the resulting reduced order model. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), NR is set as follows: if ORDSEL = 'F', NR is equal to NU+MIN(MAX(0,NR-NU),NMIN), where NR is the desired order on entry, and NMIN is the order of a minimal realization of the ALPHA-stable part of the given system; NMIN is determined as the number of Hankel singular values greater than NS*EPS*HNORM(As,Bs,Cs), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(As,Bs,Cs) is the Hankel norm of the ALPHA-stable part of the given system (computed in HSV(1)); if ORDSEL = 'A', NR is the sum of NU and the number of Hankel singular values greater than MAX(TOL1,NS*EPS*HNORM(As,Bs,Cs)). ALPHA (input) DOUBLE PRECISION Specifies the ALPHA-stability boundary for the eigenvalues of the state dynamics matrix A. For a continuous-time system (DICO = 'C'), ALPHA <= 0 is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), 0 <= ALPHA <= 1 represents the boundary value for the moduli of eigenvalues. The ALPHA-stability domain does not include the boundary. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading NR-by-NR part of this array contains the state dynamics matrix Ar of the reduced order system. The resulting A has a block-diagonal form with two blocks. For a system with NU ALPHA-unstable eigenvalues and NS ALPHA-stable eigenvalues (NU+NS = N), the leading NU-by-NU block contains the unreduced part of A corresponding to ALPHA-unstable eigenvalues in an upper real Schur form. The trailing (NR+NS-N)-by-(NR+NS-N) block contains the reduced part of A corresponding to ALPHA-stable eigenvalues. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading NR-by-M part of this array contains the input/state matrix Br of the reduced order system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-NR part of this array contains the state/output matrix Cr of the reduced order system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original input/output matrix D. On exit, if INFO = 0, the leading P-by-M part of this array contains the input/output matrix Dr of the reduced order system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NS (output) INTEGER The dimension of the ALPHA-stable subsystem. HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, the leading NS elements of HSV contain the Hankel singular values of the ALPHA-stable part of the original system ordered decreasingly. HSV(1) is the Hankel norm of the ALPHA-stable subsystem.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of reduced system. For model reduction, the recommended value is TOL1 = c*HNORM(As,Bs,Cs), where c is a constant in the interval [0.00001,0.001], and HNORM(As,Bs,Cs) is the Hankel-norm of the ALPHA-stable part of the given system (computed in HSV(1)). If TOL1 <= 0 on entry, the used default value is TOL1 = NS*EPS*HNORM(As,Bs,Cs), where NS is the number of ALPHA-stable eigenvalues of A and EPS is the machine precision (see LAPACK Library Routine DLAMCH). This value is appropriate to compute a minimal realization of the ALPHA-stable part. If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the ALPHA-stable part of the given system. The recommended value is TOL2 = NS*EPS*HNORM(As,Bs,Cs). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0, then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (MAX(1,2*N)) On exit, if INFO = 0, IWORK(1) contains the order of the minimal realization of the ALPHA-stable part of the system. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*(2*N+MAX(N,M,P)+5) + N*(N+1)/2). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NR is greater than NSMIN, the sum of the order of the ALPHA-unstable part and the order of a minimal realization of the ALPHA-stable part of the given system. In this case, the resulting NR is set equal to NSMIN. = 2: with ORDSEL = 'F', the selected order NR is less than the order of the ALPHA-unstable part of the given system. In this case NR is set equal to the order of the ALPHA-unstable part.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the computation of the ordered real Schur form of A failed; = 2: the separation of the ALPHA-stable/unstable diagonal blocks failed because of very close eigenvalues; = 3: the computation of Hankel singular values failed.Method
Let be the following linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system. The subroutine AB09ND determines for the given system (1), the matrices of a reduced order system d[z(t)] = Ar*z(t) + Br*u(t) yr(t) = Cr*z(t) + Dr*u(t) (2) such that HSV(NR+NS-N) <= INFNORM(G-Gr) <= 2*[HSV(NR+NS-N+1)+...+HSV(NS)], where G and Gr are transfer-function matrices of the systems (A,B,C,D) and (Ar,Br,Cr,Dr), respectively, and INFNORM(G) is the infinity-norm of G. The following procedure is used to reduce a given G: 1) Decompose additively G as G = G1 + G2 such that G1 = (As,Bs,Cs,D) has only ALPHA-stable poles and G2 = (Au,Bu,Cu,0) has only ALPHA-unstable poles. 2) Determine G1r, a reduced order approximation of the ALPHA-stable part G1. 3) Assemble the reduced model Gr as Gr = G1r + G2. To reduce the ALPHA-stable part G1, if JOB = 'B', the square-root balancing-based SPA method of [1] is used, and for an ALPHA-stable system, the resulting reduced model is balanced. If JOB = 'N', the balancing-free square-root SPA method of [2] is used to reduce the ALPHA-stable part G1. By setting TOL1 = TOL2, the routine can be used to compute Balance & Truncate approximations as well.References
[1] Liu Y. and Anderson B.D.O. Singular Perturbation Approximation of Balanced Systems, Int. J. Control, Vol. 50, pp. 1379-1405, 1989. [2] Varga A. Balancing-free square-root algorithm for computing singular perturbation approximations. Proc. 30-th IEEE CDC, Brighton, Dec. 11-13, 1991, Vol. 2, pp. 1062-1065.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* AB09ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 2*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( 2*NMAX + $ MAX( NMAX, MMAX, PMAX ) + 5 ) + $ ( NMAX*( NMAX + 1 ) )/2 ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, N, NR, NS, P CHARACTER*1 DICO, EQUIL, JOB, ORDSEL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL AB09ND * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NR, ALPHA, TOL1, TOL2, $ DICO, JOB, EQUIL, ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find a reduced ssr for (A,B,C,D). CALL AB09ND( DICO, JOB, EQUIL, ORDSEL, N, M, P, NR, $ ALPHA, A, LDA, B, LDB, C, LDC, D, LDD, $ NS, HSV, TOL1, TOL2, IWORK, DWORK, LDWORK, $ IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,NS ) IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' AB09ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB09ND = ',I2) 99997 FORMAT (' The order of reduced model = ',I2) 99996 FORMAT (/' The reduced state dynamics matrix Ar is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' The reduced input/output matrix Dr is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of ALPHA-stable part are') ENDProgram Data
AB09ND EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0 -.6D0 1.D-1 1.E-14 C N N A -0.04165 0.0000 4.9200 -4.9200 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 -0.5450 0.0000 0.0000 0.0000 0.0000 0.0000 4.9200 -0.04165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
AB09ND EXAMPLE PROGRAM RESULTS The order of reduced model = 5 The Hankel singular values of ALPHA-stable part are 1.9178 0.8621 0.7666 0.0336 0.0246 The reduced state dynamics matrix Ar is -0.5181 -1.1084 0.0000 0.0000 0.0000 8.8157 -0.5181 0.0000 0.0000 0.0000 0.0000 0.0000 0.5847 0.0000 1.9230 0.0000 0.0000 0.0000 -1.6606 0.0000 0.0000 0.0000 -4.3823 0.0000 -3.2922 The reduced input/state matrix Br is -1.2837 1.2837 -0.7522 0.7522 -0.6379 -0.6379 2.0656 -2.0656 -3.9315 -3.9315 The reduced state/output matrix Cr is -0.1380 -0.6445 -0.6416 -0.6293 0.2526 0.6246 0.0196 0.0000 0.4107 0.0000 0.1380 0.6445 -0.6416 0.6293 0.2526 The reduced input/output matrix Dr is 0.0582 -0.0090 0.0015 -0.0015 -0.0090 0.0582
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB13AD.html 0000664 0000000 0000000 00000026713 14560147231 0020316 0 ustar 00root root 0000000 0000000
Purpose
To compute the Hankel-norm of the ALPHA-stable projection of the transfer-function matrix G of the state-space system (A,B,C).Specification
DOUBLE PRECISION FUNCTION AB13AD( DICO, EQUIL, N, M, P, ALPHA, A, $ LDA, B, LDB, C, LDC, NS, HSV, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL INTEGER INFO, LDA, LDB, LDC, LDWORK, M, N, NS, P DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), HSV(*)Function Value
AB13AD DOUBLE PRECISION The Hankel-norm of the ALPHA-stable projection of G (if INFO = 0).Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system as follows: = 'C': continuous-time system; = 'D': discrete-time system. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration.Input/Output Parameters
N (input) INTEGER The order of the state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. ALPHA (input) DOUBLE PRECISION Specifies the ALPHA-stability boundary for the eigenvalues of the state dynamics matrix A. For a continuous-time system (DICO = 'C'), ALPHA <= 0 is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), 0 <= ALPHA <= 1 represents the boundary value for the moduli of eigenvalues. The ALPHA-stability domain does not include the boundary (see the Note below). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if INFO = 0, the leading N-by-N part of this array contains the state dynamics matrix A in a block diagonal real Schur form with its eigenvalues reordered and separated. The resulting A has two diagonal blocks. The leading NS-by-NS part of A has eigenvalues in the ALPHA-stability domain and the trailing (N-NS) x (N-NS) part has eigenvalues outside the ALPHA-stability domain. Note: The ALPHA-stability domain is defined either as the open half complex plane left to ALPHA, for a continous-time system (DICO = 'C'), or the interior of the ALPHA-radius circle centered in the origin, for a discrete-time system (DICO = 'D'). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, if INFO = 0, the leading N-by-M part of this array contains the input/state matrix B of the transformed system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, if INFO = 0, the leading P-by-N part of this array contains the state/output matrix C of the transformed system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). NS (output) INTEGER The dimension of the ALPHA-stable subsystem. HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, the leading NS elements of HSV contain the Hankel singular values of the ALPHA-stable part of the original system ordered decreasingly. HSV(1) is the Hankel norm of the ALPHA-stable subsystem.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*(MAX(N,M,P)+5)+N*(N+1)/2). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the computation of the ordered real Schur form of A failed; = 2: the separation of the ALPHA-stable/unstable diagonal blocks failed because of very close eigenvalues; = 3: the computed ALPHA-stable part is just stable, having stable eigenvalues very near to the imaginary axis (if DICO = 'C') or to the unit circle (if DICO = 'D'); = 4: the computation of Hankel singular values failed.Method
Let be the following linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system, and let G be the corresponding transfer-function matrix. The following procedure is used to compute the Hankel-norm of the ALPHA-stable projection of G: 1) Decompose additively G as G = G1 + G2 such that G1 = (As,Bs,Cs) has only ALPHA-stable poles and G2 = (Au,Bu,Cu) has only ALPHA-unstable poles. For the computation of the additive decomposition, the algorithm presented in [1] is used. 2) Compute the Hankel-norm of ALPHA-stable projection G1 as the the maximum Hankel singular value of the system (As,Bs,Cs). The computation of the Hankel singular values is performed by using the square-root method of [2].References
[1] Safonov, M.G., Jonckheere, E.A., Verma, M. and Limebeer, D.J. Synthesis of positive real multivariable feedback systems, Int. J. Control, Vol. 45, pp. 817-842, 1987. [2] Tombs, M.S. and Postlethwaite, I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987.Numerical Aspects
The implemented method relies on a square-root technique. 3 The algorithms require about 17N floating point operations.Further Comments
NoneExample
Program Text
* AB13AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( MAX( NMAX, MMAX, PMAX ) + 5 ) $ + ( NMAX*( NMAX + 1 ) )/2 ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, SHNORM INTEGER I, INFO, J, M, N, NS, P CHARACTER*1 DICO, EQUIL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), HSV(NMAX) * .. External Functions .. DOUBLE PRECISION AB13AD EXTERNAL AB13AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, ALPHA, DICO, EQUIL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Compute the Hankel-norm of the ALPHA-stable projection of * (A,B,C). SHNORM = AB13AD( DICO, EQUIL, N, M, P, ALPHA, A, LDA, B, $ LDB, C, LDC, NS, HSV, DWORK, LDWORK, $ INFO) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) SHNORM WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,NS ) END IF END IF END IF END IF STOP * 99999 FORMAT (' AB13AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB13AD = ',I2) 99997 FORMAT (' The Hankel-norm of the ALPHA-projection = ',1PD14.5) 99995 FORMAT (20(1X,F8.4)) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of ALPHA-projection are') ENDProgram Data
AB13AD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 0.0 C N -0.04165 0.0000 4.9200 -4.9200 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 -0.5450 0.0000 0.0000 0.0000 0.0000 0.0000 4.9200 -0.04165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000Program Results
AB13AD EXAMPLE PROGRAM RESULTS The Hankel-norm of the ALPHA-projection = 2.51388D+00 The Hankel singular values of ALPHA-projection are 2.5139 2.0846 1.9178 0.7666 0.5473 0.0253 0.0246
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB13AX.html 0000664 0000000 0000000 00000012001 14560147231 0020323 0 ustar 00root root 0000000 0000000
Purpose
To compute the Hankel-norm of the transfer-function matrix G of a stable state-space system (A,B,C). The state dynamics matrix A of the given system is an upper quasi-triangular matrix in real Schur form.Specification
DOUBLE PRECISION FUNCTION AB13AX( DICO, N, M, P, A, LDA, B, LDB, $ C, LDC, HSV, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER DICO INTEGER INFO, LDA, LDB, LDC, LDWORK, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), HSV(*)Function Value
AB13AX DOUBLE PRECISION The Hankel-norm of G (if INFO = 0).Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system as follows: = 'C': continuous-time system; = 'D': discrete-time system.Input/Output Parameters
N (input) INTEGER The order of the state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state dynamics matrix A in a real Schur canonical form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the state/output matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, this array contains the Hankel singular values of the given system ordered decreasingly. HSV(1) is the Hankel norm of the given system.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*(MAX(N,M,P)+5)+N*(N+1)/2). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D'); = 2: the computation of Hankel singular values failed.Method
Let be the stable linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system, and let G be the corresponding transfer-function matrix. The Hankel-norm of G is computed as the the maximum Hankel singular value of the system (A,B,C). The computation of the Hankel singular values is performed by using the square-root method of [1].References
[1] Tombs M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987.Numerical Aspects
The implemented method relies on a square-root technique. 3 The algorithms require about 17N floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the H2 or L2 norm of the transfer-function matrix G of the system (A,B,C,D). G must not have poles on the imaginary axis, for a continuous-time system, or on the unit circle, for a discrete-time system. If the H2-norm is computed, the system must be stable.Specification
DOUBLE PRECISION FUNCTION AB13BD( DICO, JOBN, N, M, P, A, LDA, $ B, LDB, C, LDC, D, LDD, NQ, TOL, $ DWORK, LDWORK, IWARN, INFO) C .. Scalar Arguments .. CHARACTER DICO, JOBN INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDWORK, M, $ N, NQ, P DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), DWORK(*)Function Value
AB13BD DOUBLE PRECISION The H2-norm of G, if JOBN = 'H', or the L2-norm of G, if JOBN = 'L' (if INFO = 0).Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBN CHARACTER*1 Specifies the norm to be computed as follows: = 'H': the H2-norm; = 'L': the L2-norm.Input/Output Parameters
N (input) INTEGER The order of the matrix A, the number of rows of the matrix B, and the number of columns of the matrix C. N represents the dimension of the state vector. N >= 0. M (input) INTEGER The number of columns of the matrices B and D. M represents the dimension of input vector. M >= 0. P (input) INTEGER The number of rows of the matrices C and D. P represents the dimension of output vector. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix of the system. On exit, the leading NQ-by-NQ part of this array contains the state dynamics matrix (in a real Schur form) of the numerator factor Q of the right coprime factorization with inner denominator of G (see METHOD). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix of the system. On exit, the leading NQ-by-M part of this array contains the input/state matrix of the numerator factor Q of the right coprime factorization with inner denominator of G (see METHOD). LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix of the system. On exit, the leading P-by-NQ part of this array contains the state/output matrix of the numerator factor Q of the right coprime factorization with inner denominator of G (see METHOD). LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the input/output matrix of the system. If DICO = 'C', D must be a null matrix. On exit, the leading P-by-M part of this array contains the input/output matrix of the numerator factor Q of the right coprime factorization with inner denominator of G (see METHOD). LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NQ (output) INTEGER The order of the resulting numerator Q of the right coprime factorization with inner denominator of G (see METHOD). Generally, NQ = N - NS, where NS is the number of uncontrollable unstable eigenvalues.Tolerances
TOL DOUBLE PRECISION The absolute tolerance level below which the elements of B are considered zero (used for controllability tests). If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS*NORM(B), is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH) and NORM(B) denotes the 1-norm of B.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LDWORK >= MAX( 1, M*(N+M) + MAX( N*(N+5), M*(M+2), 4*P ), N*( MAX( N, P ) + 4 ) + MIN( N, P ) ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = K: K violations of the numerical stability condition occured during the assignment of eigenvalues in computing the right coprime factorization with inner denominator of G (see the SLICOT subroutine SB08DD).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to a real Schur form failed; = 2: a failure was detected during the reordering of the real Schur form of A, or in the iterative process for reordering the eigenvalues of Z'*(A + B*F)*Z along the diagonal (see SLICOT routine SB08DD); = 3: if DICO = 'C' and the matrix A has a controllable eigenvalue on the imaginary axis, or DICO = 'D' and A has a controllable eigenvalue on the unit circle; = 4: the solution of Lyapunov equation failed because the equation is singular; = 5: if DICO = 'C' and D is a nonzero matrix; = 6: if JOBN = 'H' and the system is unstable.Method
The subroutine is based on the algorithms proposed in [1] and [2]. If the given transfer-function matrix G is unstable, then a right coprime factorization with inner denominator of G is first computed -1 G = Q*R , where Q and R are stable transfer-function matrices and R is inner. If G is stable, then Q = G and R = I. Let (AQ,BQ,CQ,DQ) be the state-space representation of Q. If DICO = 'C', then the L2-norm of G is computed as NORM2(G) = NORM2(Q) = SQRT(TRACE(BQ'*X*BQ)), where X satisfies the continuous-time Lyapunov equation AQ'*X + X*AQ + CQ'*CQ = 0. If DICO = 'D', then the l2-norm of G is computed as NORM2(G) = NORM2(Q) = SQRT(TRACE(BQ'*X*BQ+DQ'*DQ)), where X satisfies the discrete-time Lyapunov equation AQ'*X*AQ - X + CQ'*CQ = 0.References
[1] Varga A. On computing 2-norms of transfer-function matrices. Proc. 1992 ACC, Chicago, June 1992. [2] Varga A. A Schur method for computing coprime factorizations with inner denominators and applications in model reduction. Proc. ACC'93, San Francisco, CA, pp. 2130-2131, 1993.Numerical Aspects
3 The algorithm requires no more than 14N floating point operations.Further Comments
NoneExample
Program Text
* AB13BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( MMAX*( NMAX + MMAX ) + $ MAX( NMAX*( NMAX + 5 ), $ MMAX*( MMAX + 2 ), 4*PMAX ), $ NMAX*( MAX( NMAX, PMAX ) + 4 ) + $ MIN( NMAX, PMAX ) ) ) * .. Local Scalars .. DOUBLE PRECISION S2NORM, TOL INTEGER I, INFO, IWARN, J, M, N, NQ, P CHARACTER*1 DICO, JOBN * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK) * .. External Functions .. LOGICAL LSAME DOUBLE PRECISION AB13BD EXTERNAL AB13BD, LSAME * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, DICO, JOBN IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1, N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1, M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1, N ), I = 1, P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1, M ), I = 1, P ) * Compute the H2 or L2 norm of (A,B,C,D). S2NORM = AB13BD( DICO, JOBN, N, M, P, A, LDA, B, LDB, * C, LDC, D, LDD, NQ, TOL, DWORK, LDWORK, * IWARN, INFO) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( LSAME( JOBN, 'H' ) ) THEN WRITE ( NOUT, FMT = 99997 ) S2NORM ELSE WRITE ( NOUT, FMT = 99996 ) S2NORM END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' AB13BD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB13BD = ',I2) 99997 FORMAT (' The H2-norm of the system = ',1PD14.5) 99996 FORMAT (' The L2-norm of the system = ',1PD14.5) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
AB13BD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 1.E-10 C L -0.04165 0.0000 4.9200 0.4920 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 0.0545 0.0000 0.0000 0.0000 0.0000 0.0000 -0.49200 0.004165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 0.5210 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
AB13BD EXAMPLE PROGRAM RESULTS The L2-norm of the system = 7.93948D+00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB13CD.html 0000664 0000000 0000000 00000022025 14560147231 0020310 0 ustar 00root root 0000000 0000000
Purpose
To compute the H-infinity norm of the continuous-time stable system | A | B | G(s) = |---|---| . | C | D |Specification
DOUBLE PRECISION FUNCTION AB13CD( N, M, NP, A, LDA, B, LDB, C, $ LDC, D, LDD, TOL, IWORK, DWORK, $ LDWORK, CWORK, LCWORK, BWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LCWORK, LDD, LDWORK, M, N, $ NP DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ) COMPLEX*16 CWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), DWORK( * ) LOGICAL BWORK( * )Function Value
AB13CD DOUBLE PRECISION If INFO = 0, the H-infinity norm of the system, HNORM, i.e., the peak gain of the frequency response (as measured by the largest singular value in the MIMO case).Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP).Tolerances
TOL DOUBLE PRECISION Tolerance used to set the accuracy in determining the norm.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK, and DWORK(2) contains the frequency where the gain of the frequency response achieves its peak value HNORM. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= max(2,4*N*N+2*M*M+3*M*N+M*NP+2*(N+NP)*NP+10*N+ 6*max(M,NP)). For good performance, LDWORK must generally be larger. CWORK COMPLEX*16 array, dimension (LCWORK) On exit, if INFO = 0, CWORK(1) contains the optimal value of LCWORK. LCWORK INTEGER The dimension of the array CWORK. LCWORK >= max(1,(N+M)*(N+NP)+3*max(M,NP)). For good performance, LCWORK must generally be larger. BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the system is unstable; = 2: the tolerance is too small (the algorithm for computing the H-infinity norm did not converge); = 3: errors in computing the eigenvalues of A or of the Hamiltonian matrix (the QR algorithm did not converge); = 4: errors in computing singular values.Method
The routine implements the method presented in [1].References
[1] Bruinsma, N.A. and Steinbuch, M. A fast algorithm to compute the Hinfinity-norm of a transfer function matrix. Systems & Control Letters, vol. 14, pp. 287-293, 1990.Numerical Aspects
If the algorithm does not converge (INFO = 2), the tolerance must be increased.Further Comments
NoneExample
Program Text
* AB13CD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 10, MMAX = 10, PMAX = 10 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX ) INTEGER LCWORK PARAMETER ( LCWORK = ( NMAX + MMAX )*( NMAX + PMAX ) + $ 3*MAX( MMAX, PMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 4*NMAX*NMAX + 2*MMAX*MMAX + $ 2*PMAX*PMAX + 3*NMAX*MMAX + $ 2*NMAX*PMAX + MMAX*PMAX + 10*NMAX + $ 6*MAX( MMAX, PMAX ) ) * .. Local Scalars .. DOUBLE PRECISION FPEAK, HNORM, TOL INTEGER I, INFO, J, M, N, NP * .. Local Arrays .. LOGICAL BWORK(2*NMAX) INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK) COMPLEX*16 CWORK( LCWORK ) * .. External Functions .. DOUBLE PRECISION AB13CD EXTERNAL AB13CD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, NP IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE IF ( NP.LT.0 .OR. NP.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) NP ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,NP ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,NP ) READ ( NIN, FMT = * ) TOL * Computing the Hinf norm HNORM = AB13CD( N, M, NP, A, LDA, B, LDB, C, LDC, D, LDD, TOL, $ IWORK, DWORK, LDWORK, CWORK, LCWORK, BWORK, $ INFO ) * IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) WRITE ( NOUT, FMT = 99991 ) HNORM FPEAK = DWORK(2) WRITE ( NOUT, FMT = 99996 ) WRITE ( NOUT, FMT = 99991 ) FPEAK ELSE WRITE( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' AB13CD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' INFO on exit from AB13CD =',I2) 99997 FORMAT (/' The H_infty norm of the system is'/) 99996 FORMAT (/' The peak frequency is'/) 99992 FORMAT (10(1X,F8.4)) 99991 FORMAT (D17.10) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' NP is out of range.',/' NP = ',I5) ENDProgram Data
AB13CD EXAMPLE PROGRAM DATA 6 1 1 0.0 1.0 0.0 0.0 0.0 0.0 -0.5 -0.0002 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 -1.0 -0.00002 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 -2.0 -0.000002 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 0.0 0.000000001Program Results
AB13CD EXAMPLE PROGRAM RESULTS The H_infty norm of the system is 0.5000000006D+06 The peak frequency is 0.1414213562D+01
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB13DD.html 0000664 0000000 0000000 00000036671 14560147231 0020325 0 ustar 00root root 0000000 0000000
Purpose
To compute the L-infinity norm of a continuous-time or discrete-time system, either standard or in the descriptor form, -1 G(lambda) = C*( lambda*E - A ) *B + D . The norm is finite if and only if the matrix pair (A,E) has no eigenvalue on the boundary of the stability domain, i.e., the imaginary axis, or the unit circle, respectively. It is assumed that the matrix E is nonsingular.Specification
SUBROUTINE AB13DD( DICO, JOBE, EQUIL, JOBD, N, M, P, FPEAK, $ A, LDA, E, LDE, B, LDB, C, LDC, D, LDD, GPEAK, $ TOL, IWORK, DWORK, LDWORK, CWORK, LCWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOBD, JOBE INTEGER INFO, LCWORK, LDA, LDB, LDC, LDD, LDE, LDWORK, $ M, N, P DOUBLE PRECISION TOL C .. Array Arguments .. COMPLEX*16 CWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), DWORK( * ), E( LDE, * ), $ FPEAK( 2 ), GPEAK( 2 ) INTEGER IWORK( * )Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system, as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBE CHARACTER*1 Specifies whether E is a general square or an identity matrix, as follows: = 'G': E is a general square matrix; = 'I': E is the identity matrix. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the system (A,E,B,C) or (A,B,C), as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model: = 'D': D is present; = 'Z': D is assumed a zero matrix.Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. P (input) INTEGER The row size of the matrix C. P >= 0. FPEAK (input/output) DOUBLE PRECISION array, dimension (2) On entry, this parameter must contain an estimate of the frequency where the gain of the frequency response would achieve its peak value. Setting FPEAK(2) = 0 indicates an infinite frequency. An accurate estimate could reduce the number of iterations of the iterative algorithm. If no estimate is available, set FPEAK(1) = 0, and FPEAK(2) = 1. FPEAK(1) >= 0, FPEAK(2) >= 0. On exit, if INFO = 0, this array contains the frequency OMEGA, where the gain of the frequency response achieves its peak value GPEAK, i.e., || G ( j*OMEGA ) || = GPEAK , if DICO = 'C', or j*OMEGA || G ( e ) || = GPEAK , if DICO = 'D', where OMEGA = FPEAK(1), if FPEAK(2) > 0, and OMEGA is infinite, if FPEAK(2) = 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state dynamics matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) If JOBE = 'G', the leading N-by-N part of this array must contain the descriptor matrix E of the system. If JOBE = 'I', then E is assumed to be the identity matrix and is not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'G'; LDE >= 1, if JOBE = 'I'. B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) If JOBD = 'D', the leading P-by-M part of this array must contain the direct transmission matrix D. The array D is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P), if JOBD = 'D'; LDD >= 1, if JOBD = 'Z'. GPEAK (output) DOUBLE PRECISION array, dimension (2) The L-infinity norm of the system, i.e., the peak gain of the frequency response (as measured by the largest singular value in the MIMO case), coded in the same way as FPEAK.Tolerances
TOL DOUBLE PRECISION Tolerance used to set the accuracy in determining the norm. 0 <= TOL < 1.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= K, where K can be computed using the following pseudo-code (or the Fortran code included in the routine) d = 6*MIN(P,M); c = MAX( 4*MIN(P,M) + MAX(P,M), d ); if ( MIN(P,M) = 0 ) then K = 1; else if( N = 0 or B = 0 or C = 0 ) then if( JOBD = 'D' ) then K = P*M + c; else K = 1; end else if ( DICO = 'D' ) then b = 0; e = d; else b = N*(N+M); e = c; if ( JOBD = Z' ) then b = b + P*M; end end if ( JOBD = 'D' ) then r = P*M; if ( JOBE = 'I', DICO = 'C', N > 0, B <> 0, C <> 0 ) then K = P*P + M*M; r = r + N*(P+M); else K = 0; end K = K + r + c; r = r + MIN(P,M); else r = 0; K = 0; end r = r + N*(N+P+M); if ( JOBE = 'G' ) then r = r + N*N; if ( EQUIL = 'S' ) then K = MAX( K, r + 9*N ); end K = MAX( K, r + 4*N + MAX( M, 2*N*N, N+b+e ) ); else K = MAX( K, r + N + MAX( M, P, N*N+2*N, 3*N+b+e ) ); end w = 0; if ( JOBE = 'I', DICO = 'C' ) then w = r + 4*N*N + 11*N; if ( JOBD = 'D' ) then w = w + MAX(M,P) + N*(P+M); end end if ( JOBE = 'E' or DICO = 'D' or JOBD = 'D' ) then w = MAX( w, r + 6*N + (2*N+P+M)*(2*N+P+M) + MAX( 2*(N+P+M), 8*N*N + 16*N ) ); end K = MAX( 1, K, w, r + 2*N + e ); end For good performance, LDWORK must generally be larger. An easily computable upper bound is K = MAX( 1, 15*N*N + P*P + M*M + (6*N+3)*(P+M) + 4*P*M + N*M + 22*N + 7*MIN(P,M) ). The smallest workspace is obtained for DICO = 'C', JOBE = 'I', and JOBD = 'Z', namely K = MAX( 1, N*N + N*P + N*M + N + MAX( N*N + N*M + P*M + 3*N + c, 4*N*N + 10*N ) ). for which an upper bound is K = MAX( 1, 6*N*N + N*P + 2*N*M + P*M + 11*N + MAX(P,M) + 6*MIN(P,M) ). CWORK COMPLEX*16 array, dimension (LCWORK) On exit, if INFO = 0, CWORK(1) contains the optimal LCWORK. LCWORK INTEGER The dimension of the array CWORK. LCWORK >= 1, if N = 0, or B = 0, or C = 0; LCWORK >= MAX(1, (N+M)*(N+P) + 2*MIN(P,M) + MAX(P,M)), otherwise. For good performance, LCWORK must generally be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the matrix E is (numerically) singular; = 2: the (periodic) QR (or QZ) algorithm for computing eigenvalues did not converge; = 3: the SVD algorithm for computing singular values did not converge; = 4: the tolerance is too small and the algorithm did not converge.Method
The routine implements the method presented in [1], with extensions and refinements for improving numerical robustness and efficiency. Structure-exploiting eigenvalue computations for Hamiltonian matrices are used if JOBE = 'I', DICO = 'C', and the symmetric matrices to be implicitly inverted are not too ill- conditioned. Otherwise, generalized eigenvalue computations are used in the iterative algorithm of [1].References
[1] Bruinsma, N.A. and Steinbuch, M. A fast algorithm to compute the Hinfinity-norm of a transfer function matrix. Systems & Control Letters, vol. 14, pp. 287-293, 1990.Numerical Aspects
If the algorithm does not converge in MAXIT = 30 iterations (INFO = 4), the tolerance must be increased.Further Comments
If the matrix E is singular, other SLICOT Library routines could be used before calling AB13DD, for removing the singular part of the system.Example
Program Text
* AB13DD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 10, MMAX = 10, PMAX = 10 ) INTEGER LDA, LDB, LDC, LDD, LDE PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDE = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX ) INTEGER LCWORK PARAMETER ( LCWORK = ( NMAX + MMAX )*( NMAX + PMAX ) + $ 2*MIN( PMAX, MMAX ) + $ MAX( PMAX, MMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 15*NMAX*NMAX + PMAX*PMAX + MMAX*MMAX + $ ( 6*NMAX + 3 )*( PMAX + MMAX ) + $ 4*PMAX*MMAX + NMAX*MMAX + 22*NMAX + $ 7*MIN( PMAX, MMAX ) ) DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D+0 ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N, P CHARACTER DICO, EQUIL, JOBD, JOBE * .. Local Arrays .. INTEGER IWORK( LIWORK ) DOUBLE PRECISION A( LDA, NMAX ), B( LDB, MMAX ), C( LDC, NMAX ), $ D( LDD, MMAX ), DWORK( LDWORK ), E( LDE, NMAX ), $ FPEAK( 2 ), GPEAK( 2 ) COMPLEX*16 CWORK( LCWORK ) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL AB13DD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, FPEAK, TOL, DICO, JOBE, EQUIL, JOBD IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99992 ) P ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( JOBE, 'G' ) ) $ READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) IF ( LSAME( JOBD, 'D' ) ) $ READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Computing the Linf norm. CALL AB13DD( DICO, JOBE, EQUIL, JOBD, N, M, P, FPEAK, A, LDA, $ E, LDE, B, LDB, C, LDC, D, LDD, GPEAK, TOL, IWORK, $ DWORK, LDWORK, CWORK, LCWORK, INFO ) * IF ( INFO.EQ.0 ) THEN IF ( GPEAK( 2 ).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99991 ) ELSE WRITE ( NOUT, FMT = 99997 ) WRITE ( NOUT, FMT = 99995 ) GPEAK( 1 ) END IF IF ( FPEAK( 2 ).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99990 ) ELSE WRITE ( NOUT, FMT = 99996 ) WRITE ( NOUT, FMT = 99995 ) FPEAK( 1 ) END IF ELSE WRITE( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' AB13DD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' INFO on exit from AB13DD =',I2) 99997 FORMAT (/' The L_infty norm of the system is'/) 99996 FORMAT (/' The peak frequency is'/) 99995 FORMAT (D17.10) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' P is out of range.',/' P = ',I5) 99991 FORMAT (/' The L_infty norm of the system is infinite') 99990 FORMAT (/' The peak frequency is infinite'/) ENDProgram Data
AB13CD EXAMPLE PROGRAM DATA 6 1 1 0.0 1.0 0.000000001 C I N D 0.0 1.0 0.0 0.0 0.0 0.0 -0.5 -0.0002 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 -1.0 -0.00002 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 -2.0 -0.000002 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 0.0Program Results
AB13DD EXAMPLE PROGRAM RESULTS The L_infty norm of the system is 0.5000000001D+06 The peak frequency is 0.1414213562D+01
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB13DX.html 0000664 0000000 0000000 00000022210 14560147231 0020331 0 ustar 00root root 0000000 0000000
Purpose
To compute the maximum singular value of a given continuous-time or discrete-time transfer-function matrix, either standard or in the descriptor form, -1 G(lambda) = C*( lambda*E - A ) *B + D , for a given complex value lambda, where lambda = j*omega, in the continuous-time case, and lambda = exp(j*omega), in the discrete-time case. The matrices A, E, B, C, and D are real matrices of appropriate dimensions. Matrix A must be in an upper Hessenberg form, and if JOBE ='G', the matrix E must be upper triangular. The matrices B and C must correspond to the system in (generalized) Hessenberg form.Specification
DOUBLE PRECISION FUNCTION AB13DX( DICO, JOBE, JOBD, N, M, P, $ OMEGA, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, IWORK, DWORK, $ LDWORK, ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBD, JOBE INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDWORK, LZWORK, $ M, N, P DOUBLE PRECISION OMEGA C .. Array Arguments .. COMPLEX*16 ZWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), DWORK( * ), E( LDE, * ) INTEGER IWORK( * )Function Value
AB13DX DOUBLE PRECISION The maximum singular value of G(lambda).Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system, as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBE CHARACTER*1 Specifies whether E is an upper triangular or an identity matrix, as follows: = 'G': E is a general upper triangular matrix; = 'I': E is the identity matrix. JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model: = 'D': D is present; = 'Z': D is assumed a zero matrix.Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. P (input) INTEGER The row size of the matrix C. P >= 0. OMEGA (input) DOUBLE PRECISION The frequency value for which the calculations should be done. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N upper Hessenberg part of this array must contain the state dynamics matrix A in upper Hessenberg form. The elements below the subdiagonal are not referenced. On exit, if M > 0, P > 0, OMEGA = 0, DICO = 'C', B <> 0, and C <> 0, the leading N-by-N upper Hessenberg part of this array contains the factors L and U from the LU factorization of A (A = P*L*U); the unit diagonal elements of L are not stored, L is lower bidiagonal, and P is stored in IWORK (see SLICOT Library routine MB02SD). Otherwise, this array is unchanged on exit. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) If JOBE = 'G', the leading N-by-N upper triangular part of this array must contain the upper triangular descriptor matrix E of the system. The elements of the strict lower triangular part of this array are not referenced. If JOBE = 'I', then E is assumed to be the identity matrix and is not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'G'; LDE >= 1, if JOBE = 'I'. B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the system input matrix B. On exit, if M > 0, P > 0, OMEGA = 0, DICO = 'C', B <> 0, C <> 0, and INFO = 0 or N+1, the leading N-by-M part of this array contains the solution of the system A*X = B. Otherwise, this array is unchanged on exit. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, if JOBD = 'D', the leading P-by-M part of this array must contain the direct transmission matrix D. On exit, if (N = 0, or B = 0, or C = 0) and JOBD = 'D', or (OMEGA = 0, DICO = 'C', JOBD = 'D', and INFO = 0 or N+1), the contents of this array is destroyed. Otherwise, this array is unchanged on exit. This array is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P), if JOBD = 'D'; LDD >= 1, if JOBD = 'Z'.Workspace
IWORK INTEGER array, dimension (LIWORK), where LIWORK = N, if N > 0, M > 0, P > 0, B <> 0, and C <> 0; LIWORK = 0, otherwise. This array contains the pivot indices in the LU factorization of the matrix lambda*E - A; for 1 <= i <= N, row i of the matrix was interchanged with row IWORK(i). DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK, and DWORK(2), ..., DWORK(MIN(P,M)) contain the singular values of G(lambda), except for the first one, which is returned in the function value AB13DX. If (N = 0, or B = 0, or C = 0) and JOBD = 'Z', the last MIN(P,M)-1 zero singular values of G(lambda) are not stored in DWORK(2), ..., DWORK(MIN(P,M)). LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX(1, LDW1 + LDW2 ), LDW1 = P*M, if N > 0, B <> 0, C <> 0, OMEGA = 0, DICO = 'C', and JOBD = 'Z'; LDW1 = 0, otherwise; LDW2 = MIN(P,M) + MAX(3*MIN(P,M) + MAX(P,M), 5*MIN(P,M)), if (N = 0, or B = 0, or C = 0) and JOBD = 'D', or (N > 0, B <> 0, C <> 0, OMEGA = 0, and DICO = 'C'); LDW2 = 0, if (N = 0, or B = 0, or C = 0) and JOBD = 'Z', or MIN(P,M) = 0; LDW2 = 6*MIN(P,M), otherwise. For good performance, LDWORK must generally be larger. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) contains the optimal LZWORK. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= 1, if N = 0, or B = 0, or C = 0, or (OMEGA = 0 and DICO = 'C') or MIN(P,M) = 0; LZWORK >= MAX(1, (N+M)*(N+P) + 2*MIN(P,M) + MAX(P,M)), otherwise. For good performance, LZWORK must generally be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, U(i,i) is exactly zero; the LU factorization of the matrix lambda*E - A has been completed, but the factor U is exactly singular, i.e., the matrix lambda*E - A is exactly singular; = N+1: the SVD algorithm for computing singular values did not converge.Method
The routine implements standard linear algebra calculations, taking problem structure into account. LAPACK Library routines DGESVD and ZGESVD are used for finding the singular values.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To estimate beta(A), the 2-norm distance from a real matrix A to the nearest complex matrix with an eigenvalue on the imaginary axis. The estimate is given as LOW <= beta(A) <= HIGH, where either (1 + TOL) * LOW >= HIGH, or LOW = 0 and HIGH = delta, and delta is a small number approximately equal to the square root of machine precision times the Frobenius norm (Euclidean norm) of A. If A is stable in the sense that all eigenvalues of A lie in the open left half complex plane, then beta(A) is the distance to the nearest unstable complex matrix, i.e., the complex stability radius.Specification
SUBROUTINE AB13ED( N, A, LDA, LOW, HIGH, TOL, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. DOUBLE PRECISION HIGH, LOW, TOL INTEGER INFO, LDA, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). LOW (output) DOUBLE PRECISION A lower bound for beta(A). HIGH (output) DOUBLE PRECISION An upper bound for beta(A).Tolerances
TOL DOUBLE PRECISION Specifies the accuracy with which LOW and HIGH approximate beta(A). If the user sets TOL to be less than SQRT(EPS), where EPS is the machine precision (see LAPACK Library Routine DLAMCH), then the tolerance is taken to be SQRT(EPS). The recommended value is TOL = 9, which gives an estimate of beta(A) correct to within an order of magnitude.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, 3*N*(N+1) ). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the QR algorithm (LAPACK Library routine DHSEQR) fails to converge; this error is very rare.Method
Let beta(A) be the 2-norm distance from a real matrix A to the nearest complex matrix with an eigenvalue on the imaginary axis. It is known that beta(A) = minimum of the smallest singular value of (A - jwI), where I is the identity matrix and j**2 = -1, and the minimum is taken over all real w. The algorithm computes a lower bound LOW and an upper bound HIGH for beta(A) by a bisection method in the following way. Given a non-negative real number sigma, the Hamiltonian matrix H(sigma) is constructed: | A -sigma*I | | A G | H(sigma) = | | := | | . | sigma*I -A' | | F -A' | It can be shown [1] that H(sigma) has an eigenvalue whose real part is zero if and only if sigma >= beta. Any lower and upper bounds on beta(A) can be improved by choosing a number between them and checking to see if H(sigma) has an eigenvalue with zero real part. This decision is made by computing the eigenvalues of H(sigma) using the square reduced algorithm of Van Loan [2].References
[1] Byers, R. A bisection method for measuring the distance of a stable matrix to the unstable matrices. SIAM J. Sci. Stat. Comput., Vol. 9, No. 5, pp. 875-880, 1988. [2] Van Loan, C.F. A symplectic method for approximating all the eigenvalues of a Hamiltonian matrix. Linear Algebra and its Applications, Vol 61, 233-251, 1984.Numerical Aspects
Due to rounding errors the computed values of LOW and HIGH can be proven to satisfy LOW - p(n) * sqrt(e) * norm(A) <= beta(A) and beta(A) <= HIGH + p(n) * sqrt(e) * norm(A), where p(n) is a modest polynomial of degree 3, e is the machine precision and norm(A) is the Frobenius norm of A, see [1]. The recommended value for TOL is 9 which gives an estimate of beta(A) correct to within an order of magnitude. AB13ED requires approximately 38*N**3 flops for TOL = 9.Further Comments
NoneExample
Program Text
* AB13ED EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA PARAMETER ( LDA = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX*( NMAX + 1 ) ) * .. Local Scalars .. INTEGER I, INFO, J, N DOUBLE PRECISION HIGH, LOW, TOL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK) * .. External Subroutines .. EXTERNAL AB13ED, UD01MD * .. * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) * Read N, TOL and next A (row wise). READ ( NIN, FMT = * ) N, TOL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE DO 10 I = 1, N READ ( NIN, FMT = * ) ( A(I,J), J = 1, N ) 10 CONTINUE * WRITE ( NOUT, FMT = 99998 ) N, TOL CALL UD01MD( N, N, 5, NOUT, A, LDA, 'Matrix A', INFO ) * CALL AB13ED( N, A, LDA, LOW, HIGH, TOL, DWORK, LDWORK, INFO ) IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) LOW, HIGH ELSE WRITE ( NOUT, FMT = 99996 ) INFO END IF END IF STOP * 99999 FORMAT (' AB13ED EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' N =', I4, 2X, 'TOL =', D10.3) 99997 FORMAT (' LOW =', D18.11, /' HIGH =', D18.11) 99996 FORMAT (' INFO on exit from AB13ED = ', I2) 99995 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
AB13ED EXAMPLE PROGRAM DATA 5, 9.0D0 1.0D-01 1.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 1.0D-01 1.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 1.0D-01 1.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 1.0D-01 1.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 1.0D-01Program Results
AB13ED EXAMPLE PROGRAM RESULTS N = 5 TOL = 0.900D+01 Matrix A ( 5X 5) 1 2 3 4 5 1 0.1000000D+00 0.1000000D+01 0.0000000D+00 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 0.1000000D+00 0.1000000D+01 0.0000000D+00 0.0000000D+00 3 0.0000000D+00 0.0000000D+00 0.1000000D+00 0.1000000D+01 0.0000000D+00 4 0.0000000D+00 0.0000000D+00 0.0000000D+00 0.1000000D+00 0.1000000D+01 5 0.0000000D+00 0.0000000D+00 0.0000000D+00 0.0000000D+00 0.1000000D+00 LOW = 0.20929379255D-05 HIGH = 0.20793050504D-04
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB13FD.html 0000664 0000000 0000000 00000020607 14560147231 0020317 0 ustar 00root root 0000000 0000000
Purpose
To compute beta(A), the 2-norm distance from a real matrix A to the nearest complex matrix with an eigenvalue on the imaginary axis. If A is stable in the sense that all eigenvalues of A lie in the open left half complex plane, then beta(A) is the complex stability radius, i.e., the distance to the nearest unstable complex matrix. The value of beta(A) is the minimum of the smallest singular value of (A - jwI), taken over all real w. The value of w corresponding to the minimum is also computed.Specification
SUBROUTINE AB13FD( N, A, LDA, BETA, OMEGA, TOL, DWORK, LDWORK, $ CWORK, LCWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LCWORK, LDA, LDWORK, N DOUBLE PRECISION BETA, OMEGA, TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*) COMPLEX*16 CWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). BETA (output) DOUBLE PRECISION The computed value of beta(A), which actually is an upper bound. OMEGA (output) DOUBLE PRECISION The value of w such that the smallest singular value of (A - jwI) equals beta(A).Tolerances
TOL DOUBLE PRECISION Specifies the accuracy with which beta(A) is to be calculated. (See the Numerical Aspects section below.) If the user sets TOL to be less than EPS, where EPS is the machine precision (see LAPACK Library Routine DLAMCH), then the tolerance is taken to be EPS.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. If DWORK(1) is not needed, the first 2*N*N entries of DWORK may overlay CWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, 3*N*(N+2) ). For optimum performance LDWORK should be larger. CWORK COMPLEX*16 array, dimension (LCWORK) On exit, if INFO = 0, CWORK(1) returns the optimal value of LCWORK. If CWORK(1) is not needed, the first N*N entries of CWORK may overlay DWORK. LCWORK INTEGER The length of the array CWORK. LCWORK >= MAX( 1, N*(N+3) ). For optimum performance LCWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the routine fails to compute beta(A) within the specified tolerance. Nevertheless, the returned value is an upper bound on beta(A); = 2: either the QR or SVD algorithm (LAPACK Library routines DHSEQR, DGESVD or ZGESVD) fails to converge; this error is very rare.Method
AB13FD combines the methods of [1] and [2] into a provably reliable, quadratically convergent algorithm. It uses the simple bisection strategy of [1] to find an interval which contains beta(A), and then switches to the modified bisection strategy of [2] which converges quadratically to a minimizer. Note that the efficiency of the strategy degrades if there are several local minima that are near or equal the global minimum.References
[1] Byers, R. A bisection method for measuring the distance of a stable matrix to the unstable matrices. SIAM J. Sci. Stat. Comput., Vol. 9, No. 5, pp. 875-880, 1988. [2] Boyd, S. and Balakrishnan, K. A regularity result for the singular values of a transfer matrix and a quadratically convergent algorithm for computing its L-infinity norm. Systems and Control Letters, Vol. 15, pp. 1-7, 1990.Numerical Aspects
In the presence of rounding errors, the computed function value BETA satisfies beta(A) <= BETA + epsilon, BETA/(1+TOL) - delta <= MAX(beta(A), SQRT(2*N*EPS)*norm(A)), where norm(A) is the Frobenius norm of A, epsilon = p(N) * EPS * norm(A), and delta = p(N) * SQRT(EPS) * norm(A), and p(N) is a low degree polynomial. It is recommended to choose TOL greater than SQRT(EPS). Although rounding errors can cause AB13FD to fail for smaller values of TOL, nevertheless, it usually succeeds. Regardless of success or failure, the first inequality holds.Further Comments
NoneExample
Program Text
* AB13FD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA PARAMETER ( LDA = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX*( NMAX + 2 ) ) INTEGER LCWORK PARAMETER ( LCWORK = NMAX*( NMAX + 3 ) ) * .. Local Scalars .. INTEGER I, INFO, J, N DOUBLE PRECISION BETA, OMEGA, TOL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK) COMPLEX*16 CWORK(LCWORK) * .. External Subroutines .. EXTERNAL AB13FD, UD01MD * .. * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) * Read N, TOL and next A (row wise). READ ( NIN, FMT = * ) N, TOL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE DO 10 I = 1, N READ ( NIN, FMT = * ) ( A(I,J), J = 1, N ) 10 CONTINUE * WRITE ( NOUT, FMT = 99998 ) N, TOL CALL UD01MD( N, N, 5, NOUT, A, LDA, 'A', INFO ) * CALL AB13FD( N, A, LDA, BETA, OMEGA, TOL, DWORK, LDWORK, CWORK, $ LCWORK, INFO ) * IF ( INFO.NE.0 ) $ WRITE ( NOUT, FMT = 99996 ) INFO WRITE ( NOUT, FMT = 99997 ) BETA, OMEGA END IF * 99999 FORMAT (' AB13FD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' N =', I2, 3X, 'TOL =', D10.3) 99997 FORMAT (' Stability radius :', D18.11, / * ' Minimizing omega :', D18.11) 99996 FORMAT (' INFO on exit from AB13FD = ', I2) 99995 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
AB13FD EXAMPLE PROGRAM DATA 4 0.0D-00 0.0D-00 246.500 242.500 202.500 -197.500 -252.500 -248.500 -207.500 202.500 -302.500 -297.500 -248.500 242.500 -307.500 -302.500 -252.500 246.500Program Results
AB13FD EXAMPLE PROGRAM RESULTS N = 4 TOL = 0.000D+00 A ( 4X 4) 1 2 3 4 1 0.2465000D+03 0.2425000D+03 0.2025000D+03 -0.1975000D+03 2 -0.2525000D+03 -0.2485000D+03 -0.2075000D+03 0.2025000D+03 3 -0.3025000D+03 -0.2975000D+03 -0.2485000D+03 0.2425000D+03 4 -0.3075000D+03 -0.3025000D+03 -0.2525000D+03 0.2465000D+03 Stability radius : 0.39196472317D-02 Minimizing omega : 0.98966520430D+00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB13HD.html 0000664 0000000 0000000 00000050672 14560147231 0020326 0 ustar 00root root 0000000 0000000
Purpose
To compute the L-infinity norm of a proper continuous-time or causal discrete-time system, either standard or in the descriptor form, -1 G(lambda) = C*( lambda*E - A ) *B + D . The norm is finite if and only if the matrix pair (A,E) has no finite eigenvalue on the boundary of the stability domain, i.e., the imaginary axis, or the unit circle, respectively.Specification
SUBROUTINE AB13HD( DICO, JOBE, EQUIL, JOBD, CKPROP, REDUCE, POLES, $ N, M, P, RANKE, FPEAK, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NR, GPEAK, TOL, IWORK, DWORK, $ LDWORK, ZWORK, LZWORK, BWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER CKPROP, DICO, EQUIL, JOBD, JOBE, POLES, REDUCE INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDE, LDWORK, $ LZWORK, M, N, NR, P, RANKE C .. Array Arguments .. COMPLEX*16 ZWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), DWORK( * ), E( LDE, * ), $ FPEAK( 2 ), GPEAK( 2 ), TOL( * ) INTEGER IWORK( * ) LOGICAL BWORK( * )Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system, as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBE CHARACTER*1 Specifies whether E is an identity matrix, a general square matrix, or a matrix in compressed form, as follows: = 'I': E is the identity matrix; = 'G': E is a general matrix; = 'C': E is in compressed form, i.e., E = [ T 0 ], [ 0 0 ] with a square full-rank matrix T. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the system (A,E,B,C) or (A,B,C), as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model: = 'D': D is present; = 'Z': D is assumed a zero matrix; = 'F': D is known to be well-conditioned (hence, to have full rank), for DICO = 'C' and JOBE = 'I'. The options JOBD = 'D' and JOBD = 'F' produce the same results, but much less memory is needed for JOBD = 'F'. CKPROP CHARACTER*1 If DICO = 'C' and JOBE <> 'I', specifies whether the user wishes to check the properness of the transfer function of the descriptor system, as follows: = 'C': check the properness; = 'N': do not check the properness. If the test is requested and the system is found improper then GPEAK and FPEAK are both set to infinity, i.e., their second component is zero; in addition, IWARN is set to 2. If the test is not requested, but the system is improper, the resulted GPEAK and FPEAK may be wrong. If DICO = 'D' or JOBE = 'I', this option is ineffective. REDUCE CHARACTER*1 If CKPROP = 'C', specifies whether the user wishes to reduce the system order, by removing all uncontrollable and unobservable poles before computing the norm, as follows: = 'R': reduce the system order; = 'N': compute the norm without reducing the order. If CKPROP = 'N', this option is ineffective. POLES CHARACTER*1 Specifies whether the user wishes to use all or part of the poles to compute the test frequencies (in the non- iterative part of the algorithm), or all or part of the midpoints (in the iterative part of the algorithm), as follows: = 'A': use all poles with non-negative imaginary parts and all midpoints; = 'P': use part of the poles and midpoints.Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. P (input) INTEGER The row size of the matrix C. P >= 0. RANKE (input) INTEGER If JOBE = 'C', RANKE denotes the rank of the descriptor matrix E or the size of the full-rank block T. 0 <= RANKE <= N. FPEAK (input/output) DOUBLE PRECISION array, dimension (2) On entry, this parameter must contain an estimate of the frequency where the gain of the frequency response would achieve its peak value. Setting FPEAK(2) = 0 indicates an infinite frequency. An accurate estimate could reduce the number of iterations of the iterative algorithm. If no estimate is available, set FPEAK(1) = 0, and FPEAK(2) = 1. FPEAK(1) >= 0, FPEAK(2) >= 0. On exit, if INFO = 0, this array contains the frequency OMEGA, where the gain of the frequency response achieves its peak value GPEAK, i.e., || G ( j*OMEGA ) || = GPEAK , if DICO = 'C', or j*OMEGA || G ( e ) || = GPEAK , if DICO = 'D', where OMEGA = FPEAK(1), if FPEAK(2) > 0, and OMEGA is infinite, if FPEAK(2) = 0. (If nonzero, FPEAK(2) = 1.) For discrete-time systems, it is assumed that the sampling period is Ts = 1. If Ts <> 1, the frequency corresponding to the peak gain is OMEGA/Ts. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, if EQUIL = 'S' and CKPROP = 'N', the leading N-by-N part of this array contains the state dynamics matrix of an equivalent, scaled system. On exit, if CKPROP = 'C', DICO = 'C', and JOBE <> 'I', the leading NR-by-NR part of this array contains the state dynamics matrix of an equivalent reduced, possibly scaled (if EQUIL = 'S') system, used to check the properness. Otherwise, the array A is unchanged. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,K), where K is N, RANKE, or 0, if JOBE = 'G', 'C', or 'I', respectively. On entry, if JOBE = 'G', the leading N-by-N part of this array must contain the descriptor matrix E of the system. If JOBE = 'C', the leading RANKE-by-RANKE part of this array must contain the full-rank block T of the descriptor matrix E. If JOBE = 'I', then E is assumed to be the identity matrix and is not referenced. On exit, if EQUIL = 'S' and CKPROP = 'N', the leading K-by-K part of this array contains the descriptor matrix of an equivalent, scaled system. On exit, if CKPROP = 'C', DICO = 'C', and JOBE <> 'I', the leading MIN(K,NR)-by-MIN(K,NR) part of this array contains the descriptor matrix of an equivalent reduced, possibly scaled (if EQUIL = 'S') system, used to check the properness. Otherwise, the array E is unchanged. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'G'; LDE >= MAX(1,RANKE), if JOBE = 'C'; LDE >= 1, if JOBE = 'I'. B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the system input matrix B. On exit, if EQUIL = 'S' and CKPROP = 'N', the leading NR-by-M part of this array contains the system input matrix of an equivalent, scaled system. On exit, if CKPROP = 'C', DICO = 'C', and JOBE <> 'I', the leading NR-by-M part of this array contains the system input matrix of an equivalent reduced, possibly scaled (if EQUIL = 'S') system, used to check the properness. Otherwise, the array B is unchanged. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the system output matrix C. On exit, if EQUIL = 'S' and CKPROP = 'N', the leading P-by-NR part of this array contains the system output matrix of an equivalent, scaled system. On exit, if CKPROP = 'C', DICO = 'C', and JOBE <> 'I', the leading P-by-NR part of this array contains the system output matrix of an equivalent reduced, possibly scaled (if EQUIL = 'S') system, used to check the properness. Otherwise, the array C is unchanged. LDC INTEGER The leading dimension of the array C. LDC >= max(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) If JOBD = 'D' or JOBD = 'F', the leading P-by-M part of this array must contain the direct transmission matrix D. The array D is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P), if JOBD = 'D' or JOBD = 'F'; LDD >= 1, if JOBD = 'Z'. NR (output) INTEGER If CKPROP = 'C', DICO = 'C', and JOBE <> 'I', the order of the reduced system. Otherwise, NR = N. GPEAK (output) DOUBLE PRECISION array, dimension (2) The L-infinity norm of the system, i.e., the peak gain of the frequency response (as measured by the largest singular value in the MIMO case), coded in the same way as FPEAK.Tolerances
TOL DOUBLE PRECISION array, dimension K, where K = 2, if CKPROP = 'N' or DICO = 'D' or JOBE = 'I', and K = 4, otherwise. TOL(1) is the tolerance used to set the accuracy in determining the norm. 0 <= TOL(1) < 1. TOL(2) is the threshold value for magnitude of the matrix elements, if EQUIL = 'S': elements with magnitude less than or equal to TOL(2) are ignored for scaling. If the user sets TOL(2) >= 0, then the given value of TOL(2) is used. If the user sets TOL(2) < 0, then an implicitly computed, default threshold, THRESH, is used instead, defined by THRESH = 0.1, if MN/MX < EPS, and otherwise, THRESH = MIN( 100*(MN/(EPS**0.25*MX))**0.5, 0.1 ), where MX and MN are the maximum and the minimum nonzero absolute value, respectively, of the elements of A and E, and EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL(2) = 0 is not always a good choice. TOL(2) < 1. TOL(2) is not used if EQUIL = 'N'. TOL(3) is the tolerance to be used in rank determinations when transforming (lambda*E-A,B,C), if CKPROP = 'C'. If the user sets TOL(3) > 0, then the given value of TOL(3) is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL(3) is considered to be of full rank. If the user sets TOL(3) <= 0, then an implicitly computed, default tolerance, defined by TOLDEF1 = N*N*EPS, is used instead. TOL(3) < 1. TOL(4) is the tolerance to be used for checking the singularity of the matrices A and E when CKPROP = 'C'. If the user sets TOL(4) > 0, then the given value of TOL(4) is used. If the user sets TOL(4) <= 0, then an implicitly computed, default tolerance, defined by TOLDEF2 = N*EPS, is used instead. The 1-norms of A and E are also taken into account. TOL(4) < 1.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= 1, if MIN(N,P,M) = 0, or B = 0, or C = 0; else LIWORK >= MAX(1,N), if DICO = 'C', JOBE = 'I', and JOBD <> 'D'; LIWORK >= 2*N + M + P + R + 12, otherwise, where R = 0, if M + P is even, R = 1, if M + P is odd. On exit, if INFO = 0, IWORK(1) returns the number of iterations performed by the iterative algorithm (possibly 0). DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. On exit, if INFO = -28, DWORK(1) returns the minimum value of LDWORK. These values are also set when LDWORK = 0 on entry, but no error message related to LDWORK is issued by XERBLA. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 1, if MIN(M,P) = 0 or ( JOBD = 'Z' and ( N = 0 or B = 0 or C = 0 ) ); LDWORK >= P*M + x, if ( ( N = 0 and MIN(M,P) > 0 ) or ( B = 0 or C = 0 ) ) and JOBD <> 'Z', where x = MAX( 4*MIN(M,P) + MAX(M,P), 6*MIN(M,P) ), if DICO = 'C', x = 6*MIN(M,P), if DICO = 'D'; LDWORK >= MAX( 1, N*(N+M+P+2) + MAX( N*(N+M+2) + P*M + x, 4*N*N + 9*N ) ), if DICO = 'C', JOBE = 'I' and JOBD = 'Z'. LDWORK >= MAX( 1, (N+M)*(M+P) + P*P + x, 2*N*(N+M+P+1) + N + MIN(P,M) + MAX( M*(N+P) + N + x, N*N + MAX( N*(P+M) + MAX(M,P), 2*N*N + 8*N ) ) ), if DICO = 'C', JOBE = 'I' and JOBD = 'F'. The formulas for other cases, e.g., for JOBE <> 'I' or CKPROP = 'C', contain additional and/or other terms. The minimum value of LDWORK for all cases can be obtained in DWORK(1) when LDWORK is set to 0 on entry. 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. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) contains the optimal LZWORK. On exit, if INFO = -30, ZWORK(1) returns the minimum value of LZWORK. These values are also set when LZWORK = 0 on entry, but no error message related to LZWORK is issued by XERBLA. If LDWORK = 0 and LZWORK = 0 are both set on entry, then on exit, INFO = -30, but both DWORK(1) and ZWORK(1) are set the minimum values of LDWORK and LZWORK, respectively. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= 1, if MIN(N,M,P) = 0, or B = 0, or C = 0; LZWORK >= MAX(1, (N+M)*(N+P) + 2*MIN(M,P) + MAX(M,P)), otherwise. For good performance, LZWORK must generally be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA. BWORK LOGICAL array, dimension (N)Warning Indicator
IWARN INTEGER = 0: no warning; = 1: the descriptor system is singular. GPEAK(1) and GPEAK(2) are set to 0. FPEAK(1) and FPEAK(2) are set to 0 and 1, respectively; = 2: the descriptor system is improper. GPEAK(1) and GPEAK(2) are set to 1 and 0, respectively, corresponding to infinity. FPEAK(1) and FPEAK(2) are set similarly. This warning can only appear if CKPROP = 'C'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: a matrix is (numerically) singular or the Sylvester equation is very ill-conditioned, when computing the largest singular value of G(infinity) (for DICO = 'C'); the descriptor system is nearly singular; the L-infinity norm could be infinite; = 2: the (periodic) QR (or QZ) algorithm for computing eigenvalues did not converge; = 3: the SVD algorithm for computing singular values did not converge; = 4: the tolerance is too small and the algorithm did not converge; this is a warning; = 5: other computations than QZ iteration, or reordering of eigenvalues, failed in the LAPACK Library routines DHGEQZ or DTGSEN, respectively; = 6: the numbers of "finite" eigenvalues before and after reordering differ; the threshold used might be unsuitable.Method
The routine implements the method presented in [2], which is an extension of the method in [1] for descriptor systems. There are several improvements and refinements [3-5] to increase numerical robustness, accuracy and efficiency, such as the usage of structure-preserving eigenvalue computations for skew-Hamiltonian/ Hamiltonian eigenvalue problems in the iterative method in [2].References
[1] Bruinsma, N.A. and Steinbuch, M. A fast algorithm to compute the H-infinity-norm of a transfer function matrix. Systems & Control Letters, vol. 14, pp. 287-293, 1990. [2] Voigt, M. L-infinity-Norm Computation for Descriptor Systems. Diploma Thesis, Fakultaet fuer Mathematik, TU Chemnitz, http://nbn-resolving.de/urn:nbn:de:bsz:ch1-201001050. [3] Benner, P., Sima, V. and Voigt, M. L-infinity-norm computation for continuous-time descriptor systems using structured matrix pencils. IEEE Trans. Auto. Contr., AC-57, pp.233-238, 2012. [4] Benner, P., Sima, V. and Voigt, M. Robust and efficient algorithms for L-infinity-norm computations for descriptor systems. 7th IFAC Symposium on Robust Control Design (ROCOND'12), pp. 189-194, 2012. [5] Benner, P., Sima, V. and Voigt, M. Algorithm 961: Fortran 77 subroutines for the solution of skew-Hamiltonian/Hamiltonian eigenproblems. ACM Trans. Math. Softw, 42, pp. 1-26, 2016.Numerical Aspects
If the algorithm does not converge in MAXIT = 30 iterations (INFO = 4), the tolerance must be increased, or the system is improper.Further Comments
Setting POLES = 'P' usually saves some computational effort. The number of poles used is defined by the parameters BM, BNEICD, BNEICM, BNEICX, BNEIR and SWNEIC. Both real and complex optimal workspace sizes are computed if either LDWORK = -1 or LZWORK = -1.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB13ID.html 0000664 0000000 0000000 00000062763 14560147231 0020333 0 ustar 00root root 0000000 0000000
Purpose
To check whether the transfer function -1 G(lambda) := C*( lambda*E - A ) *B of a given linear time-invariant descriptor system with generalized state space realization (lambda*E-A,B,C) is proper. Optionally, if JOBEIG = 'A', the system (lambda*E-A,B,C) is reduced to an equivalent one (lambda*Er-Ar,Br,Cr) with only controllable and observable eigenvalues in order to use it for a subsequent L_inf-norm computation; if JOBEIG = 'I', the system is reduced to an equivalent one (lambda*Er-Ar,Br,Cr) without uncontrollable and unobservable infinite eigenvalues. In this case, intended mainly for checking the properness, the returned system is not fully reduced, unless UPDATE = 'U'.Specification
LOGICAL FUNCTION AB13ID( JOBSYS, JOBEIG, EQUIL, CKSING, RESTOR, $ UPDATE, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, NR, RANKE, TOL, IWORK, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER CKSING, EQUIL, JOBEIG, JOBSYS, RESTOR, UPDATE INTEGER INFO, IWARN, LDA, LDB, LDC, LDE, LDWORK, M, N, $ NR, P, RANKE C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), TOL( * )Function Value
AB13ID LOGICAL Indicates whether the transfer function is proper. If AB13ID = .TRUE., the transfer function is proper; otherwise, it is improper.Arguments
Mode Parameters
JOBSYS CHARACTER*1 Indicates whether the system (lambda*E-A,B,C) is already in the reduced form which is obtained as stated in JOBEIG, as follows. = 'R': The system is not in a reduced form, the reduction step is performed; = 'N': The system is in a reduced form; the reduction step is omitted. JOBEIG CHARACTER*1 Indicates which kind of eigenvalues of the matrix pencil lambda*E-A should be removed if JOBSYS = 'R', as follows: = 'A': All uncontrollable and unobservable eigenvalues are removed; the reduced system is returned in the arrays A, E, B, C; = 'I': Only all uncontrollable and unobservable infinite eigenvalues are removed; the returned system is not fully reduced if UPDATE = 'N'. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily scale the system (lambda*E-A,B,C) as follows: = 'S': Perform scaling; = 'N': Do not perform scaling. CKSING CHARACTER*1 Specifies whether the user wishes to check if the pencil (lambda*E-A) is singular as follows: = 'C': Check singularity; = 'N': Do not check singularity. If the pencil is singular, the reduced system computed for CKSING = 'N' may have completely different eigenvalues than the given system. The test is performed only if JOBSYS = 'R'. RESTOR CHARACTER*1 Specifies whether the user wishes to save the system matrices before each reduction phase (if JOBSYS = 'R') and restore them if no order reduction took place as follows: = 'R': Save and restore; = 'N': Do not save the matrices. This option is ineffective if JOBSYS = 'N'. UPDATE CHARACTER*1 Specifies whether the user wishes to update the matrices A, B, and C if JOBEIG = 'I' as follows: = 'U': Update the matrices A, B and C; = 'N': Do not update the matrices A, B and C when performing URV decomposition of the matrix E (see METHOD).Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. M (input) INTEGER The dimension of the descriptor system input vector; also the number of columns of matrix B. M >= 0. P (input) INTEGER The dimension of the descriptor system output vector; also the number of rows of matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state matrix A. On exit, if JOBSYS = 'R' and JOBEIG = 'A', the leading NR-by-NR part of this array contains the reduced order state matrix Ar of a fully controllable and observable realization for the original system. If JOBSYS = 'R' and JOBEIG = 'I', the leading NR-by-NR part of this array contains the reduced order state matrix Ar of a transformed system without uncontrollable and unobservable infinite poles. In this case, the matrix Ar does not correspond to the returned matrix Er (obtained after a URV decomposition), unless UPDATE = 'U' or RANKE < NR. On exit, if JOBSYS = 'N' and (JOBEIG = 'A' or UPDATE = 'U' or RANKE < N), the leading N-by-N part of this array contains the transformed matrix A corresponding to the URV decomposition of E (see (2) in METHOD), and if JOBEIG = 'I' and UPDATE = 'N', the submatrix A22 in (2) is further transformed to estimate its rank. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the descriptor matrix E. On exit, if JOBSYS = 'R' and JOBEIG = 'A', the leading NR-by-NR part of this array contains the reduced order descriptor matrix Er of a completely controllable and observable realization for the original system. The reduced matrix Er is in upper triangular form. If JOBSYS = 'R' and JOBEIG = 'I', the leading NR-by-NR part of this array contains the reduced order descriptor matrix Er of a transformed system without uncontrollable and unobservable infinite poles. The reduced matrix Er is upper triangular. In both cases, or if JOBSYS = 'N', the matrix Er results from a URV decomposition of the matrix E (see METHOD). LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) On entry, the leading N-by-M part of this array must contain the input matrix B; the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. On exit, if JOBSYS = 'R' and JOBEIG = 'A', the leading NR-by-M part of this array contains the reduced input matrix Br of a completely controllable and observable realization for the original system. If JOBSYS = 'R' and JOBEIG = 'I', the leading NR-by-M part of this array contains the transformed input matrix Br obtained after removing the uncontrollable and unobservable infinite poles; the transformations for the URV decomposition of the matrix E are not applied if UPDATE = 'N'. On exit, if JOBSYS = 'N' and (JOBEIG = 'A' or UPDATE = 'U'), the leading N-by-M part of this array contains the transformed matrix B corresponding to the URV decomposition of E, but if JOBEIG = 'I', EQUIL = 'N' and UPDATE = 'N', the array B is unchanged on exit. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C; the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. On exit, if JOBSYS = 'R' and JOBEIG = 'A', the leading P-by-NR part of this array contains the transformed output matrix Cr of a completely controllable and observable realization for the original system. If JOBSYS = 'R' and JOBEIG = 'I', the leading P-by-NR part of this array contains the transformed output matrix Cr obtained after removing the uncontrollable and unobservable infinite poles; the transformations for the URV decomposition of the matrix E are not applied if UPDATE = 'N'. On exit, if JOBSYS = 'N' and (JOBEIG = 'A' or UPDATE = 'U'), the leading P-by-N part of this array contains the transformed matrix C corresponding to the URV decomposition of E, but if JOBEIG = 'I', EQUIL = 'N' and UPDATE = 'N', the array C is unchanged on exit. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M,P) if N > 0; LDC >= 1 if N = 0. NR (output) INTEGER The order of the reduced generalized state space representation (lambda*Er-Ar,Br,Cr) as stated in JOBEIG. If JOBEIG = 'A', NR denotes the order of a reduced system without any uncontrollable or unobservable eigenvalues; if JOBEIG = 'I', NR denotes the order of the reduced system without any uncontrollable or unobservable infinite eigenvalues. If JOBSYS = 'N', then NR = N. RANKE (output) INTEGER The effective (estimated) rank of the reduced matrix Er.Tolerances
TOL DOUBLE PRECISION array, dimension 3 TOL(1) is the tolerance to be used in rank determinations when transforming (lambda*E-A,B,C). If the user sets TOL(1) > 0, then the given value of TOL(1) is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL(1) is considered to be of full rank. If the user sets TOL(1) <= 0, then an implicitly computed, default tolerance, defined by TOLDEF1 = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL(1) < 1. TOL(2) is the tolerance to be used for checking pencil singularity when CKSING = 'C', or singularity of the matrices A and E when CKSING = 'N'. If the user sets TOL(2) > 0, then the given value of TOL(2) is used. If the user sets TOL(2) <= 0, then an implicitly computed, default tolerance, defined by TOLDEF2 = 10*EPS, is used instead. TOL(2) < 1. TOL(3) is the threshold value for magnitude of the matrix elements, if EQUIL = 'S': elements with magnitude less than or equal to TOL(3) are ignored for scaling. If the user sets TOL(3) >= 0, then the given value of TOL(3) is used. If the user sets TOL(3) < 0, then an implicitly computed, default threshold, defined by THRESH = c*EPS, where c = MAX(||A||,||E||,||B||,||C||) is used instead and 1-norm is used. TOL(3) = 0 is not always a good choice. TOL(3) < 1. TOL(3) is not used if EQUIL = 'N'.Workspace
IWORK INTEGER array, dimension (LIWORK) If JOBSYS = 'R', LIWORK >= 2*N+MAX(M,P)+7; If JOBSYS = 'N', LIWORK >= N. If JOBSYS = 'R', the first 7 elements of IWORK contain information on performed reduction and on structure of resulting system matrices after removing the specified eigenvalues (see the description of the parameter INFRED of the SLICOT Library routine TG01JY). DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. If JOBSYS = 'R', and EQUIL = 'S', LDWORK >= MAX(w+4*N+4,8*N,x,y), where w = N*N, if JOBEIG = 'A', w = 0, if JOBEIG = 'I', x = MAX(2*(z+MAX(M,P)+N-1),N*N+4*N), if RESTOR = 'R' x = MAX( 2*(MAX(M,P)+N-1),N*N+4*N), if RESTOR = 'N' y = 2*N*N+10*N+MAX(N,23), if CKSING = 'C', y = 0, if CKSING = 'N', z = 2*N*N+N*M+N*P; if JOBSYS = 'R', and EQUIL = 'N', LDWORK >= MAX(w+4*N+4,x,y); if JOBSYS = 'N', and JOBEIG = 'A' or UPDATE = 'U', and EQUIL = 'S', LDWORK >= MAX(N*N+4*N+4,8*N,N+M,N+P); if JOBSYS = 'N', and JOBEIG = 'A' or UPDATE = 'U', and EQUIL = 'N', LDWORK >= MAX(N*N+4*N+4,N+M,N+P); if JOBSYS = 'N', and JOBEIG = 'I' and UPDATE = 'N', and EQUIL = 'S', LDWORK >= MAX(4*N+4,8*N); if JOBSYS = 'N', and JOBEIG = 'I' and UPDATE = 'N', and EQUIL = 'N', LDWORK >= 4*N+4. If JOBSYS = 'R' and ( RESTOR = 'R' or LDWORK >= MAX(1,2*N*N+N*M+N*P+2*(MAX(M,P)+N-1) ), then more accurate results are to be expected by considering only those reduction phases in the SLICOT Library routine TG01JY, where effective order reduction occurs. This is achieved by saving the system matrices before each phase (after orthogonally triangularizing the matrix A or the matrix E, if RESTOR = 'N') and restoring them if no order reduction took place. However, higher global accuracy is not guaranteed. For good performance, LDWORK should be generally 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. The optimal workspace includes the extra space for improving the accuracy.Warning Indicator
IWARN INTEGER = 0: When determining the rank of a matrix, the rank can be safely determined: a small decrease of TOL(1) will not increase the rank. = 1: The computed rank is possibly incorrect: a small decrease of TOL(1) might increase the rank.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the given pencil A - lambda*E is numerically singular and the reduced system is not computed. However, the system is considered improper, and AB13ID is set to .FALSE. This error can be returned only if CKSING = 'C'.Method
If JOBSYS = 'R', the routine first removes uncontrollable and unobservable infinite eigenvalues of the pencil lambda*E-A. If, in addition, JOBEIG = 'A', uncontrollable and unobservable zero eigenvalues are also removed. Then, or if JOBSYS = 'N', a URV decomposition of the matrix E is performed, i.e., orthogonal matrices U and V are computed, such that ( T 0 ) U*E*V = ( ) with a full-rank matrix T. (1) ( 0 0 ) Then the matrix A (or a copy of A if JOBEIG = 'A' or UPDATE = 'U') is updated and partioned as in (1), i.e., ( A11 A12 ) U*A*V = ( ) , (2) ( A21 A22 ) and the rank of A22 is computed. If A22 is invertible, the transfer function is proper, otherwise it is improper. If required (i.e., JOBEIG = 'A' or UPDATE = 'U'), the matrices B and C are updated as well in order to obtain an equivalent reduced system with the same transfer function. See also Chapter 3 in [1], [2] for more details.References
[1] Voigt, M. L_inf-Norm Computation for Descriptor Systems. Diploma Thesis, Chemnitz University of Technology, Department of Mathematics, Germany, July 2010. [2] Benner, P., Sima, V., Voigt, M. L_infinity-norm computation for continuous-time descriptor systems using structured matrix pencils. IEEE Trans. Automat. Contr., vol. 57, pp. 233-238, 2012.Numerical Aspects
The algorithm requires O(N**3) floating point operations. During the algorithm it is necessary to determine the rank of certain matrices. Therefore it is crucial to use an appropriate tolerance TOL(1) to make correct rank decisions.Further Comments
NoneExample
Program Text
* AB13ID EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE PARAMETER ( LDA = NMAX, LDB = NMAX, $ LDC = MAX( MMAX, PMAX ), LDE = NMAX ) INTEGER LDWORK, LIWORK PARAMETER ( LDWORK = 2*NMAX*NMAX + $ MAX( 2*( NMAX*( NMAX + MMAX + PMAX ) + $ MAX( MMAX, PMAX ) + NMAX - 1 ), $ 10*NMAX + MAX( NMAX, 23 ) ), $ LIWORK = 2*NMAX + MAX( MMAX, PMAX ) + 7 ) * .. Local Scalars .. LOGICAL LISPRP CHARACTER CKSING, EQUIL, JOBEIG, JOBSYS, RESTOR, UPDATE INTEGER I, INFO, IWARN, J, M, N, NO, NR, P, RANKE * .. Local Arrays .. INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAX(MMAX,PMAX)), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), TOL(3) * .. External Functions .. LOGICAL AB13ID, LSAME EXTERNAL AB13ID, LSAME * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL(1), TOL(2), TOL(3), JOBSYS, $ JOBEIG, EQUIL, CKSING, RESTOR, UPDATE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Check whether the transfer function of the descriptor * system is proper. LISPRP = AB13ID( JOBSYS, JOBEIG, EQUIL, CKSING, RESTOR, $ UPDATE, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, NR, RANKE, TOL, IWORK, DWORK, $ LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LISPRP ) THEN WRITE ( NOUT, FMT = 99991 ) ELSE WRITE ( NOUT, FMT = 99990 ) END IF WRITE ( NOUT, FMT = 99994 ) NR WRITE ( NOUT, FMT = 99989 ) RANKE IF ( LSAME( JOBSYS, 'N' ).AND.( LSAME( JOBEIG, 'A' ) $ .OR.LSAME( UPDATE, 'U' ) ) ) THEN NO = N ELSE NO = NR END IF WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, NO WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NO ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,NR ) 20 CONTINUE IF ( LSAME( JOBSYS, 'N' ).AND.LSAME( JOBEIG, 'I' ) $ .AND.LSAME( EQUIL, 'S' ) $ .AND.LSAME( UPDATE, 'N' ) ) $ NO = N WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 40 CONTINUE IF ( IWARN.NE.0 ) $ WRITE ( NOUT, FMT = 99998 ) IWARN END IF END IF END IF END IF STOP * 99999 FORMAT (' AB13ID EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB13ID = ',I2) 99997 FORMAT (/' The reduced state dynamics matrix Ar is ') 99996 FORMAT (/' The reduced descriptor matrix Er is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' Order of reduced system =', I5 ) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT ( ' The system is proper') 99990 FORMAT ( ' The system is improper') 99989 FORMAT (' Rank of matrix E =', I5 ) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
AB13ID EXAMPLE PROGRAM DATA 9 2 2 0.0 0.0 0.0 R I N N N U -2 -3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -2 -3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0 1 -3 0 1 0 2 0 0 1 1 3 0 1 0 0 1Program Results
AB13ID EXAMPLE PROGRAM RESULTS The system is improper Order of reduced system = 7 Rank of matrix E = 5 The reduced state dynamics matrix Ar is 0.2202 0.4554 -0.6171 -0.3695 -1.3751 0.8121 0.1953 0.6175 0.1352 -0.8444 -0.0262 -1.3999 -0.4013 0.3339 -0.6362 -1.1518 0.6708 -0.2221 0.8680 -0.0430 0.1827 0.1430 -0.0480 -0.3290 -0.1625 -0.6986 0.0008 -0.9031 0.0986 -0.8665 0.4541 0.6647 1.4067 0.4214 -0.0381 -0.6979 -0.0079 -0.1915 0.6588 -0.2054 0.0000 0.0000 -0.1861 -0.0021 -0.8313 -0.3063 0.4248 0.0000 0.0000 The reduced descriptor matrix Er is -1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The reduced input/state matrix Br is -0.2140 -0.3805 -0.2558 -0.2539 0.1844 0.4001 -0.1115 -0.1176 0.1879 0.5325 -0.9954 -0.0961 0.0961 -0.9954 The reduced state/output matrix Cr is 0.0439 -3.8727 0.0000 0.0000 0.0000 0.6508 0.7593 0.1184 2.0671 -0.8971 -0.8236 -2.2869 1.4100 0.1085
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB13MD.html 0000664 0000000 0000000 00000022374 14560147231 0020331 0 ustar 00root root 0000000 0000000
Purpose
To compute an upper bound on the structured singular value for a given square complex matrix and a given block structure of the uncertainty.Specification
SUBROUTINE AB13MD( FACT, N, Z, LDZ, M, NBLOCK, ITYPE, X, BOUND, D, $ G, IWORK, DWORK, LDWORK, ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER FACT INTEGER INFO, LDWORK, LDZ, LZWORK, M, N DOUBLE PRECISION BOUND C .. Array Arguments .. INTEGER ITYPE( * ), IWORK( * ), NBLOCK( * ) COMPLEX*16 Z( LDZ, * ), ZWORK( * ) DOUBLE PRECISION D( * ), DWORK( * ), G( * ), X( * )Arguments
Mode Parameters
FACT CHARACTER*1 Specifies whether or not an information from the previous call is supplied in the vector X. = 'F': On entry, X contains information from the previous call. = 'N': On entry, X does not contain an information from the previous call.Input/Output Parameters
N (input) INTEGER The order of the matrix Z. N >= 0. Z (input) COMPLEX*16 array, dimension (LDZ,N) The leading N-by-N part of this array must contain the complex matrix Z for which the upper bound on the structured singular value is to be computed. LDZ INTEGER The leading dimension of the array Z. LDZ >= max(1,N). M (input) INTEGER The number of diagonal blocks in the block structure of the uncertainty. M >= 1. NBLOCK (input) INTEGER array, dimension (M) The vector of length M containing the block structure of the uncertainty. NBLOCK(I), I = 1:M, is the size of each block. ITYPE (input) INTEGER array, dimension (M) The vector of length M indicating the type of each block. For I = 1:M, ITYPE(I) = 1 indicates that the corresponding block is a real block, and ITYPE(I) = 2 indicates that the corresponding block is a complex block. NBLOCK(I) must be equal to 1 if ITYPE(I) is equal to 1. X (input/output) DOUBLE PRECISION array, dimension ( M + MR - 1 ), where MR is the number of the real blocks. On entry, if FACT = 'F' and NBLOCK(1) < N, this array must contain information from the previous call to AB13MD. If NBLOCK(1) = N, this array is not used. On exit, if NBLOCK(1) < N, this array contains information that can be used in the next call to AB13MD for a matrix close to Z. BOUND (output) DOUBLE PRECISION The upper bound on the structured singular value. D, G (output) DOUBLE PRECISION arrays, dimension (N) The vectors of length N containing the diagonal entries of the diagonal N-by-N matrices D and G, respectively, such that the matrix Z'*D^2*Z + sqrt(-1)*(G*Z-Z'*G) - BOUND^2*D^2 is negative semidefinite.Workspace
IWORK INTEGER array, dimension (MAX(4*M-2,N)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 2*N*N*M - N*N + 9*M*M + N*M + 11*N + 33*M - 11. For best performance LDWORK >= 2*N*N*M - N*N + 9*M*M + N*M + 6*N + 33*M - 11 + MAX( 5*N,2*N*NB ) where NB is the optimal blocksize returned by ILAENV. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) contains the optimal value of LZWORK. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= 6*N*N*M + 12*N*N + 6*M + 6*N - 3. For best performance LZWORK >= 6*N*N*M + 12*N*N + 6*M + 3*N - 3 + MAX( 3*N,N*NB ) where NB is the optimal blocksize returned by ILAENV.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the block sizes must be positive integers; = 2: the sum of block sizes must be equal to N; = 3: the size of a real block must be equal to 1; = 4: the block type must be either 1 or 2; = 5: errors in solving linear equations or in matrix inversion; = 6: errors in computing eigenvalues or singular values.Method
The routine computes the upper bound proposed in [1].References
[1] Fan, M.K.H., Tits, A.L., and Doyle, J.C. Robustness in the presence of mixed parametric uncertainty and unmodeled dynamics. IEEE Trans. Automatic Control, vol. AC-36, 1991, pp. 25-38.Numerical Aspects
The accuracy and speed of computation depend on the value of the internal threshold TOL.Further Comments
NoneExample
Program Text
* AB13MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 10, MMAX = 10 ) INTEGER LDZ PARAMETER ( LDZ = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 4*MMAX-2, NMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 2*NMAX*NMAX*MMAX - NMAX*NMAX + $ 9*MMAX*MMAX + NMAX*MMAX + 11*NMAX + $ 33*MMAX - 11 ) INTEGER LZWORK PARAMETER ( LZWORK = 6*NMAX*NMAX*MMAX + 12*NMAX*NMAX + $ 6*MMAX + 6*NMAX - 3 ) * .. Local Scalars .. INTEGER I, INFO, J, M, N DOUBLE PRECISION BOUND * .. Local Arrays .. INTEGER ITYPE(MMAX), IWORK(LIWORK), NBLOCK(MMAX) DOUBLE PRECISION D(NMAX), DWORK(LDWORK), G(NMAX), X(2*MMAX-1) COMPLEX*16 Z(LDZ,NMAX), ZWORK(LZWORK) * .. External Subroutines .. EXTERNAL AB13MD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( NBLOCK(I), I = 1, M ) READ ( NIN, FMT = * ) ( ITYPE(I), I = 1, M ) READ ( NIN, FMT = * ) ( ( Z(I,J), J = 1,N ), I = 1,N ) * Computing mu. CALL AB13MD( 'N', N, Z, LDZ, M, NBLOCK, ITYPE, X, BOUND, D, G, $ IWORK, DWORK, LDWORK, ZWORK, LZWORK, INFO ) * IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) WRITE ( NOUT, FMT = 99991 ) BOUND ELSE WRITE( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' AB13MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB13MD =',I2) 99997 FORMAT (' The value of the structured singular value is'/) 99991 FORMAT (D17.10) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
AB13MD EXAMPLE PROGRAM DATA 6 5 1 1 2 1 1 1 1 2 2 2 (-1.0D0,6.0D0) (2.0D0,-3.0D0) (3.0D0,8.0D0) (3.0D0,8.0D0) (-5.0D0,-9.0D0) (-6.0D0,2.0D0) (4.0D0,2.0D0) (-2.0D0,5.0D0) (-6.0D0,-7.0D0) (-4.0D0,11.0D0) (8.0D0,-7.0D0) (12.0D0,-1.0D0) (5.0D0,-4.0D0) (-4.0D0,-8.0D0) (1.0D0,-3.0D0) (-6.0D0,14.0D0) (2.0D0,-5.0D0) (4.0D0,16.0D0) (-1.0D0,6.0D0) (2.0D0,-3.0D0) (3.0D0,8.0D0) (3.0D0,8.0D0) (-5.0D0,-9.0D0) (-6.0D0,2.0D0) (4.0D0,2.0D0) (-2.0D0,5.0D0) (-6.0D0,-7.0D0) (-4.0D0,11.0D0) (8.0D0,-7.0D0) (12.0D0,-1.0D0) (5.0D0,-4.0D0) (-4.0D0,-8.0D0) (1.0D0,-3.0D0) (-6.0D0,14.0D0) (2.0D0,-5.0D0) (4.0D0,16.0D0)Program Results
AB13MD EXAMPLE PROGRAM RESULTS The value of the structured singular value is 0.4174753408D+02
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AB8NXZ.html 0000664 0000000 0000000 00000015226 14560147231 0020432 0 ustar 00root root 0000000 0000000
Purpose
To extract from the (N+P)-by-(M+N) system ( B A ) ( D C ) an (NU+MU)-by-(M+NU) "reduced" system ( B' A') ( D' C') having the same transmission zeros but with D' of full row rank.Specification
SUBROUTINE AB8NXZ( N, M, P, RO, SIGMA, SVLMAX, ABCD, LDABCD, $ NINFZ, INFZ, KRONL, MU, NU, NKROL, TOL, IWORK, $ DWORK, ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDABCD, LZWORK, M, MU, N, NINFZ, NKROL, $ NU, P, RO, SIGMA DOUBLE PRECISION SVLMAX, TOL C .. Array Arguments .. INTEGER INFZ(*), IWORK(*), KRONL(*) COMPLEX*16 ABCD(LDABCD,*), ZWORK(*) DOUBLE PRECISION DWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The number of state variables. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. RO (input/output) INTEGER On entry, = P for the original system; = MAX(P-M, 0) for the pertransposed system. On exit, RO contains the last computed rank. SIGMA (input/output) INTEGER On entry, = 0 for the original system; = M for the pertransposed system. On exit, SIGMA contains the last computed value sigma in the algorithm. SVLMAX (input) DOUBLE PRECISION During each reduction step, the rank-revealing QR factorization of a matrix stops when the estimated minimum singular value is smaller than TOL * MAX(SVLMAX,EMSV), where EMSV is the estimated maximum singular value. SVLMAX >= 0. ABCD (input/output) COMPLEX*16 array, dimension (LDABCD,M+N) On entry, the leading (N+P)-by-(M+N) part of this array must contain the compound input matrix of the system. On exit, the leading (NU+MU)-by-(M+NU) part of this array contains the reduced compound input matrix of the system. LDABCD INTEGER The leading dimension of array ABCD. LDABCD >= MAX(1,N+P). NINFZ (input/output) INTEGER On entry, the currently computed number of infinite zeros. It should be initialized to zero on the first call. NINFZ >= 0. On exit, the number of infinite zeros. INFZ (input/output) INTEGER array, dimension (N) On entry, INFZ(i) must contain the current number of infinite zeros of degree i, where i = 1,2,...,N, found in the previous call(s) of the routine. It should be initialized to zero on the first call. On exit, INFZ(i) contains the number of infinite zeros of degree i, where i = 1,2,...,N. KRONL (input/output) INTEGER array, dimension (N+1) On entry, this array must contain the currently computed left Kronecker (row) indices found in the previous call(s) of the routine. It should be initialized to zero on the first call. On exit, the leading NKROL elements of this array contain the left Kronecker (row) indices. MU (output) INTEGER The normal rank of the transfer function matrix of the original system. NU (output) INTEGER The dimension of the reduced system matrix and the number of (finite) invariant zeros if D' is invertible. NKROL (output) INTEGER The number of left Kronecker indices.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. NOTE that when SVLMAX > 0, the estimated ranks could be less than those defined above (see SVLMAX).Workspace
IWORK INTEGER array, dimension (MAX(M,P)) DWORK DOUBLE PRECISION array, dimension (2*MAX(M,P)) ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. LZWORK INTEGER The length of the array ZWORK. LZWORK >= MAX( 1, MIN(P,M) + MAX(3*M-1,N), MIN(P,N) + MAX(3*P-1,N+P,N+M) ). For optimum performance LZWORK should be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Svaricek, F. Computation of the Structural Invariants of Linear Multivariable Systems with an Extended Version of the Program ZEROS. System & Control Letters, 6, pp. 261-266, 1985. [2] Emami-Naeini, A. and Van Dooren, P. Computation of Zeros of Linear Multivariable Systems. Automatica, 18, pp. 415-430, 1982.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the inverse (Ai-lambda*Ei,Bi,Ci,Di) of a given descriptor system (A-lambda*E,B,C,D).Specification
SUBROUTINE AG07BD( JOBE, N, M, A, LDA, E, LDE, B, LDB, C, LDC, $ D, LDD, AI, LDAI, EI, LDEI, BI, LDBI, CI, LDCI, $ DI, LDDI, INFO ) C .. Scalar Arguments .. CHARACTER JOBE INTEGER INFO, LDA, LDAI, LDB, LDBI, LDC, LDCI, $ LDD, LDDI, LDE, LDEI, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), AI(LDAI,*), B(LDB,*), BI(LDBI,*), $ C(LDC,*), CI(LDCI,*), D(LDD,*), DI(LDDI,*), $ E(LDE,*), EI(LDEI,*)Arguments
Mode Parameters
JOBE CHARACTER*1 Specifies whether E is a general square or an identity matrix as follows: = 'G': E is a general square matrix; = 'I': E is the identity matrix.Input/Output Parameters
N (input) INTEGER The order of the square matrices A and E; also the number of rows of matrix B and the number of columns of matrix C. N >= 0. M (input) INTEGER The number of system inputs and outputs, i.e., the number of columns of matrices B and D and the number of rows of matrices C and D. M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the original system. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) If JOBE = 'G', the leading N-by-N part of this array must contain the descriptor matrix E of the original system. If JOBE = 'I', then E is assumed to be the identity matrix and is not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'G'; LDE >= 1, if JOBE = 'I'. B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input matrix B of the original system. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading M-by-N part of this array must contain the output matrix C of the original system. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading M-by-M part of this array must contain the feedthrough matrix D of the original system. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,M). AI (output) DOUBLE PRECISION array, dimension (LDAI,N+M) The leading (N+M)-by-(N+M) part of this array contains the state matrix Ai of the inverse system. If LDAI = LDA >= N+M, then AI and A can share the same storage locations. LDAI INTEGER The leading dimension of the array AI. LDAI >= MAX(1,N+M). EI (output) DOUBLE PRECISION array, dimension (LDEI,N+M) The leading (N+M)-by-(N+M) part of this array contains the descriptor matrix Ei of the inverse system. If LDEI = LDE >= N+M, then EI and E can share the same storage locations. LDEI INTEGER The leading dimension of the array EI. LDEI >= MAX(1,N+M). BI (output) DOUBLE PRECISION array, dimension (LDBI,M) The leading (N+M)-by-M part of this array contains the input matrix Bi of the inverse system. If LDBI = LDB >= N+M, then BI and B can share the same storage locations. LDBI INTEGER The leading dimension of the array BI. LDBI >= MAX(1,N+M). CI (output) DOUBLE PRECISION array, dimension (LDCI,N+M) The leading M-by-(N+M) part of this array contains the output matrix Ci of the inverse system. If LDCI = LDC, CI and C can share the same storage locations. LDCI INTEGER The leading dimension of the array CI. LDCI >= MAX(1,M). DI (output) DOUBLE PRECISION array, dimension (LDDI,M) The leading M-by-M part of this array contains the feedthrough matrix Di = 0 of the inverse system. DI and D can share the same storage locations. LDDI INTEGER The leading dimension of the array DI. LDDI >= MAX(1,M).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrices of the inverse system are computed with the formulas ( E 0 ) ( A B ) ( 0 ) Ei = ( ) , Ai = ( ) , Bi = ( ), ( 0 0 ) ( C D ) ( -I ) Ci = ( 0 I ), Di = 0.Further Comments
The routine does not perform an invertibility test. This check can be performed by using the SLICOT routines AB08NX or AG08BY.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AG08BD.html 0000664 0000000 0000000 00000072465 14560147231 0020335 0 ustar 00root root 0000000 0000000
Purpose
To extract from the system pencil ( A-lambda*E B ) S(lambda) = ( ) ( C D ) a regular pencil Af-lambda*Ef which has the finite Smith zeros of S(lambda) as generalized eigenvalues. The routine also computes the orders of the infinite Smith zeros and determines the singular and infinite Kronecker structure of system pencil, i.e., the right and left Kronecker indices, and the multiplicities of infinite eigenvalues.Specification
SUBROUTINE AG08BD( EQUIL, L, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, NKROR, $ NINFE, NKROL, INFZ, KRONR, INFE, KRONL, $ TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL INTEGER DINFZ, INFO, L, LDA, LDB, LDC, LDD, LDE, LDWORK, $ M, N, NFZ, NINFE, NIZ, NKROL, NKROR, NRANK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INFE(*), INFZ(*), IWORK(*), KRONL(*), KRONR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), E(LDE,*)Arguments
Mode Parameters
EQUIL CHARACTER*1 Specifies whether the user wishes to balance the system matrix as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
L (input) INTEGER The number of rows of matrices A, B, and E. L >= 0. N (input) INTEGER The number of columns of matrices A, E, and C. N >= 0. M (input) INTEGER The number of columns of matrix B. M >= 0. P (input) INTEGER The number of rows of matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A of the system. On exit, the leading NFZ-by-NFZ part of this array contains the matrix Af of the reduced pencil. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E of the system. On exit, the leading NFZ-by-NFZ part of this array contains the matrix Ef of the reduced pencil. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the input/state matrix B of the system. On exit, this matrix does not contain useful information. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L) if M > 0; LDB >= 1 if M = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C of the system. On exit, this matrix does not contain useful information. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct transmission matrix D of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NFZ (output) INTEGER The number of finite zeros. NRANK (output) INTEGER The normal rank of the system pencil. NIZ (output) INTEGER The number of infinite zeros. DINFZ (output) INTEGER The maximal multiplicity of infinite Smith zeros. NKROR (output) INTEGER The number of right Kronecker indices. NINFE (output) INTEGER The number of elementary infinite blocks. NKROL (output) INTEGER The number of left Kronecker indices. INFZ (output) INTEGER array, dimension (N+1) The leading DINFZ elements of INFZ contain information on the infinite elementary divisors as follows: the system has INFZ(i) infinite elementary divisors of degree i in the Smith form, where i = 1,2,...,DINFZ. KRONR (output) INTEGER array, dimension (N+M+1) The leading NKROR elements of this array contain the right Kronecker (column) indices. INFE (output) INTEGER array, dimension (1+MIN(L+P,N+M)) The leading NINFE elements of INFE contain the multiplicities of infinite eigenvalues. KRONL (output) INTEGER array, dimension (L+P+1) The leading NKROL elements of this array contain the left Kronecker (row) indices.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then default tolerances are used instead, as follows: TOLDEF = L*N*EPS in TG01FD (to determine the rank of E) and TOLDEF = (L+P)*(N+M)*EPS in the rest, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N+max(1,M)) On output, IWORK(1) contains the normal rank of the transfer function matrix. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= max( 4*(L+N), LDW ), if EQUIL = 'S', LDWORK >= LDW, if EQUIL = 'N', where LDW = max(L+P,M+N)*(M+N) + max(1,5*max(L+P,M+N)). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine extracts from the system matrix of a descriptor system (A-lambda*E,B,C,D) a regular pencil Af-lambda*Ef which has the finite zeros of the system as generalized eigenvalues. The procedure has the following main computational steps: (a) construct the (L+P)-by-(N+M) system pencil S(lambda) = ( B A )-lambda*( 0 E ); ( D C ) ( 0 0 ) (b) reduce S(lambda) to S1(lambda) with the same finite zeros and right Kronecker structure but with E upper triangular and nonsingular; (c) reduce S1(lambda) to S2(lambda) with the same finite zeros and right Kronecker structure but with D of full row rank; (d) reduce S2(lambda) to S3(lambda) with the same finite zeros and with D square invertible; (e) perform a unitary transformation on the columns of S3(lambda) = (A-lambda*E B) in order to reduce it to ( C D) (Af-lambda*Ef X), with Y and Ef square invertible; ( 0 Y) (f) compute the right and left Kronecker indices of the system matrix, which together with the multiplicities of the finite and infinite eigenvalues constitute the complete set of structural invariants under strict equivalence transformations of a linear system.References
[1] P. Misra, P. Van Dooren and A. Varga. Computation of structural invariants of generalized state-space systems. Automatica, 30, pp. 1921-1936, 1994.Numerical Aspects
The algorithm is backward stable (see [1]).Further Comments
In order to compute the finite Smith zeros of the system explicitly, a call to this routine may be followed by a call to the LAPACK Library routines DGEGV or DGGEV.Example
Program Text
* AG08BD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, MMAX, NMAX, PMAX PARAMETER ( LMAX = 20, MMAX = 20, NMAX = 20, PMAX = 20 ) INTEGER LDA, LDAEMX, LDB, LDC, LDD, LDE, LDQ, LDZ PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = PMAX, $ LDD = PMAX, LDE = LMAX, LDQ = 1, LDZ = 1, $ LDAEMX = MAX( PMAX + LMAX, NMAX + MMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 4*( LMAX + NMAX ), 8*NMAX, $ LDAEMX*LDAEMX + $ MAX( 1, 5*LDAEMX ) ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER DINFZ, I, INFO, J, L, M, N, NFZ, NINFE, NIZ, $ NKROL, NKROR, NRANK, P CHARACTER*1 EQUIL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALFI(NMAX), ALFR(NMAX), $ ASAVE(LDA,NMAX), B(LDB,MMAX), BETA(NMAX), $ BSAVE(LDB,MMAX), C(LDC,NMAX), CSAVE(LDC,NMAX), $ D(LDD,MMAX), DSAVE(LDD,MMAX), DWORK(LDWORK), $ E(LDE,NMAX), ESAVE(LDE,NMAX), Q(LDQ,1), Z(LDZ,1) INTEGER INFE(1+LMAX+PMAX), INFZ(NMAX+1), $ IWORK(NMAX+MMAX), KRONL(LMAX+PMAX+1), $ KRONR(NMAX+MMAX+1) * .. External Subroutines .. EXTERNAL AG08BD, DGEGV, DLACPY * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, M, P, TOL, EQUIL IF( ( L.LT.0 .OR. L.GT.LMAX ) .OR. ( N.LT.0 .OR. N.GT.NMAX ) ) $ THEN WRITE ( NOUT, FMT = 99972 ) L, N ELSE IF( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99971 ) M ELSE IF( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99970 ) P ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,L ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) CALL DLACPY( 'F', L, N, A, LDA, ASAVE, LDA ) CALL DLACPY( 'F', L, N, E, LDE, ESAVE, LDE ) CALL DLACPY( 'F', L, M, B, LDB, BSAVE, LDB ) CALL DLACPY( 'F', P, N, C, LDC, CSAVE, LDC ) CALL DLACPY( 'F', P, M, D, LDD, DSAVE, LDD ) * Compute poles (call the routine with M = 0, P = 0). CALL AG08BD( EQUIL, L, N, 0, 0, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, $ NKROR, NINFE, NKROL, INFZ, KRONR, INFE, $ KRONL, TOL, IWORK, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99968 ) NIZ DO 10 I = 1, DINFZ WRITE ( NOUT, FMT = 99967 ) INFZ(I), I 10 CONTINUE WRITE ( NOUT, FMT = 99962 ) NINFE IF( NINFE.GT.0 ) WRITE ( NOUT, FMT = 99958 ) $ ( INFE(I), I = 1,NINFE ) IF( NFZ.EQ.0 ) THEN WRITE ( NOUT, FMT = 99965 ) ELSE WRITE ( NOUT, FMT = 99966 ) WRITE ( NOUT, FMT = 99990 ) DO 20 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( E(I,J), J = 1,NFZ ) 30 CONTINUE CALL DGEGV( 'No vectors', 'No vectors', NFZ, A, $ LDA, E, LDE, ALFR, ALFI, BETA, Q, $ LDQ, Z, LDZ, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) DO 40 I = 1, NFZ IF( ALFI(I).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99980 ) $ ALFR(I)/BETA(I) ELSE WRITE ( NOUT, FMT = 99979 ) $ ALFR(I)/BETA(I), $ ALFI(I)/BETA(I) END IF 40 CONTINUE END IF END IF END IF CALL DLACPY( 'F', L, N, ASAVE, LDA, A, LDA ) CALL DLACPY( 'F', L, N, ESAVE, LDE, E, LDE ) * Check the observability and compute the ordered set of * the observability indices (call the routine with M = 0). CALL AG08BD( EQUIL, L, N, 0, P, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, $ NKROR, NINFE, NKROL, INFZ, KRONR, INFE, $ KRONL, TOL, IWORK, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99964 ) NIZ DO 50 I = 1, DINFZ WRITE ( NOUT, FMT = 99967 ) INFZ(I), I 50 CONTINUE WRITE ( NOUT, FMT = 99962 ) NINFE IF( NINFE.GT.0 ) WRITE ( NOUT, FMT = 99960 ) $ ( INFE(I), I = 1,NINFE ) WRITE ( NOUT, FMT = 99994 ) ( KRONL(I), I = 1,NKROL ) IF( NFZ+NINFE.EQ.0 ) WRITE ( NOUT, FMT = 99993 ) IF( NFZ.EQ.0 ) THEN WRITE ( NOUT, FMT = 99957 ) ELSE WRITE ( NOUT, FMT = 99991 ) WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 60 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 70 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( E(I,J), J = 1,NFZ ) 70 CONTINUE CALL DGEGV( 'No vectors', 'No vectors', NFZ, A, $ LDA, E, LDE, ALFR, ALFI, BETA, Q, $ LDQ, Z, LDZ, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) DO 80 I = 1, NFZ IF( ALFI(I).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99980 ) $ ALFR(I)/BETA(I) ELSE WRITE ( NOUT, FMT = 99979 ) $ ALFR(I)/BETA(I), $ ALFI(I)/BETA(I) END IF 80 CONTINUE END IF END IF END IF CALL DLACPY( 'F', L, N, ASAVE, LDA, A, LDA ) CALL DLACPY( 'F', L, N, ESAVE, LDE, E, LDE ) CALL DLACPY( 'F', P, N, CSAVE, LDC, C, LDC ) * Check the controllability and compute the ordered set of * the controllability indices (call the routine with P = 0) CALL AG08BD( EQUIL, L, N, M, 0, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, $ NKROR, NINFE, NKROL, INFZ, KRONR, INFE, $ KRONL, TOL, IWORK, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99963 ) NIZ DO 90 I = 1, DINFZ WRITE ( NOUT, FMT = 99967 ) INFZ(I), I 90 CONTINUE WRITE ( NOUT, FMT = 99962 ) NINFE IF( NINFE.GT.0 ) WRITE ( NOUT, FMT = 99959 ) $ ( INFE(I), I = 1,NINFE ) WRITE ( NOUT, FMT = 99988 ) ( KRONR(I), I = 1,NKROR ) IF( NFZ+NINFE.EQ.0 ) WRITE ( NOUT, FMT = 99987 ) IF( NFZ.EQ.0 ) THEN WRITE ( NOUT, FMT = 99956 ) ELSE WRITE ( NOUT, FMT = 99985 ) WRITE ( NOUT, FMT = 99990 ) DO 100 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 100 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 110 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( E(I,J), J = 1,NFZ ) 110 CONTINUE CALL DGEGV( 'No vectors', 'No vectors', NFZ, A, $ LDA, E, LDE, ALFR, ALFI, BETA, Q, $ LDQ, Z, LDZ, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99982 ) DO 120 I = 1, NFZ IF( ALFI(I).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99980 ) $ ALFR(I)/BETA(I) ELSE WRITE ( NOUT, FMT = 99979 ) $ ALFR(I)/BETA(I), $ ALFI(I)/BETA(I) END IF 120 CONTINUE END IF END IF END IF CALL DLACPY( 'F', L, N, ASAVE, LDA, A, LDA ) CALL DLACPY( 'F', L, N, ESAVE, LDE, E, LDE ) CALL DLACPY( 'F', L, M, BSAVE, LDB, B, LDB ) CALL DLACPY( 'F', P, N, CSAVE, LDC, C, LDC ) CALL DLACPY( 'F', P, M, DSAVE, LDD, D, LDD ) * Compute the structural invariants of the given system. CALL AG08BD( EQUIL, L, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, $ NKROR, NINFE, NKROL, INFZ, KRONR, INFE, $ KRONL, TOL, IWORK, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( L.EQ.N ) THEN WRITE ( NOUT, FMT = 99969 ) NRANK - N ELSE WRITE ( NOUT, FMT = 99955 ) NRANK END IF WRITE ( NOUT, FMT = 99984 ) NFZ IF( NFZ.GT.0 ) THEN * Compute the finite zeros of the given system. * Workspace: need 8*NFZ. WRITE ( NOUT, FMT = 99983 ) WRITE ( NOUT, FMT = 99990 ) DO 130 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 130 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 140 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( E(I,J), J = 1,NFZ ) 140 CONTINUE CALL DGEGV( 'No vectors', 'No vectors', NFZ, A, $ LDA, E, LDE, ALFR, ALFI, BETA, Q, $ LDQ, Z, LDZ, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99981 ) DO 150 I = 1, NFZ IF( ALFI(I).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99980 ) $ ALFR(I)/BETA(I) ELSE WRITE ( NOUT, FMT = 99979 ) $ ALFR(I)/BETA(I), $ ALFI(I)/BETA(I) END IF 150 CONTINUE END IF END IF WRITE ( NOUT, FMT = 99978 ) NIZ DO 160 I = 1, DINFZ WRITE ( NOUT, FMT = 99977 ) INFZ(I), I 160 CONTINUE WRITE ( NOUT, FMT = 99962 ) NINFE IF( NINFE.GT.0 ) WRITE ( NOUT, FMT = 99961 ) $ ( INFE(I), I = 1,NINFE ) WRITE ( NOUT, FMT = 99976 ) NKROR IF( NKROR.GT.0 ) WRITE ( NOUT, FMT = 99975 ) $ ( KRONR(I), I = 1,NKROR ) WRITE ( NOUT, FMT = 99974 ) NKROL IF( NKROL.GT.0 ) WRITE ( NOUT, FMT = 99973 ) $ ( KRONL(I), I = 1,NKROL ) END IF END IF END IF END IF * STOP * 99999 FORMAT (' AG08BD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AG08BD = ',I2) 99997 FORMAT (' INFO on exit from DGEGV = ',I2) 99996 FORMAT (/'Unobservable finite eigenvalues'/ $ ' real part imag part ') 99995 FORMAT (/' The matrix Ef is ') 99994 FORMAT (/' The left Kronecker indices of [A-lambda*E;C] are ', $ /(20(I3,2X))) 99993 FORMAT (/' The system (A-lambda*E,C) is completely observable ') 99991 FORMAT (/' The finite output decoupling zeros are the eigenvalues' $ ,' of the pair (Af,Ef). ') 99990 FORMAT (/' The matrix Af is ') 99989 FORMAT (20(1X,F8.4)) 99988 FORMAT (/' The right Kronecker indices of [A-lambda*E,B] are ', $ /( 20(I3,2X) ) ) 99987 FORMAT (/' The system (A-lambda*E,B) is completely controllable ') 99985 FORMAT (/' The input decoupling zeros are the eigenvalues of the', $ ' pair (Af,Ef). ') 99984 FORMAT (/' The number of finite zeros = ',I3) 99983 FORMAT (/' The finite zeros are the eigenvalues ', $ 'of the pair (Af,Ef)') 99982 FORMAT (/'Uncontrollable finite eigenvalues'/ $ ' real part imag part ') 99981 FORMAT (/'Finite zeros'/' real part imag part ') 99980 FORMAT (1X,F9.4) 99979 FORMAT (1X,F9.4,6X,F9.4) 99978 FORMAT (//' The number of infinite zeros = ',I3) 99977 FORMAT ( I4,' infinite zero(s) of order ',I3) 99976 FORMAT (/' The number of right Kronecker indices = ',I3) 99975 FORMAT (/' Right Kronecker indices of [A-lambda*E,B;C,D]' $ ,' are ', /(20(I3,2X))) 99974 FORMAT (/' The number of left Kronecker indices = ',I3) 99973 FORMAT (/' The left Kronecker indices of [A-lambda*E,B;C,D]' $ ,' are ', /(20(I3,2X))) 99972 FORMAT (/' L or N is out of range.',/' L = ', I5, ' N = ',I5) 99971 FORMAT (/' M is out of range.',/' M = ',I5) 99970 FORMAT (/' P is out of range.',/' P = ',I5) 99969 FORMAT (/' Normal rank of transfer function matrix = ',I3) 99968 FORMAT (//' The number of infinite poles = ',I3) 99967 FORMAT ( I4,' infinite pole(s) of order ',I3) 99966 FORMAT (/' The finite poles are the eigenvalues', $ ' of the pair (Af,Ef). ') 99965 FORMAT (/' The system has no finite poles ') 99964 FORMAT (//' The number of unobservable infinite poles = ',I3) 99963 FORMAT (//' The number of uncontrollable infinite poles = ',I3) 99962 FORMAT (/' The number of infinite Kronecker blocks = ',I3) 99961 FORMAT (/' Multiplicities of infinite eigenvalues of ' $ ,'[A-lambda*E,B;C,D] are ', /(20(I3,2X))) 99960 FORMAT (/' Multiplicities of infinite eigenvalues of ' $ ,'[A-lambda*E;C] are ', /(20(I3,2X))) 99959 FORMAT (/' Multiplicities of infinite eigenvalues of ' $ ,'[A-lambda*E,B] are ', /(20(I3,2X))) 99958 FORMAT (/' Multiplicities of infinite eigenvalues of A-lambda*E' $ ,' are ', /(20(I3,2X))) 99957 FORMAT (/' The system (A-lambda*E,C) has no finite output', $ ' decoupling zeros ') 99956 FORMAT (/' The system (A-lambda*E,B) has no finite input', $ ' decoupling zeros ') 99955 FORMAT (/' Normal rank of system pencil = ',I3) ENDProgram Data
AG08BD EXAMPLE PROGRAM DATA 9 9 3 3 1.e-7 N 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 1 1 0 3 4 0 0 2 0 1 0 0 4 0 0 2 0 0 0 1 0 -1 4 0 -2 2 1 2 -2 0 -1 -2 0 0 0Program Results
AG08BD EXAMPLE PROGRAM RESULTS The number of infinite poles = 6 0 infinite pole(s) of order 1 3 infinite pole(s) of order 2 The number of infinite Kronecker blocks = 3 Multiplicities of infinite eigenvalues of A-lambda*E are 3 3 3 The system has no finite poles The number of unobservable infinite poles = 4 0 infinite pole(s) of order 1 2 infinite pole(s) of order 2 The number of infinite Kronecker blocks = 3 Multiplicities of infinite eigenvalues of [A-lambda*E;C] are 1 3 3 The left Kronecker indices of [A-lambda*E;C] are 0 1 1 The system (A-lambda*E,C) has no finite output decoupling zeros The number of uncontrollable infinite poles = 0 The number of infinite Kronecker blocks = 3 Multiplicities of infinite eigenvalues of [A-lambda*E,B] are 1 1 1 The right Kronecker indices of [A-lambda*E,B] are 2 2 2 The system (A-lambda*E,B) has no finite input decoupling zeros Normal rank of transfer function matrix = 2 The number of finite zeros = 1 The finite zeros are the eigenvalues of the pair (Af,Ef) The matrix Af is 0.7705 The matrix Ef is 0.7705 Finite zeros real part imag part 1.0000 The number of infinite zeros = 2 0 infinite zero(s) of order 1 1 infinite zero(s) of order 2 The number of infinite Kronecker blocks = 5 Multiplicities of infinite eigenvalues of [A-lambda*E,B;C,D] are 1 1 1 1 3 The number of right Kronecker indices = 1 Right Kronecker indices of [A-lambda*E,B;C,D] are 2 The number of left Kronecker indices = 1 The left Kronecker indices of [A-lambda*E,B;C,D] are 1
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AG08BY.html 0000664 0000000 0000000 00000021644 14560147231 0020353 0 ustar 00root root 0000000 0000000
Purpose
To extract from the (N+P)-by-(M+N) descriptor system pencil S(lambda) = ( B A - lambda*E ) ( D C ) with E nonsingular and upper triangular a (NR+PR)-by-(M+NR) "reduced" descriptor system pencil ( Br Ar-lambda*Er ) Sr(lambda) = ( ) ( Dr Cr ) having the same finite Smith zeros as the pencil S(lambda) but with Dr, a PR-by-M full row rank left upper trapezoidal matrix, and Er, an NR-by-NR upper triangular nonsingular matrix.Specification
SUBROUTINE AG08BY( FIRST, N, M, P, SVLMAX, ABCD, LDABCD, E, LDE, $ NR, PR, NINFZ, DINFZ, NKRONL, INFZ, KRONL, $ TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER DINFZ, INFO, LDABCD, LDE, LDWORK, M, N, NINFZ, $ NKRONL, NR, P, PR DOUBLE PRECISION SVLMAX, TOL LOGICAL FIRST C .. Array Arguments .. INTEGER INFZ( * ), IWORK(*), KRONL( * ) DOUBLE PRECISION ABCD( LDABCD, * ), DWORK( * ), E( LDE, * )Arguments
Mode Parameters
FIRST LOGICAL Specifies if AG08BY is called first time or it is called for an already reduced system, with D full column rank with the last M rows in upper triangular form: FIRST = .TRUE., first time called; FIRST = .FALSE., not first time called.Input/Output Parameters
N (input) INTEGER The number of rows of matrix B, the number of columns of matrix C and the order of square matrices A and E. N >= 0. M (input) INTEGER The number of columns of matrices B and D. M >= 0. M <= P if FIRST = .FALSE. . P (input) INTEGER The number of rows of matrices C and D. P >= 0. SVLMAX (input) DOUBLE PRECISION During each reduction step, the rank-revealing QR factorization of a matrix stops when the estimated minimum singular value is smaller than TOL * MAX(SVLMAX,EMSV), where EMSV is the estimated maximum singular value. SVLMAX >= 0. ABCD (input/output) DOUBLE PRECISION array, dimension (LDABCD,M+N) On entry, the leading (N+P)-by-(M+N) part of this array must contain the compound matrix ( B A ) , ( D C ) where A is an N-by-N matrix, B is an N-by-M matrix, C is a P-by-N matrix and D is a P-by-M matrix. If FIRST = .FALSE., then D must be a full column rank matrix with the last M rows in upper triangular form. On exit, the leading (NR+PR)-by-(M+NR) part of ABCD contains the reduced compound matrix ( Br Ar ) , ( Dr Cr ) where Ar is an NR-by-NR matrix, Br is an NR-by-M matrix, Cr is a PR-by-NR matrix, Dr is a PR-by-M full row rank left upper trapezoidal matrix with the first PR columns in upper triangular form. LDABCD INTEGER The leading dimension of array ABCD. LDABCD >= MAX(1,N+P). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the upper triangular nonsingular matrix E. On exit, the leading NR-by-NR part contains the reduced upper triangular nonsingular matrix Er. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). NR (output) INTEGER The order of the reduced matrices Ar and Er; also the number of rows of the reduced matrix Br and the number of columns of the reduced matrix Cr. If Dr is invertible, NR is also the number of finite Smith zeros. PR (output) INTEGER The rank of the resulting matrix Dr; also the number of rows of reduced matrices Cr and Dr. NINFZ (output) INTEGER Number of infinite zeros. NINFZ = 0 if FIRST = .FALSE. . DINFZ (output) INTEGER The maximal multiplicity of infinite zeros. DINFZ = 0 if FIRST = .FALSE. . NKRONL (output) INTEGER The maximal dimension of left elementary Kronecker blocks. INFZ (output) INTEGER array, dimension (N) INFZ(i) contains the number of infinite zeros of degree i, where i = 1,2,...,DINFZ. INFZ is not referenced if FIRST = .FALSE. . KRONL (output) INTEGER array, dimension (N+1) KRONL(i) contains the number of left elementary Kronecker blocks of dimension i-by-(i-1), where i = 1,2,...,NKRONL.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then an implicitly computed, default tolerance TOLDEF = (N+P)*(N+M)*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). NOTE that when SVLMAX > 0, the estimated ranks could be less than those defined above (see SVLMAX). TOL <= 1.Workspace
IWORK INTEGER array, dimension (M) If FIRST = .FALSE., IWORK is not referenced. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if P = 0; otherwise LDWORK >= MAX( 1, N+M-1, MIN(P,M) + MAX(3*M-1,N), 5*P ), if FIRST = .TRUE.; LDWORK >= MAX( 1, N+M-1, 5*P ), if FIRST = .FALSE. . The second term is not needed if M = 0. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The subroutine is based on the reduction algorithm of [1].References
[1] P. Misra, P. Van Dooren and A. Varga. Computation of structural invariants of generalized state-space systems. Automatica, 30, pp. 1921-1936, 1994.Numerical Aspects
The algorithm is numerically backward stable and requires 0( (P+N)*(M+N)*N ) floating point operations.Further Comments
The number of infinite zeros is computed as DINFZ NINFZ = Sum (INFZ(i)*i) . i=1 Note that each infinite zero of multiplicity k corresponds to an infinite eigenvalue of multiplicity k+1. The multiplicities of the infinite eigenvalues can be determined from PR, DINFZ and INFZ(i), i = 1, ..., DINFZ, as follows: DINFZ - there are PR - Sum (INFZ(i)) simple infinite eigenvalues; i=1 - there are INFZ(i) infinite eigenvalues with multiplicity i+1, for i = 1, ..., DINFZ. The left Kronecker indices are: [ 0 0 ... 0 | 1 1 ... 1 | .... | NKRONL ... NKRONL ] |<- KRONL(1) ->|<- KRONL(2) ->| |<- KRONL(NKRONL) ->|Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To extract from the system pencil ( A-lambda*E B ) S(lambda) = ( ) ( C D ) a regular pencil Af-lambda*Ef which has the finite Smith zeros of S(lambda) as generalized eigenvalues. The routine also computes the orders of the infinite Smith zeros and determines the singular and infinite Kronecker structure of system pencil, i.e., the right and left Kronecker indices, and the multiplicities of infinite eigenvalues.Specification
SUBROUTINE AG08BZ( EQUIL, L, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, NKROR, $ NINFE, NKROL, INFZ, KRONR, INFE, KRONL, $ TOL, IWORK, DWORK, ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL INTEGER DINFZ, INFO, L, LDA, LDB, LDC, LDD, LDE, LZWORK, $ M, N, NFZ, NINFE, NIZ, NKROL, NKROR, NRANK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INFE(*), INFZ(*), IWORK(*), KRONL(*), KRONR(*) DOUBLE PRECISION DWORK(*) COMPLEX*16 A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ E(LDE,*), ZWORK(*)Arguments
Mode Parameters
EQUIL CHARACTER*1 Specifies whether the user wishes to balance the system matrix as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
L (input) INTEGER The number of rows of matrices A, B, and E. L >= 0. N (input) INTEGER The number of columns of matrices A, E, and C. N >= 0. M (input) INTEGER The number of columns of matrix B. M >= 0. P (input) INTEGER The number of rows of matrix C. P >= 0. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A of the system. On exit, the leading NFZ-by-NFZ part of this array contains the matrix Af of the reduced pencil. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) COMPLEX*16 array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E of the system. On exit, the leading NFZ-by-NFZ part of this array contains the matrix Ef of the reduced pencil. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). B (input/output) COMPLEX*16 array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the input/state matrix B of the system. On exit, this matrix does not contain useful information. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L) if M > 0; LDB >= 1 if M = 0. C (input/output) COMPLEX*16 array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C of the system. On exit, this matrix does not contain useful information. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) COMPLEX*16 array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct transmission matrix D of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NFZ (output) INTEGER The number of finite zeros. NRANK (output) INTEGER The normal rank of the system pencil. NIZ (output) INTEGER The number of infinite zeros. DINFZ (output) INTEGER The maximal multiplicity of infinite Smith zeros. NKROR (output) INTEGER The number of right Kronecker indices. NINFE (output) INTEGER The number of elementary infinite blocks. NKROL (output) INTEGER The number of left Kronecker indices. INFZ (output) INTEGER array, dimension (N+1) The leading DINFZ elements of INFZ contain information on the infinite elementary divisors as follows: the system has INFZ(i) infinite elementary divisors of degree i in the Smith form, where i = 1,2,...,DINFZ. KRONR (output) INTEGER array, dimension (N+M+1) The leading NKROR elements of this array contain the right Kronecker (column) indices. INFE (output) INTEGER array, dimension (1+MIN(L+P,N+M)) The leading NINFE elements of INFE contain the multiplicities of infinite eigenvalues. KRONL (output) INTEGER array, dimension (L+P+1) The leading NKROL elements of this array contain the left Kronecker (row) indices.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then default tolerances are used instead, as follows: TOLDEF = L*N*EPS in TG01FZ (to determine the rank of E) and TOLDEF = (L+P)*(N+M)*EPS in the rest, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N+max(1,M)) On output, IWORK(1) contains the normal rank of the transfer function matrix. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK >= max(4*(L+N), 2*max(L+P,M+N))), if EQUIL = 'S', LDWORK >= 2*max(L+P,M+N)), if EQUIL = 'N'. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. LZWORK INTEGER The length of the array ZWORK. LZWORK >= max( max(L+P,M+N)*(M+N) + max(min(L+P,M+N) + max(min(L,N),3*(M+N)-1), 3*(L+P), 1)) For optimum performance LZWORK should be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine extracts from the system matrix of a descriptor system (A-lambda*E,B,C,D) a regular pencil Af-lambda*Ef which has the finite zeros of the system as generalized eigenvalues. The procedure has the following main computational steps: (a) construct the (L+P)-by-(N+M) system pencil S(lambda) = ( B A )-lambda*( 0 E ); ( D C ) ( 0 0 ) (b) reduce S(lambda) to S1(lambda) with the same finite zeros and right Kronecker structure but with E upper triangular and nonsingular; (c) reduce S1(lambda) to S2(lambda) with the same finite zeros and right Kronecker structure but with D of full row rank; (d) reduce S2(lambda) to S3(lambda) with the same finite zeros and with D square invertible; (e) perform a unitary transformation on the columns of S3(lambda) = (A-lambda*E B) in order to reduce it to ( C D) (Af-lambda*Ef X), with Y and Ef square invertible; ( 0 Y) (f) compute the right and left Kronecker indices of the system matrix, which together with the multiplicities of the finite and infinite eigenvalues constitute the complete set of structural invariants under strict equivalence transformations of a linear system.References
[1] P. Misra, P. Van Dooren and A. Varga. Computation of structural invariants of generalized state-space systems. Automatica, 30, pp. 1921-1936, 1994.Numerical Aspects
The algorithm is backward stable (see [1]).Further Comments
In order to compute the finite Smith zeros of the system explicitly, a call to this routine may be followed by a call to the LAPACK Library routines ZGEGV or ZGGEV.Example
Program Text
* AG08BZ EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, MMAX, NMAX, PMAX PARAMETER ( LMAX = 20, MMAX = 20, NMAX = 20, PMAX = 20 ) INTEGER LDA, LDAEMX, LDB, LDC, LDD, LDE, LDQ, LDZ PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = PMAX, $ LDD = PMAX, LDE = LMAX, LDQ = 1, LDZ = 1, $ LDAEMX = MAX( PMAX + LMAX, NMAX + MMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 4*( LMAX + NMAX ), 2*LDAEMX, $ 8*NMAX ) ) INTEGER LZWORK PARAMETER ( LZWORK = MAX( 1, LDAEMX*LDAEMX + $ MAX( MIN( LMAX+PMAX, MMAX+NMAX )+ $ MAX( MIN( LMAX, NMAX ), $ 3*( MMAX+NMAX )-1 ), $ 3*( LMAX+PMAX ) ) ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER DINFZ, I, INFO, J, L, M, N, NFZ, NINFE, NIZ, $ NKROL, NKROR, NRANK, P CHARACTER*1 EQUIL * .. Local Arrays .. COMPLEX*16 A(LDA,NMAX), ALPHA(NMAX), ASAVE(LDA,NMAX), $ B(LDB,MMAX), BETA(NMAX), BSAVE(LDB,MMAX), $ C(LDC,NMAX), CSAVE(LDC,NMAX), $ D(LDD,MMAX), DSAVE(LDD,MMAX), $ E(LDE,NMAX), ESAVE(LDE,NMAX), Q(LDQ,1), Z(LDZ,1), $ ZWORK(LZWORK) DOUBLE PRECISION DWORK(LDWORK) INTEGER INFE(1+LMAX+PMAX), INFZ(NMAX+1), $ IWORK(NMAX+MMAX), KRONL(LMAX+PMAX+1), $ KRONR(NMAX+MMAX+1) * .. External Subroutines .. EXTERNAL AG08BZ, ZGEGV, ZLACPY * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, M, P, TOL, EQUIL IF( ( L.LT.0 .OR. L.GT.LMAX ) .OR. ( N.LT.0 .OR. N.GT.NMAX ) ) $ THEN WRITE ( NOUT, FMT = 99972 ) L, N ELSE IF( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99971 ) M ELSE IF( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99970 ) P ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,L ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) CALL ZLACPY( 'F', L, N, A, LDA, ASAVE, LDA ) CALL ZLACPY( 'F', L, N, E, LDE, ESAVE, LDE ) CALL ZLACPY( 'F', L, M, B, LDB, BSAVE, LDB ) CALL ZLACPY( 'F', P, N, C, LDC, CSAVE, LDC ) CALL ZLACPY( 'F', P, M, D, LDD, DSAVE, LDD ) * Compute poles (call the routine with M = 0, P = 0). CALL AG08BZ( EQUIL, L, N, 0, 0, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, $ NKROR, NINFE, NKROL, INFZ, KRONR, INFE, $ KRONL, TOL, IWORK, DWORK, ZWORK, LZWORK, $ INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99968 ) NIZ DO 10 I = 1, DINFZ WRITE ( NOUT, FMT = 99967 ) INFZ(I), I 10 CONTINUE WRITE ( NOUT, FMT = 99962 ) NINFE IF( NINFE.GT.0 ) WRITE ( NOUT, FMT = 99958 ) $ ( INFE(I), I = 1,NINFE ) IF( NFZ.EQ.0 ) THEN WRITE ( NOUT, FMT = 99965 ) ELSE WRITE ( NOUT, FMT = 99966 ) WRITE ( NOUT, FMT = 99990 ) DO 20 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( E(I,J), J = 1,NFZ ) 30 CONTINUE CALL ZGEGV( 'No vectors', 'No vectors', NFZ, A, $ LDA, E, LDE, ALPHA, BETA, Q, LDQ, $ Z, LDZ, ZWORK, LZWORK, DWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) DO 40 I = 1, NFZ WRITE ( NOUT, FMT = 99979 ) ALPHA(I)/BETA(I) 40 CONTINUE END IF END IF END IF CALL ZLACPY( 'F', L, N, ASAVE, LDA, A, LDA ) CALL ZLACPY( 'F', L, N, ESAVE, LDE, E, LDE ) * Check the observability and compute the ordered set of * the observability indices (call the routine with M = 0). CALL AG08BZ( EQUIL, L, N, 0, P, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, $ NKROR, NINFE, NKROL, INFZ, KRONR, INFE, $ KRONL, TOL, IWORK, DWORK, ZWORK, LZWORK, $ INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99964 ) NIZ DO 50 I = 1, DINFZ WRITE ( NOUT, FMT = 99967 ) INFZ(I), I 50 CONTINUE WRITE ( NOUT, FMT = 99962 ) NINFE IF( NINFE.GT.0 ) WRITE ( NOUT, FMT = 99960 ) $ ( INFE(I), I = 1,NINFE ) WRITE ( NOUT, FMT = 99994 ) ( KRONL(I), I = 1,NKROL ) IF( NFZ+NINFE.EQ.0 ) WRITE ( NOUT, FMT = 99993 ) IF( NFZ.EQ.0 ) THEN WRITE ( NOUT, FMT = 99957 ) ELSE WRITE ( NOUT, FMT = 99991 ) WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 60 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 70 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( E(I,J), J = 1,NFZ ) 70 CONTINUE CALL ZGEGV( 'No vectors', 'No vectors', NFZ, A, $ LDA, E, LDE, ALPHA, BETA, Q, LDQ, $ Z, LDZ, ZWORK, LZWORK, DWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) DO 80 I = 1, NFZ WRITE ( NOUT, FMT = 99979 ) ALPHA(I)/BETA(I) 80 CONTINUE END IF END IF END IF CALL ZLACPY( 'F', L, N, ASAVE, LDA, A, LDA ) CALL ZLACPY( 'F', L, N, ESAVE, LDE, E, LDE ) CALL ZLACPY( 'F', P, N, CSAVE, LDC, C, LDC ) * Check the controllability and compute the ordered set of * the controllability indices (call the routine with P = 0) CALL AG08BZ( EQUIL, L, N, M, 0, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, $ NKROR, NINFE, NKROL, INFZ, KRONR, INFE, $ KRONL, TOL, IWORK, DWORK, ZWORK, LZWORK, $ INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99963 ) NIZ DO 90 I = 1, DINFZ WRITE ( NOUT, FMT = 99967 ) INFZ(I), I 90 CONTINUE WRITE ( NOUT, FMT = 99962 ) NINFE IF( NINFE.GT.0 ) WRITE ( NOUT, FMT = 99959 ) $ ( INFE(I), I = 1,NINFE ) WRITE ( NOUT, FMT = 99988 ) ( KRONR(I), I = 1,NKROR ) IF( NFZ+NINFE.EQ.0 ) WRITE ( NOUT, FMT = 99987 ) IF( NFZ.EQ.0 ) THEN WRITE ( NOUT, FMT = 99956 ) ELSE WRITE ( NOUT, FMT = 99985 ) WRITE ( NOUT, FMT = 99990 ) DO 100 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 100 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 110 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( E(I,J), J = 1,NFZ ) 110 CONTINUE CALL ZGEGV( 'No vectors', 'No vectors', NFZ, A, $ LDA, E, LDE, ALPHA, BETA, Q, LDQ, $ Z, LDZ, ZWORK, LZWORK, DWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99982 ) DO 120 I = 1, NFZ WRITE ( NOUT, FMT = 99979 ) ALPHA(I)/BETA(I) 120 CONTINUE END IF END IF END IF CALL ZLACPY( 'F', L, N, ASAVE, LDA, A, LDA ) CALL ZLACPY( 'F', L, N, ESAVE, LDE, E, LDE ) CALL ZLACPY( 'F', L, M, BSAVE, LDB, B, LDB ) CALL ZLACPY( 'F', P, N, CSAVE, LDC, C, LDC ) CALL ZLACPY( 'F', P, M, DSAVE, LDD, D, LDD ) * Compute the structural invariants of the given system. CALL AG08BZ( EQUIL, L, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, NFZ, NRANK, NIZ, DINFZ, $ NKROR, NINFE, NKROL, INFZ, KRONR, INFE, $ KRONL, TOL, IWORK, DWORK, ZWORK, LZWORK, $ INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( L.EQ.N ) THEN WRITE ( NOUT, FMT = 99969 ) NRANK - N ELSE WRITE ( NOUT, FMT = 99955 ) NRANK END IF WRITE ( NOUT, FMT = 99984 ) NFZ IF( NFZ.GT.0 ) THEN * Compute the finite zeros of the given system. * Workspace: need 8*NFZ. WRITE ( NOUT, FMT = 99983 ) WRITE ( NOUT, FMT = 99990 ) DO 130 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( A(I,J), J = 1,NFZ ) 130 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 140 I = 1, NFZ WRITE ( NOUT, FMT = 99989 ) $ ( E(I,J), J = 1,NFZ ) 140 CONTINUE CALL ZGEGV( 'No vectors', 'No vectors', NFZ, A, $ LDA, E, LDE, ALPHA, BETA, Q, LDQ, $ Z, LDZ, ZWORK, LZWORK, DWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99981 ) DO 150 I = 1, NFZ WRITE ( NOUT, FMT = 99979 ) ALPHA(I)/BETA(I) 150 CONTINUE END IF END IF WRITE ( NOUT, FMT = 99978 ) NIZ DO 160 I = 1, DINFZ WRITE ( NOUT, FMT = 99977 ) INFZ(I), I 160 CONTINUE WRITE ( NOUT, FMT = 99962 ) NINFE IF( NINFE.GT.0 ) WRITE ( NOUT, FMT = 99961 ) $ ( INFE(I), I = 1,NINFE ) WRITE ( NOUT, FMT = 99976 ) NKROR IF( NKROR.GT.0 ) WRITE ( NOUT, FMT = 99975 ) $ ( KRONR(I), I = 1,NKROR ) WRITE ( NOUT, FMT = 99974 ) NKROL IF( NKROL.GT.0 ) WRITE ( NOUT, FMT = 99973 ) $ ( KRONL(I), I = 1,NKROL ) END IF END IF END IF END IF * STOP * 99999 FORMAT (' AG08BZ EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AG08BZ = ',I2) 99997 FORMAT (' INFO on exit from ZGEGV = ',I2) 99996 FORMAT (/' Unobservable finite eigenvalues'/ $ ' real part imag part ') 99995 FORMAT (/' The matrix Ef is ') 99994 FORMAT (/' The left Kronecker indices of [A-lambda*E;C] are ', $ /(20(I3,2X))) 99993 FORMAT (/' The system (A-lambda*E,C) is completely observable ') 99991 FORMAT (/' The finite output decoupling zeros are the eigenvalues' $ , ' of the pair (Af,Ef). ') 99990 FORMAT (/' The matrix Af is ') 99989 FORMAT (20(1X,F9.4,SP,F9.4,S,'i ')) 99988 FORMAT (/' The right Kronecker indices of [A-lambda*E,B] are ', $ /( 20(I3,2X) ) ) 99987 FORMAT (/' The system (A-lambda*E,B) is completely controllable ') 99985 FORMAT (/' The input decoupling zeros are the eigenvalues of the', $ ' pair (Af,Ef). ') 99984 FORMAT (/' The number of finite zeros = ',I3) 99983 FORMAT (/' The finite zeros are the eigenvalues ', $ 'of the pair (Af,Ef)') 99982 FORMAT (/' Uncontrollable finite eigenvalues'/ $ ' real part imag part ') 99981 FORMAT (/' Finite zeros'/' real part imag part ') 99979 FORMAT (1X,F9.4,SP,F9.4,S,'i ') 99978 FORMAT (//' The number of infinite zeros = ',I3) 99977 FORMAT ( I4,' infinite zero(s) of order ',I3) 99976 FORMAT (/' The number of right Kronecker indices = ',I3) 99975 FORMAT (/' Right Kronecker indices of [A-lambda*E,B;C,D]' $ ,' are ', /(20(I3,2X))) 99974 FORMAT (/' The number of left Kronecker indices = ',I3) 99973 FORMAT (/' The left Kronecker indices of [A-lambda*E,B;C,D]' $ ,' are ', /(20(I3,2X))) 99972 FORMAT (/' L or N is out of range.',/' L = ', I5, ' N = ',I5) 99971 FORMAT (/' M is out of range.',/' M = ',I5) 99970 FORMAT (/' P is out of range.',/' P = ',I5) 99969 FORMAT (/' Normal rank of transfer function matrix = ',I3) 99968 FORMAT (//' The number of infinite poles = ',I3) 99967 FORMAT ( I4,' infinite pole(s) of order ',I3) 99966 FORMAT (/' The finite poles are the eigenvalues', $ ' of the pair (Af,Ef). ') 99965 FORMAT (/' The system has no finite poles ') 99964 FORMAT (//' The number of unobservable infinite poles = ',I3) 99963 FORMAT (//' The number of uncontrollable infinite poles = ',I3) 99962 FORMAT (/' The number of infinite Kronecker blocks = ',I3) 99961 FORMAT (/' Multiplicities of infinite eigenvalues of ' $ ,'[A-lambda*E,B;C,D] are ', /(20(I3,2X))) 99960 FORMAT (/' Multiplicities of infinite eigenvalues of ' $ ,'[A-lambda*E;C] are ', /(20(I3,2X))) 99959 FORMAT (/' Multiplicities of infinite eigenvalues of ' $ ,'[A-lambda*E,B] are ', /(20(I3,2X))) 99958 FORMAT (/' Multiplicities of infinite eigenvalues of A-lambda*E' $ ,' are ', /(20(I3,2X))) 99957 FORMAT (/' The system (A-lambda*E,C) has no finite output', $ ' decoupling zeros ') 99956 FORMAT (/' The system (A-lambda*E,B) has no finite input', $ ' decoupling zeros ') 99955 FORMAT (/' Normal rank of system pencil = ',I3) ENDProgram Data
AG08BZ EXAMPLE PROGRAM DATA 9 9 3 3 1.e-7 N (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (0,0) (-1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (-1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (-1,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (1,0) (1,0) (0,0) (3,0) (4,0) (0,0) (0,0) (2,0) (0,0) (1,0) (0,0) (0,0) (4,0) (0,0) (0,0) (2,0) (0,0) (0,0) (0,0) (1,0) (0,0) (-1,0) (4,0) (0,0) (-2,0) (2,0) (1,0) (2,0) (-2,0) (0,0) (-1,0) (-2,0) (0,0) (0,0) (0,0)Program Results
AG08BZ EXAMPLE PROGRAM RESULTS The number of infinite poles = 6 0 infinite pole(s) of order 1 3 infinite pole(s) of order 2 The number of infinite Kronecker blocks = 3 Multiplicities of infinite eigenvalues of A-lambda*E are 3 3 3 The system has no finite poles The number of unobservable infinite poles = 4 0 infinite pole(s) of order 1 2 infinite pole(s) of order 2 The number of infinite Kronecker blocks = 3 Multiplicities of infinite eigenvalues of [A-lambda*E;C] are 1 3 3 The left Kronecker indices of [A-lambda*E;C] are 0 1 1 The system (A-lambda*E,C) has no finite output decoupling zeros The number of uncontrollable infinite poles = 0 The number of infinite Kronecker blocks = 3 Multiplicities of infinite eigenvalues of [A-lambda*E,B] are 1 1 1 The right Kronecker indices of [A-lambda*E,B] are 2 2 2 The system (A-lambda*E,B) has no finite input decoupling zeros Normal rank of transfer function matrix = 2 The number of finite zeros = 1 The finite zeros are the eigenvalues of the pair (Af,Ef) The matrix Af is -0.7705 +0.0000i The matrix Ef is -0.7705 +0.0000i Finite zeros real part imag part 1.0000 +0.0000i The number of infinite zeros = 2 0 infinite zero(s) of order 1 1 infinite zero(s) of order 2 The number of infinite Kronecker blocks = 5 Multiplicities of infinite eigenvalues of [A-lambda*E,B;C,D] are 1 1 1 1 3 The number of right Kronecker indices = 1 Right Kronecker indices of [A-lambda*E,B;C,D] are 2 The number of left Kronecker indices = 1 The left Kronecker indices of [A-lambda*E,B;C,D] are 1
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/AG8BYZ.html 0000664 0000000 0000000 00000022146 14560147231 0020423 0 ustar 00root root 0000000 0000000
Purpose
To extract from the (N+P)-by-(M+N) descriptor system pencil S(lambda) = ( B A - lambda*E ) ( D C ) with E nonsingular and upper triangular a (NR+PR)-by-(M+NR) "reduced" descriptor system pencil ( Br Ar-lambda*Er ) Sr(lambda) = ( ) ( Dr Cr ) having the same finite Smith zeros as the pencil S(lambda) but with Dr, a PR-by-M full row rank left upper trapezoidal matrix, and Er, an NR-by-NR upper triangular nonsingular matrix.Specification
SUBROUTINE AG8BYZ( FIRST, N, M, P, SVLMAX, ABCD, LDABCD, E, LDE, $ NR, PR, NINFZ, DINFZ, NKRONL, INFZ, KRONL, $ TOL, IWORK, DWORK, ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. INTEGER DINFZ, INFO, LDABCD, LDE, LZWORK, M, N, NINFZ, $ NKRONL, NR, P, PR DOUBLE PRECISION SVLMAX, TOL LOGICAL FIRST C .. Array Arguments .. INTEGER INFZ( * ), IWORK(*), KRONL( * ) DOUBLE PRECISION DWORK( * ) COMPLEX*16 ABCD( LDABCD, * ), E( LDE, * ), ZWORK( * )Arguments
Mode Parameters
FIRST LOGICAL Specifies if AG8BYZ is called first time or it is called for an already reduced system, with D full column rank with the last M rows in upper triangular form: FIRST = .TRUE., first time called; FIRST = .FALSE., not first time called.Input/Output Parameters
N (input) INTEGER The number of rows of matrix B, the number of columns of matrix C and the order of square matrices A and E. N >= 0. M (input) INTEGER The number of columns of matrices B and D. M >= 0. M <= P if FIRST = .FALSE. . P (input) INTEGER The number of rows of matrices C and D. P >= 0. SVLMAX (input) DOUBLE PRECISION During each reduction step, the rank-revealing QR factorization of a matrix stops when the estimated minimum singular value is smaller than TOL * MAX(SVLMAX,EMSV), where EMSV is the estimated maximum singular value. SVLMAX >= 0. ABCD (input/output) COMPLEX*16 array, dimension (LDABCD,M+N) On entry, the leading (N+P)-by-(M+N) part of this array must contain the compound matrix ( B A ) , ( D C ) where A is an N-by-N matrix, B is an N-by-M matrix, C is a P-by-N matrix and D is a P-by-M matrix. If FIRST = .FALSE., then D must be a full column rank matrix with the last M rows in upper triangular form. On exit, the leading (NR+PR)-by-(M+NR) part of ABCD contains the reduced compound matrix ( Br Ar ) , ( Dr Cr ) where Ar is an NR-by-NR matrix, Br is an NR-by-M matrix, Cr is a PR-by-NR matrix, Dr is a PR-by-M full row rank left upper trapezoidal matrix with the first PR columns in upper triangular form. LDABCD INTEGER The leading dimension of array ABCD. LDABCD >= MAX(1,N+P). E (input/output) COMPLEX*16 array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the upper triangular nonsingular matrix E. On exit, the leading NR-by-NR part contains the reduced upper triangular nonsingular matrix Er. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). NR (output) INTEGER The order of the reduced matrices Ar and Er; also the number of rows of the reduced matrix Br and the number of columns of the reduced matrix Cr. If Dr is invertible, NR is also the number of finite Smith zeros. PR (output) INTEGER The rank of the resulting matrix Dr; also the number of rows of reduced matrices Cr and Dr. NINFZ (output) INTEGER Number of infinite zeros. NINFZ = 0 if FIRST = .FALSE. . DINFZ (output) INTEGER The maximal multiplicity of infinite zeros. DINFZ = 0 if FIRST = .FALSE. . NKRONL (output) INTEGER The maximal dimension of left elementary Kronecker blocks. INFZ (output) INTEGER array, dimension (N) INFZ(i) contains the number of infinite zeros of degree i, where i = 1,2,...,DINFZ. INFZ is not referenced if FIRST = .FALSE. . KRONL (output) INTEGER array, dimension (N+1) KRONL(i) contains the number of left elementary Kronecker blocks of dimension i-by-(i-1), where i = 1,2,...,NKRONL.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR (or RQ) factorization with column (or row) pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then an implicitly computed, default tolerance TOLDEF = (N+P)*(N+M)*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). NOTE that when SVLMAX > 0, the estimated ranks could be less than those defined above (see SVLMAX). TOL <= 1.Workspace
IWORK INTEGER array, dimension (M) If FIRST = .FALSE., IWORK is not referenced. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK >= 2*MAX(M,P), if FIRST = .TRUE.; LDWORK >= 2*P, if FIRST = .FALSE. . ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. LZWORK INTEGER The length of the array ZWORK. LZWORK >= 1, if P = 0; otherwise LZWORK >= MAX( 1, N+M-1, MIN(P,M) + MAX(3*M-1,N), 3*P ), if FIRST = .TRUE.; LZWORK >= MAX( 1, N+M-1, 3*P ), if FIRST = .FALSE. . The second term is not needed if M = 0. For optimum performance LZWORK should be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The subroutine is based on the reduction algorithm of [1].References
[1] P. Misra, P. Van Dooren and A. Varga. Computation of structural invariants of generalized state-space systems. Automatica, 30, pp. 1921-1936, 1994.Numerical Aspects
The algorithm is numerically backward stable and requires 0( (P+N)*(M+N)*N ) floating point operations.Further Comments
The number of infinite zeros is computed as DINFZ NINFZ = Sum (INFZ(i)*i) . i=1 Note that each infinite zero of multiplicity k corresponds to an infinite eigenvalue of multiplicity k+1. The multiplicities of the infinite eigenvalues can be determined from PR, DINFZ and INFZ(i), i = 1, ..., DINFZ, as follows: DINFZ - there are PR - Sum (INFZ(i)) simple infinite eigenvalues; i=1 - there are INFZ(i) infinite eigenvalues with multiplicity i+1, for i = 1, ..., DINFZ. The left Kronecker indices are: [ 0 0 ... 0 | 1 1 ... 1 | .... | NKRONL ... NKRONL ] |<- KRONL(1) ->|<- KRONL(2) ->| |<- KRONL(NKRONL) ->|Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To generate the benchmark examples for the numerical solution of continuous-time algebraic Riccati equations (CAREs) of the form 0 = Q + A'X + XA - XGX corresponding to the Hamiltonian matrix ( A G ) H = ( T ). ( Q -A ) A,G,Q,X are real N-by-N matrices, Q and G are symmetric and may be given in factored form -1 T T (I) G = B R B , (II) Q = C W C . Here, C is P-by-N, W P-by-P, B N-by-M, and R M-by-M, where W and R are symmetric. In linear-quadratic optimal control problems, usually W is positive semidefinite and R positive definite. The factorized form can be used if the CARE is solved using the deflating subspaces of the extended Hamiltonian pencil ( A 0 B ) ( I 0 0 ) ( T ) ( ) H - s K = ( Q A 0 ) - s ( 0 -I 0 ) , ( T ) ( ) ( 0 B R ) ( 0 0 0 ) where I and 0 denote the identity and zero matrix, respectively, of appropriate dimensions. NOTE: the formulation of the CARE and the related matrix (pencils) used here does not include CAREs as they arise in robust control (H_infinity optimization).Specification
SUBROUTINE BB01AD(DEF, NR, DPAR, IPAR, BPAR, CHPAR, VEC, N, M, P, 1 A, LDA, B, LDB, C, LDC, G, LDG, Q, LDQ, X, LDX, 2 DWORK, LDWORK, INFO) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDG, LDQ, LDWORK, LDX, M, N, $ P CHARACTER DEF C .. Array Arguments .. INTEGER IPAR(4), NR(2) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DPAR(*), DWORK(*), 1 G(*), Q(*), X(LDX,*) CHARACTER CHPAR*(*) LOGICAL BPAR(6), VEC(9)Arguments
Mode Parameters
DEF CHARACTER This parameter specifies if the default parameters are to be used or not. = 'N' or 'n' : The parameters given in the input vectors xPAR (x = 'D', 'I', 'B', 'CH') are used. = 'D' or 'd' : The default parameters for the example are used. This parameter is not meaningful if NR(1) = 1.Input/Output Parameters
NR (input) INTEGER array, dimension (2) This array determines the example for which CAREX returns data. NR(1) is the group of examples. NR(1) = 1 : parameter-free problems of fixed size. NR(1) = 2 : parameter-dependent problems of fixed size. NR(1) = 3 : parameter-free problems of scalable size. NR(1) = 4 : parameter-dependent problems of scalable size. NR(2) is the number of the example in group NR(1). Let NEXi be the number of examples in group i. Currently, NEX1 = 6, NEX2 = 9, NEX3 = 2, NEX4 = 4. 1 <= NR(1) <= 4; 1 <= NR(2) <= NEXi , where i = NR(1). DPAR (input/output) DOUBLE PRECISION array, dimension (7) Double precision parameter vector. For explanation of the parameters see [1]. DPAR(1) : defines the parameters 'delta' for NR(1) = 3, 'q' for NR(1).NR(2) = 4.1, 'a' for NR(1).NR(2) = 4.2, and 'mu' for NR(1).NR(2) = 4.3. DPAR(2) : defines parameters 'r' for NR(1).NR(2) = 4.1, 'b' for NR(1).NR(2) = 4.2, and 'delta' for NR(1).NR(2) = 4.3. DPAR(3) : defines parameters 'c' for NR(1).NR(2) = 4.2 and 'kappa' for NR(1).NR(2) = 4.3. DPAR(j), j=4,5,6,7: These arguments are only used to generate Example 4.2 and define in consecutive order the intervals ['beta_1', 'beta_2'], ['gamma_1', 'gamma_2']. NOTE that if DEF = 'D' or 'd', the values of DPAR entries on input are ignored and, on output, they are overwritten with the default parameters. IPAR (input/output) INTEGER array, dimension (4) On input, IPAR(1) determines the actual state dimension, i.e., the order of the matrix A as follows, where NO = NR(1).NR(2). NR(1) = 1 or 2.1-2.8: IPAR(1) is ignored. NO = 2.9 : IPAR(1) = 1 generates the CARE for optimal state feedback (default); IPAR(1) = 2 generates the Kalman filter CARE. NO = 3.1 : IPAR(1) is the number of vehicles (parameter 'l' in the description in [1]). NO = 3.2, 4.1 or 4.2: IPAR(1) is the order of the matrix A. NO = 4.3 or 4.4 : IPAR(1) determines the dimension of the second-order system, i.e., the order of the stiffness matrix for Examples 4.3 and 4.4 (parameter 'l' in the description in [1]). The order of the output matrix A is N = 2*IPAR(1) for Example 4.3 and N = 2*IPAR(1)-1 for Examples 3.1 and 4.4. NOTE that IPAR(1) is overwritten for Examples 1.1-2.8. For the other examples, IPAR(1) is overwritten if the default parameters are to be used. On output, IPAR(1) contains the order of the matrix A. On input, IPAR(2) is the number of colums in the matrix B in (I) (in control problems, the number of inputs of the system). Currently, IPAR(2) is fixed or determined by IPAR(1) for all examples and thus is not referenced on input. On output, IPAR(2) is the number of columns of the matrix B from (I). NOTE that currently IPAR(2) is overwritten and that rank(G) <= IPAR(2). On input, IPAR(3) is the number of rows in the matrix C in (II) (in control problems, the number of outputs of the system). Currently, IPAR(3) is fixed or determined by IPAR(1) for all examples and thus is not referenced on input. On output, IPAR(3) contains the number of rows of the matrix C in (II). NOTE that currently IPAR(3) is overwritten and that rank(Q) <= IPAR(3). On input, if NR(1) = NR(2) = 4, and other data file than that used by default is desired, then IPAR(4) is the length of the character string in CHPAR specifying the file name. BPAR (input) BOOLEAN array, dimension (6) This array defines the form of the output of the examples and the storage mode of the matrices G and Q. BPAR(1) = .TRUE. : G is returned. BPAR(1) = .FALSE. : G is returned in factored form, i.e., B and R from (I) are returned. BPAR(2) = .TRUE. : The matrix returned in array G (i.e., G if BPAR(1) = .TRUE. and R if BPAR(1) = .FALSE.) is stored as full matrix. BPAR(2) = .FALSE. : The matrix returned in array G is provided in packed storage mode. BPAR(3) = .TRUE. : If BPAR(2) = .FALSE., the matrix returned in array G is stored in upper packed mode, i.e., the upper triangle of a symmetric n-by-n matrix is stored by columns, e.g., the matrix entry G(i,j) is stored in the array entry G(i+j*(j-1)/2) for i <= j. Otherwise, this entry is ignored. BPAR(3) = .FALSE. : If BPAR(2) = .FALSE., the matrix returned in array G is stored in lower packed mode, i.e., the lower triangle of a symmetric n-by-n matrix is stored by columns, e.g., the matrix entry G(i,j) is stored in the array entry G(i+(2*n-j)*(j-1)/2) for j <= i. Otherwise, this entry is ignored. BPAR(4) = .TRUE. : Q is returned. BPAR(4) = .FALSE. : Q is returned in factored form, i.e., C and W from (II) are returned. BPAR(5) = .TRUE. : The matrix returned in array Q (i.e., Q if BPAR(4) = .TRUE. and W if BPAR(4) = .FALSE.) is stored as full matrix. BPAR(5) = .FALSE. : The matrix returned in array Q is provided in packed storage mode. BPAR(6) = .TRUE. : If BPAR(5) = .FALSE., the matrix returned in array Q is stored in upper packed mode (see above). Otherwise, this entry is ignored. BPAR(6) = .FALSE. : If BPAR(5) = .FALSE., the matrix returned in array Q is stored in lower packed mode (see above). Otherwise, this entry is ignored. NOTE that there are no default values for BPAR. If all entries are declared to be .TRUE., then matrices G and Q are returned in conventional storage mode, i.e., as N-by-N arrays where the array element Z(I,J) contains the matrix entry Z_{i,j}. CHPAR (input/output) CHARACTER*255 On input, this is the name of a data file supplied by the user. In the current version, only Example 4.4 allows a user-defined data file. This file must contain consecutively DOUBLE PRECISION vectors mu, delta, gamma, and kappa. The length of these vectors is determined by the input value for IPAR(1). If on entry, IPAR(1) = L, then mu and delta must each contain L DOUBLE PRECISION values, and gamma and kappa must each contain L-1 DOUBLE PRECISION values. On output, this string contains short information about the chosen example. VEC (output) LOGICAL array, dimension (9) Flag vector which displays the availability of the output data: VEC(j), j=1,2,3, refer to N, M, and P, respectively, and are always .TRUE. VEC(4) refers to A and is always .TRUE. VEC(5) is .TRUE. if BPAR(1) = .FALSE., i.e., the factors B and R from (I) are returned. VEC(6) is .TRUE. if BPAR(4) = .FALSE., i.e., the factors C and W from (II) are returned. VEC(7) refers to G and is always .TRUE. VEC(8) refers to Q and is always .TRUE. VEC(9) refers to X and is .TRUE. if the exact solution matrix is available. NOTE that VEC(i) = .FALSE. for i = 1 to 9 if on exit INFO .NE. 0. N (output) INTEGER The order of the matrices A, X, G if BPAR(1) = .TRUE., and Q if BPAR(4) = .TRUE. M (output) INTEGER The number of columns in the matrix B (or the dimension of the control input space of the underlying dynamical system). P (output) INTEGER The number of rows in the matrix C (or the dimension of the output space of the underlying dynamical system). A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array contains the coefficient matrix A of the CARE. LDA INTEGER The leading dimension of array A. LDA >= N. B (output) DOUBLE PRECISION array, dimension (LDB,M) If (BPAR(1) = .FALSE.), then the leading N-by-M part of this array contains the matrix B of the factored form (I) of G. Otherwise, B is used as workspace. LDB INTEGER The leading dimension of array B. LDB >= N. C (output) DOUBLE PRECISION array, dimension (LDC,N) If (BPAR(4) = .FALSE.), then the leading P-by-N part of this array contains the matrix C of the factored form (II) of Q. Otherwise, C is used as workspace. LDC INTEGER The leading dimension of array C. LDC >= P, where P is the number of rows of the matrix C, i.e., the output value of IPAR(3). (For all examples, P <= N, where N equals the output value of the argument IPAR(1), i.e., LDC >= LDA is always safe.) G (output) DOUBLE PRECISION array, dimension (NG) If (BPAR(2) = .TRUE.) then NG = LDG*N. If (BPAR(2) = .FALSE.) then NG = N*(N+1)/2. If (BPAR(1) = .TRUE.), then array G contains the coefficient matrix G of the CARE. If (BPAR(1) = .FALSE.), then array G contains the 'control weighting matrix' R of G's factored form as in (I). (For all examples, M <= N.) The symmetric matrix contained in array G is stored according to BPAR(2) and BPAR(3). LDG INTEGER If conventional storage mode is used for G, i.e., BPAR(2) = .TRUE., then G is stored like a 2-dimensional array with leading dimension LDG. If packed symmetric storage mode is used, then LDG is not referenced. LDG >= N if BPAR(2) = .TRUE.. Q (output) DOUBLE PRECISION array, dimension (NQ) If (BPAR(5) = .TRUE.) then NQ = LDQ*N. If (BPAR(5) = .FALSE.) then NQ = N*(N+1)/2. If (BPAR(4) = .TRUE.), then array Q contains the coefficient matrix Q of the CARE. If (BPAR(4) = .FALSE.), then array Q contains the 'output weighting matrix' W of Q's factored form as in (II). The symmetric matrix contained in array Q is stored according to BPAR(5) and BPAR(6). LDQ INTEGER If conventional storage mode is used for Q, i.e., BPAR(5) = .TRUE., then Q is stored like a 2-dimensional array with leading dimension LDQ. If packed symmetric storage mode is used, then LDQ is not referenced. LDQ >= N if BPAR(5) = .TRUE.. X (output) DOUBLE PRECISION array, dimension (LDX,IPAR(1)) If an exact solution is available (NR = 1.1, 1.2, 2.1, 2.3-2.6, 3.2), then the leading N-by-N part of this array contains the solution matrix X in conventional storage mode. Otherwise, X is not referenced. LDX INTEGER The leading dimension of array X. LDX >= 1, and LDX >= N if NR = 1.1, 1.2, 2.1, 2.3-2.6, 3.2.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= N*MAX(4,N).Error Indicator
INFO INTEGER = 0 : successful exit; < 0 : if INFO = -i, the i-th argument had an illegal value; = 1 : data file could not be opened or had wrong format; = 2 : division by zero; = 3 : G can not be computed as in (I) due to a singular R matrix.References
[1] Abels, J. and Benner, P. CAREX - A Collection of Benchmark Examples for Continuous-Time Algebraic Riccati Equations (Version 2.0). SLICOT Working Note 1999-14, November 1999. Available from http://www.win.tue.nl/niconet/NIC2/reports.html. This is an updated and extended version of [2] Benner, P., Laub, A.J., and Mehrmann, V. A Collection of Benchmark Examples for the Numerical Solution of Algebraic Riccati Equations I: Continuous-Time Case. Technical Report SPC 95_22, Fak. f. Mathematik, TU Chemnitz-Zwickau (Germany), October 1995.Numerical Aspects
If the original data as taken from the literature is given via matrices G and Q, but factored forms are requested as output, then these factors are obtained from Cholesky or LDL' decompositions of G and Q, i.e., the output data will be corrupted by roundoff errors.Further Comments
Some benchmark examples read data from the data files provided with the collection.Example
Program Text
* BB01AD EXAMPLE PROGRAM TEXT * * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX, PMAX PARAMETER ( MMAX = 100, NMAX = 100, PMAX = 100 ) INTEGER LDA, LDB, LDC, LDG, LDQ, LDX PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDG = NMAX, LDQ = NMAX, LDX = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*MAX( 4, NMAX ) ) * .. Local Scalars .. CHARACTER DEF INTEGER I, INFO, ISYMM, J, LBPAR, LDPAR, LIPAR, M, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), B(LDB,MMAX), C(LDC, NMAX), $ DPAR(7), DWORK(LDWORK), G(LDG, NMAX), $ Q(LDQ, NMAX), X(LDX, NMAX) INTEGER IPAR(4), NR(2) LOGICAL BPAR(6), VEC(9) CHARACTER CHPAR*255 * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL BB01AD, MA02DD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ( NIN, FMT = '()' ) READ( NIN, FMT = * ) DEF READ( NIN, FMT = * ) ( NR(I), I = 1, 2 ) IF( LSAME( DEF, 'N' ) ) THEN READ( NIN, FMT = * ) LBPAR IF( LBPAR.GT.0 ) READ( NIN, FMT = * ) ( BPAR(I), I = 1, LBPAR ) READ( NIN, FMT = * ) LDPAR IF( LDPAR.GT.0 ) READ( NIN, FMT = * ) ( DPAR(I), I = 1, LDPAR ) READ( NIN, FMT = * ) LIPAR IF( LIPAR.GT.0 ) READ( NIN, FMT = * ) ( IPAR(I), I = 1, LIPAR ) END IF * Generate benchmark example CALL BB01AD( DEF, NR, DPAR, IPAR, BPAR, CHPAR, VEC, N, M, P, A, $ LDA, B, LDB, C, LDC, G, LDG, Q, LDQ, X, LDX, DWORK, $ LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99998 ) INFO ELSE WRITE( NOUT, FMT = * ) CHPAR(1:70) WRITE( NOUT, FMT = 99997 ) N WRITE( NOUT, FMT = 99996 ) M WRITE( NOUT, FMT = 99995 ) P WRITE( NOUT, FMT = 99994 ) DO 10 I = 1, N WRITE( NOUT, FMT = 99979 ) ( A(I,J), J = 1, N ) 10 CONTINUE IF( VEC(5) ) THEN WRITE( NOUT, FMT = 99993 ) DO 20 I = 1, N WRITE( NOUT, FMT = 99979 ) ( B(I,J), J = 1, M ) 20 CONTINUE ELSE WRITE( NOUT, FMT = 99992 ) END IF IF( VEC(6) ) THEN WRITE( NOUT,FMT = 99991 ) DO 30 I = 1, P WRITE( NOUT, FMT = 99979 ) ( C(I,J), J = 1, N ) 30 CONTINUE ELSE WRITE( NOUT, FMT = 99990 ) END IF IF( .NOT.VEC(5) ) THEN WRITE( NOUT, FMT = 99989 ) IF( .NOT.BPAR(2) ) THEN ISYMM = ( N * ( N + 1 ) ) / 2 CALL DCOPY( ISYMM, G, 1, DWORK, 1 ) IF( BPAR(3) ) THEN CALL MA02DD( 'Unpack', 'Upper', N, G, LDG, DWORK ) ELSE CALL MA02DD( 'Unpack', 'Lower', N, G, LDG, DWORK ) END IF END IF DO 40 I = 1, N WRITE( NOUT, FMT = 99979 ) ( G(I,J), J = 1, N ) 40 CONTINUE ELSE WRITE( NOUT, FMT = 99988 ) END IF IF( .NOT.VEC(6) ) THEN IF( .NOT. BPAR(5) ) THEN ISYMM = ( N * ( N + 1 ) ) / 2 CALL DCOPY( ISYMM, Q, 1, DWORK, 1 ) IF( BPAR(6) ) THEN CALL MA02DD( 'Unpack', 'Upper', N, Q, LDQ, DWORK ) ELSE CALL MA02DD( 'Unpack', 'Lower', N, Q, LDQ, DWORK ) END IF END IF WRITE( NOUT, FMT = 99987 ) DO 50 I = 1, N WRITE( NOUT, FMT = 99979 ) ( Q(I,J), J = 1, N ) 50 CONTINUE ELSE WRITE( NOUT, FMT = 99986 ) END IF IF( VEC(6) ) THEN IF( .NOT.BPAR(5) ) THEN ISYMM = ( P * ( P + 1 ) ) / 2 CALL DCOPY( ISYMM, Q, 1, DWORK, 1 ) IF( BPAR(6) ) THEN CALL MA02DD( 'Unpack', 'Upper', P, Q, LDQ, DWORK ) ELSE CALL MA02DD( 'Unpack', 'Lower', P, Q, LDQ, DWORK ) END IF END IF WRITE( NOUT, FMT = 99985 ) DO 60 I = 1, N WRITE( NOUT, FMT = 99979 ) ( Q(I,J), J = 1, N ) 60 CONTINUE ELSE WRITE( NOUT, FMT = 99984 ) END IF IF( VEC(5) ) THEN IF( .NOT.BPAR(2) ) THEN ISYMM = ( M * ( M + 1 ) ) / 2 CALL DCOPY( ISYMM, G, 1, DWORK, 1 ) IF( BPAR(3) ) THEN CALL MA02DD( 'Unpack', 'Upper', M, G, LDG, DWORK ) ELSE CALL MA02DD( 'Unpack', 'Lower', M, G, LDG, DWORK ) END IF END IF WRITE( NOUT, FMT = 99983 ) DO 70 I = 1, N WRITE( NOUT, FMT = 99979 ) ( G(I,J), J = 1, N ) 70 CONTINUE ELSE WRITE( NOUT, FMT = 99982 ) END IF IF( VEC(9) ) THEN WRITE( NOUT, FMT = 99981 ) DO 80 I = 1, N WRITE( NOUT, FMT = 99979 ) ( X(I,J), J = 1, N ) 80 CONTINUE ELSE WRITE( NOUT, FMT = 99980 ) END IF END IF STOP * 99999 FORMAT (' BB01AD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from BB03AD = ', I3) 99997 FORMAT (/' Order of matrix A: N = ', I3) 99996 FORMAT (' Number of columns in matrix B: M = ', I3) 99995 FORMAT (' Number of rows in matrix C: P = ', I3) 99994 FORMAT (' A = ') 99993 FORMAT (' B = ') 99992 FORMAT (' B is not provided.') 99991 FORMAT (' C = ') 99990 FORMAT (' C is not provided.') 99989 FORMAT (' G = ') 99988 FORMAT (' G is not provided.') 99987 FORMAT (' Q = ') 99986 FORMAT (' Q is not provided.') 99985 FORMAT (' W = ') 99984 FORMAT (' W is not provided.') 99983 FORMAT (' R = ') 99982 FORMAT (' R is not provided.') 99981 FORMAT (' X = ') 99980 FORMAT (' X is not provided.') 99979 FORMAT (20(1X,F8.4)) * ENDProgram Data
BB01AD EXAMPLE PROGRAM DATA N 2 3 6 .T. .T. .T. .F. .F. .T. 1 .1234 0Program Results
BB01AD EXAMPLE PROGRAM RESULTS Kenney/Laub/Wette 1989, Ex.2: ARE ill conditioned for EPS -> oo Order of matrix A: N = 2 Number of columns in matrix B: M = 1 Number of rows in matrix C: P = 2 A = 0.0000 0.1234 0.0000 0.0000 B is not provided. C = 1.0000 0.0000 0.0000 1.0000 G = 0.0000 0.0000 0.0000 1.0000 Q is not provided. W = 1.0000 0.0000 0.0000 1.0000 R is not provided. X = 9.0486 1.0000 1.0000 1.1166
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/BB02AD.html 0000664 0000000 0000000 00000053100 14560147231 0020303 0 ustar 00root root 0000000 0000000
Purpose
To generate the benchmark examples for the numerical solution of discrete-time algebraic Riccati equations (DAREs) of the form T T T -1 T T 0 = A X A - X - (A X B + S) (R + B X B) (B X A + S ) + Q as presented in [1]. Here, A,Q,X are real N-by-N matrices, B,S are N-by-M, and R is M-by-M. The matrices Q and R are symmetric and Q may be given in factored form T (I) Q = C Q0 C . Here, C is P-by-N and Q0 is P-by-P. If R is nonsingular and S = 0, the DARE can be rewritten equivalently as T -1 0 = X - A X (I_n + G X) A - Q, where I_n is the N-by-N identity matrix and -1 T (II) G = B R B .Specification
SUBROUTINE BB02AD(DEF, NR, DPAR, IPAR, BPAR, CHPAR, VEC, N, M, P, 1 A, LDA, B, LDB, C, LDC, Q, LDQ, R, LDR, S, LDS, 2 X, LDX, DWORK, LDWORK, INFO) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDQ, LDR, LDS, LDWORK, LDX, $ M, N, P CHARACTER DEF C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DPAR(*), DWORK(*), 1 Q(*), R(*), S(LDS,*), X(LDX,*) INTEGER IPAR(3), NR(2) CHARACTER CHPAR*255 LOGICAL BPAR(7), VEC(10)Arguments
Mode Parameters
DEF CHARACTER This parameter specifies if the default parameters are to be used or not. = 'N' or 'n' : The parameters given in the input vectors xPAR (x = 'D', 'I', 'B', 'CH') are used. = 'D' or 'd' : The default parameters for the example are used. This parameter is not meaningful if NR(1) = 1.Input/Output Parameters
NR (input) INTEGER array, dimension (2) This array determines the example for which DAREX returns data. NR(1) is the group of examples. NR(1) = 1 : parameter-free problems of fixed size. NR(1) = 2 : parameter-dependent problems of fixed size. NR(1) = 3 : parameter-free problems of scalable size. NR(1) = 4 : parameter-dependent problems of scalable size. NR(2) is the number of the example in group NR(1). Let NEXi be the number of examples in group i. Currently, NEX1 = 13, NEX2 = 5, NEX3 = 0, NEX4 = 1. 1 <= NR(1) <= 4; 0 <= NR(2) <= NEXi, where i = NR(1). DPAR (input/output) DOUBLE PRECISION array, dimension (4) Double precision parameter vector. For explanation of the parameters see [1]. DPAR(1) defines the parameter 'epsilon' for examples NR = 2.2,2.3,2.4, the parameter 'tau' for NR = 2.5, and the 1-by-1 matrix R for NR = 2.1,4.1. For Example 2.5, DPAR(2) - DPAR(4) define in consecutive order 'D', 'K', and 'r'. NOTE that DPAR is overwritten with default values if DEF = 'D' or 'd'. IPAR (input/output) INTEGER array, dimension (3) On input, IPAR(1) determines the actual state dimension, i.e., the order of the matrix A as follows: NR(1) = 1, NR(1) = 2 : IPAR(1) is ignored. NR = NR(1).NR(2) = 4.1 : IPAR(1) determines the order of the output matrix A. NOTE that IPAR(1) is overwritten for Examples 1.1-2.3. For the other examples, IPAR(1) is overwritten if the default parameters are to be used. On output, IPAR(1) contains the order of the matrix A. On input, IPAR(2) is the number of colums in the matrix B and the order of the matrix R (in control problems, the number of inputs of the system). Currently, IPAR(2) is fixed for all examples and thus is not referenced on input. On output, IPAR(2) is the number of columns of the matrix B from (I). On input, IPAR(3) is the number of rows in the matrix C (in control problems, the number of outputs of the system). Currently, IPAR(3) is fixed for all examples and thus is not referenced on input. On output, IPAR(3) is the number of rows of the matrix C from (I). NOTE that IPAR(2) and IPAR(3) are overwritten and IPAR(2) <= IPAR(1) and IPAR(3) <= IPAR(1) for all examples. BPAR (input) LOGICAL array, dimension (7) This array defines the form of the output of the examples and the storage mode of the matrices Q, G or R. BPAR(1) = .TRUE. : Q is returned. BPAR(1) = .FALSE. : Q is returned in factored form, i.e., Q0 and C from (I) are returned. BPAR(2) = .TRUE. : The matrix returned in array Q (i.e., Q if BPAR(1) = .TRUE. and Q0 if BPAR(1) = .FALSE.) is stored as full matrix. BPAR(2) = .FALSE. : The matrix returned in array Q is provided in packed storage mode. BPAR(3) = .TRUE. : If BPAR(2) = .FALSE., the matrix returned in array Q is stored in upper packed mode, i.e., the upper triangle of a symmetric n-by-n matrix is stored by columns, e.g., the matrix entry Q(i,j) is stored in the array entry Q(i+j*(j-1)/2) for i <= j. Otherwise, this entry is ignored. BPAR(3) = .FALSE. : If BPAR(2) = .FALSE., the matrix returned in array Q is stored in lower packed mode, i.e., the lower triangle of a symmetric n-by-n matrix is stored by columns, e.g., the matrix entry Q(i,j) is stored in the array entry Q(i+(2*n-j)*(j-1)/2) for j <= i. Otherwise, this entry is ignored. BPAR(4) = .TRUE. : The product G in (II) is returned. BPAR(4) = .FALSE. : G is returned in factored form, i.e., B and R from (II) are returned. BPAR(5) = .TRUE. : The matrix returned in array R (i.e., G if BPAR(4) = .TRUE. and R if BPAR(4) = .FALSE.) is stored as full matrix. BPAR(5) = .FALSE. : The matrix returned in array R is provided in packed storage mode. BPAR(6) = .TRUE. : If BPAR(5) = .FALSE., the matrix returned in array R is stored in upper packed mode (see above). Otherwise, this entry is ignored. BPAR(6) = .FALSE. : If BPAR(5) = .FALSE., the matrix returned in array R is stored in lower packed mode (see above). Otherwise, this entry is ignored. BPAR(7) = .TRUE. : The coefficient matrix S of the DARE is returned in array S. BPAR(7) = .FALSE. : The coefficient matrix S of the DARE is not returned. NOTE that there are no default values for BPAR. If all entries are declared to be .TRUE., then matrices Q, G or R are returned in conventional storage mode, i.e., as N-by-N or M-by-M arrays where the array element Z(I,J) contains the matrix entry Z_{i,j}. CHPAR (output) CHARACTER*255 On output, this string contains short information about the chosen example. VEC (output) LOGICAL array, dimension (10) Flag vector which displays the availability of the output data: VEC(j), j=1,2,3, refer to N, M, and P, respectively, and are always .TRUE. VEC(4) refers to A and is always .TRUE. VEC(5) is .TRUE. if BPAR(4) = .FALSE., i.e., the factors B and R from (II) are returned. VEC(6) is .TRUE. if BPAR(1) = .FALSE., i.e., the factors C and Q0 from (I) are returned. VEC(7) refers to Q and is always .TRUE. VEC(8) refers to R and is always .TRUE. VEC(9) is .TRUE. if BPAR(7) = .TRUE., i.e., the matrix S is returned. VEC(10) refers to X and is .TRUE. if the exact solution matrix is available. NOTE that VEC(i) = .FALSE. for i = 1 to 10 if on exit INFO .NE. 0. N (output) INTEGER The order of the matrices A, X, G if BPAR(4) = .TRUE., and Q if BPAR(1) = .TRUE. M (output) INTEGER The number of columns in the matrix B (or the dimension of the control input space of the underlying dynamical system). P (output) INTEGER The number of rows in the matrix C (or the dimension of the output space of the underlying dynamical system). A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array contains the coefficient matrix A of the DARE. LDA INTEGER The leading dimension of array A. LDA >= N. B (output) DOUBLE PRECISION array, dimension (LDB,M) If (BPAR(4) = .FALSE.), then the leading N-by-M part of this array contains the coefficient matrix B of the DARE. Otherwise, B is used as workspace. LDB INTEGER The leading dimension of array B. LDB >= N. C (output) DOUBLE PRECISION array, dimension (LDC,N) If (BPAR(1) = .FALSE.), then the leading P-by-N part of this array contains the matrix C of the factored form (I) of Q. Otherwise, C is used as workspace. LDC INTEGER The leading dimension of array C. LDC >= P. Q (output) DOUBLE PRECISION array, dimension (NQ) If (BPAR(1) = .TRUE.) and (BPAR(2) = .TRUE.), then NQ = LDQ*N. IF (BPAR(1) = .TRUE.) and (BPAR(2) = .FALSE.), then NQ = N*(N+1)/2. If (BPAR(1) = .FALSE.) and (BPAR(2) = .TRUE.), then NQ = LDQ*P. IF (BPAR(1) = .FALSE.) and (BPAR(2) = .FALSE.), then NQ = P*(P+1)/2. The symmetric matrix contained in array Q is stored according to BPAR(2) and BPAR(3). LDQ INTEGER If conventional storage mode is used for Q, i.e., BPAR(2) = .TRUE., then Q is stored like a 2-dimensional array with leading dimension LDQ. If packed symmetric storage mode is used, then LDQ is irrelevant. LDQ >= N if BPAR(1) = .TRUE.; LDQ >= P if BPAR(1) = .FALSE.. R (output) DOUBLE PRECISION array, dimension (MR) If (BPAR(4) = .TRUE.) and (BPAR(5) = .TRUE.), then MR = LDR*N. IF (BPAR(4) = .TRUE.) and (BPAR(5) = .FALSE.), then MR = N*(N+1)/2. If (BPAR(4) = .FALSE.) and (BPAR(5) = .TRUE.), then MR = LDR*M. IF (BPAR(4) = .FALSE.) and (BPAR(5) = .FALSE.), then MR = M*(M+1)/2. The symmetric matrix contained in array R is stored according to BPAR(5) and BPAR(6). LDR INTEGER If conventional storage mode is used for R, i.e., BPAR(5) = .TRUE., then R is stored like a 2-dimensional array with leading dimension LDR. If packed symmetric storage mode is used, then LDR is irrelevant. LDR >= N if BPAR(4) = .TRUE.; LDR >= M if BPAR(4) = .FALSE.. S (output) DOUBLE PRECISION array, dimension (LDS,M) If (BPAR(7) = .TRUE.), then the leading N-by-M part of this array contains the coefficient matrix S of the DARE. LDS INTEGER The leading dimension of array S. LDS >= 1, and LDS >= N if BPAR(7) = .TRUE.. X (output) DOUBLE PRECISION array, dimension (LDX,NX) If an exact solution is available (NR = 1.1,1.3,1.4,2.1, 2.3,2.4,2.5,4.1), then NX = N and the leading N-by-N part of this array contains the solution matrix X. Otherwise, X is not referenced. LDX INTEGER The leading dimension of array X. LDX >= 1, and LDX >= N if an exact solution is available.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= N*N.Error Indicator
INFO INTEGER = 0 : successful exit; < 0 : if INFO = -i, the i-th argument had an illegal value; = 1 : data file could not be opened or had wrong format; = 2 : division by zero; = 3 : G can not be computed as in (II) due to a singular R matrix. This error can only occur if BPAR(4) = .TRUE..References
[1] Abels, J. and Benner, P. DAREX - A Collection of Benchmark Examples for Discrete-Time Algebraic Riccati Equations (Version 2.0). SLICOT Working Note 1999-16, November 1999. Available from http://www.win.tue.nl/niconet/NIC2/reports.html. This is an updated and extended version of [2] Benner, P., Laub, A.J., and Mehrmann, V. A Collection of Benchmark Examples for the Numerical Solution of Algebraic Riccati Equations II: Discrete-Time Case. Technical Report SPC 95_23, Fak. f. Mathematik, TU Chemnitz-Zwickau (Germany), December 1995.Further Comments
Some benchmark examples read data from the data files provided with the collection.Example
Program Text
* BB02AD EXAMPLE PROGRAM TEXT * * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX, PMAX PARAMETER ( MMAX = 100, NMAX = 100, PMAX = 100 ) INTEGER LDA, LDB, LDC, LDQ, LDR, LDS, LDX PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDQ = NMAX, LDR = NMAX, LDS = NMAX, $ LDX = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*NMAX ) * .. Local Scalars .. CHARACTER DEF INTEGER I, INFO, ISYMM, J, LBPAR, LDPAR, LIPAR, M, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), B(LDB,MMAX), C(LDC, NMAX), $ DPAR(4), DWORK(LDWORK), Q(LDQ, NMAX), $ R(LDR, NMAX), S(LDS, NMAX), X(LDX, NMAX) INTEGER IPAR(3), NR(2) LOGICAL BPAR(7), VEC(10) CHARACTER CHPAR(255) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL BB02AD, MA02DD * .. Executable Statements .. WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ( NIN, FMT = '()' ) READ( NIN, FMT = * ) DEF READ( NIN, FMT = * ) ( NR(I), I = 1, 2 ) IF( LSAME( DEF, 'N' ) ) THEN READ( NIN, FMT = * ) LBPAR IF( LBPAR.GT.0 ) READ( NIN, FMT = * ) ( BPAR(I), I = 1, LBPAR ) READ( NIN, FMT = * ) LDPAR IF( LDPAR.GT.0 ) READ( NIN, FMT = * ) ( DPAR(I), I = 1, LDPAR ) READ( NIN, FMT = * ) LIPAR IF( LIPAR.GT.0 ) READ( NIN, FMT = * ) ( IPAR(I), I = 1, LIPAR ) END IF * Generate benchmark example CALL BB02AD( DEF, NR, DPAR, IPAR, BPAR, CHPAR, VEC, N, M, P, A, $ LDA, B, LDB, C, LDC, Q, LDQ, R, LDR, S, LDS, X, LDX, $ DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99998 ) INFO ELSE WRITE( NOUT, FMT = * ) CHPAR(1:70) WRITE( NOUT, FMT = 99997 ) N WRITE( NOUT, FMT = 99996 ) M WRITE( NOUT, FMT = 99995 ) P WRITE( NOUT, FMT = 99994 ) DO 10 I = 1, N WRITE( NOUT, FMT = 99977 ) ( A(I,J), J = 1, N ) 10 CONTINUE IF( VEC(5) ) THEN WRITE( NOUT, FMT = 99993 ) DO 20 I = 1, N WRITE( NOUT, FMT = 99977 ) ( B(I,J), J = 1, M ) 20 CONTINUE ELSE WRITE( NOUT, FMT = 99992 ) END IF IF( VEC(6) ) THEN WRITE( NOUT,FMT = 99991 ) DO 30 I = 1, P WRITE( NOUT, FMT = 99977 ) ( C(I,J), J = 1, N ) 30 CONTINUE ELSE WRITE( NOUT, FMT = 99990 ) END IF IF( .NOT.VEC(5) ) THEN WRITE( NOUT, FMT = 99989 ) IF( .NOT.BPAR(2) ) THEN ISYMM = ( N * ( N + 1 ) ) / 2 CALL DCOPY( ISYMM, R, 1, DWORK, 1 ) IF( BPAR(3) ) THEN CALL MA02DD( 'Unpack', 'Upper', N, R, LDR, DWORK ) ELSE CALL MA02DD( 'Unpack', 'Lower', N, R, LDR, DWORK ) END IF END IF DO 40 I = 1, N WRITE( NOUT, FMT = 99977 ) ( R(I,J), J = 1, N ) 40 CONTINUE ELSE WRITE( NOUT, FMT = 99988 ) END IF IF( .NOT.VEC(6) ) THEN IF( .NOT.BPAR(5) ) THEN ISYMM = ( N * ( N + 1 ) ) / 2 CALL DCOPY( ISYMM, Q, 1, DWORK, 1 ) IF( BPAR(6) ) THEN CALL MA02DD( 'Unpack', 'Upper', N, Q, LDQ, DWORK ) ELSE CALL MA02DD( 'Unpack', 'Lower', N, Q, LDQ, DWORK ) END IF END IF WRITE( NOUT, FMT = 99987 ) DO 50 I = 1, N WRITE( NOUT, FMT = 99977 ) ( Q(I,J), J = 1, N ) 50 CONTINUE ELSE WRITE( NOUT, FMT = 99986 ) END IF IF( VEC(6) ) THEN IF( .NOT.BPAR(5) ) THEN ISYMM = ( P * ( P + 1 ) ) / 2 CALL DCOPY( ISYMM, Q, 1, DWORK, 1 ) IF( BPAR(6) ) THEN CALL MA02DD( 'Unpack', 'Upper', P, Q, LDQ, DWORK ) ELSE CALL MA02DD( 'Unpack', 'Lower', P, Q, LDQ, DWORK ) END IF END IF WRITE( NOUT, FMT = 99985 ) DO 60 I = 1, P WRITE( NOUT, FMT = 99977 ) ( Q(I,J), J = 1, P ) 60 CONTINUE ELSE WRITE( NOUT, FMT = 99984 ) END IF IF( VEC(5) ) THEN IF( .NOT.BPAR(2) ) THEN ISYMM = ( M * ( M + 1 ) ) / 2 CALL DCOPY( ISYMM, R, 1, DWORK, 1 ) IF( BPAR(3) ) THEN CALL MA02DD( 'Unpack', 'Upper', M, R, LDR, DWORK ) ELSE CALL MA02DD( 'Unpack', 'Lower', M, R, LDR, DWORK ) END IF END IF WRITE( NOUT, FMT = 99983 ) DO 70 I = 1, M WRITE( NOUT, FMT = 99977 ) ( R(I,J), J = 1, M ) 70 CONTINUE ELSE WRITE( NOUT, FMT = 99982 ) END IF IF( VEC(9) ) THEN WRITE( NOUT, FMT = 99981 ) DO 80 I = 1, N WRITE( NOUT, FMT = 99977 ) ( S(I,J), J = 1, M ) 80 CONTINUE ELSE WRITE( NOUT, FMT = 99980 ) END IF IF( VEC(10) ) THEN WRITE( NOUT, FMT = 99979 ) DO 90 I = 1, N WRITE( NOUT, FMT = 99977 ) ( X(I,J), J = 1, N ) 90 CONTINUE ELSE WRITE( NOUT, FMT = 99978 ) END IF END IF STOP * 99999 FORMAT (' BB02AD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from BB02AD = ', I3) 99997 FORMAT (/' Order of matrix A: N = ', I3) 99996 FORMAT (' Number of columns in matrix B: M = ', I3) 99995 FORMAT (' Number of rows in matrix C: P = ', I3) 99994 FORMAT (' A = ') 99993 FORMAT (' B = ') 99992 FORMAT (' B is not provided.') 99991 FORMAT (' C = ') 99990 FORMAT (' C is not provided.') 99989 FORMAT (' G = ') 99988 FORMAT (' G is not provided.') 99987 FORMAT (' Q = ') 99986 FORMAT (' Q is not provided.') 99985 FORMAT (' Q0 = ') 99984 FORMAT (' Q0 is not provided.') 99983 FORMAT (' R = ') 99982 FORMAT (' R is not provided.') 99981 FORMAT (' S = ') 99980 FORMAT (' S is not provided.') 99979 FORMAT (' X = ') 99978 FORMAT (' X is not provided.') 99977 FORMAT (20(1X,F8.4)) * ENDProgram Data
BB02AD EXAMPLE PROGRAM DATA N 2 3 7 .T. .T. .T. .F. .F. .T. .T. 1 .1234 0Program Results
BB02AD EXAMPLE PROGRAM RESULTS increasingly bad scaled system as eps -> oo Order of matrix A: N = 2 Number of columns in matrix B: M = 1 Number of rows in matrix C: P = 2 A = 0.0000 0.1234 0.0000 0.0000 B = 0.0000 1.0000 C is not provided. G is not provided. Q = 1.0000 0.0000 0.0000 1.0000 Q0 is not provided. R = 1.0000 S = 0.0000 0.0000 X = 1.0000 0.0000 0.0000 1.0152
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/BB03AD.html 0000664 0000000 0000000 00000030552 14560147231 0020312 0 ustar 00root root 0000000 0000000
Purpose
To generate benchmark examples of (generalized) continuous-time Lyapunov equations T T A X E + E X A = Y . In some examples, the right hand side has the form T Y = - B B and the solution can be represented as a product of Cholesky factors T X = U U . E, A, Y, X, and U are real N-by-N matrices, and B is M-by-N. Note that E can be the identity matrix. For some examples, B, X, or U are not provided. This routine is an implementation of the benchmark library CTLEX (Version 1.0) described in [1].Specification
SUBROUTINE BB03AD(DEF, NR, DPAR, IPAR, VEC, N, M, E, LDE, A, LDA, 1 Y, LDY, B, LDB, X, LDX, U, LDU, NOTE, DWORK, 2 LDWORK, INFO) C .. Scalar Arguments .. CHARACTER DEF CHARACTER*70 NOTE INTEGER INFO, LDA, LDB, LDE, LDU, LDWORK, LDX, LDY, M, N C .. Array Arguments .. LOGICAL VEC(8) INTEGER IPAR(*), NR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), DPAR(*), DWORK(LDWORK), 1 E(LDE,*), U(LDU,*), X(LDX,*), Y(LDY,*)Arguments
Mode Parameters
DEF CHARACTER*1 Specifies the kind of values used as parameters when generating parameter-dependent and scalable examples (i.e., examples with NR(1) = 2, 3, or 4): DEF = 'D' or 'd': Default values are used. DEF = 'N' or 'n': Values set in DPAR and IPAR are used. This parameter is not referenced if NR(1) = 1. Note that the scaling parameter of examples with NR(1) = 3 or 4 is considered as a regular parameter in this context.Input/Output Parameters
NR (input) INTEGER array, dimension 2 Specifies the index of the desired example according to [1]. NR(1) defines the group: 1 : parameter-free problems of fixed size 2 : parameter-dependent problems of fixed size 3 : parameter-free problems of scalable size 4 : parameter-dependent problems of scalable size NR(2) defines the number of the benchmark example within a certain group according to [1]. DPAR (input/output) DOUBLE PRECISION array, dimension 2 On entry, if DEF = 'N' or 'n' and the desired example depends on real parameters, then the array DPAR must contain the values for these parameters. For an explanation of the parameters see [1]. For Example 4.1, DPAR(1) and DPAR(2) define 'r' and 's', respectively. For Example 4.2, DPAR(1) and DPAR(2) define 'lambda' and 's', respectively. For Examples 4.3 and 4.4, DPAR(1) defines the parameter 't'. On exit, if DEF = 'D' or 'd' and the desired example depends on real parameters, then the array DPAR is overwritten by the default values given in [1]. IPAR (input/output) INTEGER array of DIMENSION at least 1 On entry, if DEF = 'N' or 'n' and the desired example depends on integer parameters, then the array IPAR must contain the values for these parameters. For an explanation of the parameters see [1]. For Examples 4.1, 4.2, and 4.3, IPAR(1) defines 'n'. For Example 4.4, IPAR(1) defines 'q'. On exit, if DEF = 'D' or 'd' and the desired example depends on integer parameters, then the array IPAR is overwritten by the default values given in [1]. VEC (output) LOGICAL array, dimension 8 Flag vector which displays the availability of the output data: VEC(1) and VEC(2) refer to N and M, respectively, and are always .TRUE. VEC(3) is .TRUE. iff E is NOT the identity matrix. VEC(4) and VEC(5) refer to A and Y, respectively, and are always .TRUE. VEC(6) is .TRUE. iff B is provided. VEC(7) is .TRUE. iff the solution matrix X is provided. VEC(8) is .TRUE. iff the Cholesky factor U is provided. N (output) INTEGER The actual state dimension, i.e., the order of the matrices E and A. M (output) INTEGER The number of rows in the matrix B. If B is not provided for the desired example, M = 0 is returned. E (output) DOUBLE PRECISION array, dimension (LDE,N) The leading N-by-N part of this array contains the matrix E. NOTE that this array is overwritten (by the identity matrix), if VEC(3) = .FALSE. LDE INTEGER The leading dimension of array E. LDE >= N. A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array contains the matrix A. LDA INTEGER The leading dimension of array A. LDA >= N. Y (output) DOUBLE PRECISION array, dimension (LDY,N) The leading N-by-N part of this array contains the matrix Y. LDY INTEGER The leading dimension of array Y. LDY >= N. B (output) DOUBLE PRECISION array, dimension (LDB,N) The leading M-by-N part of this array contains the matrix B. LDB INTEGER The leading dimension of array B. LDB >= M. X (output) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array contains the matrix X. LDX INTEGER The leading dimension of array X. LDX >= N. U (output) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array contains the matrix U. LDU INTEGER The leading dimension of array U. LDU >= N. NOTE (output) CHARACTER*70 String containing short information about the chosen example.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. For Examples 4.1 and 4.2., LDWORK >= 2*IPAR(1) is required. For the other examples, no workspace is needed, i.e., LDWORK >= 1.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; in particular, INFO = -3 or -4 indicates that at least one of the parameters in DPAR or IPAR, respectively, has an illegal value.References
[1] D. Kressner, V. Mehrmann, and T. Penzl. CTLEX - a Collection of Benchmark Examples for Continuous- Time Lyapunov Equations. SLICOT Working Note 1999-6, 1999.Numerical Aspects
NoneFurther Comments
NoneExample
Program Text
C BB03AD EXAMPLE PROGRAM TEXT C C .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN = 5, NOUT = 6) INTEGER NMAX, MMAX PARAMETER (NMAX = 100, MMAX = 100) INTEGER LDE, LDA, LDY, LDB, LDX, LDU, LDWORK PARAMETER (LDE = NMAX, LDA = NMAX, LDY = NMAX, LDB = MMAX, 1 LDX = NMAX, LDU = NMAX, LDWORK = 2*NMAX) C .. Local Scalars .. CHARACTER DEF INTEGER INFO, N, M, I, J, LDPAR, LIPAR CHARACTER*70 NOTE C .. Local Arrays .. DOUBLE PRECISION E(LDE,NMAX), A(LDA, NMAX), Y(LDY, NMAX), 1 B(LDB,NMAX), X(LDX, NMAX), U(LDU, NMAX), 2 DPAR(2), DWORK(LDWORK) INTEGER NR(2), IPAR(1) LOGICAL VEC(8) C .. External Functions .. LOGICAL LSAME EXTERNAL LSAME C .. External Subroutines .. EXTERNAL BB03AD C .. Executable Statements .. WRITE (NOUT, FMT = 99999) C Skip the heading in the data file and read the data. READ (NIN, FMT = '()') READ (NIN, FMT = *) DEF READ (NIN, FMT = *) (NR(I), I = 1, 2) IF (LSAME(DEF,'N')) THEN READ (NIN, FMT = *) LDPAR IF (LDPAR .GT. 0) READ (NIN, FMT = *) (DPAR(I), I = 1, LDPAR) READ (NIN, FMT = *) LIPAR IF (LIPAR .GT. 0) READ (NIN, FMT = *) (IPAR(I), I = 1, LIPAR) END IF C Generate benchmark example CALL BB03AD(DEF, NR, DPAR, IPAR, VEC, N, M, E, LDE, A, LDA, Y, 1 LDY, B, LDB, X, LDX, U, LDU, NOTE, DWORK, LDWORK, 2 INFO) C IF (INFO .NE. 0) THEN WRITE (NOUT, FMT = 99998) INFO ELSE WRITE (NOUT, FMT = *) NOTE WRITE (NOUT, FMT = 99997) N WRITE (NOUT, FMT = 99996) M IF (VEC(3)) THEN WRITE (NOUT, FMT = 99995) DO 10 I = 1, N WRITE (NOUT, FMT = 99985) (E(I,J), J = 1, N) 10 CONTINUE ELSE WRITE (NOUT, FMT = 99994) END IF WRITE (NOUT,FMT = 99993) DO 20 I = 1, N WRITE (NOUT, FMT = 99985) (A(I,J), J = 1, N) 20 CONTINUE IF (VEC(6)) THEN WRITE (NOUT,FMT = 99992) DO 30 I = 1, M WRITE (NOUT, FMT = 99985) (B(I,J), J = 1, N) 30 CONTINUE ELSE WRITE (NOUT, FMT = 99991) END IF WRITE (NOUT,FMT = 99990) DO 40 I = 1, N WRITE (NOUT, FMT = 99985) (Y(I,J), J = 1, N) 40 CONTINUE IF (VEC(7)) THEN WRITE (NOUT, FMT = 99989) DO 50 I = 1, N WRITE (NOUT, FMT = 99985) (X(I,J), J = 1, N) 50 CONTINUE ELSE WRITE (NOUT, FMT = 99988) END IF IF (VEC(8)) THEN WRITE (NOUT, FMT = 99987) DO 60 I = 1, N WRITE (NOUT, FMT = 99985) (U(I,J), J = 1, N) 60 CONTINUE ELSE WRITE (NOUT, FMT = 99986) END IF END IF C 99999 FORMAT (' BB03AD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from BB03AD = ', I3) 99997 FORMAT (/' Order of matrix A: N = ', I3) 99996 FORMAT (' Number of rows in matrix B: M = ', I3) 99995 FORMAT (/' E = ') 99994 FORMAT (/' E is the identity matrix.') 99993 FORMAT (' A = ') 99992 FORMAT (' B = ') 99991 FORMAT (' B is not provided.') 99990 FORMAT (' Y = ') 99989 FORMAT (' X = ') 99988 FORMAT (' X is not provided.') 99987 FORMAT (' U = ') 99986 FORMAT (' U is not provided.') 99985 FORMAT (20(1X,F8.4)) C ENDProgram Data
BB03AD EXAMPLE PROGRAM DATA N 4 1 2 .15D1 .15D1 1 5Program Results
BB03AD EXAMPLE PROGRAM RESULTS CTLEX: Example 4.1 Order of matrix A: N = 5 Number of rows in matrix B: M = 1 E is the identity matrix. A = -3.6360 -0.6921 -1.1933 -0.8137 0.3507 0.1406 -2.9375 0.9063 0.1562 0.3438 -2.5735 -1.4421 -2.8183 -1.1887 1.2257 -0.3779 0.0810 0.5544 -1.5891 0.0660 0.8961 1.1586 1.6279 0.5631 -2.2066 B = -3.6914 -3.9753 -0.0247 -1.9012 1.1111 Y = -13.6261 -14.6743 -0.0911 -7.0181 4.1015 -14.6743 -15.8031 -0.0982 -7.5580 4.4170 -0.0911 -0.0982 -0.0006 -0.0469 0.0274 -7.0181 -7.5580 -0.0469 -3.6147 2.1125 4.1015 4.4170 0.0274 2.1125 -1.2346 X = 1.7737 1.9307 -0.0703 1.0497 -0.4681 1.9307 2.1036 -0.0752 1.1489 -0.5069 -0.0703 -0.0752 0.0076 -0.0428 0.0178 1.0497 1.1489 -0.0428 0.6509 -0.2651 -0.4681 -0.5069 0.0178 -0.2651 0.1284 U is not provided.
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/BB04AD.html 0000664 0000000 0000000 00000030544 14560147231 0020314 0 ustar 00root root 0000000 0000000
Purpose
To generate benchmark examples of (generalized) discrete-time Lyapunov equations T T A X A - E X E = Y . In some examples, the right hand side has the form T Y = - B B and the solution can be represented as a product of Cholesky factors T X = U U . E, A, Y, X, and U are real N-by-N matrices, and B is M-by-N. Note that E can be the identity matrix. For some examples, B, X, or U are not provided. This routine is an implementation of the benchmark library DTLEX (Version 1.0) described in [1].Specification
SUBROUTINE BB04AD(DEF, NR, DPAR, IPAR, VEC, N, M, E, LDE, A, LDA, 1 Y, LDY, B, LDB, X, LDX, U, LDU, NOTE, DWORK, 2 LDWORK, INFO) C .. Scalar Arguments .. CHARACTER DEF CHARACTER*70 NOTE INTEGER INFO, LDA, LDB, LDE, LDU, LDWORK, LDX, LDY, M, N C .. Array Arguments .. LOGICAL VEC(8) INTEGER IPAR(*), NR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), DPAR(*), DWORK(LDWORK), 1 E(LDE,*), U(LDU,*), X(LDX,*), Y(LDY,*)Arguments
Mode Parameters
DEF CHARACTER*1 Specifies the kind of values used as parameters when generating parameter-dependent and scalable examples (i.e., examples with NR(1) = 2, 3, or 4): DEF = 'D' or 'd': Default values are used. DEF = 'N' or 'n': Values set in DPAR and IPAR are used. This parameter is not referenced if NR(1) = 1. Note that the scaling parameter of examples with NR(1) = 3 or 4 is considered as a regular parameter in this context.Input/Output Parameters
NR (input) INTEGER array, dimension 2 Specifies the index of the desired example according to [1]. NR(1) defines the group: 1 : parameter-free problems of fixed size 2 : parameter-dependent problems of fixed size 3 : parameter-free problems of scalable size 4 : parameter-dependent problems of scalable size NR(2) defines the number of the benchmark example within a certain group according to [1]. DPAR (input/output) DOUBLE PRECISION array, dimension 2 On entry, if DEF = 'N' or 'n' and the desired example depends on real parameters, then the array DPAR must contain the values for these parameters. For an explanation of the parameters see [1]. For Example 4.1, DPAR(1) and DPAR(2) define 'r' and 's', respectively. For Example 4.2, DPAR(1) and DPAR(2) define 'lambda' and 's', respectively. For Examples 4.3 and 4.4, DPAR(1) defines the parameter 't'. On exit, if DEF = 'D' or 'd' and the desired example depends on real parameters, then the array DPAR is overwritten by the default values given in [1]. IPAR (input/output) INTEGER array of DIMENSION at least 1 On entry, if DEF = 'N' or 'n' and the desired example depends on integer parameters, then the array IPAR must contain the values for these parameters. For an explanation of the parameters see [1]. For Examples 4.1, 4.2, and 4.3, IPAR(1) defines 'n'. For Example 4.4, IPAR(1) defines 'q'. On exit, if DEF = 'D' or 'd' and the desired example depends on integer parameters, then the array IPAR is overwritten by the default values given in [1]. VEC (output) LOGICAL array, dimension 8 Flag vector which displays the availability of the output data: VEC(1) and VEC(2) refer to N and M, respectively, and are always .TRUE. VEC(3) is .TRUE. iff E is NOT the identity matrix. VEC(4) and VEC(5) refer to A and Y, respectively, and are always .TRUE. VEC(6) is .TRUE. iff B is provided. VEC(7) is .TRUE. iff the solution matrix X is provided. VEC(8) is .TRUE. iff the Cholesky factor U is provided. N (output) INTEGER The actual state dimension, i.e., the order of the matrices E and A. M (output) INTEGER The number of rows in the matrix B. If B is not provided for the desired example, M = 0 is returned. E (output) DOUBLE PRECISION array, dimension (LDE,N) The leading N-by-N part of this array contains the matrix E. NOTE that this array is overwritten (by the identity matrix), if VEC(3) = .FALSE. LDE INTEGER The leading dimension of array E. LDE >= N. A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array contains the matrix A. LDA INTEGER The leading dimension of array A. LDA >= N. Y (output) DOUBLE PRECISION array, dimension (LDY,N) The leading N-by-N part of this array contains the matrix Y. LDY INTEGER The leading dimension of array Y. LDY >= N. B (output) DOUBLE PRECISION array, dimension (LDB,N) The leading M-by-N part of this array contains the matrix B. LDB INTEGER The leading dimension of array B. LDB >= M. X (output) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array contains the matrix X. LDX INTEGER The leading dimension of array X. LDX >= N. U (output) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array contains the matrix U. LDU INTEGER The leading dimension of array U. LDU >= N. NOTE (output) CHARACTER*70 String containing short information about the chosen example.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. For Examples 4.1 and 4.2., LDWORK >= 2*IPAR(1) is required. For the other examples, no workspace is needed, i.e., LDWORK >= 1.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; in particular, INFO = -3 or -4 indicates that at least one of the parameters in DPAR or IPAR, respectively, has an illegal value.References
[1] D. Kressner, V. Mehrmann, and T. Penzl. DTLEX - a Collection of Benchmark Examples for Discrete- Time Lyapunov Equations. SLICOT Working Note 1999-7, 1999.Numerical Aspects
NoneFurther Comments
NoneExample
Program Text
C BB04AD EXAMPLE PROGRAM TEXT C C .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN = 5, NOUT = 6) INTEGER NMAX, MMAX PARAMETER (NMAX = 100, MMAX = 100) INTEGER LDE, LDA, LDY, LDB, LDX, LDU, LDWORK PARAMETER (LDE = NMAX, LDA = NMAX, LDY = NMAX, LDB = MMAX, 1 LDX = NMAX, LDU = NMAX, LDWORK = 2*NMAX) C .. Local Scalars .. CHARACTER DEF INTEGER INFO, N, M, I, J, LDPAR, LIPAR CHARACTER*70 NOTE C .. Local Arrays .. DOUBLE PRECISION E(LDE,NMAX), A(LDA, NMAX), Y(LDY, NMAX), 1 B(LDB,NMAX), X(LDX, NMAX), U(LDU, NMAX), 2 DPAR(2), DWORK(LDWORK) INTEGER NR(2), IPAR(1) LOGICAL VEC(8) C .. External Functions .. LOGICAL LSAME EXTERNAL LSAME C .. External Subroutines .. EXTERNAL BB04AD C .. Executable Statements .. WRITE (NOUT, FMT = 99999) C Skip the heading in the data file and read the data. READ (NIN, FMT = '()') READ (NIN, FMT = *) DEF READ (NIN, FMT = *) (NR(I), I = 1, 2) IF (LSAME(DEF,'N')) THEN READ (NIN, FMT = *) LDPAR IF (LDPAR .GT. 0) READ (NIN, FMT = *) (DPAR(I), I = 1, LDPAR) READ (NIN, FMT = *) LIPAR IF (LIPAR .GT. 0) READ (NIN, FMT = *) (IPAR(I), I = 1, LIPAR) END IF C Generate benchmark example CALL BB04AD(DEF, NR, DPAR, IPAR, VEC, N, M, E, LDE, A, LDA, Y, 1 LDY, B, LDB, X, LDX, U, LDU, NOTE, DWORK, LDWORK, 2 INFO) C IF (INFO .NE. 0) THEN WRITE (NOUT, FMT = 99998) INFO ELSE WRITE (NOUT, FMT = *) NOTE WRITE (NOUT, FMT = 99997) N WRITE (NOUT, FMT = 99996) M IF (VEC(3)) THEN WRITE (NOUT, FMT = 99995) DO 10 I = 1, N WRITE (NOUT, FMT = 99985) (E(I,J), J = 1, N) 10 CONTINUE ELSE WRITE (NOUT, FMT = 99994) END IF WRITE (NOUT,FMT = 99993) DO 20 I = 1, N WRITE (NOUT, FMT = 99985) (A(I,J), J = 1, N) 20 CONTINUE IF (VEC(6)) THEN WRITE (NOUT,FMT = 99992) DO 30 I = 1, M WRITE (NOUT, FMT = 99985) (B(I,J), J = 1, N) 30 CONTINUE ELSE WRITE (NOUT, FMT = 99991) END IF WRITE (NOUT,FMT = 99990) DO 40 I = 1, N WRITE (NOUT, FMT = 99985) (Y(I,J), J = 1, N) 40 CONTINUE IF (VEC(7)) THEN WRITE (NOUT, FMT = 99989) DO 50 I = 1, N WRITE (NOUT, FMT = 99985) (X(I,J), J = 1, N) 50 CONTINUE ELSE WRITE (NOUT, FMT = 99988) END IF IF (VEC(8)) THEN WRITE (NOUT, FMT = 99987) DO 60 I = 1, N WRITE (NOUT, FMT = 99985) (U(I,J), J = 1, N) 60 CONTINUE ELSE WRITE (NOUT, FMT = 99986) END IF END IF C 99999 FORMAT (' BB04AD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from BB04AD = ', I3) 99997 FORMAT (/' Order of matrix A: N = ', I3) 99996 FORMAT (' Number of rows in matrix B: M = ', I3) 99995 FORMAT (/' E = ') 99994 FORMAT (/' E is the identity matrix.') 99993 FORMAT (' A = ') 99992 FORMAT (' B = ') 99991 FORMAT (' B is not provided.') 99990 FORMAT (' Y = ') 99989 FORMAT (' X = ') 99988 FORMAT (' X is not provided.') 99987 FORMAT (' U = ') 99986 FORMAT (' U is not provided.') 99985 FORMAT (20(1X,F8.4)) C ENDProgram Data
BB04AD EXAMPLE PROGRAM DATA N 4 1 2 .15D1 .15D1 1 5Program Results
BB04AD EXAMPLE PROGRAM RESULTS DTLEX: Example 4.1 Order of matrix A: N = 5 Number of rows in matrix B: M = 1 E is the identity matrix. A = 0.4562 0.0308 0.1990 0.0861 0.0217 0.0637 0.5142 -0.1828 0.0096 -0.1148 0.3139 0.1287 0.3484 0.1653 -0.1975 0.1500 0.0053 -0.1838 0.2501 -0.0687 0.0568 -0.1006 -0.3735 -0.0202 0.2285 B = 0.3086 0.0247 -0.4691 0.1728 -0.3704 Y = -0.0953 -0.0076 0.1448 -0.0533 0.1143 -0.0076 -0.0006 0.0116 -0.0043 0.0091 0.1448 0.0116 -0.2201 0.0811 -0.1738 -0.0533 -0.0043 0.0811 -0.0299 0.0640 0.1143 0.0091 -0.1738 0.0640 -0.1372 X = 0.0953 0.0076 -0.1448 0.0533 -0.1143 0.0076 0.0006 -0.0116 0.0043 -0.0091 -0.1448 -0.0116 0.2201 -0.0811 0.1738 0.0533 0.0043 -0.0811 0.0299 -0.0640 -0.1143 -0.0091 0.1738 -0.0640 0.1372 U is not provided.
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/BD01AD.html 0000664 0000000 0000000 00000027015 14560147231 0020312 0 ustar 00root root 0000000 0000000
Purpose
To generate benchmark examples for time-invariant, continuous-time dynamical systems . E x(t) = A x(t) + B u(t) y(t) = C x(t) + D u(t) E, A are real N-by-N matrices, B is N-by-M, C is P-by-N, and D is P-by-M. In many examples, E is the identity matrix and D is the zero matrix. This routine is an implementation of the benchmark library CTDSX (Version 1.0) described in [1].Specification
SUBROUTINE BD01AD( DEF, NR, DPAR, IPAR, VEC, N, M, P, E, LDE, A, 1 LDA, B, LDB, C, LDC, D, LDD, NOTE, DWORK, 2 LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DEF CHARACTER*70 NOTE INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDWORK, M, N, P C .. Array Arguments .. LOGICAL VEC(8) INTEGER IPAR(*), NR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), DPAR(*), 1 DWORK(*), E(LDE,*)Arguments
Mode Parameters
DEF CHARACTER*1 Specifies the kind of values used as parameters when generating parameter-dependent and scalable examples (i.e., examples with NR(1) = 2, 3, or 4): = 'D': Default values defined in [1] are used; = 'N': Values set in DPAR and IPAR are used. This parameter is not referenced if NR(1) = 1. Note that the scaling parameter of examples with NR(1) = 3 or 4 is considered as a regular parameter in this context.Input/Output Parameters
NR (input) INTEGER array, dimension (2) Specifies the index of the desired example according to [1]. NR(1) defines the group: 1 : parameter-free problems of fixed size 2 : parameter-dependent problems of fixed size 3 : parameter-free problems of scalable size 4 : parameter-dependent problems of scalable size NR(2) defines the number of the benchmark example within a certain group according to [1]. DPAR (input/output) DOUBLE PRECISION array, dimension (7) On entry, if DEF = 'N' and the desired example depends on real parameters, then the array DPAR must contain the values for these parameters. For an explanation of the parameters see [1]. For Examples 2.1 and 2.2, DPAR(1) defines the parameter 'epsilon'. For Example 2.4, DPAR(1), ..., DPAR(7) define 'b', 'mu', 'r', 'r_c', 'k_l', 'sigma', 'a', respectively. For Example 2.7, DPAR(1) and DPAR(2) define 'mu' and 'nu', respectively. For Example 4.1, DPAR(1), ..., DPAR(7) define 'a', 'b', 'c', 'beta_1', 'beta_2', 'gamma_1', 'gamma_2', respectively. For Example 4.2, DPAR(1), ..., DPAR(3) define 'mu', 'delta', 'kappa', respectively. On exit, if DEF = 'D' and the desired example depends on real parameters, then the array DPAR is overwritten by the default values given in [1]. IPAR (input/output) INTEGER array, dimension (1) On entry, if DEF = 'N' and the desired example depends on integer parameters, then the array IPAR must contain the values for these parameters. For an explanation of the parameters see [1]. For Examples 2.3, 2.5, and 2.6, IPAR(1) defines the parameter 's'. For Example 3.1, IPAR(1) defines 'q'. For Examples 3.2 and 3.3, IPAR(1) defines 'n'. For Example 3.4, IPAR(1) defines 'l'. For Example 4.1, IPAR(1) defines 'n'. For Example 4.2, IPAR(1) defines 'l'. On exit, if DEF = 'D' and the desired example depends on integer parameters, then the array IPAR is overwritten by the default values given in [1]. VEC (output) LOGICAL array, dimension (8) Flag vector which displays the availabilty of the output data: VEC(1), ..., VEC(3) refer to N, M, and P, respectively, and are always .TRUE.. VEC(4) is .TRUE. iff E is NOT the identity matrix. VEC(5), ..., VEC(7) refer to A, B, and C, respectively, and are always .TRUE.. VEC(8) is .TRUE. iff D is NOT the zero matrix. N (output) INTEGER The actual state dimension, i.e., the order of the matrices E and A. M (output) INTEGER The number of columns in the matrices B and D. P (output) INTEGER The number of rows in the matrices C and D. E (output) DOUBLE PRECISION array, dimension (LDE,N) The leading N-by-N part of this array contains the matrix E. NOTE that this array is overwritten (by the identity matrix), if VEC(4) = .FALSE.. LDE INTEGER The leading dimension of array E. LDE >= N. A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array contains the matrix A. LDA INTEGER The leading dimension of array A. LDA >= N. B (output) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array contains the matrix B. LDB INTEGER The leading dimension of array B. LDB >= N. C (output) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array contains the matrix C. LDC INTEGER The leading dimension of array C. LDC >= P. D (output) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array contains the matrix D. NOTE that this array is overwritten (by the zero matrix), if VEC(8) = .FALSE.. LDD INTEGER The leading dimension of array D. LDD >= P. NOTE (output) CHARACTER*70 String containing short information about the chosen example.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. For Example 3.4, LDWORK >= 4*IPAR(1) is required. For the other examples, no workspace is needed, i.e., LDWORK >= 1.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; in particular, INFO = -3 or -4 indicates that at least one of the parameters in DPAR or IPAR, respectively, has an illegal value; = 1: data file can not be opened or has wrong format.References
[1] Kressner, D., Mehrmann, V. and Penzl, T. CTDSX - a Collection of Benchmark Examples for State-Space Realizations of Continuous-Time Dynamical Systems. SLICOT Working Note 1998-9. 1998.Numerical Aspects
NoneFurther Comments
NoneExample
Program Text
C BD01AD EXAMPLE PROGRAM TEXT C C .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN = 5, NOUT = 6) INTEGER NMAX, MMAX, PMAX PARAMETER (NMAX = 421, MMAX = 211, PMAX = 211) INTEGER LDA, LDB, LDC, LDD, LDE, LDWORK PARAMETER (LDA = NMAX, LDB = NMAX, LDC = PMAX, LDD = PMAX, 1 LDE = NMAX, LDWORK = 4*NMAX) C .. Local Scalars .. CHARACTER DEF INTEGER I, INFO, J, LDPAR, LIPAR, M, N, P CHARACTER*70 NOTE C .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), 1 D(LDD,MMAX), DPAR(7), DWORK(LDWORK), E(LDE,NMAX) INTEGER NR(2), IPAR(7) LOGICAL VEC(8) C .. External Functions .. LOGICAL LSAME EXTERNAL LSAME C .. External Subroutines .. EXTERNAL BD01AD C .. Executable Statements .. WRITE (NOUT, FMT = 99999) C Skip the heading in the data file and read the data. READ (NIN, FMT = '()') READ (NIN, FMT = *) DEF READ (NIN, FMT = *) (NR(I), I = 1, 2) IF (LSAME(DEF,'N')) THEN READ (NIN, FMT = *) LDPAR IF (LDPAR .GT. 0) READ (NIN, FMT = *) (DPAR(I), I = 1, LDPAR) READ (NIN, FMT = *) LIPAR IF (LIPAR .GT. 0) READ (NIN, FMT = *) (IPAR(I), I = 1, LIPAR) END IF C Generate benchmark example CALL BD01AD(DEF, NR, DPAR, IPAR, VEC, N, M, P, E, LDE, A, LDA, 1 B, LDB, C, LDC, D, LDD, NOTE, DWORK, LDWORK, INFO) C IF (INFO .NE. 0) THEN WRITE (NOUT, FMT = 99998) INFO ELSE WRITE (NOUT, FMT = *) NOTE WRITE (NOUT, FMT = 99997) N WRITE (NOUT, FMT = 99996) M WRITE (NOUT, FMT = 99995) P IF (VEC(4)) THEN WRITE (NOUT, FMT = 99994) DO 10 I = 1, N WRITE (NOUT, FMT = 99987) (E(I,J), J = 1, N) 10 CONTINUE ELSE WRITE (NOUT, FMT = 99993) END IF WRITE (NOUT,FMT = 99992) DO 20 I = 1, N WRITE (NOUT, FMT = 99987) (A(I,J), J = 1, N) 20 CONTINUE WRITE (NOUT,FMT = 99991) DO 30 I = 1, N WRITE (NOUT, FMT = 99987) (B(I,J), J = 1, M) 30 CONTINUE WRITE (NOUT,FMT = 99990) DO 40 I = 1, P WRITE (NOUT, FMT = 99987) (C(I,J), J = 1, N) 40 CONTINUE IF (VEC(8)) THEN WRITE (NOUT,FMT = 99989) DO 50 I = 1, P WRITE (NOUT, FMT = 99987) (D(I,J), J = 1, M) 50 CONTINUE ELSE WRITE (NOUT, FMT = 99988) END IF END IF C 99999 FORMAT (' BD01AD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from BD01AD = ', I3) 99997 FORMAT (/' Order of matrix A: N = ', I3) 99996 FORMAT (' Number of columns in matrix B: M = ', I3) 99995 FORMAT (' Number of rows in matrix C: P = ', I3) 99994 FORMAT (/' E = ') 99993 FORMAT (/' E is the identity matrix.') 99992 FORMAT (' A = ') 99991 FORMAT (' B = ') 99990 FORMAT (' C = ') 99989 FORMAT (' D = ') 99988 FORMAT (' D is of zeros.') 99987 FORMAT (20(1X,F8.4)) C ENDProgram Data
BD01AD EXAMPLE PROGRAM DATA D 1 1Program Results
BD01AD EXAMPLE PROGRAM RESULTS Laub 1979, Ex.1 Order of matrix A: N = 2 Number of columns in matrix B: M = 1 Number of rows in matrix C: P = 2 E is the identity matrix. A = 0.0000 1.0000 0.0000 0.0000 B = 0.0000 1.0000 C = 1.0000 0.0000 0.0000 1.0000 D is of zeros.
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/BD02AD.html 0000664 0000000 0000000 00000025307 14560147231 0020315 0 ustar 00root root 0000000 0000000
Purpose
To generate benchmark examples for time-invariant, discrete-time dynamical systems E x_k+1 = A x_k + B u_k y_k = C x_k + D u_k E, A are real N-by-N matrices, B is N-by-M, C is P-by-N, and D is P-by-M. In many examples, E is the identity matrix and D is the zero matrix. This routine is an implementation of the benchmark library DTDSX (Version 1.0) described in [1].Specification
SUBROUTINE BD02AD( DEF, NR, DPAR, IPAR, VEC, N, M, P, E, LDE, A, 1 LDA, B, LDB, C, LDC, D, LDD, NOTE, DWORK, 2 LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DEF CHARACTER*70 NOTE INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDWORK, M, N, P C .. Array Arguments .. LOGICAL VEC(8) INTEGER IPAR(*), NR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), DPAR(*), 1 DWORK(*), E(LDE,*)Arguments
Mode Parameters
DEF CHARACTER*1 Specifies the kind of values used as parameters when generating parameter-dependent and scalable examples (i.e., examples with NR(1) = 2, 3, or 4): = 'D': Default values defined in [1] are used; = 'N': Values set in DPAR and IPAR are used. This parameter is not referenced if NR(1) = 1. Note that the scaling parameter of examples with NR(1) = 3 or 4 is considered as a regular parameter in this context.Input/Output Parameters
NR (input) INTEGER array, dimension (2) Specifies the index of the desired example according to [1]. NR(1) defines the group: 1 : parameter-free problems of fixed size 2 : parameter-dependent problems of fixed size 3 : parameter-free problems of scalable size 4 : parameter-dependent problems of scalable size NR(2) defines the number of the benchmark example within a certain group according to [1]. DPAR (input/output) DOUBLE PRECISION array, dimension (7) On entry, if DEF = 'N' and the desired example depends on real parameters, then the array DPAR must contain the values for these parameters. For an explanation of the parameters see [1]. For Example 2.1, DPAR(1), ..., DPAR(3) define the parameters 'tau', 'delta', 'K', respectively. On exit, if DEF = 'D' and the desired example depends on real parameters, then the array DPAR is overwritten by the default values given in [1]. IPAR (input/output) INTEGER array, dimension (1) On entry, if DEF = 'N' and the desired example depends on integer parameters, then the array IPAR must contain the values for these parameters. For an explanation of the parameters see [1]. For Example 3.1, IPAR(1) defines the parameter 'n'. On exit, if DEF = 'D' and the desired example depends on integer parameters, then the array IPAR is overwritten by the default values given in [1]. VEC (output) LOGICAL array, dimension (8) Flag vector which displays the availabilty of the output data: VEC(1), ..., VEC(3) refer to N, M, and P, respectively, and are always .TRUE.. VEC(4) is .TRUE. iff E is NOT the identity matrix. VEC(5), ..., VEC(7) refer to A, B, and C, respectively, and are always .TRUE.. VEC(8) is .TRUE. iff D is NOT the zero matrix. N (output) INTEGER The actual state dimension, i.e., the order of the matrices E and A. M (output) INTEGER The number of columns in the matrices B and D. P (output) INTEGER The number of rows in the matrices C and D. E (output) DOUBLE PRECISION array, dimension (LDE,N) The leading N-by-N part of this array contains the matrix E. NOTE that this array is overwritten (by the identity matrix), if VEC(4) = .FALSE.. LDE INTEGER The leading dimension of array E. LDE >= N. A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array contains the matrix A. LDA INTEGER The leading dimension of array A. LDA >= N. B (output) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array contains the matrix B. LDB INTEGER The leading dimension of array B. LDB >= N. C (output) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array contains the matrix C. LDC INTEGER The leading dimension of array C. LDC >= P. D (output) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array contains the matrix D. NOTE that this array is overwritten (by the zero matrix), if VEC(8) = .FALSE.. LDD INTEGER The leading dimension of array D. LDD >= P. NOTE (output) CHARACTER*70 String containing short information about the chosen example.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) NOTE that DWORK is not used in the current version of BD02AD. LDWORK INTEGER LDWORK >= 1.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; in particular, INFO = -3 or -4 indicates that at least one of the parameters in DPAR or IPAR, respectively, has an illegal value; = 1: data file can not be opened or has wrong format.References
[1] Kressner, D., Mehrmann, V. and Penzl, T. DTDSX - a Collection of Benchmark Examples for State-Space Realizations of Discrete-Time Dynamical Systems. SLICOT Working Note 1998-10. 1998.Numerical Aspects
NoneFurther Comments
NoneExample
Program Text
C BD02AD EXAMPLE PROGRAM TEXT C C .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN = 5, NOUT = 6) INTEGER NMAX, MMAX, PMAX PARAMETER (NMAX = 421, MMAX = 211, PMAX = 211) INTEGER LDA, LDB, LDC, LDD, LDE, LDWORK PARAMETER (LDA = NMAX, LDB = NMAX, LDC = PMAX, LDD = PMAX, 1 LDE = NMAX, LDWORK = 1) C .. Local Scalars .. CHARACTER DEF INTEGER I, INFO, J, LDPAR, LIPAR, M, N, P CHARACTER*70 NOTE C .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), 1 D(LDD,MMAX), DPAR(7), DWORK(LDWORK), E(LDE,NMAX) INTEGER NR(2), IPAR(7) LOGICAL VEC(8) C .. External Functions .. LOGICAL LSAME EXTERNAL LSAME C .. External Subroutines .. EXTERNAL BD02AD C .. Executable Statements .. WRITE (NOUT, FMT = 99999) C Skip the heading in the data file and read the data. READ (NIN, FMT = '()') READ (NIN, FMT = *) DEF READ (NIN, FMT = *) (NR(I), I = 1, 2) IF (LSAME(DEF,'N')) THEN READ (NIN, FMT = *) LDPAR IF (LDPAR .GT. 0) READ (NIN, FMT = *) (DPAR(I), I = 1, LDPAR) READ (NIN, FMT = *) LIPAR IF (LIPAR .GT. 0) READ (NIN, FMT = *) (IPAR(I), I = 1, LIPAR) END IF C Generate benchmark example CALL BD02AD(DEF, NR, DPAR, IPAR, VEC, N, M, P, E, LDE, A, LDA, 1 B, LDB, C, LDC, D, LDD, NOTE, DWORK, LDWORK, INFO) C IF (INFO .NE. 0) THEN WRITE (NOUT, FMT = 99998) INFO ELSE WRITE (NOUT, FMT = *) NOTE WRITE (NOUT, FMT = 99997) N WRITE (NOUT, FMT = 99996) M WRITE (NOUT, FMT = 99995) P IF (VEC(4)) THEN WRITE (NOUT, FMT = 99994) DO 10 I = 1, N WRITE (NOUT, FMT = 99987) (E(I,J), J = 1, N) 10 CONTINUE ELSE WRITE (NOUT, FMT = 99993) END IF WRITE (NOUT,FMT = 99992) DO 20 I = 1, N WRITE (NOUT, FMT = 99987) (A(I,J), J = 1, N) 20 CONTINUE WRITE (NOUT,FMT = 99991) DO 30 I = 1, N WRITE (NOUT, FMT = 99987) (B(I,J), J = 1, M) 30 CONTINUE WRITE (NOUT,FMT = 99990) DO 40 I = 1, P WRITE (NOUT, FMT = 99987) (C(I,J), J = 1, N) 40 CONTINUE IF (VEC(8)) THEN WRITE (NOUT,FMT = 99989) DO 50 I = 1, P WRITE (NOUT, FMT = 99987) (D(I,J), J = 1, M) 50 CONTINUE ELSE WRITE (NOUT, FMT = 99988) END IF END IF C 99999 FORMAT (' BD02AD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from BD02AD = ', I3) 99997 FORMAT (/' Order of matrix A: N = ', I3) 99996 FORMAT (' Number of columns in matrix B: M = ', I3) 99995 FORMAT (' Number of rows in matrix C: P = ', I3) 99994 FORMAT (/' E = ') 99993 FORMAT (/' E is the identity matrix.') 99992 FORMAT (' A = ') 99991 FORMAT (' B = ') 99990 FORMAT (' C = ') 99989 FORMAT (' D = ') 99988 FORMAT (' D is of zeros.') 99987 FORMAT (20(1X,F8.4)) C ENDProgram Data
BD02AD EXAMPLE PROGRAM DATA D 1 1Program Results
BD02AD EXAMPLE PROGRAM RESULTS Laub 1979, Ex. 2: uncontrollable-unobservable data Order of matrix A: N = 2 Number of columns in matrix B: M = 1 Number of rows in matrix C: P = 1 E is the identity matrix. A = 4.0000 3.0000 -4.5000 -3.5000 B = 1.0000 -1.0000 C = 3.0000 2.0000 D is of zeros.
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/DAESolver.html 0000664 0000000 0000000 00000340260 14560147231 0021243 0 ustar 00root root 0000000 0000000
Purpose
Interface for using a common entry point, DSblock compatible for defining Differential Algebraic Equations using several packages.
The equations follow the form (CASE A): F(dx(t)/dt, x(t), u(t), p, t) = 0 y(t) = g(dx(t)/dx, x(t), u(t), p, t) for the most general model which can only be solved by DASSL and DASSPK. A restricted case can be solved with RADAU5, LSODI, LSOIBT, if the system is expressed as (CASE B): F(x(t), u(t), p, t)*dx(t)/dt = A(x(t), u(t), p, t) y(t) = g(dx(t)/dx, x(t), u(t), p, t) And finally, the GELDA package is able to solve DAEs with the expression (CASE C): F(u(t), p, t)*dx(t)/dt = A(u(t), p, t)*x(t) + E(u(t), p, t) The user must define the subroutines: DAEDF: F(dx(t)/dt, x(t), u(t), p, t) for CASES: A, B and C DAEDA: A(x(t), u(t), p, t) for CASES: B and C DAEDE: E(u(t), p, t) for CASES: C DAEOUT: g(dx(t)/dx, x(t), u(t), p, t) and the Jacobians (JACFX, JACFU, JACFP) if used. The interface adapts the structure to fit all the codesSpecification
SUBROUTINE DAESolver(ISOLVER,CDAEDF_,CDAEDA_,CDAEDE_,CDAEOUT_, $ CJACFX_,CJACFU_,CJACFP_,CJACFXDOT_, $ NX, NY, NU, NP, TINI, TOUT, $ X, XDOTI, Y, U, P, $ IPAR, RPAR, RTOL, ATOL, $ IWORK, LIWORK, DWORK, LDWORK, $ IWARN, INFO) .. Scalar Arguments .. DOUBLE PRECISION TINI, TOUT INTEGER ISOLVER, IWARN, INFO, $ NX, NY, NU, NP, $ LDWORK, LIWORK CHARACTER*9 CDAEDF_, CDAEDA_,CDAEDE_, CDAEOUT_, $ CJACFX_, CJACFU_, CJACFP_, CJACFXDOT_, $ CDAEDF, CDAEDA,CDAEDE, CDAEOUT, $ CJACFX, CJACFU, CJACFP, CJACFXDOT .. Array Arguments .. DOUBLE PRECISION DWORK(LDWORK), RPAR(*), ATOL(*), RTOL(*) $ X(NX), XDOTI(NX), Y(NY), U(NU), P(NP) INTEGER IWORK(LIWORK), IPAR(*)Arguments
Mode Parameters
ISOLVER INTEGER Indicates the nonlinear solver packages to be used = 1: LSODI, = 2: LSOIBT, = 3: RADAU5, = 4: DASSL, = 5: DASPK, = 6: DGELDA.Input/Output Parameters
DAEDF (input) EXTERNAL Evaluates the F(dx(t)/dt, x(t), u(t), p, t). DAEDA (input) EXTERNAL Evaluates the A(x(t), u(t), p, t). DAEDE (input) EXTERNAL Evaluates the E(u(t), p, t). DAEOUT (input) EXTERNAL Evaluates the output signals function g. JACFX (input) EXTERNAL Evaluates the jacobian matrix with respect to X. JACFU (input) EXTERNAL Evaluates the jacobian matrix with respect to U. JACFP (input) EXTERNAL Evaluates the jacobian matrix with respect to P. NX (input) INTEGER Dimension of the state vector. NY (input) INTEGER Dimension of the output vector. NU (input) INTEGER Dimension of the input vector. NP (input) INTEGER Dimension of the parameter vector. TINI (input) DOUBLE PRECISION Initial value of time. TOUT (input) DOUBLE PRECISION Final value of time. X (input/output) DOUBLE PRECISION array, dimension (NX) On entry, array containing the initial state variables. On exit, it has the last value of the state variables. XDOTI (input) DOUBLE PRECISION array, dimension (NX) Array containing dx(t)/dt at initial point. Y (input/output) DOUBLE PRECISION array, dimension (NY) On entry, array containing the initial values of Y. On exit, it has the results of the system. U (input) DOUBLE PRECISION array, dimension (NU) Array containing the input initial values. P (input) DOUBLE PRECISION array, dimension (NP) Array containing the parameter variables. IPAR (input/output) INTEGER array, dimension (201) INPUT: 1..15 General 16..25 ODEPACK 26..35 RADAU5 36..50 DASSL/PK 51..60 GELDA 61..100 Reserved OUTPUT: 101..110 General 111..125 ODEPACK 126..135 RADAU5 136..145 DASSL/PK 146..155 GELDA 156..200 Reserved Any Mode: 201.. User Available Common integer parameters for SOLVERS: IPAR(1), Tolerance mode 0 : both rtol and atol are scalars 1 : rtol is a scalar and atol is a vector 2 : both rtol and atol are vectors IPAR(2), Compute Output Values only at TOUT (and not at the intermediate step). (1:Yes, 0:No) IPAR(3), mfjac, Method flag for jacobian 0 : No jacobian used (non-stiff method). 1 : User supplied full jacobian (stiff). 2 : User supplied banded jacobian (stiff). 3 : User supplied sparse jacobian (stiff). 10 : internally generated full jacobian (stiff). 11 : internally generated banded jacobian (stiff). 12 : internally generated sparse jacobian (stiff). IPAR(6), ml, lower half-bandwithds of the banded jacobian, excluding tne main diagonal. IPAR(7), mu, upper half-bandwithds of the banded jacobian, excluding the main diagonal. (Note: IPAR(6) and IPAR(7) are obligatories only if the jacobian matrix is banded) IPAR(101) = Number of steps taken for the problem. IPAR(102) = Number of residual evaluations. IPAR(103) = Number of jacobian evaluations. Common parameters for RADAU5, ODEPACK and DGELDA: IPAR(9), mfmass, Method flag for mass-matrix 0 : No mass-matrix used (non-stiff method). 1 : User supplied full mass-matrix (stiff). 2 : User supplied banded mass-matrix (stiff). 10 : Identity mass-matrix is used (stiff). IPAR(10), mlmass, lower half-bandwithds of the banded mass matrix, excluding the main diagonal. IPAR(11), mumass, upper half-bandwithds of the banded mass matrix, excluding the main diagonal. IPAR(12), Maximum number of steps allowed during one call to the solver. Common parameters for ODEPACK, DASSL, DASPK and DGELDA: IPAR(13), Maximum order to be allowed. default values : 12 if meth = 1 5 if meth = 2 If exceds the default value, it will be reduced to the default value. In DASSL, DASPK and DGELDA : (1 .LE. MAXORD .LE. 5) IPAR(111) = The method order last used(successfully). IPAR(112) = The order to be attempted on the next step. Common parameters for ODEPACK package: IPAR(16), Status Flag IPAR(17), Optional inputs, must be 0 IPAR(18), Maximum number of messages printed, default value is 10. IPAR(113) = Index of the component of largest in the weighted local error vector ( e(i)/ewt(i) ). IPAR(114) = Length of rwork actually required. IPAR(115) = Length of iwork actually required. - LSOIBIT IPAR(24), mb, block size. (mb .GE. 1) and mb*IPAR(28) = NX IPAR(25), nb, number of blocks in the main diagonal. (nb .ge. 4) and nb*IPAR(27) = NX - RADAU5 IPAR(26) Transforms the Jacobian matrix to Hessenberg form.(Only if IPAR(9)=1 and IPAR(3)=1 or 10) IPAR(27) Maximum number of Newton iterations in each step. IPAR(28) Starting values for Newton's method .EQ. 0 -> is taken the extrapolated collocation solution .NE. 0 -> zero values are used. IPAR(29) Dimension of the index 1 variables( >0 ). IPAR(30) Dimension of the index 2 variables. IPAR(31) Dimension of the index 3 variables. IPAR(32) Switch for step size strategy 0,1 Mod. Predictive controller(Gustafsson) 2 Classical step size control IPAR(33) Value of M1 (default 0). IPAR(34) Value of M2 (default(M2=M1). IPAR(126), Number of accepted steps. IPAR(127), Number of rejected steps. IPAR(128), Number of LU-Decompositions of both matrices IPAR(129), Number of forward-backward substitutions, of both systems. Common parameters for DASSL, DASPK and DGELDA solvers: IPAR(36), this parameter enables the code to initialize itself. Must set to 0 to indicate the start of every new problem. 0: Yes. (On each new problem) 1: No. (Allows 500 new steps) IPAR(38), Solver try to compute the initial T, X and XPRIME: 0: The initial T, X and XPRIME are consistent. 1: Given X_d calculate X_a and X'_d 2: Given X' calculate X. ( X_d differential variables in X X_a algebrac variables in X ) IPAR(136), Total number of error test failures so far. Common parameters for DASSL and DASPK solvers: IPAR(37), code solve the problem without invoking any special non negativity constraints: 0: Yes 1: To have constraint checking only in the initial condition calculation. 2: To enforze nonnegativity in X during the integration. 3: To enforce both options 1 and 2. IPAR(137), Total number of convergence test failures. - DASPK IPAR(39), DASPK use: 0: direct methods (dense or band) 1: Krylov method (iterative) 2: Krylov method + Jac (iterative) IPAR(41), Proceed to the integration after the initial condition calculation is done. Used when IPAR(38) > 0: 0: Yes 1: No IPAR(42), Errors are controled localy on all the variables: 0:Yes 1: No IPAR(8), Extra printing 0, no printing 1, for minimal printing 2, for full printing IPAR(44), maximum number of iterations in the SPIGMR algorithm. (.LE. NX) IPAR(45), number of vectors on which orthogonalization is done in the SPIGMR algorithm. (.LE. IPAR(44)) IPAR(46), maximum number of restarts of the SPIGMR algorithm per nonlinear iteration. (.GE. 0) IPAR(47), maximum number of Newton iterations per Jacobian or preconditioner evaluation. (> 0) IPAR(48), maximum number of Jacobian or preconditioner evaluations. (> 0) IPAR(49), maximum number of values of the artificial stepsize parameter H to be tried if IPAR(38) = 1. (> 0). IPAR(50), flag to turn off the linesearch algorithm. 0 : ON 1 : OFF (default) IPAR(138), number of convergence failures of the linear iteration IPAR(139), length of IWORK actually required. IPAR(140), length of RWORK actually required. IPAR(141), total number of nonlinear iterations. IPAR(142), total number of linear (Krylov) iterations IPAR(143), number of PSOL calls. - DGELDA IPAR(51), contains the strangeness index. IPAR(52), number of differential components IPAR(53), number of algebraic components IPAR(54), number of undetermined components IPAR(55), method used: if 1 then uses the BDF solver 2 then uses the Runge-Kutta solver IPAR(56), E(t) and A(t) are: 1 time dependent 0 constants IPAR(57), Maximum index of the problem. ( .GE. 0 ) IPAR(58), Step size strategy: 0, Mod. predictive controlled of Gustafsson(safer) 1, classical step size control(faster) RPAR (input/output) DOUBLE PRECISION array, dimension (201) INPUT: 1..15 General 16..25 ODEPACK 26..35 RADAU5 36..50 DASSL/PK 51..60 GELDA 61..100 Reserved OUTPUT: 101..110 General 111..125 ODEPACK 126..135 RADAU5 136..145 DASSL/PK 146..155 GELDA 156..200 Reserved Any Mode: 201.. User Available Common parameters for solvers: RPAR(1), Initial step size guess.Obligatory in RADAU5. RPAR(2), Maximum absolute step size allowed. Common parameters for ODEPACK, DASSL, DASPK and DGELDA: RPAR(111), Step size in t last used (successfully). RPAR(112), Step size to be attempted on the next step. RPAR(113), Current value of the independent variable which the solver has actually reached Common parameters for ODEPACK solver: RPAR(16), Critical value of t which the solver is not overshoot. RPAR(17), Minimum absolute step size allowed. RPAR(18), Tolerance scale factor, greater than 1.0. Parameters for RADAU5 solver: RPAR(26), The rounding unit, default 1E-16. RPAR(27), The safety factor in step size prediction, default 0.9D0. RPAR(28), Decides whether the jacobian should be recomputed, default 0.001D0. Increase when jacobian evaluations are costly For small systems should be smaller. RPAR(29), Stopping criterion for Newton's method, default MIN(0.03D0, RTOL(1)**0.5D0). RPAR(30), RPAR(31): This saves, together with a large RPAR(28), LU-decompositions and computing time for large systems. Small systems: RPAR(30)=1.D0, RPAR(31)=1.2D0 Large full systems: RPAR(30)=0.99D0, RPAR(31)=2.D0 might be good. RPAR(32), RPAR(33), Parameters for step size selection.Condition: RPAR(32)<=HNEW/HOLD<=RPAR(33) Parameters for DASSL, DASPK and DGELDA solvers: RPAR(36), Stopping point (Tstop) - DASPK RPAR(37), convergence test constant in SPIGMR algorithm. (0 .LT. RPAR(37) .LT. 1.0) RPAR(38), minimum scaled step in linesearch algorithm. The default is = (unit roundoff)**(2/3). (> 0) RPAR(39), swing factor in the Newton iteration convergence test. (default 0.1) (> 0) - DASPK RPAR(40), safety factor used in step size prediction. RPAR(41) and RPAR(42) restric the relation between the new and old stepsize in step size selection. 1/RPAR(41) .LE. Hnew/Hold .LE. 1/RPAR(42) RPAR(43), RPAR(44) QUOT1 and QUOT2 repectively. If QUOT1 < Hnew/Hold < QUOT2 and A and E are constants, the work can be saved by setting Hnew=Hold and using the system matrix of the previous step.Tolerances
RTOL DOUBLE PRECISION Relative Tolerance. ATOL DOUBLE PRECISION Absolute Tolerance.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER Minimum size of DWORK, depending on solver: - LSODI, LSOIBT, DASSL 20 + NX - RADAU5 3*N+20 DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER Size of DWORK, depending on solver: - LSODI 22 + 9*NX + NX**2 , IPAR(3) = 1 or 10 22 + 10*NX + (2*ML + MU)*NX , IPAR(3) = 2 or 11 - LSOIBT 20 + nyh*(maxord + 1) + 3*NX + lenw where nyh = Initial value of NX maxord = Maximum order allowed(default or IPAR(13) lenw = 3*mb*mb*nb + 2 - RADAU5 N*(LJAC+LMAS+3*LE+12)+20 where LJAC=N if (full jacobian) LJAC=MLJAC+MUJAC+1 if (banded jacobian) and LMAS=0 if (IPAR(9) = 10 or 11) LMAS=N if (IPAR(9) = 1) LMAS=MLMAS+MUMAS+1 if (IPAR(9) = 2) and LE=N if (IPAR(9) = 1 or 10) LE=2*MLJAC+MUJAC+1 if (IPAR(9) = 2 or 11) - DASSL >= 40 LRW .GE. 40+(MAXORD+4)*NEQ+NEQ**2, IPAR(3) = 1 or 10 >= 40+(MAXORD+4)*NEQ+(2*ML+MU+1)*NEQ, IPAR(3) = 2 >= 40+(MAXORD+4)*NEQ+(2*ML+MU+1)*NEQ +2*(NEQ/(ML+MU+1)+1), IPAR(3) = 11Warning Indicator
IWARN INTEGER = 0: no warning; = 1: LSODI/LSOIBT/RADAU5 do not use the input vector as argument; = 2: LSODI/LSOIBT do not use the param vector as argument; = 3: RTOL and ATOL are used as scalars;Error Indicator
INFO INTEGER = 0: Successful exit; < 0: If INFO = -i, the i-th argument had an illegal value; = 1: Wrong tolerance mode; = 2: Method (IPAR(9)) is not allowed for ODEPACK/RADAU5; = 3: Method (IPAR(3)) is not allowed for LSODE/RADAU5/DASSL; = 4: Option not allowed for IPAR(37); = 5: Option not allowed for IPAR(38); = 100+ERROR: RADAU5 returned -ERROR; = 200+ERROR: DASSL returned -ERROR; = 300+ERROR: DASPK returned -ERROR; = 400+ERROR: DGELDA returned -ERROR.Method
Since the package integrates 8 different solvers, it is possible to solve differential equations by means of Backward Differential Formulas, Runge-Kutta, using direct or iterative methods (including preconditioning) for the linear system associated, differential equations with time-varying coefficients or of order higher than one. The interface facilitates the user the work of changing the integrator and testing the results, thus leading a more robust and efficient integrated package.References
[1] A.C. Hindmarsh, Brief Description of ODEPACK: A Systematized Collection of ODE Solvers, http://www.netlib.org/odepack/doc [2] L.R. Petzold DASSL Library Documentation, http://www.netlib.org/ode/ [3] P.N. Brown, A.C. Hindmarsh, L.R. Petzold, DASPK Package 1995 Revision [4] R.S. Maier, Using DASPK on the TMC CM5. Experiences with Two Programming Models, Minesota Supercomputer Center, Technical Report. [5] E. Hairer, G. Wanner, Solving Ordinary Dirential Equations II. Stiánd Dirential- Algebraic Problems., Springer Seried in Computational Mathermatics 14, Springer-Verlag 1991, Second Edition 1996. [6] P. Kunkel, V. Mehrmann, W. Rath und J. Weickert, `GELDA: A Software Package for the Solution of General Linear Dirential Algebraic equations', SIAM Journal Scienti^Lc Computing, Vol. 18, 1997, pp. 115 - 138. [7] M. Otter, DSblock: A neutral description of dynamic systems. Version 3.3, http://www.netlib.org/odepack/doc [8] M. Otter, H. Elmqvist, The DSblock model interface for exchanging model components, Proceedings of EUROSIM 95, ed. F.Brenenecker, Vienna, Sep. 11-15, 1995 [9] M. Otter, The DSblock model interface, version 4.0, Incomplete Draft, http://dv.op.dlr.de/~otter7dsblock/dsblock4.0a.html [10] Ch. Lubich, U. Novak, U. Pohle, Ch. Engstler, MEXX - Numerical Software for the Integration of Constrained Mechanical Multibody Systems, http://www.netlib.org/odepack/doc [11] Working Group on Software (WGS), SLICOT Implementation and Documentation Standards (version 1.0), WGS-Report 90-1, Eindhoven University of Technology, May 1990. [12] P. Kunkel and V. Mehrmann, Canonical forms for linear differential- algebraic equations with variable coeÆcients., J. Comput. Appl. Math., 56:225{259, 1994. [13] Working Group on Software (WGS), SLICOT Implementation and Documentation Standards, WGS-Report 96-1, Eindhoven University of Technology, updated: Feb. 1998, ../../REPORTS/rep96-1.ps.Z. [14] A. Varga, Standarization of Interface for Nonlinear Systems Software in SLICOT, Deutsches Zentrum ur Luft un Raumfahrt, DLR. SLICOT-Working Note 1998-4, 1998, Available at ../../REPORTS/SLWN1998-4.ps.Z. [15] D. Kirk, Optimal Control Theory: An Introduction, Prentice-Hall. Englewood Cli, NJ, 1970. [16] F.L. Lewis and V.L. Syrmos, Optimal Control, Addison-Wesley. New York, 1995. [17] W.M.Lioen, J.J.B de Swart, Test Set for Initial Value Problem Solvers, Technical Report NM-R9615, CWI, Amsterdam, 1996. http://www.cwi.nl/cwi/projects/IVPTestset/. [18] V.Hernandez, I.Blanquer, E.Arias, and P.Ruiz, Definition and Implementation of a SLICOT Standard Interface and the associated MATLAB Gateway for the Solution of Nonlinear Control Systems by using ODE and DAE Packages}, Universidad Politecnica de Valencia, DSIC. SLICOT Working Note 2000-3: July 2000. Available at ../../REPORTS/SLWN2000-3.ps.Z. [19] J.J.B. de Swart, W.M. Lioen, W.A. van der Veen, SIDE, November 25, 1998. Available at http://www.cwi.nl/cwi/projects/PSIDE/. [20] Kim, H.Young, F.L.Lewis, D.M.Dawson, Intelligent optimal control of robotic manipulators using neural networks. [21] J.C.Fernandez, E.Arias, V.Hernandez, L.Penalver, High Performance Algorithm for Tracking Trajectories of Robot Manipulators, Preprints of the Proceedings of the 6th IFAC International Workshop on Algorithms and Architectures for Real-Time Control (AARTC-2000), pages 127-134.Numerical Aspects
The numerical aspects of the routine lie on the features of the different packages integrated. Several packages are more robust than others, and other packages simply cannot deal with problems that others do. For a detailed description of the numerical aspects of each method is recommended to check the references above.Further Comments
Several packages (LSODES, LSOIBT) deal only with sparse matrices. The interface checks the suitability of the methods to the parameters and show a warning message if problems could arise.Example
Program Text
* DAESOLVER EXAMPLE PROGRAM TEXT FOR LSODIX
PROBLEM
*
* .. Parameters ..
INTEGER
NIN, NOUT
PARAMETER
( NIN = 5, NOUT = 6 )
INTEGER LSODI_, LSOIBT_, RADAU5_,
DASSL_, DASPK_, GELDA_
PARAMETER (LSODI_ = 1, LSOIBT_
= 2)
PARAMETER (RADAU5_ = 3, DASSL_
= 4, DASPK_ = 5)
PARAMETER (GELDA_ = 6)
* .. Executable Statements ..
*
EXTERNAL IARGC_
INTEGER IARGC_
INTEGER NUMARGS
CHARACTER*80 NAME
CHARACTER*80 SOLVER
*
* .. Executable Statements ..
*
WRITE ( NOUT, FMT = 99999 )
*
NUMARGS = IARGC_()
*
CALL GETARG_(0, NAME)
IF (NUMARGS .NE. 1) THEN
WRITE (*,*) 'Syntax
Error: ',NAME(1:8),' <solver>'
WRITE (*,*) 'Solvers
: LSODI, LSOIBT, RADAU5, DASSL, DASPK, GELD
&A'
ELSE
*
CALL GETARG_(1, SOLVER)
*
WRITE (*,*) 'Problem:
LSODIX Solver: ',SOLVER(1:7)
*
IF (SOLVER(1:5) .EQ.
'LSODI') THEN
CALL TEST(LSODI_)
ELSEIF (SOLVER(1:6)
.EQ. 'LSOIBT') THEN
CALL TEST(LSOIBT_)
ELSEIF (SOLVER(1:6)
.EQ. 'RADAU5') THEN
CALL TEST(RADAU5_)
ELSEIF (SOLVER(1:5)
.EQ. 'GELDA') THEN
CALL TEST(GELDA_)
ELSEIF (SOLVER(1:5)
.EQ. 'DASSL') THEN
CALL TEST(DASSL_)
ELSEIF (SOLVER(1:5)
.EQ. 'DASPK') THEN
CALL TEST(DASPK_)
ELSE
WRITE (*,*)
'Error: Solver: ', SOLVER,' unknown'
ENDIF
ENDIF
*
99999 FORMAT (' DAESOLVER EXAMPLE PROGRAM RESULTS FOR LSODIX PROBLEM'
.
,/1X)
END
SUBROUTINE TEST( ISOLVER )
*
*
* PURPOSE
*
* Testing subroutine DAESolver
*
* ARGUMENTS
*
* Input/Output Parameters
*
* ISOLVER (input) INTEGER
*
Indicates the nonlinear solver package to be used:
*
= 1: LSODI,
*
= 2: LSOIBT,
*
= 3: RADAU5,
*
= 4: DASSL,
*
= 5: DASPK,
*
= 6: DGELDA.
*
* METHOD
*
* REFERENCES
*
* CONTRIBUTORS
*
* REVISIONS
*
* -
*
* KEYWORDS
*
*
* ******************************************************************
* .. Parameters ..
INTEGER LSODI_, LSOIBT_, RADAU5_,
DASSL_, DASPK_, GELDA_
PARAMETER (LSODI_ = 1, LSOIBT_
= 2)
PARAMETER (RADAU5_ = 3, DASSL_
= 4, DASPK_ = 5)
PARAMETER (GELDA_ = 6)
INTEGER
NIN, NOUT
PARAMETER
( NIN = 5, NOUT = 6 )
INTEGER
MD, ND, LPAR, LWORK
PARAMETER
( MD = 400, ND = 100, LPAR = 201,
$
LWORK = 10000 )
* .. Common variables ..
COMMON /TESTING/ ISOLVER2
INTEGER ISOLVER2
* .. Scalar Arguments ..
INTEGER ISOLVER
* .. Local Scalars ..
INTEGER
NEQN, NDISC, MLJAC, MUJAC, MLMAS, MUMAS
INTEGER
IWARN, INFO
DOUBLE PRECISION ATOL, RTOL, NORM
LOGICAL
NUMJAC, NUMMAS, CONSIS
* .. Local Arrays ..
CHARACTER FULLNM*40, PROBLM*8, TYPE*3
CHARACTER*9 CDAEDF,CDAEDA,CDAEDE,CDAEOUT,
$
CJACFX,CJACFU,CJACFP,CJACFXDOT
INTEGER
IND(MD), IPAR(LPAR), IWORK(LWORK)
DOUBLE PRECISION T(0:ND), RPAR(LPAR),
DWORK(LWORK)
DOUBLE PRECISION X(MD), XPRIME(MD),
Y(MD), U(MD), P(MD), SOLU(MD)
* .. External Functions ..
DOUBLE PRECISION DNRM2
EXTERNAL
DNRM2
* .. External Subroutines ..
EXTERNAL
PLSODIX, ILSODIX, SLSODIX
EXTERNAL
DAXPY
* .. Executable Statements ..
*
ISOLVER2 = ISOLVER
DO 20 I=1,NEQN
Y(I)=0D0
U(I)=0D0
P(I)=0D0
20 CONTINUE
DO 40 I=1,LPAR
IPAR(I)=0
RPAR(I)=0D0
40 CONTINUE
DO 60 I=1,LWORK
IWORK(I)=0
DWORK(I)=0D0
60 CONTINUE
* Get the problem dependent parameters.
RTOL=1D-4
ATOL=1D-6
IPAR(1)=0
IPAR(2)=1
IPAR(3)=1
IPAR(12)= 10000
IF (ISOLVER .EQ. LSODI_ .OR. ISOLVER
.EQ. RADAU5_) THEN
IPAR(9)=1
IPAR(16)=1
C IPAR(17)=0
RPAR(1)=1D-3
ELSE
C (ISOLVER
.EQ. DASSL_ .OR. ISOLVER .EQ. DASPK_)
C IPAR(36)=0
C IPAR(37)=0
C IPAR(38)=0
IPAR(39)=1
END IF
CALL PLSODIX(FULLNM,PROBLM,TYPE,NEQN,NDISC,T,NUMJAC,MLJAC,
$
MUJAC,NUMMAS,MLMAS,MUMAS,IND)
CALL ILSODIX(NEQN,T(0),X,XPRIME,CONSIS)
x(1) = 1.0d0
x(2) = 0.0d0
x(3) = 0.0d0
xprime(1) = -0.04D0
xprime(2) = 0.04D0
xprime(3) = 0.0D0
CALL SLSODIX(NEQN,T(1),SOLU)
IF ( TYPE.NE.'DAE' ) THEN
WRITE ( NOUT,
FMT = 99998 )
ELSE
WRITE ( NOUT,
FMT = 99997 ) FULLNM, PROBLM, TYPE, ISOLVER
CDAEDF=''
CDAEDA=''
CDAEDE=''
CDAEOUT=''
CJACFX=''
CJACFU=''
CJACFP=''
CJACFXDOT=''
CALL DAESolver(
ISOLVER, CDAEDF, CDAEDA, CDAEDE, CDAEOUT,
$
CJACFX, CJACFU, CJACFP, CJACFXDOT,
$
NEQN, NEQN, NEQN, NEQN, T(0), T(1),
$
X, XPRIME, Y, U, P,
$
IPAR, RPAR, RTOL, ATOL,
$
IWORK, LWORK, DWORK, LWORK, IWARN, INFO )
IF ( INFO.NE.0
) THEN
WRITE ( NOUT, FMT = 99996 ) INFO
ELSE
IF ( IWARN.NE.0 ) THEN
WRITE ( NOUT, FMT = 99995 ) IWARN
ENDIF
IF ( NEQN .LE. 30 ) THEN
WRITE ( NOUT, FMT = 99994 )
DO 80 I=1,NEQN
WRITE ( NOUT, FMT = 99993 ) I, X(I), SOLU(I)
80
CONTINUE
END IF
NORM=DNRM2(NEQN,SOLU,1)
IF ( NORM.EQ.0D0 ) THEN
NORM=1D0
END IF
CALL DAXPY(NEQN,-1D0,X,1,SOLU,1)
NORM=DNRM2(NEQN,SOLU,1)/NORM
WRITE ( NOUT, FMT = 99992 ) NORM
END IF
END IF
*
99998 FORMAT (' ERROR: This test is only intended for DAE problems')
99997 FORMAT (' ',A,' (',A,' , ',A,') with SOLVER ',I2)
99996 FORMAT (' INFO on exit from DAESolver = ',I3)
99995 FORMAT (' IWARN on exit from DAESolver = ',I3)
99994 FORMAT (' Solution: (calculated) (reference)')
99993 FORMAT (I,F,F)
99992 FORMAT (' Relative error comparing with the reference solution:'
$
,E,/1X)
* *** Last line of TEST ***
END
SUBROUTINE DAEDA_( RPAR, NRP, IPAR,
NIP, X, NX, U, NU, P, NP,
$
F, LDF, T, INFO )
*
*
* PURPOSE
*
* Interface routine between DAESolver and
the problem function FEVAL
*
* ARGUMENTS
*
* Input/Output Parameters
*
* RPAR (input/output)
DOUBLE PRECISION array, dimension (NRP)
*
Array for communication between the driver and FEVAL.
*
* NRP (input)
INTEGER
*
Dimension of RPAR array.
*
* IPAR (input/output)
INTEGER array, dimension (NIP)
*
Array for communication between the driver and FEVAL.
*
* NIP (input)
INTEGER
*
Dimension of IPAR array.
*
* X
(input) DOUBLE PRECISION array, dimension (NX)
*
Array containing the state variables.
*
* NX
(input) INTEGER
*
Dimension of the state vector.
*
* U
(input) DOUBLE PRECISION array, dimension (NU)
*
Array containing the input values.
*
* NU
(input) INTEGER
*
Dimension of the input vector.
*
* P
(input) DOUBLE PRECISION array, dimension (NP)
*
Array containing the parameter values.
*
* NP
(input) INTEGER
*
Dimension of the parameter vector.
*
* F
(output) DOUBLE PRECISION array, dimension (LDF,NX)
*
The resulting function value f(T,X).
*
* LDF (input)
INTEGER
*
The leading dimension of F.
*
* T
(input) INTEGER
*
The time point where the function is evaluated.
*
* Error Indicator
*
* INFO INTEGER
*
Returns values of error from FEVAL or 100 in case
*
a bad problem was choosen.
*
* METHOD
*
* REFERENCES
*
* CONTRIBUTORS
*
* REVISIONS
*
* -
*
* KEYWORDS
*
*
* ******************************************************************
*
* .. Common variables ..
COMMON /TESTING/ ISOLVER
INTEGER LSODI_, LSOIBT_, RADAU5_,
DASSL_, DASPK_, GELDA_
PARAMETER (LSODI_ = 1, LSOIBT_
= 2)
PARAMETER (RADAU5_ = 3, DASSL_
= 4, DASPK_ = 5)
PARAMETER (GELDA_ = 6)
* .. Scalar Arguments ..
INTEGER
NRP, NIP, NX, NU, NP, LDF, INFO
DOUBLE PRECISION T
* .. Array Arguments ..
INTEGER
IPAR(NIP)
DOUBLE PRECISION RPAR(NRP), X(NX),
U(NU), P(NP),
$ F(LDF,NX)
* .. External Subroutines ..
EXTERNAL
FLSODIX
* .. Executable Statements ..
CALL FLSODIX(NX,T,X,X,F,INFO,RPAR,IPAR)
* *** Last line of DAEDA_ ***
END
SUBROUTINE DAEDF_( RPAR, NRP, IPAR,
NIP, X, XPRIME, NX,
$
U, NU, P, NP, T, F, LDF, INFO )
*
*
* PURPOSE
*
* Interface routine between DAESolver and
the problem function MEVAL
*
* ARGUMENTS
*
* Input/Output Parameters
*
* RPAR (input/output)
DOUBLE PRECISION array, dimension (NRP)
*
Array for communication between the driver and MEVAL.
*
* NRP (input)
INTEGER
*
Dimension of RPAR array.
*
* IPAR (input/output)
INTEGER array, dimension (NIP)
*
Array for communication between the driver and MEVAL.
*
* NIP (input)
INTEGER
*
Dimension of IPAR array.
*
* X
(input) DOUBLE PRECISION array, dimension (NX)
*
Array containing the state variables.
*
* XPRIME (input) DOUBLE PRECISION
array, dimension (NX)
*
Array containing the state variables derivative.
*
* NX
(input) INTEGER
*
Dimension of the state vector.
*
* U
(input) DOUBLE PRECISION array, dimension (NU)
*
Array containing the input values.
*
* NU
(input) INTEGER
*
Dimension of the input vector.
*
* P
(input) DOUBLE PRECISION array, dimension (NP)
*
Array containing the parameter values.
*
* NP
(input) INTEGER
*
Dimension of the parameter vector.
*
* T
(input) INTEGER
*
The time point where the function is evaluated.
*
* F
(output) DOUBLE PRECISION array, dimension (LDF,NX)
*
The resulting function value f(T,X).
*
* LDF (input)
INTEGER
*
The leading dimension of F.
*
* Error Indicator
*
* INFO INTEGER
*
Returns values of error from MEVAL or 100 in case
*
a bad problem was choosen.
*
* METHOD
*
* REFERENCES
*
* CONTRIBUTORS
*
* REVISIONS
*
* -
*
* KEYWORDS
*
*
* ******************************************************************
*
* .. Common variables ..
COMMON /TESTING/ ISOLVER
INTEGER ISOLVER
INTEGER LSODI_, LSOIBT_, RADAU5_,
DASSL_, DASPK_, GELDA_
PARAMETER (LSODI_ = 1, LSOIBT_
= 2)
PARAMETER (RADAU5_ = 3, DASSL_
= 4, DASPK_ = 5)
PARAMETER (GELDA_ = 6)
* .. Scalar Arguments ..
INTEGER
NRP, NIP, NX, NU, NP, LDF, INFO
DOUBLE PRECISION T
* .. Array Arguments ..
INTEGER
IPAR(NIP)
DOUBLE PRECISION RPAR(NRP), X(NX),
XPRIME(NX), U(NU), P(NP),
$ F(LDF,NX)
* .. Local Scalars ..
INTEGER
I
* .. External Subroutines ..
EXTERNAL
MLSODIX, RLSODIX
* .. Executable Statements ..
IF (ISOLVER .EQ. DASSL_ .OR. ISOLVER
.EQ. DASPK_) THEN
CALL RLSODIX(LDF,NX,T,X,XPRIME,F,INFO,RPAR,IPAR)
ELSE
CALL MLSODIX(LDF,NX,T,X,XPRIME,F,INFO,RPAR,IPAR)
ENDIF
* *** Last line of DAEDF_ ***
END
SUBROUTINE JACFX_( NRP, NIP,
RPAR, IPAR, NX, NU,
$
NP, X, U, P, T, FX, LDFX,
$
INFO )
*
*
* PURPOSE
*
* Interface routine between DAESolver and
the problem function JEVAL
*
* ARGUMENTS
*
* Input/Output Parameters
*
* NRP (input)
INTEGER
*
Dimension of RPAR array.
*
* NIP (input)
INTEGER
*
Dimension of IPAR array.
*
* RPAR (input/output)
DOUBLE PRECISION array
*
Array for communication between the driver and JEVAL.
*
* IPAR (input/output)
INTEGER array
*
Array for communication between the driver and JEVAL.
*
* NX
(input) INTEGER
*
Dimension of the state vector.
*
* NU
(input) INTEGER
*
Dimension of the input vector.
*
* NP
(input) INTEGER
*
Dimension of the parameter vector.
*
* X
(input) DOUBLE PRECISION array, dimension (NX)
*
Array containing the state variables.
*
* U
(input) DOUBLE PRECISION array, dimension (NU)
*
Array containing the input values.
*
* P
(input) DOUBLE PRECISION array, dimension (NP)
*
Array containing the parameter values.
*
* T
(input) INTEGER
*
The time point where the derivative is evaluated.
*
* FX
(output) DOUBLE PRECISION array, dimension (LDFX,NX)
*
The array with the resulting Jacobian matrix.
*
* LDFX (input)
INTEGER
*
The leading dimension of the array FX.
*
* Error Indicator
*
* INFO INTEGER
*
Returns values of error from JEVAL or 100 in case
*
a bad problem was choosen.
*
* METHOD
*
* REFERENCES
*
* CONTRIBUTORS
*
* REVISIONS
*
* -
*
* KEYWORDS
*
*
* ******************************************************************
*
* .. Common variables ..
COMMON /TESTING/ ISOLVER
INTEGER LSODI_, LSOIBT_, RADAU5_,
DASSL_, DASPK_, GELDA_
PARAMETER (LSODI_ = 1, LSOIBT_
= 2)
PARAMETER (RADAU5_ = 3, DASSL_
= 4, DASPK_ = 5)
PARAMETER (GELDA_ = 6)
* .. Scalar Arguments ..
INTEGER
NRP, NIP, NX, NU, NP, LDFX, INFO
DOUBLE PRECISION T
* .. Array Arguments ..
INTEGER
IPAR(NIP)
DOUBLE PRECISION X(NX), U(NU), P(NP),
RPAR(NRP), FX(LDFX,NX)
* .. External Subroutines ..
EXTERNAL
JLSODIX
* .. Executable Statements ..
CALL JLSODIX(LDFX,NX,T,X,X,FX,INFO,RPAR,IPAR)
* *** Last line of JACFX_ ***
END
SUBROUTINE JACFXDOT_( NRP, NIP, RPAR,
IPAR,
$
NX, NU, NP, XPRIME, U, P, T, J, LDJ, INFO )
*
*
* PURPOSE
*
* MATJACFXDOT routine for TRANSAMP problem
*
* ARGUMENTS
*
* Input/Output Parameters
*
* NRP (input)
INTEGER
*
Dimension of RPAR array.
*
* NIP (input)
INTEGER
*
Dimension of IPAR array.
*
* RPAR (input/output)
DOUBLE PRECISION array
*
Array for communication with the driver.
*
* IPAR (input/output)
INTEGER array
*
Array for communication with the driver.
*
* NX
(input) INTEGER
*
Dimension of the state vector.
*
*
* NU
(input) INTEGER
*
Dimension of the input vector.
*
* NP
(input) INTEGER
*
Dimension of the parameter vector.
*
* XPRIME (input) DOUBLE PRECISION
array, dimension (NX)
*
Array containing the derivative of the state variables.
*
* U
(input) DOUBLE PRECISION array, dimension (NU)
*
Array containing the input values.
*
* P
(input) DOUBLE PRECISION array, dimension (NP)
*
Array containing the parameter values.
*
* T
(input) INTEGER
*
The time point where the derivative is evaluated.
*
* J
(output) DOUBLE PRECISION array, dimension (LDJ,NX)
*
The array with the resulting derivative matrix.
*
* LDJ (input)
INTEGER
*
The leading dimension of the array J.
*
* Error Indicator
*
* INFO INTEGER
*
Returns 1 in case a bad problem was choosen.
*
* METHOD
*
* REFERENCES
*
* CONTRIBUTORS
*
* REVISIONS
*
* -
*
* KEYWORDS
*
*
* ******************************************************************
*
* .. Common variables ..
COMMON /TESTING/ ISOLVER
INTEGER LSODI_, LSOIBT_, RADAU5_,
DASSL_, DASPK_, GELDA_
PARAMETER (LSODI_ = 1, LSOIBT_
= 2)
PARAMETER (RADAU5_ = 3, DASSL_
= 4, DASPK_ = 5)
PARAMETER (GELDA_ = 6)
* .. Scalar Arguments ..
INTEGER
NRP, NIP, NX, NU, NP, LDJ, INFO
DOUBLE PRECISION T
* .. Array Arguments ..
INTEGER
IPAR(NIP)
DOUBLE PRECISION XPRIME(NX), U(NU),
P(NP), RPAR(NRP), J(LDJ,NX)
* .. Executable Statements ..
*
CALL JDOTLSODIX(LDJ,NX,T,XPRIME,XPRIME,J,INFO,RPAR,IPAR)
ENDIF
* *** Last line of JACFXDOT_ ***
END
Program Data
No data requiredProgram Results
DAESOLVER EXAMPLE PROGRAM RESULTS Problem: LSODIX Solver: LSODI lsodix (lsodix , DAE) with SOLVER 1 IWARN on exit from DAESolver = 2 Solution: (calculated) (reference) 6.462112224297606E-07 1.255974374648338E-10 6.117680951077711E-07 Relative error comparing with the reference solution: .8898590685949503E-06
Return to index
SLICOT-SLICOT-Reference-a037f7e/doc/DE01OD.html 0000664 0000000 0000000 00000011260 14560147231 0020326 0 ustar 00root root 0000000 0000000
Purpose
To compute the convolution or deconvolution of two real signals A and B.Specification
SUBROUTINE DE01OD( CONV, N, A, B, INFO ) C .. Scalar Arguments .. CHARACTER CONV INTEGER INFO, N C .. Array Arguments .. DOUBLE PRECISION A(*), B(*)Arguments
Mode Parameters
CONV CHARACTER*1 Indicates whether convolution or deconvolution is to be performed as follows: = 'C': Convolution; = 'D': Deconvolution.Input/Output Parameters
N (input) INTEGER The number of samples. N must be a power of 2. N >= 2. A (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the first signal. On exit, this array contains the convolution (if CONV = 'C') or deconvolution (if CONV = 'D') of the two signals. B (input) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the second signal. NOTE that this array is overwritten.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
This routine computes the convolution or deconvolution of two real signals A and B using an FFT algorithm (SLICOT Library routine DG01MD).References
[1] Rabiner, L.R. and Rader, C.M. Digital Signal Processing. IEEE Press, 1972.Numerical Aspects
The algorithm requires 0( N*log(N) ) operations.Further Comments
NoneExample
Program Text
* DE01OD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 128 ) * .. Local Scalars .. INTEGER I, INFO, N CHARACTER*1 CONV * .. Local Arrays .. DOUBLE PRECISION A(NMAX), B(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DE01OD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, CONV IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( A(I), B(I), I = 1,N ) * Perform convolution on A and B. CALL DE01OD( CONV, N, A, B, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( CONV, 'C' ) ) THEN WRITE ( NOUT, FMT = 99997 ) ELSE WRITE ( NOUT, FMT = 99996 ) END IF DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) I, A(I) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' DE01OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DE01OD = ',I2) 99997 FORMAT (' Convolution ',//' i A(i)',/) 99996 FORMAT (' Deconvolution ',//' i A(i)',/) 99995 FORMAT (I4,1X,F8.4) 99994 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
DE01OD EXAMPLE PROGRAM DATA 8 C 0.4862 0.2288 0.1948 0.3671 0.5788 0.6417 -0.5861 0.3875 0.8254 0.2380 0.1815 0.4682 0.2904 0.5312 -0.3599 0.6116Program Results
DE01OD EXAMPLE PROGRAM RESULTS Convolution i A(i) 1 0.5844 2 0.5769 3 0.6106 4 1.0433 5 0.6331 6 0.4531 7 0.7027 8 0.9929
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/DE01PD.html 0000664 0000000 0000000 00000013057 14560147231 0020335 0 ustar 00root root 0000000 0000000
Purpose
To compute the convolution or deconvolution of two real signals A and B using the Hartley transform.Specification
SUBROUTINE DE01PD( CONV, WGHT, N, A, B, W, INFO ) C .. Scalar Arguments .. CHARACTER CONV, WGHT INTEGER INFO, N C .. Array Arguments .. DOUBLE PRECISION A(*), B(*), W(*)Arguments
Mode Parameters
CONV CHARACTER*1 Indicates whether convolution or deconvolution is to be performed as follows: = 'C': Convolution; = 'D': Deconvolution. WGHT CHARACTER*1 Indicates whether the precomputed weights are available or not, as follows: = 'A': available; = 'N': not available. Note that if N > 1 and WGHT = 'N' on entry, then WGHT is set to 'A' on exit.Input/Output Parameters
N (input) INTEGER The number of samples. N must be a power of 2. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the first signal. On exit, this array contains the convolution (if CONV = 'C') or deconvolution (if CONV = 'D') of the two signals. B (input) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the second signal. NOTE that this array is overwritten. W (input/output) DOUBLE PRECISION array, dimension (N - LOG2(N)) On entry with WGHT = 'A', this array must contain the long weight vector computed by a previous call of this routine or of the SLICOT Library routine DG01OD.f, with the same value of N. If WGHT = 'N', the contents of this array on entry is ignored. On exit, this array contains the long weight vector.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
This routine computes the convolution or deconvolution of two real signals A and B using three scrambled Hartley transforms (SLICOT Library routine DG01OD).References
[1] Van Loan, Charles. Computational frameworks for the fast Fourier transform. SIAM, 1992.Numerical Aspects
The algorithm requires O(N log(N)) floating point operations.Further Comments
NoneExample
Program Text
* DE01PD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 128 ) * .. Local Scalars .. INTEGER I, INFO, N CHARACTER*1 CONV, WGHT * .. Local Arrays .. DOUBLE PRECISION A(NMAX), B(NMAX), W(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DE01PD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, CONV, WGHT IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( A(I), B(I), I = 1,N ) * Perform convolution on A and B. CALL DE01PD( CONV, WGHT, N, A, B, W, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( CONV, 'C' ) ) THEN WRITE ( NOUT, FMT = 99997 ) ELSE WRITE ( NOUT, FMT = 99996 ) END IF DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) I, A(I) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' DE01PD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DE01PD = ',I2) 99997 FORMAT (' Convolution ',//' i A(i)',/) 99996 FORMAT (' Deconvolution ',//' i A(i)',/) 99995 FORMAT (I4,1X,F8.4) 99994 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
DE01PD EXAMPLE PROGRAM DATA 8 C N 0.4862 0.2288 0.1948 0.3671 0.5788 0.6417 -0.5861 0.3875 0.8254 0.2380 0.1815 0.4682 0.2904 0.5312 -0.3599 0.6116Program Results
DE01PD EXAMPLE PROGRAM RESULTS Convolution i A(i) 1 0.5844 2 0.5769 3 0.6106 4 1.0433 5 0.6331 6 0.4531 7 0.7027 8 0.9929
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/DF01MD.html 0000664 0000000 0000000 00000016501 14560147231 0020330 0 ustar 00root root 0000000 0000000
Purpose
To compute the sine transform or cosine transform of a real signal.Specification
SUBROUTINE DF01MD( SICO, N, DT, A, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER SICO INTEGER INFO, N DOUBLE PRECISION DT C .. Array Arguments .. DOUBLE PRECISION A(*), DWORK(*)Arguments
Mode Parameters
SICO CHARACTER*1 Indicates whether the sine transform or cosine transform is to be computed as follows: = 'S': The sine transform is computed; = 'C': The cosine transform is computed.Input/Output Parameters
N (input) INTEGER The number of samples. N must be a power of 2 plus 1. N >= 5. DT (input) DOUBLE PRECISION The sampling time of the signal. A (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the signal to be processed. On exit, this array contains either the sine transform, if SICO = 'S', or the cosine transform, if SICO = 'C', of the given signal.Workspace
DWORK DOUBLE PRECISION array, dimension (N+1)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Let A(1), A(2),..., A(N) be a real signal of N samples. If SICO = 'S', the routine computes the sine transform of A as follows. First, transform A(i), i = 1,2,...,N, into the complex signal B(i), i = 1,2,...,(N+1)/2, where B(1) = -2*A(2), B(i) = {A(2i-2) - A(2i)} - j*A(2i-1) for i = 2,3,...,(N-1)/2, B((N+1)/2) = 2*A(N-1) and j**2 = -1. Next, perform a discrete inverse Fourier transform on B(i) by calling SLICOT Library Routine DG01ND, to give the complex signal Z(i), i = 1,2,...,(N-1)/2, from which the real signal C(i) may be obtained as follows: C(2i-1) = Re(Z(i)), C(2i) = Im(Z(i)) for i = 1,2,...,(N-1)/2. Finally, compute the sine transform coefficients S ,S ,...,S 1 2 N given by S = 0, 1 { [C(k) + C(N+1-k)] } S = DT*{[C(k) - C(N+1-k)] - -----------------------}, k { [2*sin(pi*(k-1)/(N-1))]} for k = 2,3,...,N-1, and S = 0. N If SICO = 'C', the routine computes the cosine transform of A as follows. First, transform A(i), i = 1,2,...,N, into the complex signal B(i), i = 1,2,...,(N+1)/2, where B(1) = 2*A(1), B(i) = 2*A(2i-1) + 2*j*{[A(2i-2) - A(2i)]} for i = 2,3,...,(N-1)/2 and B((N+1)/2) = 2*A(N). Next, perform a discrete inverse Fourier transform on B(i) by calling SLICOT Library Routine DG01ND, to give the complex signal Z(i), i = 1,2,...,(N-1)/2, from which the real signal D(i) may be obtained as follows: D(2i-1) = Re(Z(i)), D(2i) = Im(Z(i)) for i = 1,2,...,(N-1)/2. Finally, compute the cosine transform coefficients S ,S ,...,S 1 2 N given by S = 2*DT*[D(1) + A0], 1 { [D(k) - D(N+1-k)] } S = DT*{[D(k) + D(N+1-k)] - -----------------------}, k { [2*sin(pi*(k-1)/(N-1))]} for k = 2,3,...,N-1, and S = 2*DT*[D(1) - A0], N (N-1)/2 where A0 = 2*SUM A(2i). i=1References
[1] Rabiner, L.R. and Rader, C.M. Digital Signal Processing. IEEE Press, 1972. [2] Oppenheim, A.V. and Schafer, R.W. Discrete-Time Signal Processing. Prentice-Hall Signal Processing Series, 1989.Numerical Aspects
The algorithm requires 0( N*log(N) ) operations.Further Comments
NoneExample
Program Text
* DF01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 129 ) * .. Local Scalars .. DOUBLE PRECISION DT INTEGER I, INFO, N CHARACTER*1 SICO * .. Local Arrays .. DOUBLE PRECISION A(NMAX), DWORK(NMAX+1) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DF01MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, DT, SICO IF ( N.LE.1 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( A(I), I = 1,N ) * Compute the sine/cosine transform of the given real signal. CALL DF01MD( SICO, N, DT, A, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( SICO, 'S' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) I, A(I) 20 CONTINUE ELSE WRITE ( NOUT, FMT = 99996 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) I, A(I) 40 CONTINUE END IF END IF END IF * STOP * 99999 FORMAT (' DF01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DF01MD = ',I2) 99997 FORMAT (' Components of sine transform are',//' i',6X,'A(i)',/) 99996 FORMAT (' Components of cosine transform are',//' i',6X,'A(i)', $ /) 99995 FORMAT (I4,3X,F8.4) 99994 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
DF01MD EXAMPLE PROGRAM DATA 17 1.0 C -0.1862 0.1288 0.3948 0.0671 0.6788 -0.2417 0.1861 0.8875 0.7254 0.9380 0.5815 -0.2682 0.4904 0.9312 -0.9599 -0.3116 0.8743Program Results
DF01MD EXAMPLE PROGRAM RESULTS Components of cosine transform are i A(i) 1 28.0536 2 3.3726 3 -20.8158 4 6.0566 5 5.7317 6 -3.9347 7 -12.8074 8 -6.8780 9 16.2892 10 -17.0788 11 21.7836 12 -20.8203 13 -7.3277 14 -2.5325 15 -0.3636 16 7.8792 17 11.0048
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/DG01MD.html 0000664 0000000 0000000 00000013516 14560147231 0020334 0 ustar 00root root 0000000 0000000
Purpose
To compute the discrete Fourier transform, or inverse transform, of a complex signal.Specification
SUBROUTINE DG01MD( INDI, N, XR, XI, INFO ) C .. Scalar Arguments .. CHARACTER INDI INTEGER INFO, N C .. Array Arguments .. DOUBLE PRECISION XI(*), XR(*)Arguments
Mode Parameters
INDI CHARACTER*1 Indicates whether a Fourier transform or inverse Fourier transform is to be performed as follows: = 'D': (Direct) Fourier transform; = 'I': Inverse Fourier transform.Input/Output Parameters
N (input) INTEGER The number of complex samples. N must be a power of 2. N >= 2. XR (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the real part of either the complex signal z if INDI = 'D', or f(z) if INDI = 'I'. On exit, this array contains either the real part of the computed Fourier transform f(z) if INDI = 'D', or the inverse Fourier transform z of f(z) if INDI = 'I'. XI (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the imaginary part of either z if INDI = 'D', or f(z) if INDI = 'I'. On exit, this array contains either the imaginary part of f(z) if INDI = 'D', or z if INDI = 'I'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
If INDI = 'D', then the routine performs a discrete Fourier transform on the complex signal Z(i), i = 1,2,...,N. If the result is denoted by FZ(k), k = 1,2,...,N, then the relationship between Z and FZ is given by the formula: N ((k-1)*(i-1)) FZ(k) = SUM ( Z(i) * V ), i=1 2 where V = exp( -2*pi*j/N ) and j = -1. If INDI = 'I', then the routine performs an inverse discrete Fourier transform on the complex signal FZ(k), k = 1,2,...,N. If the result is denoted by Z(i), i = 1,2,...,N, then the relationship between Z and FZ is given by the formula: N ((k-1)*(i-1)) Z(i) = SUM ( FZ(k) * W ), k=1 where W = exp( 2*pi*j/N ). Note that a discrete Fourier transform, followed by an inverse discrete Fourier transform, will result in a signal which is a factor N larger than the original input signal.References
[1] Rabiner, L.R. and Rader, C.M. Digital Signal Processing. IEEE Press, 1972.Numerical Aspects
The algorithm requires 0( N*log(N) ) operations.Further Comments
NoneExample
Program Text
* DG01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 128 ) * .. Local Scalars .. INTEGER I, INFO, N CHARACTER*1 INDI * .. Local Arrays .. DOUBLE PRECISION XI(NMAX), XR(NMAX) * .. External Subroutines .. EXTERNAL DG01MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, INDI IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( XR(I), XI(I), I = 1,N ) * Find the Fourier transform of the given complex signal. CALL DG01MD( INDI, N, XR, XI, 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 ) I, XR(I), XI(I) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' DG01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DG01MD = ',I2) 99997 FORMAT (' Components of Fourier transform are',//' i',6X, $ 'XR(i)',6X,'XI(i)',/) 99996 FORMAT (I4,3X,F8.4,3X,F8.4) 99995 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
DG01MD EXAMPLE PROGRAM DATA 8 D -0.1862 0.1288 0.3948 0.0671 0.6788 -0.2417 0.1861 0.8875 0.7254 0.9380 0.5815 -0.2682 0.4904 0.9312 -0.9599 -0.3116Program Results
DG01MD EXAMPLE PROGRAM RESULTS Components of Fourier transform are i XR(i) XI(i) 1 1.9109 2.1311 2 -1.9419 -2.2867 3 -1.4070 -1.3728 4 2.2886 -0.6883 5 1.5059 1.3815 6 -2.2271 0.2915 7 0.1470 2.1274 8 -1.7660 -0.5533
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/DG01ND.html 0000664 0000000 0000000 00000022104 14560147231 0020326 0 ustar 00root root 0000000 0000000
Purpose
To compute the discrete Fourier transform, or inverse Fourier transform, of a real signal.Specification
SUBROUTINE DG01ND( INDI, N, XR, XI, INFO ) C .. Scalar Arguments .. CHARACTER INDI INTEGER INFO, N C .. Array Arguments .. DOUBLE PRECISION XI(*), XR(*)Arguments
Mode Parameters
INDI CHARACTER*1 Indicates whether a Fourier transform or inverse Fourier transform is to be performed as follows: = 'D': (Direct) Fourier transform; = 'I': Inverse Fourier transform.Input/Output Parameters
N (input) INTEGER Half the number of real samples. N must be a power of 2. N >= 2. XR (input/output) DOUBLE PRECISION array, dimension (N+1) On entry with INDI = 'D', the first N elements of this array must contain the odd part of the input signal; for example, XR(I) = A(2*I-1) for I = 1,2,...,N. On entry with INDI = 'I', the first N+1 elements of this array must contain the the real part of the input discrete Fourier transform (computed, for instance, by a previous call of the routine). On exit with INDI = 'D', the first N+1 elements of this array contain the real part of the output signal, that is of the computed discrete Fourier transform. On exit with INDI = 'I', the first N elements of this array contain the odd part of the output signal, that is of the computed inverse discrete Fourier transform. XI (input/output) DOUBLE PRECISION array, dimension (N+1) On entry with INDI = 'D', the first N elements of this array must contain the even part of the input signal; for example, XI(I) = A(2*I) for I = 1,2,...,N. On entry with INDI = 'I', the first N+1 elements of this array must contain the the imaginary part of the input discrete Fourier transform (computed, for instance, by a previous call of the routine). On exit with INDI = 'D', the first N+1 elements of this array contain the imaginary part of the output signal, that is of the computed discrete Fourier transform. On exit with INDI = 'I', the first N elements of this array contain the even part of the output signal, that is of the computed inverse discrete Fourier transform.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Let A(1),....,A(2*N) be a real signal of 2*N samples. Then the first N+1 samples of the discrete Fourier transform of this signal are given by the formula: 2*N ((m-1)*(i-1)) FA(m) = SUM ( A(i) * W ), i=1 2 where m = 1,2,...,N+1, W = exp(-pi*j/N) and j = -1. This transform can be computed as follows. First, transform A(i), i = 1,2,...,2*N, into the complex signal Z(i) = (X(i),Y(i)), i = 1,2,...,N. That is, X(i) = A(2*i-1) and Y(i) = A(2*i). Next, perform a discrete Fourier transform on Z(i) by calling SLICOT Library routine DG01MD. This gives a new complex signal FZ(k), such that N ((k-1)*(i-1)) FZ(k) = SUM ( Z(i) * V ), i=1 where k = 1,2,...,N, V = exp(-2*pi*j/N). Using the values of FZ(k), the components of the discrete Fourier transform FA can be computed by simple linear relations, implemented in the DG01NY subroutine. Finally, let XR(k) = Re(FZ(k)), XI(k) = Im(FZ(k)), k = 1,2,...,N, be the contents of the arrays XR and XI on entry to DG01NY with INDI = 'D', then on exit XR and XI contain the real and imaginary parts of the Fourier transform of the original real signal A. That is, XR(m) = Re(FA(m)), XI(m) = Im(FA(m)), where m = 1,2,...,N+1. If INDI = 'I', then the routine evaluates the inverse Fourier transform of a complex signal which may itself be the discrete Fourier transform of a real signal. Let FA(m), m = 1,2,...,2*N, denote the full discrete Fourier transform of a real signal A(i), i=1,2,...,2*N. The relationship between FA and A is given by the formula: 2*N ((m-1)*(i-1)) A(i) = SUM ( FA(m) * W ), m=1 where W = exp(pi*j/N). Let XR(m) = Re(FA(m)) and XI(m) = Im(FA(m)) for m = 1,2,...,N+1, be the contents of the arrays XR and XI on entry to the routine DG01NY with INDI = 'I', then on exit the first N samples of the complex signal FZ are returned in XR and XI such that XR(k) = Re(FZ(k)), XI(k) = Im(FZ(k)) and k = 1,2,...,N. Next, an inverse Fourier transform is performed on FZ (e.g. by calling SLICOT Library routine DG01MD), to give the complex signal Z, whose i-th component is given by the formula: N ((k-1)*(i-1)) Z(i) = SUM ( FZ(k) * V ), k=1 where i = 1,2,...,N and V = exp(2*pi*j/N). Finally, the 2*N samples of the real signal A can then be obtained directly from Z. That is, A(2*i-1) = Re(Z(i)) and A(2*i) = Im(Z(i)), for i = 1,2,...N. Note that a discrete Fourier transform, followed by an inverse transform will result in a signal which is a factor 2*N larger than the original input signal.References
[1] Rabiner, L.R. and Rader, C.M. Digital Signal Processing. IEEE Press, 1972.Numerical Aspects
The algorithm requires 0( N*log(N) ) operations.Further Comments
NoneExample
Program Text
* DG01ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 128 ) * .. Local Scalars .. INTEGER I, IEND, INFO, N CHARACTER*1 INDI * .. Local Arrays .. DOUBLE PRECISION A(2*NMAX), XI(NMAX+1), XR(NMAX+1) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DG01ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, INDI IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( A(I), I = 1,2*N ) * Copy the odd and even parts of A into XR and XI respectively. DO 20 I = 1, N XR(I) = A(2*I-1) XI(I) = A(2*I) 20 CONTINUE * Find the Fourier transform of the given real signal. CALL DG01ND( INDI, N, XR, XI, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) IEND = N IF ( LSAME( INDI, 'D' ) ) IEND = N + 1 DO 40 I = 1, IEND WRITE ( NOUT, FMT = 99996 ) I, XR(I), XI(I) 40 CONTINUE END IF END IF STOP * 99999 FORMAT (' DG01ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DG01ND = ',I2) 99997 FORMAT (' Components of Fourier transform are',//' i',6X, $ 'XR(i)',6X,'XI(i)',/) 99996 FORMAT (I4,3X,F8.4,3X,F8.4) 99995 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
DG01ND EXAMPLE PROGRAM DATA 8 D -0.1862 0.1288 0.3948 0.0671 0.6788 -0.2417 0.1861 0.8875 0.7254 0.9380 0.5815 -0.2682 0.4904 0.9312 -0.9599 -0.3116Program Results
DG01ND EXAMPLE PROGRAM RESULTS Components of Fourier transform are i XR(i) XI(i) 1 4.0420 0.0000 2 -3.1322 -0.2421 3 0.1862 -1.4675 4 -2.1312 -1.1707 5 1.5059 -1.3815 6 2.1927 -0.1908 7 -1.4462 2.0327 8 -0.5757 1.4914 9 -0.2202 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/DG01OD.html 0000664 0000000 0000000 00000012433 14560147231 0020333 0 ustar 00root root 0000000 0000000
Purpose
To compute the (scrambled) discrete Hartley transform of a real signal.Specification
SUBROUTINE DG01OD( SCR, WGHT, N, A, W, INFO ) C .. Scalar Arguments .. CHARACTER SCR, WGHT INTEGER INFO, N C .. Array Arguments .. DOUBLE PRECISION A(*), W(*)Arguments
Mode Parameters
SCR CHARACTER*1 Indicates whether the signal is scrambled on input or on output as follows: = 'N': the signal is not scrambled at all; = 'I': the input signal is bit-reversed; = 'O': the output transform is bit-reversed. WGHT CHARACTER*1 Indicates whether the precomputed weights are available or not, as follows: = 'A': available; = 'N': not available. Note that if N > 1 and WGHT = 'N' on entry, then WGHT is set to 'A' on exit.Input/Output Parameters
N (input) INTEGER Number of real samples. N must be a power of 2. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (N) On entry with SCR = 'N' or SCR = 'O', this array must contain the input signal. On entry with SCR = 'I', this array must contain the bit-reversed input signal. On exit with SCR = 'N' or SCR = 'I', this array contains the Hartley transform of the input signal. On exit with SCR = 'O', this array contains the bit-reversed Hartley transform. W (input/output) DOUBLE PRECISION array, dimension (N - LOG2(N)) On entry with WGHT = 'A', this array must contain the long weight vector computed by a previous call of this routine with the same value of N. If WGHT = 'N', the contents of this array on entry is ignored. On exit, this array contains the long weight vector.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
This routine uses a Hartley butterfly algorithm as described in [1].References
[1] Van Loan, Charles. Computational frameworks for the fast Fourier transform. SIAM, 1992.Numerical Aspects
The algorithm is backward stable and requires O(N log(N)) floating point operations.Further Comments
NoneExample
Program Text
* DG01OD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 128 ) * .. Local Scalars .. INTEGER I, INFO, N CHARACTER*1 SCR, WGHT * .. Local Arrays .. DOUBLE PRECISION A(NMAX), W(NMAX) * .. External Subroutines .. EXTERNAL DG01OD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, SCR, WGHT IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( A(I), I = 1,N ) * Compute the Hartley transform. CALL DG01OD( SCR, WGHT, N, A, W, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99996 ) I, A(I) 10 CONTINUE END IF END IF STOP * 99999 FORMAT (' DG01OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DG01OD = ',I2) 99997 FORMAT (' Hartley transform ',//' i A(i)',/) 99996 FORMAT (I4,1X,F8.4) 99995 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
DG01OD EXAMPLE 16 N N 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0Program Results
DG01OD EXAMPLE PROGRAM RESULTS Hartley transform i A(i) 1 136.0000 2 -48.2187 3 -27.3137 4 -19.9728 5 -16.0000 6 -13.3454 7 -11.3137 8 -9.5913 9 -8.0000 10 -6.4087 11 -4.6863 12 -2.6546 13 0.0000 14 3.9728 15 11.3137 16 32.2187
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/DK01MD.html 0000664 0000000 0000000 00000011140 14560147231 0020327 0 ustar 00root root 0000000 0000000
Purpose
To apply an anti-aliasing window to a real signal.Specification
SUBROUTINE DK01MD( TYPE, N, A, INFO ) C .. Scalar Arguments .. CHARACTER TYPE INTEGER INFO, N C .. Array Arguments .. DOUBLE PRECISION A(*)Arguments
Mode Parameters
TYPE CHARACTER*1 Indicates the type of window to be applied to the signal as follows: = 'M': Hamming window; = 'N': Hann window; = 'Q': Quadratic window.Input/Output Parameters
N (input) INTEGER The number of samples. N >= 1. A (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the signal to be processed. On exit, this array contains the windowing function.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
If TYPE = 'M', then a Hamming window is applied to A(1),...,A(N), which yields _ A(i) = (0.54 + 0.46*cos(pi*(i-1)/(N-1)))*A(i), i = 1,2,...,N. If TYPE = 'N', then a Hann window is applied to A(1),...,A(N), which yields _ A(i) = 0.5*(1 + cos(pi*(i-1)/(N-1)))*A(i), i = 1,2,...,N. If TYPE = 'Q', then a quadratic window is applied to A(1),..., A(N), which yields _ A(i) = (1 - 2*((i-1)/(N-1))**2)*(1 - (i-1)/(N-1))*A(i), i = 1,2,...,(N-1)/2+1; _ A(i) = 2*(1 - ((i-1)/(N-1))**3)*A(i), i = (N-1)/2+2,...,N.References
[1] Rabiner, L.R. and Rader, C.M. Digital Signal Processing. IEEE Press, 1972.Numerical Aspects
The algorithm requires 0( N ) operations.Further Comments
NoneExample
Program Text
* DK01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) * .. Local Scalars .. CHARACTER*1 TYPE INTEGER I, INFO, N * .. Local Arrays .. DOUBLE PRECISION A(NMAX) * .. External Subroutines .. EXTERNAL DK01MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, TYPE IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( A(I), I = 1,N ) * Apply a Hamming window to the given signal. CALL DK01MD( TYPE, N, A, 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 ) I, A(I) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' DK01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DK01MD = ',I2) 99997 FORMAT (' Components of the windowing function are',//' k ', $ ' A(k)',/) 99996 FORMAT (I4,3X,F8.4) 99995 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
DK01MD EXAMPLE PROGRAM DATA 8 M 0.3262 0.8723 -0.7972 0.6673 -0.1722 0.3237 0.5263 -0.3275Program Results
DK01MD EXAMPLE PROGRAM RESULTS Components of the windowing function are k A(k) 1 0.3262 2 0.8326 3 -0.6591 4 0.4286 5 -0.0754 6 0.0820 7 0.0661 8 -0.0262
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/FB01QD.html 0000664 0000000 0000000 00000041364 14560147231 0020337 0 ustar 00root root 0000000 0000000
Purpose
To calculate a combined measurement and time update of one iteration of the time-varying Kalman filter. This update is given for the square root covariance filter, using dense matrices.Specification
SUBROUTINE FB01QD( JOBK, MULTBQ, N, M, P, S, LDS, A, LDA, B, $ LDB, Q, LDQ, C, LDC, R, LDR, K, LDK, TOL, $ IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBK, MULTBQ INTEGER INFO, LDA, LDB, LDC, LDK, LDQ, LDR, LDS, LDWORK, $ M, N, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ K(LDK,*), Q(LDQ,*), R(LDR,*), S(LDS,*)Arguments
Mode Parameters
JOBK CHARACTER*1 Indicates whether the user wishes to compute the Kalman filter gain matrix K as follows: i = 'K': K is computed and stored in array K; i = 'N': K is not required. i MULTBQ CHARACTER*1 1/2 Indicates how matrices B and Q are to be passed to i i the routine as follows: = 'P': Array Q is not used and the array B must contain 1/2 the product B Q ; i i = 'N': Arrays B and Q must contain the matrices as described below.Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e., the order of the matrices S and A . N >= 0. i-1 i M (input) INTEGER The actual input dimension, i.e., the order of the matrix 1/2 Q . M >= 0. i P (input) INTEGER The actual output dimension, i.e., the order of the matrix 1/2 R . P >= 0. i S (input/output) DOUBLE PRECISION array, dimension (LDS,N) On entry, the leading N-by-N lower triangular part of this array must contain S , the square root (left Cholesky i-1 factor) of the state covariance matrix at instant (i-1). On exit, the leading N-by-N lower triangular part of this array contains S , the square root (left Cholesky factor) i of the state covariance matrix at instant i. The strict upper triangular part of this array is not referenced. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,N). A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain A , i the state transition matrix of the discrete system at instant i. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain B , 1/2 i the input weight matrix (or the product B Q if i i MULTBQ = 'P') of the discrete system at instant i. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). Q (input) DOUBLE PRECISION array, dimension (LDQ,*) If MULTBQ = 'N', then the leading M-by-M lower triangular 1/2 part of this array must contain Q , the square root i (left Cholesky factor) of the input (process) noise covariance matrix at instant i. The strict upper triangular part of this array is not referenced. If MULTBQ = 'P', Q is not referenced and can be supplied as a dummy array (i.e., set parameter LDQ = 1 and declare this array to be Q(1,1) in the calling program). LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,M) if MULTBQ = 'N'; LDQ >= 1 if MULTBQ = 'P'. C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain C , the i output weight matrix of the discrete system at instant i. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). R (input/output) DOUBLE PRECISION array, dimension (LDR,P) On entry, the leading P-by-P lower triangular part of this 1/2 array must contain R , the square root (left Cholesky i factor) of the output (measurement) noise covariance matrix at instant i. On exit, the leading P-by-P lower triangular part of this 1/2 array contains (RINOV ) , the square root (left Cholesky i factor) of the covariance matrix of the innovations at instant i. The strict upper triangular part of this array is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,P). K (output) DOUBLE PRECISION array, dimension (LDK,P) If JOBK = 'K', and INFO = 0, then the leading N-by-P part of this array contains K , the Kalman filter gain matrix i at instant i. If JOBK = 'N', or JOBK = 'K' and INFO = 1, then the leading N-by-P part of this array contains AK , a matrix i related to the Kalman filter gain matrix at instant i (see -1/2 METHOD). Specifically, AK = A P C'(RINOV') . i i i|i-1 i i LDK INTEGER The leading dimension of array K. LDK >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION If JOBK = 'K', then TOL is used to test for near 1/2 singularity of the matrix (RINOV ) . If the user sets i TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number of that matrix; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = P*P*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). Otherwise, TOL is not referenced.Workspace
IWORK INTEGER array, dimension (LIWORK), where LIWORK = P if JOBK = 'K', and LIWORK = 1 otherwise. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. If INFO = 0 and JOBK = 'K', DWORK(2) returns an estimate of the reciprocal of the condition number 1/2 (in the 1-norm) of (RINOV ) . i LDWORK The length of the array DWORK. LDWORK >= MAX(1,N*(P+N)+2*P,N*(N+M+2)), if JOBK = 'N'; LDWORK >= MAX(2,N*(P+N)+2*P,N*(N+M+2),3*P), if JOBK = 'K'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; 1/2 = 1: if JOBK = 'K' and the matrix (RINOV ) is singular, i 1/2 i.e., the condition number estimate of (RINOV ) i (in the 1-norm) exceeds 1/TOL. The matrices S, AK , 1/2 i and (RINOV ) have been computed. iMethod
The routine performs one recursion of the square root covariance filter algorithm, summarized as follows: | 1/2 | | 1/2 | | R C x S 0 | | (RINOV ) 0 0 | | i i i-1 | | i | | 1/2 | T = | | | 0 A x S B x Q | | AK S 0 | | i i-1 i i | | i i | (Pre-array) (Post-array) where T is an orthogonal transformation triangularizing the pre-array. The state covariance matrix P is factorized as i|i-1 P = S S' i|i-1 i i and one combined time and measurement update for the state X i|i-1 is given by X = A X + K (Y - C X ), i+1|i i i|i-1 i i i i|i-1 -1/2 where K = AK (RINOV ) is the Kalman filter gain matrix and Y i i i i is the observed output of the system. The triangularization is done entirely via Householder transformations exploiting the zero pattern of the pre-array.References
[1] Anderson, B.D.O. and Moore, J.B. Optimal Filtering. Prentice Hall, Englewood Cliffs, New Jersey, 1979. [2] Verhaegen, M.H.G. and Van Dooren, P. Numerical Aspects of Different Kalman Filter Implementations. IEEE Trans. Auto. Contr., AC-31, pp. 907-917, Oct. 1986. [3] Vanbegin, M., Van Dooren, P., and Verhaegen, M.H.G. Algorithm 675: FORTRAN Subroutines for Computing the Square Root Covariance Filter and Square Root Information Filter in Dense or Hessenberg Forms. ACM Trans. Math. Software, 15, pp. 243-256, 1989.Numerical Aspects
The algorithm requires 3 2 2 2 (7/6)N + N x (5/2 x P + M) + N x (1/2 x M + P ) operations and is backward stable (see [2]).Further Comments
NoneExample
Program Text
* FB01QD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDK, LDQ, LDR, LDS PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDK = NMAX, LDQ = MMAX, LDR = PMAX, $ LDS = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX*(PMAX+NMAX)+2*PMAX, $ NMAX*(NMAX+MMAX+2), 3*PMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, ISTEP, J, M, N, P CHARACTER*1 JOBK, MULTBQ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DIAG(PMAX), DWORK(LDWORK), K(LDK,PMAX), $ Q(LDQ,MMAX), R(LDR,PMAX), S(LDS,NMAX) INTEGER IWORK(PMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DCOPY, FB01QD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOBK, TOL, MULTBQ IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( S(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( LSAME( MULTBQ, 'N' ) ) READ ( NIN, FMT = *) $ ( ( Q(I,J), J = 1,M ), I = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99992 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( R(I,J), J = 1,P ), I = 1,P ) * Save the strict lower triangle of R in its strict upper * triangle and the diagonal in the array DIAG. DO 10 I = 2, P CALL DCOPY( I, R(I,1), LDR, R(1,I), 1 ) 10 CONTINUE CALL DCOPY( P, R, LDR+1, DIAG, 1 ) * Perform three iterations of the (Kalman) filter recursion * (in square root covariance form). ISTEP = 1 20 CONTINUE CALL FB01QD( JOBK, MULTBQ, N, M, P, S, LDS, A, LDA, $ B, LDB, Q, LDQ, C, LDC, R, LDR, K, LDK, $ TOL, IWORK, DWORK, LDWORK, INFO ) ISTEP = ISTEP + 1 IF ( INFO.EQ.0 .AND. ISTEP.LE.3 ) THEN * Restore the lower triangle of R. DO 30 I = 2, P CALL DCOPY( I, R(1,I), 1, R(I,1), LDR ) 30 CONTINUE CALL DCOPY( P, DIAG, 1, R, LDR+1 ) GO TO 20 END IF * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( S(I,J), J = 1,N ) 40 CONTINUE IF ( LSAME( JOBK, 'K' ) ) THEN WRITE ( NOUT, FMT = 99996 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( K(I,J), J = 1,P ) 60 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' FB01QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from FB01QD = ',I2) 99997 FORMAT (' The square root of the state covariance matrix is ') 99996 FORMAT (/' The Kalman gain matrix is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
FB01QD EXAMPLE PROGRAM DATA 4 2 2 K 0.0 N 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.2113 0.8497 0.7263 0.8833 0.7560 0.6857 0.1985 0.6525 0.0002 0.8782 0.5442 0.3076 0.3303 0.0683 0.2320 0.9329 0.5618 0.5042 0.5896 0.3493 0.6853 0.3873 0.8906 0.9222 1.0000 0.0000 0.0000 1.0000 0.3616 0.5664 0.5015 0.2693 0.2922 0.4826 0.4368 0.6325 0.9488 0.0000 0.3760 0.7340Program Results
FB01QD EXAMPLE PROGRAM RESULTS The square root of the state covariance matrix is -1.2936 0.0000 0.0000 0.0000 -1.1382 -0.2579 0.0000 0.0000 -0.9622 -0.1529 0.2974 0.0000 -1.3076 0.0936 0.4508 -0.4897 The Kalman gain matrix is 0.3638 0.9469 0.3532 0.8179 0.2471 0.5542 0.1982 0.6471
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/FB01RD.html 0000664 0000000 0000000 00000042754 14560147231 0020344 0 ustar 00root root 0000000 0000000
Purpose
To calculate a combined measurement and time update of one iteration of the time-invariant Kalman filter. This update is given for the square root covariance filter, using the condensed observer Hessenberg form.Specification
SUBROUTINE FB01RD( JOBK, MULTBQ, N, M, P, S, LDS, A, LDA, B, $ LDB, Q, LDQ, C, LDC, R, LDR, K, LDK, TOL, $ IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBK, MULTBQ INTEGER INFO, LDA, LDB, LDC, LDK, LDQ, LDR, LDS, LDWORK, $ M, N, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ K(LDK,*), Q(LDQ,*), R(LDR,*), S(LDS,*)Arguments
Mode Parameters
JOBK CHARACTER*1 Indicates whether the user wishes to compute the Kalman filter gain matrix K as follows: i = 'K': K is computed and stored in array K; i = 'N': K is not required. i MULTBQ CHARACTER*1 1/2 Indicates how matrices B and Q are to be passed to i i the routine as follows: = 'P': Array Q is not used and the array B must contain 1/2 the product B Q ; i i = 'N': Arrays B and Q must contain the matrices as described below.Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e., the order of the matrices S and A. N >= 0. i-1 M (input) INTEGER The actual input dimension, i.e., the order of the matrix 1/2 Q . M >= 0. i P (input) INTEGER The actual output dimension, i.e., the order of the matrix 1/2 R . P >= 0. i S (input/output) DOUBLE PRECISION array, dimension (LDS,N) On entry, the leading N-by-N lower triangular part of this array must contain S , the square root (left Cholesky i-1 factor) of the state covariance matrix at instant (i-1). On exit, the leading N-by-N lower triangular part of this array contains S , the square root (left Cholesky factor) i of the state covariance matrix at instant i. The strict upper triangular part of this array is not referenced. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,N). A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain A, the state transition matrix of the discrete system in lower observer Hessenberg form (e.g., as produced by SLICOT Library Routine TB01ND). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain B , 1/2 i the input weight matrix (or the product B Q if i i MULTBQ = 'P') of the discrete system at instant i. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). Q (input) DOUBLE PRECISION array, dimension (LDQ,*) If MULTBQ = 'N', then the leading M-by-M lower triangular 1/2 part of this array must contain Q , the square root i (left Cholesky factor) of the input (process) noise covariance matrix at instant i. The strict upper triangular part of this array is not referenced. Otherwise, Q is not referenced and can be supplied as a dummy array (i.e., set parameter LDQ = 1 and declare this array to be Q(1,1) in the calling program). LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,M) if MULTBQ = 'N'; LDQ >= 1 if MULTBQ = 'P'. C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain C, the output weight matrix of the discrete system in lower observer Hessenberg form (e.g., as produced by SLICOT Library routine TB01ND). LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). R (input/output) DOUBLE PRECISION array, dimension (LDR,P) On entry, the leading P-by-P lower triangular part of this 1/2 array must contain R , the square root (left Cholesky i factor) of the output (measurement) noise covariance matrix at instant i. On exit, the leading P-by-P lower triangular part of this 1/2 array contains (RINOV ) , the square root (left Cholesky i factor) of the covariance matrix of the innovations at instant i. The strict upper triangular part of this array is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,P). K (output) DOUBLE PRECISION array, dimension (LDK,P) If JOBK = 'K', and INFO = 0, then the leading N-by-P part of this array contains K , the Kalman filter gain matrix i at instant i. If JOBK = 'N', or JOBK = 'K' and INFO = 1, then the leading N-by-P part of this array contains AK , a matrix i related to the Kalman filter gain matrix at instant i (see -1/2 METHOD). Specifically, AK = A P C'(RINOV') . i i|i-1 i LDK INTEGER The leading dimension of array K. LDK >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION If JOBK = 'K', then TOL is used to test for near 1/2 singularity of the matrix (RINOV ) . If the user sets i TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number of that matrix; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = P*P*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). Otherwise, TOL is not referenced.Workspace
IWORK INTEGER array, dimension (LIWORK) where LIWORK = P if JOBK = 'K', and LIWORK = 1 otherwise. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. If INFO = 0 and JOBK = 'K', DWORK(2) returns an estimate of the reciprocal of the condition number 1/2 (in the 1-norm) of (RINOV ) . i LDWORK The length of the array DWORK. LDWORK >= MAX(1,N*(P+N+1),N*(P+N)+2*P,N*(N+M+2)), if JOBK = 'N'; LDWORK >= MAX(2,N*(P+N+1),N*(P+N)+2*P,N*(N+M+2),3*P), if JOBK = 'K'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; 1/2 = 1: if JOBK = 'K' and the matrix (RINOV ) is singular, i 1/2 i.e., the condition number estimate of (RINOV ) i (in the 1-norm) exceeds 1/TOL. The matrices S, AK , 1/2 i and (RINOV ) have been computed. iMethod
The routine performs one recursion of the square root covariance filter algorithm, summarized as follows: | 1/2 | | 1/2 | | R 0 C x S | | (RINOV ) 0 0 | | i i-1 | | i | | 1/2 | T = | | | 0 B x Q A x S | | AK S 0 | | i i i-1 | | i i | (Pre-array) (Post-array) where T is unitary and (A,C) is in lower observer Hessenberg form. An example of the pre-array is given below (where N = 6, P = 2 and M = 3): |x | | x | |x x | | x x | |____|______|____________| | | x x x| x x x | | | x x x| x x x x | | | x x x| x x x x x | | | x x x| x x x x x x| | | x x x| x x x x x x| | | x x x| x x x x x x| The corresponding state covariance matrix P is then i|i-1 factorized as P = S S' i|i-1 i i and one combined time and measurement update for the state X i|i-1 is given by X = A X + K (Y - C X ) i+1|i i|i-1 i i i|i-1 -1/2 where K = AK (RINOV ) is the Kalman filter gain matrix and Y i i i i is the observed output of the system. The triangularization is done entirely via Householder transformations exploiting the zero pattern of the pre-array.References
[1] Anderson, B.D.O. and Moore, J.B. Optimal Filtering. Prentice Hall, Englewood Cliffs, New Jersey, 1979. [2] Van Dooren, P. and Verhaegen, M.H.G. Condensed Forms for Efficient Time-Invariant Kalman Filtering. SIAM J. Sci. Stat. Comp., 9. pp. 516-530, 1988. [3] Verhaegen, M.H.G. and Van Dooren, P. Numerical Aspects of Different Kalman Filter Implementations. IEEE Trans. Auto. Contr., AC-31, pp. 907-917, Oct. 1986. [4] Vanbegin, M., Van Dooren, P., and Verhaegen, M.H.G. Algorithm 675: FORTRAN Subroutines for Computing the Square Root Covariance Filter and Square Root Information Filter in Dense or Hessenberg Forms. ACM Trans. Math. Software, 15, pp. 243-256, 1989.Numerical Aspects
The algorithm requires 3 2 2 3 1/6 x N + N x (3/2 x P + M) + 2 x N x P + 2/3 x P operations and is backward stable (see [3]).Further Comments
NoneExample
Program Text
* FB01RD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDK, LDQ, LDR, LDS PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, LDK = NMAX, $ LDQ = MMAX, LDR = PMAX, LDS = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX*(PMAX+NMAX+1), $ NMAX*(PMAX+NMAX)+2*PMAX, $ NMAX*(NMAX+MMAX+2), 3*PMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, ISTEP, J, M, N, P CHARACTER*1 JOBK, MULTBQ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DIAG(PMAX), DWORK(LDWORK), K(LDK,PMAX), $ Q(LDQ,MMAX), R(LDR,PMAX), S(LDS,NMAX) INTEGER IWORK(PMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DCOPY, FB01RD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOBK, TOL, MULTBQ IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( S(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( LSAME( MULTBQ, 'N' ) ) READ ( NIN, FMT = * ) $ ( ( Q(I,J), J = 1,M ), I = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99992 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( R(I,J), J = 1,P ), I = 1,P ) * Save the strict lower triangle of R in its strict upper * triangle and the diagonal in the array DIAG. DO 10 I = 2, P CALL DCOPY( I, R(I,1), LDR, R(1,I), 1 ) 10 CONTINUE CALL DCOPY( P, R, LDR+1, DIAG, 1 ) * Perform three iterations of the (Kalman) filter recursion * (in square root covariance form). ISTEP = 1 20 CONTINUE CALL FB01RD( JOBK, MULTBQ, N, M, P, S, LDS, A, LDA, $ B, LDB, Q, LDQ, C, LDC, R, LDR, K, LDK, $ TOL, IWORK, DWORK, LDWORK, INFO ) ISTEP = ISTEP + 1 IF ( INFO.EQ.0 .AND. ISTEP.LE.3 ) THEN * Restore the lower triangle of R. DO 30 I = 2, P CALL DCOPY( I, R(1,I), 1, R(I,1), LDR ) 30 CONTINUE CALL DCOPY( P, DIAG, 1, R, LDR+1 ) GO TO 20 END IF * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( S(I,J), J = 1,N ) 40 CONTINUE IF ( LSAME( JOBK, 'K' ) ) THEN WRITE ( NOUT, FMT = 99996 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( K(I,J), J = 1,P ) 60 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' FB01RD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from FB01QD = ',I2) 99997 FORMAT (' The square root of the state covariance matrix is ') 99996 FORMAT (/' The Kalman gain matrix is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
FB01RD EXAMPLE PROGRAM DATA 4 2 2 K 0.0 N 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.2113 0.8497 0.7263 0.0000 0.7560 0.6857 0.1985 0.6525 0.0002 0.8782 0.5442 0.3076 0.3303 0.0683 0.2320 0.9329 0.5618 0.5042 0.5896 0.3493 0.6853 0.3873 0.8906 0.9222 1.0000 0.0000 0.0000 1.0000 0.3616 0.0000 0.0000 0.0000 0.2922 0.4826 0.0000 0.0000 0.9488 0.0000 0.3760 0.7340Program Results
FB01RD EXAMPLE PROGRAM RESULTS The square root of the state covariance matrix is -1.7223 0.0000 0.0000 0.0000 -2.1073 0.5467 0.0000 0.0000 -1.7649 0.1412 -0.1710 0.0000 -1.8291 0.2058 -0.1497 0.7760 The Kalman gain matrix is -0.2135 1.6649 -0.2345 2.1442 -0.2147 1.7069 -0.1345 1.4777
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/FB01SD.html 0000664 0000000 0000000 00000047612 14560147231 0020343 0 ustar 00root root 0000000 0000000
Purpose
To calculate a combined measurement and time update of one iteration of the time-varying Kalman filter. This update is given for the square root information filter, using dense matrices.Specification
SUBROUTINE FB01SD( JOBX, MULTAB, MULTRC, N, M, P, SINV, LDSINV, $ AINV, LDAINV, B, LDB, RINV, LDRINV, C, LDC, $ QINV, LDQINV, X, RINVY, Z, E, TOL, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBX, MULTAB, MULTRC INTEGER INFO, LDAINV, LDB, LDC, LDQINV, LDRINV, LDSINV, $ LDWORK, M, N, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION AINV(LDAINV,*), B(LDB,*), C(LDC,*), DWORK(*), $ E(*), QINV(LDQINV,*), RINV(LDRINV,*), RINVY(*), $ SINV(LDSINV,*), X(*), Z(*)Arguments
Mode Parameters
JOBX CHARACTER*1 Indicates whether X is to be computed as follows: i+1 = 'X': X is computed and stored in array X; i+1 = 'N': X is not required. i+1 MULTAB CHARACTER*1 -1 Indicates how matrices A and B are to be passed to i i the routine as follows: -1 = 'P': Array AINV must contain the matrix A and the -1 i array B must contain the product A B ; i i = 'N': Arrays AINV and B must contain the matrices as described below. MULTRC CHARACTER*1 -1/2 Indicates how matrices R and C are to be passed to i+1 i+1 the routine as follows: = 'P': Array RINV is not used and the array C must -1/2 contain the product R C ; i+1 i+1 = 'N': Arrays RINV and C must contain the matrices as described below.Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e., the order of the -1 -1 matrices S and A . N >= 0. i i M (input) INTEGER The actual input dimension, i.e., the order of the matrix -1/2 Q . M >= 0. i P (input) INTEGER The actual output dimension, i.e., the order of the matrix -1/2 R . P >= 0. i+1 SINV (input/output) DOUBLE PRECISION array, dimension (LDSINV,N) On entry, the leading N-by-N upper triangular part of this -1 array must contain S , the inverse of the square root i (right Cholesky factor) of the state covariance matrix P (hence the information square root) at instant i. i|i On exit, the leading N-by-N upper triangular part of this -1 array contains S , the inverse of the square root (right i+1 Cholesky factor) of the state covariance matrix P i+1|i+1 (hence the information square root) at instant i+1. The strict lower triangular part of this array is not referenced. LDSINV INTEGER The leading dimension of array SINV. LDSINV >= MAX(1,N). AINV (input) DOUBLE PRECISION array, dimension (LDAINV,N) -1 The leading N-by-N part of this array must contain A , i the inverse of the state transition matrix of the discrete system at instant i. LDAINV INTEGER The leading dimension of array AINV. LDAINV >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain B , -1 i the input weight matrix (or the product A B if i i MULTAB = 'P') of the discrete system at instant i. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). RINV (input) DOUBLE PRECISION array, dimension (LDRINV,*) If MULTRC = 'N', then the leading P-by-P upper triangular -1/2 part of this array must contain R , the inverse of the i+1 covariance square root (right Cholesky factor) of the output (measurement) noise (hence the information square root) at instant i+1. The strict lower triangular part of this array is not referenced. Otherwise, RINV is not referenced and can be supplied as a dummy array (i.e., set parameter LDRINV = 1 and declare this array to be RINV(1,1) in the calling program). LDRINV INTEGER The leading dimension of array RINV. LDRINV >= MAX(1,P) if MULTRC = 'N'; LDRINV >= 1 if MULTRC = 'P'. C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain C , -1/2 i+1 the output weight matrix (or the product R C if i+1 i+1 MULTRC = 'P') of the discrete system at instant i+1. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). QINV (input/output) DOUBLE PRECISION array, dimension (LDQINV,M) On entry, the leading M-by-M upper triangular part of this -1/2 array must contain Q , the inverse of the covariance i square root (right Cholesky factor) of the input (process) noise (hence the information square root) at instant i. On exit, the leading M-by-M upper triangular part of this -1/2 array contains (QINOV ) , the inverse of the covariance i square root (right Cholesky factor) of the process noise innovation (hence the information square root) at instant i. The strict lower triangular part of this array is not referenced. LDQINV INTEGER The leading dimension of array QINV. LDQINV >= MAX(1,M). X (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain X , the estimated i filtered state at instant i. On exit, if JOBX = 'X', and INFO = 0, then this array contains X , the estimated filtered state at i+1 instant i+1. On exit, if JOBX = 'N', or JOBX = 'X' and INFO = 1, then -1 this array contains S X . i+1 i+1 RINVY (input) DOUBLE PRECISION array, dimension (P) -1/2 This array must contain R Y , the product of the i+1 i+1 -1/2 upper triangular matrix R and the measured output i+1 vector Y at instant i+1. i+1 Z (input) DOUBLE PRECISION array, dimension (M) This array must contain Z , the mean value of the state i process noise at instant i. E (output) DOUBLE PRECISION array, dimension (P) This array contains E , the estimated error at instant i+1 i+1.Tolerances
TOL DOUBLE PRECISION If JOBX = 'X', then TOL is used to test for near -1 singularity of the matrix S . If the user sets i+1 TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number of that matrix; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). Otherwise, TOL is not referenced.Workspace
IWORK INTEGER array, dimension (LIWORK) where LIWORK = N if JOBX = 'X', and LIWORK = 1 otherwise. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. If INFO = 0 and JOBX = 'X', DWORK(2) returns an estimate of the reciprocal of the condition number -1 (in the 1-norm) of S . i+1 LDWORK The length of the array DWORK. LDWORK >= MAX(1,N*(N+2*M)+3*M,(N+P)*(N+1)+2*N), if JOBX = 'N'; LDWORK >= MAX(2,N*(N+2*M)+3*M,(N+P)*(N+1)+2*N,3*N), if JOBX = 'X'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; -1 = 1: if JOBX = 'X' and the matrix S is singular, i+1 -1 i.e., the condition number estimate of S (in the i+1 -1 -1/2 1-norm) exceeds 1/TOL. The matrices S , Q i+1 i and E have been computed.Method
The routine performs one recursion of the square root information filter algorithm, summarized as follows: | -1/2 -1/2 | | -1/2 | | Q 0 Q Z | | (QINOV ) * * | | i i i | | i | | | | | | -1 -1 -1 -1 -1 | | -1 -1 | T | S A B S A S X | = | 0 S S X | | i i i i i i i | | i+1 i+1 i+1| | | | | | -1/2 -1/2 | | | | 0 R C R Y | | 0 0 E | | i+1 i+1 i+1 i+1| | i+1 | (Pre-array) (Post-array) where T is an orthogonal transformation triangularizing the -1/2 pre-array, (QINOV ) is the inverse of the covariance square i root (right Cholesky factor) of the process noise innovation (hence the information square root) at instant i, and E is the i+1 estimated error at instant i+1. The inverse of the corresponding state covariance matrix P i+1|i+1 (hence the information matrix I) is then factorized as -1 -1 -1 I = P = (S )' S i+1|i+1 i+1|i+1 i+1 i+1 and one combined time and measurement update for the state is given by X . i+1 The triangularization is done entirely via Householder transformations exploiting the zero pattern of the pre-array.References
[1] Anderson, B.D.O. and Moore, J.B. Optimal Filtering. Prentice Hall, Englewood Cliffs, New Jersey, 1979. [2] Verhaegen, M.H.G. and Van Dooren, P. Numerical Aspects of Different Kalman Filter Implementations. IEEE Trans. Auto. Contr., AC-31, pp. 907-917, Oct. 1986. [3] Vanbegin, M., Van Dooren, P., and Verhaegen, M.H.G. Algorithm 675: FORTRAN Subroutines for Computing the Square Root Covariance Filter and Square Root Information Filter in Dense or Hessenberg Forms. ACM Trans. Math. Software, 15, pp. 243-256, 1989.Numerical Aspects
The algorithm requires approximately 3 2 2 2 (7/6)N + N x (7/2 x M + P) + N x (1/2 x P + M ) operations and is backward stable (see [2]).Further Comments
NoneExample
Program Text
* FB01SD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDAINV, LDB, LDC, LDQINV, LDRINV, LDSINV PARAMETER ( LDAINV = NMAX, LDB = NMAX, LDC = PMAX, $ LDQINV = MMAX, LDRINV = PMAX, LDSINV = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX*(NMAX + 2*MMAX) + 3*MMAX, $ (NMAX + PMAX)*(NMAX + 1) + 2*NMAX, $ 3*NMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, ISTEP, J, M, N, P CHARACTER*1 JOBX, MULTAB, MULTRC * .. Local Arrays .. DOUBLE PRECISION AINV(LDAINV,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DIAG(MMAX), DWORK(LDWORK), E(PMAX), $ QINV(LDQINV,MMAX), RINV(LDRINV,PMAX), $ RINVY(PMAX), SINV(LDSINV,NMAX), X(NMAX), Z(MMAX) INTEGER IWORK(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DCOPY, FB01SD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOBX, TOL, MULTAB, MULTRC IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( ( AINV(I,J), J = 1,N ), I = 1,N ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99991 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) IF ( LSAME( MULTRC, 'N' ) ) READ ( NIN, FMT = * ) $ ( ( RINV(I,J), J = 1,P ), I = 1,P ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( QINV(I,J), J = 1,M ), I = 1,M ) READ ( NIN, FMT = * ) ( ( SINV(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( Z(J), J = 1,M ) READ ( NIN, FMT = * ) ( X(J), J = 1,N ) READ ( NIN, FMT = * ) ( RINVY(J), J = 1,P ) * Save the strict upper triangle of QINV in its strict * lower triangle and the diagonal in the array DIAG. DO 10 I = 2, M CALL DCOPY( I, QINV(1,I), 1, QINV(I,1), LDQINV ) 10 CONTINUE CALL DCOPY( M, QINV, LDQINV+1, DIAG, 1 ) * Perform three iterations of the (Kalman) filter recursion * (in square root information form). ISTEP = 1 20 CONTINUE CALL FB01SD( JOBX, MULTAB, MULTRC, N, M, P, SINV, $ LDSINV, AINV, LDAINV, B, LDB, RINV, $ LDRINV, C, LDC, QINV, LDQINV, X, RINVY, $ Z, E, TOL, IWORK, DWORK, LDWORK, INFO ) ISTEP = ISTEP + 1 IF ( INFO.EQ.0 .AND. ISTEP.LE.3 ) THEN * Restore the upper triangle of QINV. DO 30 I = 2, M CALL DCOPY( I, QINV(I,1), LDQINV, QINV(1,I), 1 ) 30 CONTINUE CALL DCOPY( M, DIAG, 1, QINV, LDQINV+1 ) GO TO 20 END IF * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( SINV(I,J), J = 1,N ) 40 CONTINUE IF ( LSAME( JOBX, 'X' ) ) THEN WRITE ( NOUT, FMT = 99995 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99994 ) I, X(I) 50 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' FB01SD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from FB01SD = ',I2) 99997 FORMAT (' The inverse of the square root of the state covariance', $ ' matrix is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The components of the estimated filtered state are ', $ //' k X(k)',/) 99994 FORMAT (I4,3X,F8.4) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
FB01SD EXAMPLE PROGRAM DATA 4 2 2 X 0.0 P N 0.2113 0.7560 0.0002 0.3303 0.8497 0.6857 0.8782 0.0683 0.7263 0.1985 0.5442 0.2320 0.8833 0.6525 0.3076 0.9329 0.3616 0.5664 0.5015 0.2693 0.2922 0.4826 0.4368 0.6325 1.0000 0.0000 0.0000 1.0000 -0.8805 1.3257 2.1039 0.5207 -0.6075 1.0386 -0.8531 1.1688 1.1159 0.2305 0.0000 0.6597 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0019 0.5075 0.4076 0.8408 0.5017 0.9128 0.2129 0.5591Program Results
FB01SD EXAMPLE PROGRAM RESULTS The inverse of the square root of the state covariance matrix is 0.6897 0.7721 0.7079 0.6102 0.0000 -0.3363 -0.2252 -0.2642 0.0000 0.0000 -0.1650 0.0319 0.0000 0.0000 0.0000 0.3708 The components of the estimated filtered state are k X(k) 1 -0.7125 2 -1.8324 3 1.7500 4 1.5854
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/FB01TD.html 0000664 0000000 0000000 00000050343 14560147231 0020337 0 ustar 00root root 0000000 0000000
Purpose
To calculate a combined measurement and time update of one iteration of the time-invariant Kalman filter. This update is given for the square root information filter, using the condensed controller Hessenberg form.Specification
SUBROUTINE FB01TD( JOBX, MULTRC, N, M, P, SINV, LDSINV, AINV, $ LDAINV, AINVB, LDAINB, RINV, LDRINV, C, LDC, $ QINV, LDQINV, X, RINVY, Z, E, TOL, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBX, MULTRC INTEGER INFO, LDAINB, LDAINV, LDC, LDQINV, LDRINV, $ LDSINV, LDWORK, M, N, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION AINV(LDAINV,*), AINVB(LDAINB,*), C(LDC,*), $ DWORK(*), E(*), QINV(LDQINV,*), RINV(LDRINV,*), $ RINVY(*), SINV(LDSINV,*), X(*), Z(*)Arguments
Mode Parameters
JOBX CHARACTER*1 Indicates whether X is to be computed as follows: i+1 = 'X': X is computed and stored in array X; i+1 = 'N': X is not required. i+1 MULTRC CHARACTER*1 -1/2 Indicates how matrices R and C are to be passed to i+1 i+1 the routine as follows: = 'P': Array RINV is not used and the array C must -1/2 contain the product R C ; i+1 i+1 = 'N': Arrays RINV and C must contain the matrices as described below.Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e., the order of the -1 -1 matrices S and A . N >= 0. i M (input) INTEGER The actual input dimension, i.e., the order of the matrix -1/2 Q . M >= 0. i P (input) INTEGER The actual output dimension, i.e., the order of the matrix -1/2 R . P >= 0. i+1 SINV (input/output) DOUBLE PRECISION array, dimension (LDSINV,N) On entry, the leading N-by-N upper triangular part of this -1 array must contain S , the inverse of the square root i (right Cholesky factor) of the state covariance matrix P (hence the information square root) at instant i. i|i On exit, the leading N-by-N upper triangular part of this -1 array contains S , the inverse of the square root (right i+1 Cholesky factor) of the state covariance matrix P i+1|i+1 (hence the information square root) at instant i+1. The strict lower triangular part of this array is not referenced. LDSINV INTEGER The leading dimension of array SINV. LDSINV >= MAX(1,N). AINV (input) DOUBLE PRECISION array, dimension (LDAINV,N) -1 The leading N-by-N part of this array must contain A , the inverse of the state transition matrix of the discrete system in controller Hessenberg form (e.g., as produced by SLICOT Library Routine TB01MD). LDAINV INTEGER The leading dimension of array AINV. LDAINV >= MAX(1,N). AINVB (input) DOUBLE PRECISION array, dimension (LDAINB,M) -1 The leading N-by-M part of this array must contain A B, -1 the product of A and the input weight matrix B of the discrete system, in upper controller Hessenberg form (e.g., as produced by SLICOT Library Routine TB01MD). LDAINB INTEGER The leading dimension of array AINVB. LDAINB >= MAX(1,N). RINV (input) DOUBLE PRECISION array, dimension (LDRINV,*) If MULTRC = 'N', then the leading P-by-P upper triangular -1/2 part of this array must contain R , the inverse of the i+1 covariance square root (right Cholesky factor) of the output (measurement) noise (hence the information square root) at instant i+1. The strict lower triangular part of this array is not referenced. Otherwise, RINV is not referenced and can be supplied as a dummy array (i.e., set parameter LDRINV = 1 and declare this array to be RINV(1,1) in the calling program). LDRINV INTEGER The leading dimension of array RINV. LDRINV >= MAX(1,P) if MULTRC = 'N'; LDRINV >= 1 if MULTRC = 'P'. C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain C , -1/2 i+1 the output weight matrix (or the product R C if i+1 i+1 MULTRC = 'P') of the discrete system at instant i+1. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). QINV (input/output) DOUBLE PRECISION array, dimension (LDQINV,M) On entry, the leading M-by-M upper triangular part of this -1/2 array must contain Q , the inverse of the covariance i square root (right Cholesky factor) of the input (process) noise (hence the information square root) at instant i. On exit, the leading M-by-M upper triangular part of this -1/2 array contains (QINOV ) , the inverse of the covariance i square root (right Cholesky factor) of the process noise innovation (hence the information square root) at instant i. The strict lower triangular part of this array is not referenced. LDQINV INTEGER The leading dimension of array QINV. LDQINV >= MAX(1,M). X (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain X , the estimated i filtered state at instant i. On exit, if JOBX = 'X', and INFO = 0, then this array contains X , the estimated filtered state at i+1 instant i+1. On exit, if JOBX = 'N', or JOBX = 'X' and INFO = 1, then -1 this array contains S X . i+1 i+1 RINVY (input) DOUBLE PRECISION array, dimension (P) -1/2 This array must contain R Y , the product of the i+1 i+1 -1/2 upper triangular matrix R and the measured output i+1 vector Y at instant i+1. i+1 Z (input) DOUBLE PRECISION array, dimension (M) This array must contain Z , the mean value of the state i process noise at instant i. E (output) DOUBLE PRECISION array, dimension (P) This array contains E , the estimated error at instant i+1 i+1.Tolerances
TOL DOUBLE PRECISION If JOBX = 'X', then TOL is used to test for near -1 singularity of the matrix S . If the user sets i+1 TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number of that matrix; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). Otherwise, TOL is not referenced.Workspace
IWORK INTEGER array, dimension (LIWORK) where LIWORK = N if JOBX = 'X', and LIWORK = 1 otherwise. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. If INFO = 0 and JOBX = 'X', DWORK(2) returns an estimate of the reciprocal of the condition number -1 (in the 1-norm) of S . i+1 LDWORK The length of the array DWORK. LDWORK >= MAX(1,N*(N+2*M)+3*M,(N+P)*(N+1)+N+MAX(N-1,M+1)), if JOBX = 'N'; LDWORK >= MAX(2,N*(N+2*M)+3*M,(N+P)*(N+1)+N+MAX(N-1,M+1), 3*N), if JOBX = 'X'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; -1 = 1: if JOBX = 'X' and the matrix S is singular, i+1 -1 i.e., the condition number estimate of S (in the i+1 -1 -1/2 1-norm) exceeds 1/TOL. The matrices S , Q i+1 i and E have been computed.Method
The routine performs one recursion of the square root information filter algorithm, summarized as follows: | -1/2 -1/2 | | -1/2 | | Q 0 Q Z | | (QINOV ) * * | | i i i | | i | | | | | | -1/2 -1/2 | | -1 -1 | T | 0 R C R Y | = | 0 S S X | | i+1 i+1 i+1 i+1| | i+1 i+1 i+1| | | | | | -1 -1 -1 -1 -1 | | | | S A B S A S X | | 0 0 E | | i i i i | | i+1 | (Pre-array) (Post-array) where T is an orthogonal transformation triangularizing the -1/2 pre-array, (QINOV ) is the inverse of the covariance square i root (right Cholesky factor) of the process noise innovation -1 -1 (hence the information square root) at instant i and (A ,A B) is in upper controller Hessenberg form. An example of the pre-array is given below (where N = 6, M = 2, and P = 3): |x x | | x| | x | | x| _______________________ | | x x x x x x | x| | | x x x x x x | x| | | x x x x x x | x| _______________________ |x x | x x x x x x | x| | x | x x x x x x | x| | | x x x x x x | x| | | x x x x x | x| | | x x x x | x| | | x x x | x| The inverse of the corresponding state covariance matrix P i+1|i+1 (hence the information matrix I) is then factorized as -1 -1 -1 I = P = (S )' S i+1|i+1 i+1|i+1 i+1 i+1 and one combined time and measurement update for the state is given by X . i+1 The triangularization is done entirely via Householder transformations exploiting the zero pattern of the pre-array.References
[1] Anderson, B.D.O. and Moore, J.B. Optimal Filtering. Prentice Hall, Englewood Cliffs, New Jersey, 1979. [2] Van Dooren, P. and Verhaegen, M.H.G. Condensed Forms for Efficient Time-Invariant Kalman Filtering. SIAM J. Sci. Stat. Comp., 9. pp. 516-530, 1988. [3] Verhaegen, M.H.G. and Van Dooren, P. Numerical Aspects of Different Kalman Filter Implementations. IEEE Trans. Auto. Contr., AC-31, pp. 907-917, Oct. 1986. [4] Vanbegin, M., Van Dooren, P., and Verhaegen, M.H.G. Algorithm 675: FORTRAN Subroutines for Computing the Square Root Covariance Filter and Square Root Information Filter in Dense or Hessenberg Forms. ACM Trans. Math. Software, 15, pp. 243-256, 1989.Numerical Aspects
The algorithm requires approximately 3 2 2 3 (1/6)N + N x (3/2 x M + P) + 2 x N x M + 2/3 x M operations and is backward stable (see [3]).Further Comments
NoneExample
Program Text
* FB01TD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDAINB, LDAINV, LDC, LDQINV, LDRINV, LDSINV PARAMETER ( LDAINB = NMAX, LDAINV = NMAX, LDC = PMAX, $ LDQINV = MMAX, LDRINV = PMAX, LDSINV = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX*(NMAX + 2*MMAX) + 3*MMAX, $ (NMAX + PMAX)*(NMAX + 1) + NMAX + $ MAX( NMAX - 1, MMAX + 1 ), $ 3*NMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, ISTEP, J, M, N, P CHARACTER*1 JOBX, MULTRC * .. Local Arrays .. DOUBLE PRECISION AINV(LDAINV,NMAX), AINVB(LDAINB,MMAX), $ C(LDC,NMAX), DIAG(MMAX), DWORK(LDWORK), E(PMAX), $ QINV(LDQINV,MMAX), RINV(LDRINV,PMAX), $ RINVY(PMAX), SINV(LDSINV,NMAX), X(NMAX), Z(MMAX) INTEGER IWORK(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DCOPY, FB01TD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOBX, TOL, MULTRC IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( ( AINV(I,J), J = 1,N ), I = 1,N ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99991 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) IF ( LSAME( MULTRC, 'N' ) ) READ ( NIN, FMT = * ) $ ( ( RINV(I,J), J = 1,P ), I = 1,P ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) $ ( ( AINVB(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( QINV(I,J), J = 1,M ), I = 1,M ) READ ( NIN, FMT = * ) ( ( SINV(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( Z(J), J = 1,M ) READ ( NIN, FMT = * ) ( X(J), J = 1,N ) READ ( NIN, FMT = * ) ( RINVY(J), J = 1,P ) * Save the strict upper triangle of QINV in its strict * lower triangle and the diagonal in the array DIAG. DO 10 I = 2, M CALL DCOPY( I, QINV(1,I), 1, QINV(I,1), LDQINV ) 10 CONTINUE CALL DCOPY( M, QINV, LDQINV+1, DIAG, 1 ) * Perform three iterations of the (Kalman) filter * recursion (in square root information form). ISTEP = 1 20 CONTINUE CALL FB01TD( JOBX, MULTRC, N, M, P, SINV, LDSINV, $ AINV, LDAINV, AINVB, LDAINB, RINV, $ LDRINV, C, LDC, QINV, LDQINV, X, RINVY, $ Z, E, TOL, IWORK, DWORK, LDWORK, INFO ) ISTEP = ISTEP + 1 IF ( INFO.EQ.0 .AND. ISTEP.LE.3 ) THEN * Restore the upper triangle of QINV. DO 30 I = 2, M CALL DCOPY( I, QINV(I,1), LDQINV, QINV(1,I), 1 ) 30 CONTINUE CALL DCOPY( M, DIAG, 1, QINV, LDQINV+1 ) GO TO 20 END IF * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( SINV(I,J), J = 1,N ) 40 CONTINUE IF ( LSAME( JOBX, 'X' ) ) THEN WRITE ( NOUT, FMT = 99995 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99994 ) I, X(I) 50 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' FB01TD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from FB01TD = ',I2) 99997 FORMAT (' The inverse of the square root of the state covariance', $ ' matrix is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The components of the estimated filtered state are ', $ //' k X(k)',/) 99994 FORMAT (I4,3X,F8.4) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
FB01TD EXAMPLE PROGRAM DATA 4 2 2 X 0.0 N 0.2113 0.7560 0.0002 0.3303 0.8497 0.6857 0.8782 0.0683 0.7263 0.1985 0.5442 0.2320 0.0000 0.6525 0.3076 0.9329 0.3616 0.5664 0.5015 0.2693 0.2922 0.4826 0.4368 0.6325 1.0000 0.0000 0.0000 1.0000 -0.8805 1.3257 0.0000 0.5207 0.0000 0.0000 0.0000 0.0000 1.1159 0.2305 0.0000 0.6597 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0019 0.5075 0.4076 0.8408 0.5017 0.9128 0.2129 0.5591Program Results
FB01TD EXAMPLE PROGRAM RESULTS The inverse of the square root of the state covariance matrix is -0.8731 -1.1461 -1.0260 -0.8901 0.0000 -0.2763 -0.1929 -0.3763 0.0000 0.0000 -0.1110 -0.1051 0.0000 0.0000 0.0000 0.3120 The components of the estimated filtered state are k X(k) 1 -2.0688 2 -0.7814 3 2.2181 4 0.9298
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/FB01VD.html 0000664 0000000 0000000 00000031644 14560147231 0020344 0 ustar 00root root 0000000 0000000
Purpose
To compute one recursion of the conventional Kalman filter equations. This is one update of the Riccati difference equation and the Kalman filter gain.Specification
SUBROUTINE FB01VD( N, M, L, P, LDP, A, LDA, B, LDB, C, LDC, Q, $ LDQ, R, LDR, K, LDK, TOL, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDA, LDB, LDC, LDK, LDP, LDQ, LDR, $ LDWORK, M, N DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ K(LDK,*), P(LDP,*), Q(LDQ,*), R(LDR,*)Arguments
Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e., the order of the matrices P and A . N >= 0. i|i-1 i M (input) INTEGER The actual input dimension, i.e., the order of the matrix Q . M >= 0. i L (input) INTEGER The actual output dimension, i.e., the order of the matrix R . L >= 0. i P (input/output) DOUBLE PRECISION array, dimension (LDP,N) On entry, the leading N-by-N part of this array must contain P , the state covariance matrix at instant i|i-1 (i-1). The upper triangular part only is needed. On exit, if INFO = 0, the leading N-by-N part of this array contains P , the state covariance matrix at i+1|i instant i. The strictly lower triangular part is not set. Otherwise, the leading N-by-N part of this array contains P , its input value. i|i-1 LDP INTEGER The leading dimension of array P. LDP >= MAX(1,N). A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain A , i the state transition matrix of the discrete system at instant i. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain B , i the input weight matrix of the discrete system at instant i. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading L-by-N part of this array must contain C , i the output weight matrix of the discrete system at instant i. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,L). Q (input) DOUBLE PRECISION array, dimension (LDQ,M) The leading M-by-M part of this array must contain Q , i the input (process) noise covariance matrix at instant i. The diagonal elements of this array are modified by the routine, but are restored on exit. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,M). R (input/output) DOUBLE PRECISION array, dimension (LDR,L) On entry, the leading L-by-L part of this array must contain R , the output (measurement) noise covariance i matrix at instant i. On exit, if INFO = 0, or INFO = L+1, the leading L-by-L 1/2 upper triangular part of this array contains (RINOV ) , i the square root (left Cholesky factor) of the covariance matrix of the innovations at instant i. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,L). K (output) DOUBLE PRECISION array, dimension (LDK,L) If INFO = 0, the leading N-by-L part of this array contains K , the Kalman filter gain matrix at instant i. i If INFO > 0, the leading N-by-L part of this array contains the matrix product P C'. i|i-1 i LDK INTEGER The leading dimension of array K. LDK >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity of the matrix RINOV . If the user sets TOL > 0, then the i given value of TOL is used as a lower bound for the reciprocal condition number of that matrix; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = L*L*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (L) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, or INFO = L+1, DWORK(1) returns an estimate of the reciprocal of the condition number (in the 1-norm) of the matrix RINOV . i LDWORK The length of the array DWORK. LDWORK >= MAX(1,L*N+3*L,N*N,N*M).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value; = k: if INFO = k, 1 <= k <= L, the leading minor of order k of the matrix RINOV is not positive-definite, and i its Cholesky factorization could not be completed; = L+1: the matrix RINOV is singular, i.e., the condition i number estimate of RINOV (in the 1-norm) exceeds i 1/TOL.Method
The conventional Kalman filter gain used at the i-th recursion step is of the form -1 K = P C' RINOV , i i|i-1 i i where RINOV = C P C' + R , and the state covariance matrix i i i|i-1 i i P is updated by the discrete-time difference Riccati equation i|i-1 P = A (P - K C P ) A' + B Q B'. i+1|i i i|i-1 i i i|i-1 i i i i Using these two updates, the combined time and measurement update of the state X is given by i|i-1 X = A X + A K (Y - C X ), i+1|i i i|i-1 i i i i i|i-1 where Y is the new observation at step i. iReferences
[1] Anderson, B.D.O. and Moore, J.B. Optimal Filtering, Prentice Hall, Englewood Cliffs, New Jersey, 1979. [2] Verhaegen, M.H.G. and Van Dooren, P. Numerical Aspects of Different Kalman Filter Implementations. IEEE Trans. Auto. Contr., AC-31, pp. 907-917, 1986.Numerical Aspects
The algorithm requires approximately 3 2 3/2 x N + N x (3 x L + M/2) operations.Further Comments
NoneExample
Program Text
* FB01VD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, LMAX PARAMETER ( NMAX = 20, MMAX = 20, LMAX = 20 ) INTEGER LDA, LDB, LDC, LDK, LDP, LDQ, LDR PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = LMAX, LDK = NMAX, $ LDP = NMAX, LDQ = MMAX, LDR = LMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( LMAX*NMAX + 3*LMAX, NMAX*NMAX, $ MMAX*NMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, L, M, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), K(LDK,LMAX), P(LDP,NMAX), $ Q(LDQ,MMAX), R(LDR,LMAX) INTEGER IWORK(LMAX) * .. External Subroutines .. EXTERNAL DCOPY, FB01VD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, L, TOL IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( ( P(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( Q(I,J), J = 1,M ), I = 1,M ) IF ( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99991 ) L ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( R(I,J), J = 1,L ), I = 1,L ) * Perform one iteration of the (Kalman) filter recursion. CALL FB01VD( N, M, L, P, LDP, A, LDA, B, LDB, C, LDC, $ Q, LDQ, R, LDR, K, LDK, TOL, IWORK, DWORK, $ LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, N CALL DCOPY( I-1, P(1,I), 1, P(I,1), LDP ) WRITE ( NOUT, FMT = 99994 ) ( P(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( K(I,J), J = 1,L ) 40 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 60 I = 1, L WRITE ( NOUT, FMT = 99994 ) ( R(I,J), J = 1,L ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' FB01VD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from FB01VD = ',I3) 99997 FORMAT (' The state covariance matrix is ') 99996 FORMAT (/' The Kalman filter gain matrix is ') 99995 FORMAT (/' The square root of the covariance matrix of the innov', $ 'ations is ') 99994 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' L is out of range.',/' P = ',I5) ENDProgram Data
FB01VD EXAMPLE PROGRAM DATA 4 3 2 0.0 0.5015 0.4368 0.2693 0.6325 0.4368 0.4818 0.2639 0.4148 0.2693 0.2639 0.1121 0.6856 0.6325 0.4148 0.6856 0.8906 0.2113 0.8497 0.7263 0.8833 0.7560 0.6857 0.1985 0.6525 0.0002 0.8782 0.5442 0.3076 0.3303 0.0683 0.2320 0.9329 0.0437 0.7783 0.5618 0.4818 0.2119 0.5896 0.2639 0.1121 0.6853 0.4148 0.6856 0.8906 0.9329 0.2146 0.3126 0.2146 0.2922 0.5664 0.3126 0.5664 0.5935 0.3873 0.9488 0.3760 0.0881 0.9222 0.3435 0.7340 0.4498 1.0000 0.0000 0.0000 1.0000Program Results
FB01VD EXAMPLE PROGRAM RESULTS The state covariance matrix is 1.6007 1.3283 1.1153 1.7177 1.3283 1.2763 1.0132 1.5137 1.1153 1.0132 0.8222 1.2722 1.7177 1.5137 1.2722 2.1562 The Kalman filter gain matrix is 0.1648 0.2241 0.2115 0.1610 0.0728 0.1673 0.1304 0.3892 The square root of the covariance matrix of the innovations is 1.5091 1.1543 0.0000 1.5072
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/FD01AD.html 0000664 0000000 0000000 00000034063 14560147231 0020317 0 ustar 00root root 0000000 0000000
Purpose
To solve the least-squares filtering problem recursively in time. Each subroutine call implements one time update of the solution. The algorithm uses a fast QR-decomposition based approach.Specification
SUBROUTINE FD01AD( JP, L, LAMBDA, XIN, YIN, EFOR, XF, EPSBCK, $ CTETA, STETA, YQ, EPOS, EOUT, SALPH, IWARN, $ INFO ) C .. Scalar Arguments .. CHARACTER JP INTEGER INFO, IWARN, L DOUBLE PRECISION EFOR, EOUT, EPOS, LAMBDA, XIN, YIN C .. Array Arguments .. DOUBLE PRECISION CTETA(*), EPSBCK(*), SALPH(*), STETA(*), XF(*), $ YQ(*)Arguments
Mode Parameters
JP CHARACTER*1 Indicates whether the user wishes to apply both prediction and filtering parts, as follows: = 'B': Both prediction and filtering parts are to be applied; = 'P': Only the prediction section is to be applied.Input/Output Parameters
L (input) INTEGER The length of the impulse response of the equivalent transversal filter model. L >= 1. LAMBDA (input) DOUBLE PRECISION Square root of the forgetting factor. For tracking capabilities and exponentially stable error propagation, LAMBDA < 1.0 (strict inequality) should be used. 0.0 < LAMBDA <= 1.0. XIN (input) DOUBLE PRECISION The input sample at instant n. (The situation just before and just after the call of the routine are denoted by instant (n-1) and instant n, respectively.) YIN (input) DOUBLE PRECISION If JP = 'B', then YIN must contain the reference sample at instant n. Otherwise, YIN is not referenced. EFOR (input/output) DOUBLE PRECISION On entry, this parameter must contain the square root of exponentially weighted forward prediction error energy at instant (n-1). EFOR >= 0.0. On exit, this parameter contains the square root of the exponentially weighted forward prediction error energy at instant n. XF (input/output) DOUBLE PRECISION array, dimension (L) On entry, this array must contain the transformed forward prediction variables at instant (n-1). On exit, this array contains the transformed forward prediction variables at instant n. EPSBCK (input/output) DOUBLE PRECISION array, dimension (L+1) On entry, the leading L elements of this array must contain the normalized a posteriori backward prediction error residuals of orders zero through L-1, respectively, at instant (n-1), and EPSBCK(L+1) must contain the square-root of the so-called "conversion factor" at instant (n-1). On exit, this array contains the normalized a posteriori backward prediction error residuals, plus the square root of the conversion factor at instant n. CTETA (input/output) DOUBLE PRECISION array, dimension (L) On entry, this array must contain the cosines of the rotation angles used in time updates, at instant (n-1). On exit, this array contains the cosines of the rotation angles at instant n. STETA (input/output) DOUBLE PRECISION array, dimension (L) On entry, this array must contain the sines of the rotation angles used in time updates, at instant (n-1). On exit, this array contains the sines of the rotation angles at instant n. YQ (input/output) DOUBLE PRECISION array, dimension (L) On entry, if JP = 'B', then this array must contain the orthogonally transformed reference vector at instant (n-1). These elements are also the tap multipliers of an equivalent normalized lattice least-squares filter. Otherwise, YQ is not referenced and can be supplied as a dummy array (i.e., declare this array to be YQ(1) in the calling program). On exit, if JP = 'B', then this array contains the orthogonally transformed reference vector at instant n. EPOS (output) DOUBLE PRECISION The a posteriori forward prediction error residual. EOUT (output) DOUBLE PRECISION If JP = 'B', then EOUT contains the a posteriori output error residual from the least-squares filter at instant n. SALPH (output) DOUBLE PRECISION array, dimension (L) The element SALPH(i), i=1,...,L, contains the opposite of the i-(th) reflection coefficient for the least-squares normalized lattice predictor (whose value is -SALPH(i)).Warning Indicator
IWARN INTEGER = 0: no warning; = 1: an element to be annihilated by a rotation is less than the machine precision (see LAPACK Library routine DLAMCH).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The output error EOUT at instant n, denoted by EOUT(n), is the reference sample minus a linear combination of L successive input samples: L-1 EOUT(n) = YIN(n) - SUM h_i * XIN(n-i), i=0 where YIN(n) and XIN(n) are the scalar samples at instant n. A least-squares filter uses those h_0,...,h_{L-1} which minimize an exponentially weighted sum of successive output errors squared: n SUM [LAMBDA**(2(n-k)) * EOUT(k)**2]. k=1 Each subroutine call performs a time update of the least-squares filter using a fast least-squares algorithm derived from a QR decomposition, as described in references [1] and [2] (the notation from [2] is followed in the naming of the arrays). The algorithm does not compute the parameters h_0,...,h_{L-1} from the above formula, but instead furnishes the parameters of an equivalent normalized least-squares lattice filter, which are available from the arrays SALPH (reflection coefficients) and YQ (tap multipliers), as well as the exponentially weighted input signal energy n L SUM [LAMBDA**(2(n-k)) * XIN(k)**2] = EFOR**2 + SUM XF(i)**2. k=1 i=1 For more details on reflection coefficients and tap multipliers, references [2] and [4] are recommended.References
[1] Proudler, I. K., McWhirter, J. G., and Shepherd, T. J. Fast QRD based algorithms for least-squares linear prediction. Proceedings IMA Conf. Mathematics in Signal Processing Warwick, UK, December 1988. [2] Regalia, P. A., and Bellanger, M. G. On the duality between QR methods and lattice methods in least-squares adaptive filtering. IEEE Trans. Signal Processing, SP-39, pp. 879-891, April 1991. [3] Regalia, P. A. Numerical stability properties of a QR-based fast least-squares algorithm. IEEE Trans. Signal Processing, SP-41, June 1993. [4] Lev-Ari, H., Kailath, T., and Cioffi, J. Least-squares adaptive lattice and transversal filters: A unified geometric theory. IEEE Trans. Information Theory, IT-30, pp. 222-236, March 1984.Numerical Aspects
The algorithm requires O(L) operations for each subroutine call. It is backward consistent for all input sequences XIN, and backward stable for persistently exciting input sequences, assuming LAMBDA < 1.0 (see [3]). If the condition of the signal is very poor (IWARN = 1), then the results are not guaranteed to be reliable.Further Comments
1. For tracking capabilities and exponentially stable error propagation, LAMBDA < 1.0 should be used. LAMBDA is typically chosen slightly less than 1.0 so that "past" data are exponentially forgotten. 2. Prior to the first subroutine call, the variables must be initialized. The following initial values are recommended: XF(i) = 0.0, i=1,...,L EPSBCK(i) = 0.0 i=1,...,L EPSBCK(L+1) = 1.0 CTETA(i) = 1.0 i=1,...,L STETA(i) = 0.0 i=1,...,L YQ(i) = 0.0 i=1,...,L EFOR = 0.0 (exact start) EFOR = "small positive constant" (soft start). Soft starts are numerically more reliable, but result in a biased least-squares solution during the first few iterations. This bias decays exponentially fast provided LAMBDA < 1.0. If sigma is the standard deviation of the input sequence XIN, then initializing EFOR = sigma*1.0E-02 usually works well.Example
Program Text
* FD01AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT, NOUT1 PARAMETER ( NIN = 5, NOUT = 6, NOUT1 = 7 ) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) INTEGER IMAX, LMAX PARAMETER ( IMAX = 500, LMAX = 10 ) DOUBLE PRECISION LAMBDA PARAMETER ( LAMBDA = 0.99D0 ) * .. Local Scalars .. CHARACTER JP INTEGER I, INFO, IWARN, L DOUBLE PRECISION DELTA, EFOR, EOUT, EPOS, XIN, YIN * .. Local Arrays .. DOUBLE PRECISION CTETA(LMAX), EPSBCK(LMAX+1), SALPH(LMAX), $ STETA(LMAX), XF(LMAX), YQ(LMAX) * .. External Functions .. DOUBLE PRECISION XFCN, YFCN EXTERNAL XFCN, YFCN * NOTE: XFCN() generates at each iteration the next sample of the * input sequence. YFCN() generates at each iteration the next * sample of the reference sequence. These functions are user * defined (obtained from data acquisition devices, for * example). * .. External Subroutines .. EXTERNAL FD01AD * * .. File for the output error sequence .. OPEN ( UNIT = NOUT1, FILE = 'ERR.OUT', STATUS = 'REPLACE' ) * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, DELTA, JP IF ( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99992 ) L ELSE IF ( DELTA.LT.ZERO ) THEN WRITE ( NOUT, FMT = 99991 ) ELSE * DO 10 I = 1, L CTETA(I) = ONE STETA(I) = ZERO EPSBCK(I) = ZERO XF(I) = ZERO YQ(I) = ZERO 10 CONTINUE EPSBCK(L+1) = ONE EFOR = DELTA * .. Run least squares filter. DO 20 I = 1, IMAX XIN = XFCN(I) YIN = YFCN(I) CALL FD01AD( JP, L, LAMBDA, XIN, YIN, EFOR, XF, EPSBCK, $ CTETA, STETA, YQ, EPOS, EOUT, SALPH, IWARN, $ INFO) WRITE(NOUT1,*) EOUT 20 CONTINUE CLOSE(NOUT1) * NOTE: File 'ERR.OUT' now contains the output error * sequence. * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 30 I = 1, L WRITE ( NOUT, FMT = 99996 ) I, XF(I), YQ(I), EPSBCK(I) 30 CONTINUE WRITE ( NOUT, FMT = 99995 ) L+1, EPSBCK(L+1) WRITE ( NOUT, FMT = 99994 ) EFOR IF ( IWARN.NE.0 ) THEN WRITE ( NOUT, FMT = 99993 ) IWARN END IF END IF END IF END IF STOP * 99999 FORMAT (' FD01AD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from FD01AD = ', I2) 99997 FORMAT (' i', 7X, 'XF(i)', 7X, 'YQ(i)', 6X, 'EPSBCK(i)', /1X) 99996 FORMAT ( I3, 2X, 3(2X, F10.6)) 99995 FORMAT ( I3, 28X, F10.6, /1X) 99994 FORMAT (' EFOR = ', D10.3) 99993 FORMAT (' IWARN on exit from FD01AD = ', I2) 99992 FORMAT (/' L is out of range.',/' L = ',I5) 99991 FORMAT (/' The exponentially weighted forward prediction error', $ ' energy must be non-negative.' ) * END * * .. Example functions .. * DOUBLE PRECISION FUNCTION XFCN( I ) * .. Intrinsic Functions .. INTRINSIC DBLE, SIN * .. Local Scalar .. INTEGER I * .. Executable Statements .. XFCN = SIN( 0.3D0*DBLE( I ) ) * *** Last line of XFCN *** END * DOUBLE PRECISION FUNCTION YFCN( I ) * .. Intrinsic Functions .. INTRINSIC DBLE, SIN * .. Local Scalar .. INTEGER I * .. Executable Statements .. YFCN = 0.5D0 * SIN( 0.3D0*DBLE( I ) ) + $ 2.0D0 * SIN( 0.3D0*DBLE( I-1 ) ) * *** Last line of YFCN *** ENDProgram Data
FD01AD EXAMPLE PROGRAM DATA 2 1.0D-2 BProgram Results
FD01AD EXAMPLE PROGRAM RESULTS i XF(i) YQ(i) EPSBCK(i) 1 4.880088 12.307615 -0.140367 2 -1.456881 2.914057 -0.140367 3 0.980099 EFOR = 0.197D-02
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/FSQP.html 0000664 0000000 0000000 00000040555 14560147231 0020234 0 ustar 00root root 0000000 0000000
Purpose
To perform the minimization of the maximum of a set of smooth objective functions (possibly a single one or none at all) subject to nonlinear equality and inequality constraints, linear equality and inequality constraints, and simple bounds on the variables. Specifically, the problem to solve is of the form min max{f (x)} i i n where 1 <= i <= NF, and x is a vector in R subject to the following constraints bl <= x <= bu g (x)<=0, j = 1 ... NINEQN j g (x)<=0, j = NINEQN+1 ... NINEQ j h (x)=0, j = 1 ... NEQN j h (x)=0, j = NEQN+1 ... NEQ j n where bl and bu are vectors in R , and n f : R -> R, j = 1 ... NF, smooth j n g : R -> R, j = 1 ... NINEQN, nonlinear and smooth j n g : R -> R, j = NINEQN+1 ... NINEQ, linear j n h : R -> R, j = 1 ... NEQN, nonlinear and smooth j n h : R -> R, j = NEQN+1 ... NEQ, linear jSpecification
SUBROUTINE FSQP( MODE, IPRINT, OBJ, CONSTR, GRADOB, GRADCN, & NPARAM, NF, NINEQN, NINEQ, NEQN, NEQ, MITER, & UDELTA, BIGBND, BL, BU, X, F, G, TOL1, TOL2, & IWORK, LIWORK, DWORK, LDWORK, INFO) C .. Scalar Arguments .. INTEGER NPARAM, NF, NINEQN, NINEQ, NEQN, NEQ, MODE, & IPRINT, MITER, INFO, LIWORK, LDWORK DOUBLE PRECISION BIGBND, TOL1, TOL2, UDELTA C .. Array Arguments .. INTEGER IWORK(LIWORK) DOUBLE PRECISION BL(*), BU(*), X(*), F(*), G(*), DWORK(LDWORK)Arguments
Mode Parameters
MODE (input) INTEGER mode = CBA (a 3-digit number) with the following meaning (see [1] for more details): A specifies the problem to be solved: A = 0: The problem is that described above. A = 1: In the problem described above, the function to minimize is replaced by min max{ABS(f (x))} i i i.e., absolute values of the objective functions are taken. B indicates the method to be used: B = 0: Algorithm FFSQP-AL is selected (see METHOD below). B = 1: Algorithm FFSQP-NL is selected (see METHOD below). C indicates the order of evaluation of objective functions and constraints during the line search: C = 1: The function that caused the previous value of t to be rejected is checked first and all functions of the same type ("objective" or "constraint") as the latter will then be checked first (recommended for most users). C = 2: Constraints will be always checked first at each trial point during the line search. If it is a contraint that caused the previous value of t to be rejected, that constraint will be checked first (useful when objective functions are not defined or are difficult to evaluate outside of the feasible region). IPRINT (input) INTEGER Parameter indicating the desired output (see [1] for a more complete description of the output). IPRINT = 0: No information except for user-input errors is displayed. This value is imposed during phase 1. IPRINT = 1: Objective and constraint values at the initial feasible point are displayed. At the end of execution, status (INFO), iterate, objective values, constraint values, number of evaluations of objectives and nonlinear constraints, norm of the Kuhn-Tucker vector, and sum of feasibility violation are displayed. IPRINT = 2: At the end of each iteration, the same information as with IPRINT = 1 is displayed. IPRINT = 3: At each iteration, the same information as with IPRINT = 2,including detailed information on the search direction computation, on the line search, and on the update, is displayed. IPRINT = 10*N +M: N any positive integer, M=2 or 3. Information corresponding to IPRINT=M is displayed at every (10*N)th iteration and at the last iteration.User-supplied Subroutines
OBJ SUBROUTINE Computes the value of the objective functions. If NF = 0, a (dummy) subroutine must be provided anyway. The specification of OBJ is SUBROUTINE OBJ(NPARAM,J,X,FJ) INTEGER NPARAM, J DOUBLE PRECISION X(NPARAM),FJ Arguments: NPARAM (Input) Dimension of X. J (Input) Number of the objective to be computed. X (Input) Current iterate. FJ (Output) Value of the jth objective function at X. CONSTR SUBROUTINE Computes the value of the constraints. If there are no constraints, a (dummy) subroutine must be provided anyway. The specification of CONSTR is as follows. SUBROUTINE CONSTR(NPARAM,J,X,GJ) INTEGER NPARAM,J DOUBLE PRECISION X(NPARAM),GJ Arguments: NPARAM (Input) Dimension of X. J (Input) Number of the constraint to be computed. X (Input) Current iterate. GJ (Output) Value of the jth constraint at X. The order of the constraints must be as follows. First the NINEQN (possibly zero) nonlinear inequality constraints. Then the NINEQ-NINEQN (possibly zero) linear inequality constraints. Finally, the NEQN (possibly zero) nonlinear equality constraints followed by the NEQ-NEQN (possibly zero) linear equality constraints. GRADOB SUBROUTINE Computes the gradients of the objective functions. The user must pass the subroutine name GROBFD, if he/she wishes that FSQP evaluate these gradients automatically, by forward finite differences. The specification of GRADOB is as follows. SUBROUTINE GRADOB(NPARAM,J,X,GRADFJ,DUMMY) INTEGER NPARAM,J DOUBLE PRECISION X(NPARAM),GRADFJ(NPARAM) DOUBLE PRECISION DUMMY EXTERNAL DUMMY Arguments: NPARAM (Input) Dimension of X. J (Input) Number of objective for which gradient is to be computed. X (Input) Current iterate. GRADFJ (Output) Gradient of the jth objective function at X. DUMMY (Input) Used by GROBFD (internally assigned the name of the objective function subroutine by FFSQP). Note that DUMMY is passed as argument to GRADOB to allow for forward finite difference computation of the gradient. GRADCN SUBROUTINE Computes the gradients of the constraints. The user must pass the subroutine name GRCNFD, if he/she wishes that FSQP evaluate these gradients automatically, by forward finite differences. The specification of GRADCN is as follows SUBROUTINE GRADCN (NPARAM,J,X,GRADGJ,DUMMY) INTEGER NPARAM,J DOUBLE PRECISION X(NPARAM),GRADGJ(NPARAM) DOUBLE PRECISION DUMMY EXTERNAL DUMMY Arguments: NPARAM (Input) Dimension of X. J (Input) Number of constraint for which gradient is to be computed. X (Input) Current iterate. GRADGJ (Output) Gradient of the jth constraint evaluated at X. DUMMY (Input) Used by GRCNFD (internally assigned the name of the constraint function subroutine by FFSQP). Note that DUMMY is passed as argument to GRADCN to allow for forward finite difference computation of the gradients.Input/Output Parameters
NPARAM (input) INTEGER Number of free variables, i.e., the dimension of X. NF (input) INTEGER Number of objective functions (possibly zero). NINEQN (input) INTEGER Number (possibly zero) of nonlinear inequality constraints. NINEQ (input) INTEGER Total number (possibly equal to nineqn) of inequality constraints. NEQN (input) INTEGER Number (possibly zero) of nonlinear equality constraints. NEQ (input) INTEGER Total number (possibly equal to neqn) of equality constraints. MITER (input) INTEGER Maximum number of iterations allowed by the user before termination of execution. UDELTA (input) DOUBLE PRECISION The perturbation size the user suggests to use in approximating gradients by finite difference. UDELTA should be set to zero if the user has no idea how to choose it. See [1] for details. BIGBND (input) DOUBLE PRECISION It plays the role of Infinite Bound (see also BL and BU below). BL (input) DOUBLE PRECISION array, dimension (NPARAM) Lower bounds for the components of X. To specify a non- existent lower bound for some j, the value used must satisfy BL(j) <= -BIGBND. BU (input) DOUBLE PRECISION array, dimension (NPARAM) Upper bounds for the components of X. To specify a non- existent upper bound for some j, the value used must satisfy BU(j) >= BIGBND. X (input/output) DOUBLE PRECISION array, dimension (NPARAM) On entry, this is the initial guess. On exit, this is the iterate at the end of execution. F (output) DOUBLE PRECISION array, dimension ( MAX(1,NF) ) Value of functions f_i, i = 1, ..., NF, at X at the end of execution. G (output) DOUBLE PRECISION array, dimension ( MAX(1,NINEQ+NEQ) ) Value of constraint functions at X at the end of execution.Tolerances
TOL1 DOUBLE PRECISION Corresponds to argument EPS in [1]. Final norm requirement for the Newton direction (see [1], argument EPS). It must be bigger than the machine precision epsmac (computed by FSQP). If the user does not have a good feeling of what value should be chosen, a very small number could be provided and IPRINT = 2 be selected so that the user would be able to keep track of the process of optimization and terminate FSQP at appropriate time. TOL2 DOUBLE PRECISION Corresponds to argument EPSEQN in [1]. Maximum violation of nonlinear equality constraints allowed by the user at an optimal point. It is in effect only if NEQN > 0 and must be bigger than the machine precision epsmac (computed by FSQP).Workspace
IWORK INTEGER array, dimension (LIWORK) Corresponds to argument IW in [1]. LIWORK INTEGER Corresponds to argument IWSIZE in [1]. The length of array IWORK. It must be at least as big as 6*NPARAM + 8*max(1,NINEQ+NEQ) + 7*max(1,NF) + 30. This estimate is usually very conservative and the smallest suitable value will be displayed if the user-supplied value is too small. DWORK DOUBLE PRECISION array, dimension (LDWORK) Corresponds to argument W in [1]. On exit, it will contain estimates of Lagrange multipliers at the end of execution. These multipliers will be placed in the first NPARAM + NINEQ + NEQ + NFF entries; where NFF = 0 if (in mode) A = 0 and NF = 1, and NFF = NF otherwise. See [1] for details. LDWORK INTEGER Corresponds to argument NWSIZE in [1]. The length of array DWORK. It must be at least as big as 4*SQR(NPARAM) + 5*MAX(1,NINEQ+NEQ)*NPARAM + 3*MAX(1,NF)*NPARAM + 26*(NPARAM+MAX(1,NF)) + 45*MAX(1,NINEQ+NEQ) + 100. This estimate is usually very conservative and the smallest suitable value will be displayed if the user- supplied value is too small.Error Indicator
INFO (output) INTEGER Corresponds to argument INFORM in [1]. INFO = 0: Normal termination of execution. INFO = 1: The user-provided initial guess is infeasible for linear constraints and FFSQP is unable to generate a point satisfying all these constraints. INFO = 2: The user-provided initial guess is infeasible for nonlinear inequality constraints and linear constraints; and FFSQP is unable to generate a point satisfying all these constraints. INFO = 3: The maximum number miter of iterations has been reached before a solution is obtained. INFO = 4: The line search fails to find a new iterate (trial step size being smaller than the machine precision epsmac computed by FFSQP). INFO = 5: Failure of the QP solver in attempting to construct d0. A more robust QP solver may succeed. INFO = 6: Failure of the QP solver in attempting to construct d1 . A more robust QP solver may succeed. INFO = 7: Input data are not consistent (with printout indicating the error). INFO = 8: Two consecutive iterates are numerically equivalent before a stopping criterion is satisfied. INFO = 9: One of the penalty parameters exceeded BIGBND. The algorithm is having trouble satisfying a nonlinear equality constraint.Method
If the initial guess provided by the user is infeasible for nonlinear inequality constraints and linear constraints, FFSQP first generates a point satisfying all these constraints by iterating on the problem of minimizing the maximum of these constraints. Then, using Mayne-Polak's scheme, nonlinear equality constraints are turned into nonlinear inequality constraints and the original objective function is replaced by a modified objective function. After obtaining feasibility, either (i) an Armijo-type line search may be used (algorithm FFSQP-AL), yielding a monotone decrease of the objective function at each iteration; or (ii) a nonmonotone line search may be selected (algorithm FFSQP-NL), forcing a decrease of the objective function within at most four iterations. See [1] for further details.References
[1] J. L. Zhou, A. L. Tits and C. T. Lawrence User's Guide for FFSQP Version 3.7 : A Fortran Code for Solving Optimization Programs, Possibly Minimax, with General Inequality Constraints and Linear Equality Constraints, Generating Feasible Iterates Institute for Systems Research, University of Maryland, Technical Report SRC-TR-92-107r5, 1997. (Available at http://gachinese.com/aemdesign/FSQPframe.htm)Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/IB01AD.html 0000664 0000000 0000000 00000134603 14560147231 0020321 0 ustar 00root root 0000000 0000000
Purpose
To preprocess the input-output data for estimating the matrices of a linear time-invariant dynamical system and to find an estimate of the system order. The input-output data can, optionally, be processed sequentially.Specification
SUBROUTINE IB01AD( METH, ALG, JOBD, BATCH, CONCT, CTRL, NOBR, M, $ L, NSMP, U, LDU, Y, LDY, N, R, LDR, SV, RCOND, $ TOL, IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION RCOND, TOL INTEGER INFO, IWARN, L, LDR, LDU, LDWORK, LDY, M, N, $ NOBR, NSMP CHARACTER ALG, BATCH, CONCT, CTRL, JOBD, METH C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION DWORK(*), R(LDR, *), SV(*), U(LDU, *), $ Y(LDY, *)Arguments
Mode Parameters
METH CHARACTER*1 Specifies the subspace identification method to be used, as follows: = 'M': MOESP algorithm with past inputs and outputs; = 'N': N4SID algorithm. ALG CHARACTER*1 Specifies the algorithm for computing the triangular factor R, as follows: = 'C': Cholesky algorithm applied to the correlation matrix of the input-output data; = 'F': Fast QR algorithm; = 'Q': QR algorithm applied to the concatenated block Hankel matrices. JOBD CHARACTER*1 Specifies whether or not the matrices B and D should later be computed using the MOESP approach, as follows: = 'M': the matrices B and D should later be computed using the MOESP approach; = 'N': the matrices B and D should not be computed using the MOESP approach. This parameter is not relevant for METH = 'N'. BATCH CHARACTER*1 Specifies whether or not sequential data processing is to be used, and, for sequential processing, whether or not the current data block is the first block, an intermediate block, or the last block, as follows: = 'F': the first block in sequential data processing; = 'I': an intermediate block in sequential data processing; = 'L': the last block in sequential data processing; = 'O': one block only (non-sequential data processing). NOTE that when 100 cycles of sequential data processing are completed for BATCH = 'I', a warning is issued, to prevent for an infinite loop. CONCT CHARACTER*1 Specifies whether or not the successive data blocks in sequential data processing belong to a single experiment, as follows: = 'C': the current data block is a continuation of the previous data block and/or it will be continued by the next data block; = 'N': there is no connection between the current data block and the previous and/or the next ones. This parameter is not used if BATCH = 'O'. CTRL CHARACTER*1 Specifies whether or not the user's confirmation of the system order estimate is desired, as follows: = 'C': user's confirmation; = 'N': no confirmation. If CTRL = 'C', a reverse communication routine, IB01OY, is indirectly called (by SLICOT Library routine IB01OD), and, after inspecting the singular values and system order estimate, n, the user may accept n or set a new value. IB01OY is not called if CTRL = 'N'.Input/Output Parameters
NOBR (input) INTEGER The number of block rows, s, in the input and output block Hankel matrices to be processed. NOBR > 0. (In the MOESP theory, NOBR should be larger than n, the estimated dimension of state vector.) M (input) INTEGER The number of system inputs. M >= 0. When M = 0, no system inputs are processed. L (input) INTEGER The number of system outputs. L > 0. NSMP (input) INTEGER The number of rows of matrices U and Y (number of samples, t). (When sequential data processing is used, NSMP is the number of samples of the current data block.) NSMP >= 2*(M+L+1)*NOBR - 1, for non-sequential processing; NSMP >= 2*NOBR, for sequential processing. The total number of samples when calling the routine with BATCH = 'L' should be at least 2*(M+L+1)*NOBR - 1. The NSMP argument may vary from a cycle to another in sequential data processing, but NOBR, M, and L should be kept constant. For efficiency, it is advisable to use NSMP as large as possible. U (input) DOUBLE PRECISION array, dimension (LDU,M) The leading NSMP-by-M part of this array must contain the t-by-m input-data sequence matrix U, U = [u_1 u_2 ... u_m]. Column j of U contains the NSMP values of the j-th input component for consecutive time increments. If M = 0, this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= NSMP, if M > 0; LDU >= 1, if M = 0. Y (input) DOUBLE PRECISION array, dimension (LDY,L) The leading NSMP-by-L part of this array must contain the t-by-l output-data sequence matrix Y, Y = [y_1 y_2 ... y_l]. Column j of Y contains the NSMP values of the j-th output component for consecutive time increments. LDY INTEGER The leading dimension of the array Y. LDY >= NSMP. N (output) INTEGER The estimated order of the system. If CTRL = 'C', the estimated order has been reset to a value specified by the user. R (output or input/output) DOUBLE PRECISION array, dimension ( LDR,2*(M+L)*NOBR ) On exit, if ALG = 'C' and BATCH = 'F' or 'I', the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array contains the current upper triangular part of the correlation matrix in sequential data processing. If ALG = 'F' and BATCH = 'F' or 'I', the array R is not referenced. On exit, if INFO = 0, ALG = 'Q', and BATCH = 'F' or 'I', the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array contains the current upper triangular factor R from the QR factorization of the concatenated block Hankel matrices. Denote R_ij, i,j = 1:4, the ij submatrix of R, partitioned by M*NOBR, M*NOBR, L*NOBR, and L*NOBR rows and columns. On exit, if INFO = 0 and BATCH = 'L' or 'O', the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array contains the matrix S, the processed upper triangular factor R from the QR factorization of the concatenated block Hankel matrices, as required by other subroutines. Specifically, let S_ij, i,j = 1:4, be the ij submatrix of S, partitioned by M*NOBR, L*NOBR, M*NOBR, and L*NOBR rows and columns. The submatrix S_22 contains the matrix of left singular vectors needed subsequently. Useful information is stored in S_11 and in the block-column S_14 : S_44. For METH = 'M' and JOBD = 'M', the upper triangular part of S_31 contains the upper triangular factor in the QR factorization of the matrix R_1c = [ R_12' R_22' R_11' ]', and S_12 contains the corresponding leading part of the transformed matrix R_2c = [ R_13' R_23' R_14' ]'. For METH = 'N', the subarray S_41 : S_43 contains the transpose of the matrix contained in S_14 : S_34. The details of the contents of R need not be known if this routine is followed by SLICOT Library routine IB01BD. On entry, if ALG = 'C', or ALG = 'Q', and BATCH = 'I' or 'L', the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array must contain the upper triangular matrix R computed at the previous call of this routine in sequential data processing. The array R need not be set on entry if ALG = 'F' or if BATCH = 'F' or 'O'. LDR INTEGER The leading dimension of the array R. LDR >= MAX( 2*(M+L)*NOBR, 3*M*NOBR ), for METH = 'M' and JOBD = 'M'; LDR >= 2*(M+L)*NOBR, for METH = 'M' and JOBD = 'N' or for METH = 'N'. SV (output) DOUBLE PRECISION array, dimension ( L*NOBR ) The singular values used to estimate the system order.Tolerances
RCOND DOUBLE PRECISION The tolerance to be used for estimating the rank of matrices. If the user sets RCOND > 0, the given value of RCOND is used as a lower bound for the reciprocal condition number; an m-by-n matrix whose estimated condition number is less than 1/RCOND is considered to be of full rank. If the user sets RCOND <= 0, then an implicitly computed, default tolerance, defined by RCONDEF = m*n*EPS, is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH). This parameter is not used for METH = 'M'. TOL DOUBLE PRECISION Absolute tolerance used for determining an estimate of the system order. If TOL >= 0, the estimate is indicated by the index of the last singular value greater than or equal to TOL. (Singular values less than TOL are considered as zero.) When TOL = 0, an internally computed default value, TOL = NOBR*EPS*SV(1), is used, where SV(1) is the maximal singular value, and EPS is the relative machine precision (see LAPACK Library routine DLAMCH). When TOL < 0, the estimate is indicated by the index of the singular value that has the largest logarithmic gap to its successor.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= MAX(3,(M+L)*NOBR), if METH = 'N'; LIWORK >= MAX(3,M+L), if METH = 'M' and ALG = 'F'; LIWORK >= 3, if METH = 'M' and ALG = 'C' or 'Q'. On entry with BATCH = 'I' or BATCH = 'L', IWORK(1:3) must contain the values of ICYCLE, MAXWRK, and NSMPSM set by the previous call of this routine. On exit with BATCH = 'F' or BATCH = 'I', IWORK(1:3) contains the values of ICYCLE, MAXWRK, and NSMPSM to be used by the next call of the routine. ICYCLE counts the cycles for BATCH = 'I'. MAXWRK stores the current optimal workspace. NSMPSM sums up the NSMP values for BATCH <> 'O'. The first three elements of IWORK should be preserved during successive calls of the routine with BATCH = 'F' or BATCH = 'I', till the final call with BATCH = 'L'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and, for METH = 'N', and BATCH = 'L' or 'O', DWORK(2) and DWORK(3) contain the reciprocal condition numbers of the triangular factors of the matrices U_f and r_1 [6]. On exit, if INFO = -23, DWORK(1) returns the minimum value of LDWORK. Let k = 0, if CONCT = 'N' and ALG = 'C' or 'Q'; k = 2*NOBR-1, if CONCT = 'C' and ALG = 'C' or 'Q'; k = 2*NOBR*(M+L+1), if CONCT = 'N' and ALG = 'F'; k = 2*NOBR*(M+L+2), if CONCT = 'C' and ALG = 'F'. The first (M+L)*k elements of DWORK should be preserved during successive calls of the routine with BATCH = 'F' or 'I', till the final call with BATCH = 'L'. LDWORK INTEGER The length of the array DWORK. LDWORK >= (4*NOBR-2)*(M+L), if ALG = 'C', BATCH = 'F' or 'I' and CONCT = 'C'; LDWORK >= 1, if ALG = 'C', BATCH = 'F' or 'I' and CONCT = 'N'; LDWORK >= max((4*NOBR-2)*(M+L), 5*L*NOBR), if METH = 'M', ALG = 'C', BATCH = 'L' and CONCT = 'C'; LDWORK >= max((2*M-1)*NOBR, (M+L)*NOBR, 5*L*NOBR), if METH = 'M', JOBD = 'M', ALG = 'C', BATCH = 'O', or (BATCH = 'L' and CONCT = 'N'); LDWORK >= 5*L*NOBR, if METH = 'M', JOBD = 'N', ALG = 'C', BATCH = 'O', or (BATCH = 'L' and CONCT = 'N'); LDWORK >= 5*(M+L)*NOBR+1, if METH = 'N', ALG = 'C', and BATCH = 'L' or 'O'; LDWORK >= (M+L)*2*NOBR*(M+L+3), if ALG = 'F', BATCH <> 'O' and CONCT = 'C'; LDWORK >= (M+L)*2*NOBR*(M+L+1), if ALG = 'F', BATCH = 'F', 'I' and CONCT = 'N'; LDWORK >= (M+L)*4*NOBR*(M+L+1)+(M+L)*2*NOBR, if ALG = 'F', BATCH = 'L' and CONCT = 'N', or BATCH = 'O'; LDWORK >= 4*(M+L)*NOBR, if ALG = 'Q', BATCH = 'F', and LDR >= NS = NSMP - 2*NOBR + 1; LDWORK >= max(4*(M+L)*NOBR, 5*L*NOBR), if METH = 'M', ALG = 'Q', BATCH = 'O', and LDR >= NS; LDWORK >= 5*(M+L)*NOBR+1, if METH = 'N', ALG = 'Q', BATCH = 'O', and LDR >= NS; LDWORK >= 6*(M+L)*NOBR, if ALG = 'Q', (BATCH = 'F' or 'O', and LDR < NS), or (BATCH = 'I' or 'L' and CONCT = 'N'); LDWORK >= 4*(NOBR+1)*(M+L)*NOBR, if ALG = 'Q', BATCH = 'I' or 'L' and CONCT = 'C'. The workspace used for ALG = 'Q' is LDRWRK*2*(M+L)*NOBR + 4*(M+L)*NOBR, where LDRWRK = LDWORK/(2*(M+L)*NOBR) - 2; recommended value LDRWRK = NS, assuming a large enough cache size. For good performance, LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: the number of 100 cycles in sequential data processing has been exhausted without signaling that the last block of data was get; the cycle counter was reinitialized; = 2: a fast algorithm was requested (ALG = 'C' or 'F'), but it failed, and the QR algorithm was then used (non-sequential data processing); = 3: all singular values were exactly zero, hence N = 0 (both input and output were identically zero); = 4: the least squares problems with coefficient matrix U_f, used for computing the weighted oblique projection (for METH = 'N'), have a rank-deficient coefficient matrix; = 5: the least squares problem with coefficient matrix r_1 [6], used for computing the weighted oblique projection (for METH = 'N'), has a rank-deficient coefficient matrix. NOTE: the values 4 and 5 of IWARN have no significance for the identification problem.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: a fast algorithm was requested (ALG = 'C', or 'F') in sequential data processing, but it failed; the routine can be repeatedly called again using the standard QR algorithm; = 2: the singular value decomposition (SVD) algorithm did not converge.Method
The procedure consists in three main steps, the first step being performed by one of the three algorithms included. 1.a) For non-sequential data processing using QR algorithm, a t x 2(m+l)s matrix H is constructed, where H = [ Uf' Up' Y' ], for METH = 'M', s+1,2s,t 1,s,t 1,2s,t H = [ U' Y' ], for METH = 'N', 1,2s,t 1,2s,t and Up , Uf , U , and Y are block Hankel 1,s,t s+1,2s,t 1,2s,t 1,2s,t matrices defined in terms of the input and output data [3]. A QR factorization is used to compress the data. The fast QR algorithm uses a QR factorization which exploits the block-Hankel structure. Actually, the Cholesky factor of H'*H is computed. 1.b) For sequential data processing using QR algorithm, the QR decomposition is done sequentially, by updating the upper triangular factor R. This is also performed internally if the workspace is not large enough to accommodate an entire batch. 1.c) For non-sequential or sequential data processing using Cholesky algorithm, the correlation matrix of input-output data is computed (sequentially, if requested), taking advantage of the block Hankel structure [7]. Then, the Cholesky factor of the correlation matrix is found, if possible. 2) A singular value decomposition (SVD) of a certain matrix is then computed, which reveals the order n of the system as the number of "non-zero" singular values. For the MOESP approach, this matrix is [ R_24' R_34' ]' := R(ms+1:(2m+l)s,(2m+l)s+1:2(m+l)s), where R is the upper triangular factor R constructed by SLICOT Library routine IB01MD. For the N4SID approach, a weighted oblique projection is computed from the upper triangular factor R and its SVD is then found. 3) The singular values are compared to the given, or default TOL, and the estimated order n is returned, possibly after user's confirmation.References
[1] Verhaegen M., and Dewilde, P. Subspace Model Identification. Part 1: The output-error state-space model identification class of algorithms. Int. J. Control, 56, pp. 1187-1210, 1992. [2] Verhaegen M. Subspace Model Identification. Part 3: Analysis of the ordinary output-error state-space model identification algorithm. Int. J. Control, 58, pp. 555-586, 1993. [3] Verhaegen M. Identification of the deterministic part of MIMO state space models given in innovations form from input-output data. Automatica, Vol.30, No.1, pp.61-74, 1994. [4] Van Overschee, P., and De Moor, B. N4SID: Subspace Algorithms for the Identification of Combined Deterministic-Stochastic Systems. Automatica, Vol.30, No.1, pp. 75-93, 1994. [5] Peternell, K., Scherrer, W. and Deistler, M. Statistical Analysis of Novel Subspace Identification Methods. Signal Processing, 52, pp. 161-177, 1996. [6] Sima, V. Subspace-based Algorithms for Multivariable System Identification. Studies in Informatics and Control, 5, pp. 335-344, 1996. [7] Sima, V. Cholesky or QR Factorization for Data Compression in Subspace-based Identification ? Proceedings of the Second NICONET Workshop on ``Numerical Control Software: SLICOT, a Useful Tool in Industry'', December 3, 1999, INRIA Rocquencourt, France, pp. 75-80, 1999.Numerical Aspects
The implemented method is numerically stable (when QR algorithm is used), reliable and efficient. The fast Cholesky or QR algorithms are more efficient, but the accuracy could diminish by forming the correlation matrix. The most time-consuming computational step is step 1: 2 The QR algorithm needs 0(t(2(m+l)s) ) floating point operations. 2 3 The Cholesky algorithm needs 0(2t(m+l) s)+0((2(m+l)s) ) floating point operations. 2 3 2 The fast QR algorithm needs 0(2t(m+l) s)+0(4(m+l) s ) floating point operations. 3 Step 2 of the algorithm requires 0(((m+l)s) ) floating point operations.Further Comments
For ALG = 'Q', BATCH = 'O' and LDR < NS, or BATCH <> 'O', the calculations could be rather inefficient if only minimal workspace (see argument LDWORK) is provided. It is advisable to provide as much workspace as possible. Almost optimal efficiency can be obtained for LDWORK = (NS+2)*(2*(M+L)*NOBR), assuming that the cache size is large enough to accommodate R, U, Y, and DWORK.Example
Program Text
* IB01AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LDR, LDU, LDWORK, LDY, LIWORK, LMAX, MMAX, $ NOBRMX, NSMPMX PARAMETER ( LMAX = 5, MMAX = 5, NOBRMX = 20, NSMPMX = 2000, $ LDR = MAX( 2*( MMAX + LMAX )*NOBRMX, $ 3*MMAX*NOBRMX ), LDU = NSMPMX, $ LDWORK = MAX( 6*( MMAX + LMAX )*NOBRMX, $ ( MMAX + LMAX )*( 4*NOBRMX* $ ( MMAX + LMAX + 1 ) + 2*NOBRMX ), $ ( MMAX + LMAX )*4*NOBRMX* $ ( NOBRMX + 1 ) ), $ LDY = NSMPMX, LIWORK = ( MMAX + LMAX )*NOBRMX ) * .. Local Scalars .. LOGICAL NGIVEN CHARACTER ALG, BATCH, CONCT, CTRL, JOBD, METH INTEGER I, ICYCLE, II, INFO, IWARN, J, L, M, N, NCYCLE, $ NGIV, NOBR, NSAMPL, NSMP DOUBLE PRECISION RCOND, TOL * .. Local Arrays .. DOUBLE PRECISION DWORK(LDWORK), R(LDR, 2*(MMAX+LMAX)*NOBRMX), $ SV(LMAX*NOBRMX), U(LDU, MMAX), Y(LDY, LMAX) INTEGER IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL IB01AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. * If the value of N is positive, it will be taken as system order. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) NOBR, N, M, L, NSMP, RCOND, TOL, METH, ALG, $ JOBD, BATCH, CONCT, CTRL IF ( LSAME( BATCH, 'F' ) ) THEN READ ( NIN, FMT = * ) NCYCLE ELSE NCYCLE = 1 END IF NSAMPL = NCYCLE*NSMP * NGIVEN = N.GT.0 IF( NGIVEN ) $ NGIV = N IF ( NOBR.LE.0 .OR. NOBR.GT.NOBRMX ) THEN WRITE ( NOUT, FMT = 99997 ) NOBR ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99996 ) M ELSE IF ( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99995 ) L ELSE IF ( NSMP.LT.0 .OR. NSMP.GT.NSMPMX .OR. $ ( NSMP.LT.2*( M + L + 1 )*NOBR - 1 .AND. $ LSAME( BATCH, 'O' ) ) .OR. $ ( NSAMPL.LT.2*( M + L + 1 )*NOBR - 1 .AND. $ LSAME( BATCH, 'L' ) ) .OR. $ NSMP.LT.2*NOBR .AND. ( LSAME( BATCH, 'F' ) .OR. $ LSAME( BATCH, 'I' ) ) ) THEN WRITE ( NOUT, FMT = 99994 ) NSMP ELSE IF ( NCYCLE.LE.0 .OR. NSAMPL.GT.NSMPMX ) THEN WRITE ( NOUT, FMT = 99993 ) NCYCLE ELSE * Read the matrices U and Y from the input file. IF ( M.GT.0 ) $ READ ( NIN, FMT = * ) $ ( ( U(I,J), J = 1, M ), I = 1, NSAMPL ) READ ( NIN, FMT = * ) ( ( Y(I,J), J = 1, L ), I = 1, NSAMPL ) * Compute the R factor from a QR (or Cholesky) factorization * of the Hankel-like matrix (or correlation matrix). DO 10 ICYCLE = 1, NCYCLE II = ( ICYCLE - 1 )*NSMP + 1 IF ( NCYCLE.GT.1 ) THEN IF ( ICYCLE.GT.1 ) BATCH = 'I' IF ( ICYCLE.EQ.NCYCLE ) BATCH = 'L' END IF CALL IB01AD( METH, ALG, JOBD, BATCH, CONCT, CTRL, NOBR, M, $ L, NSMP, U(II,1), LDU, Y(II,1), LDY, N, R, LDR, $ SV, RCOND, TOL, IWORK, DWORK, LDWORK, IWARN, $ INFO ) 10 CONTINUE IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) $ WRITE ( NOUT, FMT = 99990 ) IWARN IF( NGIVEN ) $ N = NGIV WRITE ( NOUT, FMT = 99992 ) N WRITE ( NOUT, FMT = 99991 ) ( SV(I), I = 1,L*NOBR ) END IF END IF STOP 99999 FORMAT ( ' IB01AD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT ( ' INFO on exit from IB01AD = ',I2) 99997 FORMAT (/' NOBR is out of range.',/' NOBR = ', I5) 99996 FORMAT (/' M is out of range.',/' M = ', I5) 99995 FORMAT (/' L is out of range.',/' L = ', I5) 99994 FORMAT (/' NSMP is out of range.',/' NSMP = ', I5) 99993 FORMAT (/' NCYCLE is out of range.',/' NCYCLE = ', I5) 99992 FORMAT ( ' The order of the system is ', I5) 99991 FORMAT ( ' The singular values are ',/ (8(1X,F8.4))) 99990 FORMAT ( ' IWARN on exit from IB01AD = ',I2) ENDProgram Data
IB01AD EXAMPLE PROGRAM DATA 15 0 1 1 1000 0.0 -1.0 M C N O N N 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 6.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 4.766099 4.763659 4.839359 5.002979 5.017629 5.056699 5.154379 5.361949 5.425439 5.569519 5.681849 5.742899 5.803949 5.918729 5.821049 5.447419 5.061589 4.629349 4.267939 4.011519 3.850349 3.711159 3.569519 3.518239 3.652549 3.818609 3.862559 4.011519 4.353409 4.705049 5.083559 5.344859 5.274039 5.127519 4.761219 4.451089 4.221539 4.045709 3.874769 3.730689 3.662319 3.576849 3.542659 3.479169 3.454749 3.359509 3.298459 3.225199 3.200779 3.225199 3.227639 3.274039 3.457189 3.867449 4.321659 4.492599 4.431549 4.243519 4.050599 3.857679 3.730689 3.791739 3.921169 3.955359 3.847909 3.725809 3.611039 3.716039 4.092109 4.480389 4.814939 5.054259 5.303339 5.486489 5.672089 5.779529 5.799069 5.664759 5.291129 4.880879 4.558529 4.184909 3.889419 3.708719 3.623249 3.569519 3.718479 4.033499 4.412009 4.629349 4.558529 4.394919 4.180019 4.197119 4.431549 4.714819 4.961459 5.300899 5.567079 5.681849 5.545099 5.188569 4.883319 4.600049 4.270379 4.038389 3.838139 3.711159 3.591499 3.535329 3.486489 3.476729 3.425439 3.381489 3.369279 3.364389 3.347299 3.381489 3.420559 3.413229 3.452309 3.635459 4.038389 4.375379 4.727029 5.056699 5.298459 5.532889 5.466959 5.195899 4.885759 4.763659 4.875989 5.042049 5.283809 5.491379 5.596379 5.672089 5.772209 5.830819 5.933379 5.899189 5.935819 5.894309 5.918729 5.994429 5.957799 6.031059 6.062809 6.040829 6.096999 6.123859 6.162929 6.040829 5.845469 5.772209 5.799069 5.923609 5.928499 6.001759 6.001759 6.060369 5.882099 5.510909 5.322879 5.371719 5.454749 5.437649 5.159269 4.902859 4.587839 4.502369 4.595159 4.824709 5.064029 5.271599 5.466959 5.615919 5.528009 5.254499 4.883319 4.517019 4.197119 4.001759 3.806399 3.904079 3.923609 3.869889 3.806399 3.720929 3.818609 4.140949 4.529229 4.805179 5.086009 5.339969 5.532889 5.576849 5.667199 5.791739 5.850349 5.923609 5.921169 5.977339 5.740459 5.388809 5.000539 4.849129 4.944369 5.173919 5.369279 5.447419 5.603709 5.730689 5.850349 5.979779 5.991989 6.084789 5.940709 5.803949 5.791739 5.603709 5.264269 4.946809 4.619579 4.514579 4.433989 4.285029 4.121419 3.945589 3.984659 4.219099 4.546319 4.873549 5.154379 5.388809 5.613479 5.835699 5.884539 5.955359 5.762439 5.459629 5.061589 4.707499 4.458409 4.267939 4.053039 3.943149 3.825929 3.967569 4.280149 4.480389 4.492599 4.390039 4.197119 4.111649 3.982219 3.867449 3.767319 3.872329 4.236189 4.663539 4.971229 5.066469 4.902859 4.675749 4.392479 4.099439 4.114089 4.326539 4.643999 4.971229 5.159269 5.388809 5.576849 5.652549 5.803949 5.913839 5.886979 5.799069 5.730689 5.762439 5.813719 5.821049 5.928499 6.013969 5.764879 5.413229 5.098219 4.678189 4.372939 4.392479 4.590279 4.919949 5.017629 4.858899 4.675749 4.619579 4.834479 5.090889 5.376599 5.681849 5.823489 5.952919 6.062809 6.089669 6.075019 6.026179 5.994429 6.077459 5.857679 5.701389 5.730689 5.784419 5.823489 5.894309 5.762439 5.415679 4.961459 4.595159 4.331429 4.297239 4.582949 4.861339 5.173919 5.166589 4.919949 4.607369 4.370499 4.182469 4.038389 4.145839 4.431549 4.556089 4.480389 4.375379 4.370499 4.558529 4.858899 4.895529 4.741679 4.744129 4.875989 5.105539 5.239849 5.518239 5.652549 5.723369 5.855239 5.962679 5.984659 5.984659 6.055479 6.062809 6.055479 6.070129 5.784419 5.440099 5.056699 4.941929 5.010299 5.134849 5.313109 5.479169 5.623249 5.562199 5.330209 5.010299 4.665979 4.414459 4.201999 4.048159 4.079899 4.189789 4.131179 4.004199 3.916289 3.960239 4.199559 4.624469 4.883319 5.137289 5.379049 5.623249 5.762439 5.833259 5.686739 5.366839 5.225199 5.239849 5.354629 5.508469 5.596379 5.752669 5.874769 5.906519 5.894309 5.742899 5.447419 5.024959 4.883319 4.885759 4.893089 4.714819 4.451089 4.233749 4.043269 3.864999 3.757559 3.669639 3.593939 3.547539 3.506029 3.454749 3.398579 3.361949 3.339969 3.374159 3.520679 3.713599 3.757559 3.779529 3.696509 3.777089 3.886979 3.904079 3.850349 3.965129 4.282589 4.521899 4.714819 4.971229 5.220319 5.532889 5.652549 5.781979 5.955359 6.035939 6.118969 6.133629 6.153159 6.192229 6.143389 6.167809 5.991989 5.652549 5.459629 5.437649 5.339969 5.098219 4.785639 4.492599 4.236189 4.067689 3.933379 3.823489 3.730689 3.611039 3.564639 3.549989 3.557309 3.513359 3.515799 3.694059 4.072579 4.480389 4.705049 4.612259 4.385149 4.201999 4.026179 3.904079 3.774649 3.691619 3.845469 4.201999 4.585399 4.902859 5.256949 5.510909 5.640339 5.843029 5.974889 5.935819 5.821049 5.528009 5.171479 4.810059 4.453529 4.380269 4.565859 4.805179 5.125079 5.354629 5.589059 5.764879 5.923609 5.940709 5.857679 5.694059 5.486489 5.149499 4.844249 4.541439 4.267939 4.060369 3.960239 3.789299 3.642779 3.525569 3.498699 3.454749 3.408349 3.379049 3.376599 3.361949 3.359509 3.369279 3.398579 3.579289 3.948029 4.412009 4.585399 4.514579 4.343639 4.155599 3.984659 4.043269 4.307009 4.421779 4.353409 4.223979 4.053039 3.940709 3.838139 3.730689 3.652549 3.611039 3.564639 3.496259 3.462069 3.454749 3.425439 3.379049 3.432769 3.623249 3.974889 4.380269 4.714819 5.073799 5.369279 5.603709 5.745349 5.652549 5.401019 5.015189 4.709939 4.416899 4.236189 4.236189 4.248399 4.221539 4.297239 4.590279 4.893089 5.134849 5.427889 5.379049 5.364389 5.452309 5.567079 5.672089 5.769769 5.830819 5.923609 5.965129 6.057919 6.050599 6.072579 6.111649 6.070129 5.896749 5.755109 5.718479 5.821049 6.001759 6.001759 5.901629 5.557309 5.173919 4.800289 4.431549 4.194679 4.006639 3.850349 3.747789 3.642779 3.591499 3.569519 3.528009 3.537779 3.554869 3.493819 3.447419 3.440099 3.408349 3.410789 3.452309 3.681849 4.060369 4.441319 4.854019 5.154379 5.425439 5.596379 5.586619 5.354629 5.027399 4.863779 4.761219 4.570739 4.368059 4.397359 4.573189 4.841809 5.203219 5.452309 5.652549 5.855239 5.906519 5.952919 5.828369 5.791739 5.799069 5.813719 5.877209 5.955359 5.781979 5.518239 5.127519 4.763659 4.492599 4.233749 4.011519 3.855239 3.691619 3.635459 3.818609 4.155599 4.590279 4.988329 5.076239 4.907739 4.648889 4.377829 4.216649 4.287469 4.590279 4.846689 5.139729 5.388809 5.689179 5.884539 6.043269 6.170259 6.211769 6.250839 6.209329 6.013969 5.701389 5.469399 5.479169 5.557309 5.728249 5.882099 5.984659 5.901629 5.581729 5.371719 5.418119 5.510909 5.667199 5.791739 5.698949 5.484049 5.154379 4.980999 5.061589 5.195899 5.359509 5.615919 5.762439 5.857679 5.948029 5.835699 5.706269 5.498699 5.188569 5.117749 5.191009 5.315549 5.532889 5.444979 5.396139 5.274039 5.027399 4.744129 4.668419 4.651329 4.514579 4.267939 4.260609 4.263049 4.189789 4.277699 4.600049 4.932159 5.283809 5.528009 5.740459 5.874769 5.955359 5.991989 5.845469 5.528009 5.061589 4.734359 4.534109 4.534109 4.697729 4.744129 4.619579 4.643999 4.832039 5.132399 5.410789 5.625689 5.603709 5.315549 4.961459 4.619579 4.358289 4.155599 4.033499 3.886979 3.772209 3.640339 3.532889 3.435209 3.427889 3.422999 3.398579 3.603709 4.023729 4.451089 4.792969 4.902859 4.780759 4.590279 4.336309 4.145839 4.216649 4.433989 4.714819 5.098219 5.359509 5.569519 5.772209 5.921169 6.055479 5.962679 5.642779 5.435209 5.388809 5.537779 5.681849 5.701389 5.615919 5.667199 5.740459 5.803949 5.882099 5.950469 6.072579 6.148279 6.116529 6.177579 6.201999 6.206889 5.991989 5.564639 5.178799 4.998089 5.051819 5.232529 5.484049 5.686739 5.899189 5.869889 5.977339 6.053039 6.079899 6.128739 6.079899 6.167809 6.194679 6.236189 6.053039 5.652549 5.274039 4.858899 4.534109 4.455969 4.619579 4.866229 5.117749 5.166589 5.056699 5.002979 5.098219 5.325319 5.567079 5.466959 5.252059 4.946809 4.880879 4.980999 5.225199 5.459629 5.723369 5.791739 5.906519 5.991989 5.835699 5.528009 5.142169 4.775869 4.490159 4.236189 4.023729 3.886979 3.752669 3.681849 3.806399 4.145839 4.600049 5.002979 5.303339 5.552429 5.615919 5.523119 5.611039 5.713599 5.845469 5.899189 5.994429 6.092109 6.092109 6.143389 6.153159 6.233749 6.187349 6.013969 5.835699 5.774649 5.686739 5.537779 5.327759 5.054259 4.700169 4.394919 4.180019 4.043269 3.877209 3.752669 3.728249 3.869889 4.206889 4.355849 4.426669 4.453529 4.521899 4.392479 4.155599 3.965129 3.877209 3.970009 4.258169 4.421779 4.336309 4.299679 4.392479 4.675749 4.761219 4.658659 4.490159 4.307009 4.126299 3.972449 4.077459 4.372939 4.741679 5.088449 5.186129 5.037169 4.785639 4.563419 4.534109 4.705049 4.741679 4.648889 4.431549 4.238629 4.065249 3.943149 3.811279 3.691619 3.652549 3.825929 4.223979 4.424219 4.429109 4.319219 4.138509 3.965129 3.886979 3.801509 3.701389 3.640339 3.767319 4.150719 4.648889 4.990769 5.088449 5.022509 4.783199 4.685519 4.665979 4.707499 4.912619 5.195899 5.415679 5.623249 5.740459 5.899189 5.928499 6.050599 6.153159 5.965129 5.586619 5.381489 5.371719 5.486489 5.567079 5.821049 5.913839 5.994429 6.011519 5.999309 6.018849 5.821049 5.728249 5.740459 5.764879 5.882099 5.926049 5.750229 5.415679 4.995649 4.861339 4.902859 5.103099 5.364389 5.596379 5.752669 5.845469 5.928499 6.006639 5.840579 5.518239 5.173919 4.739239 4.458409 4.426669 4.602489 4.822269 5.183689 5.430329 5.652549 5.821049 5.706269 5.369279 5.027399 4.705049 4.414459 4.145839 3.965129 4.033499 4.372939 4.683079Program Results
IB01AD EXAMPLE PROGRAM RESULTS The order of the system is 4 The singular values are 69.8841 14.9963 3.6675 1.9677 0.3000 0.2078 0.1651 0.1373 0.1133 0.1059 0.0856 0.0784 0.0733 0.0678 0.0571
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/IB01BD.html 0000664 0000000 0000000 00000143574 14560147231 0020331 0 ustar 00root root 0000000 0000000
Purpose
To estimate the system matrices A, C, B, and D, the noise covariance matrices Q, Ry, and S, and the Kalman gain matrix K of a linear time-invariant state space model, using the processed triangular factor R of the concatenated block Hankel matrices, provided by SLICOT Library routine IB01AD.Specification
SUBROUTINE IB01BD( METH, JOB, JOBCK, NOBR, N, M, L, NSMPL, R, $ LDR, A, LDA, C, LDC, B, LDB, D, LDD, Q, LDQ, $ RY, LDRY, S, LDS, K, LDK, TOL, IWORK, DWORK, $ LDWORK, BWORK, IWARN, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION TOL INTEGER INFO, IWARN, L, LDA, LDB, LDC, LDD, LDK, LDQ, $ LDR, LDRY, LDS, LDWORK, M, N, NOBR, NSMPL CHARACTER JOB, JOBCK, METH C .. Array Arguments .. DOUBLE PRECISION A(LDA, *), B(LDB, *), C(LDC, *), D(LDD, *), $ DWORK(*), K(LDK, *), Q(LDQ, *), R(LDR, *), $ RY(LDRY, *), S(LDS, *) INTEGER IWORK( * ) LOGICAL BWORK( * )Arguments
Mode Parameters
METH CHARACTER*1 Specifies the subspace identification method to be used, as follows: = 'M': MOESP algorithm with past inputs and outputs; = 'N': N4SID algorithm; = 'C': combined method: MOESP algorithm for finding the matrices A and C, and N4SID algorithm for finding the matrices B and D. JOB CHARACTER*1 Specifies which matrices should be computed, as follows: = 'A': compute all system matrices, A, B, C, and D; = 'C': compute the matrices A and C only; = 'B': compute the matrix B only; = 'D': compute the matrices B and D only. JOBCK CHARACTER*1 Specifies whether or not the covariance matrices and the Kalman gain matrix are to be computed, as follows: = 'C': the covariance matrices only should be computed; = 'K': the covariance matrices and the Kalman gain matrix should be computed; = 'N': the covariance matrices and the Kalman gain matrix should not be computed.Input/Output Parameters
NOBR (input) INTEGER The number of block rows, s, in the input and output Hankel matrices processed by other routines. NOBR > 1. N (input) INTEGER The order of the system. NOBR > N > 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L > 0. NSMPL (input) INTEGER If JOBCK = 'C' or 'K', the total number of samples used for calculating the covariance matrices. NSMPL >= 2*(M+L)*NOBR. This parameter is not meaningful if JOBCK = 'N'. R (input/workspace) DOUBLE PRECISION array, dimension ( LDR,2*(M+L)*NOBR ) On entry, the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR part of this array must contain the relevant data for the MOESP or N4SID algorithms, as constructed by SLICOT Library routine IB01AD. Let R_ij, i,j = 1:4, be the ij submatrix of R (denoted S in IB01AD), partitioned by M*NOBR, L*NOBR, M*NOBR, and L*NOBR rows and columns. The submatrix R_22 contains the matrix of left singular vectors used. Also needed, for METH = 'N' or JOBCK <> 'N', are the submatrices R_11, R_14 : R_44, and, for METH = 'M' or 'C' and JOB <> 'C', the submatrices R_31 and R_12, containing the processed matrices R_1c and R_2c, respectively, as returned by SLICOT Library routine IB01AD. Moreover, if METH = 'N' and JOB = 'A' or 'C', the block-row R_41 : R_43 must contain the transpose of the block-column R_14 : R_34 as returned by SLICOT Library routine IB01AD. The remaining part of R is used as workspace. On exit, part of this array is overwritten. Specifically, if METH = 'M', R_22 and R_31 are overwritten if JOB = 'B' or 'D', and R_12, R_22, R_14 : R_34, and possibly R_11 are overwritten if JOBCK <> 'N'; if METH = 'N', all needed submatrices are overwritten. The details of the contents of R need not be known if this routine is called once just after calling the SLICOT Library routine IB01AD. LDR INTEGER The leading dimension of the array R. LDR >= 2*(M+L)*NOBR. A (input or output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if METH = 'N' or 'C' and JOB = 'B' or 'D', the leading N-by-N part of this array must contain the system state matrix. If METH = 'M' or (METH = 'N' or 'C' and JOB = 'A' or 'C'), this array need not be set on input. On exit, if JOB = 'A' or 'C' and INFO = 0, the leading N-by-N part of this array contains the system state matrix. LDA INTEGER The leading dimension of the array A. LDA >= N, if JOB = 'A' or 'C', or METH = 'N' or 'C' and JOB = 'B' or 'D'; LDA >= 1, otherwise. C (input or output) DOUBLE PRECISION array, dimension (LDC,N) On entry, if METH = 'N' or 'C' and JOB = 'B' or 'D', the leading L-by-N part of this array must contain the system output matrix. If METH = 'M' or (METH = 'N' or 'C' and JOB = 'A' or 'C'), this array need not be set on input. On exit, if JOB = 'A' or 'C' and INFO = 0, or INFO = 3 (or INFO >= 0, for METH = 'M'), the leading L-by-N part of this array contains the system output matrix. LDC INTEGER The leading dimension of the array C. LDC >= L, if JOB = 'A' or 'C', or METH = 'N' or 'C' and JOB = 'B' or 'D'; LDC >= 1, otherwise. B (output) DOUBLE PRECISION array, dimension (LDB,M) If M > 0, JOB = 'A', 'B', or 'D' and INFO = 0, the leading N-by-M part of this array contains the system input matrix. If M = 0 or JOB = 'C', this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= N, if M > 0 and JOB = 'A', 'B', or 'D'; LDB >= 1, if M = 0 or JOB = 'C'. D (output) DOUBLE PRECISION array, dimension (LDD,M) If M > 0, JOB = 'A' or 'D' and INFO = 0, the leading L-by-M part of this array contains the system input-output matrix. If M = 0 or JOB = 'C' or 'B', this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= L, if M > 0 and JOB = 'A' or 'D'; LDD >= 1, if M = 0 or JOB = 'C' or 'B'. Q (output) DOUBLE PRECISION array, dimension (LDQ,N) If JOBCK = 'C' or 'K', the leading N-by-N part of this array contains the positive semidefinite state covariance matrix. If JOBCK = 'K', this matrix has been used as state weighting matrix for computing the Kalman gain. This parameter is not referenced if JOBCK = 'N'. LDQ INTEGER The leading dimension of the array Q. LDQ >= N, if JOBCK = 'C' or 'K'; LDQ >= 1, if JOBCK = 'N'. RY (output) DOUBLE PRECISION array, dimension (LDRY,L) If JOBCK = 'C' or 'K', the leading L-by-L part of this array contains the positive (semi)definite output covariance matrix. If JOBCK = 'K', this matrix has been used as output weighting matrix for computing the Kalman gain. This parameter is not referenced if JOBCK = 'N'. LDRY INTEGER The leading dimension of the array RY. LDRY >= L, if JOBCK = 'C' or 'K'; LDRY >= 1, if JOBCK = 'N'. S (output) DOUBLE PRECISION array, dimension (LDS,L) If JOBCK = 'C' or 'K', the leading N-by-L part of this array contains the state-output cross-covariance matrix. If JOBCK = 'K', this matrix has been used as state- output weighting matrix for computing the Kalman gain. This parameter is not referenced if JOBCK = 'N'. LDS INTEGER The leading dimension of the array S. LDS >= N, if JOBCK = 'C' or 'K'; LDS >= 1, if JOBCK = 'N'. K (output) DOUBLE PRECISION array, dimension ( LDK,L ) If JOBCK = 'K', the leading N-by-L part of this array contains the estimated Kalman gain matrix. If JOBCK = 'C' or 'N', this array is not referenced. LDK INTEGER The leading dimension of the array K. LDK >= N, if JOBCK = 'K'; LDK >= 1, if JOBCK = 'C' or 'N'.Tolerances
TOL DOUBLE PRECISION The tolerance to be used for estimating the rank of matrices. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; an m-by-n matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = m*n*EPS, is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= max(LIW1,LIW2), where LIW1 = N, if METH <> 'N' and M = 0 or JOB = 'C' and JOBCK = 'N'; LIW1 = M*NOBR+N, if METH <> 'N', JOB = 'C', and JOBCK <> 'N'; LIW1 = max(L*NOBR,M*NOBR), if METH = 'M', JOB <> 'C', and JOBCK = 'N'; LIW1 = max(L*NOBR,M*NOBR+N), if METH = 'M', JOB <> 'C', and JOBCK = 'C' or 'K'; LIW1 = max(M*NOBR+N,M*(N+L)), if METH = 'N', or METH = 'C' and JOB <> 'C'; LIW2 = 0, if JOBCK <> 'K'; LIW2 = N*N, if JOBCK = 'K'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and DWORK(2), DWORK(3), DWORK(4), and DWORK(5) contain the reciprocal condition numbers of the triangular factors of the following matrices (defined in SLICOT Library routine IB01PD and in the lower level routines): GaL (GaL = Un(1:(s-1)*L,1:n)), R_1c (if METH = 'M' or 'C'), M (if JOBCK = 'C' or 'K' or METH = 'N'), and Q or T (see SLICOT Library routine IB01PY or IB01PX), respectively. If METH = 'N', DWORK(3) is set to one without any calculations. Similarly, if METH = 'M' and JOBCK = 'N', DWORK(4) is set to one. If M = 0 or JOB = 'C', DWORK(3) and DWORK(5) are set to one. If JOBCK = 'K' and INFO = 0, DWORK(6) to DWORK(13) contain information about the accuracy of the results when computing the Kalman gain matrix, as follows: DWORK(6) - reciprocal condition number of the matrix U11 of the Nth order system of algebraic equations from which the solution matrix X of the Riccati equation is obtained; DWORK(7) - reciprocal pivot growth factor for the LU factorization of the matrix U11; DWORK(8) - reciprocal condition number of the matrix As = A - S*inv(Ry)*C, which is inverted by the standard Riccati solver; DWORK(9) - reciprocal pivot growth factor for the LU factorization of the matrix As; DWORK(10) - reciprocal condition number of the matrix Ry; DWORK(11) - reciprocal condition number of the matrix Ry + C*X*C'; DWORK(12) - reciprocal condition number for the Riccati equation solution; DWORK(13) - forward error bound for the Riccati equation solution. On exit, if INFO = -30, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= max( LDW1,LDW2,LDW3 ), where, if METH = 'M', LDW1 >= max( 2*(L*NOBR-L)*N+2*N, (L*NOBR-L)*N+N*N+7*N ), if JOB = 'C' or JOB = 'A' and M = 0; LDW1 >= max( 2*(L*NOBR-L)*N+N*N+7*N, (L*NOBR-L)*N+N+6*M*NOBR, (L*NOBR-L)*N+N+ max( L+M*NOBR, L*NOBR + max( 3*L*NOBR+1, M ) ) ), if M > 0 and JOB = 'A', 'B', or 'D'; LDW2 >= 0, if JOBCK = 'N'; LDW2 >= L*NOBR*N+ max( (L*NOBR-L)*N+Aw+2*N+max(5*N,(2*M+L)*NOBR+L), 4*(M*NOBR+N)+1, M*NOBR+2*N+L ), if JOBCK = 'C' or 'K', where Aw = N+N*N, if M = 0 or JOB = 'C'; Aw = 0, otherwise; if METH = 'N', LDW1 >= L*NOBR*N+max( (L*NOBR-L)*N+2*N+(2*M+L)*NOBR+L, 2*(L*NOBR-L)*N+N*N+8*N, N+4*(M*NOBR+N)+1, M*NOBR+3*N+L ); LDW2 >= 0, if M = 0 or JOB = 'C'; LDW2 >= L*NOBR*N+M*NOBR*(N+L)*(M*(N+L)+1)+ max( (N+L)**2, 4*M*(N+L)+1 ), if M > 0 and JOB = 'A', 'B', or 'D'; and, if METH = 'C', LDW1 as max( LDW1 for METH = 'M', JOB = 'C', LDW1 for METH = 'N'), and LDW2 for METH = 'N' are used; LDW3 >= 0, if JOBCK <> 'K'; LDW3 >= max( 4*N*N+2*N*L+L*L+max( 3*L,N*L ), 14*N*N+12*N+5 ), if JOBCK = 'K'. For good performance, LDWORK should be larger. BWORK LOGICAL array, dimension (LBWORK) LBWORK = 2*N, if JOBCK = 'K'; LBWORK = 0, if JOBCK <> 'K'.Warning Indicator
IWARN INTEGER = 0: no warning; = 4: a least squares problem to be solved has a rank-deficient coefficient matrix; = 5: the computed covariance matrices are too small. The problem seems to be a deterministic one; the gain matrix is set to zero.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 2: the singular value decomposition (SVD) algorithm did not converge; = 3: a singular upper triangular matrix was found; = 3+i: if JOBCK = 'K' and the associated Riccati equation could not be solved, where i = 1,...,6; (see the description of the parameter INFO for the SLICOT Library routine SB02RD for the meaning of the i values); = 10: the QR algorithm did not converge.Method
In the MOESP approach, the matrices A and C are first computed from an estimated extended observability matrix [1], and then, the matrices B and D are obtained by solving an extended linear system in a least squares sense. In the N4SID approach, besides the estimated extended observability matrix, the solutions of two least squares problems are used to build another least squares problem, whose solution is needed to compute the system matrices A, C, B, and D. The solutions of the two least squares problems are also optionally used by both approaches to find the covariance matrices. The Kalman gain matrix is obtained by solving a discrete-time algebraic Riccati equation.References
[1] Verhaegen M., and Dewilde, P. Subspace Model Identification. Part 1: The output-error state-space model identification class of algorithms. Int. J. Control, 56, pp. 1187-1210, 1992. [2] Van Overschee, P., and De Moor, B. N4SID: Two Subspace Algorithms for the Identification of Combined Deterministic-Stochastic Systems. Automatica, Vol.30, No.1, pp. 75-93, 1994. [3] Van Overschee, P. Subspace Identification : Theory - Implementation - Applications. Ph. D. Thesis, Department of Electrical Engineering, Katholieke Universiteit Leuven, Belgium, Feb. 1995. [4] Sima, V. Subspace-based Algorithms for Multivariable System Identification. Studies in Informatics and Control, 5, pp. 335-344, 1996.Numerical Aspects
The implemented method consists in numerically stable steps.Further Comments
The covariance matrices are computed using the N4SID approach. Therefore, for efficiency reasons, it is advisable to set METH = 'N', if the Kalman gain matrix or covariance matrices are needed (JOBCK = 'K', or 'C'). When JOBCK = 'N', it could be more efficient to use the combined method, METH = 'C'. Often, this combination will also provide better accuracy than MOESP algorithm. In some applications, it is useful to compute the system matrices using two calls to this routine, the first one with JOB = 'C', and the second one with JOB = 'B' or 'D'. This is slightly less efficient than using a single call with JOB = 'A', because some calculations are repeated. If METH = 'N', all the calculations at the first call are performed again at the second call; moreover, it is required to save the needed submatrices of R before the first call and restore them before the second call. If the covariance matrices and/or the Kalman gain are desired, JOBCK should be set to 'C' or 'K' at the second call. If B and D are both needed, they should be computed at once.Example
Program Text
* IB01BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LDA, LDB, LDC, LDD, LDK, LDQ, LDR, LDRY, LDS, $ LDU, LDW1, LDW2, LDW3, LDWORK, LDY, LIWORK, LMAX, $ MMAX, NMAX, NOBRMX, NSMPMX PARAMETER ( LMAX = 5, MMAX = 5, NOBRMX = 20, NSMPMX = 2000, $ NMAX = NOBRMX - 1, LDA = NMAX, LDB = NMAX, $ LDC = LMAX, LDD = LMAX, LDK = NMAX, $ LDQ = NMAX, LDRY = LMAX, LDS = NMAX, $ LDR = MAX( 2*( MMAX + LMAX )*NOBRMX, $ 3*MMAX*NOBRMX ), LDU = NSMPMX, $ LDW1 = MAX( LMAX*( NOBRMX - 1 )*NMAX + NMAX + $ MAX( 6*MMAX, 4*LMAX )*NOBRMX, $ LMAX*NOBRMX*NMAX + $ MAX( LMAX*( NOBRMX - 1 )*NMAX + $ 3*NMAX + LMAX + $ ( 2*MMAX + LMAX )*NOBRMX, $ 2*LMAX*( NOBRMX - 1 )*NMAX + $ NMAX*NMAX + 8*NMAX, $ NMAX + $ 4*( MMAX*NOBRMX + NMAX ) ) ), $ LDW2 = LMAX*NOBRMX*NMAX + $ MMAX*NOBRMX*( NMAX + LMAX )* $ ( MMAX*( NMAX + LMAX ) + 1 ) + $ MAX( ( NMAX + LMAX )**2, $ 4*MMAX*( NMAX + LMAX ) + 1 ), $ LDW3 = MAX( 4*NMAX*NMAX + 2*NMAX*LMAX + $ LMAX*LMAX + $ MAX( 3*LMAX, NMAX*LMAX ), $ 14*NMAX*NMAX + 12*NMAX + 5 ), $ LDWORK = MAX( 6*( MMAX + LMAX )*NOBRMX, $ ( MMAX + LMAX )*( 4*NOBRMX* $ ( MMAX + LMAX + 2 ) - 2 ), $ ( MMAX + LMAX )*4*NOBRMX* $ ( NOBRMX + 1 ), LDW1, LDW2, $ LDW3 ), $ LDY = NSMPMX, $ LIWORK = MAX( ( MMAX + LMAX )*NOBRMX, $ MMAX*NOBRMX + NMAX, LMAX*NOBRMX, $ MMAX*( NMAX + LMAX ), NMAX*NMAX ) $ ) * .. Local Scalars .. LOGICAL NGIVEN CHARACTER ALG, BATCH, CONCT, CTRL, JOB, JOBCK, JOBD, JOBDA, $ METH, METHA INTEGER I, ICYCLE, II, INFO, IWARN, J, L, M, N, NCYCLE, $ NGIV, NOBR, NSAMPL, NSMP DOUBLE PRECISION RCOND, TOL * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), B(LDB, MMAX), C(LDC, NMAX), $ D(LDD, MMAX), DWORK(LDWORK), K(LDK, LMAX), $ Q(LDQ, NMAX), R(LDR, 2*(MMAX+LMAX)*NOBRMX), $ RY(LDRY, LMAX), S(LDS, LMAX), SV(LMAX*NOBRMX), $ U(LDU, MMAX), Y(LDY, LMAX) INTEGER IWORK(LIWORK) LOGICAL BWORK(2*NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL IB01AD, IB01BD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. * If the value of N is positive, it will be taken as system order. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) NOBR, N, M, L, NSMP, RCOND, TOL READ ( NIN, FMT = * ) METH, ALG, JOBD, BATCH, CONCT, CTRL, JOB, $ JOBCK IF ( LSAME( BATCH, 'F' ) ) THEN READ ( NIN, FMT = * ) NCYCLE ELSE NCYCLE = 1 END IF NSAMPL = NCYCLE*NSMP * NGIVEN = N.GT.0 IF( NGIVEN ) $ NGIV = N IF ( NOBR.LE.0 .OR. NOBR.GT.NOBRMX ) THEN WRITE ( NOUT, FMT = 99997 ) NOBR ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99996 ) M ELSE IF ( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99995 ) L ELSE IF ( NSMP.LT.0 .OR. NSMP.GT.NSMPMX .OR. $ ( NSMP.LT.2*( M + L + 1 )*NOBR - 1 .AND. $ LSAME( BATCH, 'O' ) ) .OR. $ ( NSAMPL.LT.2*( M + L + 1 )*NOBR - 1 .AND. $ LSAME( BATCH, 'L' ) ) .OR. $ NSMP.LT.2*NOBR .AND. ( LSAME( BATCH, 'F' ) .OR. $ LSAME( BATCH, 'I' ) ) ) THEN WRITE ( NOUT, FMT = 99994 ) NSMP ELSE IF ( NCYCLE.LE.0 .OR. NSAMPL.GT.NSMPMX ) THEN WRITE ( NOUT, FMT = 99993 ) NCYCLE ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99980 ) N ELSE * Read the matrices U and Y from the input file. IF ( M.GT.0 ) $ READ ( NIN, FMT = * ) $ ( ( U(I,J), J = 1, M ), I = 1, NSAMPL ) READ ( NIN, FMT = * ) ( ( Y(I,J), J = 1, L ), I = 1, NSAMPL ) * Read A and C matrices, if METH <> 'M' and JOB = 'B' or 'D'. IF ( .NOT.LSAME( METH, 'M' ) .AND. $ ( LSAME( JOB, 'B' ) .OR. LSAME( JOB, 'D' ) ) ) THEN DO 10 I = 1, N READ ( NIN, FMT = * ) ( A(I,J), J = 1, N ) 10 CONTINUE DO 20 I = 1, L READ ( NIN, FMT = * ) ( C(I,J), J = 1, N ) 20 CONTINUE END IF * Force some options for IB01AD, depending on the specifications. IF ( LSAME( METH, 'C' ) ) THEN METHA = 'M' JOBDA = 'N' ELSE METHA = METH JOBDA = JOBD END IF * Compute the R factor from a QR (or Cholesky) factorization * of the Hankel-like matrix (or correlation matrix). DO 30 ICYCLE = 1, NCYCLE II = ( ICYCLE - 1 )*NSMP + 1 IF ( NCYCLE.GT.1 ) THEN IF ( ICYCLE.GT.1 ) BATCH = 'I' IF ( ICYCLE.EQ.NCYCLE ) BATCH = 'L' END IF CALL IB01AD( METHA, ALG, JOBDA, BATCH, CONCT, CTRL, NOBR, M, $ L, NSMP, U(II,1), LDU, Y(II,1), LDY, N, R, LDR, $ SV, RCOND, TOL, IWORK, DWORK, LDWORK, IWARN, $ INFO ) 30 CONTINUE IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) $ WRITE ( NOUT, FMT = 99990 ) IWARN IF( NGIVEN ) $ N = NGIV * Compute the system matrices. CALL IB01BD( METH, JOB, JOBCK, NOBR, N, M, L, NSMP, R, $ LDR, A, LDA, C, LDC, B, LDB, D, LDD, Q, LDQ, $ RY, LDRY, S, LDS, K, LDK, RCOND, IWORK, DWORK, $ LDWORK, BWORK, IWARN, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99992 ) INFO ELSE IF ( IWARN.NE.0 ) $ WRITE ( NOUT, FMT = 99991 ) IWARN IF ( LSAME( JOB, 'A' ) .OR. LSAME( JOB, 'C' ) ) THEN WRITE ( NOUT, FMT = 99989 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99988 ) ( A(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99987 ) DO 50 I = 1, L WRITE ( NOUT, FMT = 99988 ) ( C(I,J), J = 1,N ) 50 CONTINUE END IF IF ( .NOT.LSAME( JOB, 'C' ) ) THEN WRITE ( NOUT, FMT = 99986 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99988 ) ( B(I,J), J = 1,M ) 60 CONTINUE END IF IF ( LSAME( JOB, 'A' ) .OR. LSAME( JOB, 'D' ) ) THEN WRITE ( NOUT, FMT = 99985 ) DO 70 I = 1, L WRITE ( NOUT, FMT = 99988 ) ( D(I,J), J = 1,M ) 70 CONTINUE END IF IF ( LSAME( JOBCK, 'K' ) ) THEN WRITE ( NOUT, FMT = 99984 ) DO 80 I = 1, N WRITE ( NOUT, FMT = 99988 ) ( K(I,J), J = 1,L ) 80 CONTINUE END IF IF ( .NOT.LSAME( JOBCK, 'N' ) ) THEN WRITE ( NOUT, FMT = 99983 ) DO 90 I = 1, N WRITE ( NOUT, FMT = 99988 ) ( Q(I,J), J = 1,N ) 90 CONTINUE WRITE ( NOUT, FMT = 99982 ) DO 100 I = 1, L WRITE ( NOUT, FMT = 99988 ) ( RY(I,J), J = 1,L ) 100 CONTINUE WRITE ( NOUT, FMT = 99981 ) DO 110 I = 1, N WRITE ( NOUT, FMT = 99988 ) ( S(I,J), J = 1,L ) 110 CONTINUE END IF END IF END IF END IF STOP 99999 FORMAT ( ' IB01BD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT ( ' INFO on exit from IB01AD = ',I2) 99997 FORMAT (/' NOBR is out of range.',/' NOBR = ', I5) 99996 FORMAT (/' M is out of range.',/' M = ', I5) 99995 FORMAT (/' L is out of range.',/' L = ', I5) 99994 FORMAT (/' NSMP is out of range.',/' NSMP = ', I5) 99993 FORMAT (/' NCYCLE is out of range.',/' NCYCLE = ', I5) 99992 FORMAT ( ' INFO on exit from IB01BD = ',I2) 99991 FORMAT ( ' IWARN on exit from IB01BD = ',I2) 99990 FORMAT ( ' IWARN on exit from IB01AD = ',I2) 99989 FORMAT (/' The system state matrix A is ') 99988 FORMAT (20(1X,F8.4)) 99987 FORMAT (/' The system output matrix C is ') 99986 FORMAT (/' The system input matrix B is ') 99985 FORMAT (/' The system input-output matrix D is ') 99984 FORMAT (/' The Kalman gain matrix K is ') 99983 FORMAT (/' The state covariance matrix Q is ') 99982 FORMAT (/' The output covariance matrix Ry is ') 99981 FORMAT (/' The state-output cross-covariance matrix S is ') 99980 FORMAT (/' N is out of range.',/' N = ', I5) ENDProgram Data
IB01BD EXAMPLE PROGRAM DATA 15 0 1 1 1000 0.0 -1.0 C C N O N N A K 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 6.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 4.766099 4.763659 4.839359 5.002979 5.017629 5.056699 5.154379 5.361949 5.425439 5.569519 5.681849 5.742899 5.803949 5.918729 5.821049 5.447419 5.061589 4.629349 4.267939 4.011519 3.850349 3.711159 3.569519 3.518239 3.652549 3.818609 3.862559 4.011519 4.353409 4.705049 5.083559 5.344859 5.274039 5.127519 4.761219 4.451089 4.221539 4.045709 3.874769 3.730689 3.662319 3.576849 3.542659 3.479169 3.454749 3.359509 3.298459 3.225199 3.200779 3.225199 3.227639 3.274039 3.457189 3.867449 4.321659 4.492599 4.431549 4.243519 4.050599 3.857679 3.730689 3.791739 3.921169 3.955359 3.847909 3.725809 3.611039 3.716039 4.092109 4.480389 4.814939 5.054259 5.303339 5.486489 5.672089 5.779529 5.799069 5.664759 5.291129 4.880879 4.558529 4.184909 3.889419 3.708719 3.623249 3.569519 3.718479 4.033499 4.412009 4.629349 4.558529 4.394919 4.180019 4.197119 4.431549 4.714819 4.961459 5.300899 5.567079 5.681849 5.545099 5.188569 4.883319 4.600049 4.270379 4.038389 3.838139 3.711159 3.591499 3.535329 3.486489 3.476729 3.425439 3.381489 3.369279 3.364389 3.347299 3.381489 3.420559 3.413229 3.452309 3.635459 4.038389 4.375379 4.727029 5.056699 5.298459 5.532889 5.466959 5.195899 4.885759 4.763659 4.875989 5.042049 5.283809 5.491379 5.596379 5.672089 5.772209 5.830819 5.933379 5.899189 5.935819 5.894309 5.918729 5.994429 5.957799 6.031059 6.062809 6.040829 6.096999 6.123859 6.162929 6.040829 5.845469 5.772209 5.799069 5.923609 5.928499 6.001759 6.001759 6.060369 5.882099 5.510909 5.322879 5.371719 5.454749 5.437649 5.159269 4.902859 4.587839 4.502369 4.595159 4.824709 5.064029 5.271599 5.466959 5.615919 5.528009 5.254499 4.883319 4.517019 4.197119 4.001759 3.806399 3.904079 3.923609 3.869889 3.806399 3.720929 3.818609 4.140949 4.529229 4.805179 5.086009 5.339969 5.532889 5.576849 5.667199 5.791739 5.850349 5.923609 5.921169 5.977339 5.740459 5.388809 5.000539 4.849129 4.944369 5.173919 5.369279 5.447419 5.603709 5.730689 5.850349 5.979779 5.991989 6.084789 5.940709 5.803949 5.791739 5.603709 5.264269 4.946809 4.619579 4.514579 4.433989 4.285029 4.121419 3.945589 3.984659 4.219099 4.546319 4.873549 5.154379 5.388809 5.613479 5.835699 5.884539 5.955359 5.762439 5.459629 5.061589 4.707499 4.458409 4.267939 4.053039 3.943149 3.825929 3.967569 4.280149 4.480389 4.492599 4.390039 4.197119 4.111649 3.982219 3.867449 3.767319 3.872329 4.236189 4.663539 4.971229 5.066469 4.902859 4.675749 4.392479 4.099439 4.114089 4.326539 4.643999 4.971229 5.159269 5.388809 5.576849 5.652549 5.803949 5.913839 5.886979 5.799069 5.730689 5.762439 5.813719 5.821049 5.928499 6.013969 5.764879 5.413229 5.098219 4.678189 4.372939 4.392479 4.590279 4.919949 5.017629 4.858899 4.675749 4.619579 4.834479 5.090889 5.376599 5.681849 5.823489 5.952919 6.062809 6.089669 6.075019 6.026179 5.994429 6.077459 5.857679 5.701389 5.730689 5.784419 5.823489 5.894309 5.762439 5.415679 4.961459 4.595159 4.331429 4.297239 4.582949 4.861339 5.173919 5.166589 4.919949 4.607369 4.370499 4.182469 4.038389 4.145839 4.431549 4.556089 4.480389 4.375379 4.370499 4.558529 4.858899 4.895529 4.741679 4.744129 4.875989 5.105539 5.239849 5.518239 5.652549 5.723369 5.855239 5.962679 5.984659 5.984659 6.055479 6.062809 6.055479 6.070129 5.784419 5.440099 5.056699 4.941929 5.010299 5.134849 5.313109 5.479169 5.623249 5.562199 5.330209 5.010299 4.665979 4.414459 4.201999 4.048159 4.079899 4.189789 4.131179 4.004199 3.916289 3.960239 4.199559 4.624469 4.883319 5.137289 5.379049 5.623249 5.762439 5.833259 5.686739 5.366839 5.225199 5.239849 5.354629 5.508469 5.596379 5.752669 5.874769 5.906519 5.894309 5.742899 5.447419 5.024959 4.883319 4.885759 4.893089 4.714819 4.451089 4.233749 4.043269 3.864999 3.757559 3.669639 3.593939 3.547539 3.506029 3.454749 3.398579 3.361949 3.339969 3.374159 3.520679 3.713599 3.757559 3.779529 3.696509 3.777089 3.886979 3.904079 3.850349 3.965129 4.282589 4.521899 4.714819 4.971229 5.220319 5.532889 5.652549 5.781979 5.955359 6.035939 6.118969 6.133629 6.153159 6.192229 6.143389 6.167809 5.991989 5.652549 5.459629 5.437649 5.339969 5.098219 4.785639 4.492599 4.236189 4.067689 3.933379 3.823489 3.730689 3.611039 3.564639 3.549989 3.557309 3.513359 3.515799 3.694059 4.072579 4.480389 4.705049 4.612259 4.385149 4.201999 4.026179 3.904079 3.774649 3.691619 3.845469 4.201999 4.585399 4.902859 5.256949 5.510909 5.640339 5.843029 5.974889 5.935819 5.821049 5.528009 5.171479 4.810059 4.453529 4.380269 4.565859 4.805179 5.125079 5.354629 5.589059 5.764879 5.923609 5.940709 5.857679 5.694059 5.486489 5.149499 4.844249 4.541439 4.267939 4.060369 3.960239 3.789299 3.642779 3.525569 3.498699 3.454749 3.408349 3.379049 3.376599 3.361949 3.359509 3.369279 3.398579 3.579289 3.948029 4.412009 4.585399 4.514579 4.343639 4.155599 3.984659 4.043269 4.307009 4.421779 4.353409 4.223979 4.053039 3.940709 3.838139 3.730689 3.652549 3.611039 3.564639 3.496259 3.462069 3.454749 3.425439 3.379049 3.432769 3.623249 3.974889 4.380269 4.714819 5.073799 5.369279 5.603709 5.745349 5.652549 5.401019 5.015189 4.709939 4.416899 4.236189 4.236189 4.248399 4.221539 4.297239 4.590279 4.893089 5.134849 5.427889 5.379049 5.364389 5.452309 5.567079 5.672089 5.769769 5.830819 5.923609 5.965129 6.057919 6.050599 6.072579 6.111649 6.070129 5.896749 5.755109 5.718479 5.821049 6.001759 6.001759 5.901629 5.557309 5.173919 4.800289 4.431549 4.194679 4.006639 3.850349 3.747789 3.642779 3.591499 3.569519 3.528009 3.537779 3.554869 3.493819 3.447419 3.440099 3.408349 3.410789 3.452309 3.681849 4.060369 4.441319 4.854019 5.154379 5.425439 5.596379 5.586619 5.354629 5.027399 4.863779 4.761219 4.570739 4.368059 4.397359 4.573189 4.841809 5.203219 5.452309 5.652549 5.855239 5.906519 5.952919 5.828369 5.791739 5.799069 5.813719 5.877209 5.955359 5.781979 5.518239 5.127519 4.763659 4.492599 4.233749 4.011519 3.855239 3.691619 3.635459 3.818609 4.155599 4.590279 4.988329 5.076239 4.907739 4.648889 4.377829 4.216649 4.287469 4.590279 4.846689 5.139729 5.388809 5.689179 5.884539 6.043269 6.170259 6.211769 6.250839 6.209329 6.013969 5.701389 5.469399 5.479169 5.557309 5.728249 5.882099 5.984659 5.901629 5.581729 5.371719 5.418119 5.510909 5.667199 5.791739 5.698949 5.484049 5.154379 4.980999 5.061589 5.195899 5.359509 5.615919 5.762439 5.857679 5.948029 5.835699 5.706269 5.498699 5.188569 5.117749 5.191009 5.315549 5.532889 5.444979 5.396139 5.274039 5.027399 4.744129 4.668419 4.651329 4.514579 4.267939 4.260609 4.263049 4.189789 4.277699 4.600049 4.932159 5.283809 5.528009 5.740459 5.874769 5.955359 5.991989 5.845469 5.528009 5.061589 4.734359 4.534109 4.534109 4.697729 4.744129 4.619579 4.643999 4.832039 5.132399 5.410789 5.625689 5.603709 5.315549 4.961459 4.619579 4.358289 4.155599 4.033499 3.886979 3.772209 3.640339 3.532889 3.435209 3.427889 3.422999 3.398579 3.603709 4.023729 4.451089 4.792969 4.902859 4.780759 4.590279 4.336309 4.145839 4.216649 4.433989 4.714819 5.098219 5.359509 5.569519 5.772209 5.921169 6.055479 5.962679 5.642779 5.435209 5.388809 5.537779 5.681849 5.701389 5.615919 5.667199 5.740459 5.803949 5.882099 5.950469 6.072579 6.148279 6.116529 6.177579 6.201999 6.206889 5.991989 5.564639 5.178799 4.998089 5.051819 5.232529 5.484049 5.686739 5.899189 5.869889 5.977339 6.053039 6.079899 6.128739 6.079899 6.167809 6.194679 6.236189 6.053039 5.652549 5.274039 4.858899 4.534109 4.455969 4.619579 4.866229 5.117749 5.166589 5.056699 5.002979 5.098219 5.325319 5.567079 5.466959 5.252059 4.946809 4.880879 4.980999 5.225199 5.459629 5.723369 5.791739 5.906519 5.991989 5.835699 5.528009 5.142169 4.775869 4.490159 4.236189 4.023729 3.886979 3.752669 3.681849 3.806399 4.145839 4.600049 5.002979 5.303339 5.552429 5.615919 5.523119 5.611039 5.713599 5.845469 5.899189 5.994429 6.092109 6.092109 6.143389 6.153159 6.233749 6.187349 6.013969 5.835699 5.774649 5.686739 5.537779 5.327759 5.054259 4.700169 4.394919 4.180019 4.043269 3.877209 3.752669 3.728249 3.869889 4.206889 4.355849 4.426669 4.453529 4.521899 4.392479 4.155599 3.965129 3.877209 3.970009 4.258169 4.421779 4.336309 4.299679 4.392479 4.675749 4.761219 4.658659 4.490159 4.307009 4.126299 3.972449 4.077459 4.372939 4.741679 5.088449 5.186129 5.037169 4.785639 4.563419 4.534109 4.705049 4.741679 4.648889 4.431549 4.238629 4.065249 3.943149 3.811279 3.691619 3.652549 3.825929 4.223979 4.424219 4.429109 4.319219 4.138509 3.965129 3.886979 3.801509 3.701389 3.640339 3.767319 4.150719 4.648889 4.990769 5.088449 5.022509 4.783199 4.685519 4.665979 4.707499 4.912619 5.195899 5.415679 5.623249 5.740459 5.899189 5.928499 6.050599 6.153159 5.965129 5.586619 5.381489 5.371719 5.486489 5.567079 5.821049 5.913839 5.994429 6.011519 5.999309 6.018849 5.821049 5.728249 5.740459 5.764879 5.882099 5.926049 5.750229 5.415679 4.995649 4.861339 4.902859 5.103099 5.364389 5.596379 5.752669 5.845469 5.928499 6.006639 5.840579 5.518239 5.173919 4.739239 4.458409 4.426669 4.602489 4.822269 5.183689 5.430329 5.652549 5.821049 5.706269 5.369279 5.027399 4.705049 4.414459 4.145839 3.965129 4.033499 4.372939 4.683079Program Results
IB01BD EXAMPLE PROGRAM RESULTS The system state matrix A is 0.8924 0.3887 0.1285 0.1716 -0.0837 0.6186 -0.6273 -0.4582 0.0052 0.1307 0.6685 -0.6755 0.0055 0.0734 -0.2148 0.4788 The system output matrix C is -0.4442 0.6663 0.3961 0.4102 The system input matrix B is -0.2142 -0.1968 0.0525 0.0361 The system input-output matrix D is -0.0041 The Kalman gain matrix K is -1.9513 -0.1867 0.6348 -0.3486 The state covariance matrix Q is 0.0052 0.0005 -0.0017 0.0009 0.0005 0.0000 -0.0002 0.0001 -0.0017 -0.0002 0.0006 -0.0003 0.0009 0.0001 -0.0003 0.0002 The output covariance matrix Ry is 0.0012 The state-output cross-covariance matrix S is -0.0025 -0.0002 0.0008 -0.0005
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/IB01CD.html 0000664 0000000 0000000 00000153044 14560147231 0020323 0 ustar 00root root 0000000 0000000
Purpose
To estimate the initial state and, optionally, the system matrices B and D of a linear time-invariant (LTI) discrete-time system, given the system matrices (A,B,C,D), or (when B and D are estimated) only the matrix pair (A,C), and the input and output trajectories of the system. The model structure is : x(k+1) = Ax(k) + Bu(k), k >= 0, y(k) = Cx(k) + Du(k), where x(k) is the n-dimensional state vector (at time k), u(k) is the m-dimensional input vector, y(k) is the l-dimensional output vector, and A, B, C, and D are real matrices of appropriate dimensions. The input-output data can internally be processed sequentially.Specification
SUBROUTINE IB01CD( JOBX0, COMUSE, JOB, N, M, L, NSMP, A, LDA, B, $ LDB, C, LDC, D, LDD, U, LDU, Y, LDY, X0, V, $ LDV, TOL, IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION TOL INTEGER INFO, IWARN, L, LDA, LDB, LDC, LDD, LDU, LDV, $ LDWORK, LDY, M, N, NSMP CHARACTER COMUSE, JOB, JOBX0 C .. Array Arguments .. DOUBLE PRECISION A(LDA, *), B(LDB, *), C(LDC, *), D(LDD, *), $ DWORK(*), U(LDU, *), V(LDV, *), X0(*), $ Y(LDY, *) INTEGER IWORK(*)Arguments
Mode Parameters
JOBX0 CHARACTER*1 Specifies whether or not the initial state should be computed, as follows: = 'X': compute the initial state x(0); = 'N': do not compute the initial state (possibly, because x(0) is known to be zero). COMUSE CHARACTER*1 Specifies whether the system matrices B and D should be computed or used, as follows: = 'C': compute the system matrices B and D, as specified by JOB; = 'U': use the system matrices B and D, as specified by JOB; = 'N': do not compute/use the matrices B and D. If JOBX0 = 'N' and COMUSE <> 'N', then x(0) is set to zero. If JOBX0 = 'N' and COMUSE = 'N', then x(0) is neither computed nor set to zero. JOB CHARACTER*1 If COMUSE = 'C' or 'U', specifies which of the system matrices B and D should be computed or used, as follows: = 'B': compute/use the matrix B only (D is known to be zero); = 'D': compute/use the matrices B and D. The value of JOB is irrelevant if COMUSE = 'N' or if JOBX0 = 'N' and COMUSE = 'U'. The combinations of options, the data used, and the returned results, are given in the table below, where '*' denotes an irrelevant value. JOBX0 COMUSE JOB Data used Returned results ---------------------------------------------------------- X C B A,C,u,y x,B X C D A,C,u,y x,B,D N C B A,C,u,y x=0,B N C D A,C,u,y x=0,B,D ---------------------------------------------------------- X U B A,B,C,u,y x X U D A,B,C,D,u,y x N U * - x=0 ---------------------------------------------------------- X N * A,C,y x N N * - - ---------------------------------------------------------- For JOBX0 = 'N' and COMUSE = 'N', the routine just sets DWORK(1) to 2 and DWORK(2) to 1, and returns (see the parameter DWORK).Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L > 0. NSMP (input) INTEGER The number of rows of matrices U and Y (number of samples, t). NSMP >= 0, if JOBX0 = 'N' and COMUSE <> 'C'; NSMP >= N, if JOBX0 = 'X' and COMUSE <> 'C'; NSMP >= N*M + a + e, if COMUSE = 'C', where a = 0, if JOBX0 = 'N'; a = N, if JOBX0 = 'X'; e = 0, if JOBX0 = 'X' and JOB = 'B'; e = 1, if JOBX0 = 'N' and JOB = 'B'; e = M, if JOB = 'D'. A (input) DOUBLE PRECISION array, dimension (LDA,N) If JOBX0 = 'X' or COMUSE = 'C', the leading N-by-N part of this array must contain the system state matrix A. If N = 0, or JOBX0 = 'N' and COMUSE <> 'C', this array is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N), if JOBX0 = 'X' or COMUSE = 'C'; LDA >= 1, if JOBX0 = 'N' and COMUSE <> 'C'. B (input or output) DOUBLE PRECISION array, dimension (LDB,M) If JOBX0 = 'X' and COMUSE = 'U', B is an input parameter and, on entry, the leading N-by-M part of this array must contain the system input matrix B. If COMUSE = 'C', B is an output parameter and, on exit, if INFO = 0, the leading N-by-M part of this array contains the estimated system input matrix B. If min(N,M) = 0, or JOBX0 = 'N' and COMUSE = 'U', or COMUSE = 'N', this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N), if M > 0, COMUSE = 'U', JOBX0 = 'X', or M > 0, COMUSE = 'C'; LDB >= 1, if min(N,M) = 0, or COMUSE = 'N', or JOBX0 = 'N' and COMUSE = 'U'. C (input) DOUBLE PRECISION array, dimension (LDC,N) If JOBX0 = 'X' or COMUSE = 'C', the leading L-by-N part of this array must contain the system output matrix C. If N = 0, or JOBX0 = 'N' and COMUSE <> 'C', this array is not referenced. LDC INTEGER The leading dimension of the array C. LDC >= L, if N > 0, and JOBX0 = 'X' or COMUSE = 'C'; LDC >= 1, if N = 0, or JOBX0 = 'N' and COMUSE <> 'C'. D (input or output) DOUBLE PRECISION array, dimension (LDD,M) If JOBX0 = 'X', COMUSE = 'U', and JOB = 'D', D is an input parameter and, on entry, the leading L-by-M part of this array must contain the system input-output matrix D. If COMUSE = 'C' and JOB = 'D', D is an output parameter and, on exit, if INFO = 0, the leading L-by-M part of this array contains the estimated system input-output matrix D. If M = 0, or JOBX0 = 'N' and COMUSE = 'U', or COMUSE = 'N', or JOB = 'B', this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= L, if M > 0, JOBX0 = 'X', COMUSE = 'U', and JOB = 'D', or if M > 0, COMUSE = 'C', and JOB = 'D'; LDD >= 1, if M = 0, or JOBX0 = 'N' and COMUSE = 'U', or COMUSE = 'N', or JOB = 'B'. U (input or input/output) DOUBLE PRECISION array, dimension (LDU,M) On entry, if COMUSE = 'C', or JOBX0 = 'X' and COMUSE = 'U', the leading NSMP-by-M part of this array must contain the t-by-m input-data sequence matrix U, U = [u_1 u_2 ... u_m]. Column j of U contains the NSMP values of the j-th input component for consecutive time increments. On exit, if COMUSE = 'C' and JOB = 'D', the leading NSMP-by-M part of this array contains details of the QR factorization of the t-by-m matrix U, possibly computed sequentially (see METHOD). If COMUSE = 'C' and JOB = 'B', or COMUSE = 'U', this array is unchanged on exit. If M = 0, or JOBX0 = 'N' and COMUSE = 'U', or COMUSE = 'N', this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= MAX(1,NSMP), if M > 0 and COMUSE = 'C' or JOBX0 = 'X' and COMUSE = 'U; LDU >= 1, if M = 0, or COMUSE = 'N', or JOBX0 = 'N' and COMUSE = 'U'. Y (input) DOUBLE PRECISION array, dimension (LDY,L) On entry, if JOBX0 = 'X' or COMUSE = 'C', the leading NSMP-by-L part of this array must contain the t-by-l output-data sequence matrix Y, Y = [y_1 y_2 ... y_l]. Column j of Y contains the NSMP values of the j-th output component for consecutive time increments. If JOBX0 = 'N' and COMUSE <> 'C', this array is not referenced. LDY INTEGER The leading dimension of the array Y. LDY >= MAX(1,NSMP), if JOBX0 = 'X' or COMUSE = 'C; LDY >= 1, if JOBX0 = 'N' and COMUSE <> 'C'. X0 (output) DOUBLE PRECISION array, dimension (N) If INFO = 0 and JOBX0 = 'X', this array contains the estimated initial state of the system, x(0). If JOBX0 = 'N' and COMUSE = 'C', this array is used as workspace and finally it is set to zero. If JOBX0 = 'N' and COMUSE = 'U', then x(0) is set to zero without any calculations. If JOBX0 = 'N' and COMUSE = 'N', this array is not referenced. V (output) DOUBLE PRECISION array, dimension (LDV,N) On exit, if INFO = 0 or 2, JOBX0 = 'X' or COMUSE = 'C', the leading N-by-N part of this array contains the orthogonal matrix V of a real Schur factorization of the matrix A. If JOBX0 = 'N' and COMUSE <> 'C', this array is not referenced. LDV INTEGER The leading dimension of the array V. LDV >= MAX(1,N), if JOBX0 = 'X' or COMUSE = 'C; LDV >= 1, if JOBX0 = 'N' and COMUSE <> 'C'.Tolerances
TOL DOUBLE PRECISION The tolerance to be used for estimating the rank of matrices. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then EPS is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH). TOL <= 1.Workspace
IWORK INTEGER array, dimension (LIWORK), where LIWORK >= 0, if JOBX0 = 'N' and COMUSE <> 'C'; LIWORK >= N, if JOBX0 = 'X' and COMUSE <> 'C'; LIWORK >= N*M + a, if COMUSE = 'C' and JOB = 'B', LIWORK >= max(N*M + a,M), if COMUSE = 'C' and JOB = 'D', with a = 0, if JOBX0 = 'N'; a = N, if JOBX0 = 'X'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK; DWORK(2) contains the reciprocal condition number of the triangular factor of the QR factorization of the matrix W2, if COMUSE = 'C', or of the matrix Gamma, if COMUSE = 'U' (see METHOD); if JOBX0 = 'N' and COMUSE <> 'C', DWORK(2) is set to one; if COMUSE = 'C', M > 0, and JOB = 'D', DWORK(3) contains the reciprocal condition number of the triangular factor of the QR factorization of U; denoting g = 2, if JOBX0 = 'X' and COMUSE <> 'C' or COMUSE = 'C' and M = 0 or JOB = 'B', g = 3, if COMUSE = 'C' and M > 0 and JOB = 'D', then DWORK(i), i = g+1:g+N*N, DWORK(j), j = g+1+N*N:g+N*N+L*N, and DWORK(k), k = g+1+N*N+L*N:g+N*N+L*N+N*M, contain the transformed system matrices At, Ct, and Bt, respectively, corresponding to the real Schur form of the given system state matrix A, i.e., At = V'*A*V, Bt = V'*B, Ct = C*V. The matrices At, Ct, Bt are not computed if JOBX0 = 'N' and COMUSE <> 'C'. On exit, if INFO = -26, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 2, if JOBX0 = 'N' and COMUSE <> 'C', or if max( N, M ) = 0. Otherwise, LDWORK >= LDW1 + N*( N + M + L ) + max( 5*N, LDW1, min( LDW2, LDW3 ) ), where, if COMUSE = 'C', then LDW1 = 2, if M = 0 or JOB = 'B', LDW1 = 3, if M > 0 and JOB = 'D', LDWa = t*L*(r + 1) + max( N + max( d, f ), 6*r ), LDW2 = LDWa, if M = 0 or JOB = 'B', LDW2 = max( LDWa, t*L*(r + 1) + 2*M*M + 6*M ), if M > 0 and JOB = 'D', LDWb = (b + r)*(r + 1) + max( q*(r + 1) + N*N*M + c + max( d, f ), 6*r ), LDW3 = LDWb, if M = 0 or JOB = 'B', LDW3 = max( LDWb, (b + r)*(r + 1) + 2*M*M + 6*M ), if M > 0 and JOB = 'D', r = N*M + a, a = 0, if JOBX0 = 'N', a = N, if JOBX0 = 'X'; b = 0, if JOB = 'B', b = L*M, if JOB = 'D'; c = 0, if JOBX0 = 'N', c = L*N, if JOBX0 = 'X'; d = 0, if JOBX0 = 'N', d = 2*N*N + N, if JOBX0 = 'X'; f = 2*r, if JOB = 'B' or M = 0, f = M + max( 2*r, M ), if JOB = 'D' and M > 0; q = b + r*L; and, if JOBX0 = 'X' and COMUSE <> 'C', then LDW1 = 2, LDW2 = t*L*(N + 1) + 2*N + max( 2*N*N, 4*N ), LDW3 = N*(N + 1) + 2*N + max( q*(N + 1) + 2*N*N + L*N, 4*N ), q = N*L. For good performance, LDWORK should be larger. If LDWORK >= LDW2, or if COMUSE = 'C' and LDWORK >= t*L*(r + 1) + (b + r)*(r + 1) + N*N*M + c + max( d, f ), then standard QR factorizations of the matrices U and/or W2, if COMUSE = 'C', or of the matrix Gamma, if JOBX0 = 'X' and COMUSE <> 'C' (see METHOD), are used. Otherwise, the QR factorizations are computed sequentially by performing NCYCLE cycles, each cycle (except possibly the last one) processing s < t samples, where s is chosen by equating LDWORK to the first term of LDWb, if COMUSE = 'C', or of LDW3, if COMUSE <> 'C', for q replaced by s*L. (s is larger than or equal to the minimum value of NSMP.) The computational effort may increase and the accuracy may slightly decrease with the decrease of s. Recommended value is LDWORK = LDW2, assuming a large enough cache size, to also accommodate A, (B,) C, (D,) U, and Y.Warning Indicator
IWARN INTEGER = 0: no warning; = 4: the least squares problem to be solved has a rank-deficient coefficient matrix; = 6: the matrix A is unstable; the estimated x(0) and/or B and D could be inaccurate. NOTE: the value 4 of IWARN has no significance for the identification problem.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the QR algorithm failed to compute all the eigenvalues of the matrix A (see LAPACK Library routine DGEES); the locations DWORK(i), for i = g+1:g+N*N, contain the partially converged Schur form; = 2: the singular value decomposition (SVD) algorithm did not converge.Method
Matrix A is initially reduced to a real Schur form, A = V*At*V', and the given system matrices are transformed accordingly. For the reduced system, an extension and refinement of the method in [1,2] is used. Specifically, for JOBX0 = 'X', COMUSE = 'C', and JOB = 'D', denoting X = [ vec(D')' vec(B)' x0' ]', where vec(M) is the vector obtained by stacking the columns of the matrix M, then X is the least squares solution of the system S*X = vec(Y), with the matrix S = [ diag(U) W ], defined by ( U | | ... | | | ... | | ) ( U | 11 | ... | n1 | 12 | ... | nm | ) S = ( : | y | ... | y | y | ... | y | P*Gamma ), ( : | | ... | | | ... | | ) ( U | | ... | | | ... | | ) ij diag(U) having L block rows and columns. In this formula, y are the outputs of the system for zero initial state computed using the following model, for j = 1:m, and for i = 1:n, ij ij ij x (k+1) = Ax (k) + e_i u_j(k), x (0) = 0, ij ij y (k) = Cx (k), where e_i is the i-th n-dimensional unit vector, Gamma is given by ( C ) ( C*A ) Gamma = ( C*A^2 ), ( : ) ( C*A^(t-1) ) and P is a permutation matrix that groups together the rows of Gamma depending on the same row of C, namely [ c_j; c_j*A; c_j*A^2; ... c_j*A^(t-1) ], for j = 1:L. The first block column, diag(U), is not explicitly constructed, but its structure is exploited. The last block column is evaluated using powers of A with exponents 2^k. No interchanges are applied. A special QR decomposition of the matrix S is computed. Let U = q*[ r' 0 ]' be the QR decomposition of U, if M > 0, where r is M-by-M. Then, diag(q') is applied to W and vec(Y). The block-rows of S and vec(Y) are implicitly permuted so that matrix S becomes ( diag(r) W1 ) ( 0 W2 ), where W1 has L*M rows. Then, the QR decomposition of W2 is computed (sequentially, if M > 0) and used to obtain B and x0. The intermediate results and the QR decomposition of U are needed to find D. If a triangular factor is too ill conditioned, then singular value decomposition (SVD) is employed. SVD is not generally needed if the input sequence is sufficiently persistently exciting and NSMP is large enough. If the matrix W cannot be stored in the workspace (i.e., LDWORK < LDW2), the QR decompositions of W2 and U are computed sequentially. For JOBX0 = 'N' and COMUSE = 'C', or JOB = 'B', a simpler problem is solved efficiently. For JOBX0 = 'X' and COMUSE <> 'C', a simpler method is used. Specifically, the output y0(k) of the system for zero initial state is computed for k = 0, 1, ..., t-1 using the given model. Then the following least squares problem is solved for x(0) ( y(0) - y0(0) ) ( y(1) - y0(1) ) Gamma * x(0) = ( : ). ( : ) ( y(t-1) - y0(t-1) ) The coefficient matrix Gamma is evaluated using powers of A with exponents 2^k. The QR decomposition of this matrix is computed. If its triangular factor R is too ill conditioned, then singular value decomposition of R is used. If the coefficient matrix cannot be stored in the workspace (i.e., LDWORK < LDW2), the QR decomposition is computed sequentially.References
[1] Verhaegen M., and Varga, A. Some Experience with the MOESP Class of Subspace Model Identification Methods in Identifying the BO105 Helicopter. Report TR R165-94, DLR Oberpfaffenhofen, 1994. [2] Sima, V., and Varga, A. RASP-IDENT : Subspace Model Identification Programs. Deutsche Forschungsanstalt fur Luft- und Raumfahrt e. V., Report TR R888-94, DLR Oberpfaffenhofen, Oct. 1994.Numerical Aspects
The implemented method is numerically stable.Further Comments
The algorithm for computing the system matrices B and D is less efficient than the MOESP or N4SID algorithms implemented in SLICOT Library routines IB01BD/IB01PD, because a large least squares problem has to be solved, but the accuracy is better, as the computed matrices B and D are fitted to the input and output trajectories. However, if matrix A is unstable, the computed matrices B and D could be inaccurate.Example
Program Text
* IB01CD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LDA, LDB, LDC, LDD, LDR, LDU, LDV, LDW1, LDW2, $ LDW4, LDW5, LDWORK, LDY, LIWORK, LMAX, MMAX, $ NMAX, NOBRMX, NSMPMX PARAMETER ( LMAX = 5, MMAX = 5, NOBRMX = 20, NSMPMX = 2000, $ NMAX = NOBRMX - 1, LDA = NMAX, LDB = NMAX, $ LDC = LMAX, LDD = LMAX, LDV = NMAX, $ LDR = MAX( 2*( MMAX + LMAX )*NOBRMX, $ 3*MMAX*NOBRMX ), LDU = NSMPMX, $ LDW1 = MAX( LMAX*( NOBRMX - 1 )*NMAX + NMAX + $ MAX( 6*MMAX, 4*LMAX )*NOBRMX, $ LMAX*NOBRMX*NMAX + $ MAX( LMAX*( NOBRMX - 1 )*NMAX + $ 3*NMAX + LMAX + $ ( 2*MMAX + LMAX )*NOBRMX, $ 2*LMAX*( NOBRMX - 1 )*NMAX + $ NMAX*NMAX + 8*NMAX, $ NMAX + $ 4*( MMAX*NOBRMX + NMAX ) ) ), $ LDW2 = LMAX*NOBRMX*NMAX + $ MMAX*NOBRMX*( NMAX + LMAX )* $ ( MMAX*( NMAX + LMAX ) + 1 ) + $ MAX( ( NMAX + LMAX )**2, $ 4*MMAX*( NMAX + LMAX ) + 1 ), $ LDW4 = NSMPMX*LMAX*NMAX*( MMAX + 1 ) + $ MAX( NMAX + $ MAX( 2*NMAX*NMAX + NMAX, $ MMAX + $ MAX( 2*NMAX*( MMAX + 1 ), $ MMAX ), $ 6*NMAX*( MMAX + 1 ) ), $ 2*MMAX*MMAX*NMAX + 6*MMAX ), $ LDW5 = ( LMAX*MMAX + NMAX*( MMAX + 1 ) )* $ NMAX*( MMAX + 1 ) + $ MAX( ( LMAX*MMAX + $ LMAX*NMAX*( MMAX + 1 ) )* $ NMAX*( MMAX + 1 ) + $ NMAX*NMAX*MMAX + LMAX*NMAX + $ MAX( 2*NMAX*NMAX + NMAX, $ MMAX + $ MAX( 2*NMAX*( MMAX + 1 ), $ MMAX ), $ 6*NMAX*( MMAX + 1 ) ), $ 2*MMAX*MMAX*NMAX + 6*MMAX ), $ LDWORK = MAX( 6*( MMAX + LMAX )*NOBRMX, $ ( MMAX + LMAX )*( 4*NOBRMX* $ ( MMAX + LMAX + 2 ) - 2 ), $ ( MMAX + LMAX )*4*NOBRMX* $ ( NOBRMX + 1 ), LDW1, LDW2, $ 3 + ( NMAX + MMAX + LMAX )*NMAX + $ MAX( 5*NMAX, 3, $ MIN( LDW4, LDW5 ) ) ), $ LDY = NSMPMX, $ LIWORK = MAX( ( MMAX + LMAX )*NOBRMX, $ MMAX*NOBRMX + NMAX, $ MMAX*( NMAX + LMAX ), $ NMAX*MMAX + NMAX, MMAX ) $ ) * .. Local Scalars .. LOGICAL NGIVEN CHARACTER ALG, BATCH, COMUSE, CONCT, CTRL, JOB, JOBBD, $ JOBCK, JOBD, JOBDA, JOBX0, METH, METHA INTEGER I, ICYCLE, II, INFO, IWARN, J, L, M, N, NCYCLE, $ NGIV, NOBR, NSAMPL, NSMP DOUBLE PRECISION RCOND, TOL * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), B(LDB, MMAX), C(LDC, NMAX), $ D(LDD, MMAX), DUM(1), DWORK(LDWORK), $ R(LDR, 2*(MMAX+LMAX)*NOBRMX), $ SV(LMAX*NOBRMX), U(LDU, MMAX), V(LDV, NMAX), $ X0(NMAX), Y(LDY, LMAX) INTEGER IWORK(LIWORK) LOGICAL BWORK(1) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL IB01AD, IB01BD, IB01CD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. * If the value of N is positive, it will be taken as system order. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) NOBR, N, M, L, NSMP, RCOND, TOL READ ( NIN, FMT = * ) METH, ALG, JOBD, BATCH, CONCT, CTRL, JOB, $ COMUSE, JOBX0 IF ( LSAME( BATCH, 'F' ) ) THEN READ ( NIN, FMT = * ) NCYCLE ELSE NCYCLE = 1 END IF NSAMPL = NCYCLE*NSMP * NGIVEN = N.GT.0 IF( NGIVEN ) $ NGIV = N IF ( NOBR.LE.0 .OR. NOBR.GT.NOBRMX ) THEN WRITE ( NOUT, FMT = 99997 ) NOBR ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99996 ) M ELSE IF ( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99995 ) L ELSE IF ( NSMP.LT.0 .OR. NSMP.GT.NSMPMX .OR. $ ( NSMP.LT.2*( M + L + 1 )*NOBR - 1 .AND. $ LSAME( BATCH, 'O' ) ) .OR. $ ( NSAMPL.LT.2*( M + L + 1 )*NOBR - 1 .AND. $ LSAME( BATCH, 'L' ) ) .OR. $ NSMP.LT.2*NOBR .AND. ( LSAME( BATCH, 'F' ) .OR. $ LSAME( BATCH, 'I' ) ) ) THEN WRITE ( NOUT, FMT = 99994 ) NSMP ELSE IF ( NCYCLE.LE.0 .OR. NSAMPL.GT.NSMPMX ) THEN WRITE ( NOUT, FMT = 99993 ) NCYCLE ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99983 ) N ELSE * Read the matrices U and Y from the input file. IF ( M.GT.0 ) $ READ ( NIN, FMT = * ) $ ( ( U(I,J), J = 1, M ), I = 1, NSAMPL ) READ ( NIN, FMT = * ) ( ( Y(I,J), J = 1, L ), I = 1, NSAMPL ) * Force some options, depending on the specifications. IF ( LSAME( METH, 'C' ) ) THEN METHA = 'M' JOBDA = 'N' ELSE METHA = METH JOBDA = JOBD END IF * The covariances and Kalman gain matrix are not computed. JOBCK = 'N' IF ( LSAME( JOB, 'A' ) .OR. LSAME( JOB, 'C' ) ) THEN JOBBD = 'D' ELSE JOBBD = JOB END IF IF ( LSAME( COMUSE, 'C' ) ) THEN JOB = 'C' ELSE IF ( LSAME( COMUSE, 'U' ) ) THEN JOB = 'A' END IF * Compute the R factor from a QR (or Cholesky) factorization * of the Hankel-like matrix (or correlation matrix). DO 10 ICYCLE = 1, NCYCLE II = ( ICYCLE - 1 )*NSMP + 1 IF ( NCYCLE.GT.1 ) THEN IF ( ICYCLE.GT.1 ) BATCH = 'I' IF ( ICYCLE.EQ.NCYCLE ) BATCH = 'L' END IF CALL IB01AD( METHA, ALG, JOBDA, BATCH, CONCT, CTRL, NOBR, M, $ L, NSMP, U(II,1), LDU, Y(II,1), LDY, N, R, LDR, $ SV, RCOND, TOL, IWORK, DWORK, LDWORK, IWARN, $ INFO ) 10 CONTINUE IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) $ WRITE ( NOUT, FMT = 99990 ) IWARN IF( NGIVEN ) $ N = NGIV * Compute the system matrices and x0. CALL IB01BD( METH, JOB, JOBCK, NOBR, N, M, L, NSMP, R, $ LDR, A, LDA, C, LDC, B, LDB, D, LDD, DUM, 1, $ DUM, 1, DUM, 1, DUM, 1, RCOND, IWORK, DWORK, $ LDWORK, BWORK, IWARN, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99982 ) INFO ELSE IF ( IWARN.NE.0 ) $ WRITE ( NOUT, FMT = 99981 ) IWARN CALL IB01CD( JOBX0, COMUSE, JOBBD, N, M, L, NSMP, A, LDA, $ B, LDB, C, LDC, D, LDD, U, LDU, Y, LDY, X0, $ V, LDV, RCOND, IWORK, DWORK, LDWORK, IWARN, $ INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99992 ) INFO ELSE IF ( IWARN.NE.0 ) $ WRITE ( NOUT, FMT = 99991 ) IWARN IF ( LSAME( JOB, 'A' ) .OR. LSAME( JOB, 'C' ) ) THEN WRITE ( NOUT, FMT = 99989 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99988 ) ( A(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99987 ) DO 30 I = 1, L WRITE ( NOUT, FMT = 99988 ) ( C(I,J), J = 1,N ) 30 CONTINUE END IF IF ( LSAME( COMUSE, 'C' ) ) THEN WRITE ( NOUT, FMT = 99986 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99988 ) ( B(I,J), J = 1,M ) 40 CONTINUE IF ( LSAME( JOBBD, 'D' ) ) THEN WRITE ( NOUT, FMT = 99985 ) DO 50 I = 1, L WRITE ( NOUT, FMT = 99988 ) $ ( D(I,J), J = 1,M ) 50 CONTINUE END IF END IF IF ( LSAME( JOBX0, 'X' ) ) THEN WRITE ( NOUT, FMT = 99984 ) WRITE ( NOUT, FMT = 99988 ) ( X0(I), I = 1,N ) END IF END IF END IF END IF END IF STOP 99999 FORMAT ( ' IB01CD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT ( ' INFO on exit from IB01AD = ',I2) 99997 FORMAT (/' NOBR is out of range.',/' NOBR = ', I5) 99996 FORMAT (/' M is out of range.',/' M = ', I5) 99995 FORMAT (/' L is out of range.',/' L = ', I5) 99994 FORMAT (/' NSMP is out of range.',/' NSMP = ', I5) 99993 FORMAT (/' NCYCLE is out of range.',/' NCYCLE = ', I5) 99992 FORMAT ( ' INFO on exit from IB01CD = ',I2) 99991 FORMAT ( ' IWARN on exit from IB01CD = ',I2) 99990 FORMAT ( ' IWARN on exit from IB01AD = ',I2) 99989 FORMAT (/' The system state matrix A is ') 99988 FORMAT (20(1X,F8.4)) 99987 FORMAT (/' The system output matrix C is ') 99986 FORMAT (/' The system input matrix B is ') 99985 FORMAT (/' The system input-output matrix D is ') 99984 FORMAT (/' The initial state vector x0 is ') 99983 FORMAT (/' N is out of range.',/' N = ', I5) 99982 FORMAT ( ' INFO on exit from IB01BD = ',I2) 99981 FORMAT ( ' IWARN on exit from IB01BD = ',I2) ENDProgram Data
IB01CD EXAMPLE PROGRAM DATA 15 0 1 1 1000 0.0 -1.0 C C N O N N A C X 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 6.41 3.41 3.41 3.41 6.41 3.41 3.41 3.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 6.41 3.41 3.41 3.41 3.41 3.41 3.41 3.41 6.41 6.41 6.41 6.41 6.41 6.41 4.766099 4.763659 4.839359 5.002979 5.017629 5.056699 5.154379 5.361949 5.425439 5.569519 5.681849 5.742899 5.803949 5.918729 5.821049 5.447419 5.061589 4.629349 4.267939 4.011519 3.850349 3.711159 3.569519 3.518239 3.652549 3.818609 3.862559 4.011519 4.353409 4.705049 5.083559 5.344859 5.274039 5.127519 4.761219 4.451089 4.221539 4.045709 3.874769 3.730689 3.662319 3.576849 3.542659 3.479169 3.454749 3.359509 3.298459 3.225199 3.200779 3.225199 3.227639 3.274039 3.457189 3.867449 4.321659 4.492599 4.431549 4.243519 4.050599 3.857679 3.730689 3.791739 3.921169 3.955359 3.847909 3.725809 3.611039 3.716039 4.092109 4.480389 4.814939 5.054259 5.303339 5.486489 5.672089 5.779529 5.799069 5.664759 5.291129 4.880879 4.558529 4.184909 3.889419 3.708719 3.623249 3.569519 3.718479 4.033499 4.412009 4.629349 4.558529 4.394919 4.180019 4.197119 4.431549 4.714819 4.961459 5.300899 5.567079 5.681849 5.545099 5.188569 4.883319 4.600049 4.270379 4.038389 3.838139 3.711159 3.591499 3.535329 3.486489 3.476729 3.425439 3.381489 3.369279 3.364389 3.347299 3.381489 3.420559 3.413229 3.452309 3.635459 4.038389 4.375379 4.727029 5.056699 5.298459 5.532889 5.466959 5.195899 4.885759 4.763659 4.875989 5.042049 5.283809 5.491379 5.596379 5.672089 5.772209 5.830819 5.933379 5.899189 5.935819 5.894309 5.918729 5.994429 5.957799 6.031059 6.062809 6.040829 6.096999 6.123859 6.162929 6.040829 5.845469 5.772209 5.799069 5.923609 5.928499 6.001759 6.001759 6.060369 5.882099 5.510909 5.322879 5.371719 5.454749 5.437649 5.159269 4.902859 4.587839 4.502369 4.595159 4.824709 5.064029 5.271599 5.466959 5.615919 5.528009 5.254499 4.883319 4.517019 4.197119 4.001759 3.806399 3.904079 3.923609 3.869889 3.806399 3.720929 3.818609 4.140949 4.529229 4.805179 5.086009 5.339969 5.532889 5.576849 5.667199 5.791739 5.850349 5.923609 5.921169 5.977339 5.740459 5.388809 5.000539 4.849129 4.944369 5.173919 5.369279 5.447419 5.603709 5.730689 5.850349 5.979779 5.991989 6.084789 5.940709 5.803949 5.791739 5.603709 5.264269 4.946809 4.619579 4.514579 4.433989 4.285029 4.121419 3.945589 3.984659 4.219099 4.546319 4.873549 5.154379 5.388809 5.613479 5.835699 5.884539 5.955359 5.762439 5.459629 5.061589 4.707499 4.458409 4.267939 4.053039 3.943149 3.825929 3.967569 4.280149 4.480389 4.492599 4.390039 4.197119 4.111649 3.982219 3.867449 3.767319 3.872329 4.236189 4.663539 4.971229 5.066469 4.902859 4.675749 4.392479 4.099439 4.114089 4.326539 4.643999 4.971229 5.159269 5.388809 5.576849 5.652549 5.803949 5.913839 5.886979 5.799069 5.730689 5.762439 5.813719 5.821049 5.928499 6.013969 5.764879 5.413229 5.098219 4.678189 4.372939 4.392479 4.590279 4.919949 5.017629 4.858899 4.675749 4.619579 4.834479 5.090889 5.376599 5.681849 5.823489 5.952919 6.062809 6.089669 6.075019 6.026179 5.994429 6.077459 5.857679 5.701389 5.730689 5.784419 5.823489 5.894309 5.762439 5.415679 4.961459 4.595159 4.331429 4.297239 4.582949 4.861339 5.173919 5.166589 4.919949 4.607369 4.370499 4.182469 4.038389 4.145839 4.431549 4.556089 4.480389 4.375379 4.370499 4.558529 4.858899 4.895529 4.741679 4.744129 4.875989 5.105539 5.239849 5.518239 5.652549 5.723369 5.855239 5.962679 5.984659 5.984659 6.055479 6.062809 6.055479 6.070129 5.784419 5.440099 5.056699 4.941929 5.010299 5.134849 5.313109 5.479169 5.623249 5.562199 5.330209 5.010299 4.665979 4.414459 4.201999 4.048159 4.079899 4.189789 4.131179 4.004199 3.916289 3.960239 4.199559 4.624469 4.883319 5.137289 5.379049 5.623249 5.762439 5.833259 5.686739 5.366839 5.225199 5.239849 5.354629 5.508469 5.596379 5.752669 5.874769 5.906519 5.894309 5.742899 5.447419 5.024959 4.883319 4.885759 4.893089 4.714819 4.451089 4.233749 4.043269 3.864999 3.757559 3.669639 3.593939 3.547539 3.506029 3.454749 3.398579 3.361949 3.339969 3.374159 3.520679 3.713599 3.757559 3.779529 3.696509 3.777089 3.886979 3.904079 3.850349 3.965129 4.282589 4.521899 4.714819 4.971229 5.220319 5.532889 5.652549 5.781979 5.955359 6.035939 6.118969 6.133629 6.153159 6.192229 6.143389 6.167809 5.991989 5.652549 5.459629 5.437649 5.339969 5.098219 4.785639 4.492599 4.236189 4.067689 3.933379 3.823489 3.730689 3.611039 3.564639 3.549989 3.557309 3.513359 3.515799 3.694059 4.072579 4.480389 4.705049 4.612259 4.385149 4.201999 4.026179 3.904079 3.774649 3.691619 3.845469 4.201999 4.585399 4.902859 5.256949 5.510909 5.640339 5.843029 5.974889 5.935819 5.821049 5.528009 5.171479 4.810059 4.453529 4.380269 4.565859 4.805179 5.125079 5.354629 5.589059 5.764879 5.923609 5.940709 5.857679 5.694059 5.486489 5.149499 4.844249 4.541439 4.267939 4.060369 3.960239 3.789299 3.642779 3.525569 3.498699 3.454749 3.408349 3.379049 3.376599 3.361949 3.359509 3.369279 3.398579 3.579289 3.948029 4.412009 4.585399 4.514579 4.343639 4.155599 3.984659 4.043269 4.307009 4.421779 4.353409 4.223979 4.053039 3.940709 3.838139 3.730689 3.652549 3.611039 3.564639 3.496259 3.462069 3.454749 3.425439 3.379049 3.432769 3.623249 3.974889 4.380269 4.714819 5.073799 5.369279 5.603709 5.745349 5.652549 5.401019 5.015189 4.709939 4.416899 4.236189 4.236189 4.248399 4.221539 4.297239 4.590279 4.893089 5.134849 5.427889 5.379049 5.364389 5.452309 5.567079 5.672089 5.769769 5.830819 5.923609 5.965129 6.057919 6.050599 6.072579 6.111649 6.070129 5.896749 5.755109 5.718479 5.821049 6.001759 6.001759 5.901629 5.557309 5.173919 4.800289 4.431549 4.194679 4.006639 3.850349 3.747789 3.642779 3.591499 3.569519 3.528009 3.537779 3.554869 3.493819 3.447419 3.440099 3.408349 3.410789 3.452309 3.681849 4.060369 4.441319 4.854019 5.154379 5.425439 5.596379 5.586619 5.354629 5.027399 4.863779 4.761219 4.570739 4.368059 4.397359 4.573189 4.841809 5.203219 5.452309 5.652549 5.855239 5.906519 5.952919 5.828369 5.791739 5.799069 5.813719 5.877209 5.955359 5.781979 5.518239 5.127519 4.763659 4.492599 4.233749 4.011519 3.855239 3.691619 3.635459 3.818609 4.155599 4.590279 4.988329 5.076239 4.907739 4.648889 4.377829 4.216649 4.287469 4.590279 4.846689 5.139729 5.388809 5.689179 5.884539 6.043269 6.170259 6.211769 6.250839 6.209329 6.013969 5.701389 5.469399 5.479169 5.557309 5.728249 5.882099 5.984659 5.901629 5.581729 5.371719 5.418119 5.510909 5.667199 5.791739 5.698949 5.484049 5.154379 4.980999 5.061589 5.195899 5.359509 5.615919 5.762439 5.857679 5.948029 5.835699 5.706269 5.498699 5.188569 5.117749 5.191009 5.315549 5.532889 5.444979 5.396139 5.274039 5.027399 4.744129 4.668419 4.651329 4.514579 4.267939 4.260609 4.263049 4.189789 4.277699 4.600049 4.932159 5.283809 5.528009 5.740459 5.874769 5.955359 5.991989 5.845469 5.528009 5.061589 4.734359 4.534109 4.534109 4.697729 4.744129 4.619579 4.643999 4.832039 5.132399 5.410789 5.625689 5.603709 5.315549 4.961459 4.619579 4.358289 4.155599 4.033499 3.886979 3.772209 3.640339 3.532889 3.435209 3.427889 3.422999 3.398579 3.603709 4.023729 4.451089 4.792969 4.902859 4.780759 4.590279 4.336309 4.145839 4.216649 4.433989 4.714819 5.098219 5.359509 5.569519 5.772209 5.921169 6.055479 5.962679 5.642779 5.435209 5.388809 5.537779 5.681849 5.701389 5.615919 5.667199 5.740459 5.803949 5.882099 5.950469 6.072579 6.148279 6.116529 6.177579 6.201999 6.206889 5.991989 5.564639 5.178799 4.998089 5.051819 5.232529 5.484049 5.686739 5.899189 5.869889 5.977339 6.053039 6.079899 6.128739 6.079899 6.167809 6.194679 6.236189 6.053039 5.652549 5.274039 4.858899 4.534109 4.455969 4.619579 4.866229 5.117749 5.166589 5.056699 5.002979 5.098219 5.325319 5.567079 5.466959 5.252059 4.946809 4.880879 4.980999 5.225199 5.459629 5.723369 5.791739 5.906519 5.991989 5.835699 5.528009 5.142169 4.775869 4.490159 4.236189 4.023729 3.886979 3.752669 3.681849 3.806399 4.145839 4.600049 5.002979 5.303339 5.552429 5.615919 5.523119 5.611039 5.713599 5.845469 5.899189 5.994429 6.092109 6.092109 6.143389 6.153159 6.233749 6.187349 6.013969 5.835699 5.774649 5.686739 5.537779 5.327759 5.054259 4.700169 4.394919 4.180019 4.043269 3.877209 3.752669 3.728249 3.869889 4.206889 4.355849 4.426669 4.453529 4.521899 4.392479 4.155599 3.965129 3.877209 3.970009 4.258169 4.421779 4.336309 4.299679 4.392479 4.675749 4.761219 4.658659 4.490159 4.307009 4.126299 3.972449 4.077459 4.372939 4.741679 5.088449 5.186129 5.037169 4.785639 4.563419 4.534109 4.705049 4.741679 4.648889 4.431549 4.238629 4.065249 3.943149 3.811279 3.691619 3.652549 3.825929 4.223979 4.424219 4.429109 4.319219 4.138509 3.965129 3.886979 3.801509 3.701389 3.640339 3.767319 4.150719 4.648889 4.990769 5.088449 5.022509 4.783199 4.685519 4.665979 4.707499 4.912619 5.195899 5.415679 5.623249 5.740459 5.899189 5.928499 6.050599 6.153159 5.965129 5.586619 5.381489 5.371719 5.486489 5.567079 5.821049 5.913839 5.994429 6.011519 5.999309 6.018849 5.821049 5.728249 5.740459 5.764879 5.882099 5.926049 5.750229 5.415679 4.995649 4.861339 4.902859 5.103099 5.364389 5.596379 5.752669 5.845469 5.928499 6.006639 5.840579 5.518239 5.173919 4.739239 4.458409 4.426669 4.602489 4.822269 5.183689 5.430329 5.652549 5.821049 5.706269 5.369279 5.027399 4.705049 4.414459 4.145839 3.965129 4.033499 4.372939 4.683079Program Results
IB01CD EXAMPLE PROGRAM RESULTS The system state matrix A is 0.8924 0.3887 0.1285 0.1716 -0.0837 0.6186 -0.6273 -0.4582 0.0052 0.1307 0.6685 -0.6755 0.0055 0.0734 -0.2148 0.4788 The system output matrix C is -0.4442 0.6663 0.3961 0.4102 The system input matrix B is -0.2150 -0.1962 0.0511 0.0373 The system input-output matrix D is -0.0018 The initial state vector x0 is -11.4329 -0.6767 0.0472 0.3600
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/IB01MD.html 0000664 0000000 0000000 00000036260 14560147231 0020335 0 ustar 00root root 0000000 0000000
Purpose
To construct an upper triangular factor R of the concatenated block Hankel matrices using input-output data. The input-output data can, optionally, be processed sequentially.Specification
SUBROUTINE IB01MD( METH, ALG, BATCH, CONCT, NOBR, M, L, NSMP, U, $ LDU, Y, LDY, R, LDR, IWORK, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. INTEGER INFO, IWARN, L, LDR, LDU, LDWORK, LDY, M, NOBR, $ NSMP CHARACTER ALG, BATCH, CONCT, METH C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION DWORK(*), R(LDR, *), U(LDU, *), Y(LDY, *)Arguments
Mode Parameters
METH CHARACTER*1 Specifies the subspace identification method to be used, as follows: = 'M': MOESP algorithm with past inputs and outputs; = 'N': N4SID algorithm. ALG CHARACTER*1 Specifies the algorithm for computing the triangular factor R, as follows: = 'C': Cholesky algorithm applied to the correlation matrix of the input-output data; = 'F': Fast QR algorithm; = 'Q': QR algorithm applied to the concatenated block Hankel matrices. BATCH CHARACTER*1 Specifies whether or not sequential data processing is to be used, and, for sequential processing, whether or not the current data block is the first block, an intermediate block, or the last block, as follows: = 'F': the first block in sequential data processing; = 'I': an intermediate block in sequential data processing; = 'L': the last block in sequential data processing; = 'O': one block only (non-sequential data processing). NOTE that when 100 cycles of sequential data processing are completed for BATCH = 'I', a warning is issued, to prevent for an infinite loop. CONCT CHARACTER*1 Specifies whether or not the successive data blocks in sequential data processing belong to a single experiment, as follows: = 'C': the current data block is a continuation of the previous data block and/or it will be continued by the next data block; = 'N': there is no connection between the current data block and the previous and/or the next ones. This parameter is not used if BATCH = 'O'.Input/Output Parameters
NOBR (input) INTEGER The number of block rows, s, in the input and output block Hankel matrices to be processed. NOBR > 0. (In the MOESP theory, NOBR should be larger than n, the estimated dimension of state vector.) M (input) INTEGER The number of system inputs. M >= 0. When M = 0, no system inputs are processed. L (input) INTEGER The number of system outputs. L > 0. NSMP (input) INTEGER The number of rows of matrices U and Y (number of samples, t). (When sequential data processing is used, NSMP is the number of samples of the current data block.) NSMP >= 2*(M+L+1)*NOBR - 1, for non-sequential processing; NSMP >= 2*NOBR, for sequential processing. The total number of samples when calling the routine with BATCH = 'L' should be at least 2*(M+L+1)*NOBR - 1. The NSMP argument may vary from a cycle to another in sequential data processing, but NOBR, M, and L should be kept constant. For efficiency, it is advisable to use NSMP as large as possible. U (input) DOUBLE PRECISION array, dimension (LDU,M) The leading NSMP-by-M part of this array must contain the t-by-m input-data sequence matrix U, U = [u_1 u_2 ... u_m]. Column j of U contains the NSMP values of the j-th input component for consecutive time increments. If M = 0, this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= NSMP, if M > 0; LDU >= 1, if M = 0. Y (input) DOUBLE PRECISION array, dimension (LDY,L) The leading NSMP-by-L part of this array must contain the t-by-l output-data sequence matrix Y, Y = [y_1 y_2 ... y_l]. Column j of Y contains the NSMP values of the j-th output component for consecutive time increments. LDY INTEGER The leading dimension of the array Y. LDY >= NSMP. R (output or input/output) DOUBLE PRECISION array, dimension ( LDR,2*(M+L)*NOBR ) On exit, if INFO = 0 and ALG = 'Q', or (ALG = 'C' or 'F', and BATCH = 'L' or 'O'), the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array contains the (current) upper triangular factor R from the QR factorization of the concatenated block Hankel matrices. The diagonal elements of R are positive when the Cholesky algorithm was successfully used. On exit, if ALG = 'C' and BATCH = 'F' or 'I', the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array contains the current upper triangular part of the correlation matrix in sequential data processing. If ALG = 'F' and BATCH = 'F' or 'I', the array R is not referenced. On entry, if ALG = 'C', or ALG = 'Q', and BATCH = 'I' or 'L', the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array must contain the upper triangular matrix R computed at the previous call of this routine in sequential data processing. The array R need not be set on entry if ALG = 'F' or if BATCH = 'F' or 'O'. LDR INTEGER The leading dimension of the array R. LDR >= 2*(M+L)*NOBR.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= MAX(3,M+L), if ALG = 'F'; LIWORK >= 3, if ALG = 'C' or 'Q'. On entry with BATCH = 'I' or BATCH = 'L', IWORK(1:3) must contain the values of ICYCLE, MAXWRK, and NSMPSM set by the previous call of this routine. On exit with BATCH = 'F' or BATCH = 'I', IWORK(1:3) contains the values of ICYCLE, MAXWRK, and NSMPSM to be used by the next call of the routine. ICYCLE counts the cycles for BATCH = 'I'. MAXWRK stores the current optimal workspace. NSMPSM sums up the NSMP values for BATCH <> 'O'. The first three elements of IWORK should be preserved during successive calls of the routine with BATCH = 'F' or BATCH = 'I', till the final call with BATCH = 'L'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -17, DWORK(1) returns the minimum value of LDWORK. Let k = 0, if CONCT = 'N' and ALG = 'C' or 'Q'; k = 2*NOBR-1, if CONCT = 'C' and ALG = 'C' or 'Q'; k = 2*NOBR*(M+L+1), if CONCT = 'N' and ALG = 'F'; k = 2*NOBR*(M+L+2), if CONCT = 'C' and ALG = 'F'. The first (M+L)*k elements of DWORK should be preserved during successive calls of the routine with BATCH = 'F' or 'I', till the final call with BATCH = 'L'. LDWORK INTEGER The length of the array DWORK. LDWORK >= (4*NOBR-2)*(M+L), if ALG = 'C', BATCH <> 'O' and CONCT = 'C'; LDWORK >= 1, if ALG = 'C', BATCH = 'O' or CONCT = 'N'; LDWORK >= (M+L)*2*NOBR*(M+L+3), if ALG = 'F', BATCH <> 'O' and CONCT = 'C'; LDWORK >= (M+L)*2*NOBR*(M+L+1), if ALG = 'F', BATCH = 'F', 'I' and CONCT = 'N'; LDWORK >= (M+L)*4*NOBR*(M+L+1)+(M+L)*2*NOBR, if ALG = 'F', BATCH = 'L' and CONCT = 'N', or BATCH = 'O'; LDWORK >= 4*(M+L)*NOBR, if ALG = 'Q', BATCH = 'F' or 'O', and LDR >= NS = NSMP - 2*NOBR + 1; LDWORK >= 6*(M+L)*NOBR, if ALG = 'Q', BATCH = 'F' or 'O', and LDR < NS, or BATCH = 'I' or 'L' and CONCT = 'N'; LDWORK >= 4*(NOBR+1)*(M+L)*NOBR, if ALG = 'Q', BATCH = 'I' or 'L' and CONCT = 'C'. The workspace used for ALG = 'Q' is LDRWRK*2*(M+L)*NOBR + 4*(M+L)*NOBR, where LDRWRK = LDWORK/(2*(M+L)*NOBR) - 2; recommended value LDRWRK = NS, assuming a large enough cache size. For good performance, LDWORK should 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.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: the number of 100 cycles in sequential data processing has been exhausted without signaling that the last block of data was get; the cycle counter was reinitialized; = 2: a fast algorithm was requested (ALG = 'C' or 'F'), but it failed, and the QR algorithm was then used (non-sequential data processing).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: a fast algorithm was requested (ALG = 'C', or 'F') in sequential data processing, but it failed. The routine can be repeatedly called again using the standard QR algorithm.Method
1) For non-sequential data processing using QR algorithm, a t x 2(m+l)s matrix H is constructed, where H = [ Uf' Up' Y' ], for METH = 'M', s+1,2s,t 1,s,t 1,2s,t H = [ U' Y' ], for METH = 'N', 1,2s,t 1,2s,t and Up , Uf , U , and Y are block Hankel 1,s,t s+1,2s,t 1,2s,t 1,2s,t matrices defined in terms of the input and output data [3]. A QR factorization is used to compress the data. The fast QR algorithm uses a QR factorization which exploits the block-Hankel structure. Actually, the Cholesky factor of H'*H is computed. 2) For sequential data processing using QR algorithm, the QR decomposition is done sequentially, by updating the upper triangular factor R. This is also performed internally if the workspace is not large enough to accommodate an entire batch. 3) For non-sequential or sequential data processing using Cholesky algorithm, the correlation matrix of input-output data is computed (sequentially, if requested), taking advantage of the block Hankel structure [7]. Then, the Cholesky factor of the correlation matrix is found, if possible.References
[1] Verhaegen M., and Dewilde, P. Subspace Model Identification. Part 1: The output-error state-space model identification class of algorithms. Int. J. Control, 56, pp. 1187-1210, 1992. [2] Verhaegen M. Subspace Model Identification. Part 3: Analysis of the ordinary output-error state-space model identification algorithm. Int. J. Control, 58, pp. 555-586, 1993. [3] Verhaegen M. Identification of the deterministic part of MIMO state space models given in innovations form from input-output data. Automatica, Vol.30, No.1, pp.61-74, 1994. [4] Van Overschee, P., and De Moor, B. N4SID: Subspace Algorithms for the Identification of Combined Deterministic-Stochastic Systems. Automatica, Vol.30, No.1, pp. 75-93, 1994. [5] Peternell, K., Scherrer, W. and Deistler, M. Statistical Analysis of Novel Subspace Identification Methods. Signal Processing, 52, pp. 161-177, 1996. [6] Sima, V. Subspace-based Algorithms for Multivariable System Identification. Studies in Informatics and Control, 5, pp. 335-344, 1996. [7] Sima, V. Cholesky or QR Factorization for Data Compression in Subspace-based Identification ? Proceedings of the Second NICONET Workshop on ``Numerical Control Software: SLICOT, a Useful Tool in Industry'', December 3, 1999, INRIA Rocquencourt, France, pp. 75-80, 1999.Numerical Aspects
The implemented method is numerically stable (when QR algorithm is used), reliable and efficient. The fast Cholesky or QR algorithms are more efficient, but the accuracy could diminish by forming the correlation matrix. 2 The QR algorithm needs 0(t(2(m+l)s) ) floating point operations. 2 3 The Cholesky algorithm needs 0(2t(m+l) s)+0((2(m+l)s) ) floating point operations. 2 3 2 The fast QR algorithm needs 0(2t(m+l) s)+0(4(m+l) s ) floating point operations.Further Comments
For ALG = 'Q', BATCH = 'O' and LDR < NS, or BATCH <> 'O', the calculations could be rather inefficient if only minimal workspace (see argument LDWORK) is provided. It is advisable to provide as much workspace as possible. Almost optimal efficiency can be obtained for LDWORK = (NS+2)*(2*(M+L)*NOBR), assuming that the cache size is large enough to accommodate R, U, Y, and DWORK.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct an upper triangular factor R of the concatenated block Hankel matrices using input-output data, via a fast QR algorithm based on displacement rank. The input-output data can, optionally, be processed sequentially.Specification
SUBROUTINE IB01MY( METH, BATCH, CONCT, NOBR, M, L, NSMP, U, LDU, $ Y, LDY, R, LDR, IWORK, DWORK, LDWORK, IWARN, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, IWARN, L, LDR, LDU, LDWORK, LDY, M, NOBR, $ NSMP CHARACTER BATCH, CONCT, METH C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION DWORK(*), R(LDR, *), U(LDU, *), Y(LDY, *)Arguments
Mode Parameters
METH CHARACTER*1 Specifies the subspace identification method to be used, as follows: = 'M': MOESP algorithm with past inputs and outputs; = 'N': N4SID algorithm. BATCH CHARACTER*1 Specifies whether or not sequential data processing is to be used, and, for sequential processing, whether or not the current data block is the first block, an intermediate block, or the last block, as follows: = 'F': the first block in sequential data processing; = 'I': an intermediate block in sequential data processing; = 'L': the last block in sequential data processing; = 'O': one block only (non-sequential data processing). NOTE that when 100 cycles of sequential data processing are completed for BATCH = 'I', a warning is issued, to prevent for an infinite loop. CONCT CHARACTER*1 Specifies whether or not the successive data blocks in sequential data processing belong to a single experiment, as follows: = 'C': the current data block is a continuation of the previous data block and/or it will be continued by the next data block; = 'N': there is no connection between the current data block and the previous and/or the next ones. This parameter is not used if BATCH = 'O'.Input/Output Parameters
NOBR (input) INTEGER The number of block rows, s, in the input and output block Hankel matrices to be processed. NOBR > 0. (In the MOESP theory, NOBR should be larger than n, the estimated dimension of state vector.) M (input) INTEGER The number of system inputs. M >= 0. When M = 0, no system inputs are processed. L (input) INTEGER The number of system outputs. L > 0. NSMP (input) INTEGER The number of rows of matrices U and Y (number of samples, t). (When sequential data processing is used, NSMP is the number of samples of the current data block.) NSMP >= 2*(M+L+1)*NOBR - 1, for non-sequential processing; NSMP >= 2*NOBR, for sequential processing. The total number of samples when calling the routine with BATCH = 'L' should be at least 2*(M+L+1)*NOBR - 1. The NSMP argument may vary from a cycle to another in sequential data processing, but NOBR, M, and L should be kept constant. For efficiency, it is advisable to use NSMP as large as possible. U (input) DOUBLE PRECISION array, dimension (LDU,M) The leading NSMP-by-M part of this array must contain the t-by-m input-data sequence matrix U, U = [u_1 u_2 ... u_m]. Column j of U contains the NSMP values of the j-th input component for consecutive time increments. If M = 0, this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= NSMP, if M > 0; LDU >= 1, if M = 0. Y (input) DOUBLE PRECISION array, dimension (LDY,L) The leading NSMP-by-L part of this array must contain the t-by-l output-data sequence matrix Y, Y = [y_1 y_2 ... y_l]. Column j of Y contains the NSMP values of the j-th output component for consecutive time increments. LDY INTEGER The leading dimension of the array Y. LDY >= NSMP. R (output) DOUBLE PRECISION array, dimension ( LDR,2*(M+L)*NOBR ) If INFO = 0 and BATCH = 'L' or 'O', the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array contains the upper triangular factor R from the QR factorization of the concatenated block Hankel matrices. LDR INTEGER The leading dimension of the array R. LDR >= 2*(M+L)*NOBR.Workspace
IWORK INTEGER array, dimension MAX(3,M+L) On entry with BATCH = 'I' or BATCH = 'L', IWORK(1:3) must contain the values of ICYCLE, MAXWRK, and NSMPSM set by the previous call of this routine. On exit with BATCH = 'F' or BATCH = 'I', IWORK(1:3) contains the values of ICYCLE, MAXWRK, and NSMPSM to be used by the next call of the routine. ICYCLE counts the cycles for BATCH = 'I'. MAXWRK stores the current optimal workspace. NSMPSM sums up the NSMP values for BATCH <> 'O'. The first three elements of IWORK should be preserved during successive calls of the routine with BATCH = 'F' or BATCH = 'I', till the final call with BATCH = 'L'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -16, DWORK(1) returns the minimum value of LDWORK. The first (M+L)*2*NOBR*(M+L+c) elements of DWORK should be preserved during successive calls of the routine with BATCH = 'F' or 'I', till the final call with BATCH = 'L', where c = 1, if the successive data blocks do not belong to a single experiment (CONCT = 'N'); c = 2, if the successive data blocks belong to a single experiment (CONCT = 'C'). LDWORK INTEGER The length of the array DWORK. LDWORK >= (M+L)*2*NOBR*(M+L+3), if BATCH <> 'O' and CONCT = 'C'; LDWORK >= (M+L)*2*NOBR*(M+L+1), if BATCH = 'F' or 'I' and CONCT = 'N'; LDWORK >= (M+L)*4*NOBR*(M+L+1)+(M+L)*2*NOBR, if BATCH = 'L' and CONCT = 'N', or BATCH = 'O'. 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. The workspace query should be done for BATCH = 'L' or BATCH = 'O'. To get it in advance, use BATCH = 'O'.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: the number of 100 cycles in sequential data processing has been exhausted without signaling that the last block of data was get.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the fast QR factorization algorithm failed. The matrix H'*H is not (numerically) positive definite.Method
Consider the t x 2(m+l)s matrix H of concatenated block Hankel matrices H = [ Uf' Up' Y' ], for METH = 'M', s+1,2s,t 1,s,t 1,2s,t H = [ U' Y' ], for METH = 'N', 1,2s,t 1,2s,t where Up , Uf , U , and Y are block 1,s,t s+1,2s,t 1,2s,t 1,2s,t Hankel matrices defined in terms of the input and output data [3]. The fast QR algorithm uses a factorization of H'*H which exploits the block-Hankel structure, via a displacement rank technique [5].References
[1] Verhaegen M., and Dewilde, P. Subspace Model Identification. Part 1: The output-error state-space model identification class of algorithms. Int. J. Control, 56, pp. 1187-1210, 1992. [2] Verhaegen M. Subspace Model Identification. Part 3: Analysis of the ordinary output-error state-space model identification algorithm. Int. J. Control, 58, pp. 555-586, 1993. [3] Verhaegen M. Identification of the deterministic part of MIMO state space models given in innovations form from input-output data. Automatica, Vol.30, No.1, pp.61-74, 1994. [4] Van Overschee, P., and De Moor, B. N4SID: Subspace Algorithms for the Identification of Combined Deterministic-Stochastic Systems. Automatica, Vol.30, No.1, pp. 75-93, 1994. [5] Kressner, D., Mastronardi, N., Sima, V., Van Dooren, P., and Van Huffel, S. A Fast Algorithm for Subspace State-space System Identification via Exploitation of the Displacement Structure. J. Comput. Appl. Math., Vol.132, No.1, pp. 71-81, 2001.Numerical Aspects
The implemented method is reliable and efficient. Numerical difficulties are possible when the matrix H'*H is nearly rank defficient. The method cannot be used if the matrix H'*H is not numerically positive definite. 2 3 2 The algorithm requires 0(2t(m+l) s)+0(4(m+l) s ) floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To find the singular value decomposition (SVD) giving the system order, using the triangular factor of the concatenated block Hankel matrices. Related preliminary calculations needed for computing the system matrices are also performed.Specification
SUBROUTINE IB01ND( METH, JOBD, NOBR, M, L, R, LDR, SV, TOL, IWORK, $ DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION TOL INTEGER INFO, IWARN, L, LDR, LDWORK, M, NOBR CHARACTER JOBD, METH C .. Array Arguments .. DOUBLE PRECISION DWORK(*), R(LDR, *), SV(*) INTEGER IWORK(*)Arguments
Mode Parameters
METH CHARACTER*1 Specifies the subspace identification method to be used, as follows: = 'M': MOESP algorithm with past inputs and outputs; = 'N': N4SID algorithm. JOBD CHARACTER*1 Specifies whether or not the matrices B and D should later be computed using the MOESP approach, as follows: = 'M': the matrices B and D should later be computed using the MOESP approach; = 'N': the matrices B and D should not be computed using the MOESP approach. This parameter is not relevant for METH = 'N'.Input/Output Parameters
NOBR (input) INTEGER The number of block rows, s, in the input and output block Hankel matrices. NOBR > 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L > 0. R (input/output) DOUBLE PRECISION array, dimension ( LDR,2*(M+L)*NOBR ) On entry, the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array must contain the upper triangular factor R from the QR factorization of the concatenated block Hankel matrices. Denote R_ij, i,j = 1:4, the ij submatrix of R, partitioned by M*NOBR, M*NOBR, L*NOBR, and L*NOBR rows and columns. On exit, if INFO = 0, the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR upper triangular part of this array contains the matrix S, the processed upper triangular factor R, as required by other subroutines. Specifically, let S_ij, i,j = 1:4, be the ij submatrix of S, partitioned by M*NOBR, L*NOBR, M*NOBR, and L*NOBR rows and columns. The submatrix S_22 contains the matrix of left singular vectors needed subsequently. Useful information is stored in S_11 and in the block-column S_14 : S_44. For METH = 'M' and JOBD = 'M', the upper triangular part of S_31 contains the upper triangular factor in the QR factorization of the matrix R_1c = [ R_12' R_22' R_11' ]', and S_12 contains the corresponding leading part of the transformed matrix R_2c = [ R_13' R_23' R_14' ]'. For METH = 'N', the subarray S_41 : S_43 contains the transpose of the matrix contained in S_14 : S_34. LDR INTEGER The leading dimension of the array R. LDR >= MAX( 2*(M+L)*NOBR, 3*M*NOBR ), for METH = 'M' and JOBD = 'M'; LDR >= 2*(M+L)*NOBR, for METH = 'M' and JOBD = 'N' or for METH = 'N'. SV (output) DOUBLE PRECISION array, dimension ( L*NOBR ) The singular values of the relevant part of the triangular factor from the QR factorization of the concatenated block Hankel matrices.Tolerances
TOL DOUBLE PRECISION The tolerance to be used for estimating the rank of matrices. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; an m-by-n matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = m*n*EPS, is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH). This parameter is not used for METH = 'M'.Workspace
IWORK INTEGER array, dimension ((M+L)*NOBR) This parameter is not referenced for METH = 'M'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and, for METH = 'N', DWORK(2) and DWORK(3) contain the reciprocal condition numbers of the triangular factors of the matrices U_f and r_1 [6]. On exit, if INFO = -12, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= max( (2*M-1)*NOBR, (M+L)*NOBR, 5*L*NOBR ), if METH = 'M' and JOBD = 'M'; LDWORK >= 5*L*NOBR, if METH = 'M' and JOBD = 'N'; LDWORK >= 5*(M+L)*NOBR+1, if METH = 'N'. For good performance, LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 4: the least squares problems with coefficient matrix U_f, used for computing the weighted oblique projection (for METH = 'N'), have a rank-deficient coefficient matrix; = 5: the least squares problem with coefficient matrix r_1 [6], used for computing the weighted oblique projection (for METH = 'N'), has a rank-deficient coefficient matrix.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 2: the singular value decomposition (SVD) algorithm did not converge.Method
A singular value decomposition (SVD) of a certain matrix is computed, which reveals the order n of the system as the number of "non-zero" singular values. For the MOESP approach, this matrix is [ R_24' R_34' ]' := R(ms+1:(2m+l)s,(2m+l)s+1:2(m+l)s), where R is the upper triangular factor R constructed by SLICOT Library routine IB01MD. For the N4SID approach, a weighted oblique projection is computed from the upper triangular factor R and its SVD is then found.References
[1] Verhaegen M., and Dewilde, P. Subspace Model Identification. Part 1: The output-error state-space model identification class of algorithms. Int. J. Control, 56, pp. 1187-1210, 1992. [2] Verhaegen M. Subspace Model Identification. Part 3: Analysis of the ordinary output-error state-space model identification algorithm. Int. J. Control, 58, pp. 555-586, 1993. [3] Verhaegen M. Identification of the deterministic part of MIMO state space models given in innovations form from input-output data. Automatica, Vol.30, No.1, pp.61-74, 1994. [4] Van Overschee, P., and De Moor, B. N4SID: Subspace Algorithms for the Identification of Combined Deterministic-Stochastic Systems. Automatica, Vol.30, No.1, pp. 75-93, 1994. [5] Van Overschee, P., and De Moor, B. Subspace Identification for Linear Systems: Theory - Implementation - Applications. Kluwer Academic Publishers, Boston/London/Dordrecht, 1996. [6] Sima, V. Subspace-based Algorithms for Multivariable System Identification. Studies in Informatics and Control, 5, pp. 335-344, 1996.Numerical Aspects
The implemented method is numerically stable. 3 The algorithm requires 0(((m+l)s) ) floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To estimate the system order, based on the singular values of the relevant part of the triangular factor of the concatenated block Hankel matrices.Specification
SUBROUTINE IB01OD( CTRL, NOBR, L, SV, N, TOL, IWARN, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION TOL INTEGER INFO, IWARN, L, N, NOBR CHARACTER CTRL C .. Array Arguments .. DOUBLE PRECISION SV(*)Arguments
Mode Parameters
CTRL CHARACTER*1 Specifies whether or not the user's confirmation of the system order estimate is desired, as follows: = 'C': user's confirmation; = 'N': no confirmation. If CTRL = 'C', a reverse communication routine, IB01OY, is called, and, after inspecting the singular values and system order estimate, n, the user may accept n or set a new value. IB01OY is not called by the routine if CTRL = 'N'.Input/Output Parameters
NOBR (input) INTEGER The number of block rows, s, in the processed input and output block Hankel matrices. NOBR > 0. L (input) INTEGER The number of system outputs. L > 0. SV (input) DOUBLE PRECISION array, dimension ( L*NOBR ) The singular values of the relevant part of the triangular factor from the QR factorization of the concatenated block Hankel matrices. N (output) INTEGER The estimated order of the system.Tolerances
TOL DOUBLE PRECISION Absolute tolerance used for determining an estimate of the system order. If TOL >= 0, the estimate is indicated by the index of the last singular value greater than or equal to TOL. (Singular values less than TOL are considered as zero.) When TOL = 0, an internally computed default value, TOL = NOBR*EPS*SV(1), is used, where SV(1) is the maximal singular value, and EPS is the relative machine precision (see LAPACK Library routine DLAMCH). When TOL < 0, the estimate is indicated by the index of the singular value that has the largest logarithmic gap to its successor.Warning Indicator
IWARN INTEGER = 0: no warning; = 3: all singular values were exactly zero, hence N = 0. (Both input and output were identically zero.)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The singular values are compared to the given, or default TOL, and the estimated order n is returned, possibly after user's confirmation.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To ask for user's confirmation of the system order found by SLICOT Library routine IB01OD. This routine may be modified, but its interface must be preserved.Specification
SUBROUTINE IB01OY( NS, NMAX, N, SV, INFO ) C .. Scalar Arguments .. INTEGER INFO, N, NMAX, NS C .. Array Arguments .. DOUBLE PRECISION SV( * )Arguments
Input/Output Parameters
NS (input) INTEGER The number of singular values. NS > 0. NMAX (input) INTEGER The maximum value of the system order. 0 <= NMAX <= NS. N (input/output) INTEGER On entry, the estimate of the system order computed by IB01OD routine. 0 <= N <= NS. On exit, the user's estimate of the system order, which could be identical with the input value of N. Note that the output value of N should be less than or equal to NMAX. SV (input) DOUBLE PRECISION array, dimension ( NS ) The singular values, in descending order, used for determining the system order.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To estimate the matrices A, C, B, and D of a linear time-invariant (LTI) state space model, using the singular value decomposition information provided by other routines. Optionally, the system and noise covariance matrices, needed for the Kalman gain, are also determined.Specification
SUBROUTINE IB01PD( METH, JOB, JOBCV, NOBR, N, M, L, NSMPL, R, $ LDR, A, LDA, C, LDC, B, LDB, D, LDD, Q, LDQ, $ RY, LDRY, S, LDS, O, LDO, TOL, IWORK, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION TOL INTEGER INFO, IWARN, L, LDA, LDB, LDC, LDD, LDO, LDQ, $ LDR, LDRY, LDS, LDWORK, M, N, NOBR, NSMPL CHARACTER JOB, JOBCV, METH C .. Array Arguments .. DOUBLE PRECISION A(LDA, *), B(LDB, *), C(LDC, *), D(LDD, *), $ DWORK(*), O(LDO, *), Q(LDQ, *), R(LDR, *), $ RY(LDRY, *), S(LDS, *) INTEGER IWORK( * )Arguments
Mode Parameters
METH CHARACTER*1 Specifies the subspace identification method to be used, as follows: = 'M': MOESP algorithm with past inputs and outputs; = 'N': N4SID algorithm. JOB CHARACTER*1 Specifies which matrices should be computed, as follows: = 'A': compute all system matrices, A, B, C, and D; = 'C': compute the matrices A and C only; = 'B': compute the matrix B only; = 'D': compute the matrices B and D only. JOBCV CHARACTER*1 Specifies whether or not the covariance matrices are to be computed, as follows: = 'C': the covariance matrices should be computed; = 'N': the covariance matrices should not be computed.Input/Output Parameters
NOBR (input) INTEGER The number of block rows, s, in the input and output Hankel matrices processed by other routines. NOBR > 1. N (input) INTEGER The order of the system. NOBR > N > 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L > 0. NSMPL (input) INTEGER If JOBCV = 'C', the total number of samples used for calculating the covariance matrices. NSMPL >= 2*(M+L)*NOBR. This parameter is not meaningful if JOBCV = 'N'. R (input/workspace) DOUBLE PRECISION array, dimension ( LDR,2*(M+L)*NOBR ) On entry, the leading 2*(M+L)*NOBR-by-2*(M+L)*NOBR part of this array must contain the relevant data for the MOESP or N4SID algorithms, as constructed by SLICOT Library routines IB01AD or IB01ND. Let R_ij, i,j = 1:4, be the ij submatrix of R (denoted S in IB01AD and IB01ND), partitioned by M*NOBR, L*NOBR, M*NOBR, and L*NOBR rows and columns. The submatrix R_22 contains the matrix of left singular vectors used. Also needed, for METH = 'N' or JOBCV = 'C', are the submatrices R_11, R_14 : R_44, and, for METH = 'M' and JOB <> 'C', the submatrices R_31 and R_12, containing the processed matrices R_1c and R_2c, respectively, as returned by SLICOT Library routines IB01AD or IB01ND. Moreover, if METH = 'N' and JOB = 'A' or 'C', the block-row R_41 : R_43 must contain the transpose of the block-column R_14 : R_34 as returned by SLICOT Library routines IB01AD or IB01ND. The remaining part of R is used as workspace. On exit, part of this array is overwritten. Specifically, if METH = 'M', R_22 and R_31 are overwritten if JOB = 'B' or 'D', and R_12, R_22, R_14 : R_34, and possibly R_11 are overwritten if JOBCV = 'C'; if METH = 'N', all needed submatrices are overwritten. LDR INTEGER The leading dimension of the array R. LDR >= 2*(M+L)*NOBR. A (input or output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if METH = 'N' and JOB = 'B' or 'D', the leading N-by-N part of this array must contain the system state matrix. If METH = 'M' or (METH = 'N' and JOB = 'A' or 'C'), this array need not be set on input. On exit, if JOB = 'A' or 'C' and INFO = 0, the leading N-by-N part of this array contains the system state matrix. LDA INTEGER The leading dimension of the array A. LDA >= N, if JOB = 'A' or 'C', or METH = 'N' and JOB = 'B' or 'D'; LDA >= 1, otherwise. C (input or output) DOUBLE PRECISION array, dimension (LDC,N) On entry, if METH = 'N' and JOB = 'B' or 'D', the leading L-by-N part of this array must contain the system output matrix. If METH = 'M' or (METH = 'N' and JOB = 'A' or 'C'), this array need not be set on input. On exit, if JOB = 'A' or 'C' and INFO = 0, or INFO = 3 (or INFO >= 0, for METH = 'M'), the leading L-by-N part of this array contains the system output matrix. LDC INTEGER The leading dimension of the array C. LDC >= L, if JOB = 'A' or 'C', or METH = 'N' and JOB = 'B' or 'D'; LDC >= 1, otherwise. B (output) DOUBLE PRECISION array, dimension (LDB,M) If M > 0, JOB = 'A', 'B', or 'D' and INFO = 0, the leading N-by-M part of this array contains the system input matrix. If M = 0 or JOB = 'C', this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= N, if M > 0 and JOB = 'A', 'B', or 'D'; LDB >= 1, if M = 0 or JOB = 'C'. D (output) DOUBLE PRECISION array, dimension (LDD,M) If M > 0, JOB = 'A' or 'D' and INFO = 0, the leading L-by-M part of this array contains the system input-output matrix. If M = 0 or JOB = 'C' or 'B', this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= L, if M > 0 and JOB = 'A' or 'D'; LDD >= 1, if M = 0 or JOB = 'C' or 'B'. Q (output) DOUBLE PRECISION array, dimension (LDQ,N) If JOBCV = 'C', the leading N-by-N part of this array contains the positive semidefinite state covariance matrix to be used as state weighting matrix when computing the Kalman gain. This parameter is not referenced if JOBCV = 'N'. LDQ INTEGER The leading dimension of the array Q. LDQ >= N, if JOBCV = 'C'; LDQ >= 1, if JOBCV = 'N'. RY (output) DOUBLE PRECISION array, dimension (LDRY,L) If JOBCV = 'C', the leading L-by-L part of this array contains the positive (semi)definite output covariance matrix to be used as output weighting matrix when computing the Kalman gain. This parameter is not referenced if JOBCV = 'N'. LDRY INTEGER The leading dimension of the array RY. LDRY >= L, if JOBCV = 'C'; LDRY >= 1, if JOBCV = 'N'. S (output) DOUBLE PRECISION array, dimension (LDS,L) If JOBCV = 'C', the leading N-by-L part of this array contains the state-output cross-covariance matrix to be used as cross-weighting matrix when computing the Kalman gain. This parameter is not referenced if JOBCV = 'N'. LDS INTEGER The leading dimension of the array S. LDS >= N, if JOBCV = 'C'; LDS >= 1, if JOBCV = 'N'. O (output) DOUBLE PRECISION array, dimension ( LDO,N ) If METH = 'M' and JOBCV = 'C', or METH = 'N', the leading L*NOBR-by-N part of this array contains the estimated extended observability matrix, i.e., the first N columns of the relevant singular vectors. If METH = 'M' and JOBCV = 'N', this array is not referenced. LDO INTEGER The leading dimension of the array O. LDO >= L*NOBR, if JOBCV = 'C' or METH = 'N'; LDO >= 1, otherwise.Tolerances
TOL DOUBLE PRECISION The tolerance to be used for estimating the rank of matrices. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; an m-by-n matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = m*n*EPS, is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = N, if METH = 'M' and M = 0 or JOB = 'C' and JOBCV = 'N'; LIWORK = M*NOBR+N, if METH = 'M', JOB = 'C', and JOBCV = 'C'; LIWORK = max(L*NOBR,M*NOBR), if METH = 'M', JOB <> 'C', and JOBCV = 'N'; LIWORK = max(L*NOBR,M*NOBR+N), if METH = 'M', JOB <> 'C', and JOBCV = 'C'; LIWORK = max(M*NOBR+N,M*(N+L)), if METH = 'N'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and DWORK(2), DWORK(3), DWORK(4), and DWORK(5) contain the reciprocal condition numbers of the triangular factors of the matrices, defined in the code, GaL (GaL = Un(1:(s-1)*L,1:n)), R_1c (if METH = 'M'), M (if JOBCV = 'C' or METH = 'N'), and Q or T (see SLICOT Library routines IB01PY or IB01PX), respectively. If METH = 'N', DWORK(3) is set to one without any calculations. Similarly, if METH = 'M' and JOBCV = 'N', DWORK(4) is set to one. If M = 0 or JOB = 'C', DWORK(3) and DWORK(5) are set to one. On exit, if INFO = -30, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= max( LDW1,LDW2 ), where, if METH = 'M', LDW1 >= max( 2*(L*NOBR-L)*N+2*N, (L*NOBR-L)*N+N*N+7*N ), if JOB = 'C' or JOB = 'A' and M = 0; LDW1 >= max( 2*(L*NOBR-L)*N+N*N+7*N, (L*NOBR-L)*N+N+6*M*NOBR, (L*NOBR-L)*N+N+ max( L+M*NOBR, L*NOBR + max( 3*L*NOBR+1, M ) ) ) if M > 0 and JOB = 'A', 'B', or 'D'; LDW2 >= 0, if JOBCV = 'N'; LDW2 >= max( (L*NOBR-L)*N+Aw+2*N+max(5*N,(2*M+L)*NOBR+L), 4*(M*NOBR+N)+1, M*NOBR+2*N+L ), if JOBCV = 'C', where Aw = N+N*N, if M = 0 or JOB = 'C'; Aw = 0, otherwise; and, if METH = 'N', LDW1 >= max( (L*NOBR-L)*N+2*N+(2*M+L)*NOBR+L, 2*(L*NOBR-L)*N+N*N+8*N, N+4*(M*NOBR+N)+1, M*NOBR+3*N+L ); LDW2 >= 0, if M = 0 or JOB = 'C'; LDW2 >= M*NOBR*(N+L)*(M*(N+L)+1)+ max( (N+L)**2, 4*M*(N+L)+1 ), if M > 0 and JOB = 'A', 'B', or 'D'. For good performance, LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 4: a least squares problem to be solved has a rank-deficient coefficient matrix; = 5: the computed covariance matrices are too small. The problem seems to be a deterministic one.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 2: the singular value decomposition (SVD) algorithm did not converge; = 3: a singular upper triangular matrix was found.Method
In the MOESP approach, the matrices A and C are first computed from an estimated extended observability matrix [1], and then, the matrices B and D are obtained by solving an extended linear system in a least squares sense. In the N4SID approach, besides the estimated extended observability matrix, the solutions of two least squares problems are used to build another least squares problem, whose solution is needed to compute the system matrices A, C, B, and D. The solutions of the two least squares problems are also optionally used by both approaches to find the covariance matrices.References
[1] Verhaegen M., and Dewilde, P. Subspace Model Identification. Part 1: The output-error state- space model identification class of algorithms. Int. J. Control, 56, pp. 1187-1210, 1992. [2] Van Overschee, P., and De Moor, B. N4SID: Two Subspace Algorithms for the Identification of Combined Deterministic-Stochastic Systems. Automatica, Vol.30, No.1, pp. 75-93, 1994. [3] Van Overschee, P. Subspace Identification : Theory - Implementation - Applications. Ph. D. Thesis, Department of Electrical Engineering, Katholieke Universiteit Leuven, Belgium, Feb. 1995. [4] Sima, V. Subspace-based Algorithms for Multivariable System Identification. Studies in Informatics and Control, 5, pp. 335-344, 1996.Numerical Aspects
The implemented method is numerically stable.Further Comments
In some applications, it is useful to compute the system matrices using two calls to this routine, the first one with JOB = 'C', and the second one with JOB = 'B' or 'D'. This is slightly less efficient than using a single call with JOB = 'A', because some calculations are repeated. If METH = 'N', all the calculations at the first call are performed again at the second call; moreover, it is required to save the needed submatrices of R before the first call and restore them before the second call. If the covariance matrices are desired, JOBCV should be set to 'C' at the second call. If B and D are both needed, they should be computed at once. It is possible to compute the matrices A and C using the MOESP algorithm (METH = 'M'), and the matrices B and D using the N4SID algorithm (METH = 'N'). This combination could be slightly more efficient than N4SID algorithm alone and it could be more accurate than MOESP algorithm. No saving/restoring is needed in such a combination, provided JOBCV is set to 'N' at the first call. Recommended usage: either one call with JOB = 'A', or first call with METH = 'M', JOB = 'C', JOBCV = 'N', second call with METH = 'M', JOB = 'D', JOBCV = 'C', or first call with METH = 'M', JOB = 'C', JOBCV = 'N', second call with METH = 'N', JOB = 'D', JOBCV = 'C'.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To build and solve the least squares problem T*X = Kv, and estimate the matrices B and D of a linear time-invariant (LTI) state space model, using the solution X, and the singular value decomposition information and other intermediate results, provided by other routines. The matrix T is computed as a sum of Kronecker products, T = T + kron(Uf(:,(i-1)*m+1:i*m),N_i), for i = 1 : s, (with T initialized by zero), where Uf is the triangular factor of the QR factorization of the future input part (see SLICOT Library routine IB01ND), N_i is given by the i-th block row of the matrix [ Q_11 Q_12 ... Q_1,s-2 Q_1,s-1 Q_1s ] [ I_L 0 ] [ Q_12 Q_13 ... Q_1,s-1 Q_1s 0 ] [ ] N = [ Q_13 Q_14 ... Q_1s 0 0 ] * [ ], [ : : : : : ] [ ] [ Q_1s 0 ... 0 0 0 ] [ 0 GaL ] and where [ -L_1|1 ] [ M_i-1 - L_1|i ] Q_11 = [ ], Q_1i = [ ], i = 2:s, [ I_L - L_2|1 ] [ -L_2|i ] are (n+L)-by-L matrices, and GaL is built from the first n relevant singular vectors, GaL = Un(1:L(s-1),1:n), computed by IB01ND. The vector Kv is vec(K), with the matrix K defined by K = [ K_1 K_2 K_3 ... K_s ], where K_i = K(:,(i-1)*m+1:i*m), i = 1:s, is (n+L)-by-m. The given matrices are Uf, GaL, and [ L_1|1 ... L_1|s ] L = [ ], (n+L)-by-L*s, [ L_2|1 ... L_2|s ] M = [ M_1 ... M_s-1 ], n-by-L*(s-1), and K, (n+L)-by-m*s. Matrix M is the pseudoinverse of the matrix GaL, computed by SLICOT Library routine IB01PD.Specification
SUBROUTINE IB01PX( JOB, NOBR, N, M, L, UF, LDUF, UN, LDUN, UL, $ LDUL, PGAL, LDPGAL, K, LDK, R, LDR, X, B, LDB, $ D, LDD, TOL, IWORK, DWORK, LDWORK, IWARN, $ INFO ) C .. Scalar Arguments .. DOUBLE PRECISION TOL INTEGER INFO, IWARN, L, LDB, LDD, LDK, LDPGAL, LDR, $ LDUF, LDUL, LDUN, LDWORK, M, N, NOBR CHARACTER JOB C .. Array Arguments .. DOUBLE PRECISION B(LDB, *), D(LDD, *), DWORK(*), K(LDK, *), $ PGAL(LDPGAL, *), R(LDR, *), UF(LDUF, *), $ UL(LDUL, *), UN(LDUN, *), X(*) INTEGER IWORK( * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies which of the matrices B and D should be computed, as follows: = 'B': compute the matrix B, but not the matrix D; = 'D': compute both matrices B and D.Input/Output Parameters
NOBR (input) INTEGER The number of block rows, s, in the input and output Hankel matrices processed by other routines. NOBR > 1. N (input) INTEGER The order of the system. NOBR > N > 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L > 0. UF (input/output) DOUBLE PRECISION array, dimension ( LDUF,M*NOBR ) On entry, the leading M*NOBR-by-M*NOBR upper triangular part of this array must contain the upper triangular factor of the QR factorization of the future input part, as computed by SLICOT Library routine IB01ND. The strict lower triangle need not be set to zero. On exit, the leading M*NOBR-by-M*NOBR upper triangular part of this array is unchanged, and the strict lower triangle is set to zero. LDUF INTEGER The leading dimension of the array UF. LDUF >= MAX( 1, M*NOBR ). UN (input) DOUBLE PRECISION array, dimension ( LDUN,N ) The leading L*(NOBR-1)-by-N part of this array must contain the matrix GaL, i.e., the leading part of the first N columns of the matrix Un of relevant singular vectors. LDUN INTEGER The leading dimension of the array UN. LDUN >= L*(NOBR-1). UL (input/output) DOUBLE PRECISION array, dimension ( LDUL,L*NOBR ) On entry, the leading (N+L)-by-L*NOBR part of this array must contain the given matrix L. On exit, if M > 0, the leading (N+L)-by-L*NOBR part of this array is overwritten by the matrix [ Q_11 Q_12 ... Q_1,s-2 Q_1,s-1 Q_1s ]. LDUL INTEGER The leading dimension of the array UL. LDUL >= N+L. PGAL (input) DOUBLE PRECISION array, dimension ( LDPGAL,L*(NOBR-1) ) The leading N-by-L*(NOBR-1) part of this array must contain the pseudoinverse of the matrix GaL, computed by SLICOT Library routine IB01PD. LDPGAL INTEGER The leading dimension of the array PGAL. LDPGAL >= N. K (input) DOUBLE PRECISION array, dimension ( LDK,M*NOBR ) The leading (N+L)-by-M*NOBR part of this array must contain the given matrix K. LDK INTEGER The leading dimension of the array K. LDK >= N+L. R (output) DOUBLE PRECISION array, dimension ( LDR,M*(N+L) ) The leading (N+L)*M*NOBR-by-M*(N+L) part of this array contains details of the complete orthogonal factorization of the coefficient matrix T of the least squares problem which is solved for getting the system matrices B and D. LDR INTEGER The leading dimension of the array R. LDR >= MAX( 1, (N+L)*M*NOBR ). X (output) DOUBLE PRECISION array, dimension ( (N+L)*M*NOBR ) The leading M*(N+L) elements of this array contain the least squares solution of the system T*X = Kv. The remaining elements are used as workspace (to store the corresponding part of the vector Kv = vec(K)). B (output) DOUBLE PRECISION array, dimension ( LDB,M ) The leading N-by-M part of this array contains the system input matrix. LDB INTEGER The leading dimension of the array B. LDB >= N. D (output) DOUBLE PRECISION array, dimension ( LDD,M ) If JOB = 'D', the leading L-by-M part of this array contains the system input-output matrix. If JOB = 'B', this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= L, if JOB = 'D'; LDD >= 1, if JOB = 'B'.Tolerances
TOL DOUBLE PRECISION The tolerance to be used for estimating the rank of matrices. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; an m-by-n matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = m*n*EPS, is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension ( M*(N+L) ) DWORK DOUBLE PRECISION array, dimension ( LDWORK ) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and, if M > 0, DWORK(2) contains the reciprocal condition number of the triangular factor of the matrix T. On exit, if INFO = -26, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( (N+L)*(N+L), 4*M*(N+L)+1 ). For good performance, LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 4: the least squares problem to be solved has a rank-deficient coefficient matrix.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix T is computed, evaluating the sum of Kronecker products, and then the linear system T*X = Kv is solved in a least squares sense. The matrices B and D are then directly obtained from the least squares solution.References
[1] Verhaegen M., and Dewilde, P. Subspace Model Identification. Part 1: The output-error state-space model identification class of algorithms. Int. J. Control, 56, pp. 1187-1210, 1992. [2] Van Overschee, P., and De Moor, B. N4SID: Two Subspace Algorithms for the Identification of Combined Deterministic-Stochastic Systems. Automatica, Vol.30, No.1, pp. 75-93, 1994. [3] Van Overschee, P. Subspace Identification : Theory - Implementation - Applications. Ph. D. Thesis, Department of Electrical Engineering, Katholieke Universiteit Leuven, Belgium, Feb. 1995.Numerical Aspects
The implemented method is numerically stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
1. To compute the triangular (QR) factor of the p-by-L*s structured matrix Q, [ Q_1s Q_1,s-1 Q_1,s-2 ... Q_12 Q_11 ] [ 0 Q_1s Q_1,s-1 ... Q_13 Q_12 ] Q = [ 0 0 Q_1s ... Q_14 Q_13 ], [ : : : : : ] [ 0 0 0 ... 0 Q_1s ] and apply the transformations to the p-by-m matrix Kexpand, [ K_1 ] [ K_2 ] Kexpand = [ K_3 ], [ : ] [ K_s ] where, for MOESP approach (METH = 'M'), p = s*(L*s-n), and Q_1i = u2(L*(i-1)+1:L*i,:)' is (Ls-n)-by-L, for i = 1:s, u2 = Un(1:L*s,n+1:L*s), K_i = K(:,(i-1)*m+1:i*m) (i = 1:s) is (Ls-n)-by-m, and for N4SID approach (METH = 'N'), p = s*(n+L), and [ -L_1|1 ] [ M_i-1 - L_1|i ] Q_11 = [ ], Q_1i = [ ], i = 2:s, [ I_L - L_2|1 ] [ -L_2|i ] are (n+L)-by-L matrices, and K_i = K(:,(i-1)*m+1:i*m), i = 1:s, is (n+L)-by-m. The given matrices are: For METH = 'M', u2 = Un(1:L*s,n+1:L*s), K(1:Ls-n,1:m*s); [ L_1|1 ... L_1|s ] For METH = 'N', L = [ ], (n+L)-by-L*s, [ L_2|1 ... L_2|s ] M = [ M_1 ... M_s-1 ], n-by-L*(s-1), and K, (n+L)-by-m*s. Matrix M is the pseudoinverse of the matrix GaL, built from the first n relevant singular vectors, GaL = Un(1:L(s-1),1:n), and computed by SLICOT Library routine IB01PD for METH = 'N'. Matrix Q is triangularized (in R), exploiting its structure, and the transformations are applied from the left to Kexpand. 2. To estimate the matrices B and D of a linear time-invariant (LTI) state space model, using the factor R, transformed matrix Kexpand, and the singular value decomposition information provided by other routines. IB01PY routine is intended for speed and efficient use of the memory space. It is generally not recommended for METH = 'N', as IB01PX routine can produce more accurate results.Specification
SUBROUTINE IB01PY( METH, JOB, NOBR, N, M, L, RANKR1, UL, LDUL, $ R1, LDR1, TAU1, PGAL, LDPGAL, K, LDK, R, LDR, $ H, LDH, B, LDB, D, LDD, TOL, IWORK, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION TOL INTEGER INFO, IWARN, L, LDB, LDD, LDH, LDK, LDPGAL, $ LDR, LDR1, LDUL, LDWORK, M, N, NOBR, RANKR1 CHARACTER JOB, METH C .. Array Arguments .. DOUBLE PRECISION B(LDB, *), D(LDD, *), DWORK(*), H(LDH, *), $ K(LDK, *), PGAL(LDPGAL, *), R(LDR, *), $ R1(LDR1, *), TAU1(*), UL(LDUL, *) INTEGER IWORK( * )Arguments
Mode Parameters
METH CHARACTER*1 Specifies the subspace identification method to be used, as follows: = 'M': MOESP algorithm with past inputs and outputs; = 'N': N4SID algorithm. JOB CHARACTER*1 Specifies whether or not the matrices B and D should be computed, as follows: = 'B': compute the matrix B, but not the matrix D; = 'D': compute both matrices B and D; = 'N': do not compute the matrices B and D, but only the R factor of Q and the transformed Kexpand.Input/Output Parameters
NOBR (input) INTEGER The number of block rows, s, in the input and output Hankel matrices processed by other routines. NOBR > 1. N (input) INTEGER The order of the system. NOBR > N > 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L > 0. RANKR1 (input) INTEGER The effective rank of the upper triangular matrix r1, i.e., the triangular QR factor of the matrix GaL, computed by SLICOT Library routine IB01PD. It is also the effective rank of the matrix GaL. 0 <= RANKR1 <= N. If JOB = 'N', or M = 0, or METH = 'N', this parameter is not used. UL (input/workspace) DOUBLE PRECISION array, dimension ( LDUL,L*NOBR ) On entry, if METH = 'M', the leading L*NOBR-by-L*NOBR part of this array must contain the matrix Un of relevant singular vectors. The first N columns of UN need not be specified for this routine. On entry, if METH = 'N', the leading (N+L)-by-L*NOBR part of this array must contain the given matrix L. On exit, the leading LDF-by-L*(NOBR-1) part of this array is overwritten by the matrix F of the algorithm in [4], where LDF = MAX( 1, L*NOBR-N-L ), if METH = 'M'; LDF = N, if METH = 'N'. LDUL INTEGER The leading dimension of the array UL. LDUL >= L*NOBR, if METH = 'M'; LDUL >= N+L, if METH = 'N'. R1 (input) DOUBLE PRECISION array, dimension ( LDR1,N ) If JOB <> 'N', M > 0, METH = 'M', and RANKR1 = N, the leading L*(NOBR-1)-by-N part of this array must contain details of the QR factorization of the matrix GaL, as computed by SLICOT Library routine IB01PD. Specifically, the leading N-by-N upper triangular part must contain the upper triangular factor r1 of GaL, and the lower L*(NOBR-1)-by-N trapezoidal part, together with array TAU1, must contain the factored form of the orthogonal matrix Q1 in the QR factorization of GaL. If JOB = 'N', or M = 0, or METH = 'N', or METH = 'M' and RANKR1 < N, this array is not referenced. LDR1 INTEGER The leading dimension of the array R1. LDR1 >= L*(NOBR-1), if JOB <> 'N', M > 0, METH = 'M', and RANKR1 = N; LDR1 >= 1, otherwise. TAU1 (input) DOUBLE PRECISION array, dimension ( N ) If JOB <> 'N', M > 0, METH = 'M', and RANKR1 = N, this array must contain the scalar factors of the elementary reflectors used in the QR factorization of the matrix GaL, computed by SLICOT Library routine IB01PD. If JOB = 'N', or M = 0, or METH = 'N', or METH = 'M' and RANKR1 < N, this array is not referenced. PGAL (input) DOUBLE PRECISION array, dimension ( LDPGAL,L*(NOBR-1) ) If METH = 'N', or JOB <> 'N', M > 0, METH = 'M' and RANKR1 < N, the leading N-by-L*(NOBR-1) part of this array must contain the pseudoinverse of the matrix GaL, as computed by SLICOT Library routine IB01PD. If METH = 'M' and JOB = 'N', or M = 0, or RANKR1 = N, this array is not referenced. LDPGAL INTEGER The leading dimension of the array PGAL. LDPGAL >= N, if METH = 'N', or JOB <> 'N', M > 0, and METH = 'M' and RANKR1 < N; LDPGAL >= 1, otherwise. K (input/output) DOUBLE PRECISION array, dimension ( LDK,M*NOBR ) On entry, the leading (p/s)-by-M*NOBR part of this array must contain the given matrix K defined above. On exit, the leading (p/s)-by-M*NOBR part of this array contains the transformed matrix K. LDK INTEGER The leading dimension of the array K. LDK >= p/s. R (output) DOUBLE PRECISION array, dimension ( LDR,L*NOBR ) If JOB = 'N', or M = 0, or Q has full rank, the leading L*NOBR-by-L*NOBR upper triangular part of this array contains the R factor of the QR factorization of the matrix Q. If JOB <> 'N', M > 0, and Q has not a full rank, the leading L*NOBR-by-L*NOBR upper trapezoidal part of this array contains details of the complete orhogonal factorization of the matrix Q, as constructed by SLICOT Library routines MB03OD and MB02QY. LDR INTEGER The leading dimension of the array R. LDR >= L*NOBR. H (output) DOUBLE PRECISION array, dimension ( LDH,M ) If JOB = 'N' or M = 0, the leading L*NOBR-by-M part of this array contains the updated part of the matrix Kexpand corresponding to the upper triangular factor R in the QR factorization of the matrix Q. If JOB <> 'N', M > 0, and METH = 'N' or METH = 'M' and RANKR1 < N, the leading L*NOBR-by-M part of this array contains the minimum norm least squares solution of the linear system Q*X = Kexpand, from which the matrices B and D are found. The first NOBR-1 row blocks of X appear in the reverse order in H. If JOB <> 'N', M > 0, METH = 'M' and RANKR1 = N, the leading L*(NOBR-1)-by-M part of this array contains the matrix product Q1'*X, and the subarray L*(NOBR-1)+1:L*NOBR-by-M contains the corresponding submatrix of X, with X defined in the phrase above. LDH INTEGER The leading dimension of the array H. LDH >= L*NOBR. B (output) DOUBLE PRECISION array, dimension ( LDB,M ) If M > 0, JOB = 'B' or 'D' and INFO = 0, the leading N-by-M part of this array contains the system input matrix. If M = 0 or JOB = 'N', this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= N, if M > 0 and JOB = 'B' or 'D'; LDB >= 1, if M = 0 or JOB = 'N'. D (output) DOUBLE PRECISION array, dimension ( LDD,M ) If M > 0, JOB = 'D' and INFO = 0, the leading L-by-M part of this array contains the system input-output matrix. If M = 0 or JOB = 'B' or 'N', this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= L, if M > 0 and JOB = 'D'; LDD >= 1, if M = 0 or JOB = 'B' or 'N'.Tolerances
TOL DOUBLE PRECISION The tolerance to be used for estimating the rank of matrices. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; an m-by-n matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = m*n*EPS, is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH). This parameter is not used if M = 0 or JOB = 'N'.Workspace
IWORK INTEGER array, dimension ( LIWORK ) where LIWORK >= 0, if JOB = 'N', or M = 0; LIWORK >= L*NOBR, if JOB <> 'N', and M > 0. DWORK DOUBLE PRECISION array, dimension ( LDWORK ) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and, if JOB <> 'N', and M > 0, DWORK(2) contains the reciprocal condition number of the triangular factor of the matrix R. On exit, if INFO = -28, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 2*L, L*NOBR, L+M*NOBR ), if JOB = 'N', or M = 0; LDWORK >= MAX( L+M*NOBR, L*NOBR + MAX( 3*L*NOBR+1, M ) ), if JOB <> 'N', and M > 0. For good performance, LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 4: the least squares problem to be solved has a rank-deficient coefficient matrix.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 3: a singular upper triangular matrix was found.Method
The QR factorization is computed exploiting the structure, as described in [4]. The matrices B and D are then obtained by solving certain linear systems in a least squares sense.References
[1] Verhaegen M., and Dewilde, P. Subspace Model Identification. Part 1: The output-error state-space model identification class of algorithms. Int. J. Control, 56, pp. 1187-1210, 1992. [2] Van Overschee, P., and De Moor, B. N4SID: Two Subspace Algorithms for the Identification of Combined Deterministic-Stochastic Systems. Automatica, Vol.30, No.1, pp. 75-93, 1994. [3] Van Overschee, P. Subspace Identification : Theory - Implementation - Applications. Ph. D. Thesis, Department of Electrical Engineering, Katholieke Universiteit Leuven, Belgium, Feb. 1995. [4] Sima, V. Subspace-based Algorithms for Multivariable System Identification. Studies in Informatics and Control, 5, pp. 335-344, 1996.Numerical Aspects
The implemented method for computing the triangular factor and updating Kexpand is numerically stable.Further Comments
The computed matrices B and D are not the least squares solutions delivered by either MOESP or N4SID algorithms, except for the special case n = s - 1, L = 1. However, the computed B and D are frequently good enough estimates, especially for METH = 'M'. Better estimates could be obtained by calling SLICOT Library routine IB01PX, but it is less efficient, and requires much more workspace.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To estimate the initial state and the system matrices B and D of a linear time-invariant (LTI) discrete-time system, given the matrix pair (A,C) and the input and output trajectories of the system. The model structure is : x(k+1) = Ax(k) + Bu(k), k >= 0, y(k) = Cx(k) + Du(k), where x(k) is the n-dimensional state vector (at time k), u(k) is the m-dimensional input vector, y(k) is the l-dimensional output vector, and A, B, C, and D are real matrices of appropriate dimensions. Matrix A is assumed to be in a real Schur form.Specification
SUBROUTINE IB01QD( JOBX0, JOB, N, M, L, NSMP, A, LDA, C, LDC, U, $ LDU, Y, LDY, X0, B, LDB, D, LDD, TOL, IWORK, $ DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION TOL INTEGER INFO, IWARN, L, LDA, LDB, LDC, LDD, LDU, $ LDWORK, LDY, M, N, NSMP CHARACTER JOB, JOBX0 C .. Array Arguments .. DOUBLE PRECISION A(LDA, *), B(LDB, *), C(LDC, *), D(LDD, *), $ DWORK(*), U(LDU, *), X0(*), Y(LDY, *) INTEGER IWORK(*)Arguments
Mode Parameters
JOBX0 CHARACTER*1 Specifies whether or not the initial state should be computed, as follows: = 'X': compute the initial state x(0); = 'N': do not compute the initial state (x(0) is known to be zero). JOB CHARACTER*1 Specifies which matrices should be computed, as follows: = 'B': compute the matrix B only (D is known to be zero); = 'D': compute the matrices B and D.Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L > 0. NSMP (input) INTEGER The number of rows of matrices U and Y (number of samples, t). NSMP >= N*M + a + e, where a = 0, if JOBX0 = 'N'; a = N, if JOBX0 = 'X'; e = 0, if JOBX0 = 'X' and JOB = 'B'; e = 1, if JOBX0 = 'N' and JOB = 'B'; e = M, if JOB = 'D'. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A in a real Schur form. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading L-by-N part of this array must contain the system output matrix C (corresponding to the real Schur form of A). LDC INTEGER The leading dimension of the array C. LDC >= L. U (input/output) DOUBLE PRECISION array, dimension (LDU,M) On entry, the leading NSMP-by-M part of this array must contain the t-by-m input-data sequence matrix U, U = [u_1 u_2 ... u_m]. Column j of U contains the NSMP values of the j-th input component for consecutive time increments. On exit, if JOB = 'D', the leading NSMP-by-M part of this array contains details of the QR factorization of the t-by-m matrix U, possibly computed sequentially (see METHOD). If JOB = 'B', this array is unchanged on exit. If M = 0, this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= MAX(1,NSMP), if M > 0; LDU >= 1, if M = 0. Y (input) DOUBLE PRECISION array, dimension (LDY,L) The leading NSMP-by-L part of this array must contain the t-by-l output-data sequence matrix Y, Y = [y_1 y_2 ... y_l]. Column j of Y contains the NSMP values of the j-th output component for consecutive time increments. LDY INTEGER The leading dimension of the array Y. LDY >= MAX(1,NSMP). X0 (output) DOUBLE PRECISION array, dimension (N) If JOBX0 = 'X', the estimated initial state of the system, x(0). If JOBX0 = 'N', x(0) is set to zero without any calculations. B (output) DOUBLE PRECISION array, dimension (LDB,M) If N > 0, M > 0, and INFO = 0, the leading N-by-M part of this array contains the system input matrix B in the coordinates corresponding to the real Schur form of A. If N = 0 or M = 0, this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= N, if N > 0 and M > 0; LDB >= 1, if N = 0 or M = 0. D (output) DOUBLE PRECISION array, dimension (LDD,M) If M > 0, JOB = 'D', and INFO = 0, the leading L-by-M part of this array contains the system input-output matrix D. If M = 0 or JOB = 'B', this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= L, if M > 0 and JOB = 'D'; LDD >= 1, if M = 0 or JOB = 'B'.Tolerances
TOL DOUBLE PRECISION The tolerance to be used for estimating the rank of matrices. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then EPS is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH). TOL <= 1.Workspace
IWORK INTEGER array, dimension (LIWORK), where LIWORK >= N*M + a, if JOB = 'B', LIWORK >= max( N*M + a, M ), if JOB = 'D', with a = 0, if JOBX0 = 'N'; a = N, if JOBX0 = 'X'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK; DWORK(2) contains the reciprocal condition number of the triangular factor of the QR factorization of the matrix W2 (see METHOD); if M > 0 and JOB = 'D', DWORK(3) contains the reciprocal condition number of the triangular factor of the QR factorization of U. On exit, if INFO = -23, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= max( LDW1, min( LDW2, LDW3 ) ), where LDW1 = 2, if M = 0 or JOB = 'B', LDW1 = 3, if M > 0 and JOB = 'D', LDWa = t*L*(r + 1) + max( N + max( d, f ), 6*r ), LDW2 = LDWa, if M = 0 or JOB = 'B', LDW2 = max( LDWa, t*L*(r + 1) + 2*M*M + 6*M ), if M > 0 and JOB = 'D', LDWb = (b + r)*(r + 1) + max( q*(r + 1) + N*N*M + c + max( d, f ), 6*r ), LDW3 = LDWb, if M = 0 or JOB = 'B', LDW3 = max( LDWb, (b + r)*(r + 1) + 2*M*M + 6*M ), if M > 0 and JOB = 'D', r = N*M + a, a = 0, if JOBX0 = 'N', a = N, if JOBX0 = 'X'; b = 0, if JOB = 'B', b = L*M, if JOB = 'D'; c = 0, if JOBX0 = 'N', c = L*N, if JOBX0 = 'X'; d = 0, if JOBX0 = 'N', d = 2*N*N + N, if JOBX0 = 'X'; f = 2*r, if JOB = 'B' or M = 0, f = M + max( 2*r, M ), if JOB = 'D' and M > 0; q = b + r*L. For good performance, LDWORK should be larger. If LDWORK >= LDW2 or LDWORK >= t*L*(r + 1) + (b + r)*(r + 1) + N*N*M + c + max( d, f ), then standard QR factorizations of the matrices U and/or W2 (see METHOD) are used. Otherwise, the QR factorizations are computed sequentially by performing NCYCLE cycles, each cycle (except possibly the last one) processing s < t samples, where s is chosen from the equation LDWORK = s*L*(r + 1) + (b + r)*(r + 1) + N*N*M + c + max( d, f ). (s is at least N*M+a+e, the minimum value of NSMP.) The computational effort may increase and the accuracy may decrease with the decrease of s. Recommended value is LDWORK = LDW2, assuming a large enough cache size, to also accommodate A, C, U, and Y.Warning Indicator
IWARN INTEGER = 0: no warning; = 4: the least squares problem to be solved has a rank-deficient coefficient matrix.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 2: the singular value decomposition (SVD) algorithm did not converge.Method
An extension and refinement of the method in [1,2] is used. Specifically, denoting X = [ vec(D')' vec(B)' x0' ]', where vec(M) is the vector obtained by stacking the columns of the matrix M, then X is the least squares solution of the system S*X = vec(Y), with the matrix S = [ diag(U) W ], defined by ( U | | ... | | | ... | | ) ( U | 11 | ... | n1 | 12 | ... | nm | ) S = ( : | y | ... | y | y | ... | y | P*Gamma ), ( : | | ... | | | ... | | ) ( U | | ... | | | ... | | ) ij diag(U) having L block rows and columns. In this formula, y are the outputs of the system for zero initial state computed using the following model, for j = 1:m, and for i = 1:n, ij ij ij x (k+1) = Ax (k) + e_i u_j(k), x (0) = 0, ij ij y (k) = Cx (k), where e_i is the i-th n-dimensional unit vector, Gamma is given by ( C ) ( C*A ) Gamma = ( C*A^2 ), ( : ) ( C*A^(t-1) ) and P is a permutation matrix that groups together the rows of Gamma depending on the same row of C, namely [ c_j; c_j*A; c_j*A^2; ... c_j*A^(t-1) ], for j = 1:L. The first block column, diag(U), is not explicitly constructed, but its structure is exploited. The last block column is evaluated using powers of A with exponents 2^k. No interchanges are applied. A special QR decomposition of the matrix S is computed. Let U = q*[ r' 0 ]' be the QR decomposition of U, if M > 0, where r is M-by-M. Then, diag(q') is applied to W and vec(Y). The block-rows of S and vec(Y) are implicitly permuted so that matrix S becomes ( diag(r) W1 ) ( 0 W2 ), where W1 has L*M rows. Then, the QR decomposition of W2 is computed (sequentially, if M > 0) and used to obtain B and x0. The intermediate results and the QR decomposition of U are needed to find D. If a triangular factor is too ill conditioned, then singular value decomposition (SVD) is employed. SVD is not generally needed if the input sequence is sufficiently persistently exciting and NSMP is large enough. If the matrix W cannot be stored in the workspace (i.e., LDWORK < LDW2), the QR decompositions of W2 and U are computed sequentially.References
[1] Verhaegen M., and Varga, A. Some Experience with the MOESP Class of Subspace Model Identification Methods in Identifying the BO105 Helicopter. Report TR R165-94, DLR Oberpfaffenhofen, 1994. [2] Sima, V., and Varga, A. RASP-IDENT : Subspace Model Identification Programs. Deutsche Forschungsanstalt fur Luft- und Raumfahrt e. V., Report TR R888-94, DLR Oberpfaffenhofen, Oct. 1994.Numerical Aspects
The implemented method is numerically stable.Further Comments
The algorithm for computing the system matrices B and D is less efficient than the MOESP or N4SID algorithms implemented in SLICOT Library routine IB01PD, because a large least squares problem has to be solved, but the accuracy is better, as the computed matrices B and D are fitted to the input and output trajectories. However, if matrix A is unstable, the computed matrices B and D could be inaccurate.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To estimate the initial state of a linear time-invariant (LTI) discrete-time system, given the system matrices (A,B,C,D) and the input and output trajectories of the system. The model structure is : x(k+1) = Ax(k) + Bu(k), k >= 0, y(k) = Cx(k) + Du(k), where x(k) is the n-dimensional state vector (at time k), u(k) is the m-dimensional input vector, y(k) is the l-dimensional output vector, and A, B, C, and D are real matrices of appropriate dimensions. Matrix A is assumed to be in a real Schur form.Specification
SUBROUTINE IB01RD( JOB, N, M, L, NSMP, A, LDA, B, LDB, C, LDC, D, $ LDD, U, LDU, Y, LDY, X0, TOL, IWORK, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION TOL INTEGER INFO, IWARN, L, LDA, LDB, LDC, LDD, LDU, $ LDWORK, LDY, M, N, NSMP CHARACTER JOB C .. Array Arguments .. DOUBLE PRECISION A(LDA, *), B(LDB, *), C(LDC, *), D(LDD, *), $ DWORK(*), U(LDU, *), X0(*), Y(LDY, *) INTEGER IWORK(*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies whether or not the matrix D is zero, as follows: = 'Z': the matrix D is zero; = 'N': the matrix D is not zero.Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L > 0. NSMP (input) INTEGER The number of rows of matrices U and Y (number of samples used, t). NSMP >= N. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A in a real Schur form. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B (corresponding to the real Schur form of A). If N = 0 or M = 0, this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= N, if N > 0 and M > 0; LDB >= 1, if N = 0 or M = 0. C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading L-by-N part of this array must contain the system output matrix C (corresponding to the real Schur form of A). LDC INTEGER The leading dimension of the array C. LDC >= L. D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading L-by-M part of this array must contain the system input-output matrix. If M = 0 or JOB = 'Z', this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= L, if M > 0 and JOB = 'N'; LDD >= 1, if M = 0 or JOB = 'Z'. U (input) DOUBLE PRECISION array, dimension (LDU,M) If M > 0, the leading NSMP-by-M part of this array must contain the t-by-m input-data sequence matrix U, U = [u_1 u_2 ... u_m]. Column j of U contains the NSMP values of the j-th input component for consecutive time increments. If M = 0, this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= MAX(1,NSMP), if M > 0; LDU >= 1, if M = 0. Y (input) DOUBLE PRECISION array, dimension (LDY,L) The leading NSMP-by-L part of this array must contain the t-by-l output-data sequence matrix Y, Y = [y_1 y_2 ... y_l]. Column j of Y contains the NSMP values of the j-th output component for consecutive time increments. LDY INTEGER The leading dimension of the array Y. LDY >= MAX(1,NSMP). X0 (output) DOUBLE PRECISION array, dimension (N) The estimated initial state of the system, x(0).Tolerances
TOL DOUBLE PRECISION The tolerance to be used for estimating the rank of matrices. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then EPS is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH). TOL <= 1.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK and DWORK(2) contains the reciprocal condition number of the triangular factor of the QR factorization of the matrix Gamma (see METHOD). On exit, if INFO = -22, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= max( 2, min( LDW1, LDW2 ) ), where LDW1 = t*L*(N + 1) + 2*N + max( 2*N*N, 4*N ), LDW2 = N*(N + 1) + 2*N + max( q*(N + 1) + 2*N*N + L*N, 4*N ), q = N*L. For good performance, LDWORK should be larger. If LDWORK >= LDW1, then standard QR factorization of the matrix Gamma (see METHOD) is used. Otherwise, the QR factorization is computed sequentially by performing NCYCLE cycles, each cycle (except possibly the last one) processing s samples, where s is chosen by equating LDWORK to LDW2, for q replaced by s*L. The computational effort may increase and the accuracy may decrease with the decrease of s. Recommended value is LDRWRK = LDW1, assuming a large enough cache size, to also accommodate A, B, C, D, U, and Y.Warning Indicator
IWARN INTEGER = 0: no warning; = 4: the least squares problem to be solved has a rank-deficient coefficient matrix.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 2: the singular value decomposition (SVD) algorithm did not converge.Method
An extension and refinement of the method in [1] is used. Specifically, the output y0(k) of the system for zero initial state is computed for k = 0, 1, ..., t-1 using the given model. Then the following least squares problem is solved for x(0) ( C ) ( y(0) - y0(0) ) ( C*A ) ( y(1) - y0(1) ) Gamma * x(0) = ( : ) * x(0) = ( : ). ( : ) ( : ) ( C*A^(t-1) ) ( y(t-1) - y0(t-1) ) The coefficient matrix Gamma is evaluated using powers of A with exponents 2^k. The QR decomposition of this matrix is computed. If its triangular factor R is too ill conditioned, then singular value decomposition of R is used. If the coefficient matrix cannot be stored in the workspace (i.e., LDWORK < LDW1), the QR decomposition is computed sequentially.References
[1] Verhaegen M., and Varga, A. Some Experience with the MOESP Class of Subspace Model Identification Methods in Identifying the BO105 Helicopter. Report TR R165-94, DLR Oberpfaffenhofen, 1994.Numerical Aspects
The implemented method is numerically stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a set of parameters for approximating a Wiener system in a least-squares sense, using a neural network approach and a Levenberg-Marquardt algorithm. Conjugate gradients (CG) or Cholesky algorithms are used to solve linear systems of equations. The Wiener system is represented as x(t+1) = A*x(t) + B*u(t) z(t) = C*x(t) + D*u(t), y(t) = f(z(t),wb(1:L)), where t = 1, 2, ..., NSMP, and f is a nonlinear function, evaluated by the SLICOT Library routine NF01AY. The parameter vector X is partitioned as X = ( wb(1), ..., wb(L), theta ), where wb(i), i = 1 : L, correspond to the nonlinear part, and theta corresponds to the linear part. See SLICOT Library routine NF01AD for further details. The sum of squares of the error functions, defined by e(t) = y(t) - Y(t), t = 1, 2, ..., NSMP, is minimized, where Y(t) is the measured output vector. The functions and their Jacobian matrices are evaluated by SLICOT Library routine NF01BB (the FCN routine in the call of MD03AD).Specification
SUBROUTINE IB03AD( INIT, ALG, STOR, NOBR, M, L, NSMP, N, NN, $ ITMAX1, ITMAX2, NPRINT, U, LDU, Y, LDY, X, LX, $ TOL1, TOL2, IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER ALG, INIT, STOR INTEGER INFO, ITMAX1, ITMAX2, IWARN, L, LDU, LDWORK, $ LDY, LX, M, N, NN, NOBR, NPRINT, NSMP DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. DOUBLE PRECISION DWORK(*), U(LDU, *), X(*), Y(LDY, *) INTEGER IWORK(*)Arguments
Mode Parameters
INIT CHARACTER*1 Specifies which parts have to be initialized, as follows: = 'L' : initialize the linear part only, X already contains an initial approximation of the nonlinearity; = 'S' : initialize the static nonlinearity only, X already contains an initial approximation of the linear part; = 'B' : initialize both linear and nonlinear parts; = 'N' : do not initialize anything, X already contains an initial approximation. If INIT = 'S' or 'B', the error functions for the nonlinear part, and their Jacobian matrices, are evaluated by SLICOT Library routine NF01BA (used as a second FCN routine in the MD03AD call for the initialization step, see METHOD). ALG CHARACTER*1 Specifies the algorithm used for solving the linear systems involving a Jacobian matrix J, as follows: = 'D' : a direct algorithm, which computes the Cholesky factor of the matrix J'*J + par*I is used, where par is the Levenberg factor; = 'I' : an iterative Conjugate Gradients algorithm, which only needs the matrix J, is used. In both cases, matrix J is stored in a compressed form. STOR CHARACTER*1 If ALG = 'D', specifies the storage scheme for the symmetric matrix J'*J, as follows: = 'F' : full storage is used; = 'P' : packed storage is used. The option STOR = 'F' usually ensures a faster execution. This parameter is not relevant if ALG = 'I'.Input/Output Parameters
NOBR (input) INTEGER If INIT = 'L' or 'B', NOBR is the number of block rows, s, in the input and output block Hankel matrices to be processed for estimating the linear part. NOBR > 0. (In the MOESP theory, NOBR should be larger than n, the estimated dimension of state vector.) This parameter is ignored if INIT is 'S' or 'N'. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L >= 0, and L > 0, if INIT = 'L' or 'B'. NSMP (input) INTEGER The number of input and output samples, t. NSMP >= 0, and NSMP >= 2*(M+L+1)*NOBR - 1, if INIT = 'L' or 'B'. N (input/output) INTEGER The order of the linear part. If INIT = 'L' or 'B', and N < 0 on entry, the order is assumed unknown and it will be found by the routine. Otherwise, the input value will be used. If INIT = 'S' or 'N', N must be non-negative. The values N >= NOBR, or N = 0, are not acceptable if INIT = 'L' or 'B'. NN (input) INTEGER The number of neurons which shall be used to approximate the nonlinear part. NN >= 0. ITMAX1 (input) INTEGER The maximum number of iterations for the initialization of the static nonlinearity. This parameter is ignored if INIT is 'N' or 'L'. Otherwise, ITMAX1 >= 0. ITMAX2 (input) INTEGER The maximum number of iterations. ITMAX2 >= 0. NPRINT (input) INTEGER This parameter enables controlled printing of iterates if it is positive. In this case, FCN is called with IFLAG = 0 at the beginning of the first iteration and every NPRINT iterations thereafter and immediately prior to return, and the current error norm is printed. Other intermediate results could be printed by modifying the corresponding FCN routine (NF01BA and/or NF01BB). If NPRINT <= 0, no special calls of FCN with IFLAG = 0 are made. U (input) DOUBLE PRECISION array, dimension (LDU, M) The leading NSMP-by-M part of this array must contain the set of input samples, U = ( U(1,1),...,U(1,M); ...; U(NSMP,1),...,U(NSMP,M) ). LDU INTEGER The leading dimension of array U. LDU >= MAX(1,NSMP). Y (input) DOUBLE PRECISION array, dimension (LDY, L) The leading NSMP-by-L part of this array must contain the set of output samples, Y = ( Y(1,1),...,Y(1,L); ...; Y(NSMP,1),...,Y(NSMP,L) ). LDY INTEGER The leading dimension of array Y. LDY >= MAX(1,NSMP). X (input/output) DOUBLE PRECISION array dimension (LX) On entry, if INIT = 'L', the leading (NN*(L+2) + 1)*L part of this array must contain the initial parameters for the nonlinear part of the system. On entry, if INIT = 'S', the elements lin1 : lin2 of this array must contain the initial parameters for the linear part of the system, corresponding to the output normal form, computed by SLICOT Library routine TB01VD, where lin1 = (NN*(L+2) + 1)*L + 1; lin2 = (NN*(L+2) + 1)*L + N*(L+M+1) + L*M. On entry, if INIT = 'N', the elements 1 : lin2 of this array must contain the initial parameters for the nonlinear part followed by the initial parameters for the linear part of the system, as specified above. This array need not be set on entry if INIT = 'B'. On exit, the elements 1 : lin2 of this array contain the optimal parameters for the nonlinear part followed by the optimal parameters for the linear part of the system, as specified above. LX (input/output) INTEGER On entry, this parameter must contain the intended length of X. If N >= 0, then LX >= NX := lin2 (see parameter X). If N is unknown (N < 0 on entry), a large enough estimate of N should be used in the formula of lin2. On exit, if N < 0 on entry, but LX is not large enough, then this parameter contains the actual length of X, corresponding to the computed N. Otherwise, its value is unchanged.Tolerances
TOL1 DOUBLE PRECISION If INIT = 'S' or 'B' and TOL1 >= 0, TOL1 is the tolerance which measures the relative error desired in the sum of squares, for the initialization step of nonlinear part. Termination occurs when the actual relative reduction in the sum of squares is at most TOL1. In addition, if ALG = 'I', TOL1 also measures the relative residual of the solutions computed by the CG algorithm (for the initialization step). Termination of a CG process occurs when the relative residual is at most TOL1. If the user sets TOL1 < 0, then SQRT(EPS) is used instead TOL1, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is ignored if INIT is 'N' or 'L'. TOL2 DOUBLE PRECISION If TOL2 >= 0, TOL2 is the tolerance which measures the relative error desired in the sum of squares, for the whole optimization process. Termination occurs when the actual relative reduction in the sum of squares is at most TOL2. If ALG = 'I', TOL2 also measures the relative residual of the solutions computed by the CG algorithm (for the whole optimization). Termination of a CG process occurs when the relative residual is at most TOL2. If the user sets TOL2 < 0, then SQRT(EPS) is used instead TOL2. This default value could require many iterations, especially if TOL1 is larger. If INIT = 'S' or 'B', it is advisable that TOL2 be larger than TOL1, and spend more time with cheaper iterations.Workspace
IWORK INTEGER array, dimension (MAX( 3, LIW1, LIW2 )), where LIW1 = LIW2 = 0, if INIT = 'S' or 'N'; otherwise, LIW1 = M+L; LIW2 = MAX(M*NOBR+N,M*(N+L)). On output, if INFO = 0, IWORK(1) and IWORK(2) return the (total) number of function and Jacobian evaluations, respectively (including the initialization step, if it was performed), and if INIT = 'L' or INIT = 'B', IWORK(3) specifies how many locations of DWORK contain reciprocal condition number estimates (see below); otherwise, IWORK(3) = 0. DWORK DOUBLE PRECISION array, dimension (LDWORK) On entry, if desired, and if INIT = 'S' or 'B', the entries DWORK(1:4) are set to initialize the random numbers generator for the nonlinear part parameters (see the description of the argument XINIT of SLICOT Library routine MD03AD); this enables to obtain reproducible results. The same seed is used for all outputs. On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, DWORK(2) returns the residual error norm (the sum of squares), DWORK(3) returns the number of iterations performed, DWORK(4) returns the number of conjugate gradients iterations performed, and DWORK(5) returns the final Levenberg factor, for optimizing the parameters of both the linear part and the static nonlinearity part. If INIT = 'S' or INIT = 'B' and INFO = 0, then the elements DWORK(6) to DWORK(10) contain the corresponding five values for the initialization step (see METHOD). (If L > 1, DWORK(10) contains the maximum of the Levenberg factors for all outputs.) If INIT = 'L' or INIT = 'B', and INFO = 0, DWORK(11) to DWORK(10+IWORK(3)) contain reciprocal condition number estimates set by SLICOT Library routines IB01AD, IB01BD, and IB01CD. On exit, if INFO = -23, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. In the formulas below, N should be taken not larger than NOBR - 1, if N < 0 on entry. LDWORK = MAX( LW1, LW2, LW3, LW4 ), where LW1 = 0, if INIT = 'S' or 'N'; otherwise, LW1 = MAX( 2*(M+L)*NOBR*(2*(M+L)*(NOBR+1)+3) + L*NOBR, 4*(M+L)*NOBR*(M+L)*NOBR + (N+L)*(N+M) + MAX( LDW1, LDW2 ), (N+L)*(N+M) + N + N*N + 2 + N*(N+M+L) + MAX( 5*N, 2, MIN( LDW3, LDW4 ), LDW5, LDW6 ), where, LDW1 >= MAX( 2*(L*NOBR-L)*N+2*N, (L*NOBR-L)*N+N*N+7*N, L*NOBR*N + MAX( (L*NOBR-L)*N+2*N + (2*M+L)*NOBR+L, 2*(L*NOBR-L)*N+N*N+8*N, N+4*(M*NOBR+N)+1, M*NOBR+3*N+L ) ) LDW2 >= 0, if M = 0; LDW2 >= L*NOBR*N + M*NOBR*(N+L)*(M*(N+L)+1) + MAX( (N+L)**2, 4*M*(N+L)+1 ), if M > 0; LDW3 = NSMP*L*(N+1) + 2*N + MAX( 2*N*N, 4*N ), LDW4 = N*(N+1) + 2*N + MAX( N*L*(N+1) + 2*N*N + L*N, 4*N ); LDW5 = NSMP*L + (N+L)*(N+M) + 3*N+M+L; LDW6 = NSMP*L + (N+L)*(N+M) + N + MAX(1, N*N*L + N*L + N, N*N + MAX(N*N + N*MAX(N,L) + 6*N + MIN(N,L), N*M)); LW2 = LW3 = 0, if INIT = 'L' or 'N'; otherwise, LW2 = NSMP*L + MAX( 5, NSMP + 2*BSN + NSMP*BSN + MAX( 2*NN + BSN, LDW7 ) ); LDW7 = BSN*BSN, if ALG = 'D' and STOR = 'F'; LDW7 = BSN*(BSN+1)/2, if ALG = 'D' and STOR = 'P'; LDW7 = 3*BSN + NSMP, if ALG = 'I'; LW3 = MAX( LDW8, NSMP*L + (N+L)*(2*N+M) + 2*N ); LDW8 = NSMP*L + (N+L)*(N+M) + 3*N+M+L, if M > 0; LDW8 = NSMP*L + (N+L)*N + 2*N+L, if M = 0; LW4 = MAX( 5, NSMP*L + 2*NX + NSMP*L*( BSN + LTHS ) + MAX( L1 + NX, NSMP*L + L1, L2 ) ), L0 = MAX( N*(N+L), N+M+L ), if M > 0; L0 = MAX( N*(N+L), L ), if M = 0; L1 = NSMP*L + MAX( 2*NN, (N+L)*(N+M) + 2*N + L0); L2 = NX*NX, if ALG = 'D' and STOR = 'F'; L2 = NX*(NX+1)/2, if ALG = 'D' and STOR = 'P'; L2 = 3*NX + NSMP*L, if ALG = 'I', with BSN = NN*( L + 2 ) + 1, LTHS = N*( L + M + 1 ) + L*M. For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; < 0: the user set IFLAG = IWARN in (one of) the subroutine(s) FCN, i.e., NF01BA, if INIT = 'S' or 'B', and/or NF01BB; this value cannot be returned without changing the FCN routine(s); otherwise, IWARN has the value k*100 + j*10 + i, where k is defined below, i refers to the whole optimization process, and j refers to the initialization step (j = 0, if INIT = 'L' or 'N'), and the possible values for i and j have the following meaning (where TOL* denotes TOL1 or TOL2, and similarly for ITMAX*): = 1: the number of iterations has reached ITMAX* without satisfying the convergence condition; = 2: if alg = 'I' and in an iteration of the Levenberg- Marquardt algorithm, the CG algorithm finished after 3*NX iterations (or 3*(lin1-1) iterations, for the initialization phase), without achieving the precision required in the call; = 3: the cosine of the angle between the vector of error function values and any column of the Jacobian is at most FACTOR*EPS in absolute value (FACTOR = 100); = 4: TOL* is too small: no further reduction in the sum of squares is possible. The digit k is normally 0, but if INIT = 'L' or 'B', it can have a value in the range 1 to 6 (see IB01AD, IB01BD and IB01CD). In all these cases, the entries DWORK(1:5), DWORK(6:10) (if INIT = 'S' or 'B'), and DWORK(11:10+IWORK(3)) (if INIT = 'L' or 'B'), are set as described above.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; otherwise, INFO has the value k*100 + j*10 + i, where k is defined below, i refers to the whole optimization process, and j refers to the initialization step (j = 0, if INIT = 'L' or 'N'), and the possible values for i and j have the following meaning: = 1: the routine FCN returned with INFO <> 0 for IFLAG = 1; = 2: the routine FCN returned with INFO <> 0 for IFLAG = 2; = 3: ALG = 'D' and SLICOT Library routines MB02XD or NF01BU (or NF01BV, if INIT = 'S' or 'B') or ALG = 'I' and SLICOT Library routines MB02WD or NF01BW (or NF01BX, if INIT = 'S' or 'B') returned with INFO <> 0. In addition, if INIT = 'L' or 'B', i could also be = 4: if a Lyapunov equation could not be solved; = 5: if the identified linear system is unstable; = 6: if the QR algorithm failed on the state matrix of the identified linear system. The digit k is normally 0, but if INIT = 'L' or 'B', it can have a value in the range 1 to 10 (see IB01AD/IB01BD).Method
If INIT = 'L' or 'B', the linear part of the system is approximated using the combined MOESP and N4SID algorithm. If necessary, this algorithm can also choose the order, but it is advantageous if the order is already known. If INIT = 'S' or 'B', the output of the approximated linear part is computed and used to calculate an approximation of the static nonlinearity using the Levenberg-Marquardt algorithm [1]. This step is referred to as the (nonlinear) initialization step. As last step, the Levenberg-Marquardt algorithm is used again to optimize the parameters of the linear part and the static nonlinearity as a whole. Therefore, it is necessary to parametrise the matrices of the linear part. The output normal form [2] parameterisation is used. The Jacobian is computed analytically, for the nonlinear part, and numerically, for the linear part.References
[1] Kelley, C.T. Iterative Methods for Optimization. Society for Industrial and Applied Mathematics (SIAM), Philadelphia (Pa.), 1999. [2] Peeters, R.L.M., Hanzon, B., and Olivi, M. Balanced realizations of discrete-time stable all-pass systems and the tangential Schur algorithm. Proceedings of the European Control Conference, 31 August - 3 September 1999, Karlsruhe, Germany. Session CP-6, Discrete-time Systems, 1999.Further Comments
NoneExample
Program Text
* IB03AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LDU, LDY, LIWORK, LMAX, MMAX, NMAX, NNMAX, $ NOBRMX, NSMPMX PARAMETER ( LMAX = 2, MMAX = 3, NOBRMX = 10, NNMAX = 12, $ NMAX = 4, NSMPMX = 1024, $ LDU = NSMPMX, LDY = NSMPMX, $ LIWORK = MAX( MMAX + LMAX, MMAX*NOBRMX + NMAX, $ MMAX*( NMAX + LMAX ) ) ) INTEGER BSNM, L0, L1M, L2M, LDW1, LDW2, LDW3, LDW4, $ LDW5, LDW6, LDW7, LDW8, LDWORK, LTHS, LW1, LW2, $ LW3, LW4, LXM PARAMETER ( BSNM = NNMAX*( LMAX + 2 ) + 1, $ LTHS = NMAX*( LMAX + MMAX + 1 ) + LMAX*MMAX, $ L0 = MAX( NMAX*( NMAX + LMAX ), $ NMAX + MMAX + LMAX ), $ L1M = NSMPMX*LMAX + $ MAX( 2*NNMAX, $ ( NMAX + LMAX )*( NMAX + MMAX ) + $ 2*NMAX + L0 ), $ LXM = BSNM*LMAX + LTHS, $ L2M = MAX( LXM*LXM, 3*LXM + NSMPMX*LMAX ), $ LDW1 = MAX( 2*( LMAX*NOBRMX - LMAX )*NMAX + $ 2*NMAX, $ ( LMAX*NOBRMX - LMAX )*NMAX + $ NMAX*NMAX + 7*NMAX, $ LMAX*NOBRMX*NMAX + $ MAX( ( LMAX*NOBRMX - LMAX )*NMAX + $ 2*NMAX + LMAX + $ ( 2*MMAX + LMAX )*NOBRMX, $ 2*( LMAX*NOBRMX - LMAX )*NMAX $ + NMAX*NMAX + 8*NMAX, $ NMAX + 4*( MMAX*NOBRMX + $ NMAX ) + 1, $ MMAX*NOBRMX + 3*NMAX + LMAX ) $ ), $ LDW2 = LMAX*NOBRMX*NMAX + $ MMAX*NOBRMX*( NMAX + LMAX )* $ ( MMAX*( NMAX + LMAX ) + 1 ) + $ MAX( ( NMAX + LMAX )**2, $ 4*MMAX*( NMAX + LMAX ) + 1 ), $ LDW3 = NSMPMX*LMAX*( NMAX + 1 ) + 2*NMAX + $ MAX( 2*NMAX*NMAX, 4*NMAX ), $ LDW4 = NMAX*( NMAX + 1 ) + 2*NMAX + $ MAX( NMAX*LMAX*( NMAX + 1 ) + $ 2*NMAX*NMAX + LMAX*NMAX, 4*NMAX ), $ LDW5 = NSMPMX*LMAX + ( NMAX + LMAX )* $ ( NMAX + MMAX ) + 3*NMAX + MMAX + LMAX, $ LDW6 = NSMPMX*LMAX + ( NMAX + LMAX )* $ ( NMAX + MMAX ) + NMAX + $ MAX( 1, NMAX*NMAX*LMAX + NMAX*LMAX + $ NMAX, NMAX*NMAX + $ MAX( NMAX*NMAX + $ NMAX*MAX( NMAX, LMAX ) + $ 6*NMAX + MIN( NMAX, LMAX ), $ NMAX*MMAX ) ), $ LDW7 = MAX( BSNM*BSNM, 3*BSNM + NSMPMX ), $ LDW8 = NSMPMX*LMAX + ( NMAX + LMAX )* $ ( NMAX + MMAX ) + 3*NMAX + MMAX + LMAX, $ LW1 = MAX( 2*( MMAX + LMAX )*NOBRMX* $ ( 2*( MMAX + LMAX )*( NOBRMX + 1 ) $ + 3 ) + LMAX*NOBRMX, $ 4*( MMAX + LMAX )*NOBRMX* $ ( MMAX + LMAX )*NOBRMX + $ ( NMAX + LMAX )*( NMAX + MMAX ) + $ MAX( LDW1, LDW2 ), $ ( NMAX + LMAX )*( NMAX + MMAX ) + $ NMAX + NMAX*NMAX + 2 + $ NMAX*( NMAX + MMAX + LMAX ) + $ MAX( 5*NMAX, 2, MIN( LDW3, LDW4 ), $ LDW5, LDW6 ) ), $ LW2 = NSMPMX*LMAX + $ MAX( 5, NSMPMX + 2*BSNM + NSMPMX*BSNM + $ MAX( 2*NNMAX + BSNM, LDW7 ) ), $ LW3 = MAX( LDW8, NSMPMX*LMAX + $ ( NMAX + LMAX )*( 2*NMAX + MMAX )+ $ 2*NMAX ), $ LW4 = MAX( 5, NSMPMX*LMAX + 2*LXM + $ NSMPMX*LMAX*( BSNM + LTHS ) + $ MAX( L1M + LXM, NSMPMX*LMAX + L1M, $ L2M ) ), $ LDWORK = MAX( LW1, LW2, LW3, LW4 ) ) * .. Local Scalars .. LOGICAL INIT1, INITB, INITL, INITN, INITS CHARACTER*1 ALG, INIT, STOR INTEGER BSN, I, INFO, INI, ITER, ITERCG, ITMAX1, ITMAX2, $ IWARN, J, L, L1, L2, LPAR, LX, M, N, NN, NOBR, $ NPRINT, NS, NSMP DOUBLE PRECISION TOL1, TOL2 * .. Array Arguments .. INTEGER IWORK(LIWORK) DOUBLE PRECISION DWORK(LDWORK), U(LDU,MMAX), X(LXM), Y(LDY,LMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL IB03AD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) NOBR, M, L, NSMP, N, NN, ITMAX1, ITMAX2, $ NPRINT, TOL1, TOL2, INIT, ALG, STOR INITL = LSAME( INIT, 'L' ) INITS = LSAME( INIT, 'S' ) INITB = LSAME( INIT, 'B' ) INITN = LSAME( INIT, 'N' ) INIT1 = INITL .OR. INITB IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE IF( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99992 ) L ELSE NS = N IF( INIT1 ) THEN IF( NOBR.LE.0 .OR. NOBR.GT.NOBRMX ) THEN WRITE ( NOUT, FMT = 99991 ) NOBR STOP ELSEIF( NSMP.LT.2*( M + L + 1 )*NOBR - 1 ) THEN WRITE ( NOUT, FMT = 99990 ) NSMP STOP ELSEIF( N.EQ.0 .OR. N.GE.NOBR ) THEN WRITE ( NOUT, FMT = 99989 ) N STOP END IF IF ( N.LT.0 ) $ N = NOBR - 1 ELSE IF( NSMP.LT.0 ) THEN WRITE ( NOUT, FMT = 99990 ) NSMP STOP ELSEIF( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99989 ) N STOP END IF END IF IF( NN.LT.0 .OR. NN.GT.NNMAX ) THEN WRITE ( NOUT, FMT = 99988 ) NN ELSE BSN = NN*( L + 2 ) + 1 L1 = BSN*L L2 = N*( L + M + 1 ) + L*M LX = L1 + L2 INI = 1 IF ( INITL ) THEN LPAR = L1 ELSEIF ( INITS ) THEN INI = L1 + 1 LPAR = L2 ELSEIF ( INITN ) THEN LPAR = LX END IF IF( INIT1 ) $ N = NS * Read the input-output data, initial parameters, and seed. READ ( NIN, FMT = * ) ( ( U(I,J), J = 1,M ), I = 1,NSMP ) READ ( NIN, FMT = * ) ( ( Y(I,J), J = 1,L ), I = 1,NSMP ) IF ( .NOT.INITB ) $ READ ( NIN, FMT = * ) ( X(I), I = INI,INI+LPAR-1 ) IF ( INITS .OR. INITB ) $ READ ( NIN, FMT = * ) ( DWORK(I), I = 1,4 ) * Solve a Wiener system identification problem. CALL IB03AD( INIT, ALG, STOR, NOBR, M, L, NSMP, N, NN, $ ITMAX1, ITMAX2, NPRINT, U, LDU, Y, LDY, $ X, LX, TOL1, TOL2, IWORK, DWORK, LDWORK, $ IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( IWARN.NE.0 ) WRITE ( NOUT, FMT = 99987 ) IWARN ITER = DWORK(3) ITERCG = DWORK(4) WRITE ( NOUT, FMT = 99997 ) DWORK(2) WRITE ( NOUT, FMT = 99996 ) ITER, ITERCG, $ IWORK(1), IWORK(2) * Recompute LX is necessary. IF ( INIT1 .AND. NS.LT.0 ) $ LX = L1 + N*( L + M + 1 ) + L*M WRITE ( NOUT, FMT = 99994 ) WRITE ( NOUT, FMT = 99995 ) ( X(I), I = 1, LX ) END IF END IF END IF END IF STOP * 99999 FORMAT (' IB03AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from IB03AD = ',I4) 99997 FORMAT (/' Final 2-norm of the residuals = ',D15.7) 99996 FORMAT (/' Number of iterations = ', I7, $ /' Number of conjugate gradients iterations = ', I7, $ /' Number of function evaluations = ', I7, $ /' Number of Jacobian evaluations = ', I7) 99995 FORMAT (10(1X,F8.4)) 99994 FORMAT (/' Final approximate solution is ' ) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' L is out of range.',/' L = ',I5) 99991 FORMAT (/' NOBR is out of range.',/' NOBR = ',I5) 99990 FORMAT (/' NSMP is out of range.',/' NSMP = ',I5) 99989 FORMAT (/' N is out of range.',/' N = ',I5) 99988 FORMAT (/' NN is out of range.',/' NN = ',I5) 99987 FORMAT (' IWARN on exit from IB03AD = ',I4) ENDProgram Data
IB03AD EXAMPLE PROGRAM DATA 10 1 1 1024 4 12 500 1000 0 .00001 .00001 B D F 2.2183165e-01 3.9027807e-02 -5.0295887e-02 8.5386224e-03 7.2431159e-02 -1.7082198e-03 -1.7176287e-01 -2.6198104e-01 -1.7194108e-01 1.8566868e-02 1.5625362e-01 1.7463811e-01 1.1564450e-01 2.8779248e-02 -8.4265993e-02 -2.0978501e-01 -2.6591828e-01 -1.7268680e-01 2.1525013e-02 1.4363602e-01 7.3101431e-02 -1.0259212e-01 -1.6380473e-01 -1.0021167e-02 2.0263451e-01 2.1983417e-01 -2.1636523e-02 -3.0986057e-01 -3.8521982e-01 -2.1785179e-01 -1.4761096e-02 3.7005180e-02 -2.8119028e-02 -4.2167901e-02 5.2117694e-02 1.2023747e-01 1.8863385e-02 -1.9506434e-01 -3.0192175e-01 -1.7000747e-01 8.0740471e-02 2.0188076e-01 8.5108288e-02 -1.3270970e-01 -2.3646822e-01 -1.6505385e-01 -4.7448014e-02 -2.7886815e-02 -1.0152026e-01 -1.4155374e-01 -6.1650823e-02 8.3519614e-02 1.5926650e-01 8.6142760e-02 -9.4385381e-02 -2.6609066e-01 -3.2883874e-01 -2.5908050e-01 -1.1648940e-01 -3.0653766e-03 1.0326675e-02 -5.3445909e-02 -9.2412724e-02 -3.0279541e-02 8.4846832e-02 1.1133075e-01 -3.2135250e-02 -2.5308181e-01 -3.5670882e-01 -2.4458860e-01 -2.5254261e-02 9.3714332e-02 1.8643667e-02 -1.4592119e-01 -2.2730880e-01 -1.7140060e-01 -7.4131665e-02 -3.9669515e-02 -5.1266129e-02 -1.1752833e-02 1.0785565e-01 2.0665525e-01 1.6117322e-01 -2.6938653e-02 -2.1941152e-01 -2.7753567e-01 -1.8805912e-01 -4.6845025e-02 5.8585698e-02 1.2218407e-01 1.7838638e-01 2.2169815e-01 1.9825589e-01 8.0215288e-02 -7.2135308e-02 -1.4381520e-01 -6.8724371e-02 1.0191205e-01 2.3766633e-01 2.3876101e-01 1.1678077e-01 -2.0428168e-02 -5.8973233e-02 3.1326900e-02 1.7391495e-01 2.4558570e-01 1.7650262e-01 1.2444292e-02 -1.1538234e-01 -9.5917970e-02 6.4762165e-02 2.4258524e-01 3.0102251e-01 2.1222960e-01 7.8706189e-02 3.1500466e-02 1.0297577e-01 1.9875173e-01 1.9434906e-01 5.8146667e-02 -1.1941921e-01 -2.1038478e-01 -1.5594967e-01 1.8552198e-03 1.6878529e-01 2.5937416e-01 2.2516346e-01 6.6144472e-02 -1.5623019e-01 -3.3161105e-01 -3.6695732e-01 -2.6565333e-01 -1.3254832e-01 -8.0101064e-02 -1.2531889e-01 -1.8843171e-01 -1.9038956e-01 -1.3230055e-01 -7.0889306e-02 -3.9679280e-02 -2.6286077e-02 -2.3630770e-02 -6.0652834e-02 -1.4929250e-01 -2.2155095e-01 -1.7331044e-01 5.2693564e-03 1.7683919e-01 1.8244690e-01 2.5118458e-02 -1.1051051e-01 -5.1764984e-02 1.6342054e-01 3.1563281e-01 2.3808751e-01 -4.4871135e-03 -1.8778679e-01 -1.6017584e-01 2.3481991e-02 1.9209185e-01 2.4281065e-01 2.1224192e-01 1.8825017e-01 1.9811718e-01 2.0202486e-01 1.6812825e-01 1.1444796e-01 7.2452475e-02 4.0090973e-02 -6.7139529e-03 -6.8721730e-02 -1.1460099e-01 -1.1914168e-01 -8.9852521e-02 -4.5942222e-02 1.0932686e-02 8.1900393e-02 1.3092374e-01 9.0790221e-02 -6.3538148e-02 -2.5119963e-01 -3.2585173e-01 -2.0850925e-01 1.7922009e-02 1.6783753e-01 1.2518317e-01 -4.3517162e-02 -1.5783138e-01 -1.0686847e-01 4.4782565e-02 1.3893172e-01 9.8691579e-02 2.6311282e-03 -1.6073049e-02 7.8512306e-02 1.9453537e-01 2.2504627e-01 1.6121235e-01 7.8124056e-02 2.9774586e-02 -5.3899280e-03 -6.5745322e-02 -1.2329059e-01 -9.5096521e-02 5.5471394e-02 2.5017082e-01 3.4773286e-01 2.6656242e-01 5.3705965e-02 -1.6135006e-01 -2.7310977e-01 -2.6814818e-01 -2.1074926e-01 -1.7743213e-01 -1.9796482e-01 -2.4059041e-01 -2.4663820e-01 -1.8780129e-01 -9.8317382e-02 -4.7848155e-02 -7.3425069e-02 -1.3529842e-01 -1.4739094e-01 -6.2482366e-02 6.8729554e-02 1.3251322e-01 6.1482940e-02 -8.5065014e-02 -1.6074078e-01 -6.7974104e-02 1.3976672e-01 2.9838081e-01 2.8233998e-01 1.1391411e-01 -7.1966946e-02 -1.5876983e-01 -1.3805556e-01 -8.2998592e-02 -5.7864811e-02 -6.5300733e-02 -7.0590592e-02 -5.5847027e-02 -4.1219301e-02 -6.1578267e-02 -1.3176243e-01 -2.2968907e-01 -3.0193311e-01 -2.8770451e-01 -1.5729276e-01 5.4414593e-02 2.5362617e-01 3.4482230e-01 3.0119122e-01 1.8534835e-01 9.6712488e-02 9.3385279e-02 1.6057572e-01 2.4424680e-01 3.0164891e-01 3.1693510e-01 2.8441517e-01 1.9948758e-01 7.3600888e-02 -5.4291337e-02 -1.3721320e-01 -1.5626045e-01 -1.3464149e-01 -1.1510541e-01 -1.2587072e-01 -1.6605420e-01 -2.1242088e-01 -2.3059410e-01 -1.8785957e-01 -7.8188380e-02 5.0484398e-02 1.0697957e-01 2.7421051e-02 -1.4419852e-01 -2.5888039e-01 -1.8018121e-01 7.8519535e-02 3.4009981e-01 4.0793257e-01 2.3842529e-01 -2.7029751e-02 -1.9919385e-01 -2.0420528e-01 -1.1389043e-01 -3.5602606e-02 5.7385906e-04 3.8759790e-02 1.0691941e-01 1.6303496e-01 1.4314046e-01 4.7786789e-02 -4.1030659e-02 -3.5960232e-02 7.0498851e-02 2.0120383e-01 2.6638170e-01 2.3249669e-01 1.2937468e-01 1.3309043e-02 -6.2770099e-02 -5.8936178e-02 3.4143049e-02 1.6425689e-01 2.2228910e-01 1.2062705e-01 -1.0832755e-01 -3.0711352e-01 -3.2002334e-01 -1.4072879e-01 7.6263091e-02 1.6385270e-01 1.0093887e-01 1.7269577e-02 4.3458474e-02 1.6769625e-01 2.4967945e-01 1.7314220e-01 -2.7519776e-02 -1.9806822e-01 -2.1140982e-01 -7.2758850e-02 1.1057470e-01 2.3440218e-01 2.5956640e-01 1.9629970e-01 7.2200120e-02 -6.6390448e-02 -1.4805958e-01 -1.1487691e-01 1.3561014e-02 1.3146288e-01 1.3205007e-01 1.5159726e-02 -9.9141126e-02 -7.9831031e-02 8.4487631e-02 2.6348526e-01 2.9617209e-01 1.3322758e-01 -1.1642178e-01 -2.7289866e-01 -2.2996687e-01 -3.5143323e-02 1.5983180e-01 2.3035457e-01 1.7179773e-01 7.3333592e-02 1.1653452e-02 -1.8499701e-02 -6.7962911e-02 -1.4361094e-01 -1.7665147e-01 -9.1259528e-02 9.8323111e-02 2.6912800e-01 2.8047779e-01 9.9377687e-02 -1.5436535e-01 -2.9569363e-01 -2.3017874e-01 -4.1007324e-02 8.2484352e-02 2.1760384e-02 -1.5212456e-01 -2.4257965e-01 -1.2641528e-01 1.0676585e-01 2.2865135e-01 1.0211687e-01 -1.6408728e-01 -3.0761461e-01 -1.7309336e-01 1.2302931e-01 3.0157576e-01 1.9992664e-01 -6.5766948e-02 -2.2490680e-01 -1.3209725e-01 9.1452627e-02 1.9707770e-01 7.0972862e-02 -1.6016460e-01 -2.7859962e-01 -2.0288880e-01 -4.9817844e-02 1.3587087e-02 -5.2447125e-02 -1.4164147e-01 -1.3776729e-01 -3.9470574e-02 5.4688171e-02 5.9780155e-02 -2.0666265e-02 -1.2306679e-01 -1.9150051e-01 -1.9953793e-01 -1.3072099e-01 1.7129752e-02 1.9139299e-01 2.8015628e-01 1.9737258e-01 -1.0273734e-02 -1.6921879e-01 -1.2914132e-01 8.3866166e-02 2.8290870e-01 3.0288568e-01 1.5939055e-01 1.4121758e-02 -8.0309556e-03 5.7046152e-02 7.8808779e-02 -4.0300321e-04 -9.3021531e-02 -6.6955916e-02 1.0073094e-01 2.8905786e-01 3.4946321e-01 2.4220689e-01 5.3331283e-02 -1.0609621e-01 -1.9358889e-01 -2.2728166e-01 -2.1680862e-01 -1.4144032e-01 -5.2173696e-03 1.1701944e-01 1.2668247e-01 4.8375112e-03 -1.4889224e-01 -1.9905951e-01 -9.9563224e-02 6.4580042e-02 1.5505008e-01 9.7617503e-02 -6.4905019e-02 -2.1769152e-01 -2.6787937e-01 -2.0919394e-01 -1.1033568e-01 -4.3266567e-02 -1.8066266e-02 1.3641281e-02 9.0806946e-02 1.8645977e-01 2.3150216e-01 1.9334856e-01 1.1238648e-01 4.9498545e-02 1.3155560e-02 -3.5876844e-02 -1.0537074e-01 -1.2612890e-01 -1.8934023e-02 1.8850628e-01 3.4290627e-01 3.0108912e-01 9.0554124e-02 -9.4812468e-02 -8.8842381e-02 6.3160674e-02 1.4646977e-01 1.7441277e-02 -2.2104173e-01 -3.1862778e-01 -1.5530235e-01 1.1291463e-01 2.1663682e-01 7.1521680e-02 -1.2722266e-01 -1.3147084e-01 6.8036453e-02 2.2914846e-01 1.4875917e-01 -8.5725554e-02 -1.9280127e-01 -3.7053987e-02 1.9484616e-01 2.0627194e-01 -5.0290692e-02 -2.9703694e-01 -2.4262627e-01 7.3980280e-02 3.1209111e-01 2.0500085e-01 -1.4678863e-01 -3.9620361e-01 -3.3299784e-01 -8.5315346e-02 7.0026906e-02 3.1783466e-02 -5.6224174e-02 -3.8238612e-02 4.1162402e-02 1.4020902e-02 -1.6267337e-01 -3.2229719e-01 -2.8405914e-01 -8.0208074e-02 7.7279407e-02 5.2461001e-02 -5.6931255e-02 -5.7081867e-02 8.4722273e-02 1.8989091e-01 9.1251490e-02 -1.4913841e-01 -3.0047660e-01 -2.2924644e-01 -4.5027749e-02 4.5847665e-02 -1.0582268e-02 -7.0165157e-02 8.8253349e-03 1.7968871e-01 2.6336655e-01 1.6274839e-01 -3.4038513e-02 -1.6866975e-01 -1.7822821e-01 -1.1212378e-01 -2.2511191e-02 9.2633595e-02 2.2273027e-01 2.8312792e-01 1.8855450e-01 -1.3339719e-02 -1.4451328e-01 -7.9411873e-02 9.5243626e-02 1.5825934e-01 8.6924573e-03 -1.9762612e-01 -2.0963986e-01 3.0881541e-02 3.1088543e-01 3.7605990e-01 2.0371110e-01 3.1659734e-03 -4.2255731e-02 2.7937777e-02 4.3768827e-02 -5.0975761e-02 -1.2013869e-01 -1.9514056e-02 1.9409077e-01 3.0061057e-01 1.6772761e-01 -8.4377993e-02 -2.0596833e-01 -8.8137439e-02 1.3053768e-01 2.3231724e-01 1.5592782e-01 3.3546556e-02 1.2609146e-02 8.8143918e-02 1.3076425e-01 5.2445727e-02 -9.1540218e-02 -1.6532665e-01 -8.9700956e-02 9.2256458e-02 2.6287064e-01 3.2206114e-01 2.4782579e-01 1.0180547e-01 -1.2653507e-02 -2.4053903e-02 4.5165362e-02 9.2697417e-02 3.9645255e-02 -7.0244568e-02 -9.7812594e-02 4.0489353e-02 2.5706426e-01 3.5970764e-01 2.4838839e-01 2.8758245e-02 -9.2051146e-02 -1.8531616e-02 1.4540527e-01 2.2483594e-01 1.6366159e-01 6.0613849e-02 2.6700790e-02 4.8805007e-02 2.4088984e-02 -8.7776563e-02 -1.9182802e-01 -1.5875230e-01 2.1332672e-02 2.1574747e-01 2.8121193e-01 1.9605244e-01 5.2140821e-02 -6.0594054e-02 -1.3111027e-01 -1.9003660e-01 -2.3031943e-01 -1.9896872e-01 -7.1576527e-02 8.7126470e-02 1.5966083e-01 8.0700885e-02 -9.6050487e-02 -2.3768453e-01 -2.4174619e-01 -1.1781079e-01 2.4058534e-02 6.3114157e-02 -3.4924911e-02 -1.8708629e-01 -2.5777811e-01 -1.7457598e-01 2.3256558e-03 1.2615984e-01 9.1298660e-02 -7.2869748e-02 -2.3064584e-01 -2.6487668e-01 -1.7896622e-01 -8.1019614e-02 -7.2160218e-02 -1.5109102e-01 -2.2270453e-01 -1.9311631e-01 -5.5949947e-02 1.0558527e-01 1.9015867e-01 1.5010510e-01 9.3491571e-03 -1.6206410e-01 -2.7872156e-01 -2.6789883e-01 -1.0908763e-01 1.3219241e-01 3.2581004e-01 3.6597785e-01 2.5860903e-01 1.1593033e-01 5.3232658e-02 8.9253999e-02 1.5038178e-01 1.6325136e-01 1.2516262e-01 8.1000365e-02 5.6249003e-02 4.1260796e-02 3.6021307e-02 7.0909773e-02 1.5431016e-01 2.1909293e-01 1.6946538e-01 1.3913978e-03 -1.5472276e-01 -1.5445369e-01 -6.5114694e-03 1.1511921e-01 5.3537688e-02 -1.4926948e-01 -2.8563000e-01 -2.0489020e-01 2.2256191e-02 1.8089745e-01 1.3686717e-01 -4.3194077e-02 -1.9185844e-01 -2.2260927e-01 -1.8688905e-01 -1.7299493e-01 -1.9552456e-01 -2.0311384e-01 -1.6521655e-01 -1.1035364e-01 -7.5596967e-02 -5.2167223e-02 -5.0648414e-03 6.7754101e-02 1.2412118e-01 1.2838133e-01 9.0308482e-02 4.0708671e-02 -1.2463102e-02 -7.6325303e-02 -1.2432208e-01 -9.0380523e-02 5.7426602e-02 2.4318485e-01 3.1839858e-01 2.0029814e-01 -2.6893656e-02 -1.7351791e-01 -1.2458940e-01 4.6580380e-02 1.5624992e-01 9.9382689e-02 -5.1882624e-02 -1.4100610e-01 -1.0040874e-01 -1.2845131e-02 -3.6737447e-03 -9.7637188e-02 -2.0172142e-01 -2.1938378e-01 -1.5223806e-01 -7.5818447e-02 -3.6932476e-02 -8.3361793e-03 4.9321106e-02 1.0828653e-01 8.6261922e-02 -5.6487106e-02 -2.4839500e-01 -3.5078033e-01 -2.7598256e-01 -6.2963150e-02 1.5901166e-01 2.7685307e-01 2.7164897e-01 2.1079033e-01 1.7714997e-01 2.0086813e-01 2.4438441e-01 2.4570310e-01 1.8078261e-01 9.0365447e-02 4.4844498e-02 7.6311118e-02 1.4103984e-01 1.5313326e-01 6.6678933e-02 -6.7720328e-02 -1.3565971e-01 -6.6316159e-02 8.3832277e-02 1.6588475e-01 7.6147385e-02 -1.3444251e-01 -2.9759248e-01 -2.8274479e-01 -1.1318459e-01 7.1421886e-02 1.5414324e-01 1.3182338e-01 8.0829372e-02 6.0814130e-02 6.6565578e-02 6.1490382e-02 3.4525574e-02 1.4709018e-02 3.9340413e-02 1.1733787e-01 2.1846966e-01 2.8684125e-01 2.6688313e-01 1.3632576e-01 -6.7370697e-02 -2.5502586e-01 -3.3949317e-01 -3.0013913e-01 -1.9871892e-01 -1.2610649e-01 -1.2941580e-01 -1.8923457e-01 -2.5813995e-01 -3.0533743e-01 -3.1970649e-01 -2.8788006e-01 -1.9500297e-01 -5.4155345e-02 8.1116905e-02 1.5269009e-01 1.4976106e-01 1.1681611e-01 1.0728712e-01 1.3670700e-01 1.8344060e-01 2.2041268e-01 2.2972773e-01 1.9334746e-01 9.8734288e-02 -2.6231283e-02 -9.9070456e-02 -4.1644202e-02 1.2360480e-01 2.5212308e-01 1.9060093e-01 -6.5066267e-02 -3.3581971e-01 -4.0871250e-01 -2.3222990e-01 4.0796545e-02 2.0553146e-01 1.9047036e-01 8.7982654e-02 2.1078714e-02 1.1947834e-02 -7.4158796e-03 -8.0649898e-02 -1.5932177e-01 -1.5963498e-01 -6.7654645e-02 3.3754864e-02 4.5488264e-02 -5.1656648e-02 -1.8439778e-01 -2.5821552e-01 -2.3168258e-01 -1.3075945e-01 -1.4319768e-02 6.0276859e-02 5.2808278e-02 -4.2009846e-02 -1.6857834e-01 -2.1862301e-01 -1.0815610e-01 1.2758494e-01 3.3007803e-01 3.4236071e-01 1.5606744e-01 -7.3906241e-02 -1.7487103e-01 -1.1779263e-01 -2.8797157e-02 -4.2649366e-02 -1.5603253e-01 -2.3465677e-01 -1.6213440e-01 3.1155521e-02 1.9455902e-01 2.0308035e-01 6.4105637e-02 -1.1373221e-01 -2.2912186e-01 -2.4930244e-01 -1.8794162e-01 -6.9023299e-02 6.6894859e-02 1.4860950e-01 1.1319286e-01 -2.1622177e-02 -1.4430675e-01 -1.4139382e-01 -1.4679189e-02 1.0606471e-01 8.3987908e-02 -8.6549724e-02 -2.6473902e-01 -2.8787546e-01 -1.1665499e-01 1.3032718e-01 2.7649250e-01 2.2886289e-01 4.1972959e-02 -1.4166947e-01 -2.1351821e-01 -1.7294568e-01 -9.5242426e-02 -3.9988034e-02 6.0215518e-04 6.4278100e-02 1.4411085e-01 1.7008073e-01 7.6346726e-02 -1.1397897e-01 -2.7942868e-01 -2.8837790e-01 -1.1356283e-01 1.2995490e-01 2.6791352e-01 2.1050936e-01 3.2758432e-02 -8.8492035e-02 -3.6187051e-02 1.3102808e-01 2.2789768e-01 1.2664599e-01 -9.9240525e-02 -2.3008477e-01 -1.1958430e-01 1.3943384e-01 2.8863442e-01 1.6130336e-01 -1.3747854e-01 -3.2522857e-01 -2.2524885e-01 5.3864511e-02 2.3305883e-01 1.5177574e-01 -7.4373920e-02 -1.8870441e-01 -6.7093573e-02 1.6495747e-01 2.8369836e-01 2.0511206e-01 5.1011236e-02 -6.5929875e-03 6.8964562e-02 1.6340844e-01 1.5740112e-01 5.4023734e-02 -4.3471011e-02 -5.1346211e-02 2.3145779e-02 1.1745308e-01 1.8212689e-01 1.9584070e-01 1.4022670e-01 5.9022790e-03 -1.6079919e-01 -2.4935419e-01 -1.7100378e-01 3.1256057e-02 1.8605482e-01 1.4297623e-01 -7.3243962e-02 -2.7593402e-01 -2.9797544e-01 -1.5307840e-01 -4.0914832e-03 2.1269662e-02 -4.1497170e-02 -5.9046655e-02 2.7976789e-02 1.2846949e-01 1.0303296e-01 -7.5938937e-02 -2.8392411e-01 -3.6123552e-01 -2.5664252e-01 -5.3262494e-02 1.2879625e-01 2.3255706e-01 2.6842403e-01 2.5122050e-01 1.7087253e-01 3.4014290e-02 -9.3227815e-02 -1.2001867e-01 -2.1139059e-02 1.2023890e-01 1.7758447e-01 9.6606085e-02 -5.2792108e-02 -1.3892628e-01 -8.4350032e-02 7.1620365e-02 2.1524576e-01 2.5910116e-01 2.0627091e-01 1.2532985e-01 7.1727643e-02 3.8319163e-02 -1.9240088e-02 -1.1662856e-01 -2.1107703e-01 -2.4258539e-01 -1.9809090e-01 -1.2271124e-01 -6.5266079e-02 -2.6001544e-02 2.6587042e-02 8.9979857e-02 1.0112134e-01 -1.6495775e-03 -1.8712095e-01 -3.2285436e-01 -2.8769737e-01 -1.0373843e-01 6.3283390e-02 6.4192144e-02 -6.9141383e-02 -1.4546154e-01 -2.2743165e-02 2.1671482e-01 3.3495240e-01 1.9730942e-01 -6.4245098e-02 -1.8430371e-01 -5.9313975e-02 1.3285821e-01 1.3988590e-01 -6.3313853e-02 -2.3781208e-01 -1.6565753e-01 7.8634007e-02 2.0643470e-01 6.3051903e-02 -1.7337120e-01 -1.9553447e-01 5.8877424e-02 3.1320739e-01 2.6455767e-01 -5.6738794e-02 -3.0614673e-01 -2.0738949e-01 1.4261991e-01 3.9321755e-01 3.3131011e-01 8.6485026e-02 -6.3943179e-02 -2.3354764e-02 5.9552949e-02 3.1845636e-02 -5.2189216e-02 -1.8514555e-02 1.7050716e-01 3.3649462e-01 2.9310084e-01 7.8582244e-02 -8.5200138e-02 -5.9242022e-02 5.3629257e-02 5.3919799e-02 -9.1290610e-02 -1.9983794e-01 -1.0236954e-01 1.3831631e-01 2.9035137e-01 -1.7703630e-01 -1.1470789e-01 -1.7257803e-02 7.3360924e-02 1.2806267e-01 1.3650217e-01 1.0539571e-01 5.4901306e-02 1.0347593e-02 -1.4210364e-02 -2.9316079e-02 -5.9818410e-02 -1.1287079e-01 -1.5651256e-01 -1.3759239e-01 -3.1325918e-02 1.2118952e-01 2.2925439e-01 2.1688928e-01 8.3280850e-02 -9.0968958e-02 -1.9863421e-01 -1.7919413e-01 -5.4874063e-02 9.1323774e-02 1.7241745e-01 1.4973591e-01 5.1202694e-02 -5.0722214e-02 -8.6474562e-02 -3.6675604e-02 5.0794719e-02 9.2852996e-02 3.5475423e-02 -9.8019853e-02 -2.1560266e-01 -2.2054921e-01 -8.4207430e-02 1.2773783e-01 2.9411889e-01 3.1432928e-01 1.7183620e-01 -5.3673166e-02 -2.3087548e-01 -2.5206313e-01 -9.9556443e-02 1.3579254e-01 3.0302360e-01 2.8345210e-01 6.9698019e-02 -2.2311064e-01 -4.2606792e-01 -4.1979542e-01 -2.0235411e-01 1.1680679e-01 3.8269042e-01 4.7499251e-01 3.6130151e-01 1.0698485e-01 -1.5666457e-01 -2.9684785e-01 -2.5130444e-01 -6.7456399e-02 1.2329504e-01 1.8968350e-01 8.9456729e-02 -1.0185072e-01 -2.4339863e-01 -2.2562726e-01 -4.5215735e-02 1.9190737e-01 3.3930982e-01 3.0360010e-01 1.0486525e-01 -1.3364785e-01 -2.6276635e-01 -2.0355127e-01 -1.0514338e-03 2.0109829e-01 2.5410141e-01 1.0538640e-01 -1.6182684e-01 -3.7724711e-01 -3.8906986e-01 -1.6075631e-01 2.0065197e-01 5.0030087e-01 5.6260189e-01 3.3306758e-01 -8.1981699e-02 -4.6637054e-01 -6.1157444e-01 -4.3578631e-01 -3.4787751e-02 3.6943357e-01 5.5331393e-01 4.1651911e-01 3.8203811e-02 -3.6624642e-01 -5.6531588e-01 -4.4111547e-01 -5.7977077e-02 3.6800859e-01 5.8749279e-01 4.6334166e-01 5.9154789e-02 -3.8817476e-01 -6.0585734e-01 -4.5438072e-01 -2.1770889e-02 4.2269933e-01 5.9388393e-01 3.7277877e-01 -1.1367643e-01 -5.6785416e-01 -7.0538273e-01 -4.3261293e-01 9.5667577e-02 5.7311674e-01 7.2849359e-01 4.8697304e-01 9.0040534e-03 -4.1643634e-01 -5.5375692e-01 -3.6053568e-01 1.0675442e-03 2.8391467e-01 3.2050851e-01 1.2014875e-01 -1.5499683e-01 -3.0636590e-01 -2.2845450e-01 3.0168597e-02 3.0447079e-01 4.1814633e-01 2.9408146e-01 3.3795396e-03 -2.8043536e-01 -3.9163122e-01 -2.7524621e-01 -1.6330862e-02 2.2338646e-01 3.1163298e-01 2.1884631e-01 2.0034460e-02 -1.6244160e-01 -2.3122765e-01 -1.5928083e-01 4.5460308e-03 1.6378113e-01 2.2566835e-01 1.5187573e-01 -1.8633628e-02 -1.8835877e-01 -2.5597784e-01 -1.7568160e-01 1.6144538e-02 2.1796548e-01 3.1334397e-01 2.3350541e-01 9.9054075e-04 -2.7139443e-01 -4.3349329e-01 -3.8409180e-01 -1.3941008e-01 1.6850242e-01 3.6865127e-01 3.5669633e-01 1.5962938e-01 -8.6421861e-02 -2.2603591e-01 -1.7879992e-01 1.5608870e-02 2.2316774e-01 2.9540664e-01 1.5777130e-01 -1.3932674e-01 -4.3707134e-01 -5.5308393e-01 -3.9056636e-01 -6.9866596e-03 4.0342788e-01 6.1470960e-01 5.0478901e-01 1.3556472e-01 -2.7661265e-01 -4.8754120e-01 -3.7410263e-01 -1.0933935e-02 3.7332700e-01 5.3265415e-01 3.5296792e-01 -7.5112937e-02 -5.0630963e-01 -6.8543131e-01 -5.0254861e-01 -6.3204556e-02 3.7616490e-01 5.6861420e-01 4.2839911e-01 7.7256895e-02 -2.4286013e-01 -3.2974149e-01 -1.4621212e-01 1.6396591e-01 3.7227253e-01 3.1398669e-01 -1.5203951e-03 -3.8826155e-01 -5.9422715e-01 -4.6290884e-01 -4.4082503e-02 4.2614489e-01 6.6944646e-01 5.4057059e-01 1.1914310e-01 -3.4186097e-01 -5.7361170e-01 -4.5144665e-01 -6.3037624e-02 3.5015696e-01 5.3940241e-01 3.9354970e-01 6.6063109e-05 -4.0735798e-01 -5.8396114e-01 -4.1610263e-01 1.0313382e-02 4.5449701e-01 6.5638620e-01 4.8903578e-01 3.8482894e-02 -4.3952337e-01 -6.6436421e-01 -4.9492372e-01 -1.7915270e-02 4.9445240e-01 7.3828446e-01 5.5772875e-01 4.3827397e-02 -5.1216643e-01 -7.8827423e-01 -6.2373284e-01 -1.1577453e-01 4.4053448e-01 7.3121649e-01 6.0691719e-01 1.6037942e-01 -3.4101558e-01 -6.1837622e-01 -5.3898039e-01 -1.7955555e-01 2.3296574e-01 4.6098842e-01 3.9204767e-01 9.4586522e-02 -2.3425494e-01 -3.9383077e-01 -2.9901136e-01 -2.1727093e-02 2.6290754e-01 3.8667642e-01 2.8641038e-01 3.4299620e-02 -2.1199530e-01 -3.0703990e-01 -2.0539827e-01 1.3733625e-02 1.9989717e-01 2.2856610e-01 8.0442398e-02 -1.4924794e-01 -3.1635143e-01 -3.2043874e-01 -1.6226330e-01 6.7449386e-02 2.5253008e-01 3.1855044e-01 2.6051993e-01 1.2699840e-01 -1.6342455e-02 -1.1750854e-01 -1.5094063e-01 -1.1699324e-01 -3.6407066e-02 5.7070826e-02 1.2470744e-01 1.3295525e-01 6.7237676e-02 -5.6199791e-02 -1.8928499e-01 -2.6860491e-01 -2.4751370e-01 -1.2546869e-01 4.7269068e-02 1.9379936e-01 2.5012057e-01 1.9757699e-01 6.9603172e-02 -6.6884197e-02 -1.4260360e-01 -1.1800895e-01 -4.5690911e-03 1.3505757e-01 2.1176910e-01 1.5667518e-01 -2.9715225e-02 -2.6058872e-01 -4.0072162e-01 -3.4636170e-01 -1.0002597e-01 2.1522385e-01 4.2116592e-01 3.9178740e-01 1.3552073e-01 -2.0194672e-01 -4.2193015e-01 -3.9351670e-01 -1.3365470e-01 2.0423921e-01 4.2544835e-01 4.1162219e-01 1.8730580e-01 -1.0283670e-01 -2.8986993e-01 -2.8756628e-01 -1.3866788e-01 2.8290398e-02 9.5513335e-02 3.5118646e-02 -8.2724881e-02 -1.5147446e-01 -1.0799938e-01 2.6949604e-02 1.6959254e-01 2.3358015e-01 1.8482066e-01 5.6424609e-02 -7.8806247e-02 -1.5583364e-01 -1.5299245e-01 -9.3729273e-02 -1.9708548e-02 3.8600307e-02 7.1469845e-02 7.8472613e-02 5.5625386e-02 -1.0621857e-03 -8.0782039e-02 -1.5057837e-01 -1.6705428e-01 -1.0304932e-01 2.9389143e-02 1.7801990e-01 2.7318425e-01 2.6234323e-01 1.3834554e-01 -5.4215912e-02 -2.3593270e-01 -3.2392000e-01 -2.6898405e-01 -8.5844039e-02 1.4215609e-01 2.9652172e-01 2.8801270e-01 1.1683545e-01 -1.1688760e-01 -2.6947626e-01 -2.4573958e-01 -6.4329645e-02 1.5353975e-01 2.6653313e-01 2.0755588e-01 2.4602079e-02 -1.5772495e-01 -2.2567844e-01 -1.4875573e-01 9.9414396e-03 1.4397851e-01 1.7486115e-01 9.6314112e-02 -3.2169687e-02 -1.2887854e-01 -1.3861783e-01 -5.9693947e-02 6.1826068e-02 1.6117670e-01 1.8758542e-01 1.2643056e-01 4.7038639e-03 -1.2089033e-01 -1.8936563e-01 -1.6676448e-01 -6.8240952e-02 4.6702545e-02 1.0911959e-01 8.7135042e-02 1.1538006e-02 -4.4789930e-02 -2.4262269e-02 6.5437901e-02 1.5116338e-01 1.4886934e-01 3.3820535e-02 -1.3097789e-01 -2.3522600e-01 -2.0099760e-01 -4.2018915e-02 1.4060900e-01 2.2430878e-01 1.4698003e-01 -4.9334401e-02 -2.4015379e-01 -2.9449301e-01 -1.5978257e-01 9.9469238e-02 3.3553927e-01 4.0432846e-01 2.5275189e-01 -4.8157255e-02 -3.4363559e-01 -4.8101858e-01 -3.9093124e-01 -1.2065446e-01 1.9561509e-01 4.0816957e-01 4.2449571e-01 2.4947873e-01 -2.2290220e-02 -2.5535821e-01 -3.3965313e-01 -2.4442241e-01 -3.2717407e-02 1.7386538e-01 2.6131002e-01 1.8344736e-01 -1.4617105e-02 -2.2004617e-01 -3.0989410e-01 -2.1648361e-01 2.9614296e-02 3.0600899e-01 4.6010027e-01 3.9585763e-01 1.3407054e-01 -1.9445050e-01 -4.2254041e-01 -4.4190341e-01 -2.6148822e-01 2.4561144e-03 1.9639531e-01 2.2058130e-01 8.8618067e-02 -8.2771773e-02 -1.5145974e-01 -4.8116921e-02 1.7081593e-01 3.5448643e-01 3.5655964e-01 1.3834184e-01 -1.9528570e-01 -4.5613811e-01 -4.9089820e-01 -2.7873232e-01 5.5837539e-02 3.2156811e-01 3.7683870e-01 2.1007687e-01 -6.1195486e-02 -2.6670692e-01 -2.8529736e-01 -1.1252984e-01 1.4069959e-01 3.1548805e-01 3.0070613e-01 1.0177110e-01 -1.6096596e-01 -3.2711612e-01 -2.9842835e-01 -9.9492033e-02 1.4305421e-01 2.8418081e-01 2.4879424e-01 7.0440776e-02 -1.3708347e-01 -2.5105923e-01 -2.1001593e-01 -4.5285982e-02 1.4155737e-01 2.4209754e-01 2.0725941e-01 7.3959838e-02 -6.6466455e-02 -1.3533231e-01 -1.1722667e-01 -5.6247689e-02 -8.2151160e-03 4.6646596e-03 -5.3013327e-05 6.4836935e-03 3.4885521e-02 7.2093769e-02 9.6085499e-02 9.0621414e-02 5.0063443e-02 -1.9216694e-02 -9.5194586e-02 -1.4177512e-01 -1.2554939e-01 -4.1561203e-02 7.4612994e-02 1.6458119e-01 1.8370169e-01 1.2694288e-01 2.5574339e-02 -7.6209464e-02 -1.4292208e-01 -1.5717793e-01 -1.2150507e-01 -5.7465582e-02 3.0433319e-03 3.8135050e-02 5.3444515e-02 7.4126764e-02 1.1232692e-01 1.4266966e-01 1.1713381e-01 1.2919877e-02 -1.3094351e-01 -2.2903887e-01 -2.1083457e-01 -7.7741149e-02 9.2251468e-02 1.9732652e-01 1.8027267e-01 6.1530912e-02 -8.1015797e-02 -1.6435623e-01 -1.4922825e-01 -5.8874212e-02 3.9408110e-02 7.8379546e-02 3.6886774e-02 -4.2241134e-02 -8.1505612e-02 -2.9557008e-02 9.2798034e-02 2.0055247e-01 2.0414883e-01 7.6944227e-02 -1.2029199e-01 -2.7519345e-01 -2.9408814e-01 -1.6081545e-01 5.1070794e-02 2.1840144e-01 2.3874816e-01 9.4335060e-02 -1.2904879e-01 -2.8774773e-01 -2.6899028e-01 -6.6408095e-02 2.1071698e-01 4.0356249e-01 3.9994180e-01 1.9633323e-01 -1.0730235e-01 -3.6601054e-01 -4.6248715e-01 -3.5922221e-01 -1.1354600e-01 1.4870456e-01 2.9521055e-01 2.5966678e-01 8.3040302e-02 -1.0914113e-01 -1.8742442e-01 -1.0478464e-01 7.3317409e-02 2.1546569e-01 2.1382067e-01 5.6531581e-02 -1.6427012e-01 -3.1183656e-01 -2.9186150e-01 -1.1383004e-01 1.1231696e-01 2.4506533e-01 2.0292544e-01 1.9811075e-02 -1.7391062e-01 -2.3677906e-01 -1.1242105e-01 1.2953875e-01 3.3467916e-01 3.5946938e-01 1.6169418e-01 -1.6880410e-01 -4.5538345e-01 -5.3000472e-01 -3.2991559e-01 5.7588162e-02 4.3386984e-01 5.9508457e-01 4.4813661e-01 6.8860243e-02 -3.3635714e-01 -5.4527976e-01 -4.4370745e-01 -8.9647493e-02 3.1753702e-01 5.4673805e-01 4.6318145e-01 1.0733728e-01 -3.1949400e-01 -5.6446899e-01 -4.7269412e-01 -8.8269356e-02 3.6150197e-01 5.9965309e-01 4.7275161e-01 5.2712510e-02 -4.0097128e-01 -6.0010920e-01 -4.1032807e-01 6.1089052e-02 5.2877389e-01 7.0388838e-01 4.7272792e-01 -3.2841140e-02 -5.1806125e-01 -7.0615746e-01 -5.0443062e-01 -5.3964611e-02 3.6781621e-01 5.2531916e-01 3.6514315e-01 3.1895267e-02 -2.4276338e-01 -2.9561167e-01 -1.2568333e-01 1.2380832e-01 2.6979551e-01 2.0920891e-01 -2.0179145e-02 -2.6980104e-01 -3.7620139e-01 -2.6519009e-01 -1.4966321e-04 2.5905182e-01 3.5875119e-01 2.4783584e-01 5.4317821e-03 -2.1770753e-01 -2.9814845e-01 -2.0810260e-01 -1.7395596e-02 1.5890290e-01 2.2758901e-01 1.6085463e-01 3.3576307e-03 -1.5297196e-01 -2.1737064e-01 -1.5023570e-01 1.2479222e-02 1.7606639e-01 2.4089523e-01 1.6216345e-01 -2.3230254e-02 -2.1504218e-01 -3.0098784e-01 -2.1779026e-01 8.8067567e-03 2.6812984e-01 4.1695437e-01 3.6159556e-01 1.2203070e-01 -1.7147580e-01 -3.5437470e-01 -3.3058973e-01 -1.3341351e-01 9.9954914e-02 2.1969740e-01 1.5589313e-01 -4.1996520e-02 -2.3771826e-01 -2.9083527e-01 -1.4002506e-01 1.5548285e-01 4.3862419e-01 5.3769302e-01 3.6811228e-01 -6.9569482e-03 -3.9769165e-01 -5.8956799e-01 -4.7193386e-01 -1.1138894e-01 2.8025332e-01 4.6943948e-01 3.4372376e-01 -1.6555081e-02 -3.8429530e-01 -5.2185674e-01 -3.2705351e-01 1.0055685e-01 5.1629500e-01 6.7570174e-01 4.8204840e-01 4.6679399e-02 -3.7892485e-01 -5.5799051e-01 -4.1189337e-01 -6.3130989e-02 2.4927425e-01 3.2624429e-01 1.3391859e-01 -1.7899014e-01 -3.7999275e-01 -3.0718591e-01 1.9919795e-02 4.0587411e-01 5.9872071e-01 4.5200311e-01 2.6827172e-02 -4.3774484e-01 -6.7014857e-01 -5.3423365e-01 -1.1312830e-01 3.4367827e-01 5.7281717e-01 4.5156693e-01 6.5481027e-02 -3.4683106e-01 -5.3783781e-01 -3.9562633e-01 -5.2304328e-03 4.0256826e-01 5.8408144e-01 4.2300297e-01 -1.8218267e-04 -4.4833216e-01 -6.5943295e-01 -5.0033881e-01 -5.1578103e-02 4.3192551e-01 6.6545648e-01 5.0237264e-01 2.6477477e-02 -4.8897549e-01 -7.3697545e-01 -5.5960739e-01 -4.7597748e-02 5.0867228e-01 7.8911527e-01 6.3269313e-01 1.3197226e-01 -4.2464681e-01 -7.2603682e-01 -6.1784801e-01 -1.8264666e-01 3.2014735e-01 6.1135123e-01 5.4895999e-01 1.9768580e-01 -2.2062099e-01 -4.6220719e-01 -4.0211731e-01 -9.9950534e-02 2.4465654e-01 4.1872319e-01 3.2500596e-01 3.2810917e-02 -2.7440750e-01 -4.1536442e-01 -3.1832701e-01 -5.5989066e-02 2.0726049e-01 3.1798239e-01 2.2484797e-01 5.1703651e-03 -1.8889751e-01 -2.2927380e-01 -9.1914974e-02 1.3314428e-01 3.0513495e-01 3.2224987e-01 1.7778028e-01 -4.7100451e-02 -2.4007922e-01 -3.2145867e-01 -2.7615883e-01 -1.4545755e-01 4.2822900e-03 1.1399372e-01 1.5138712e-01 1.1530153e-01 3.0234280e-02 -6.4234624e-02 -1.2615802e-01 -1.2407054e-01 -4.9317670e-02 7.5619816e-02 2.0015044e-01 2.6472178e-01 2.3118708e-01 1.0699863e-01 -5.5412012e-02 -1.8550876e-01 -2.3096135e-01 -1.8218227e-01 -7.2615500e-02 4.0881922e-02 1.0372451e-01 8.6362391e-02 -1.1351454e-03 -1.0889033e-01 -1.6548976e-01 -1.1405709e-01 4.6560657e-02 2.4386985e-01 3.6111476e-01 3.0662373e-01 8.1468123e-02 -2.0497551e-01 -3.9165036e-01 -3.6309524e-01 -1.2535574e-01 1.8954273e-01 3.9793935e-01 3.7486538e-01 1.3124068e-01 -1.9174474e-01 -4.0848802e-01 -4.0149539e-01 -1.8960477e-01 9.0301438e-02 2.7507284e-01 2.7972729e-01 1.4341274e-01 -1.2566755e-02 -7.8032703e-02 -2.7425697e-02 7.5351759e-02 1.3487633e-01 9.5488652e-02 -2.4590018e-02 -1.5233210e-01 -2.1189289e-01 -1.7248897e-01 -6.2455423e-02 5.4933614e-02 1.2398028e-01 1.2778044e-01 8.7386392e-02 3.4966577e-02 -1.0850501e-02 -4.6716543e-02 -6.9020828e-02 -6.3681635e-02 -1.6203206e-02 6.7394491e-02 1.5127737e-01 1.8399090e-01 1.2920707e-01 -7.0434827e-03 -1.7216342e-01 -2.8937677e-01 -2.9509198e-01 -1.7314710e-01 3.2745183e-02 2.3542177e-01 3.4097958e-01 2.9247721e-01 1.0411948e-01 -1.3495077e-01 -2.9868629e-01 -2.9240849e-01 -1.1517683e-01 1.2871323e-01 2.8803761e-01 2.6146766e-01 6.7234759e-02 -1.6729947e-01 -2.9180077e-01 -2.3297675e-01 -3.8493954e-02 1.6188055e-01 2.4607750e-01 1.7580193e-01 1.0770499e-02 -1.3917580e-01 -1.8630712e-01 -1.1496682e-01 1.8120146e-02 1.2605380e-01 1.4532251e-01 6.9056099e-02 -5.5814690e-02 -1.6001831e-01 -1.8912751e-01 -1.2778372e-01 -4.4698128e-03 1.2208903e-01 1.8963074e-01 1.6384408e-01 6.0799128e-02 -5.7339158e-02 -1.1860919e-01 -9.0086196e-02 -4.5798607e-03 6.0280807e-02 4.1676388e-02 -5.5180320e-02 -1.5518201e-01 -1.6828578e-01 -6.2049884e-02 1.0561621e-01 2.2337555e-01 2.0643187e-01 5.9839911e-02 -1.2043322e-01 -2.1083864e-01 -1.4415945e-01 4.3538937e-02 2.3203364e-01 2.9044234e-01 1.6171416e-01 -9.5674666e-02 -3.3749265e-01 -4.1795872e-01 -2.7746809e-01 2.0648626e-02 3.2603206e-01 4.8410918e-01 4.1672303e-01 1.5905611e-01 -1.6318595e-01 -3.9931562e-01 -4.4568803e-01 -2.9169291e-01 -2.0960934e-02 2.3175866e-01 3.4693819e-01 2.7877641e-01 7.7125945e-02 -1.4069530e-01 -2.5367798e-01 -2.0150506e-01 -1.6778161e-02 1.9116819e-01 2.9409556e-01 2.1593628e-01 -1.9610708e-02 -2.9401135e-01 -4.5512990e-01 -4.0311941e-01 -1.5075705e-01 1.7921653e-01 4.2153577e-01 4.6143206e-01 2.9688389e-01 3.5275834e-02 -1.7206796e-01 -2.2040717e-01 -1.1280250e-01 4.6014479e-02 1.2005000e-01 3.5297082e-02 -1.6459920e-01 -3.4121448e-01 -3.5130088e-01 -1.4787707e-01 1.7615712e-01 4.3972643e-01 4.8949447e-01 2.9899548e-01 -1.6059656e-02 -2.7414987e-01 -3.4124596e-01 -2.0476598e-01 3.1287353e-02 2.1535118e-01 2.3693813e-01 8.7039128e-02 -1.3914592e-01 -2.9731202e-01 -2.8057123e-01 -8.9244625e-02 1.6445576e-01 3.2621002e-01 2.9949560e-01 1.0678193e-01 -1.3016725e-01 -2.7225661e-01 -2.4687907e-01 -8.3173776e-02 1.1381888e-01 2.2819642e-01 1.9830143e-01 4.8505476e-02 -1.2763594e-01 -2.2560309e-01 -1.9560311e-01 -7.1212054e-02 6.0380807e-02 1.2445307e-01 1.0835168e-01 5.5609724e-02 1.7269294e-02 9.3997346e-03 1.1223045e-02 -4.3543819e-03 -4.2668837e-02 -8.5657964e-02 -1.0909342e-01 -9.7154374e-02 -4.6781850e-02 3.1101930e-02 1.0973840e-01 1.5122945e-01 1.2531404e-01 3.3620966e-02 -8.3194568e-02 -1.6716420e-01 1998. 1999. 2000. 2001.Program Results
IB03AD EXAMPLE PROGRAM RESULTS Final 2-norm of the residuals = 0.2970365D+00 Number of iterations = 87 Number of conjugate gradients iterations = 0 Number of function evaluations = 1322 Number of Jacobian evaluations = 105 Final approximate solution is -0.9728 0.6465 -1.2888 -0.4296 -0.8530 0.3181 0.9778 0.4570 -0.1420 0.8984 -0.6031 0.0697 -1.0822 0.4465 0.6036 0.3792 0.2532 -0.0285 0.4129 0.4833 0.1746 0.5626 0.2150 -0.3343 0.4013 -0.3679 0.5653 0.8092 -0.2363 -0.6361 -0.6818 0.6110 -0.5506 0.9914 0.0352 0.1968 -0.2502 7.0067 -10.7378 2.6900 -59.8756 -0.9898 -0.8296 2.3429 1.3456 -0.2531 -1.1265 0.0326 0.5617 0.1045
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/IB03BD.html 0000664 0000000 0000000 00000204106 14560147231 0020320 0 ustar 00root root 0000000 0000000
Purpose
To compute a set of parameters for approximating a Wiener system in a least-squares sense, using a neural network approach and a MINPACK-like Levenberg-Marquardt algorithm. The Wiener system consists of a linear part and a static nonlinearity, and it is represented as x(t+1) = A*x(t) + B*u(t) z(t) = C*x(t) + D*u(t), y(t) = f(z(t),wb(1:L)), where t = 1, 2, ..., NSMP, and f is a nonlinear function, evaluated by the SLICOT Library routine NF01AY. The parameter vector X is partitioned as X = ( wb(1), ..., wb(L), theta ), where theta corresponds to the linear part, and wb(i), i = 1 : L, correspond to the nonlinear part. See SLICOT Library routine NF01AD for further details. The sum of squares of the error functions, defined by e(t) = y(t) - Y(t), t = 1, 2, ..., NSMP, is minimized, where Y(t) is the measured output vector. The functions and their Jacobian matrices are evaluated by SLICOT Library routine NF01BF (the FCN routine in the call of MD03BD).Specification
SUBROUTINE IB03BD( INIT, NOBR, M, L, NSMP, N, NN, ITMAX1, ITMAX2, $ NPRINT, U, LDU, Y, LDY, X, LX, TOL1, TOL2, $ IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER INIT INTEGER INFO, ITMAX1, ITMAX2, IWARN, L, LDU, LDWORK, $ LDY, LX, M, N, NN, NOBR, NPRINT, NSMP DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. DOUBLE PRECISION DWORK(*), U(LDU, *), X(*), Y(LDY, *) INTEGER IWORK(*)Arguments
Mode Parameters
INIT CHARACTER*1 Specifies which parts have to be initialized, as follows: = 'L' : initialize the linear part only, X already contains an initial approximation of the nonlinearity; = 'S' : initialize the static nonlinearity only, X already contains an initial approximation of the linear part; = 'B' : initialize both linear and nonlinear parts; = 'N' : do not initialize anything, X already contains an initial approximation. If INIT = 'S' or 'B', the error functions for the nonlinear part, and their Jacobian matrices, are evaluated by SLICOT Library routine NF01BE (used as a second FCN routine in the MD03BD call for the initialization step, see METHOD).Input/Output Parameters
NOBR (input) INTEGER If INIT = 'L' or 'B', NOBR is the number of block rows, s, in the input and output block Hankel matrices to be processed for estimating the linear part. NOBR > 0. (In the MOESP theory, NOBR should be larger than n, the estimated dimension of state vector.) This parameter is ignored if INIT is 'S' or 'N'. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L >= 0, and L > 0, if INIT = 'L' or 'B'. NSMP (input) INTEGER The number of input and output samples, t. NSMP >= 0, and NSMP >= 2*(M+L+1)*NOBR - 1, if INIT = 'L' or 'B'. N (input/output) INTEGER The order of the linear part. If INIT = 'L' or 'B', and N < 0 on entry, the order is assumed unknown and it will be found by the routine. Otherwise, the input value will be used. If INIT = 'S' or 'N', N must be non-negative. The values N >= NOBR, or N = 0, are not acceptable if INIT = 'L' or 'B'. NN (input) INTEGER The number of neurons which shall be used to approximate the nonlinear part. NN >= 0. ITMAX1 (input) INTEGER The maximum number of iterations for the initialization of the static nonlinearity. This parameter is ignored if INIT is 'N' or 'L'. Otherwise, ITMAX1 >= 0. ITMAX2 (input) INTEGER The maximum number of iterations. ITMAX2 >= 0. NPRINT (input) INTEGER This parameter enables controlled printing of iterates if it is positive. In this case, FCN is called with IFLAG = 0 at the beginning of the first iteration and every NPRINT iterations thereafter and immediately prior to return, and the current error norm is printed. Other intermediate results could be printed by modifying the corresponding FCN routine (NF01BE and/or NF01BF). If NPRINT <= 0, no special calls of FCN with IFLAG = 0 are made. U (input) DOUBLE PRECISION array, dimension (LDU, M) The leading NSMP-by-M part of this array must contain the set of input samples, U = ( U(1,1),...,U(1,M); ...; U(NSMP,1),...,U(NSMP,M) ). LDU INTEGER The leading dimension of array U. LDU >= MAX(1,NSMP). Y (input) DOUBLE PRECISION array, dimension (LDY, L) The leading NSMP-by-L part of this array must contain the set of output samples, Y = ( Y(1,1),...,Y(1,L); ...; Y(NSMP,1),...,Y(NSMP,L) ). LDY INTEGER The leading dimension of array Y. LDY >= MAX(1,NSMP). X (input/output) DOUBLE PRECISION array dimension (LX) On entry, if INIT = 'L', the leading (NN*(L+2) + 1)*L part of this array must contain the initial parameters for the nonlinear part of the system. On entry, if INIT = 'S', the elements lin1 : lin2 of this array must contain the initial parameters for the linear part of the system, corresponding to the output normal form, computed by SLICOT Library routine TB01VD, where lin1 = (NN*(L+2) + 1)*L + 1; lin2 = (NN*(L+2) + 1)*L + N*(L+M+1) + L*M. On entry, if INIT = 'N', the elements 1 : lin2 of this array must contain the initial parameters for the nonlinear part followed by the initial parameters for the linear part of the system, as specified above. This array need not be set on entry if INIT = 'B'. On exit, the elements 1 : lin2 of this array contain the optimal parameters for the nonlinear part followed by the optimal parameters for the linear part of the system, as specified above. LX (input/output) INTEGER On entry, this parameter must contain the intended length of X. If N >= 0, then LX >= NX := lin2 (see parameter X). If N is unknown (N < 0 on entry), a large enough estimate of N should be used in the formula of lin2. On exit, if N < 0 on entry, but LX is not large enough, then this parameter contains the actual length of X, corresponding to the computed N. Otherwise, its value is unchanged.Tolerances
TOL1 DOUBLE PRECISION If INIT = 'S' or 'B' and TOL1 >= 0, TOL1 is the tolerance which measures the relative error desired in the sum of squares, as well as the relative error desired in the approximate solution, for the initialization step of nonlinear part. Termination occurs when either both the actual and predicted relative reductions in the sum of squares, or the relative error between two consecutive iterates are at most TOL1. If the user sets TOL1 < 0, then SQRT(EPS) is used instead TOL1, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is ignored if INIT is 'N' or 'L'. TOL2 DOUBLE PRECISION If TOL2 >= 0, TOL2 is the tolerance which measures the relative error desired in the sum of squares, as well as the relative error desired in the approximate solution, for the whole optimization process. Termination occurs when either both the actual and predicted relative reductions in the sum of squares, or the relative error between two consecutive iterates are at most TOL2. If the user sets TOL2 < 0, then SQRT(EPS) is used instead TOL2. This default value could require many iterations, especially if TOL1 is larger. If INIT = 'S' or 'B', it is advisable that TOL2 be larger than TOL1, and spend more time with cheaper iterations.Workspace
IWORK INTEGER array, dimension (MAX( LIW1, LIW2, LIW3 )), where LIW1 = LIW2 = 0, if INIT = 'S' or 'N'; otherwise, LIW1 = M+L; LIW2 = MAX(M*NOBR+N,M*(N+L)); LIW3 = 3+MAX(NN*(L+2)+2,NX+L), if INIT = 'S' or 'B'; LIW3 = 3+NX+L, if INIT = 'L' or 'N'. On output, if INFO = 0, IWORK(1) and IWORK(2) return the (total) number of function and Jacobian evaluations, respectively (including the initialization step, if it was performed), and if INIT = 'L' or INIT = 'B', IWORK(3) specifies how many locations of DWORK contain reciprocal condition number estimates (see below); otherwise, IWORK(3) = 0. If INFO = 0, the entries 4 to 3+NX of IWORK define a permutation matrix P such that J*P = Q*R, where J is the final calculated Jacobian, Q is an orthogonal matrix (not stored), and R is upper triangular with diagonal elements of nonincreasing magnitude (possibly for each block column of J). Column j of P is column IWORK(3+j) of the identity matrix. Moreover, the entries 4+NX:3+NX+L of this array contain the ranks of the final submatrices S_k (see description of LMPARM in MD03BD). DWORK DOUBLE PRECISION array, dimension (LDWORK) On entry, if desired, and if INIT = 'S' or 'B', the entries DWORK(1:4) are set to initialize the random numbers generator for the nonlinear part parameters (see the description of the argument XINIT of SLICOT Library routine MD03BD); this enables to obtain reproducible results. The same seed is used for all outputs. On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, DWORK(2) returns the residual error norm (the sum of squares), DWORK(3) returns the number of iterations performed, and DWORK(4) returns the final Levenberg factor, for optimizing the parameters of both the linear part and the static nonlinearity part. If INIT = 'S' or INIT = 'B' and INFO = 0, then the elements DWORK(5) to DWORK(8) contain the corresponding four values for the initialization step (see METHOD). (If L > 1, DWORK(8) contains the maximum of the Levenberg factors for all outputs.) If INIT = 'L' or INIT = 'B', and INFO = 0, DWORK(9) to DWORK(8+IWORK(3)) contain reciprocal condition number estimates set by SLICOT Library routines IB01AD, IB01BD, and IB01CD. On exit, if INFO = -21, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. In the formulas below, N should be taken not larger than NOBR - 1, if N < 0 on entry. LDWORK = MAX( LW1, LW2, LW3, LW4 ), where LW1 = 0, if INIT = 'S' or 'N'; otherwise, LW1 = MAX( 2*(M+L)*NOBR*(2*(M+L)*(NOBR+1)+3) + L*NOBR, 4*(M+L)*NOBR*(M+L)*NOBR + (N+L)*(N+M) + MAX( LDW1, LDW2 ), (N+L)*(N+M) + N + N*N + 2 + N*(N+M+L) + MAX( 5*N, 2, MIN( LDW3, LDW4 ), LDW5, LDW6 ), where, LDW1 >= MAX( 2*(L*NOBR-L)*N+2*N, (L*NOBR-L)*N+N*N+7*N, L*NOBR*N + MAX( (L*NOBR-L)*N+2*N + (2*M+L)*NOBR+L, 2*(L*NOBR-L)*N+N*N+8*N, N+4*(M*NOBR+N)+1, M*NOBR+3*N+L ) ) LDW2 >= 0, if M = 0; LDW2 >= L*NOBR*N + M*NOBR*(N+L)*(M*(N+L)+1) + MAX( (N+L)**2, 4*M*(N+L)+1 ), if M > 0; LDW3 = NSMP*L*(N+1) + 2*N + MAX( 2*N*N, 4*N ), LDW4 = N*(N+1) + 2*N + MAX( N*L*(N+1) + 2*N*N + L*N, 4*N ); LDW5 = NSMP*L + (N+L)*(N+M) + 3*N+M+L; LDW6 = NSMP*L + (N+L)*(N+M) + N + MAX(1, N*N*L + N*L + N, N*N + MAX(N*N + N*MAX(N,L) + 6*N + MIN(N,L), N*M)); LW2 = LW3 = 0, if INIT = 'L' or 'N'; otherwise, LW2 = NSMP*L + BSN + MAX( 4, NSMP + MAX( NSMP*BSN + MAX( 2*NN, 5*BSN + 1 ), BSN**2 + BSN + MAX( NSMP + 2*NN, 5*BSN ) ) ); LW3 = MAX( LDW7, NSMP*L + (N+L)*(2*N+M) + 2*N ); LDW7 = NSMP*L + (N+L)*(N+M) + 3*N+M+L, if M > 0; LDW7 = NSMP*L + (N+L)*N + 2*N+L, if M = 0; LW4 = NSMP*L + NX + MAX( 4, NSMP*L + MAX( NSMP*L*( BSN + LTHS ) + MAX( NSMP*L + L1, L2 + NX ), NX*( BSN + LTHS ) + NX + MAX( NSMP*L + L1, NX + L3 ) ) ), L0 = MAX( N*(N+L), N+M+L ), if M > 0; L0 = MAX( N*(N+L), L ), if M = 0; L1 = NSMP*L + MAX( 2*NN, (N+L)*(N+M) + 2*N + L0); L2 = 4*NX + 1, if L <= 1 or BSN = 0; otherwise, L2 = BSN + MAX(3*BSN+1,LTHS); L2 = MAX(L2,4*LTHS+1), if NSMP > BSN; L2 = MAX(L2,(NSMP-BSN)*(L-1)), if BSN < NSMP < 2*BSN; L3 = 4*NX, if L <= 1 or BSN = 0; L3 = LTHS*BSN + 2*NX + 2*MAX(BSN,LTHS), if L > 1 and BSN > 0, with BSN = NN*( L + 2 ) + 1, LTHS = N*( L + M + 1 ) + L*M. For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER < 0: the user set IFLAG = IWARN in (one of) the subroutine(s) FCN, i.e., NF01BE, if INIT = 'S' or 'B', and/or NF01BF; this value cannot be returned without changing the FCN routine(s); otherwise, IWARN has the value k*100 + j*10 + i, where k is defined below, i refers to the whole optimization process, and j refers to the initialization step (j = 0, if INIT = 'L' or 'N'), and the possible values for i and j have the following meaning (where TOL* denotes TOL1 or TOL2, and similarly for ITMAX*): = 1: both actual and predicted relative reductions in the sum of squares are at most TOL*; = 2: relative error between two consecutive iterates is at most TOL*; = 3: conditions for i or j = 1 and i or j = 2 both hold; = 4: the cosine of the angle between the vector of error function values and any column of the Jacobian is at most EPS in absolute value; = 5: the number of iterations has reached ITMAX* without satisfying any convergence condition; = 6: TOL* is too small: no further reduction in the sum of squares is possible; = 7: TOL* is too small: no further improvement in the approximate solution X is possible; = 8: the vector of function values e is orthogonal to the columns of the Jacobian to machine precision. The digit k is normally 0, but if INIT = 'L' or 'B', it can have a value in the range 1 to 6 (see IB01AD, IB01BD and IB01CD). In all these cases, the entries DWORK(1:4), DWORK(5:8) (if INIT = 'S' or 'B'), and DWORK(9:8+IWORK(3)) (if INIT = 'L' or 'B'), are set as described above.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; otherwise, INFO has the value k*100 + j*10 + i, where k is defined below, i refers to the whole optimization process, and j refers to the initialization step (j = 0, if INIT = 'L' or 'N'), and the possible values for i and j have the following meaning: = 1: the routine FCN returned with INFO <> 0 for IFLAG = 1; = 2: the routine FCN returned with INFO <> 0 for IFLAG = 2; = 3: the routine QRFACT returned with INFO <> 0; = 4: the routine LMPARM returned with INFO <> 0. In addition, if INIT = 'L' or 'B', i could also be = 5: if a Lyapunov equation could not be solved; = 6: if the identified linear system is unstable; = 7: if the QR algorithm failed on the state matrix of the identified linear system. QRFACT and LMPARM are generic names for SLICOT Library routines NF01BS and NF01BP, respectively, for the whole optimization process, and MD03BA and MD03BB, respectively, for the initialization step (if INIT = 'S' or 'B'). The digit k is normally 0, but if INIT = 'L' or 'B', it can have a value in the range 1 to 10 (see IB01AD/IB01BD).Method
If INIT = 'L' or 'B', the linear part of the system is approximated using the combined MOESP and N4SID algorithm. If necessary, this algorithm can also choose the order, but it is advantageous if the order is already known. If INIT = 'S' or 'B', the output of the approximated linear part is computed and used to calculate an approximation of the static nonlinearity using the Levenberg-Marquardt algorithm [1,3]. This step is referred to as the (nonlinear) initialization step. As last step, the Levenberg-Marquardt algorithm is used again to optimize the parameters of the linear part and the static nonlinearity as a whole. Therefore, it is necessary to parametrise the matrices of the linear part. The output normal form [2] parameterisation is used. The Jacobian is computed analytically, for the nonlinear part, and numerically, for the linear part.References
[1] More, J.J., Garbow, B.S, and Hillstrom, K.E. User's Guide for MINPACK-1. Applied Math. Division, Argonne National Laboratory, Argonne, Illinois, Report ANL-80-74, 1980. [2] Peeters, R.L.M., Hanzon, B., and Olivi, M. Balanced realizations of discrete-time stable all-pass systems and the tangential Schur algorithm. Proceedings of the European Control Conference, 31 August - 3 September 1999, Karlsruhe, Germany. Session CP-6, Discrete-time Systems, 1999. [3] More, J.J. The Levenberg-Marquardt algorithm: implementation and theory. In Watson, G.A. (Ed.), Numerical Analysis, Lecture Notes in Mathematics, vol. 630, Springer-Verlag, Berlin, Heidelberg and New York, pp. 105-116, 1978.Numerical Aspects
The Levenberg-Marquardt algorithm described in [3] is scaling invariant and globally convergent to (maybe local) minima. The convergence rate near a local minimum is quadratic, if the Jacobian is computed analytically, and linear, if the Jacobian is computed numerically.Further Comments
NoneExample
Program Text
* IB03BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER BSNM, LDU, LDY, LIWORK, LMAX, LTHS, LXM, MMAX, $ NMAX, NNMAX, NOBRMX, NSMPMX PARAMETER ( LMAX = 2, MMAX = 3, NOBRMX = 10, NNMAX = 12, $ NMAX = 4, NSMPMX = 1024, $ BSNM = NNMAX*( LMAX + 2 ) + 1, $ LTHS = NMAX*( LMAX + MMAX + 1 ) + LMAX*MMAX, $ LDU = NSMPMX, LDY = NSMPMX, $ LXM = BSNM*LMAX + LTHS, $ LIWORK = MAX( MMAX + LMAX, MMAX*NOBRMX + NMAX, $ MMAX*( NMAX + LMAX ), 3 + $ MAX( BSNM + 1, LXM + LMAX ) ) ) INTEGER L0, L1M, L2M, L3M, LDW1, LDW2, LDW3, LDW4, LDW5, $ LDW6, LDW7, LDWORK, LW1, LW2, LW3, LW4 PARAMETER ( L0 = MAX( NMAX*( NMAX + LMAX ), $ NMAX + MMAX + LMAX ), $ L1M = NSMPMX*LMAX + $ MAX( 2*NNMAX, $ ( NMAX + LMAX )*( NMAX + MMAX ) + $ 2*NMAX + L0 ), $ L2M = MAX( 4*LXM + 1, BSNM + $ MAX( 3*BSNM + 1, LTHS ), $ NSMPMX*( LMAX - 1 ) ), $ L3M = MAX( 4*LXM, LTHS*BSNM + 2*LXM + $ 2*MAX( BSNM, LTHS ) ), $ LDW1 = MAX( 2*( LMAX*NOBRMX - LMAX )*NMAX + $ 2*NMAX, $ ( LMAX*NOBRMX - LMAX )*NMAX + $ NMAX*NMAX + 7*NMAX, $ LMAX*NOBRMX*NMAX + $ MAX( ( LMAX*NOBRMX - LMAX )*NMAX + $ 2*NMAX + LMAX + $ ( 2*MMAX + LMAX )*NOBRMX, $ 2*( LMAX*NOBRMX - LMAX )*NMAX $ + NMAX*NMAX + 8*NMAX, $ NMAX + 4*( MMAX*NOBRMX + $ NMAX ) + 1, $ MMAX*NOBRMX + 3*NMAX + LMAX ) $ ), $ LDW2 = LMAX*NOBRMX*NMAX + $ MMAX*NOBRMX*( NMAX + LMAX )* $ ( MMAX*( NMAX + LMAX ) + 1 ) + $ MAX( ( NMAX + LMAX )**2, $ 4*MMAX*( NMAX + LMAX ) + 1 ), $ LDW3 = NSMPMX*LMAX*( NMAX + 1 ) + 2*NMAX + $ MAX( 2*NMAX*NMAX, 4*NMAX ), $ LDW4 = NMAX*( NMAX + 1 ) + 2*NMAX + $ MAX( NMAX*LMAX*( NMAX + 1 ) + $ 2*NMAX*NMAX + LMAX*NMAX, 4*NMAX ), $ LDW5 = NSMPMX*LMAX + ( NMAX + LMAX )* $ ( NMAX + MMAX ) + 3*NMAX + MMAX + LMAX, $ LDW6 = NSMPMX*LMAX + ( NMAX + LMAX )* $ ( NMAX + MMAX ) + NMAX + $ MAX( 1, NMAX*NMAX*LMAX + NMAX*LMAX + $ NMAX, NMAX*NMAX + $ MAX( NMAX*NMAX + $ NMAX*MAX( NMAX, LMAX ) + $ 6*NMAX + MIN( NMAX, LMAX ), $ NMAX*MMAX ) ), $ LDW7 = NSMPMX*LMAX + ( NMAX + LMAX )* $ ( NMAX + MMAX ) + 3*NMAX + MMAX + LMAX, $ LW1 = MAX( 2*( MMAX + LMAX )*NOBRMX* $ ( 2*( MMAX + LMAX )*( NOBRMX + 1 ) $ + 3 ) + LMAX*NOBRMX, $ 4*( MMAX + LMAX )*NOBRMX* $ ( MMAX + LMAX )*NOBRMX + $ ( NMAX + LMAX )*( NMAX + MMAX ) + $ MAX( LDW1, LDW2 ), $ ( NMAX + LMAX )*( NMAX + MMAX ) + $ NMAX + NMAX*NMAX + 2 + $ NMAX*( NMAX + MMAX + LMAX ) + $ MAX( 5*NMAX, 2, MIN( LDW3, LDW4 ), $ LDW5, LDW6 ) ), $ LW2 = NSMPMX*LMAX + BSNM + $ MAX( 4, NSMPMX + $ MAX( NSMPMX*BSNM + $ MAX( 2*NNMAX, 5*BSNM + 1 ), $ BSNM**2 + BSNM + $ MAX( NSMPMX + 2*NNMAX, $ 5*BSNM ) ) ), $ LW3 = MAX( LDW7, NSMPMX*LMAX + $ ( NMAX + LMAX )*( 2*NMAX + MMAX )+ $ 2*NMAX ), $ LW4 = NSMPMX*LMAX + LXM + $ MAX( 4, NSMPMX*LMAX + $ MAX( NSMPMX*LMAX*( BSNM + LTHS ) + $ MAX( NSMPMX*LMAX + L1M, $ L2M + LXM ), $ LXM*( BSNM + LTHS ) + $ LXM + $ MAX( NSMPMX*LMAX + L1M, $ LXM + L3M ) ) ), $ LDWORK = MAX( LW1, LW2, LW3, LW4 ) ) * .. Local Scalars .. LOGICAL INIT1, INITB, INITL, INITN, INITS CHARACTER*1 INIT INTEGER BSN, I, INFO, INI, ITER, ITMAX1, ITMAX2, IWARN, $ J, L, L1, L2, LPAR, LX, M, N, NN, NOBR, NPRINT, $ NS, NSMP DOUBLE PRECISION TOL1, TOL2 * .. Array Arguments .. INTEGER IWORK(LIWORK) DOUBLE PRECISION DWORK(LDWORK), U(LDU,MMAX), X(LXM), Y(LDY,LMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL IB03BD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) NOBR, M, L, NSMP, N, NN, ITMAX1, ITMAX2, $ NPRINT, TOL1, TOL2, INIT INITL = LSAME( INIT, 'L' ) INITS = LSAME( INIT, 'S' ) INITB = LSAME( INIT, 'B' ) INITN = LSAME( INIT, 'N' ) INIT1 = INITL .OR. INITB IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE IF( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99992 ) L ELSE NS = N IF( INIT1 ) THEN IF( NOBR.LE.0 .OR. NOBR.GT.NOBRMX ) THEN WRITE ( NOUT, FMT = 99991 ) NOBR STOP ELSEIF( NSMP.LT.2*( M + L + 1 )*NOBR - 1 ) THEN WRITE ( NOUT, FMT = 99990 ) NSMP STOP ELSEIF( N.EQ.0 .OR. N.GE.NOBR ) THEN WRITE ( NOUT, FMT = 99989 ) N STOP END IF IF ( N.LT.0 ) $ N = NOBR - 1 ELSE IF( NSMP.LT.0 ) THEN WRITE ( NOUT, FMT = 99990 ) NSMP STOP ELSEIF( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99989 ) N STOP END IF END IF IF( NN.LT.0 .OR. NN.GT.NNMAX ) THEN WRITE ( NOUT, FMT = 99988 ) NN ELSE BSN = NN*( L + 2 ) + 1 L1 = BSN*L L2 = N*( L + M + 1 ) + L*M LX = L1 + L2 INI = 1 IF ( INITL ) THEN LPAR = L1 ELSEIF ( INITS ) THEN INI = L1 + 1 LPAR = L2 ELSEIF ( INITN ) THEN LPAR = LX END IF IF( INIT1 ) $ N = NS * Read the input-output data, initial parameters, and seed. READ ( NIN, FMT = * ) ( ( U(I,J), J = 1,M ), I = 1,NSMP ) READ ( NIN, FMT = * ) ( ( Y(I,J), J = 1,L ), I = 1,NSMP ) IF ( .NOT.INITB ) $ READ ( NIN, FMT = * ) ( X(I), I = INI,INI+LPAR-1 ) IF ( INITS .OR. INITB ) $ READ ( NIN, FMT = * ) ( DWORK(I), I = 1,4 ) * Solve a Wiener system identification problem. CALL IB03BD( INIT, NOBR, M, L, NSMP, N, NN, ITMAX1, $ ITMAX2, NPRINT, U, LDU, Y, LDY, X, LX, TOL1, $ TOL2, IWORK, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( IWARN.NE.0 ) WRITE ( NOUT, FMT = 99987 ) IWARN ITER = DWORK(3) WRITE ( NOUT, FMT = 99997 ) DWORK(2) WRITE ( NOUT, FMT = 99996 ) ITER, IWORK(1), IWORK(2) * Recompute LX is necessary. IF ( INIT1 .AND. NS.LT.0 ) $ LX = L1 + N*( L + M + 1 ) + L*M WRITE ( NOUT, FMT = 99994 ) WRITE ( NOUT, FMT = 99995 ) ( X(I), I = 1, LX ) END IF END IF END IF END IF STOP * 99999 FORMAT (' IB03BD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from IB03BD = ',I4) 99997 FORMAT (/' Final 2-norm of the residuals = ',D15.7) 99996 FORMAT (/' Number of iterations = ', I7, $ /' Number of function evaluations = ', I7, $ /' Number of Jacobian evaluations = ', I7) 99995 FORMAT (10(1X,F9.4)) 99994 FORMAT (/' Final approximate solution is ' ) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' L is out of range.',/' L = ',I5) 99991 FORMAT (/' NOBR is out of range.',/' NOBR = ',I5) 99990 FORMAT (/' NSMP is out of range.',/' NSMP = ',I5) 99989 FORMAT (/' N is out of range.',/' N = ',I5) 99988 FORMAT (/' NN is out of range.',/' NN = ',I5) 99987 FORMAT (' IWARN on exit from IB03BD = ',I4) ENDProgram Data
IB03BD EXAMPLE PROGRAM DATA 10 1 1 1024 4 12 500 1000 0 .00001 .00001 B 2.2183165e-01 3.9027807e-02 -5.0295887e-02 8.5386224e-03 7.2431159e-02 -1.7082198e-03 -1.7176287e-01 -2.6198104e-01 -1.7194108e-01 1.8566868e-02 1.5625362e-01 1.7463811e-01 1.1564450e-01 2.8779248e-02 -8.4265993e-02 -2.0978501e-01 -2.6591828e-01 -1.7268680e-01 2.1525013e-02 1.4363602e-01 7.3101431e-02 -1.0259212e-01 -1.6380473e-01 -1.0021167e-02 2.0263451e-01 2.1983417e-01 -2.1636523e-02 -3.0986057e-01 -3.8521982e-01 -2.1785179e-01 -1.4761096e-02 3.7005180e-02 -2.8119028e-02 -4.2167901e-02 5.2117694e-02 1.2023747e-01 1.8863385e-02 -1.9506434e-01 -3.0192175e-01 -1.7000747e-01 8.0740471e-02 2.0188076e-01 8.5108288e-02 -1.3270970e-01 -2.3646822e-01 -1.6505385e-01 -4.7448014e-02 -2.7886815e-02 -1.0152026e-01 -1.4155374e-01 -6.1650823e-02 8.3519614e-02 1.5926650e-01 8.6142760e-02 -9.4385381e-02 -2.6609066e-01 -3.2883874e-01 -2.5908050e-01 -1.1648940e-01 -3.0653766e-03 1.0326675e-02 -5.3445909e-02 -9.2412724e-02 -3.0279541e-02 8.4846832e-02 1.1133075e-01 -3.2135250e-02 -2.5308181e-01 -3.5670882e-01 -2.4458860e-01 -2.5254261e-02 9.3714332e-02 1.8643667e-02 -1.4592119e-01 -2.2730880e-01 -1.7140060e-01 -7.4131665e-02 -3.9669515e-02 -5.1266129e-02 -1.1752833e-02 1.0785565e-01 2.0665525e-01 1.6117322e-01 -2.6938653e-02 -2.1941152e-01 -2.7753567e-01 -1.8805912e-01 -4.6845025e-02 5.8585698e-02 1.2218407e-01 1.7838638e-01 2.2169815e-01 1.9825589e-01 8.0215288e-02 -7.2135308e-02 -1.4381520e-01 -6.8724371e-02 1.0191205e-01 2.3766633e-01 2.3876101e-01 1.1678077e-01 -2.0428168e-02 -5.8973233e-02 3.1326900e-02 1.7391495e-01 2.4558570e-01 1.7650262e-01 1.2444292e-02 -1.1538234e-01 -9.5917970e-02 6.4762165e-02 2.4258524e-01 3.0102251e-01 2.1222960e-01 7.8706189e-02 3.1500466e-02 1.0297577e-01 1.9875173e-01 1.9434906e-01 5.8146667e-02 -1.1941921e-01 -2.1038478e-01 -1.5594967e-01 1.8552198e-03 1.6878529e-01 2.5937416e-01 2.2516346e-01 6.6144472e-02 -1.5623019e-01 -3.3161105e-01 -3.6695732e-01 -2.6565333e-01 -1.3254832e-01 -8.0101064e-02 -1.2531889e-01 -1.8843171e-01 -1.9038956e-01 -1.3230055e-01 -7.0889306e-02 -3.9679280e-02 -2.6286077e-02 -2.3630770e-02 -6.0652834e-02 -1.4929250e-01 -2.2155095e-01 -1.7331044e-01 5.2693564e-03 1.7683919e-01 1.8244690e-01 2.5118458e-02 -1.1051051e-01 -5.1764984e-02 1.6342054e-01 3.1563281e-01 2.3808751e-01 -4.4871135e-03 -1.8778679e-01 -1.6017584e-01 2.3481991e-02 1.9209185e-01 2.4281065e-01 2.1224192e-01 1.8825017e-01 1.9811718e-01 2.0202486e-01 1.6812825e-01 1.1444796e-01 7.2452475e-02 4.0090973e-02 -6.7139529e-03 -6.8721730e-02 -1.1460099e-01 -1.1914168e-01 -8.9852521e-02 -4.5942222e-02 1.0932686e-02 8.1900393e-02 1.3092374e-01 9.0790221e-02 -6.3538148e-02 -2.5119963e-01 -3.2585173e-01 -2.0850925e-01 1.7922009e-02 1.6783753e-01 1.2518317e-01 -4.3517162e-02 -1.5783138e-01 -1.0686847e-01 4.4782565e-02 1.3893172e-01 9.8691579e-02 2.6311282e-03 -1.6073049e-02 7.8512306e-02 1.9453537e-01 2.2504627e-01 1.6121235e-01 7.8124056e-02 2.9774586e-02 -5.3899280e-03 -6.5745322e-02 -1.2329059e-01 -9.5096521e-02 5.5471394e-02 2.5017082e-01 3.4773286e-01 2.6656242e-01 5.3705965e-02 -1.6135006e-01 -2.7310977e-01 -2.6814818e-01 -2.1074926e-01 -1.7743213e-01 -1.9796482e-01 -2.4059041e-01 -2.4663820e-01 -1.8780129e-01 -9.8317382e-02 -4.7848155e-02 -7.3425069e-02 -1.3529842e-01 -1.4739094e-01 -6.2482366e-02 6.8729554e-02 1.3251322e-01 6.1482940e-02 -8.5065014e-02 -1.6074078e-01 -6.7974104e-02 1.3976672e-01 2.9838081e-01 2.8233998e-01 1.1391411e-01 -7.1966946e-02 -1.5876983e-01 -1.3805556e-01 -8.2998592e-02 -5.7864811e-02 -6.5300733e-02 -7.0590592e-02 -5.5847027e-02 -4.1219301e-02 -6.1578267e-02 -1.3176243e-01 -2.2968907e-01 -3.0193311e-01 -2.8770451e-01 -1.5729276e-01 5.4414593e-02 2.5362617e-01 3.4482230e-01 3.0119122e-01 1.8534835e-01 9.6712488e-02 9.3385279e-02 1.6057572e-01 2.4424680e-01 3.0164891e-01 3.1693510e-01 2.8441517e-01 1.9948758e-01 7.3600888e-02 -5.4291337e-02 -1.3721320e-01 -1.5626045e-01 -1.3464149e-01 -1.1510541e-01 -1.2587072e-01 -1.6605420e-01 -2.1242088e-01 -2.3059410e-01 -1.8785957e-01 -7.8188380e-02 5.0484398e-02 1.0697957e-01 2.7421051e-02 -1.4419852e-01 -2.5888039e-01 -1.8018121e-01 7.8519535e-02 3.4009981e-01 4.0793257e-01 2.3842529e-01 -2.7029751e-02 -1.9919385e-01 -2.0420528e-01 -1.1389043e-01 -3.5602606e-02 5.7385906e-04 3.8759790e-02 1.0691941e-01 1.6303496e-01 1.4314046e-01 4.7786789e-02 -4.1030659e-02 -3.5960232e-02 7.0498851e-02 2.0120383e-01 2.6638170e-01 2.3249669e-01 1.2937468e-01 1.3309043e-02 -6.2770099e-02 -5.8936178e-02 3.4143049e-02 1.6425689e-01 2.2228910e-01 1.2062705e-01 -1.0832755e-01 -3.0711352e-01 -3.2002334e-01 -1.4072879e-01 7.6263091e-02 1.6385270e-01 1.0093887e-01 1.7269577e-02 4.3458474e-02 1.6769625e-01 2.4967945e-01 1.7314220e-01 -2.7519776e-02 -1.9806822e-01 -2.1140982e-01 -7.2758850e-02 1.1057470e-01 2.3440218e-01 2.5956640e-01 1.9629970e-01 7.2200120e-02 -6.6390448e-02 -1.4805958e-01 -1.1487691e-01 1.3561014e-02 1.3146288e-01 1.3205007e-01 1.5159726e-02 -9.9141126e-02 -7.9831031e-02 8.4487631e-02 2.6348526e-01 2.9617209e-01 1.3322758e-01 -1.1642178e-01 -2.7289866e-01 -2.2996687e-01 -3.5143323e-02 1.5983180e-01 2.3035457e-01 1.7179773e-01 7.3333592e-02 1.1653452e-02 -1.8499701e-02 -6.7962911e-02 -1.4361094e-01 -1.7665147e-01 -9.1259528e-02 9.8323111e-02 2.6912800e-01 2.8047779e-01 9.9377687e-02 -1.5436535e-01 -2.9569363e-01 -2.3017874e-01 -4.1007324e-02 8.2484352e-02 2.1760384e-02 -1.5212456e-01 -2.4257965e-01 -1.2641528e-01 1.0676585e-01 2.2865135e-01 1.0211687e-01 -1.6408728e-01 -3.0761461e-01 -1.7309336e-01 1.2302931e-01 3.0157576e-01 1.9992664e-01 -6.5766948e-02 -2.2490680e-01 -1.3209725e-01 9.1452627e-02 1.9707770e-01 7.0972862e-02 -1.6016460e-01 -2.7859962e-01 -2.0288880e-01 -4.9817844e-02 1.3587087e-02 -5.2447125e-02 -1.4164147e-01 -1.3776729e-01 -3.9470574e-02 5.4688171e-02 5.9780155e-02 -2.0666265e-02 -1.2306679e-01 -1.9150051e-01 -1.9953793e-01 -1.3072099e-01 1.7129752e-02 1.9139299e-01 2.8015628e-01 1.9737258e-01 -1.0273734e-02 -1.6921879e-01 -1.2914132e-01 8.3866166e-02 2.8290870e-01 3.0288568e-01 1.5939055e-01 1.4121758e-02 -8.0309556e-03 5.7046152e-02 7.8808779e-02 -4.0300321e-04 -9.3021531e-02 -6.6955916e-02 1.0073094e-01 2.8905786e-01 3.4946321e-01 2.4220689e-01 5.3331283e-02 -1.0609621e-01 -1.9358889e-01 -2.2728166e-01 -2.1680862e-01 -1.4144032e-01 -5.2173696e-03 1.1701944e-01 1.2668247e-01 4.8375112e-03 -1.4889224e-01 -1.9905951e-01 -9.9563224e-02 6.4580042e-02 1.5505008e-01 9.7617503e-02 -6.4905019e-02 -2.1769152e-01 -2.6787937e-01 -2.0919394e-01 -1.1033568e-01 -4.3266567e-02 -1.8066266e-02 1.3641281e-02 9.0806946e-02 1.8645977e-01 2.3150216e-01 1.9334856e-01 1.1238648e-01 4.9498545e-02 1.3155560e-02 -3.5876844e-02 -1.0537074e-01 -1.2612890e-01 -1.8934023e-02 1.8850628e-01 3.4290627e-01 3.0108912e-01 9.0554124e-02 -9.4812468e-02 -8.8842381e-02 6.3160674e-02 1.4646977e-01 1.7441277e-02 -2.2104173e-01 -3.1862778e-01 -1.5530235e-01 1.1291463e-01 2.1663682e-01 7.1521680e-02 -1.2722266e-01 -1.3147084e-01 6.8036453e-02 2.2914846e-01 1.4875917e-01 -8.5725554e-02 -1.9280127e-01 -3.7053987e-02 1.9484616e-01 2.0627194e-01 -5.0290692e-02 -2.9703694e-01 -2.4262627e-01 7.3980280e-02 3.1209111e-01 2.0500085e-01 -1.4678863e-01 -3.9620361e-01 -3.3299784e-01 -8.5315346e-02 7.0026906e-02 3.1783466e-02 -5.6224174e-02 -3.8238612e-02 4.1162402e-02 1.4020902e-02 -1.6267337e-01 -3.2229719e-01 -2.8405914e-01 -8.0208074e-02 7.7279407e-02 5.2461001e-02 -5.6931255e-02 -5.7081867e-02 8.4722273e-02 1.8989091e-01 9.1251490e-02 -1.4913841e-01 -3.0047660e-01 -2.2924644e-01 -4.5027749e-02 4.5847665e-02 -1.0582268e-02 -7.0165157e-02 8.8253349e-03 1.7968871e-01 2.6336655e-01 1.6274839e-01 -3.4038513e-02 -1.6866975e-01 -1.7822821e-01 -1.1212378e-01 -2.2511191e-02 9.2633595e-02 2.2273027e-01 2.8312792e-01 1.8855450e-01 -1.3339719e-02 -1.4451328e-01 -7.9411873e-02 9.5243626e-02 1.5825934e-01 8.6924573e-03 -1.9762612e-01 -2.0963986e-01 3.0881541e-02 3.1088543e-01 3.7605990e-01 2.0371110e-01 3.1659734e-03 -4.2255731e-02 2.7937777e-02 4.3768827e-02 -5.0975761e-02 -1.2013869e-01 -1.9514056e-02 1.9409077e-01 3.0061057e-01 1.6772761e-01 -8.4377993e-02 -2.0596833e-01 -8.8137439e-02 1.3053768e-01 2.3231724e-01 1.5592782e-01 3.3546556e-02 1.2609146e-02 8.8143918e-02 1.3076425e-01 5.2445727e-02 -9.1540218e-02 -1.6532665e-01 -8.9700956e-02 9.2256458e-02 2.6287064e-01 3.2206114e-01 2.4782579e-01 1.0180547e-01 -1.2653507e-02 -2.4053903e-02 4.5165362e-02 9.2697417e-02 3.9645255e-02 -7.0244568e-02 -9.7812594e-02 4.0489353e-02 2.5706426e-01 3.5970764e-01 2.4838839e-01 2.8758245e-02 -9.2051146e-02 -1.8531616e-02 1.4540527e-01 2.2483594e-01 1.6366159e-01 6.0613849e-02 2.6700790e-02 4.8805007e-02 2.4088984e-02 -8.7776563e-02 -1.9182802e-01 -1.5875230e-01 2.1332672e-02 2.1574747e-01 2.8121193e-01 1.9605244e-01 5.2140821e-02 -6.0594054e-02 -1.3111027e-01 -1.9003660e-01 -2.3031943e-01 -1.9896872e-01 -7.1576527e-02 8.7126470e-02 1.5966083e-01 8.0700885e-02 -9.6050487e-02 -2.3768453e-01 -2.4174619e-01 -1.1781079e-01 2.4058534e-02 6.3114157e-02 -3.4924911e-02 -1.8708629e-01 -2.5777811e-01 -1.7457598e-01 2.3256558e-03 1.2615984e-01 9.1298660e-02 -7.2869748e-02 -2.3064584e-01 -2.6487668e-01 -1.7896622e-01 -8.1019614e-02 -7.2160218e-02 -1.5109102e-01 -2.2270453e-01 -1.9311631e-01 -5.5949947e-02 1.0558527e-01 1.9015867e-01 1.5010510e-01 9.3491571e-03 -1.6206410e-01 -2.7872156e-01 -2.6789883e-01 -1.0908763e-01 1.3219241e-01 3.2581004e-01 3.6597785e-01 2.5860903e-01 1.1593033e-01 5.3232658e-02 8.9253999e-02 1.5038178e-01 1.6325136e-01 1.2516262e-01 8.1000365e-02 5.6249003e-02 4.1260796e-02 3.6021307e-02 7.0909773e-02 1.5431016e-01 2.1909293e-01 1.6946538e-01 1.3913978e-03 -1.5472276e-01 -1.5445369e-01 -6.5114694e-03 1.1511921e-01 5.3537688e-02 -1.4926948e-01 -2.8563000e-01 -2.0489020e-01 2.2256191e-02 1.8089745e-01 1.3686717e-01 -4.3194077e-02 -1.9185844e-01 -2.2260927e-01 -1.8688905e-01 -1.7299493e-01 -1.9552456e-01 -2.0311384e-01 -1.6521655e-01 -1.1035364e-01 -7.5596967e-02 -5.2167223e-02 -5.0648414e-03 6.7754101e-02 1.2412118e-01 1.2838133e-01 9.0308482e-02 4.0708671e-02 -1.2463102e-02 -7.6325303e-02 -1.2432208e-01 -9.0380523e-02 5.7426602e-02 2.4318485e-01 3.1839858e-01 2.0029814e-01 -2.6893656e-02 -1.7351791e-01 -1.2458940e-01 4.6580380e-02 1.5624992e-01 9.9382689e-02 -5.1882624e-02 -1.4100610e-01 -1.0040874e-01 -1.2845131e-02 -3.6737447e-03 -9.7637188e-02 -2.0172142e-01 -2.1938378e-01 -1.5223806e-01 -7.5818447e-02 -3.6932476e-02 -8.3361793e-03 4.9321106e-02 1.0828653e-01 8.6261922e-02 -5.6487106e-02 -2.4839500e-01 -3.5078033e-01 -2.7598256e-01 -6.2963150e-02 1.5901166e-01 2.7685307e-01 2.7164897e-01 2.1079033e-01 1.7714997e-01 2.0086813e-01 2.4438441e-01 2.4570310e-01 1.8078261e-01 9.0365447e-02 4.4844498e-02 7.6311118e-02 1.4103984e-01 1.5313326e-01 6.6678933e-02 -6.7720328e-02 -1.3565971e-01 -6.6316159e-02 8.3832277e-02 1.6588475e-01 7.6147385e-02 -1.3444251e-01 -2.9759248e-01 -2.8274479e-01 -1.1318459e-01 7.1421886e-02 1.5414324e-01 1.3182338e-01 8.0829372e-02 6.0814130e-02 6.6565578e-02 6.1490382e-02 3.4525574e-02 1.4709018e-02 3.9340413e-02 1.1733787e-01 2.1846966e-01 2.8684125e-01 2.6688313e-01 1.3632576e-01 -6.7370697e-02 -2.5502586e-01 -3.3949317e-01 -3.0013913e-01 -1.9871892e-01 -1.2610649e-01 -1.2941580e-01 -1.8923457e-01 -2.5813995e-01 -3.0533743e-01 -3.1970649e-01 -2.8788006e-01 -1.9500297e-01 -5.4155345e-02 8.1116905e-02 1.5269009e-01 1.4976106e-01 1.1681611e-01 1.0728712e-01 1.3670700e-01 1.8344060e-01 2.2041268e-01 2.2972773e-01 1.9334746e-01 9.8734288e-02 -2.6231283e-02 -9.9070456e-02 -4.1644202e-02 1.2360480e-01 2.5212308e-01 1.9060093e-01 -6.5066267e-02 -3.3581971e-01 -4.0871250e-01 -2.3222990e-01 4.0796545e-02 2.0553146e-01 1.9047036e-01 8.7982654e-02 2.1078714e-02 1.1947834e-02 -7.4158796e-03 -8.0649898e-02 -1.5932177e-01 -1.5963498e-01 -6.7654645e-02 3.3754864e-02 4.5488264e-02 -5.1656648e-02 -1.8439778e-01 -2.5821552e-01 -2.3168258e-01 -1.3075945e-01 -1.4319768e-02 6.0276859e-02 5.2808278e-02 -4.2009846e-02 -1.6857834e-01 -2.1862301e-01 -1.0815610e-01 1.2758494e-01 3.3007803e-01 3.4236071e-01 1.5606744e-01 -7.3906241e-02 -1.7487103e-01 -1.1779263e-01 -2.8797157e-02 -4.2649366e-02 -1.5603253e-01 -2.3465677e-01 -1.6213440e-01 3.1155521e-02 1.9455902e-01 2.0308035e-01 6.4105637e-02 -1.1373221e-01 -2.2912186e-01 -2.4930244e-01 -1.8794162e-01 -6.9023299e-02 6.6894859e-02 1.4860950e-01 1.1319286e-01 -2.1622177e-02 -1.4430675e-01 -1.4139382e-01 -1.4679189e-02 1.0606471e-01 8.3987908e-02 -8.6549724e-02 -2.6473902e-01 -2.8787546e-01 -1.1665499e-01 1.3032718e-01 2.7649250e-01 2.2886289e-01 4.1972959e-02 -1.4166947e-01 -2.1351821e-01 -1.7294568e-01 -9.5242426e-02 -3.9988034e-02 6.0215518e-04 6.4278100e-02 1.4411085e-01 1.7008073e-01 7.6346726e-02 -1.1397897e-01 -2.7942868e-01 -2.8837790e-01 -1.1356283e-01 1.2995490e-01 2.6791352e-01 2.1050936e-01 3.2758432e-02 -8.8492035e-02 -3.6187051e-02 1.3102808e-01 2.2789768e-01 1.2664599e-01 -9.9240525e-02 -2.3008477e-01 -1.1958430e-01 1.3943384e-01 2.8863442e-01 1.6130336e-01 -1.3747854e-01 -3.2522857e-01 -2.2524885e-01 5.3864511e-02 2.3305883e-01 1.5177574e-01 -7.4373920e-02 -1.8870441e-01 -6.7093573e-02 1.6495747e-01 2.8369836e-01 2.0511206e-01 5.1011236e-02 -6.5929875e-03 6.8964562e-02 1.6340844e-01 1.5740112e-01 5.4023734e-02 -4.3471011e-02 -5.1346211e-02 2.3145779e-02 1.1745308e-01 1.8212689e-01 1.9584070e-01 1.4022670e-01 5.9022790e-03 -1.6079919e-01 -2.4935419e-01 -1.7100378e-01 3.1256057e-02 1.8605482e-01 1.4297623e-01 -7.3243962e-02 -2.7593402e-01 -2.9797544e-01 -1.5307840e-01 -4.0914832e-03 2.1269662e-02 -4.1497170e-02 -5.9046655e-02 2.7976789e-02 1.2846949e-01 1.0303296e-01 -7.5938937e-02 -2.8392411e-01 -3.6123552e-01 -2.5664252e-01 -5.3262494e-02 1.2879625e-01 2.3255706e-01 2.6842403e-01 2.5122050e-01 1.7087253e-01 3.4014290e-02 -9.3227815e-02 -1.2001867e-01 -2.1139059e-02 1.2023890e-01 1.7758447e-01 9.6606085e-02 -5.2792108e-02 -1.3892628e-01 -8.4350032e-02 7.1620365e-02 2.1524576e-01 2.5910116e-01 2.0627091e-01 1.2532985e-01 7.1727643e-02 3.8319163e-02 -1.9240088e-02 -1.1662856e-01 -2.1107703e-01 -2.4258539e-01 -1.9809090e-01 -1.2271124e-01 -6.5266079e-02 -2.6001544e-02 2.6587042e-02 8.9979857e-02 1.0112134e-01 -1.6495775e-03 -1.8712095e-01 -3.2285436e-01 -2.8769737e-01 -1.0373843e-01 6.3283390e-02 6.4192144e-02 -6.9141383e-02 -1.4546154e-01 -2.2743165e-02 2.1671482e-01 3.3495240e-01 1.9730942e-01 -6.4245098e-02 -1.8430371e-01 -5.9313975e-02 1.3285821e-01 1.3988590e-01 -6.3313853e-02 -2.3781208e-01 -1.6565753e-01 7.8634007e-02 2.0643470e-01 6.3051903e-02 -1.7337120e-01 -1.9553447e-01 5.8877424e-02 3.1320739e-01 2.6455767e-01 -5.6738794e-02 -3.0614673e-01 -2.0738949e-01 1.4261991e-01 3.9321755e-01 3.3131011e-01 8.6485026e-02 -6.3943179e-02 -2.3354764e-02 5.9552949e-02 3.1845636e-02 -5.2189216e-02 -1.8514555e-02 1.7050716e-01 3.3649462e-01 2.9310084e-01 7.8582244e-02 -8.5200138e-02 -5.9242022e-02 5.3629257e-02 5.3919799e-02 -9.1290610e-02 -1.9983794e-01 -1.0236954e-01 1.3831631e-01 2.9035137e-01 -1.7703630e-01 -1.1470789e-01 -1.7257803e-02 7.3360924e-02 1.2806267e-01 1.3650217e-01 1.0539571e-01 5.4901306e-02 1.0347593e-02 -1.4210364e-02 -2.9316079e-02 -5.9818410e-02 -1.1287079e-01 -1.5651256e-01 -1.3759239e-01 -3.1325918e-02 1.2118952e-01 2.2925439e-01 2.1688928e-01 8.3280850e-02 -9.0968958e-02 -1.9863421e-01 -1.7919413e-01 -5.4874063e-02 9.1323774e-02 1.7241745e-01 1.4973591e-01 5.1202694e-02 -5.0722214e-02 -8.6474562e-02 -3.6675604e-02 5.0794719e-02 9.2852996e-02 3.5475423e-02 -9.8019853e-02 -2.1560266e-01 -2.2054921e-01 -8.4207430e-02 1.2773783e-01 2.9411889e-01 3.1432928e-01 1.7183620e-01 -5.3673166e-02 -2.3087548e-01 -2.5206313e-01 -9.9556443e-02 1.3579254e-01 3.0302360e-01 2.8345210e-01 6.9698019e-02 -2.2311064e-01 -4.2606792e-01 -4.1979542e-01 -2.0235411e-01 1.1680679e-01 3.8269042e-01 4.7499251e-01 3.6130151e-01 1.0698485e-01 -1.5666457e-01 -2.9684785e-01 -2.5130444e-01 -6.7456399e-02 1.2329504e-01 1.8968350e-01 8.9456729e-02 -1.0185072e-01 -2.4339863e-01 -2.2562726e-01 -4.5215735e-02 1.9190737e-01 3.3930982e-01 3.0360010e-01 1.0486525e-01 -1.3364785e-01 -2.6276635e-01 -2.0355127e-01 -1.0514338e-03 2.0109829e-01 2.5410141e-01 1.0538640e-01 -1.6182684e-01 -3.7724711e-01 -3.8906986e-01 -1.6075631e-01 2.0065197e-01 5.0030087e-01 5.6260189e-01 3.3306758e-01 -8.1981699e-02 -4.6637054e-01 -6.1157444e-01 -4.3578631e-01 -3.4787751e-02 3.6943357e-01 5.5331393e-01 4.1651911e-01 3.8203811e-02 -3.6624642e-01 -5.6531588e-01 -4.4111547e-01 -5.7977077e-02 3.6800859e-01 5.8749279e-01 4.6334166e-01 5.9154789e-02 -3.8817476e-01 -6.0585734e-01 -4.5438072e-01 -2.1770889e-02 4.2269933e-01 5.9388393e-01 3.7277877e-01 -1.1367643e-01 -5.6785416e-01 -7.0538273e-01 -4.3261293e-01 9.5667577e-02 5.7311674e-01 7.2849359e-01 4.8697304e-01 9.0040534e-03 -4.1643634e-01 -5.5375692e-01 -3.6053568e-01 1.0675442e-03 2.8391467e-01 3.2050851e-01 1.2014875e-01 -1.5499683e-01 -3.0636590e-01 -2.2845450e-01 3.0168597e-02 3.0447079e-01 4.1814633e-01 2.9408146e-01 3.3795396e-03 -2.8043536e-01 -3.9163122e-01 -2.7524621e-01 -1.6330862e-02 2.2338646e-01 3.1163298e-01 2.1884631e-01 2.0034460e-02 -1.6244160e-01 -2.3122765e-01 -1.5928083e-01 4.5460308e-03 1.6378113e-01 2.2566835e-01 1.5187573e-01 -1.8633628e-02 -1.8835877e-01 -2.5597784e-01 -1.7568160e-01 1.6144538e-02 2.1796548e-01 3.1334397e-01 2.3350541e-01 9.9054075e-04 -2.7139443e-01 -4.3349329e-01 -3.8409180e-01 -1.3941008e-01 1.6850242e-01 3.6865127e-01 3.5669633e-01 1.5962938e-01 -8.6421861e-02 -2.2603591e-01 -1.7879992e-01 1.5608870e-02 2.2316774e-01 2.9540664e-01 1.5777130e-01 -1.3932674e-01 -4.3707134e-01 -5.5308393e-01 -3.9056636e-01 -6.9866596e-03 4.0342788e-01 6.1470960e-01 5.0478901e-01 1.3556472e-01 -2.7661265e-01 -4.8754120e-01 -3.7410263e-01 -1.0933935e-02 3.7332700e-01 5.3265415e-01 3.5296792e-01 -7.5112937e-02 -5.0630963e-01 -6.8543131e-01 -5.0254861e-01 -6.3204556e-02 3.7616490e-01 5.6861420e-01 4.2839911e-01 7.7256895e-02 -2.4286013e-01 -3.2974149e-01 -1.4621212e-01 1.6396591e-01 3.7227253e-01 3.1398669e-01 -1.5203951e-03 -3.8826155e-01 -5.9422715e-01 -4.6290884e-01 -4.4082503e-02 4.2614489e-01 6.6944646e-01 5.4057059e-01 1.1914310e-01 -3.4186097e-01 -5.7361170e-01 -4.5144665e-01 -6.3037624e-02 3.5015696e-01 5.3940241e-01 3.9354970e-01 6.6063109e-05 -4.0735798e-01 -5.8396114e-01 -4.1610263e-01 1.0313382e-02 4.5449701e-01 6.5638620e-01 4.8903578e-01 3.8482894e-02 -4.3952337e-01 -6.6436421e-01 -4.9492372e-01 -1.7915270e-02 4.9445240e-01 7.3828446e-01 5.5772875e-01 4.3827397e-02 -5.1216643e-01 -7.8827423e-01 -6.2373284e-01 -1.1577453e-01 4.4053448e-01 7.3121649e-01 6.0691719e-01 1.6037942e-01 -3.4101558e-01 -6.1837622e-01 -5.3898039e-01 -1.7955555e-01 2.3296574e-01 4.6098842e-01 3.9204767e-01 9.4586522e-02 -2.3425494e-01 -3.9383077e-01 -2.9901136e-01 -2.1727093e-02 2.6290754e-01 3.8667642e-01 2.8641038e-01 3.4299620e-02 -2.1199530e-01 -3.0703990e-01 -2.0539827e-01 1.3733625e-02 1.9989717e-01 2.2856610e-01 8.0442398e-02 -1.4924794e-01 -3.1635143e-01 -3.2043874e-01 -1.6226330e-01 6.7449386e-02 2.5253008e-01 3.1855044e-01 2.6051993e-01 1.2699840e-01 -1.6342455e-02 -1.1750854e-01 -1.5094063e-01 -1.1699324e-01 -3.6407066e-02 5.7070826e-02 1.2470744e-01 1.3295525e-01 6.7237676e-02 -5.6199791e-02 -1.8928499e-01 -2.6860491e-01 -2.4751370e-01 -1.2546869e-01 4.7269068e-02 1.9379936e-01 2.5012057e-01 1.9757699e-01 6.9603172e-02 -6.6884197e-02 -1.4260360e-01 -1.1800895e-01 -4.5690911e-03 1.3505757e-01 2.1176910e-01 1.5667518e-01 -2.9715225e-02 -2.6058872e-01 -4.0072162e-01 -3.4636170e-01 -1.0002597e-01 2.1522385e-01 4.2116592e-01 3.9178740e-01 1.3552073e-01 -2.0194672e-01 -4.2193015e-01 -3.9351670e-01 -1.3365470e-01 2.0423921e-01 4.2544835e-01 4.1162219e-01 1.8730580e-01 -1.0283670e-01 -2.8986993e-01 -2.8756628e-01 -1.3866788e-01 2.8290398e-02 9.5513335e-02 3.5118646e-02 -8.2724881e-02 -1.5147446e-01 -1.0799938e-01 2.6949604e-02 1.6959254e-01 2.3358015e-01 1.8482066e-01 5.6424609e-02 -7.8806247e-02 -1.5583364e-01 -1.5299245e-01 -9.3729273e-02 -1.9708548e-02 3.8600307e-02 7.1469845e-02 7.8472613e-02 5.5625386e-02 -1.0621857e-03 -8.0782039e-02 -1.5057837e-01 -1.6705428e-01 -1.0304932e-01 2.9389143e-02 1.7801990e-01 2.7318425e-01 2.6234323e-01 1.3834554e-01 -5.4215912e-02 -2.3593270e-01 -3.2392000e-01 -2.6898405e-01 -8.5844039e-02 1.4215609e-01 2.9652172e-01 2.8801270e-01 1.1683545e-01 -1.1688760e-01 -2.6947626e-01 -2.4573958e-01 -6.4329645e-02 1.5353975e-01 2.6653313e-01 2.0755588e-01 2.4602079e-02 -1.5772495e-01 -2.2567844e-01 -1.4875573e-01 9.9414396e-03 1.4397851e-01 1.7486115e-01 9.6314112e-02 -3.2169687e-02 -1.2887854e-01 -1.3861783e-01 -5.9693947e-02 6.1826068e-02 1.6117670e-01 1.8758542e-01 1.2643056e-01 4.7038639e-03 -1.2089033e-01 -1.8936563e-01 -1.6676448e-01 -6.8240952e-02 4.6702545e-02 1.0911959e-01 8.7135042e-02 1.1538006e-02 -4.4789930e-02 -2.4262269e-02 6.5437901e-02 1.5116338e-01 1.4886934e-01 3.3820535e-02 -1.3097789e-01 -2.3522600e-01 -2.0099760e-01 -4.2018915e-02 1.4060900e-01 2.2430878e-01 1.4698003e-01 -4.9334401e-02 -2.4015379e-01 -2.9449301e-01 -1.5978257e-01 9.9469238e-02 3.3553927e-01 4.0432846e-01 2.5275189e-01 -4.8157255e-02 -3.4363559e-01 -4.8101858e-01 -3.9093124e-01 -1.2065446e-01 1.9561509e-01 4.0816957e-01 4.2449571e-01 2.4947873e-01 -2.2290220e-02 -2.5535821e-01 -3.3965313e-01 -2.4442241e-01 -3.2717407e-02 1.7386538e-01 2.6131002e-01 1.8344736e-01 -1.4617105e-02 -2.2004617e-01 -3.0989410e-01 -2.1648361e-01 2.9614296e-02 3.0600899e-01 4.6010027e-01 3.9585763e-01 1.3407054e-01 -1.9445050e-01 -4.2254041e-01 -4.4190341e-01 -2.6148822e-01 2.4561144e-03 1.9639531e-01 2.2058130e-01 8.8618067e-02 -8.2771773e-02 -1.5145974e-01 -4.8116921e-02 1.7081593e-01 3.5448643e-01 3.5655964e-01 1.3834184e-01 -1.9528570e-01 -4.5613811e-01 -4.9089820e-01 -2.7873232e-01 5.5837539e-02 3.2156811e-01 3.7683870e-01 2.1007687e-01 -6.1195486e-02 -2.6670692e-01 -2.8529736e-01 -1.1252984e-01 1.4069959e-01 3.1548805e-01 3.0070613e-01 1.0177110e-01 -1.6096596e-01 -3.2711612e-01 -2.9842835e-01 -9.9492033e-02 1.4305421e-01 2.8418081e-01 2.4879424e-01 7.0440776e-02 -1.3708347e-01 -2.5105923e-01 -2.1001593e-01 -4.5285982e-02 1.4155737e-01 2.4209754e-01 2.0725941e-01 7.3959838e-02 -6.6466455e-02 -1.3533231e-01 -1.1722667e-01 -5.6247689e-02 -8.2151160e-03 4.6646596e-03 -5.3013327e-05 6.4836935e-03 3.4885521e-02 7.2093769e-02 9.6085499e-02 9.0621414e-02 5.0063443e-02 -1.9216694e-02 -9.5194586e-02 -1.4177512e-01 -1.2554939e-01 -4.1561203e-02 7.4612994e-02 1.6458119e-01 1.8370169e-01 1.2694288e-01 2.5574339e-02 -7.6209464e-02 -1.4292208e-01 -1.5717793e-01 -1.2150507e-01 -5.7465582e-02 3.0433319e-03 3.8135050e-02 5.3444515e-02 7.4126764e-02 1.1232692e-01 1.4266966e-01 1.1713381e-01 1.2919877e-02 -1.3094351e-01 -2.2903887e-01 -2.1083457e-01 -7.7741149e-02 9.2251468e-02 1.9732652e-01 1.8027267e-01 6.1530912e-02 -8.1015797e-02 -1.6435623e-01 -1.4922825e-01 -5.8874212e-02 3.9408110e-02 7.8379546e-02 3.6886774e-02 -4.2241134e-02 -8.1505612e-02 -2.9557008e-02 9.2798034e-02 2.0055247e-01 2.0414883e-01 7.6944227e-02 -1.2029199e-01 -2.7519345e-01 -2.9408814e-01 -1.6081545e-01 5.1070794e-02 2.1840144e-01 2.3874816e-01 9.4335060e-02 -1.2904879e-01 -2.8774773e-01 -2.6899028e-01 -6.6408095e-02 2.1071698e-01 4.0356249e-01 3.9994180e-01 1.9633323e-01 -1.0730235e-01 -3.6601054e-01 -4.6248715e-01 -3.5922221e-01 -1.1354600e-01 1.4870456e-01 2.9521055e-01 2.5966678e-01 8.3040302e-02 -1.0914113e-01 -1.8742442e-01 -1.0478464e-01 7.3317409e-02 2.1546569e-01 2.1382067e-01 5.6531581e-02 -1.6427012e-01 -3.1183656e-01 -2.9186150e-01 -1.1383004e-01 1.1231696e-01 2.4506533e-01 2.0292544e-01 1.9811075e-02 -1.7391062e-01 -2.3677906e-01 -1.1242105e-01 1.2953875e-01 3.3467916e-01 3.5946938e-01 1.6169418e-01 -1.6880410e-01 -4.5538345e-01 -5.3000472e-01 -3.2991559e-01 5.7588162e-02 4.3386984e-01 5.9508457e-01 4.4813661e-01 6.8860243e-02 -3.3635714e-01 -5.4527976e-01 -4.4370745e-01 -8.9647493e-02 3.1753702e-01 5.4673805e-01 4.6318145e-01 1.0733728e-01 -3.1949400e-01 -5.6446899e-01 -4.7269412e-01 -8.8269356e-02 3.6150197e-01 5.9965309e-01 4.7275161e-01 5.2712510e-02 -4.0097128e-01 -6.0010920e-01 -4.1032807e-01 6.1089052e-02 5.2877389e-01 7.0388838e-01 4.7272792e-01 -3.2841140e-02 -5.1806125e-01 -7.0615746e-01 -5.0443062e-01 -5.3964611e-02 3.6781621e-01 5.2531916e-01 3.6514315e-01 3.1895267e-02 -2.4276338e-01 -2.9561167e-01 -1.2568333e-01 1.2380832e-01 2.6979551e-01 2.0920891e-01 -2.0179145e-02 -2.6980104e-01 -3.7620139e-01 -2.6519009e-01 -1.4966321e-04 2.5905182e-01 3.5875119e-01 2.4783584e-01 5.4317821e-03 -2.1770753e-01 -2.9814845e-01 -2.0810260e-01 -1.7395596e-02 1.5890290e-01 2.2758901e-01 1.6085463e-01 3.3576307e-03 -1.5297196e-01 -2.1737064e-01 -1.5023570e-01 1.2479222e-02 1.7606639e-01 2.4089523e-01 1.6216345e-01 -2.3230254e-02 -2.1504218e-01 -3.0098784e-01 -2.1779026e-01 8.8067567e-03 2.6812984e-01 4.1695437e-01 3.6159556e-01 1.2203070e-01 -1.7147580e-01 -3.5437470e-01 -3.3058973e-01 -1.3341351e-01 9.9954914e-02 2.1969740e-01 1.5589313e-01 -4.1996520e-02 -2.3771826e-01 -2.9083527e-01 -1.4002506e-01 1.5548285e-01 4.3862419e-01 5.3769302e-01 3.6811228e-01 -6.9569482e-03 -3.9769165e-01 -5.8956799e-01 -4.7193386e-01 -1.1138894e-01 2.8025332e-01 4.6943948e-01 3.4372376e-01 -1.6555081e-02 -3.8429530e-01 -5.2185674e-01 -3.2705351e-01 1.0055685e-01 5.1629500e-01 6.7570174e-01 4.8204840e-01 4.6679399e-02 -3.7892485e-01 -5.5799051e-01 -4.1189337e-01 -6.3130989e-02 2.4927425e-01 3.2624429e-01 1.3391859e-01 -1.7899014e-01 -3.7999275e-01 -3.0718591e-01 1.9919795e-02 4.0587411e-01 5.9872071e-01 4.5200311e-01 2.6827172e-02 -4.3774484e-01 -6.7014857e-01 -5.3423365e-01 -1.1312830e-01 3.4367827e-01 5.7281717e-01 4.5156693e-01 6.5481027e-02 -3.4683106e-01 -5.3783781e-01 -3.9562633e-01 -5.2304328e-03 4.0256826e-01 5.8408144e-01 4.2300297e-01 -1.8218267e-04 -4.4833216e-01 -6.5943295e-01 -5.0033881e-01 -5.1578103e-02 4.3192551e-01 6.6545648e-01 5.0237264e-01 2.6477477e-02 -4.8897549e-01 -7.3697545e-01 -5.5960739e-01 -4.7597748e-02 5.0867228e-01 7.8911527e-01 6.3269313e-01 1.3197226e-01 -4.2464681e-01 -7.2603682e-01 -6.1784801e-01 -1.8264666e-01 3.2014735e-01 6.1135123e-01 5.4895999e-01 1.9768580e-01 -2.2062099e-01 -4.6220719e-01 -4.0211731e-01 -9.9950534e-02 2.4465654e-01 4.1872319e-01 3.2500596e-01 3.2810917e-02 -2.7440750e-01 -4.1536442e-01 -3.1832701e-01 -5.5989066e-02 2.0726049e-01 3.1798239e-01 2.2484797e-01 5.1703651e-03 -1.8889751e-01 -2.2927380e-01 -9.1914974e-02 1.3314428e-01 3.0513495e-01 3.2224987e-01 1.7778028e-01 -4.7100451e-02 -2.4007922e-01 -3.2145867e-01 -2.7615883e-01 -1.4545755e-01 4.2822900e-03 1.1399372e-01 1.5138712e-01 1.1530153e-01 3.0234280e-02 -6.4234624e-02 -1.2615802e-01 -1.2407054e-01 -4.9317670e-02 7.5619816e-02 2.0015044e-01 2.6472178e-01 2.3118708e-01 1.0699863e-01 -5.5412012e-02 -1.8550876e-01 -2.3096135e-01 -1.8218227e-01 -7.2615500e-02 4.0881922e-02 1.0372451e-01 8.6362391e-02 -1.1351454e-03 -1.0889033e-01 -1.6548976e-01 -1.1405709e-01 4.6560657e-02 2.4386985e-01 3.6111476e-01 3.0662373e-01 8.1468123e-02 -2.0497551e-01 -3.9165036e-01 -3.6309524e-01 -1.2535574e-01 1.8954273e-01 3.9793935e-01 3.7486538e-01 1.3124068e-01 -1.9174474e-01 -4.0848802e-01 -4.0149539e-01 -1.8960477e-01 9.0301438e-02 2.7507284e-01 2.7972729e-01 1.4341274e-01 -1.2566755e-02 -7.8032703e-02 -2.7425697e-02 7.5351759e-02 1.3487633e-01 9.5488652e-02 -2.4590018e-02 -1.5233210e-01 -2.1189289e-01 -1.7248897e-01 -6.2455423e-02 5.4933614e-02 1.2398028e-01 1.2778044e-01 8.7386392e-02 3.4966577e-02 -1.0850501e-02 -4.6716543e-02 -6.9020828e-02 -6.3681635e-02 -1.6203206e-02 6.7394491e-02 1.5127737e-01 1.8399090e-01 1.2920707e-01 -7.0434827e-03 -1.7216342e-01 -2.8937677e-01 -2.9509198e-01 -1.7314710e-01 3.2745183e-02 2.3542177e-01 3.4097958e-01 2.9247721e-01 1.0411948e-01 -1.3495077e-01 -2.9868629e-01 -2.9240849e-01 -1.1517683e-01 1.2871323e-01 2.8803761e-01 2.6146766e-01 6.7234759e-02 -1.6729947e-01 -2.9180077e-01 -2.3297675e-01 -3.8493954e-02 1.6188055e-01 2.4607750e-01 1.7580193e-01 1.0770499e-02 -1.3917580e-01 -1.8630712e-01 -1.1496682e-01 1.8120146e-02 1.2605380e-01 1.4532251e-01 6.9056099e-02 -5.5814690e-02 -1.6001831e-01 -1.8912751e-01 -1.2778372e-01 -4.4698128e-03 1.2208903e-01 1.8963074e-01 1.6384408e-01 6.0799128e-02 -5.7339158e-02 -1.1860919e-01 -9.0086196e-02 -4.5798607e-03 6.0280807e-02 4.1676388e-02 -5.5180320e-02 -1.5518201e-01 -1.6828578e-01 -6.2049884e-02 1.0561621e-01 2.2337555e-01 2.0643187e-01 5.9839911e-02 -1.2043322e-01 -2.1083864e-01 -1.4415945e-01 4.3538937e-02 2.3203364e-01 2.9044234e-01 1.6171416e-01 -9.5674666e-02 -3.3749265e-01 -4.1795872e-01 -2.7746809e-01 2.0648626e-02 3.2603206e-01 4.8410918e-01 4.1672303e-01 1.5905611e-01 -1.6318595e-01 -3.9931562e-01 -4.4568803e-01 -2.9169291e-01 -2.0960934e-02 2.3175866e-01 3.4693819e-01 2.7877641e-01 7.7125945e-02 -1.4069530e-01 -2.5367798e-01 -2.0150506e-01 -1.6778161e-02 1.9116819e-01 2.9409556e-01 2.1593628e-01 -1.9610708e-02 -2.9401135e-01 -4.5512990e-01 -4.0311941e-01 -1.5075705e-01 1.7921653e-01 4.2153577e-01 4.6143206e-01 2.9688389e-01 3.5275834e-02 -1.7206796e-01 -2.2040717e-01 -1.1280250e-01 4.6014479e-02 1.2005000e-01 3.5297082e-02 -1.6459920e-01 -3.4121448e-01 -3.5130088e-01 -1.4787707e-01 1.7615712e-01 4.3972643e-01 4.8949447e-01 2.9899548e-01 -1.6059656e-02 -2.7414987e-01 -3.4124596e-01 -2.0476598e-01 3.1287353e-02 2.1535118e-01 2.3693813e-01 8.7039128e-02 -1.3914592e-01 -2.9731202e-01 -2.8057123e-01 -8.9244625e-02 1.6445576e-01 3.2621002e-01 2.9949560e-01 1.0678193e-01 -1.3016725e-01 -2.7225661e-01 -2.4687907e-01 -8.3173776e-02 1.1381888e-01 2.2819642e-01 1.9830143e-01 4.8505476e-02 -1.2763594e-01 -2.2560309e-01 -1.9560311e-01 -7.1212054e-02 6.0380807e-02 1.2445307e-01 1.0835168e-01 5.5609724e-02 1.7269294e-02 9.3997346e-03 1.1223045e-02 -4.3543819e-03 -4.2668837e-02 -8.5657964e-02 -1.0909342e-01 -9.7154374e-02 -4.6781850e-02 3.1101930e-02 1.0973840e-01 1.5122945e-01 1.2531404e-01 3.3620966e-02 -8.3194568e-02 -1.6716420e-01 1998. 1999. 2000. 2001.Program Results
IB03BD EXAMPLE PROGRAM RESULTS IWARN on exit from IB03BD = 12 Final 2-norm of the residuals = 0.2995840D+00 Number of iterations = 42 Number of function evaluations = 898 Number of Jacobian evaluations = 295 Final approximate solution is 14.1294 1.1232 6.4322 -11.2418 7.6380 -33.4730 -64.7203 747.1515 -0.4623 -92.6092 6.1682 -0.7672 0.1194 0.3558 0.9091 0.2948 1.3465 0.0093 0.0560 -0.0035 -0.4179 -0.0455 -2.0871 -0.9196 1.0777 0.9213 0.5373 1.0412 -0.3978 7.6832 -6.8614 -31.6119 -0.1092 -9.8984 0.1257 0.4056 0.0472 7.5819 -13.3969 2.4869 -66.0727 -0.8411 -0.7040 1.9641 1.3059 -0.2046 -0.9326 0.0040 0.4032 0.1479
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/KINSOL.html 0000664 0000000 0000000 00000071276 14560147231 0020466 0 ustar 00root root 0000000 0000000
Purpose
To solve a nonlinear system of equations F(u)=0, where F(u) is n n a nonlinear function from R to R , using Krylov Inexact Newton techniques.Specification
SUBROUTINE KINSOL (GSTRAT, LINSU, NEQ, OPTIN, MAXL, MAXLRST, & MSBPRE, UU, USCALE, FSCALE, CONSTR, & IOPT, ROPT, TOL1, TOL2, INFO) C .. Scalar Arguments .. LOGICAL OPTIN INTEGER INFO, GSTRAT, MAXL, MAXLRST, MSBPRE, NEQ DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. INTEGER IOPT(40) DOUBLE PRECISION CONSTR(NEQ), FSCALE(NEQ), ROPT(40), USCALE(NEQ), $ UU(NEQ)Arguments
Input/Output Parameters
GSTRAT (input) INTEGER Indicates the global strategy to apply the computed increment delta in the solution UU. Choices are: 0 - Inexact Newton. 1 - Linesearch. LINSU SUBROUTINE Linear Solver Set-up Routine. This is the KINSOL routine to be called to set-up the linear solver. The user should specify here one of the 6 different Fortran-callable routines provided by KINSOL for this purpose. The choice to be used depends on which of the optional user-defined routines are provided by the user (see User-defined routines below). LINSU can be one of the following routines: FKINSPGMR00, FKINSPGMR01, FKINSPGMR10, FKINSPGMR11, FKINSPGMR20, and FKINSPGMR21, where the first digit in the name of the function is: 0 if neither KPSOL nor KPRECO routines are provided; 1 if only the preconditioner solve routine (KPSOL) is provided; and 2 if both the preconditioner solve (KPSOL) and setup (KPRECO) routines are provided. The second digit is: 0 if a function FATIMES is not provided; and 1 if a function FATIMES is provided. NEQ (input) INTEGER Number of equations (and unknowns) in the algebraic system. OPTIN (input) LOGICAL Flag indicating whether optional inputs from the user in the arrays IOPT and ROPT are to be used. Pass FALSE to ignore all optional inputs and TRUE to use all optional inputs that are present. Either choice does NOT affect outputs in other positions of IOPT or ROPT. MAXL (input) INTEGER Maximum Krylov dimension for the Linear Solver. Pass 0 to use the default value MIN(Neq, 10). MAXLRST (input) INTEGER Maximum number of linear solver restarts allowed. Values outside the range 0 to 2*NEQ/MAXL will be restricted to that range. 0, meaning no restarts, is a safe starting value. MSBPRE (input) INTEGER Maximum number of steps calling the solver KPSOL without calling the preconditioner KPRECO. (The default is 10). UU (input/output) DOUBLE PRECISION array, dimension (NEQ) On entry, UU is the initial guess. On exit, if no errors ocurr, UU is the solution of the system KFUN(UU) = 0. USCALE (input) DOUBLE PRECISION array, dimension (NEQ) Array of diagonal elements of the scaling matrix for UU. The elements of USCALE must be positive values. The scaling matrix USCALE should be chosen so that USCALE * UU (as a matrix multiplication) should have all its components with roughly the same magnitude when UU is close to a root of KFUN. FSCALE (input) DOUBLE PRECISION array, dimension (NEQ) Array of diagonal elements of the scaling matrix for KFUN. The elements of FSCALE must be positive values. The scaling matrix FSCALE should be chosen so that FSCALE * KFUN(UU) (as a matrix multiplication) should have all its components with roughly the same magnitude when UU is NOT too near a root of KFUN. CONSTR (input) DOUBLE PRECISION array, dimension (NEQ) Constraints on UU. A positive value in CONSTR(I) implies that the Ith component of UU is to be constrained > 0. A negative value in CONSTR(I) implies that the Ith component of UU is to be constrained < 0. A zero value in CONSTR(I) implies there is no constraint on UU(I). IOPT (input/output) INTEGER array, dimension (40) Array of optional integer inputs and outputs. If OPTIN is TRUE, the user should preset to 0 those locations for which default values are to be used. See Optional Inputs and Outputs, below. ROPT (input/output) DOUBLE PRECISION array, dimension (40) Array of optional double precision inputs and outputs. If OPTIN is TRUE, the user should preset to 0 those locations for which default values are to be used. See Optional Inputs and Outputs, below.Tolerances
TOL1 DOUBLE PRECISION Stopping tolerance on maxnorm( FSCALE * KFUN(UU) ). If TOL1 is input as 0., then a default value of (uround) to the 1/3 power will be used. uround is the unit roundoff for the machine in use for the calculation. TOL2 DOUBLE PRECISION Stopping tolerance on the maximum scaled step UU(K) - UU(K-1). If TOL2 is input as 0., then a default value of (uround) to the 2/3 power will be used. uround is the unit roundoff for the machine in use for the calculation.Error Indicator
INFO (output) INTEGER See Termination Codes below. --------------------------------------------------------------- Termination Codes (Note: in this documentation we use named constants for certain integer constant values. To see the values of these symbols see Named constants below.) The termination values KINS_***** are now given. These are the values of the INFO argument. SUCCESS : means maxnorm(FSCALE*KFUN(UU) <= TOL1, where maxnorm() is the maximum norm function N_VMaxNorm. Therefore, UU is probably an approximate root of KFUN. INITIAL_GUESS_OK: means the initial guess UU has been found to already satisfy the system to the desired accuracy. No calculation was performed other than testing UU. STEP_LT_STPTOL: means the scaled distance between the last two steps is less than TOL2. UU may be an approximate root of KFUN, but it is also possible that the algorithm is making very slow progress and is not near a root or that TOL2 is too large LNSRCH_NONCONV: means the LineSearch module failed to reduce norm(KFUN) sufficiently on the last global step. Either UU is close to a root of F and no more accuracy is possible, or the finite-difference approximation to J*v is inaccurate, or TOL2 is too large. Check the outputs NCFL and NNI: if NCFL is close to NNI, it may be the case that the Krylov iteration is converging very slowly. In this case, the user may want to use precondition- ing and/or increase the MAXL argument (that is, increase the max dimension of the Krylov subspace) by setting MAXL to nonzero (thus not using the default value of KINSPGMR_MAXL) or if MAXL is being set, increase its value. MAXITER_REACHED: means that the maximum allowable number of nonlinear iterations has been reached. This is by default 200, but may be changed through optional input IOPT(MXITER). MXNEWT_5X_EXCEEDED: means 5 consecutive steps of length mxnewt (maximum Newton stepsize limit) have been taken. Either norm(F) asymptotes from above to a finite value in some direction, or mxnewt is too small. Mxnewt is computed internally (by default) as mxnewt = 1000*max(norm(USCALE*UU0),1), where UU0 is the initial guess for UU, and norm() is the Euclidean norm. Mxnewt can be set by the user through optional input ROPT(MXNEWTSTEP). LINESEARCH_BCFAIL: means that more than the allowed maximum number of failures (MXNBCF) occurred when trying to satisfy the beta condition in the linesearch algorithm. It is likely that the iteration is making poor progress. KRYLOV_FAILURE: means there was a failure of the Krylov iteration process to converge. PRECONDSET_FAILURE: means there was a nonrecoverable error in PrecondSet causing the iteration to halt. PRECONDSOLVE_FAILURE: means there was a nonrecoverable error in PrecondSolve causing the iteration to halt. NO_MEM: the KINSol memory pointer received was NULL. INPUT_ERROR: one or more input parameters or arrays was in error. See the program output for further info. LSOLV_NO_MEM: The linear solver memory pointer (lmem) was received as NULL. The return value from the linear solver needs to be checked and the cause found. ---------------------------------------------------------------Optional inputs and outputs
(Note: in this documentation we use named constants for certain integer constant values. To see the values of these symbols see Named constants below.) The user should declare two arrays for optional input and output, an IOPT array for optional integer input and output and an ROPT array for optional real input and output. These arrays should both be of size OPT_SIZE. So the user's declaration should look like: INTEGER IOPT(OPT_SIZE) DOUBLE PRECISION ROPT(OPT_SIZE) The following definitions are indices into the IOPT and ROPT arrays. A brief description of the contents of these positions follows. IOPT(PRINTFL) (input) Allows user to select from 4 levels of output. =0 no statistics printed (DEFAULT) =1 output the nonlinear iteration count, the scaled norm of KFUN(UU), and number of KFUN calls. =2 same as 1 with the addition of global strategy statistics: f1 = 0.5*norm(FSCALE*KFUN(UU))**2 and f1new = 0.5*norm(FSCALE*KFUN(unew))**2 . =3 same as 2 with the addition of further Krylov iteration statistics. IOPT(MXITER) (input) Maximum allowable number of nonlinear iterations. The default is MXITER_DEFAULT. IOPT(PRECOND_NO_INIT) (input) Set to 1 to prevent the initial call to the routine KPRECO upon a given call to KINSol. Set to 0 or leave unset to force the initial call to KPRECO. Use the choice of 1 only after beginning the first of a series of calls with a 0 value. If a value other than 0 or 1 is encountered, the default, 0, is set in this element of IOPT and thus the routine KPRECO will be called upon every call to KINSol, unless IOPT(PRECOND_NO_INIT) is changed by the user. IOPT(ETACHOICE) (input) A flag indicating which of three methods to use for computing eta, the coefficient in the linear solver convergence tolerance eps, given by eps = (eta+u_round)*norm(KFUN(UU)). Here, all norms are the scaled L2 norm. The linear solver attempts to produce a step p such that norm(KFUN(UU)+J(UU)*p) <= eps. Two of the methods for computing eta calculate a value based on the convergence process in the routine KINForcingTerm. The third method does not require calculation; a constant eta is selected. The default if IOPT(ETACHOICE) is not specified is ETACHOICE1, (see below). The allowed values (methods) are: ETACONSTANT constant eta, default of 0.1 or user supplied choice, for which see ROPT(ETACONST), ETACHOICE1 (default) which uses choice 1 of Eisenstat and Walker's paper of SIAM J. Sci. Comput.,17 (1996), pp 16-32 wherein eta is: eta(k) = ABS( norm(KFUN(UU(k))) - norm(KFUN(UU(k-1))+J(UU(k-1))*p) ) / norm(KFUN(UU(k-1))), ETACHOICE2 which uses choice 2 of Eisenstat and Walker wherein eta is: eta(k) = egamma * ( norm(KFUN(UU(k))) / norm(KFUN(u(k-1))) )^ealpha egamma and ealpha for choice 2, both required, are from either defaults (egamma = 0.9 , ealpha = 2) or from user input, see ROPT(ETAALPHA) and ROPT(ETAGAMMA), below. For eta(k) determined by either Choice 1 or Choice 2, a value eta_safe is determined, and the safeguard eta(k) <- max(eta_safe,eta(k)) is applied to prevent eta(k) from becoming too small too quickly. For Choice 1, eta_safe = eta(k-1)^((1.+sqrt(5.))/2.) and for Choice 2, eta_safe = egamma*eta(k-1)^ealpha. (These safeguards are turned off if they drop below 0.1 . Also, eta is never allowed to be less than eta_min = 1.e-4). IOPT(NO_MIN_EPS) (input) Set to 1 or greater to remove protection agains eps becoming too small. This option is useful for debugging linear and nonlinear solver interactions. Set to 0 for standard eps minimum value testing. IOPT(NNI) (output) Total number of nonlinear iterations. IOPT(NFE) (output) Total number of calls to the user- supplied system function KFUN. IOPT(NBCF) (output) Total number of times the beta condition could not be met in the linesearch algorithm. The nonlinear iteration is halted if this value ever exceeds MXNBCF (10). IOPT(NBKTRK) (output) Total number of backtracks in the linesearch algorithm. IOPT(SPGMR_NLI) (output) Number of linear iterations. IOPT(SPGMR_NPE) (output) Number of preconditioner evaluations. IOPT(SPGMR_NPS) (output) Number of calls made to user's psolve function. IOPT(SPGMR_NCFL) (output) Number of linear convergence failures. ROPT(MXNEWTSTEP) (input) Maximum allowable length of a Newton step. The default value is calculated from 1000*max(norm(USCALE*UU(0),norm(USCALE)). ROPT(RELFUNC) (input) Relative error in computing KFUN(UU) if known. Default is the machine epsilon. ROPT(RELU) (input) A scalar constraint which restricts the update of UU to del(UU)/UU < ROPT(RELU) The default is no constraint on the relative step in UU. ROPT(ETAGAMMA) (input) The coefficient egamma in the eta computation. See routine KINForcingTerm (SEE IOPT(ETACHOICE) above for additional info). ROPT(ETAALPHA) (input) The coefficient ealpha in the eta computation. See routine KINForcingTerm (SEE IOPT(ETACHOICE) above for additional info). ROPT(ETACONST) (input) A user specified constant value for eta, used in lieu of that computed by routine KINForcingTerm (SEE IOPT(ETACHOICE) above for additional info). ROPT(FNORM) (output) The scaled norm at a given iteration: norm(FSCALE(KFUN(UU)). ROPT(STEPL) (output) Last step length in the global strategy routine: KINLineSearch or KINInexactNewton. ---------------------------------------------------------------User-defined routines
In order to use this routine, some user-defined routines have to be provided. One of them is required, while the others are optional. These routines are described next. KFUN Required SUBROUTINE KFUN (NEQ, UU, FVAL) INTEGER NEQ DOUBLE PRECISION UU(NEQ), FVAL(NEQ) PURPOSE Evaluates the KFUN function which defines the system to be solved: KFUN(UU)=0 ARGUMENTS NEQ (input) INTEGER Number of equations (and unknowns) in the algebraic system UU (input) DOUBLE PRECISION array, dimension (NEQ) independent variable vector FVAL (output) DOUBLE PRECISION array, dimension (NEQ) Result of KFUN(UU) KPRECO Optional SUBROUTINE KPRECO (NEQ, UU, USCALE, FVAL, FSCALE, VTEMP1, VTEMP2, UROUND, NFE, IER) INTEGER NEQ, NFE, IER DOUBLE PRECISION UROUND DOUBLE PRECISION UU(NEQ), USCALE(NEQ), FVAL(NEQ), FSCALE(NEQ), VTEMP1(NEQ), VTEMP2(NEQ) PURPOSE The user-supplied preconditioner setup function KPRECO and the user-supplied preconditioner solve function KPSOL together must define the right preconditoner matrix P chosen so as to provide an easier system for the Krylov solver to solve. KPRECO is called to provide any matrix data required by the subsequent call(s) to KPSOL. The data is expected to be stored in variables within a COMMON block and the definition of those variables is up to the user. More specifically, the user-supplied preconditioner setup function KPRECO is to evaluate and preprocess any Jacobian-related data needed by the preconditioner solve function KPSOL. This might include forming a crude approximate Jacobian, and performing an LU factorization on the resulting approximation to J. This function will not be called in advance of every call to KPSOL, but instead will be called only as often as necessary to achieve convergence within the Newton iteration in KINSol. If the KPSOL function needs no preparation, the KPRECO function need not be provided. KPRECO should not modify the contents of the arrays UU or FVAL as those arrays are used elsewhere in the iteration process. Each call to the KPRECO function is preceded by a call to the system function KFUN. Thus the KPRECO function can use any auxiliary data that is computed by the KFUN function and saved in a way accessible to KPRECO. The two scaling arrays, FSCALE and USCALE, and unit roundoff UROUND are provided to the KPRECO function for possible use in approximating Jacobian data, e.g. by difference quotients. These arrays should also not be altered ARGUMENTS NEQ (input) INTEGER Number of equations (and unknowns) in the algebraic system. UU (input) DOUBLE PRECISION array, dimension (NEQ) Independent variable vector. USCALE (input) DOUBLE PRECISION array, dimension (NEQ) See USCALE above. FVAL (input) DOUBLE PRECISION array, dimension (NEQ) Current value of KFUN(UU). FSCALE (input) DOUBLE PRECISION array, dimension (NEQ) See FSCALE above. VTEMP1 DOUBLE PRECISION array, dimension (NEQ) Temporary work array. VTEMP2 DOUBLE PRECISION array, dimension (NEQ) Temporary work array. UROUND (input) DOUBLE PRECISION Machine unit roundoff. NFE (input/output) INTEGER Number of calls to KFUN made by the package. The KPRECO routine should update this counter by adding on the number of KFUN calls made in order to approximate the Jacobian, if any. For example, if the routine calls KFUN a total of W times, then the update is NFE = NFE + W. IER (output) INTEGER Error indicator. 0 if successful, 1 if failure, in which case KINSOL stops. KPSOL Optional SUBROUTINE KPSOL (NEQ, UU, USCALE, FVAL, FSCALE, VTEM, FTEM, UROUND, NFE, IER) INTEGER NEQ, NFE, IER DOUBLE PRECISION UU(NEQ), USCALE(NEQ), FVAL(NEQ), FSCALE(NEQ), VTEM(NEQ), FTEM(NEQ) PURPOSE The user-supplied preconditioner solve function KPSOL is to solve a linear system P x = r in which the matrix P is the (right) preconditioner matrix P. KPSOL should not modify the contents of the iterate array UU or the current function value array FVAL as those are used elsewhere in the iteration process. ARGUMENTS NEQ (input) INTEGER Number of equations (and unknowns) in the algebraic system. UU (input) DOUBLE PRECISION array, dimension (NEQ) Independent variable vector. USCALE (input) DOUBLE PRECISION array, dimension (NEQ) See USCALE above. FVAL (input) DOUBLE PRECISION array, dimension (NEQ) Current value of KFUN(UU). FSCALE (input) DOUBLE PRECISION array, dimension (NEQ) See FSCALE above. VTEM (input/output) DOUBLE PRECISION array, dimension (NEQ) On entry, holds the RHS vector r. On exit, holds the result x. FTEM DOUBLE PRECISION array, dimension (NEQ) Temporary work array. UROUND (input) DOUBLE PRECISION Machine unit roundoff. NFE (input/output) INTEGER Number of calls to KFUN made by the package. The KPRECO routine should update this counter by adding on the number of KFUN calls made in order to carry out the solution, if any. For example, if the routine calls KFUN a total of W times, then the update is NFE = NFE + W. IER (output) INTEGER Error indicator. 0 if successful, 1 if failure, in which case KINSOL stops. FATIMES Optional SUBROUTINE FATIMES(V, Z, NEWU, UU, IER) INTEGER NEWU, IER DOUBLE PRECISION V(:), Z(:), UU(:) PURPOSE The user-supplied A times V routine (optional) where A is the Jacobian matrix dF/du, or an approximation to it, and V is a given vector. This routine computes the product Z = J V. ARGUMENTS V (input) DOUBLE PRECISION array, dimension (NEQ) Vector to be multiplied by J (preconditioned and unscaled as received). Z (output) DOUBLE PRECISION array, dimension (NEQ) Vector resulting from the application of J to V. NEW_UU (input) INTEGER Flag indicating whether or not the UU vector has been changed since the last call to this function (0 means FALSE, 1 TRUE). If this function computes and saves Jacobian data, then this computation can be skipped if NEW_UU = FALSE. UU (input) DOUBLE PRECISION array, dimension (NEQ) Current iterate u. IER (output) INTEGER Error indicator. 0 if successful, 1 if failure, in which case KINSOL stops. ---------------------------------------------------------------Named constants
Here we specify the value of the named integer constants used in this documentation. We use Fortran code for the specification, so that the user can copy and paste these lines in order to use the named constants in his/her programs. KINSOL return values Note that the value of these constants differ from those of the KINSOL package. This is due to the adaptation to the SLICOT standards. INTEGER KINS_NO_MEM, KINS_INPUT_ERROR, KINS_LSOLV_NO_MEM, & KINS_SUCCESS, KINS_INITIAL_GUESS_OK,KINS_STEP_LT_STPTOL, & KINS_LNSRCH_NONCONV, KINS_MAXITER_REACHED, & KINS_MXNEWT_5X_EXCEEDED, KINS_LINESEARCH_BCFAIL, & KINS_KRYLOV_FAILURE, KINS_PRECONDSET_FAILURE, & KINS_PRECONDSOLVE_FAILURE} PARAMETER(KINS_NO_MEM=101) PARAMETER(KINS_INPUT_ERROR=102) PARAMETER(KINS_LSOLV_NO_MEM=103) PARAMETER(KINS_SUCCESS=0) PARAMETER(KINS_INITIAL_GUESS_OK=2) PARAMETER(KINS_STEP_LT_STPTOL=3) PARAMETER(KINS_LNSRCH_NONCONV=4) PARAMETER(KINS_MAXITER_REACHED=5) PARAMETER(KINS_MXNEWT_5X_EXCEEDED=6) PARAMETER(KINS_LINESEARCH_BCFAIL=7) PARAMETER(KINS_KRYLOV_FAILURE = 8) PARAMETER(KINS_PRECONDSET_FAILURE=9) PARAMETER(KINS_PRECONDSOLVE_FAILURE=10) Size of IOPT, ROPT INTEGER OPT_SIZE PARAMETER(OPT_SIZE=40) IOPT indices INTEGER PRINTFL, MXITER, PRECOND_NO_INIT, NNI ,NFE ,NBCF, NBKTRK, & ETACHOICE, NO_MIN_EPS INTEGER SPGMR_NLI, SPGMR_NPE, SPGMR_NPS, SPGMR_NCFL PARAMETER(PRINTFL=1) PARAMETER(MXITER=2) PARAMETER(PRECOND_NO_INIT=3) PARAMETER(NNI=4) PARAMETER(NFE=5) PARAMETER(NBCF=6) PARAMETER(NBKTRK=7) PARAMETER(ETACHOICE=8) PARAMETER(NO_MIN_EPS=9) PARAMETER(SPGMR_NLI=11) PARAMETER(SPGMR_NPE=12) PARAMETER(SPGMR_NPS=13) PARAMETER(SPGMR_NCFL=14) ROPT indices INTEGER MXNEWTSTEP , RELFUNC , RELU , FNORM , STEPL, & ETACONST, ETAGAMMA, ETAALPHA PARAMETER(MXNEWTSTEP=1) PARAMETER(RELFUNC=2) PARAMETER(RELU=3) PARAMETER(FNORM=4) PARAMETER(STEPL=5) PARAMETER(ETACONST=6) PARAMETER(ETAGAMMA=7) PARAMETER(ETAALPHA=8) Values for IOPT(ETACHOICE) INTEGER ETACHOICE1, ETACHOICE2, ETACONSTANT PARAMETER(ETACHOICE1=0) PARAMETER(ETACHOICE2=1) PARAMETER(ETACONSTANT=2) ---------------------------------------------------------------Method
KINSOL (Krylov Inexact Newton SOLver) is a general purpose solver for nonlinear systems of equations. Its most notable feature is that it uses Krylov Inexact Newton techniques in the system's approximate solution. The Newton method used results in the solution of linear systems of the form J(u)*x = b where J(u) is the Jacobian of F at u. The solution of these systems by a Krylov method requires products of the form J(u)*v, which are approximated by a difference quotient of the form F(u+sigma*v)-F(u) ----------------- sigma Thus, the Jacobian need not be formed explicitly.References
[1] Allan G. Taylor and Alan C. Hindmarsh, "User Documentation for KINSOL, a Nonlinear Solver for Sequential and Parallel Computers", Center for Applied Scientific Computing, L-561, LLNL, Livermore, CA 94551.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MA01AD.html 0000664 0000000 0000000 00000004033 14560147231 0020315 0 ustar 00root root 0000000 0000000
Purpose
To compute the complex square root YR + i*YI of a complex number XR + i*XI in real arithmetic. The returned result is so that YR >= 0.0 and SIGN(YI) = SIGN(XI).Specification
SUBROUTINE MA01AD( XR, XI, YR, YI ) C .. Scalar Arguments .. DOUBLE PRECISION XR, XI, YR, YIArguments
Input/Output Parameters
XR (input) DOUBLE PRECISION XI (input) DOUBLE PRECISION These scalars define the real and imaginary part of the complex number of which the square root is sought. YR (output) DOUBLE PRECISION YI (output) DOUBLE PRECISION These scalars define the real and imaginary part of the complex square root.Method
The complex square root YR + i*YI of the complex number XR + i*XI is computed in real arithmetic, taking care to avoid overflow.References
Adapted from EISPACK subroutine CSROOT.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the general product of K real scalars without over- or underflow.Specification
SUBROUTINE MA01BD( BASE, LGBAS, K, S, A, INCA, ALPHA, BETA, SCAL ) C .. Scalar Arguments .. INTEGER INCA, K, SCAL DOUBLE PRECISION ALPHA, BASE, BETA, LGBAS C .. Array Arguments .. INTEGER S(*) DOUBLE PRECISION A(*)Arguments
Input/Output Parameters
BASE (input) DOUBLE PRECISION Machine base. LGBAS (input) DOUBLE PRECISION Logarithm of BASE. K (input) INTEGER The number of scalars. K >= 1. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. A (input) DOUBLE PRECISION array, dimension (K) Vector of real scalars. INCA (input) INTEGER Increment for the array A. INCA <> 0. ALPHA (output) DOUBLE PRECISION ALPHA is a real scalar such that ALPHA / BETA * BASE**(SCAL) is the general product of the scalars in the array A. BETA (output) DOUBLE PRECISION BETA is either 0.0 or 1.0. See also the description of ALPHA. SCAL (output) INTEGER Scaling factor exponent, see ALPHA.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the general product of K complex scalars trying to avoid over- and underflow.Specification
SUBROUTINE MA01BZ( BASE, K, S, A, INCA, ALPHA, BETA, SCAL ) C .. Scalar Arguments .. INTEGER INCA, K, SCAL DOUBLE PRECISION BASE COMPLEX*16 ALPHA, BETA C .. Array Arguments .. INTEGER S(*) COMPLEX*16 A(*)Arguments
Input/Output Parameters
BASE (input) DOUBLE PRECISION Machine base. K (input) INTEGER The number of scalars. K >= 1. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. A (input) COMPLEX*16 array, dimension (K) Vector of complex scalars. INCA (input) INTEGER Increment for the array A. INCA <> 0. ALPHA (output) COMPLEX*16 ALPHA is a complex scalar with ABS(ALPHA) = 0, or 1.0 <= ABS(ALPHA) < BASE, such that ALPHA / BETA * BASE**(SCAL) is the general product of the scalars in the array A. BETA (output) COMPLEX*16 BETA is either 0.0 or 1.0. See also the description of ALPHA. SCAL (output) INTEGER Scaling factor exponent, see ALPHA.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute, without over- or underflow, the sign of the sum of two real numbers represented using integer powers of a base (usually, the machine base). Any base can be used, but it should the same for both numbers. The result is an integer with value 1, 0, or -1, depending on the sum being found as positive, zero, or negative, respectively.Specification
INTEGER FUNCTION MA01CD( A, IA, B, IB ) C .. Scalar Arguments .. INTEGER IA, IB DOUBLE PRECISION A, BFunction Value
MA01CD INTEGER The sign of the sum of the two numbers, which is usually either 1, or -1. If both numbers are 0, or if they have the same exponent and their sum is 0, the returned value is 0.Arguments
Input/Output Parameters
A (input) DOUBLE PRECISION The first real scalar. IA (input) INTEGER Exponent of the base for the first real scalar. The scalar is represented as A * BASE**(IA). B (input) DOUBLE PRECISION The first real scalar. IB (input) INTEGER Exponent of the base for the first real scalar. The scalar is represented as B * BASE**(IB).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute an approximate symmetric chordal metric for two complex numbers A1 and A2, with Aj = ARj + i*AIj, j = 1, 2.Specification
SUBROUTINE MA01DD( AR1, AI1, AR2, AI2, EPS, SAFEMN, D ) C .. Scalar Arguments .. DOUBLE PRECISION AI1, AI2, AR1, AR2, D, EPS, SAFEMNArguments
Input/Output Parameters
AR1 (input) DOUBLE PRECISION AI1 (input) DOUBLE PRECISION These scalars define the real and imaginary parts of the number A1. AR2 (input) DOUBLE PRECISION AI2 (input) DOUBLE PRECISION These scalars define the real and imaginary parts of the number A2. EPS (input) DOUBLE PRECISION The relative machine precision. See the LAPACK Library routine DLAMCH. SAFEMN (input) DOUBLE PRECISION The "safe minimum", such that its reciprocal does not overflow. See the LAPACK Library routine DLAMCH. D (output) DOUBLE PRECISION The approximate symmetric chordal metric D. D >= 0.Method
The approximate symmetric chordal metric is evaluated using the formula D = MIN( | A1 - A2 |, |1/A1 - 1/A2| ). The chordal metric is finite even if A1 and A2 are both infinite, or if one of them is infinite and the other is finite, nonzero.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute an approximate symmetric chordal metric for two complex numbers A1 and A2 in real arithmetic. Each number Aj, j = 1, 2, is represented as a rational number with numerator ARj + i*AIj, and denominator Bj, with Bj >= 0. A value Bj = 0, when ARj or AIj is nonzero, means that the number Aj is infinite. The case when ARj = AIj = Bj = 0 means that the pair (Aj,Bj) is not a number.Specification
SUBROUTINE MA01DZ( AR1, AI1, B1, AR2, AI2, B2, EPS, SAFEMN, D1, $ D2, IWARN ) C .. Scalar Arguments .. DOUBLE PRECISION AI1, AI2, AR1, AR2, B1, B2, D1, D2, EPS, SAFEMN INTEGER IWARNArguments
Input/Output Parameters
AR1 (input) DOUBLE PRECISION AI1 (input) DOUBLE PRECISION These scalars define the real and imaginary parts of the numerator of A1. B1 (input) DOUBLE PRECISION The denominator of A1. B1 >= 0. AR2 (input) DOUBLE PRECISION AI2 (input) DOUBLE PRECISION These scalars define the real and imaginary parts of the numerator of A2. B2 (input) DOUBLE PRECISION The denominator of A2. B2 >= 0. EPS (input) DOUBLE PRECISION The relative machine precision. See the LAPACK Library routine DLAMCH. SAFEMN (input) DOUBLE PRECISION The "safe minimum", such that its reciprocal does not overflow. See the LAPACK Library routine DLAMCH. D1 (output) DOUBLE PRECISION The numerator of the chordal metric D. D1 >= 0. D2 (output) DOUBLE PRECISION The denominator of the chordal metric D. D2 is 0 or 1. If D2 = 0, and D1 = 0, the chordal metric is undefined, so either A1 and/or A2 are undefined.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: A1 or A2 is not a number (NaN); D1 and D2 are both set to 0.Method
The approximate symmetric chordal metric is evaluated using the formula D = MIN( | A1 - A2 |, |1/A1 - 1/A2| ), taking into account the special cases of infinite or NaN values. The chordal metric is finite even if A1 and A2 are both infinite, or if one of them is infinite and the other is finite, nonzero.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To transpose all or part of a two-dimensional matrix A into another matrix B.Specification
SUBROUTINE MA02AD( JOB, M, N, A, LDA, B, LDB ) C .. Scalar Arguments .. CHARACTER JOB INTEGER LDA, LDB, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the part of the matrix A to be transposed into B as follows: = 'U': Upper triangular part; = 'L': Lower triangular part; Otherwise: All of the matrix A.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The m-by-n matrix A. If JOB = 'U', only the upper triangle or trapezoid is accessed; if JOB = 'L', only the lower triangle or trapezoid is accessed. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). B (output) DOUBLE PRECISION array, dimension (LDB,M) B = A' in the locations specified by JOB. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To (conjugate) transpose all or part of a two-dimensional complex matrix A into another matrix B.Specification
SUBROUTINE MA02AZ( TRANS, JOB, M, N, A, LDA, B, LDB ) C .. Scalar Arguments .. CHARACTER JOB, TRANS INTEGER LDA, LDB, M, N C .. Array Arguments .. COMPLEX*16 A(LDA,*), B(LDB,*)Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies if a transpose or conjugate transpose operation should be performed as follows: = 'T': transpose operation; = 'C': conjugate transpose operation. JOB CHARACTER*1 Specifies the part of the matrix A to be transposed into B as follows: = 'U': Upper triangular part; = 'L': Lower triangular part; Otherwise: All of the matrix A.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input) COMPLEX*16 array, dimension (LDA,N) The m-by-n matrix A. If JOB = 'U', only the upper triangle or trapezoid is accessed; if JOB = 'L', only the lower triangle or trapezoid is accessed. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). B (output) COMPLEX*16 array, dimension (LDB,M) B = A' in the locations specified by JOB, where ' denotes the transpose or conjugate transpose operation, as as specified by TRANS. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reverse the order of rows and/or columns of a given matrix A by pre-multiplying and/or post-multiplying it, respectively, with a permutation matrix P, where P is a square matrix of appropriate order, with ones down the secondary diagonal.Specification
SUBROUTINE MA02BD( SIDE, M, N, A, LDA ) C .. Scalar Arguments .. CHARACTER SIDE INTEGER LDA, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies the operation to be performed, as follows: = 'L': the order of rows of A is to be reversed by pre-multiplying A with P; = 'R': the order of columns of A is to be reversed by post-multiplying A with P; = 'B': both the order of rows and the order of columns of A is to be reversed by pre-multiplying and post-multiplying A with P.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M-by-N part of this array must contain the given matrix whose rows and/or columns are to be permuted. On exit, the leading M-by-N part of this array contains the matrix P*A if SIDE = 'L', or A*P if SIDE = 'R', or P*A*P if SIDE = 'B'. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reverse the order of rows and/or columns of a given matrix A by pre-multiplying and/or post-multiplying it, respectively, with a permutation matrix P, where P is a square matrix of appropriate order, with ones down the secondary diagonal.Specification
SUBROUTINE MA02BZ( SIDE, M, N, A, LDA ) C .. Scalar Arguments .. CHARACTER SIDE INTEGER LDA, M, N C .. Array Arguments .. COMPLEX*16 A(LDA,*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies the operation to be performed, as follows: = 'L': the order of rows of A is to be reversed by pre-multiplying A with P; = 'R': the order of columns of A is to be reversed by post-multiplying A with P; = 'B': both the order of rows and the order of columns of A is to be reversed by pre-multiplying and post-multiplying A with P.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading M-by-N part of this array must contain the given matrix whose rows and/or columns are to be permuted. On exit, the leading M-by-N part of this array contains the matrix P*A if SIDE = 'L', or A*P if SIDE = 'R', or P*A*P if SIDE = 'B'. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the pertranspose of a central band of a square matrix.Specification
SUBROUTINE MA02CD( N, KL, KU, A, LDA ) C .. Scalar Arguments .. INTEGER KL, KU, LDA, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the square matrix A. N >= 0. KL (input) INTEGER The number of subdiagonals of A to be pertransposed. 0 <= KL <= N-1. KU (input) INTEGER The number of superdiagonals of A to be pertransposed. 0 <= KU <= N-1. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain a square matrix whose central band formed from the KL subdiagonals, the main diagonal and the KU superdiagonals will be pertransposed. On exit, the leading N-by-N part of this array contains the matrix A with its central band (the KL subdiagonals, the main diagonal and the KU superdiagonals) pertransposed (that is the elements of each antidiagonal appear in reversed order). This is equivalent to forming P*B'*P, where B is the matrix formed from the central band of A and P is a permutation matrix with ones down the secondary diagonal. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the pertranspose of a central band of a square matrix.Specification
SUBROUTINE MA02CZ( N, KL, KU, A, LDA ) C .. Scalar Arguments .. INTEGER KL, KU, LDA, N C .. Array Arguments .. COMPLEX*16 A(LDA,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the square matrix A. N >= 0. KL (input) INTEGER The number of subdiagonals of A to be pertransposed. 0 <= KL <= N-1. KU (input) INTEGER The number of superdiagonals of A to be pertransposed. 0 <= KU <= N-1. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain a square matrix whose central band formed from the KL subdiagonals, the main diagonal and the KU superdiagonals will be pertransposed. On exit, the leading N-by-N part of this array contains the matrix A with its central band (the KL subdiagonals, the main diagonal and the KU superdiagonals) pertransposed (that is the elements of each antidiagonal appear in reversed order). This is equivalent to forming P*B'*P, where B is the matrix formed from the central band of A and P is a permutation matrix with ones down the secondary diagonal. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To pack/unpack the upper or lower triangle of a symmetric matrix. The packed matrix is stored column-wise in the one-dimensional array AP.Specification
SUBROUTINE MA02DD( JOB, UPLO, N, A, LDA, AP ) C .. Scalar Arguments .. CHARACTER JOB, UPLO INTEGER LDA, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), AP(*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies whether the matrix should be packed or unpacked, as follows: = 'P': The matrix should be packed; = 'U': The matrix should be unpacked. UPLO CHARACTER*1 Specifies the part of the matrix to be packed/unpacked, as follows: = 'U': Upper triangular part; = 'L': Lower triangular part.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input or output) DOUBLE PRECISION array, dimension (LDA,N) This array is an input parameter if JOB = 'P', and an output parameter if JOB = 'U'. On entry, if JOB = 'P', the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array must contain the corresponding upper or lower triangle of the symmetric matrix A, and the other strictly triangular part is not referenced. On exit, if JOB = 'U', the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding upper or lower triangle of the symmetric matrix A; the other strictly triangular part is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). AP (output or input) DOUBLE PRECISION array, dimension (N*(N+1)/2) This array is an output parameter if JOB = 'P', and an input parameter if JOB = 'U'. On entry, if JOB = 'U', the leading N*(N+1)/2 elements of this array must contain the upper (if UPLO = 'U') or lower (if UPLO = 'L') triangle of the symmetric matrix A, packed column-wise. That is, the elements are stored in the order 11, 12, 22, ..., 1n, 2n, 3n, ..., nn, if UPLO = 'U'; 11, 21, 31, ..., n1, 22, 32, ..., n2, ..., if UPLO = 'L'. On exit, if JOB = 'P', the leading N*(N+1)/2 elements of this array contain the upper (if UPLO = 'U') or lower (if UPLO = 'L') triangle of the symmetric matrix A, packed column-wise, as described above.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To store by symmetry the upper or lower triangle of a symmetric matrix, given the other triangle.Specification
SUBROUTINE MA02ED( UPLO, N, A, LDA ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER LDA, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which part of the matrix is given as follows: = 'U': Upper triangular part; = 'L': Lower triangular part. For all other values, the array A is not referenced.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array must contain the corresponding upper or lower triangle of the symmetric matrix A. On exit, the leading N-by-N part of this array contains the symmetric matrix A with all elements stored. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To store by skew-symmetry the upper or lower triangle of a skew-symmetric matrix, given the other triangle. The diagonal entries are set to zero.Specification
SUBROUTINE MA02ES( UPLO, N, A, LDA ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER LDA, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which part of the matrix is given as follows: = 'U': Upper triangular part; = 'L': Lower triangular part. For all other values, the array A is not referenced.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array must contain the corresponding upper or lower triangle of the skew-symmetric matrix A. On exit, the leading N-by-N part of this array contains the skew-symmetric matrix A with all elements stored. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To store by (skew-)symmetry the upper or lower triangle of a (skew-)symmetric/Hermitian complex matrix, given the other triangle. The option SKEW = 'G' allows to suitably deal with the diagonal of a general square triangular matrix.Specification
SUBROUTINE MA02EZ( UPLO, TRANS, SKEW, N, A, LDA ) C .. Scalar Arguments .. CHARACTER SKEW, TRANS, UPLO INTEGER LDA, N C .. Array Arguments .. COMPLEX*16 A(LDA,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which part of the matrix is given as follows: = 'U': Upper triangular part; = 'L': Lower triangular part. For all other values, the array A is not referenced. TRANS CHARACTER*1 Specifies whether to use transposition or conjugate transposition as follows: = 'T': Use transposition; = 'C': Use conjugate transposition. SKEW CHARACTER*1 Specifies whether the matrix is symmetric/Hermitian or skew-symmetric/Hermitian as follows: = 'G': The matrix is not symmetric/Hermitian (general); = 'N': The matrix is symmetric/Hermitian; = 'S': The matrix is skew-symmetric/Hermitian.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array must contain the corresponding upper or lower triangle of the (skew-)symmetric/Hermitian matrix A. On exit, the leading N-by-N part of this array contains the (skew-)symmetric/Hermitian matrix A with all elements stored. If the resulted matrix should be Hermitian, the imaginary parts of the diagonal entries are set to zero. If the resulted matrix should be skew-Hermitian, the real parts of the diagonal entries are set to zero. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the coefficients c and s (c^2 + s^2 = 1) for a modified hyperbolic plane rotation, such that, y1 := 1/c * x1 - s/c * x2 = sqrt(x1^2 - x2^2), y2 := -s * y1 + c * x2 = 0, given two real numbers x1 and x2, satisfying either x1 = x2 = 0, or abs(x2) < abs(x1).Specification
SUBROUTINE MA02FD( X1, X2, C, S, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION X1, X2, C, S INTEGER INFOArguments
Input/Output Parameters
X1 (input/output) DOUBLE PRECISION On entry, the real number x1. On exit, the real number y1. X2 (input) DOUBLE PRECISION The real number x2. The values x1 and x2 should satisfy either x1 = x2 = 0, or abs(x2) < abs(x1). C (output) DOUBLE PRECISION The cosines c of the modified hyperbolic plane rotation. S (output) DOUBLE PRECISION The sines s of the modified hyperbolic plane rotation.Error Indicator
INFO INTEGER = 0: succesful exit; = 1: if abs(x2) >= abs(x1) and either x1 <> 0 or x2 <> 0.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To perform a series of column interchanges on the matrix A. One column interchange is initiated for each of columns K1 through K2 of A. This is useful for solving linear systems X*A = B, when the matrix A has already been factored by LAPACK Library routine DGETRF.Specification
SUBROUTINE MA02GD( N, A, LDA, K1, K2, IPIV, INCX ) C .. Scalar Arguments .. INTEGER INCX, K1, K2, LDA, N C .. Array Arguments .. INTEGER IPIV( * ) DOUBLE PRECISION A( LDA, * )Arguments
Input/Output Parameters
N (input) INTEGER The number of rows of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,*) On entry, the leading N-by-M part of this array must contain the matrix A to which the column interchanges will be applied, where M is the largest element of IPIV(K), for K = K1, ..., K2. On exit, the leading N-by-M part of this array contains the permuted matrix. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). K1 (input) INTEGER The first element of IPIV for which a column interchange will be done. K2 (input) INTEGER The last element of IPIV for which a column interchange will be done. IPIV (input) INTEGER array, dimension (K1+(K2-K1)*abs(INCX)) The vector of interchanging (pivot) indices. Only the elements in positions K1 through K2 of IPIV are accessed. IPIV(K) = L implies columns K and L are to be interchanged. INCX (input) INTEGER The increment between successive values of IPIV. If INCX is negative, the interchanges are applied in reverse order.Method
The columns IPIV(K) and K are swapped for K = K1, ..., K2, for INCX = 1 (and similarly, for INCX <> 1).Further Comments
This routine is the column-oriented counterpart of the LAPACK Library routine DLASWP. The LAPACK Library routine DLAPMT cannot be used in this context. To solve the system X*A = B, where A and B are N-by-N and M-by-N, respectively, the following statements can be used: CALL DGETRF( N, N, A, LDA, IPIV, INFO ) CALL DTRSM( 'R', 'U', 'N', 'N', M, N, ONE, A, LDA, B, LDB ) CALL DTRSM( 'R', 'L', 'N', 'U', M, N, ONE, A, LDA, B, LDB ) CALL MA02GD( M, B, LDB, 1, N, IPIV, -1 )Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To perform a series of column interchanges on the matrix A. One column interchange is initiated for each of columns K1 through K2 of A. This is useful for solving linear systems X*A = B, when the matrix A has already been factored by LAPACK Library routine DGETRF.Specification
SUBROUTINE MA02GZ( N, A, LDA, K1, K2, IPIV, INCX ) C .. Scalar Arguments .. INTEGER INCX, K1, K2, LDA, N C .. Array Arguments .. INTEGER IPIV( * ) COMPLEX*16 A( LDA, * )Arguments
Input/Output Parameters
N (input) INTEGER The number of rows of the matrix A. N >= 0. A (input/output) COMPLEX*16 array, dimension (LDA,*) On entry, the leading N-by-M part of this array must contain the matrix A to which the column interchanges will be applied, where M is the largest element of IPIV(K), for K = K1, ..., K2. On exit, the leading N-by-M part of this array contains the permuted matrix. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). K1 (input) INTEGER The first element of IPIV for which a column interchange will be done. K2 (input) INTEGER The last element of IPIV for which a column interchange will be done. IPIV (input) INTEGER array, dimension (K1+(K2-K1)*abs(INCX)) The vector of interchanging (pivot) indices. Only the elements in positions K1 through K2 of IPIV are accessed. IPIV(K) = L implies columns K and L are to be interchanged. INCX (input) INTEGER The increment between successive values of IPIV. If INCX is negative, the interchanges are applied in reverse order.Method
The columns IPIV(K) and K are swapped for K = K1, ..., K2, for INCX = 1 (and similarly, for INCX <> 1).Further Comments
This routine is the column-oriented counterpart of the LAPACK Library routine DLASWP. The LAPACK Library routine DLAPMT cannot be used in this context. To solve the system X*A = B, where A and B are N-by-N and M-by-N, respectively, the following statements can be used: CALL DGETRF( N, N, A, LDA, IPIV, INFO ) CALL DTRSM( 'R', 'U', 'N', 'N', M, N, ONE, A, LDA, B, LDB ) CALL DTRSM( 'R', 'L', 'N', 'U', M, N, ONE, A, LDA, B, LDB ) CALL MA02GZ( M, B, LDB, 1, N, IPIV, -1 )Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To check if A = DIAG*I, where I is an M-by-N matrix with ones on the diagonal and zeros elsewhere.Specification
LOGICAL FUNCTION MA02HD( JOB, M, N, DIAG, A, LDA ) C .. Scalar Arguments .. CHARACTER JOB INTEGER LDA, M, N DOUBLE PRECISION DIAG C .. Array Arguments .. DOUBLE PRECISION A(LDA,*)Function Value
MA02HD LOGICAL The function value is set to .TRUE. if A = DIAG*I, and to .FALSE., otherwise. If min(M,N) = 0, the value is .FALSE.Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the part of the matrix A to be checked out, as follows: = 'U': Upper triangular/trapezoidal part; = 'L': Lower triangular/trapezoidal part. Otherwise: All of the matrix A.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. DIAG (input) DOUBLE PRECISION The scalar DIAG. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix A. If JOB = 'U', only the upper triangle or trapezoid is accessed; if JOB = 'L', only the lower triangle or trapezoid is accessed. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M).Method
The routine returns immediately after detecting a diagonal element which differs from DIAG, or a nonzero off-diagonal element in the searched part of A.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To check if A = DIAG*I, where I is an M-by-N matrix with ones on the diagonal and zeros elsewhere, A is a complex matrix and DIAG is a complex scalar.Specification
LOGICAL FUNCTION MA02HZ( JOB, M, N, DIAG, A, LDA ) C .. Scalar Arguments .. CHARACTER JOB INTEGER LDA, M, N COMPLEX*16 DIAG C .. Array Arguments .. COMPLEX*16 A(LDA,*)Function Value
MA02HZ LOGICAL The function value is set to .TRUE. if A = DIAG*I, and to .FALSE., otherwise. If min(M,N) = 0, the value is .FALSE.Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the part of the matrix A to be checked out, as follows: = 'U': Upper triangular/trapezoidal part; = 'L': Lower triangular/trapezoidal part. Otherwise: All of the matrix A.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. DIAG (input) COMPLEX*16 The scalar DIAG. A (input) COMPLEX*16 array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix A. If JOB = 'U', only the upper triangle or trapezoid is accessed; if JOB = 'L', only the lower triangle or trapezoid is accessed. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M).Method
The routine returns immediately after detecting a diagonal element which differs from DIAG, or a nonzero off-diagonal element in the searched part of A.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real skew-Hamiltonian matrix [ A G ] T T X = [ T ], G = -G, Q = -Q, [ Q A ] or of a real Hamiltonian matrix [ A G ] T T X = [ T ], G = G, Q = Q, [ Q -A ] where A, G and Q are real n-by-n matrices. Note that for this kind of matrices the infinity norm is equal to the one norm.Specification
DOUBLE PRECISION FUNCTION MA02ID( TYP, NORM, N, A, LDA, QG, $ LDQG, DWORK ) C .. Scalar Arguments .. CHARACTER NORM, TYP INTEGER LDA, LDQG, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), QG(LDQG,*)Function Value
MA02ID DOUBLE PRECISION The computed norm.Arguments
Mode Parameters
TYP CHARACTER*1 Specifies the type of the input matrix X: = 'S': X is skew-Hamiltonian; = 'H': X is Hamiltonian. NORM CHARACTER*1 Specifies the value to be returned in MA02ID: = '1' or 'O': one norm of X; = 'F' or 'E': Frobenius norm of X; = 'I': infinity norm of X; = 'M': max(abs(X(i,j)).Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). QG (input) 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 lower triangular part of the matrix Q and in columns 2:N+1 the upper triangular part of the matrix G. If TYP = 'S', the parts containing the diagonal and the first supdiagonal of this array are not referenced. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) where LDWORK >= 2*N when NORM = '1', NORM = 'I' or NORM = 'O'; otherwise, DWORK is not referenced.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex skew-Hamiltonian matrix [ A G ] H H X = [ H ], G = -G, Q = -Q, [ Q A ] or of a complex Hamiltonian matrix [ A G ] H H X = [ H ], G = G, Q = Q, [ Q -A ] where A, G and Q are complex n-by-n matrices. Note that for this kind of matrices the infinity norm is equal to the one norm.Specification
DOUBLE PRECISION FUNCTION MA02IZ( TYP, NORM, N, A, LDA, QG, $ LDQG, DWORK ) C .. Scalar Arguments .. CHARACTER NORM, TYP INTEGER LDA, LDQG, N C .. Array Arguments .. COMPLEX*16 A(LDA,*), QG(LDQG,*) DOUBLE PRECISION DWORK(*)Function Value
MA02IZ DOUBLE PRECISION The computed norm.Arguments
Mode Parameters
TYP CHARACTER*1 Specifies the type of the input matrix X: = 'S': X is skew-Hamiltonian; = 'H': X is Hamiltonian. NORM CHARACTER*1 Specifies the value to be returned in MA02IZ: = '1' or 'O': one norm of X; = 'F' or 'E': Frobenius norm of X; = 'I': infinity norm of X; = 'M': max(abs(X(i,j)).Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input) COMPLEX*16 array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). QG (input) COMPLEX*16 array, dimension (LDQG,N+1) On entry, the leading N-by-N+1 part of this array must contain in columns 1:N the lower triangular part of the matrix Q and in columns 2:N+1 the upper triangular part of the matrix G. If TYP = 'S', the real parts of the entries on the diagonal and the first superdiagonal of this array, which should be zero, need not be set, since they are not used. Similarly, if TYP = 'H', the imaginary parts of the entries on the diagonal and the first superdiagonal of this array, which should be zero, need not be set. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) where LDWORK >= 2*N when NORM = '1', NORM = 'I' or NORM = 'O'; otherwise, DWORK is not referenced.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute || Q^T Q - I ||_F for a matrix of the form [ op( Q1 ) op( Q2 ) ] Q = [ ], [ -op( Q2 ) op( Q1 ) ] where Q1 and Q2 are N-by-N matrices. This residual can be used to test wether Q is numerically an orthogonal symplectic matrix.Specification
DOUBLE PRECISION FUNCTION MA02JD( LTRAN1, LTRAN2, N, Q1, LDQ1, Q2, $ LDQ2, RES, LDRES ) C .. Scalar Arguments .. LOGICAL LTRAN1, LTRAN2 INTEGER LDQ1, LDQ2, LDRES, N C .. Array Arguments .. DOUBLE PRECISION Q1(LDQ1,*), Q2(LDQ2,*), RES(LDRES,*)Function Value
MA02JD DOUBLE PRECISION The computed residual.Arguments
Mode Parameters
LTRAN1 LOGICAL Specifies the form of op( Q1 ) as follows: = .FALSE.: op( Q1 ) = Q1; = .TRUE. : op( Q1 ) = Q1'. LTRAN2 LOGICAL Specifies the form of op( Q2 ) as follows: = .FALSE.: op( Q2 ) = Q2; = .TRUE. : op( Q2 ) = Q2'.Input/Output Parameters
N (input) INTEGER The order of the matrices Q1 and Q2. N >= 0. Q1 (input) DOUBLE PRECISION array, dimension (LDQ1,N) On entry, the leading N-by-N part of this array must contain the matrix op( Q1 ). LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= MAX(1,N). Q2 (input) DOUBLE PRECISION array, dimension (LDQ2,N) On entry, the leading N-by-N part of this array must contain the matrix op( Q2 ). LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= MAX(1,N).Workspace
RES DOUBLE PRECISION array, dimension (LDRES,N) LDRES INTEGER The leading dimension of the array RES. LDRES >= MAX(1,N).Method
The routine computes the residual by simple elementary operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute || Q^H Q - I ||_F for a complex matrix of the form [ op( Q1 ) op( Q2 ) ] Q = [ ], [ -op( Q2 ) op( Q1 ) ] where Q1 and Q2 are N-by-N matrices. This residual can be used to test wether Q is numerically a unitary symplectic matrix.Specification
DOUBLE PRECISION FUNCTION MA02JZ( LTRAN1, LTRAN2, N, Q1, LDQ1, Q2, $ LDQ2, RES, LDRES ) C .. Scalar Arguments .. LOGICAL LTRAN1, LTRAN2 INTEGER LDQ1, LDQ2, LDRES, N C .. Array Arguments .. COMPLEX*16 Q1(LDQ1,*), Q2(LDQ2,*), RES(LDRES,*)Function Value
MA02JZ DOUBLE PRECISION The computed residual.Arguments
Mode Parameters
LTRAN1 LOGICAL Specifies the form of op( Q1 ) as follows: = .FALSE.: op( Q1 ) = Q1; = .TRUE. : op( Q1 ) = Q1'. LTRAN2 LOGICAL Specifies the form of op( Q2 ) as follows: = .FALSE.: op( Q2 ) = Q2; = .TRUE. : op( Q2 ) = Q2'.Input/Output Parameters
N (input) INTEGER The order of the matrices Q1 and Q2. N >= 0. Q1 (input) COMPLEX*16 array, dimension (LDQ1,N) On entry, the leading N-by-N part of this array must contain the matrix op( Q1 ). LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= MAX(1,N). Q2 (input) COMPLEX*16 array, dimension (LDQ2,N) On entry, the leading N-by-N part of this array must contain the matrix op( Q2 ). LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= MAX(1,N).Workspace
RES DOUBLE PRECISION array, dimension (LDRES,N) LDRES INTEGER The leading dimension of the array RES. LDRES >= MAX(1,N).Method
The routine computes the residual by simple elementary operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real skew-symmetric matrix. Note that for this kind of matrices the infinity norm is equal to the one norm.Specification
DOUBLE PRECISION FUNCTION MA02MD( NORM, UPLO, N, A, LDA, DWORK ) C .. Scalar Arguments .. CHARACTER NORM, UPLO INTEGER LDA, N C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), DWORK( * )Function Value
MA02MD DOUBLE PRECISION The computed norm.Arguments
Mode Parameters
NORM CHARACTER*1 Specifies the value to be returned in MA02MD: = '1' or 'O': one norm of A; = 'F' or 'E': Frobenius norm of A; = 'I': infinity norm of A; = 'M': max(abs(A(i,j)). UPLO CHARACTER*1 Specifies whether the upper or lower triangular part of the skew-symmetric matrix A is to be referenced. = 'U': Upper triangular part of A is referenced; = 'L': Lower triangular part of A is referenced.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. When N = 0, MA02MD is set to zero. A (input) DOUBLE PRECISION array, dimension (LDA,N) The skew-symmetric matrix A. If UPLO = 'U', the leading N-by-N strictly upper triangular part of A contains the strictly upper triangular part of the matrix A, and the lower triangular part of A is not referenced. If UPLO = 'L', the leading N-by-N strictly lower triangular part of A contains the strictly lower triangular part of the matrix A, and the upper triangular part of A is not referenced. The diagonal of A need not be set to zero. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (MAX(1,LDWORK)), where LDWORK >= N when NORM = 'I' or '1' or 'O'; otherwise, DWORK is not referenced.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex skew-Hermitian matrix. Note that for this kind of matrices the infinity norm is equal to the one norm.Specification
DOUBLE PRECISION FUNCTION MA02MZ( NORM, UPLO, N, A, LDA, DWORK ) C .. Scalar Arguments .. CHARACTER NORM, UPLO INTEGER LDA, N C .. Array Arguments .. DOUBLE PRECISION DWORK( * ) COMPLEX*16 A( LDA, * )Function Value
MA02MZ DOUBLE PRECISION The computed norm.Arguments
Mode Parameters
NORM CHARACTER*1 Specifies the value to be returned in MA02MZ: = '1' or 'O': one norm of A; = 'F' or 'E': Frobenius norm of A; = 'I': infinity norm of A; = 'M': max(abs(A(i,j)). UPLO CHARACTER*1 Specifies whether the upper or lower triangular part of the skew-Hermitian matrix A is to be referenced. = 'U': Upper triangular part of A is referenced; = 'L': Lower triangular part of A is referenced.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. When N = 0, MA02MZ is set to zero. A (input) COMPLEX*16 array, dimension (LDA,N) The skew-Hermitian matrix A. If UPLO = 'U', the leading N-by-N upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. If UPLO = 'L', the leading N-by-N lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced. The real parts of the diagonal elements of A need not be set and are assumed to be zero. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (MAX(1,LDWORK)), where LDWORK >= N when NORM = 'I' or '1' or 'O'; otherwise, DWORK is not referenced.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To permute two specified rows and corresponding columns of a (skew-)symmetric/Hermitian complex matrix.Specification
SUBROUTINE MA02NZ( UPLO, TRANS, SKEW, N, K, L, A, LDA ) C .. Scalar Arguments .. CHARACTER SKEW, TRANS, UPLO INTEGER K, L, LDA, N C .. Array Arguments .. COMPLEX*16 A(LDA,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies whether the upper or lower triangular part of the (skew-)symmetric/Hermitian matrix A is to be referenced, as follows: = 'U': Upper triangular part of A is referenced; = 'L': Lower triangular part of A is referenced. TRANS CHARACTER*1 Specifies whether to use transposition or conjugate transposition as follows: = 'T': Use transposition; = 'C': Use conjugate transposition. SKEW CHARACTER*1 Specifies whether the matrix is symmetric/Hermitian or skew-symmetric/Hermitian as follows: = 'N': The matrix is symmetric/Hermitian; = 'S': The matrix is skew-symmetric/skew-Hermitian.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. K (input) INTEGER The smaller index of the pair of rows and columns to be permuted. 0 <= K <= L. If K = 0, the routine returns. L (input) INTEGER The larger index of the pair of rows and columns to be permuted. K <= L <= N. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array must contain the corresponding upper or lower triangle of the (skew-)symmetric/Hermitian matrix A. On exit, the leading N-by-N upper or lower triangular part of this array (depending on UPLO) contains the corresponding part of the permuted matrix A. Note that a Hermitian matrix has the imaginary parts of the diagonal entries zero. Similarly, a skew-Hermitian matrix has the real parts of the diagonal entries zero. The routine does not check out this conditions. LDA INTEGER The leading dimension of the array A. LDA >= max(N,1).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the number of zero rows (and zero columns) of a real (skew-)Hamiltonian matrix, ( A D ) H = ( ). ( E +/-A' )Specification
INTEGER FUNCTION MA02OD( SKEW, M, A, LDA, DE, LDDE ) C .. Scalar Arguments .. CHARACTER SKEW INTEGER LDA, LDDE, M C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), DE( LDDE, * )Function Value
MA02OD INTEGER The number of zero rows.Arguments
Mode Parameters
SKEW CHARACTER*1 Specifies whether the matrix is Hamiltonian or skew- Hamiltonian as follows: = 'H': The matrix is Hamiltonian; = 'S': The matrix is skew-Hamiltonian.Input/Output Parameters
M (input) INTEGER The order of the matrices A, D, and E. M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). DE (input) DOUBLE PRECISION array, dimension (LDDE,M+1) The leading M-by-M lower triangular part of this array must contain the lower triangular part of the (skew-) symmetric matrix E, and the M-by-M upper triangular part of the submatrix in the columns 2 to M+1 of this array must contain the upper triangular part of the (skew-)symmetric matrix D. If S is skew-Hamiltonian, the parts containing the diagonal and the first superdiagonal of this array, which should be zero, are not referenced. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1,M).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the number of zero rows (and zero columns) of a complex (skew-)Hamiltonian matrix, ( A D ) H = ( ). ( E +/-A' )Specification
INTEGER FUNCTION MA02OZ( SKEW, M, A, LDA, DE, LDDE ) C .. Scalar Arguments .. CHARACTER SKEW INTEGER LDA, LDDE, M C .. Array Arguments .. COMPLEX*16 A( LDA, * ), DE( LDDE, * )Function Value
MA02OZ INTEGER The number of zero rows.Arguments
Mode Parameters
SKEW CHARACTER*1 Specifies whether the matrix is Hamiltonian or skew- Hamiltonian as follows: = 'H': The matrix is Hamiltonian; = 'S': The matrix is skew-Hamiltonian.Input/Output Parameters
M (input) INTEGER The order of the matrices A, D, and E. M >= 0. A (input) COMPLEX*16 array, dimension (LDA,M) The leading M-by-M part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). DE (input) COMPLEX*16 array, dimension (LDDE,M+1) The leading M-by-M lower triangular part of this array must contain the lower triangular part of the (skew-) Hermitian matrix E, and the M-by-M upper triangular part of the submatrix in the columns 2 to M+1 of this array must contain the upper triangular part of the (skew-)Hermitian matrix D. If S is skew-Hamiltonian, the real parts of the entries on the diagonal and the first superdiagonal of this array, which should be zero, are not used. If S is Hamiltonian, the imaginary parts of the entries on the diagonal and the first superdiagonal of this array, which should be zero, are not used. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1,M).Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the number of zero rows and zero columns of a real matrix.Specification
SUBROUTINE MA02PD( M, N, A, LDA, NZR, NZC ) C .. Scalar Arguments .. INTEGER LDA, M, N, NZC, NZR C .. Array Arguments .. DOUBLE PRECISION A( LDA, * )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). NZR (output) INTEGER The number of zero rows of the matrix A. NZC (output) INTEGER The number of zero columns of the matrix A.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the number of zero rows and zero columns of a complex matrix.Specification
SUBROUTINE MA02PZ( M, N, A, LDA, NZR, NZC ) C .. Scalar Arguments .. INTEGER LDA, M, N, NZC, NZR C .. Array Arguments .. COMPLEX*16 A( LDA, * )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input) COMPLEX*16 array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). NZR (output) INTEGER The number of zero rows of the matrix A. NZC (output) INTEGER The number of zero columns of the matrix A.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To perform one of the skew-symmetric rank 2k operations C := alpha*A*B' - alpha*B*A' + beta*C, or C := alpha*A'*B - alpha*B'*A + beta*C, where alpha and beta are scalars, C is a real N-by-N skew- symmetric matrix and A, B are N-by-K matrices in the first case and K-by-N matrices in the second case. This is a modified version of the vanilla implemented BLAS routine DSYR2K written by Jack Dongarra, Iain Duff, Jeremy Du Croz and Sven Hammarling.Specification
SUBROUTINE MB01KD( UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, $ C, LDC, INFO ) C .. Scalar Arguments .. CHARACTER UPLO, TRANS INTEGER INFO, K, LDA, LDB, LDC, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies whether the upper or lower triangular part of the array C is to be referenced, as follows: = 'U': only the strictly upper triangular part of C is to be referenced; = 'L': only the striclty lower triangular part of C is to be referenced. TRANS CHARACTER*1 Specifies the operation to be performed, as follows: = 'N': C := alpha*A*B' - alpha*B*A' + beta*C; = 'T' or 'C': C := alpha*A'*B - alpha*B'*A + beta*C.Input/Output Parameters
N (input) INTEGER The order of the matrix C. N >= 0. K (input) INTEGER If TRANS = 'N' the number of columns of A and B; and if TRANS = 'T' or TRANS = 'C' the number of rows of A and B. K >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. If alpha is zero, or N <= 1, or K = 0, A and B are not referenced. A (input) DOUBLE PRECISION array, dimension (LDA,KA), where KA is K when TRANS = 'N', and is N otherwise. On entry with TRANS = 'N', the leading N-by-K part of of this array must contain the matrix A. On entry with TRANS = 'T' or TRANS = 'C', the leading K-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N), if TRANS = 'N'; LDA >= MAX(1,K), if TRANS = 'T' or TRANS = 'C'. B (input) DOUBLE PRECISION array, dimension (LDB,KB), where KB is K when TRANS = 'N', and is N otherwise. On entry with TRANS = 'N', the leading N-by-K part of of this array must contain the matrix B. On entry with TRANS = 'T' or TRANS = 'C', the leading K-by-N part of this array must contain the matrix B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N), if TRANS = 'N'; LDB >= MAX(1,K), if TRANS = 'T' or TRANS = 'C'. BETA (input) DOUBLE PRECISION The scalar beta. If beta is zero C need not be set before entry. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry with UPLO = 'U', the leading N-by-N part of this array must contain the strictly upper triangular part of the matrix C. The lower triangular part of this array is not referenced. On entry with UPLO = 'L', the leading N-by-N part of this array must contain the strictly lower triangular part of the matrix C. The upper triangular part of this array is not referenced. On exit with UPLO = 'U', the leading N-by-N part of this array contains the strictly upper triangular part of the updated matrix C. On exit with UPLO = 'L', the leading N-by-N part of this array contains the strictly lower triangular part of the updated matrix C. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Numerical Aspects
Though being almost identical with the vanilla implementation of the BLAS routine DSYR2K the performance of this routine could be significantly lower in the case of vendor supplied, highly optimized BLAS.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrix formula _ R = alpha*R + beta*op( A )*X*op( A )', _ where alpha and beta are scalars, R, X, and R are skew-symmetric matrices, A is a general matrix, and op( A ) is one of op( A ) = A or op( A ) = A'. The result is overwritten on R.Specification
SUBROUTINE MB01LD( UPLO, TRANS, M, N, ALPHA, BETA, R, LDR, A, LDA, $ X, LDX, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDA, LDR, LDWORK, LDX, M, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), R(LDR,*), X(LDX,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangles of the skew-symmetric matrices R and X are given, as follows: = 'U': the strictly upper triangular part is given; = 'L': the strictly lower triangular part is given. TRANS CHARACTER*1 Specifies the form of op( A ) to be used in the matrix multiplication, as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'.Input/Output Parameters
M (input) INTEGER _ The order of the matrices R and R and the number of rows of the matrix op( A ). M >= 0. N (input) INTEGER The order of the matrix X and the number of columns of the matrix op( A ). N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry, except when R is identified with X in the call. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero or N <= 1, or M <= 1, then A and X are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry with UPLO = 'U', the leading M-by-M strictly upper triangular part of this array must contain the strictly upper triangular part of the skew-symmetric matrix R. The lower triangle is not referenced. On entry with UPLO = 'L', the leading M-by-M strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix R. The upper triangle is not referenced. On exit, the leading M-by-M strictly upper triangular part (if UPLO = 'U'), or strictly lower triangular part (if UPLO = 'L'), of this array contains the corresponding _ strictly triangular part of the computed matrix R. LDR INTEGER The leading dimension of the array R. LDR >= MAX(1,M). A (input) DOUBLE PRECISION array, dimension (LDA,k) where k is N when TRANS = 'N' and is M when TRANS = 'T' or TRANS = 'C'. On entry with TRANS = 'N', the leading M-by-N part of this array must contain the matrix A. On entry with TRANS = 'T' or TRANS = 'C', the leading N-by-M part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,k), where k is M when TRANS = 'N' and is N when TRANS = 'T' or TRANS = 'C'. X (input or input/output) DOUBLE PRECISION array, dimension (LDX,K), where K = N, if UPLO = 'U' or LDWORK >= M*(N-1), or K = MAX(N,M), if UPLO = 'L' and LDWORK < M*(N-1). On entry, if UPLO = 'U', the leading N-by-N strictly upper triangular part of this array must contain the strictly upper triangular part of the skew-symmetric matrix X and the lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix X and the upper triangular part of the array is not referenced. If LDWORK < M*(N-1), this array is overwritten with the matrix op(A)*X, if UPLO = 'U', or X*op(A)', if UPLO = 'L'. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,N), if UPLO = 'L' or LDWORK >= M*(N-1); LDX >= MAX(1,N,M), if UPLO = 'U' and LDWORK < M*(N-1).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) This array is not referenced when beta = 0, or M <= 1, or N <= 1. LDWORK The length of the array DWORK. LDWORK >= N, if beta <> 0, and M > 0, and N > 1; LDWORK >= 0, if beta = 0, or M = 0, or N <= 1. For optimum performance, LDWORK >= M*(N-1), if beta <> 0, M > 1, and N > 1.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the skew- symmetry into account. If LDWORK >= M*(N-1), a BLAS 3 like implementation is used. Specifically, let X = T - T', with T a strictly upper or strictly lower triangular matrix, defined by T = striu( X ), if UPLO = 'U', T = stril( X ), if UPLO = 'L', where striu and stril denote the strictly upper triangular part and strictly lower triangular part of X, respectively. Then, A*X*A' = ( A*T )*A' - A*( A*T )', for TRANS = 'N', A'*X*A = A'*( T*A ) - ( T*A )'*A, for TRANS = 'T', or 'C', which involve BLAS 3 operations DTRMM and the skew-symmetric correspondent of DSYR2K (with a Fortran implementation available in the SLICOT Library routine MB01KD). If LDWORK < M*(N-1), a BLAS 2 implementation is used.Numerical Aspects
The algorithm requires approximately 2 2 3/2 x M x N + 1/2 x M operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To perform the matrix-vector operation y := alpha*A*x + beta*y, where alpha and beta are scalars, x and y are vectors of length n and A is an n-by-n skew-symmetric matrix. This is a modified version of the vanilla implemented BLAS routine DSYMV written by Jack Dongarra, Jeremy Du Croz, Sven Hammarling, and Richard Hanson.Specification
SUBROUTINE MB01MD( UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, $ INCY ) C .. Scalar Arguments .. DOUBLE PRECISION ALPHA, BETA INTEGER INCX, INCY, LDA, N CHARACTER UPLO C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), X(*), Y(*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies whether the upper or lower triangular part of the array A is to be referenced as follows: = 'U': only the strictly upper triangular part of A is to be referenced; = 'L': only the strictly lower triangular part of A is to be referenced.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. If alpha is zero the array A is not referenced. A (input) DOUBLE PRECISION array, dimension (LDA,N) On entry with UPLO = 'U', the leading N-by-N part of this array must contain the strictly upper triangular part of the matrix A. The lower triangular part of this array is not referenced. On entry with UPLO = 'L', the leading N-by-N part of this array must contain the strictly lower triangular part of the matrix A. The upper triangular part of this array is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N) X (input) DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) ). On entry, elements 1, INCX+1, .., ( N - 1 )*INCX + 1 of this array must contain the elements of the vector X. INCX (input) INTEGER The increment for the elements of X. IF INCX < 0 then the elements of X are accessed in reversed order. INCX <> 0. BETA (input) DOUBLE PRECISION The scalar beta. If beta is zero then Y need not be set on input. Y (input/output) DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCY ) ). On entry, elements 1, INCY+1, .., ( N - 1 )*INCY + 1 of this array must contain the elements of the vector Y. On exit, elements 1, INCY+1, .., ( N - 1 )*INCY + 1 of this array contain the updated elements of the vector Y. INCY (input) INTEGER The increment for the elements of Y. IF INCY < 0 then the elements of Y are accessed in reversed order. INCY <> 0.Numerical Aspects
Though being almost identical with the vanilla implementation of the BLAS routine DSYMV the performance of this routine could be significantly lower in the case of vendor supplied, highly optimized BLAS.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To perform the skew-symmetric rank 2 operation A := alpha*x*y' - alpha*y*x' + A, where alpha is a scalar, x and y are vectors of length n and A is an n-by-n skew-symmetric matrix. This is a modified version of the vanilla implemented BLAS routine DSYR2 written by Jack Dongarra, Jeremy Du Croz, Sven Hammarling, and Richard Hanson.Specification
SUBROUTINE MB01ND( UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA ) C .. Scalar Arguments .. DOUBLE PRECISION ALPHA INTEGER INCX, INCY, LDA, N CHARACTER UPLO C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), X( * ), Y( * )Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies whether the upper or lower triangular part of the array A is to be referenced as follows: = 'U': only the strictly upper triangular part of A is to be referenced; = 'L': only the strictly lower triangular part of A is to be referenced.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. If alpha is zero X and Y are not referenced. X (input) DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) ). On entry, elements 1, INCX+1, .., ( N - 1 )*INCX + 1 of this array must contain the elements of the vector X. INCX (input) INTEGER The increment for the elements of X. IF INCX < 0 then the elements of X are accessed in reversed order. INCX <> 0. Y (input) DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCY ) ). On entry, elements 1, INCY+1, .., ( N - 1 )*INCY + 1 of this array must contain the elements of the vector Y. INCY (input) INTEGER The increment for the elements of Y. IF INCY < 0 then the elements of Y are accessed in reversed order. INCY <> 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry with UPLO = 'U', the leading N-by-N part of this array must contain the strictly upper triangular part of the matrix A. The lower triangular part of this array is not referenced. On entry with UPLO = 'L', the leading N-by-N part of this array must contain the strictly lower triangular part of the matrix A. The upper triangular part of this array is not referenced. On exit with UPLO = 'U', the leading N-by-N part of this array contains the strictly upper triangular part of the updated matrix A. On exit with UPLO = 'L', the leading N-by-N part of this array contains the strictly lower triangular part of the updated matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N)Numerical Aspects
Though being almost identical with the vanilla implementation of the BLAS routine DSYR2 the performance of this routine could be significantly lower in the case of vendor supplied, highly optimized BLAS.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To perform one of the special symmetric rank 2k operations R := alpha*R + beta*H*X + beta*X*H', or R := alpha*R + beta*H'*X + beta*X*H, where alpha and beta are scalars, R and X are N-by-N symmetric matrices, and H is an N-by-N upper Hessenberg matrix.Specification
SUBROUTINE MB01OC( UPLO, TRANS, N, ALPHA, BETA, R, LDR, H, LDH, X, $ LDX, INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDH, LDR, LDX, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION H(LDH,*), R(LDR,*), X(LDX,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangles of the symmetric matrices R and X are given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the operation to be performed as follows: = 'N': R := alpha*R + beta*H*X + beta*X*H'; = 'T' or 'C': R := alpha*R + beta*H'*X + beta*X*H.Input/Output Parameters
N (input) INTEGER The order of the matrices R, H, and X. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry, except when R is identified with X in the call. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then H and X are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry with UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix R. On entry with UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix R. In both cases, the other strictly triangular part is not referenced. On exit, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of the computed matrix R. LDR INTEGER The leading dimension of the array R. LDR >= MAX(1,N). H (input) DOUBLE PRECISION array, dimension (LDH,N) On entry, the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix H. The remaining part of this array is not referenced. LDH INTEGER The leading dimension of the array H. LDH >= MAX(1,N). X (input) DOUBLE PRECISION array, dimension (LDX,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix X and the strictly lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix X and the strictly upper triangular part of the array is not referenced. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the structure into account, and using inline code and BLAS1 routines.Numerical Aspects
The algorithm requires approximately N**3/2 operations.Further Comments
This routine acts as a specialization of BLAS Library routine DSYR2K.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrix formula R := alpha*R + beta*( op( H )*X*op( E )' + op( E )*X*op( H )' ), where alpha and beta are scalars, R and X are symmetric matrices, H is an upper Hessenberg matrix, E is an upper triangular matrix, and op( M ) is one of op( M ) = M or op( M ) = M'. The result is overwritten on R.Specification
SUBROUTINE MB01OD( UPLO, TRANS, N, ALPHA, BETA, R, LDR, H, LDH, $ X, LDX, E, LDE, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDE, LDH, LDR, LDWORK, LDX, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION DWORK(*), E(LDE,*), H(LDH,*), R(LDR,*), X(LDX,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangles of the symmetric matrices R and X are given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the form of op( M ) to be used in the matrix multiplication as follows: = 'N': op( M ) = M; = 'T': op( M ) = M'; = 'C': op( M ) = M'.Input/Output Parameters
N (input) INTEGER The order of the matrices R, H, E, and X. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry, except when R is identified with X in the call. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then H and X are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry with UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix R. On entry with UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix R. In both cases, the other strictly triangular part is not referenced. On exit, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). H (input) DOUBLE PRECISION array, dimension (LDH,N) On entry, the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix H. If TRANS = 'N', the entries 3, 4,..., N of the first column are modified internally, but are restored on exit. The remaining part of this array is not referenced. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,N). X (input) DOUBLE PRECISION array, dimension (LDX,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix X and the strictly lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix X and the strictly upper triangular part of the array is not referenced. The diagonal elements of this array are modified internally, but are restored on exit. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix E. The remaining part of this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) This array is not referenced when beta = 0, or N = 0. LDWORK The length of the array DWORK. LDWORK >= N*N, if beta <> 0; LDWORK >= 0, if beta = 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the symmetry into account. Specifically, let X = U + L, with U and L upper and lower triangular matrices, defined by U = triu( X ) - (1/2)*diag( X ), L = tril( X ) - (1/2)*diag( X ), where triu, tril, and diag denote the upper triangular part, lower triangular part, and diagonal part of X, respectively. Then, if UPLO = 'U', H*X*E' + E*X*H' = (H*U)*E' + E*(H*U)' + H*(E*U)' + (E*U)*H', for TRANS = 'N', H'*X*E + E'*X*H = H'*(U*E) + (U*E)'*H + (U*H)'*E + E'*(U*H), for TRANS = 'T', or 'C', and if UPLO = 'L', H*X*E' + E*X*H' = (H*L')*E' + E*(H*L')' + H*(E*L')' + (E*L')*H', for TRANS = 'N', H'*X*E + E'*X*H = H'*(L'*E) + (L'*E)'*H + (L'*H)'*E + E'*(L'*H), for TRANS = 'T', or 'C', which involve operations like in BLAS 2 and 3 (DTRMV and DSYR2K). This approach ensures that the matrices H*U, U*H, H*L', or L'*H are upper Hessenberg, and E*U, U*E, E*L', or L'*E are upper triangular.Numerical Aspects
The algorithm requires approximately N**3/2 operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute one of the symmetric rank 2k operations R := alpha*R + beta*H*E' + beta*E*H', or R := alpha*R + beta*H'*E + beta*E'*H, where alpha and beta are scalars, R, E, and H are N-by-N matrices, with H upper Hessenberg and E upper triangular.Specification
SUBROUTINE MB01OE( UPLO, TRANS, N, ALPHA, BETA, R, LDR, H, LDH, E, $ LDE ) C .. Scalar Arguments .. DOUBLE PRECISION ALPHA, BETA INTEGER LDE, LDH, LDR, N CHARACTER TRANS, UPLO C .. Array Arguments .. DOUBLE PRECISION E(LDE,*), H(LDH,*), R(LDR,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangle of the symmetric matrix R is given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the form of H to be used in the matrix multiplication as follows: = 'N': R := alpha*R + beta*H*E' + beta*E*H'; = 'T': R := alpha*R + beta*H'*E + beta*E'*H; = 'C': R := alpha*R + beta*H'*E + beta*E'*H.Input/Output Parameters
N (input) INTEGER The order of the matrices R, E, and H. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then E and H are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry with UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix R. On entry with UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix R. In both cases, the other strictly triangular part is not referenced. On exit, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). H (input) DOUBLE PRECISION array, dimension (LDH,N) On entry, the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix H. The remaining part of this array is not referenced. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix E. The remaining part of this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N).Method
E particularization of the algorithm used in the BLAS 3 routine DSYR2K is used.Numerical Aspects
The algorithm requires approximately N**3/3 operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute one of the symmetric rank 2k operations R := alpha*R + beta*H*A' + beta*A*H', or R := alpha*R + beta*H'*A + beta*A'*H, where alpha and beta are scalars, R, A, and H are N-by-N matrices, with A and H upper Hessenberg.Specification
SUBROUTINE MB01OH( UPLO, TRANS, N, ALPHA, BETA, R, LDR, H, LDH, A, $ LDA ) C .. Scalar Arguments .. DOUBLE PRECISION ALPHA, BETA INTEGER LDA, LDH, LDR, N CHARACTER TRANS, UPLO C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), H(LDH,*), R(LDR,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangle of the symmetric matrix R is given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the form of H to be used in the matrix multiplication as follows: = 'N': R := alpha*R + beta*H*A' + beta*A*H'; = 'T': R := alpha*R + beta*H'*A + beta*A'*H; = 'C': R := alpha*R + beta*H'*A + beta*A'*H.Input/Output Parameters
N (input) INTEGER The order of the matrices R, A, and H. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then A and H are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry with UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix R. On entry with UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix R. In both cases, the other strictly triangular part is not referenced. On exit, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). H (input) DOUBLE PRECISION array, dimension (LDH,N) On entry, the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix H. The remaining part of this array is not referenced. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,N) A (input) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix A. The remaining part of this array is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N)Method
A particularization of the algorithm used in the BLAS 3 routine DSYR2K is used.Numerical Aspects
The algorithm requires approximately N**3/3 operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute either P or P', with P defined by the matrix formula P = op( H )*X*op( E )', where H is an upper Hessenberg matrix, X is a symmetric matrix, E is an upper triangular matrix, and op( M ) is one of op( M ) = M or op( M ) = M'.Specification
SUBROUTINE MB01OO( UPLO, TRANS, N, H, LDH, X, LDX, E, LDE, P, LDP, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, LDE, LDH, LDP, LDX, N CHARACTER TRANS, UPLO C .. Array Arguments .. DOUBLE PRECISION E(LDE,*), H(LDH,*), P(LDP,*), X(LDX,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangle of the symmetric matrix X is given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the operation to be performed as follows: = 'N': compute P = H*X*E'; = 'T' or 'C': compute P' = E'*X*H.Input/Output Parameters
N (input) INTEGER The order of the matrices H, X, E, and P. N >= 0. H (input) DOUBLE PRECISION array, dimension (LDH,N) On entry, the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix H. The remaining part of this array is not referenced. LDH INTEGER The leading dimension of the array H. LDH >= MAX(1,N). X (input) DOUBLE PRECISION array, dimension (LDX,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix X and the strictly lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix X and the strictly upper triangular part of the array is not referenced. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix E. The remaining part of this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). P (output) DOUBLE PRECISION array, dimension (LDP,N) On exit, the leading N-by-N part of this array contains the computed matrix P = H*X*E', if TRANS = 'N', or the computed matrix P' = E'*X*H, if TRANS = 'T'. LDP INTEGER The leading dimension of the array P. LDP >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the structure into account, and using BLAS and SLICOT routines. Let W = H*X, or W = X*H, computed using SLICOT Library routine MB01OS. The result is then obtained calling BLAS 3 routine DTRMM.Numerical Aspects
The algorithm requires approximately N**3 operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute P = H*X or P = X*H, where H is an upper Hessenberg matrix and X is a symmetric matrix.Specification
SUBROUTINE MB01OS( UPLO, TRANS, N, H, LDH, X, LDX, P, LDP, INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDH, LDP, LDX, N C .. Array Arguments .. DOUBLE PRECISION H(LDH,*), P(LDP,*), X(LDX,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangle of the symmetric matrix X is given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the operation to be performed as follows: = 'N': compute P = H*X; = 'T' or 'C': compute P = X*H.Input/Output Parameters
N (input) INTEGER The order of the matrices H, X, and P. N >= 0. H (input) DOUBLE PRECISION array, dimension (LDH,N) On entry, the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix H. The remaining part of this array is not referenced. LDH INTEGER The leading dimension of the array H. LDH >= MAX(1,N). X (input) DOUBLE PRECISION array, dimension (LDX,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix X and the strictly lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix X and the strictly upper triangular part of the array is not referenced. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,N). P (output) DOUBLE PRECISION array, dimension (LDP,N) On exit, the leading N-by-N part of this array contains the computed matrix P. LDP INTEGER The leading dimension of the array P. LDP >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the structure into account, and using inline code and BLAS routines. Let X = U + sL, where U is upper triangular and sL is strictly lower triangular. Then, P = H*X = H*U + H*sL = H*U + H*sU', where sU is the strictly upper triangular part of X. Similarly, P = X*H = L'*H + sL*H, where L is lower triangular, and X = L + sL'. Note that H*U and L'*H are both upper Hessenberg. However, when UPLO = 'L' and TRANS = 'N', or when UPLO = 'U' and TRANS = 'T', then the matrix P is full. The computations are done similarly.Numerical Aspects
The algorithm requires approximately N**3/2 operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute one of the symmetric rank 2k operations R := alpha*R + beta*E*T' + beta*T*E', or R := alpha*R + beta*E'*T + beta*T'*E, where alpha and beta are scalars, R, T, and E are N-by-N matrices, with T and E upper triangular.Specification
SUBROUTINE MB01OT( UPLO, TRANS, N, ALPHA, BETA, R, LDR, E, LDE, T, $ LDT ) C .. Scalar Arguments .. DOUBLE PRECISION ALPHA, BETA INTEGER LDE, LDR, LDT, N CHARACTER TRANS, UPLO C .. Array Arguments .. DOUBLE PRECISION E(LDE,*), R(LDR,*), T(LDT,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangle of the symmetric matrix R is given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the form of E to be used in the matrix multiplication as follows: = 'N': R := alpha*R + beta*E*T' + beta*T*E'; = 'T': R := alpha*R + beta*E'*T + beta*T'*E; = 'C': R := alpha*R + beta*E'*T + beta*T'*E.Input/Output Parameters
N (input) INTEGER The order of the matrices R, T, and E. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then T and E are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry with UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix R. On entry with UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix R. In both cases, the other strictly triangular part is not referenced. On exit, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix E. The remaining part of this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). T (input) DOUBLE PRECISION array, dimension (LDT,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix T. The remaining part of this array is not referenced. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N).Method
A particularization of the algorithm used in the BLAS 3 routine DSYR2K is used.Numerical Aspects
The algorithm requires approximately N**3/3 operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To scale a matrix or undo scaling. Scaling is performed, if necessary, so that the matrix norm will be in a safe range of representable numbers.Specification
SUBROUTINE MB01PD( SCUN, TYPE, M, N, KL, KU, ANRM, NBL, NROWS, A, $ LDA, INFO ) C .. Scalar Arguments .. CHARACTER SCUN, TYPE INTEGER INFO, KL, KU, LDA, M, MN, N, NBL DOUBLE PRECISION ANRM C .. Array Arguments .. INTEGER NROWS ( * ) DOUBLE PRECISION A( LDA, * )Arguments
Mode Parameters
SCUN CHARACTER*1 SCUN indicates the operation to be performed. = 'S': scale the matrix. = 'U': undo scaling of the matrix. TYPE CHARACTER*1 TYPE indicates the storage type of the input matrix. = 'G': A is a full matrix. = 'L': A is a (block) lower triangular matrix. = 'U': A is an (block) upper triangular matrix. = 'H': A is an (block) upper Hessenberg matrix. = 'B': A is a symmetric band matrix with lower bandwidth KL and upper bandwidth KU and with the only the lower half stored. = 'Q': A is a symmetric band matrix with lower bandwidth KL and upper bandwidth KU and with the only the upper half stored. = 'Z': A is a band matrix with lower bandwidth KL and upper bandwidth KU.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. KL (input) INTEGER The lower bandwidth of A. Referenced only if TYPE = 'B', 'Q' or 'Z'. KU (input) INTEGER The upper bandwidth of A. Referenced only if TYPE = 'B', 'Q' or 'Z'. ANRM (input) DOUBLE PRECISION The norm of the initial matrix A. ANRM >= 0. When ANRM = 0 then an immediate return is effected. ANRM should be preserved between the call of the routine with SCUN = 'S' and the corresponding one with SCUN = 'U'. NBL (input) INTEGER The number of diagonal blocks of the matrix A, if it has a block structure. To specify that matrix A has no block structure, set NBL = 0. NBL >= 0. NROWS (input) INTEGER array, dimension max(1,NBL) NROWS(i) contains the number of rows and columns of the i-th diagonal block of matrix A. The sum of the values NROWS(i), for i = 1: NBL, should be equal to min(M,N). The elements of the array NROWS are not referenced if NBL = 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M by N part of this array must contain the matrix to be scaled/unscaled. On exit, the leading M by N part of A will contain the modified matrix. The storage mode of A is specified by TYPE. LDA (input) INTEGER The leading dimension of the array A. LDA >= max(1,M).Error Indicator
INFO (output) INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value.Method
Denote by ANRM the norm of the matrix, and by SMLNUM and BIGNUM, two positive numbers near the smallest and largest safely representable numbers, respectively. The matrix is scaled, if needed, such that the norm of the result is in the range [SMLNUM, BIGNUM]. The scaling factor is represented as a ratio of two numbers, one of them being ANRM, and the other one either SMLNUM or BIGNUM, depending on ANRM being less than SMLNUM or larger than BIGNUM, respectively. For undoing the scaling, the norm is again compared with SMLNUM or BIGNUM, and the reciprocal of the previous scaling factor is used.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01QD.html 0000664 0000000 0000000 00000010576 14560147231 0020347 0 ustar 00root root 0000000 0000000
Purpose
To multiply the M by N real matrix A by the real scalar CTO/CFROM. This is done without over/underflow as long as the final result CTO*A(I,J)/CFROM does not over/underflow. TYPE specifies that A may be full, (block) upper triangular, (block) lower triangular, (block) upper Hessenberg, or banded.Specification
SUBROUTINE MB01QD( TYPE, M, N, KL, KU, CFROM, CTO, NBL, NROWS, A, $ LDA, INFO ) C .. Scalar Arguments .. CHARACTER TYPE INTEGER INFO, KL, KU, LDA, M, N, NBL DOUBLE PRECISION CFROM, CTO C .. Array Arguments .. INTEGER NROWS ( * ) DOUBLE PRECISION A( LDA, * )Arguments
Mode Parameters
TYPE CHARACTER*1 TYPE indices the storage type of the input matrix. = 'G': A is a full matrix. = 'L': A is a (block) lower triangular matrix. = 'U': A is a (block) upper triangular matrix. = 'H': A is a (block) upper Hessenberg matrix. = 'B': A is a symmetric band matrix with lower bandwidth KL and upper bandwidth KU and with the only the lower half stored. = 'Q': A is a symmetric band matrix with lower bandwidth KL and upper bandwidth KU and with the only the upper half stored. = 'Z': A is a band matrix with lower bandwidth KL and upper bandwidth KU.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. KL (input) INTEGER The lower bandwidth of A. Referenced only if TYPE = 'B', 'Q' or 'Z'. KU (input) INTEGER The upper bandwidth of A. Referenced only if TYPE = 'B', 'Q' or 'Z'. CFROM (input) DOUBLE PRECISION CTO (input) DOUBLE PRECISION The matrix A is multiplied by CTO/CFROM. A(I,J) is computed without over/underflow if the final result CTO*A(I,J)/CFROM can be represented without over/ underflow. CFROM must be nonzero. NBL (input) INTEGER The number of diagonal blocks of the matrix A, if it has a block structure. To specify that matrix A has no block structure, set NBL = 0. NBL >= 0. NROWS (input) INTEGER array, dimension max(1,NBL) NROWS(i) contains the number of rows and columns of the i-th diagonal block of matrix A. The sum of the values NROWS(i), for i = 1: NBL, should be equal to min(M,N). The array NROWS is not referenced if NBL = 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) The matrix to be multiplied by CTO/CFROM. See TYPE for the storage type. LDA (input) INTEGER The leading dimension of the array A. LDA >= max(1,M).Error Indicator
INFO INTEGER Not used in this implementation.Method
Matrix A is multiplied by the real scalar CTO/CFROM, taking into account the specified storage mode of the matrix. MB01QD is a version of the LAPACK routine DLASCL, modified for dealing with block triangular, or block Hessenberg matrices. For efficiency, no tests of the input scalar parameters are performed.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01RB.html 0000664 0000000 0000000 00000015223 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
To compute either the upper or lower triangular part of one of the matrix formulas _ R = alpha*R + beta*op( A )*B, (1) _ R = alpha*R + beta*B*op( A ), (2) _ where alpha and beta are scalars, R and R are m-by-m matrices, op( A ) and B are m-by-n and n-by-m matrices for (1), or n-by-m and m-by-n matrices for (2), respectively, and op( A ) is one of op( A ) = A or op( A ) = A', the transpose of A. The result is overwritten on R.Specification
SUBROUTINE MB01RB( SIDE, UPLO, TRANS, M, N, ALPHA, BETA, R, LDR, $ A, LDA, B, LDB, INFO ) C .. Scalar Arguments .. CHARACTER SIDE, TRANS, UPLO INTEGER INFO, LDA, LDB, LDR, M, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), R(LDR,*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether the matrix A appears on the left or right in the matrix product as follows: _ = 'L': R = alpha*R + beta*op( A )*B; _ = 'R': R = alpha*R + beta*B*op( A ). UPLO CHARACTER*1 _ Specifies which triangles of the matrices R and R are computed and given, respectively, as follows: = 'U': the upper triangular part; = 'L': the lower triangular part. TRANS CHARACTER*1 Specifies the form of op( A ) to be used in the matrix multiplication as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'.Input/Output Parameters
M (input) INTEGER _ The order of the matrices R and R, the number of rows of the matrix op( A ) and the number of columns of the matrix B, for SIDE = 'L', or the number of rows of the matrix B and the number of columns of the matrix op( A ), for SIDE = 'R'. M >= 0. N (input) INTEGER The number of rows of the matrix B and the number of columns of the matrix op( A ), for SIDE = 'L', or the number of rows of the matrix op( A ) and the number of columns of the matrix B, for SIDE = 'R'. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then A and B are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry with UPLO = 'U', the leading M-by-M upper triangular part of this array must contain the upper triangular part of the matrix R; the strictly lower triangular part of the array is not referenced. On entry with UPLO = 'L', the leading M-by-M lower triangular part of this array must contain the lower triangular part of the matrix R; the strictly upper triangular part of the array is not referenced. On exit, the leading M-by-M upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L') of this array contains the corresponding triangular part of _ the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M). A (input) DOUBLE PRECISION array, dimension (LDA,k), where k = N when SIDE = 'L', and TRANS = 'N', or SIDE = 'R', and TRANS <> 'T'; k = M when SIDE = 'R', and TRANS = 'N', or SIDE = 'L', and TRANS <> 'T'. On entry, if SIDE = 'L', and TRANS = 'N', or SIDE = 'R', and TRANS <> 'T', the leading M-by-N part of this array must contain the matrix A. On entry, if SIDE = 'R', and TRANS = 'N', or SIDE = 'L', and TRANS <> 'T', the leading N-by-M part of this array must contain the matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,l), where l = M when SIDE = 'L', and TRANS = 'N', or SIDE = 'R', and TRANS <> 'T'; l = N when SIDE = 'R', and TRANS = 'N', or SIDE = 'L', and TRANS <> 'T'. B (input) DOUBLE PRECISION array, dimension (LDB,p), where p = M when SIDE = 'L'; p = N when SIDE = 'R'. On entry, the leading N-by-M part, if SIDE = 'L', or M-by-N part, if SIDE = 'R', of this array must contain the matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N), if SIDE = 'L'; LDB >= MAX(1,M), if SIDE = 'R'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix expression is evaluated taking the triangular structure into account. A block algorithm is used.Further Comments
The main application of this routine is when the result should be a symmetric matrix, e.g., when B = X*op( A )', for (1), or B = op( A )'*X, for (2), where B is already available and X = X'. The required triangle only is computed and overwritten, contrary to a general matrix multiplication operation. This is a BLAS 3 version of the SLICOT Library routine MB01RX.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01RD.html 0000664 0000000 0000000 00000016477 14560147231 0020356 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrix formula _ R = alpha*R + beta*op( A )*X*op( A )', _ where alpha and beta are scalars, R, X, and R are symmetric matrices, A is a general matrix, and op( A ) is one of op( A ) = A or op( A ) = A'. The result is overwritten on R.Specification
SUBROUTINE MB01RD( UPLO, TRANS, M, N, ALPHA, BETA, R, LDR, A, LDA, $ X, LDX, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDA, LDR, LDWORK, LDX, M, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), R(LDR,*), X(LDX,*)Arguments
Mode Parameters
UPLO CHARACTER*1 _ Specifies which triangles of the symmetric matrices R, R, and X are given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the form of op( A ) to be used in the matrix multiplication as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'.Input/Output Parameters
M (input) INTEGER _ The order of the matrices R and R and the number of rows of the matrix op( A ). M >= 0. N (input) INTEGER The order of the matrix X and the number of columns of the the matrix op( A ). N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry, except when R is identified with X in the call (which is possible only in this case). BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then A and X are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry with UPLO = 'U', the leading M-by-M upper triangular part of this array must contain the upper triangular part of the symmetric matrix R; the strictly lower triangular part of the array is used as workspace. On entry with UPLO = 'L', the leading M-by-M lower triangular part of this array must contain the lower triangular part of the symmetric matrix R; the strictly upper triangular part of the array is used as workspace. On exit, the leading M-by-M upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of _ the computed matrix R. If beta <> 0, the remaining strictly triangular part of this array contains the corresponding part of the matrix expression beta*op( A )*T*op( A )', where T is the triangular matrix defined in the Method section. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M). A (input) DOUBLE PRECISION array, dimension (LDA,k) where k is N when TRANS = 'N' and is M when TRANS = 'T' or TRANS = 'C'. On entry with TRANS = 'N', the leading M-by-N part of this array must contain the matrix A. On entry with TRANS = 'T' or TRANS = 'C', the leading N-by-M part of this array must contain the matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,l), where l is M when TRANS = 'N' and is N when TRANS = 'T' or TRANS = 'C'. X (input/output) DOUBLE PRECISION array, dimension (LDX,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix X and the strictly lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix X and the strictly upper triangular part of the array is not referenced. On exit, each diagonal element of this array has half its input value, but the other elements are not modified. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, the leading M-by-N part of this array (with the leading dimension MAX(1,M)) returns the matrix product beta*op( A )*T, where T is the triangular matrix defined in the Method section. This array is not referenced when beta = 0. LDWORK The length of the array DWORK. LDWORK >= MAX(1,M*N), if beta <> 0; LDWORK >= 1, if beta = 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the symmetry into account. Specifically, let X = T + T', with T an upper or lower triangular matrix, defined by T = triu( X ) - (1/2)*diag( X ), if UPLO = 'U', T = tril( X ) - (1/2)*diag( X ), if UPLO = 'L', where triu, tril, and diag denote the upper triangular part, lower triangular part, and diagonal part of X, respectively. Then, op( A )*X*op( A )' = B + B', where B := op( A )*T*op( A )'. Matrix B is not symmetric, but it can be written as tri( B ) + stri( B ), where tri denotes the triangular part specified by UPLO, and stri denotes the remaining strictly triangular part. Let R = V + V', with V defined as T above. Then, the required triangular part of the result can be written as alpha*V + beta*tri( B ) + beta*(stri( B ))' + alpha*diag( V ) + beta*diag( tri( B ) ).References
None.Numerical Aspects
The algorithm requires approximately 2 2 M x N + 1/2 x N x M operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01RH.html 0000664 0000000 0000000 00000014154 14560147231 0020350 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrix formula R := alpha*R + beta*op( H )*X*op( H )', where alpha and beta are scalars, R and X are symmetric matrices, H is an upper Hessenberg matrix, and op( H ) is one of op( H ) = H or op( H ) = H'. The result is overwritten on R.Specification
SUBROUTINE MB01RH( UPLO, TRANS, N, ALPHA, BETA, R, LDR, H, LDH, $ X, LDX, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDH, LDR, LDWORK, LDX, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION DWORK(*), H(LDH,*), R(LDR,*), X(LDX,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangles of the symmetric matrices R and X are given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the form of op( H ) to be used in the matrix multiplication as follows: = 'N': op( H ) = H; = 'T': op( H ) = H'; = 'C': op( H ) = H'.Input/Output Parameters
N (input) INTEGER The order of the matrices R, H, and X. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry, except when R is identified with X in the call. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then H and X are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry with UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix R. On entry with UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix R. In both cases, the other strictly triangular part is not referenced. On exit, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). H (input) DOUBLE PRECISION array, dimension (LDH,N) On entry, the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix H. If TRANS = 'N', the entries 3, 4,..., N of the first column are modified internally, but are restored on exit. The remaining part of this array is not referenced. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,N). X (input) DOUBLE PRECISION array, dimension (LDX,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix X and the strictly lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix X and the strictly upper triangular part of the array is not referenced. The diagonal elements of this array are modified internally, but are restored on exit. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) This array is not referenced when beta = 0, or N = 0. LDWORK The length of the array DWORK. LDWORK >= N*N, if beta <> 0; LDWORK >= 0, if beta = 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the symmetry into account. Specifically, let X = U + L, with U and L upper and lower triangular matrices, defined by U = triu( X ) - (1/2)*diag( X ), L = tril( X ) - (1/2)*diag( X ), where triu, tril, and diag denote the upper triangular part, lower triangular part, and diagonal part of X, respectively. Then, if UPLO = 'U', H*X*H' = ( H*U )*H' + H*( H*U )', for TRANS = 'N', H'*X*H = H'*( U*H ) + ( U*H )'*H, for TRANS = 'T', or 'C', and if UPLO = 'L', H*X*H' = ( H*L' )*H' + H*( H*L' )', for TRANS = 'N', H'*X*H = H'*( L'*H ) + ( L'*H )'*H, for TRANS = 'T', or 'C', which involve operations like in BLAS 2 and 3 (DTRMV and DSYR2K). This approach ensures that the matrices H*U, U*H, H*L', or L'*H are upper Hessenberg.Numerical Aspects
The algorithm requires approximately N**3/2 operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrix formula R := alpha*R + beta*op( E )*X*op( E )', where alpha and beta are scalars, R and X are symmetric matrices, E is an upper triangular matrix, and op( E ) is one of op( E ) = E or op( E ) = E'. The result is overwritten on R.Specification
SUBROUTINE MB01RT( UPLO, TRANS, N, ALPHA, BETA, R, LDR, E, LDE, $ X, LDX, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDE, LDR, LDWORK, LDX, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION DWORK(*), E(LDE,*), R(LDR,*), X(LDX,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangles of the symmetric matrices R and X are given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the form of op( E ) to be used in the matrix multiplication as follows: = 'N': op( E ) = E; = 'T': op( E ) = E'; = 'C': op( E ) = E'.Input/Output Parameters
N (input) INTEGER The order of the matrices R, E, and X. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry, except when R is identified with X in the call. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then E and X are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry with UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix R. On entry with UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix R. In both cases, the other strictly triangular part is not referenced. On exit, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix E. The remaining part of this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). X (input) DOUBLE PRECISION array, dimension (LDX,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix X and the strictly lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix X and the strictly upper triangular part of the array is not referenced. The diagonal elements of this array are modified internally, but are restored on exit. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) This array is not referenced when beta = 0, or N = 0. LDWORK The length of the array DWORK. LDWORK >= N*N, if beta <> 0; LDWORK >= 0, if beta = 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the symmetry into account. Specifically, let X = U + L, with U and L upper and lower triangular matrices, defined by U = triu( X ) - (1/2)*diag( X ), L = tril( X ) - (1/2)*diag( X ), where triu, tril, and diag denote the upper triangular part, lower triangular part, and diagonal part of X, respectively. Then, if UPLO = 'U', E*X*E' = ( E*U )*E' + E*( E*U )', for TRANS = 'N', E'*X*E = E'*( U*E ) + ( U*E )'*E, for TRANS = 'T', or 'C', and if UPLO = 'L', E*X*E' = ( E*L' )*E' + E*( E*L' )', for TRANS = 'N', E'*X*E = E'*( L'*E ) + ( L'*E )'*E, for TRANS = 'T', or 'C', which involve operations like in BLAS 2 and 3 (DTRMV and DSYR2K). This approach ensures that the matrices E*U, U*E, E*L', or L'*E are upper triangular.Numerical Aspects
The algorithm requires approximately N**3/2 operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrix formula _ R = alpha*R + beta*op( A )*X*op( A )', _ where alpha and beta are scalars, R, X, and R are symmetric matrices, A is a general matrix, and op( A ) is one of op( A ) = A or op( A ) = A'. The result is overwritten on R.Specification
SUBROUTINE MB01RU( UPLO, TRANS, M, N, ALPHA, BETA, R, LDR, A, LDA, $ X, LDX, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDA, LDR, LDWORK, LDX, M, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), R(LDR,*), X(LDX,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangles of the symmetric matrices R and X are given as follows: = 'U': the upper triangular part is given; = 'L': the lower triangular part is given. TRANS CHARACTER*1 Specifies the form of op( A ) to be used in the matrix multiplication as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'.Input/Output Parameters
M (input) INTEGER _ The order of the matrices R and R and the number of rows of the matrix op( A ). M >= 0. N (input) INTEGER The order of the matrix X and the number of columns of the the matrix op( A ). N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry, except when R is identified with X in the call. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then A and X are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry with UPLO = 'U', the leading M-by-M upper triangular part of this array must contain the upper triangular part of the symmetric matrix R. On entry with UPLO = 'L', the leading M-by-M lower triangular part of this array must contain the lower triangular part of the symmetric matrix R. On exit, the leading M-by-M upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of _ the computed matrix R. When R is identified with X in the call, after exit, the diagonal entries of R must be divided by 2. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M). A (input) DOUBLE PRECISION array, dimension (LDA,k) where k is N when TRANS = 'N' and is M when TRANS = 'T' or TRANS = 'C'. On entry with TRANS = 'N', the leading M-by-N part of this array must contain the matrix A. On entry with TRANS = 'T' or TRANS = 'C', the leading N-by-M part of this array must contain the matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,k), where k is M when TRANS = 'N' and is N when TRANS = 'T' or TRANS = 'C'. X (input) DOUBLE PRECISION array, dimension (LDX,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix X and the strictly lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix X and the strictly upper triangular part of the array is not referenced. The diagonal elements of this array are modified internally, but are restored on exit. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) This array is not referenced when beta = 0, or M*N = 0. LDWORK The length of the array DWORK. LDWORK >= M*N, if beta <> 0; LDWORK >= 0, if beta = 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the symmetry into account. Specifically, let X = T + T', with T an upper or lower triangular matrix, defined by T = triu( X ) - (1/2)*diag( X ), if UPLO = 'U', T = tril( X ) - (1/2)*diag( X ), if UPLO = 'L', where triu, tril, and diag denote the upper triangular part, lower triangular part, and diagonal part of X, respectively. Then, A*X*A' = ( A*T )*A' + A*( A*T )', for TRANS = 'N', A'*X*A = A'*( T*A ) + ( T*A )'*A, for TRANS = 'T', or 'C', which involve BLAS 3 operations (DTRMM and DSYR2K).Numerical Aspects
The algorithm requires approximately 2 2 M x N + 1/2 x N x M operations.Further Comments
This is a simpler version for MB01RD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the transformation of the symmetric matrix A by the matrix Z in the form A := op(Z)*A*op(Z)', where op(Z) is either Z or its transpose, Z'.Specification
SUBROUTINE MB01RW( UPLO, TRANS, M, N, A, LDA, Z, LDZ, DWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDA, LDZ, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), Z(LDZ,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies whether the upper or lower triangle of A is stored: = 'U': Upper triangle of A is stored; = 'L': Lower triangle of A is stored. TRANS CHARACTER*1 Specifies whether op(Z) is Z or its transpose Z': = 'N': op(Z) = Z; = 'T': op(Z) = Z'.Input/Output Parameters
M (input) INTEGER The order of the resulting symmetric matrix op(Z)*A*op(Z)' and the number of rows of the matrix Z, if TRANS = 'N', or the number of columns of the matrix Z, if TRANS = 'T'. M >= 0. N (input) INTEGER The order of the symmetric matrix A and the number of columns of the matrix Z, if TRANS = 'N', or the number of rows of the matrix Z, if TRANS = 'T'. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,MAX(M,N)) On entry, the leading N-by-N upper or lower triangular part of this array must contain the upper (UPLO = 'U') or lower (UPLO = 'L') triangular part of the symmetric matrix A. On exit, the leading M-by-M upper or lower triangular part of this array contains the upper (UPLO = 'U') or lower (UPLO = 'L') triangular part of the symmetric matrix op(Z)*A*op(Z)'. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,M,N). Z (input) DOUBLE PRECISION array, dimension (LDQ,K) where K = N if TRANS = 'N' and K = M if TRANS = 'T'. The leading M-by-N part, if TRANS = 'N', or N-by-M part, if TRANS = 'T', of this array contains the matrix Z. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,M) if TRANS = 'N' and LDZ >= MAX(1,N) if TRANS = 'T'.Workspace
DWORK DOUBLE PRECISION array, dimension (N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Further Comments
This is a simpler, BLAS 2 version for MB01RD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute either the upper or lower triangular part of one of the matrix formulas _ R = alpha*R + beta*op( A )*B, (1) _ R = alpha*R + beta*B*op( A ), (2) _ where alpha and beta are scalars, R and R are m-by-m matrices, op( A ) and B are m-by-n and n-by-m matrices for (1), or n-by-m and m-by-n matrices for (2), respectively, and op( A ) is one of op( A ) = A or op( A ) = A', the transpose of A. The result is overwritten on R.Specification
SUBROUTINE MB01RX( SIDE, UPLO, TRANS, M, N, ALPHA, BETA, R, LDR, $ A, LDA, B, LDB, INFO ) C .. Scalar Arguments .. CHARACTER SIDE, TRANS, UPLO INTEGER INFO, LDA, LDB, LDR, M, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), R(LDR,*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether the matrix A appears on the left or right in the matrix product as follows: _ = 'L': R = alpha*R + beta*op( A )*B; _ = 'R': R = alpha*R + beta*B*op( A ). UPLO CHARACTER*1 _ Specifies which triangles of the matrices R and R are computed and given, respectively, as follows: = 'U': the upper triangular part; = 'L': the lower triangular part. TRANS CHARACTER*1 Specifies the form of op( A ) to be used in the matrix multiplication as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'.Input/Output Parameters
M (input) INTEGER _ The order of the matrices R and R, the number of rows of the matrix op( A ) and the number of columns of the matrix B, for SIDE = 'L', or the number of rows of the matrix B and the number of columns of the matrix op( A ), for SIDE = 'R'. M >= 0. N (input) INTEGER The number of rows of the matrix B and the number of columns of the matrix op( A ), for SIDE = 'L', or the number of rows of the matrix op( A ) and the number of columns of the matrix B, for SIDE = 'R'. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then A and B are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry with UPLO = 'U', the leading M-by-M upper triangular part of this array must contain the upper triangular part of the matrix R; the strictly lower triangular part of the array is not referenced. On entry with UPLO = 'L', the leading M-by-M lower triangular part of this array must contain the lower triangular part of the matrix R; the strictly upper triangular part of the array is not referenced. On exit, the leading M-by-M upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L') of this array contains the corresponding triangular part of _ the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M). A (input) DOUBLE PRECISION array, dimension (LDA,k), where k = N when SIDE = 'L', and TRANS = 'N', or SIDE = 'R', and TRANS = 'T'; k = M when SIDE = 'R', and TRANS = 'N', or SIDE = 'L', and TRANS = 'T'. On entry, if SIDE = 'L', and TRANS = 'N', or SIDE = 'R', and TRANS = 'T', the leading M-by-N part of this array must contain the matrix A. On entry, if SIDE = 'R', and TRANS = 'N', or SIDE = 'L', and TRANS = 'T', the leading N-by-M part of this array must contain the matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,l), where l = M when SIDE = 'L', and TRANS = 'N', or SIDE = 'R', and TRANS = 'T'; l = N when SIDE = 'R', and TRANS = 'N', or SIDE = 'L', and TRANS = 'T'. B (input) DOUBLE PRECISION array, dimension (LDB,p), where p = M when SIDE = 'L'; p = N when SIDE = 'R'. On entry, the leading N-by-M part, if SIDE = 'L', or M-by-N part, if SIDE = 'R', of this array must contain the matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N), if SIDE = 'L'; LDB >= MAX(1,M), if SIDE = 'R'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix expression is evaluated taking the triangular structure into account. BLAS 2 operations are used. A block algorithm can be easily constructed; it can use BLAS 3 GEMM operations for most computations, and calls of this BLAS 2 algorithm for computing the triangles.Further Comments
The main application of this routine is when the result should be a symmetric matrix, e.g., when B = X*op( A )', for (1), or B = op( A )'*X, for (2), where B is already available and X = X'.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute either the upper or lower triangular part of one of the matrix formulas _ R = alpha*R + beta*op( H )*B, (1) _ R = alpha*R + beta*B*op( H ), (2) _ where alpha and beta are scalars, H, B, R, and R are m-by-m matrices, H is an upper Hessenberg matrix, and op( H ) is one of op( H ) = H or op( H ) = H', the transpose of H. The result is overwritten on R.Specification
SUBROUTINE MB01RY( SIDE, UPLO, TRANS, M, ALPHA, BETA, R, LDR, H, $ LDH, B, LDB, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER SIDE, TRANS, UPLO INTEGER INFO, LDB, LDH, LDR, M DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION B(LDB,*), DWORK(*), H(LDH,*), R(LDR,*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether the Hessenberg matrix H appears on the left or right in the matrix product as follows: _ = 'L': R = alpha*R + beta*op( H )*B; _ = 'R': R = alpha*R + beta*B*op( H ). UPLO CHARACTER*1 _ Specifies which triangles of the matrices R and R are computed and given, respectively, as follows: = 'U': the upper triangular part; = 'L': the lower triangular part. TRANS CHARACTER*1 Specifies the form of op( H ) to be used in the matrix multiplication as follows: = 'N': op( H ) = H; = 'T': op( H ) = H'; = 'C': op( H ) = H'.Input/Output Parameters
M (input) INTEGER _ The order of the matrices R, R, H and B. M >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then R need not be set before entry. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then H and B are not referenced. R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry with UPLO = 'U', the leading M-by-M upper triangular part of this array must contain the upper triangular part of the matrix R; the strictly lower triangular part of the array is not referenced. On entry with UPLO = 'L', the leading M-by-M lower triangular part of this array must contain the lower triangular part of the matrix R; the strictly upper triangular part of the array is not referenced. On exit, the leading M-by-M upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L') of this array contains the corresponding triangular part of _ the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M). H (input) DOUBLE PRECISION array, dimension (LDH,M) On entry, the leading M-by-M upper Hessenberg part of this array must contain the upper Hessenberg part of the matrix H. The elements below the subdiagonal are not referenced, except possibly for those in the first column, which could be overwritten, but are restored on exit. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,M). B (input) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading M-by-M part of this array must contain the matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK >= M, if beta <> 0 and SIDE = 'L'; LDWORK >= 0, if beta = 0 or SIDE = 'R'. This array is not referenced when beta = 0 or SIDE = 'R'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix expression is efficiently evaluated taking the Hessenberg/triangular structure into account. BLAS 2 operations are used. A block algorithm can be constructed; it can use BLAS 3 GEMM operations for most computations, and calls of this BLAS 2 algorithm for computing the triangles.Further Comments
The main application of this routine is when the result should be a symmetric matrix, e.g., when B = X*op( H )', for (1), or B = op( H )'*X, for (2), where B is already available and X = X'.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To scale a general M-by-N matrix A using the row and column scaling factors in the vectors R and C.Specification
SUBROUTINE MB01SD( JOBS, M, N, A, LDA, R, C ) C .. Scalar Arguments .. CHARACTER JOBS INTEGER LDA, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), C(*), R(*)Arguments
Mode Parameters
JOBS CHARACTER*1 Specifies the scaling operation to be done, as follows: = 'R': row scaling, i.e., A will be premultiplied by diag(R); = 'C': column scaling, i.e., A will be postmultiplied by diag(C); = 'B': both row and column scaling, i.e., A will be replaced by diag(R) * A * diag(C).Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit, the scaled matrix. See JOBS for the form of the scaled matrix. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). R (input) DOUBLE PRECISION array, dimension (M) The row scale factors for A. R is not referenced if JOBS = 'C'. C (input) DOUBLE PRECISION array, dimension (N) The column scale factors for A. C is not referenced if JOBS = 'R'.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To scale a symmetric N-by-N matrix A using the row and column scaling factors stored in the vector D.Specification
SUBROUTINE MB01SS( JOBS, UPLO, N, A, LDA, D ) C .. Scalar Arguments .. CHARACTER JOBS, UPLO INTEGER LDA, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), D(*)Arguments
Mode Parameters
JOBS CHARACTER*1 Specifies the scaling operation to be done, as follows: = 'D': row and column scaling with D, i.e., A will be transformed to diag(D)*A*diag(D); = 'I': row and column scaling with inv(D), i.e., A will be transformed to inv(diag(D))*A*inv(diag(D)). UPLO CHARACTER*1 Specifies which triangle of the matrix A is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix A. On exit, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the corresponding triangular part of the matrix diag(D)*A*diag(D), if JOBS = 'D', or of the matrix inv(diag(D))*A*inv(diag(D)), JOBS = 'I'. The stricly lower triangular part (if UPLO = 'U') or stricly upper triangular part (if UPLO = 'L') is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). D (input) DOUBLE PRECISION array, dimension (N) The diagonal elements of the diagonal matrix D.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrix product A * B, where A and B are upper quasi-triangular matrices (that is, block upper triangular with 1-by-1 or 2-by-2 diagonal blocks) with the same structure. The result is returned in the array B.Specification
SUBROUTINE MB01TD( N, A, LDA, B, LDB, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrices A and B. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the upper quasi-triangular matrix A. The elements below the subdiagonal are not referenced. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N part of this array must contain the upper quasi-triangular matrix B, with the same structure as matrix A. On exit, the leading N-by-N part of this array contains the computed product A * B, with the same structure as on entry. The elements below the subdiagonal are not referenced. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (N-1)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrices A and B have not the same structure, and/or A and B are not upper quasi-triangular.Method
The matrix product A * B is computed column by column, using BLAS 2 and BLAS 1 operations.Further Comments
This routine can be used, for instance, for computing powers of a real Schur form matrix.Example
Program Text
* MB01TD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDB PARAMETER ( LDA = NMAX, LDB = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX-1 ) * .. Local Scalars .. INTEGER I, INFO, J, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,NMAX), DWORK(LDWORK) * .. External Subroutines .. EXTERNAL MB01TD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) 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 ) * Compute the matrix product A*B. CALL MB01TD( N, A, LDA, B, LDB, DWORK, 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 ) ( B(I,J), J = 1,N ) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' MB01TD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB01TD = ',I2) 99997 FORMAT (' The matrix product A*B is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB01TD EXAMPLE PROGRAM DATA 5 1. 2. 6. 3. 5. -2. -1. -1. 0. -2. 0. 0. 1. 5. 1. 0. 0. 0. 0. -4. 0. 0. 0. 20. 4. 5. 5. 1. 5. 1. -2. 1. 3. 0. -4. 0. 0. 4. 20. 4. 0. 0. 0. 3. 5. 0. 0. 0. 1. -2.Program Results
MB01TD EXAMPLE PROGRAM RESULTS The matrix product A*B is 1.0000 7.0000 31.0000 139.0000 22.0000 -8.0000 -11.0000 -9.0000 -32.0000 2.0000 0.0000 0.0000 4.0000 36.0000 27.0000 0.0000 0.0000 0.0000 -4.0000 8.0000 0.0000 0.0000 0.0000 64.0000 92.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01UD.html 0000664 0000000 0000000 00000010245 14560147231 0020344 0 ustar 00root root 0000000 0000000
Purpose
To compute one of the matrix products B = alpha*op( H ) * A, or B = alpha*A * op( H ), where alpha is a scalar, A and B are m-by-n matrices, H is an upper Hessenberg matrix, and op( H ) is one of op( H ) = H or op( H ) = H', the transpose of H.Specification
SUBROUTINE MB01UD( SIDE, TRANS, M, N, ALPHA, H, LDH, A, LDA, B, $ LDB, INFO ) C .. Scalar Arguments .. CHARACTER SIDE, TRANS INTEGER INFO, LDA, LDB, LDH, M, N DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), H(LDH,*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether the Hessenberg matrix H appears on the left or right in the matrix product as follows: = 'L': B = alpha*op( H ) * A; = 'R': B = alpha*A * op( H ). TRANS CHARACTER*1 Specifies the form of op( H ) to be used in the matrix multiplication as follows: = 'N': op( H ) = H; = 'T': op( H ) = H'; = 'C': op( H ) = H'.Input/Output Parameters
M (input) INTEGER The number of rows of the matrices A and B. M >= 0. N (input) INTEGER The number of columns of the matrices A and B. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then H is not referenced and A need not be set before entry. H (input) DOUBLE PRECISION array, dimension (LDH,k) where k is M when SIDE = 'L' and is N when SIDE = 'R'. On entry with SIDE = 'L', the leading M-by-M upper Hessenberg part of this array must contain the upper Hessenberg matrix H. On entry with SIDE = 'R', the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix H. The elements below the subdiagonal are not referenced, except possibly for those in the first column, which could be overwritten, but are restored on exit. LDH INTEGER The leading dimension of the array H. LDH >= max(1,k), where k is M when SIDE = 'L' and is N when SIDE = 'R'. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). B (output) DOUBLE PRECISION array, dimension (LDB,N) The leading M-by-N part of this array contains the computed product. LDB INTEGER The leading dimension of the array B. LDB >= max(1,M).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The required matrix product is computed in two steps. In the first step, the upper triangle of H is used; in the second step, the contribution of the subdiagonal is added. A fast BLAS 3 DTRMM operation is used in the first step.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01UW.html 0000664 0000000 0000000 00000011233 14560147231 0020365 0 ustar 00root root 0000000 0000000
Purpose
To compute one of the matrix products A : = alpha*op( H ) * A, or A : = alpha*A * op( H ), where alpha is a scalar, A is an m-by-n matrix, H is an upper Hessenberg matrix, and op( H ) is one of op( H ) = H or op( H ) = H', the transpose of H.Specification
SUBROUTINE MB01UW( SIDE, TRANS, M, N, ALPHA, H, LDH, A, LDA, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER SIDE, TRANS INTEGER INFO, LDA, LDH, LDWORK, M, N DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), H(LDH,*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether the Hessenberg matrix H appears on the left or right in the matrix product as follows: = 'L': A := alpha*op( H ) * A; = 'R': A := alpha*A * op( H ). TRANS CHARACTER*1 Specifies the form of op( H ) to be used in the matrix multiplication as follows: = 'N': op( H ) = H; = 'T': op( H ) = H'; = 'C': op( H ) = H'.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then H is not referenced and A need not be set before entry. H (input) DOUBLE PRECISION array, dimension (LDH,k) where k is M when SIDE = 'L' and is N when SIDE = 'R'. On entry with SIDE = 'L', the leading M-by-M upper Hessenberg part of this array must contain the upper Hessenberg matrix H. On entry with SIDE = 'R', the leading N-by-N upper Hessenberg part of this array must contain the upper Hessenberg matrix H. The elements below the subdiagonal are not referenced, except possibly for those in the first column, which could be overwritten, but are restored on exit. LDH INTEGER The leading dimension of the array H. LDH >= max(1,k), where k is M when SIDE = 'L' and is N when SIDE = 'R'. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M-by-N part of this array must contain the matrix A. On exit, the leading M-by-N part of this array contains the computed product. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, alpha <> 0, and LDWORK >= M*N > 0, DWORK contains a copy of the matrix A, having the leading dimension M. This array is not referenced when alpha = 0. LDWORK The length of the array DWORK. LDWORK >= 0, if alpha = 0 or MIN(M,N) = 0; LDWORK >= M-1, if SIDE = 'L'; LDWORK >= N-1, if SIDE = 'R'. For maximal efficiency LDWORK should be at least M*N.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The required matrix product is computed in two steps. In the first step, the upper triangle of H is used; in the second step, the contribution of the subdiagonal is added. If the workspace can accomodate a copy of A, a fast BLAS 3 DTRMM operation is used in the first step.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute one of the matrix products A : = alpha*op( T ) * A, or A : = alpha*A * op( T ), where alpha is a scalar, A is an m-by-n matrix, T is a quasi- triangular matrix, and op( T ) is one of op( T ) = T or op( T ) = T', the transpose of T.Specification
SUBROUTINE MB01UX( SIDE, UPLO, TRANS, M, N, ALPHA, T, LDT, A, LDA, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER SIDE, TRANS, UPLO INTEGER INFO, LDA, LDT, LDWORK, M, N DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), T(LDT,*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether the upper quasi-triangular matrix H appears on the left or right in the matrix product as follows: = 'L': A := alpha*op( T ) * A; = 'R': A := alpha*A * op( T ). UPLO CHARACTER*1. Specifies whether the matrix T is an upper or lower quasi-triangular matrix as follows: = 'U': T is an upper quasi-triangular matrix; = 'L': T is a lower quasi-triangular matrix. TRANS CHARACTER*1 Specifies the form of op( T ) to be used in the matrix multiplication as follows: = 'N': op( T ) = T; = 'T': op( T ) = T'; = 'C': op( T ) = T'.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then T is not referenced and A need not be set before entry. T (input) DOUBLE PRECISION array, dimension (LDT,k) where k is M when SIDE = 'L' and is N when SIDE = 'R'. On entry with UPLO = 'U', the leading k-by-k upper Hessenberg part of this array must contain the upper quasi-triangular matrix T. The elements below the subdiagonal are not referenced. On entry with UPLO = 'L', the leading k-by-k lower Hessenberg part of this array must contain the lower quasi-triangular matrix T. The elements above the supdiagonal are not referenced. LDT INTEGER The leading dimension of the array T. LDT >= max(1,k), where k is M when SIDE = 'L' and is N when SIDE = 'R'. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M-by-N part of this array must contain the matrix A. On exit, the leading M-by-N part of this array contains the computed product. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 and ALPHA<>0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -12, DWORK(1) returns the minimum value of LDWORK. This array is not referenced when alpha = 0. LDWORK The length of the array DWORK. LDWORK >= 1, if alpha = 0 or MIN(M,N) = 0; LDWORK >= 2*(M-1), if SIDE = 'L'; LDWORK >= 2*(N-1), if SIDE = 'R'. For maximal efficiency LDWORK should be at least NOFF*N + M - 1, if SIDE = 'L'; NOFF*M + N - 1, if SIDE = 'R'; where NOFF is the number of nonzero elements on the subdiagonal (if UPLO = 'U') or supdiagonal (if UPLO = 'L') of T. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The technique used in this routine is similiar to the technique used in the SLICOT [1] subroutine MB01UW developed by Vasile Sima. The required matrix product is computed in two steps. In the first step, the triangle of T specified by UPLO is used; in the second step, the contribution of the sub-/supdiagonal is added. If the workspace can accommodate parts of A, a fast BLAS 3 DTRMM operation is used in the first step.References
[1] Benner, P., Mehrmann, V., Sima, V., Van Huffel, S., and Varga, A. SLICOT - A subroutine library in systems and control theory. In: Applied and computational control, signals, and circuits, Vol. 1, pp. 499-539, Birkhauser, Boston, 1999.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01UY.html 0000664 0000000 0000000 00000012077 14560147231 0020376 0 ustar 00root root 0000000 0000000
Purpose
To compute one of the matrix products T : = alpha*op( T ) * A, or T : = alpha*A * op( T ), where alpha is a scalar, A is an M-by-N matrix, T is a triangular matrix, and op( T ) is one of op( T ) = T or op( T ) = T', the transpose of T. A block-row/column algorithm is used, if possible. The result overwrites the array T.Specification
SUBROUTINE MB01UY( SIDE, UPLO, TRANS, M, N, ALPHA, T, LDT, A, LDA, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER SIDE, TRANS, UPLO INTEGER INFO, LDA, LDT, LDWORK, M, N DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), T(LDT,*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether the triangular matrix T appears on the left or right in the matrix product, as follows: = 'L': T := alpha*op( T ) * A; = 'R': T := alpha*A * op( T ). UPLO CHARACTER*1. Specifies whether the matrix T is an upper or lower triangular matrix, as follows: = 'U': T is an upper triangular matrix; = 'L': T is a lower triangular matrix. TRANS CHARACTER*1 Specifies the form of op( T ) to be used in the matrix multiplication as follows: = 'N': op( T ) = T; = 'T': op( T ) = T'; = 'C': op( T ) = T'.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then T and A need not be set before entry. T (input/output) DOUBLE PRECISION array, dimension (LDT,max(K,N)), when SIDE = 'L', and (LDT,K), when SIDE = 'R', where K is M if SIDE = 'L' and is N if SIDE = 'R'. On entry with UPLO = 'U', the leading K-by-K upper triangular part of this array must contain the upper triangular matrix T. The elements below the diagonal do not need to be zero. On entry with UPLO = 'L', the leading K-by-K lower triangular part of this array must contain the lower triangular matrix T. The elements above the diagonal do not need to be zero. On exit, the leading M-by-N part of this array contains the corresponding product defined by SIDE, UPLO, and TRANS. LDT INTEGER The leading dimension of the array T. LDT >= max(1,M), if SIDE = 'L'; LDT >= max(1,M,N), if SIDE = 'R'. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -12, DWORK(1) returns the minimum value of LDWORK. LDWORK The length of the array DWORK. LDWORK >= 1, if alpha = 0 or MIN(M,N) = 0; LDWORK >= M, if SIDE = 'L'; LDWORK >= N, if SIDE = 'R'. For good performance, LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
A block-row/column size is found based on the available workspace. BLAS 3 gemm and trmm are used if possible.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01UZ.html 0000664 0000000 0000000 00000012213 14560147231 0020367 0 ustar 00root root 0000000 0000000
Purpose
To compute one of the matrix products T : = alpha*op( T ) * A, or T : = alpha*A * op( T ), where alpha is a scalar, A is an M-by-N matrix, T is a triangular matrix, and op( T ) is one of op( T ) = T, or op( T ) = T', the transpose of T, or op( T ) = conj(T'), the conjugate transpose of T. A block-row/column algorithm is used, if possible. The result overwrites the array T.Specification
SUBROUTINE MB01UZ( SIDE, UPLO, TRANS, M, N, ALPHA, T, LDT, A, LDA, $ ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER SIDE, TRANS, UPLO INTEGER INFO, LDA, LDT, LZWORK, M, N COMPLEX*16 ALPHA C .. Array Arguments .. COMPLEX*16 A(LDA,*), T(LDT,*), ZWORK(*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether the triangular matrix T appears on the left or right in the matrix product, as follows: = 'L': T := alpha * op( T ) * A; = 'R': T := alpha * A * op( T ). UPLO CHARACTER*1. Specifies whether the matrix T is an upper or lower triangular matrix, as follows: = 'U': T is an upper triangular matrix; = 'L': T is a lower triangular matrix. TRANS CHARACTER*1 Specifies the form of op( T ) to be used in the matrix multiplication as follows: = 'N': op( T ) = T; = 'T': op( T ) = T'; = 'C': op( T ) = conj(T').Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. ALPHA (input) COMPLEX*16 The scalar alpha. When alpha is zero then T and A need not be set before entry. T (input/output) COMPLEX*16 array, dimension (LDT,max(K,N)), when SIDE = 'L', and (LDT,K), when SIDE = 'R', where K is M if SIDE = 'L' and is N if SIDE = 'R'. On entry with UPLO = 'U', the leading K-by-K upper triangular part of this array must contain the upper triangular matrix T. The elements below the diagonal do not need to be zero. On entry with UPLO = 'L', the leading K-by-K lower triangular part of this array must contain the lower triangular matrix T. The elements above the diagonal do not need to be zero. On exit, the leading M-by-N part of this array contains the corresponding product defined by SIDE, UPLO, and TRANS. LDT INTEGER The leading dimension of the array T. LDT >= max(1,M), if SIDE = 'L'; LDT >= max(1,M,N), if SIDE = 'R'. A (input) COMPLEX*16 array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M).Workspace
ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. On exit, if INFO = -12, ZWORK(1) returns the minimum value of LZWORK. LZWORK The length of the array ZWORK. LZWORK >= 1, if alpha = 0 or MIN(M,N) = 0; LZWORK >= M, if SIDE = 'L'; LZWORK >= N, if SIDE = 'R'. For good performance, LZWORK should be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
A block-row/column size is found based on the available workspace. BLAS 3 gemm and trmm are used if possible.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01VD.html 0000664 0000000 0000000 00000012030 14560147231 0020337 0 ustar 00root root 0000000 0000000
Purpose
To perform the following matrix operation C = alpha*kron( op(A), op(B) ) + beta*C, where alpha and beta are real scalars, op(M) is either matrix M or its transpose, M', and kron( X, Y ) denotes the Kronecker product of the matrices X and Y.Specification
SUBROUTINE MB01VD( TRANA, TRANB, MA, NA, MB, NB, ALPHA, BETA, $ A, LDA, B, LDB, C, LDC, MC, NC, INFO ) C .. Scalar Arguments .. CHARACTER TRANA, TRANB INTEGER INFO, LDA, LDB, LDC, MA, MB, MC, NA, NB, NC DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*)Arguments
Mode Parameters
TRANA CHARACTER*1 Specifies the form of op(A) to be used as follows: = 'N': op(A) = A; = 'T': op(A) = A'; = 'C': op(A) = A'. TRANB CHARACTER*1 Specifies the form of op(B) to be used as follows: = 'N': op(B) = B; = 'T': op(B) = B'; = 'C': op(B) = B'.Input/Output Parameters
MA (input) INTEGER The number of rows of the matrix op(A). MA >= 0. NA (input) INTEGER The number of columns of the matrix op(A). NA >= 0. MB (input) INTEGER The number of rows of the matrix op(B). MB >= 0. NB (input) INTEGER The number of columns of the matrix op(B). NB >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then A and B need not be set before entry. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then C need not be set before entry. A (input) DOUBLE PRECISION array, dimension (LDA,ka), where ka is NA when TRANA = 'N', and is MA otherwise. If TRANA = 'N', the leading MA-by-NA part of this array must contain the matrix A; otherwise, the leading NA-by-MA part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,MA), if TRANA = 'N'; LDA >= max(1,NA), if TRANA = 'T' or 'C'. B (input) DOUBLE PRECISION array, dimension (LDB,kb) where kb is NB when TRANB = 'N', and is MB otherwise. If TRANB = 'N', the leading MB-by-NB part of this array must contain the matrix B; otherwise, the leading NB-by-MB part of this array must contain the matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,MB), if TRANB = 'N'; LDB >= max(1,NB), if TRANB = 'T' or 'C'. C (input/output) DOUBLE PRECISION array, dimension (LDC,NC) On entry, if beta is nonzero, the leading MC-by-NC part of this array must contain the given matric C, where MC = MA*MB and NC = NA*NB. On exit, the leading MC-by-NC part of this array contains the computed matrix expression C = alpha*kron( op(A), op(B) ) + beta*C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,MC). MC (output) INTEGER The number of rows of the matrix C. MC = MA*MB. NC (output) INTEGER The number of columns of the matrix C. NC = NA*NB.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The Kronecker product of the matrices op(A) and op(B) is computed column by column.Further Comments
The multiplications by zero elements in A are avoided, if the matrix A is considered to be sparse, i.e., if (number of zeros in A)/(MA*NA) >= SPARST = 0.8. The code makes NB+1 passes through the matrix A, and MA*NA passes through the matrix B. If LDA and/or LDB are very large, and op(A) = A' and/or op(B) = B', it could be more efficient to transpose A and/or B before calling this routine, and use the 'N' values for TRANA and/or TRANB.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrix formula _ R = alpha*( op( A )'*op( T )'*op( T ) + op( T )'*op( T )*op( A ) ) + beta*R, (1) if DICO = 'C', or _ R = alpha*( op( A )'*op( T )'*op( T )*op( A ) - op( T )'*op( T )) + beta*R, (2) _ if DICO = 'D', where alpha and beta are scalars, R, and R are symmetric matrices, T is a triangular matrix, A is a general or Hessenberg matrix, and op( M ) is one of op( M ) = M or op( M ) = M'. The result is overwritten on R.Specification
SUBROUTINE MB01WD( DICO, UPLO, TRANS, HESS, N, ALPHA, BETA, R, $ LDR, A, LDA, T, LDT, INFO ) C .. Scalar Arguments .. CHARACTER DICO, HESS, TRANS, UPLO INTEGER INFO, LDA, LDR, LDT, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), R(LDR,*), T(LDT,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the formula to be evaluated, as follows: = 'C': formula (1), "continuous-time" case; = 'D': formula (2), "discrete-time" case. UPLO CHARACTER*1 Specifies which triangles of the symmetric matrix R and triangular matrix T are given, as follows: = 'U': the upper triangular parts of R and T are given; = 'L': the lower triangular parts of R and T are given; TRANS CHARACTER*1 Specifies the form of op( M ) to be used, as follows: = 'N': op( M ) = M; = 'T': op( M ) = M'; = 'C': op( M ) = M'. HESS CHARACTER*1 Specifies the form of the matrix A, as follows: = 'F': matrix A is full; = 'H': matrix A is Hessenberg (or Schur), either upper (if UPLO = 'U'), or lower (if UPLO = 'L').Input/Output Parameters
N (input) INTEGER The order of the matrices R, A, and T. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then the arrays A and T are not referenced. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then the array R need not be set before entry. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry with UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix R. On entry with UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix R. On exit, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of _ the computed matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). 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. If HESS = 'H' the elements below the first subdiagonal, if UPLO = 'U', or above the first superdiagonal, if UPLO = 'L', need not be set to zero, and are not referenced if DICO = 'D'. On exit, the leading N-by-N part of this array contains the following matrix product alpha*T'*T*A, if TRANS = 'N', or alpha*A*T*T', otherwise, if DICO = 'C', or T*A, if TRANS = 'N', or A*T, otherwise, if DICO = 'D' (and in this case, these products have a Hessenberg form, if HESS = 'H'). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). T (input) DOUBLE PRECISION array, dimension (LDT,N) If UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular matrix T and the strictly lower triangular part need not be set to zero (and it is not referenced). If UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular matrix T and the strictly upper triangular part need not be set to zero (and it is not referenced). LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value.Method
The matrix expression (1) or (2) is efficiently evaluated taking the structure into account. BLAS 3 operations (DTRMM, DSYRK and their specializations) are used throughout.Numerical Aspects
If A is a full matrix, the algorithm requires approximately 3 N operations, if DICO = 'C'; 3 7/6 x N operations, if DICO = 'D'.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01XD.html 0000664 0000000 0000000 00000006620 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrix product U' * U or L * L', where U and L are upper and lower triangular matrices, respectively, stored in the corresponding upper or lower triangular part of the array A. If UPLO = 'U' then the upper triangle of the result is stored, overwriting the matrix U in A. If UPLO = 'L' then the lower triangle of the result is stored, overwriting the matrix L in A.Specification
SUBROUTINE MB01XD( UPLO, N, A, LDA, INFO ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER INFO, LDA, N C .. Array Arguments .. DOUBLE PRECISION A( LDA, * )Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangle (U or L) is given in the array A, as follows: = 'U': the upper triangular part U is given; = 'L': the lower triangular part L is given.Input/Output Parameters
N (input) INTEGER The order of the triangular matrices U or L. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular matrix U. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular matrix L. On exit, if UPLO = 'U', the leading N-by-N upper triangular part of this array contains the upper triangular part of the product U' * U. The strictly lower triangular part is not referenced. On exit, if UPLO = 'L', the leading N-by-N lower triangular part of this array contains the lower triangular part of the product L * L'. The strictly upper triangular part is not referenced. LDA INTEGER The leading dimension of array A. LDA >= max(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix product U' * U or L * L' is computed using BLAS 3 operations as much as possible (a block algorithm).Further Comments
This routine is a counterpart of LAPACK Library routine DLAUUM, which computes the matrix product U * U' or L' * L.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01XY.html 0000664 0000000 0000000 00000006632 14560147231 0020401 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrix product U' * U or L * L', where U and L are upper and lower triangular matrices, respectively, stored in the corresponding upper or lower triangular part of the array A. If UPLO = 'U' then the upper triangle of the result is stored, overwriting the matrix U in A. If UPLO = 'L' then the lower triangle of the result is stored, overwriting the matrix L in A.Specification
SUBROUTINE MB01XY( UPLO, N, A, LDA, INFO ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER INFO, LDA, N C .. Array Arguments .. DOUBLE PRECISION A( LDA, * )Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangle (U or L) is given in the array A, as follows: = 'U': the upper triangular part U is given; = 'L': the lower triangular part L is given.Input/Output Parameters
N (input) INTEGER The order of the triangular matrices U or L. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular matrix U. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular matrix L. On exit, if UPLO = 'U', the leading N-by-N upper triangular part of this array contains the upper triangular part of the product U' * U. The strictly lower triangular part is not referenced. On exit, if UPLO = 'L', the leading N-by-N lower triangular part of this array contains the lower triangular part of the product L * L'. The strictly upper triangular part is not referenced. LDA INTEGER The leading dimension of array A. LDA >= max(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix product U' * U or L * L' is computed using BLAS 2 and BLAS 1 operations (an unblocked algorithm).Further Comments
This routine is a counterpart of LAPACK Library routine DLAUU2, which computes the matrix product U * U' or L' * L.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To perform the symmetric rank k operations C := alpha*op( A )*op( A )' + beta*C, where alpha and beta are scalars, C is an n-by-n symmetric matrix, op( A ) is an n-by-k matrix, and op( A ) is one of op( A ) = A or op( A ) = A'. The matrix A has l nonzero codiagonals, either upper or lower.Specification
SUBROUTINE MB01YD( UPLO, TRANS, N, K, L, ALPHA, BETA, A, LDA, C, $ LDC, INFO ) C .. Scalar Arguments .. CHARACTER TRANS, UPLO INTEGER INFO, LDA, LDC, K, L, N DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), C( LDC, * )Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies which triangle of the symmetric matrix C is given and computed, as follows: = 'U': the upper triangular part is given/computed; = 'L': the lower triangular part is given/computed. UPLO also defines the pattern of the matrix A (see below). TRANS CHARACTER*1 Specifies the form of op( A ) to be used, as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'.Input/Output Parameters
N (input) INTEGER The order of the matrix C. N >= 0. K (input) INTEGER The number of columns of the matrix op( A ). K >= 0. L (input) INTEGER If UPLO = 'U', matrix A has L nonzero subdiagonals. If UPLO = 'L', matrix A has L nonzero superdiagonals. MAX(0,NR-1) >= L >= 0, if UPLO = 'U', MAX(0,NC-1) >= L >= 0, if UPLO = 'L', where NR and NC are the numbers of rows and columns of the matrix A, respectively. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then the array A is not referenced. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then the array C need not be set before entry. A (input) DOUBLE PRECISION array, dimension (LDA,NC), where NC is K when TRANS = 'N', and is N otherwise. If TRANS = 'N', the leading N-by-K part of this array must contain the matrix A, otherwise the leading K-by-N part of this array must contain the matrix A. If UPLO = 'U', only the upper triangular part and the first L subdiagonals are referenced, and the remaining subdiagonals are assumed to be zero. If UPLO = 'L', only the lower triangular part and the first L superdiagonals are referenced, and the remaining superdiagonals are assumed to be zero. LDA INTEGER The leading dimension of array A. LDA >= max(1,NR), where NR = N, if TRANS = 'N', and NR = K, otherwise. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry with UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix C. On entry with UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix C. On exit, the leading N-by-N upper triangular part (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), of this array contains the corresponding triangular part of the updated matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The calculations are efficiently performed taking the symmetry and structure into account.Further Comments
The matrix A may have the following patterns, when n = 7, k = 5, and l = 2 are used for illustration: UPLO = 'U', TRANS = 'N' UPLO = 'L', TRANS = 'N' [ x x x x x ] [ x x x 0 0 ] [ x x x x x ] [ x x x x 0 ] [ x x x x x ] [ x x x x x ] A = [ 0 x x x x ], A = [ x x x x x ], [ 0 0 x x x ] [ x x x x x ] [ 0 0 0 x x ] [ x x x x x ] [ 0 0 0 0 x ] [ x x x x x ] UPLO = 'U', TRANS = 'T' UPLO = 'L', TRANS = 'T' [ x x x x x x x ] [ x x x 0 0 0 0 ] [ x x x x x x x ] [ x x x x 0 0 0 ] A = [ x x x x x x x ], A = [ x x x x x 0 0 ]. [ 0 x x x x x x ] [ x x x x x x 0 ] [ 0 0 x x x x x ] [ x x x x x x x ] If N = K, the matrix A is upper or lower triangular, for L = 0, and upper or lower Hessenberg, for L = 1. This routine is a specialization of the BLAS 3 routine DSYRK. BLAS 1 calls are used when appropriate, instead of in-line code, in order to increase the efficiency. If the matrix A is full, or its zero triangle has small order, an optimized DSYRK code could be faster than MB01YD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB01ZD.html 0000664 0000000 0000000 00000015160 14560147231 0020352 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrix product H := alpha*op( T )*H, or H := alpha*H*op( T ), where alpha is a scalar, H is an m-by-n upper or lower Hessenberg-like matrix (with l nonzero subdiagonals or superdiagonals, respectively), T is a unit, or non-unit, upper or lower triangular matrix, and op( T ) is one of op( T ) = T or op( T ) = T'.Specification
SUBROUTINE MB01ZD( SIDE, UPLO, TRANST, DIAG, M, N, L, ALPHA, T, $ LDT, H, LDH, INFO ) C .. Scalar Arguments .. CHARACTER DIAG, SIDE, TRANST, UPLO INTEGER INFO, L, LDH, LDT, M, N DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION H( LDH, * ), T( LDT, * )Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether the triangular matrix T appears on the left or right in the matrix product, as follows: = 'L': the product alpha*op( T )*H is computed; = 'R': the product alpha*H*op( T ) is computed. UPLO CHARACTER*1 Specifies the form of the matrices T and H, as follows: = 'U': the matrix T is upper triangular and the matrix H is upper Hessenberg-like; = 'L': the matrix T is lower triangular and the matrix H is lower Hessenberg-like. TRANST CHARACTER*1 Specifies the form of op( T ) to be used, as follows: = 'N': op( T ) = T; = 'T': op( T ) = T'; = 'C': op( T ) = T'. DIAG CHARACTER*1. Specifies whether or not T is unit triangular, as follows: = 'U': the matrix T is assumed to be unit triangular; = 'N': the matrix T is not assumed to be unit triangular.Input/Output Parameters
M (input) INTEGER The number of rows of H. M >= 0. N (input) INTEGER The number of columns of H. N >= 0. L (input) INTEGER If UPLO = 'U', matrix H has L nonzero subdiagonals. If UPLO = 'L', matrix H has L nonzero superdiagonals. MAX(0,M-1) >= L >= 0, if UPLO = 'U'; MAX(0,N-1) >= L >= 0, if UPLO = 'L'. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then T is not referenced and H need not be set before entry. T (input) DOUBLE PRECISION array, dimension (LDT,k), where k is m when SIDE = 'L' and is n when SIDE = 'R'. If UPLO = 'U', the leading k-by-k upper triangular part of this array must contain the upper triangular matrix T and the strictly lower triangular part is not referenced. If UPLO = 'L', the leading k-by-k lower triangular part of this array must contain the lower triangular matrix T and the strictly upper triangular part is not referenced. Note that when DIAG = 'U', the diagonal elements of T are not referenced either, but are assumed to be unity. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,M), if SIDE = 'L'; LDT >= MAX(1,N), if SIDE = 'R'. H (input/output) DOUBLE PRECISION array, dimension (LDH,N) On entry, if UPLO = 'U', the leading M-by-N upper Hessenberg part of this array must contain the upper Hessenberg-like matrix H. On entry, if UPLO = 'L', the leading M-by-N lower Hessenberg part of this array must contain the lower Hessenberg-like matrix H. On exit, the leading M-by-N part of this array contains the matrix product alpha*op( T )*H, if SIDE = 'L', or alpha*H*op( T ), if SIDE = 'R'. If TRANST = 'N', this product has the same pattern as the given matrix H; the elements below the L-th subdiagonal (if UPLO = 'U'), or above the L-th superdiagonal (if UPLO = 'L'), are not referenced in this case. If TRANST = 'T', the elements below the (N+L)-th row (if UPLO = 'U', SIDE = 'R', and M > N+L), or at the right of the (M+L)-th column (if UPLO = 'L', SIDE = 'L', and N > M+L), are not set to zero nor referenced. LDH INTEGER The leading dimension of array H. LDH >= max(1,M).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The calculations are efficiently performed taking the problem structure into account.Further Comments
The matrix H may have the following patterns, when m = 7, n = 6, and l = 2 are used for illustration: UPLO = 'U' UPLO = 'L' [ x x x x x x ] [ x x x 0 0 0 ] [ x x x x x x ] [ x x x x 0 0 ] [ x x x x x x ] [ x x x x x 0 ] H = [ 0 x x x x x ], H = [ x x x x x x ]. [ 0 0 x x x x ] [ x x x x x x ] [ 0 0 0 x x x ] [ x x x x x x ] [ 0 0 0 0 x x ] [ x x x x x x ] The products T*H or H*T have the same pattern as H, but the products T'*H or H*T' may be full matrices. If m = n, the matrix H is upper or lower triangular, for l = 0, and upper or lower Hessenberg, for l = 1. This routine is a specialization of the BLAS 3 routine DTRMM. BLAS 1 calls are used when appropriate, instead of in-line code, in order to increase the efficiency. If the matrix H is full, or its zero triangle has small order, an optimized DTRMM code could be faster than MB01ZD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02CD.html 0000664 0000000 0000000 00000031354 14560147231 0020327 0 ustar 00root root 0000000 0000000
Purpose
To compute the Cholesky factor and the generator and/or the Cholesky factor of the inverse of a symmetric positive definite (s.p.d.) block Toeplitz matrix T, defined by either its first block row, or its first block column, depending on the routine parameter TYPET. Transformation information is stored.Specification
SUBROUTINE MB02CD( JOB, TYPET, K, N, T, LDT, G, LDG, R, LDR, L, $ LDL, CS, LCS, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOB, TYPET INTEGER INFO, K, LCS, LDG, LDL, LDR, LDT, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION CS(*), DWORK(*), G(LDG, *), L(LDL,*), R(LDR,*), $ T(LDT,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the output of the routine, as follows: = 'G': only computes the generator G of the inverse; = 'R': computes the generator G of the inverse and the Cholesky factor R of T, i.e., if TYPET = 'R', then R'*R = T, and if TYPET = 'C', then R*R' = T; = 'L': computes the generator G and the Cholesky factor L of the inverse, i.e., if TYPET = 'R', then L'*L = inv(T), and if TYPET = 'C', then L*L' = inv(T); = 'A': computes the generator G, the Cholesky factor L of the inverse and the Cholesky factor R of T; = 'O': only computes the Cholesky factor R of T. TYPET CHARACTER*1 Specifies the type of T, as follows: = 'R': T contains the first block row of an s.p.d. block Toeplitz matrix; if demanded, the Cholesky factors R and L are upper and lower triangular, respectively, and G contains the transposed generator of the inverse; = 'C': T contains the first block column of an s.p.d. block Toeplitz matrix; if demanded, the Cholesky factors R and L are lower and upper triangular, respectively, and G contains the generator of the inverse. This choice results in a column oriented algorithm which is usually faster. Note: in the sequel, the notation x / y means that x corresponds to TYPET = 'R' and y corresponds to TYPET = 'C'.Input/Output Parameters
K (input) INTEGER The number of rows / columns in T, which should be equal to the blocksize. K >= 0. N (input) INTEGER The number of blocks in T. N >= 0. T (input/output) DOUBLE PRECISION array, dimension (LDT,N*K) / (LDT,K) On entry, the leading K-by-N*K / N*K-by-K part of this array must contain the first block row / column of an s.p.d. block Toeplitz matrix. On exit, if INFO = 0, then the leading K-by-N*K / N*K-by-K part of this array contains, in the first K-by-K block, the upper / lower Cholesky factor of T(1:K,1:K), and in the remaining part, the Householder transformations applied during the process. LDT INTEGER The leading dimension of the array T. LDT >= MAX(1,K), if TYPET = 'R'; LDT >= MAX(1,N*K), if TYPET = 'C'. G (output) DOUBLE PRECISION array, dimension (LDG,N*K) / (LDG,2*K) If INFO = 0 and JOB = 'G', 'R', 'L', or 'A', the leading 2*K-by-N*K / N*K-by-2*K part of this array contains, in the first K-by-K block of the second block row / column, the lower right block of L (necessary for updating factorizations in SLICOT Library routine MB02DD), and in the remaining part, the generator of the inverse of T. Actually, to obtain a generator one has to set G(K+1:2*K, 1:K) = 0, if TYPET = 'R'; G(1:K, K+1:2*K) = 0, if TYPET = 'C'. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,2*K), if TYPET = 'R' and JOB = 'G', 'R', 'L', or 'A'; LDG >= MAX(1,N*K), if TYPET = 'C' and JOB = 'G', 'R', 'L', or 'A'; LDG >= 1, if JOB = 'O'. R (output) DOUBLE PRECISION array, dimension (LDR,N*K) If INFO = 0 and JOB = 'R', 'A', or 'O', then the leading N*K-by-N*K part of this array contains the upper / lower Cholesky factor of T. The elements in the strictly lower / upper triangular part are not referenced. LDR INTEGER The leading dimension of the array R. LDR >= MAX(1,N*K), if JOB = 'R', 'A', or 'O'; LDR >= 1, if JOB = 'G', or 'L'. L (output) DOUBLE PRECISION array, dimension (LDL,N*K) If INFO = 0 and JOB = 'L', or 'A', then the leading N*K-by-N*K part of this array contains the lower / upper Cholesky factor of the inverse of T. The elements in the strictly upper / lower triangular part are not referenced. LDL INTEGER The leading dimension of the array L. LDL >= MAX(1,N*K), if JOB = 'L', or 'A'; LDL >= 1, if JOB = 'G', 'R', or 'O'. CS (output) DOUBLE PRECISION array, dimension (LCS) If INFO = 0, then the leading 3*(N-1)*K part of this array contains information about the hyperbolic rotations and Householder transformations applied during the process. This information is needed for updating the factorizations in SLICOT Library routine MB02DD. LCS INTEGER The length of the array CS. LCS >= 3*(N-1)*K.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -16, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,(N-1)*K). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction algorithm failed. The Toeplitz matrix associated with T is not (numerically) positive definite.Method
Householder transformations and modified hyperbolic rotations are used in the Schur algorithm [1], [2].References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
The implemented method is numerically stable. 3 2 The algorithm requires 0(K N ) floating point operations.Further Comments
NoneExample
Program Text
* MB02CD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, NMAX PARAMETER ( KMAX = 20, NMAX = 20 ) INTEGER LCS, LDG, LDL, LDR, LDT, LDWORK PARAMETER ( LDG = 2*KMAX, LDL = NMAX*KMAX, LDR = NMAX*KMAX, $ LDT = KMAX, LDWORK = ( NMAX - 1 )*KMAX ) PARAMETER ( LCS = 3*LDWORK ) * .. Local Scalars .. INTEGER I, INFO, J, K, M, N CHARACTER JOB, TYPET * .. Local Arrays .. (Dimensioned for TYPET = 'R'.) DOUBLE PRECISION CS(LCS), DWORK(LDWORK), G(LDG, NMAX*KMAX), $ L(LDL, NMAX*KMAX), R(LDR, NMAX*KMAX), $ T(LDT, NMAX*KMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DLASET, MB02CD * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, K, JOB TYPET = 'R' M = N*K IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE IF( K.LE.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99992 ) K ELSE READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,M ), I = 1,K ) * Compute the Cholesky factor(s) and/or the generator. CALL MB02CD( JOB, TYPET, K, N, T, LDT, G, LDG, R, LDR, L, $ LDL, CS, LCS, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( JOB, 'G' ) .OR. LSAME( JOB, 'A' ) .OR. $ LSAME( JOB, 'L' ) .OR. LSAME( JOB, 'R' ) ) THEN WRITE ( NOUT, FMT = 99997 ) CALL DLASET( 'Full', K, K, ZERO, ZERO, G(K+1,1), LDG ) DO 10 I = 1, 2*K WRITE ( NOUT, FMT = 99994 ) ( G(I,J), J = 1, M ) 10 CONTINUE END IF IF ( LSAME( JOB, 'L' ) .OR. LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, M WRITE ( NOUT, FMT = 99994 ) ( L(I,J), J = 1, M ) 20 CONTINUE END IF IF ( LSAME( JOB, 'R' ) .OR. LSAME( JOB, 'A' ) $ .OR. LSAME( JOB, 'O' ) ) THEN WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, M WRITE ( NOUT, FMT = 99994 ) ( R(I,J), J = 1, M ) 30 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' MB02CD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02CD = ',I2) 99997 FORMAT (' The generator of the inverse of block Toeplitz matrix', $ ' is ') 99996 FORMAT (/' The lower Cholesky factor of the inverse is ') 99995 FORMAT (/' The upper Cholesky factor of block Toeplitz matrix is ' $ ) 99994 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' K is out of range.',/' K = ',I5) ENDProgram Data
MB02CD EXAMPLE PROGRAM DATA 3 2 A 3.0000 1.0000 0.1000 0.1000 0.2000 0.0500 1.0000 4.0000 0.4000 0.1000 0.0400 0.2000Program Results
MB02CD EXAMPLE PROGRAM RESULTS The generator of the inverse of block Toeplitz matrix is -0.2355 0.5231 -0.0642 0.0077 0.0187 -0.0265 -0.5568 -0.0568 0.0229 0.0060 0.0363 0.0000 0.0000 0.0000 -0.0387 0.0052 0.0003 -0.0575 0.0000 0.0000 0.0119 -0.0265 -0.0110 0.0076 The lower Cholesky factor of the inverse is 0.5774 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1741 0.5222 0.0000 0.0000 0.0000 0.0000 0.0000 -0.0581 0.5812 0.0000 0.0000 0.0000 -0.0142 0.0080 -0.1747 0.5224 0.0000 0.0000 -0.0387 0.0052 0.0003 -0.0575 0.5825 0.0000 0.0119 -0.0265 -0.0110 0.0076 -0.1754 0.5231 The upper Cholesky factor of block Toeplitz matrix is 1.7321 0.5774 0.0577 0.0577 0.1155 0.0289 0.0000 1.9149 0.1915 0.0348 -0.0139 0.0957 0.0000 0.0000 1.7205 0.5754 0.0558 0.0465 0.0000 0.0000 0.0000 1.9142 0.1890 0.0357 0.0000 0.0000 0.0000 0.0000 1.7169 0.5759 0.0000 0.0000 0.0000 0.0000 0.0000 1.9118
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02CU.html 0000664 0000000 0000000 00000023002 14560147231 0020337 0 ustar 00root root 0000000 0000000
Purpose
To bring the first blocks of a generator to proper form. The positive part of the generator is contained in the arrays A1 and A2. The negative part of the generator is contained in B. Transformation information will be stored and can be applied via SLICOT Library routine MB02CV.Specification
SUBROUTINE MB02CU( TYPEG, K, P, Q, NB, A1, LDA1, A2, LDA2, B, LDB, $ RNK, IPVT, CS, TOL, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TYPEG INTEGER INFO, K, LDA1, LDA2, LDB, LDWORK, NB, P, Q, RNK DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IPVT(*) DOUBLE PRECISION A1(LDA1,*), A2(LDA2,*), B(LDB,*), CS(*), $ DWORK(*)Arguments
Mode Parameters
TYPEG CHARACTER*1 Specifies the type of the generator, as follows: = 'D': generator is column oriented and rank deficiencies are expected; = 'C': generator is column oriented and rank deficiencies are not expected; = 'R': generator is row oriented and rank deficiencies are not expected.Input/Output Parameters
K (input) INTEGER The number of rows in A1 to be processed. K >= 0. P (input) INTEGER The number of columns of the positive generator. P >= K. Q (input) INTEGER The number of columns in B containing the negative generators. If TYPEG = 'D', Q >= K; If TYPEG = 'C' or 'R', Q >= 0. NB (input) INTEGER On entry, if TYPEG = 'C' or TYPEG = 'R', NB specifies the block size to be used in the blocked parts of the algorithm. If NB <= 0, an unblocked algorithm is used. A1 (input/output) DOUBLE PRECISION array, dimension (LDA1, K) On entry, the leading K-by-K part of this array must contain the leading submatrix of the positive part of the generator. If TYPEG = 'C', A1 is assumed to be lower triangular and the strictly upper triangular part is not referenced. If TYPEG = 'R', A1 is assumed to be upper triangular and the strictly lower triangular part is not referenced. On exit, if TYPEG = 'D', the leading K-by-RNK part of this array contains the lower trapezoidal part of the proper generator and information for the Householder transformations applied during the reduction process. On exit, if TYPEG = 'C', the leading K-by-K part of this array contains the leading lower triangular part of the proper generator. On exit, if TYPEG = 'R', the leading K-by-K part of this array contains the leading upper triangular part of the proper generator. LDA1 INTEGER The leading dimension of the array A1. LDA1 >= MAX(1,K). A2 (input/output) DOUBLE PRECISION array, if TYPEG = 'D' or TYPEG = 'C', dimension (LDA2, P-K); if TYPEG = 'R', dimension (LDA2, K). On entry, if TYPEG = 'D' or TYPEG = 'C', the leading K-by-(P-K) part of this array must contain the (K+1)-st to P-th columns of the positive part of the generator. On entry, if TYPEG = 'R', the leading (P-K)-by-K part of this array must contain the (K+1)-st to P-th rows of the positive part of the generator. On exit, if TYPEG = 'D' or TYPEG = 'C', the leading K-by-(P-K) part of this array contains information for Householder transformations. On exit, if TYPEG = 'R', the leading (P-K)-by-K part of this array contains information for Householder transformations. LDA2 INTEGER The leading dimension of the array A2. If P = K, LDA2 >= 1; If P > K and (TYPEG = 'D' or TYPEG = 'C'), LDA2 >= MAX(1,K); if P > K and TYPEG = 'R', LDA2 >= P-K. B (input/output) DOUBLE PRECISION array, if TYPEG = 'D' or TYPEG = 'C', dimension (LDB, Q); if TYPEG = 'R', dimension (LDB, K). On entry, if TYPEG = 'D' or TYPEG = 'C', the leading K-by-Q part of this array must contain the negative part of the generator. On entry, if TYPEG = 'R', the leading Q-by-K part of this array must contain the negative part of the generator. On exit, if TYPEG = 'D' or TYPEG = 'C', the leading K-by-Q part of this array contains information for Householder transformations. On exit, if TYPEG = 'R', the leading Q-by-K part of this array contains information for Householder transformations. LDB INTEGER The leading dimension of the array B. If Q = 0, LDB >= 1; if Q > 0 and (TYPEG = 'D' or TYPEG = 'C'), LDB >= MAX(1,K); if Q > 0 and TYPEG = 'R', LDB >= Q. RNK (output) INTEGER If TYPEG = 'D', the number of columns in the reduced generator which are found to be linearly independent. If TYPEG = 'C' or TYPEG = 'R', then RNK is not set. IPVT (output) INTEGER array, dimension (K) If TYPEG = 'D', then if IPVT(i) = k, the k-th row of the proper generator is the reduced i-th row of the input generator. If TYPEG = 'C' or TYPEG = 'R', this array is not referenced. CS (output) DOUBLE PRECISION array, dimension (x) If TYPEG = 'D' and P = K, x = 3*K; if TYPEG = 'D' and P > K, x = 5*K; if (TYPEG = 'C' or TYPEG = 'R') and P = K, x = 4*K; if (TYPEG = 'C' or TYPEG = 'R') and P > K, x = 6*K. On exit, the first x elements of this array contain necessary information for the SLICOT library routine MB02CV (Givens and modified hyperbolic rotation parameters, scalar factors of the Householder transformations).Tolerances
TOL DOUBLE PRECISION If TYPEG = 'D', this number specifies the used tolerance for handling deficiencies. If the hyperbolic norm of two diagonal elements in the positive and negative generators appears to be less than or equal to TOL, then the corresponding columns are not reduced.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = -17, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,4*K), if TYPEG = 'D'; LDWORK >= MAX(1,MAX(NB,1)*K), if TYPEG = 'C' or 'R'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if TYPEG = 'D', the generator represents a (numerically) indefinite matrix; and if TYPEG = 'C' or TYPEG = 'R', the generator represents a (numerically) semidefinite matrix.Method
If TYPEG = 'C' or TYPEG = 'R', blocked Householder transformations and modified hyperbolic rotations are used to downdate the matrix [ A1 A2 sqrt(-1)*B ], cf. [1], [2]. If TYPEG = 'D', then an algorithm with row pivoting is used. In the first stage it maximizes the hyperbolic norm of the active row. As soon as the hyperbolic norm is below the threshold TOL, the strategy is changed. Now, in the second stage, the algorithm applies an LQ decomposition with row pivoting on B such that the Euclidean norm of the active row is maximized.References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
2 The algorithm requires 0(K *( P + Q )) floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To apply the transformations created by the SLICOT Library routine MB02CU on other columns / rows of the generator, contained in the arrays F1, F2 and G.Specification
SUBROUTINE MB02CV( TYPEG, STRUCG, K, N, P, Q, NB, RNK, A1, LDA1, $ A2, LDA2, B, LDB, F1, LDF1, F2, LDF2, G, LDG, $ CS, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER STRUCG, TYPEG INTEGER INFO, K, LDA1, LDA2, LDB, LDF1, LDF2, LDG, $ LDWORK, N, NB, P, Q, RNK C .. Array Arguments .. DOUBLE PRECISION A1(LDA1,*), A2(LDA2,*), B(LDB,*), CS(*), $ DWORK(*), F1(LDF1,*), F2(LDF2,*), G(LDG,*)Arguments
Mode Parameters
TYPEG CHARACTER*1 Specifies the type of the generator, as follows: = 'D': generator is column oriented and rank deficient; = 'C': generator is column oriented and not rank deficient; = 'R': generator is row oriented and not rank deficient. Note that this parameter must be equivalent with the used TYPEG in the call of MB02CU. STRUCG CHARACTER*1 Information about the structure of the generators, as follows: = 'T': the trailing block of the positive generator is upper / lower triangular, and the trailing block of the negative generator is zero; = 'N': no special structure to mention.Input/Output Parameters
K (input) INTEGER The number of rows in A1 to be processed. K >= 0. N (input) INTEGER If TYPEG = 'D' or TYPEG = 'C', the number of rows in F1; if TYPEG = 'R', the number of columns in F1. N >= 0. P (input) INTEGER The number of columns of the positive generator. P >= K. Q (input) INTEGER The number of columns in B. If TYPEG = 'D', Q >= K; If TYPEG = 'C' or 'R', Q >= 0. NB (input) INTEGER On entry, if TYPEG = 'C' or TYPEG = 'R', NB specifies the block size to be used in the blocked parts of the algorithm. NB must be equivalent with the used block size in the routine MB02CU. RNK (input) INTEGER If TYPEG = 'D', the number of linearly independent columns in the generator as returned by MB02CU. 0 <= RNK <= K. If TYPEG = 'C' or 'R', the value of this parameter is irrelevant. A1 (input) DOUBLE PRECISION array, dimension (LDA1, K) On entry, if TYPEG = 'D', the leading K-by-K part of this array must contain the matrix A1 as returned by MB02CU. If TYPEG = 'C' or 'R', this array is not referenced. LDA1 INTEGER The leading dimension of the array A1. If TYPEG = 'D', LDA1 >= MAX(1,K); if TYPEG = 'C' or TYPEG = 'R', LDA1 >= 1. A2 (input) DOUBLE PRECISION array, if TYPEG = 'D' or TYPEG = 'C', dimension (LDA2, P-K); if TYPEG = 'R', dimension (LDA2, K). On entry, if TYPEG = 'D' or TYPEG = 'C', the leading K-by-(P-K) part of this array must contain the matrix A2 as returned by MB02CU. On entry, if TYPEG = 'R', the leading (P-K)-by-K part of this array must contain the matrix A2 as returned by MB02CU. LDA2 INTEGER The leading dimension of the array A2. If P = K, LDA2 >= 1; If P > K and (TYPEG = 'D' or TYPEG = 'C'), LDA2 >= MAX(1,K); if P > K and TYPEG = 'R', LDA2 >= P-K. B (input) DOUBLE PRECISION array, if TYPEG = 'D' or TYPEG = 'C', dimension (LDB, Q); if TYPEG = 'R', dimension (LDB, K). On entry, if TYPEG = 'D' or TYPEG = 'C', the leading K-by-Q part of this array must contain the matrix B as returned by MB02CU. On entry, if TYPEG = 'R', the leading Q-by-K part of this array must contain the matrix B as returned by MB02CU. LDB INTEGER The leading dimension of the array B. If Q = 0, LDB >= 1; If Q > 0 and (TYPEG = 'D' or TYPEG = 'C'), LDB >= MAX(1,K); if Q > 0 and TYPEG = 'R', LDB >= Q. F1 (input/output) DOUBLE PRECISION array, if TYPEG = 'D' or TYPEG = 'C', dimension (LDF1, K); if TYPEG = 'R', dimension (LDF1, N). On entry, if TYPEG = 'D' or TYPEG = 'C', the leading N-by-K part of this array must contain the first part of the positive generator to be processed. On entry, if TYPEG = 'R', the leading K-by-N part of this array must contain the first part of the positive generator to be processed. On exit, if TYPEG = 'D' or TYPEG = 'C', the leading N-by-K part of this array contains the first part of the transformed positive generator. On exit, if TYPEG = 'R', the leading K-by-N part of this array contains the first part of the transformed positive generator. LDF1 INTEGER The leading dimension of the array F1. If TYPEG = 'D' or TYPEG = 'C', LDF1 >= MAX(1,N); if TYPEG = 'R', LDF1 >= MAX(1,K). F2 (input/output) DOUBLE PRECISION array, if TYPEG = 'D' or TYPEG = 'C', dimension (LDF2, P-K); if TYPEG = 'R', dimension (LDF2, N). On entry, if TYPEG = 'D' or TYPEG = 'C', the leading N-by-(P-K) part of this array must contain the second part of the positive generator to be processed. On entry, if TYPEG = 'R', the leading (P-K)-by-N part of this array must contain the second part of the positive generator to be processed. On exit, if TYPEG = 'D' or TYPEG = 'C', the leading N-by-(P-K) part of this array contains the second part of the transformed positive generator. On exit, if TYPEG = 'R', the leading (P-K)-by-N part of this array contains the second part of the transformed positive generator. LDF2 INTEGER The leading dimension of the array F2. If P = K, LDF2 >= 1; If P > K and (TYPEG = 'D' or TYPEG = 'C'), LDF2 >= MAX(1,N); if P > K and TYPEG = 'R', LDF2 >= P-K. G (input/output) DOUBLE PRECISION array, if TYPEG = 'D' or TYPEG = 'C', dimension (LDG, Q); if TYPEG = 'R', dimension (LDG, N). On entry, if TYPEG = 'D' or TYPEG = 'C', the leading N-by-Q part of this array must contain the negative part of the generator to be processed. On entry, if TYPEG = 'R', the leading Q-by-N part of this array must contain the negative part of the generator to be processed. On exit, if TYPEG = 'D' or TYPEG = 'C', the leading N-by-Q part of this array contains the transformed negative generator. On exit, if TYPEG = 'R', the leading Q-by-N part of this array contains the transformed negative generator. LDG INTEGER The leading dimension of the array G. If Q = 0, LDG >= 1; If Q > 0 and (TYPEG = 'D' or TYPEG = 'C'), LDG >= MAX(1,N); if Q > 0 and TYPEG = 'R', LDG >= Q. CS (input) DOUBLE PRECISION array, dimension (x) If TYPEG = 'D' and P = K, x = 3*K; If TYPEG = 'D' and P > K, x = 5*K; If (TYPEG = 'C' or TYPEG = 'R') and P = K, x = 4*K; If (TYPEG = 'C' or TYPEG = 'R') and P > K, x = 6*K. On entry, the first x elements of this array must contain Givens and modified hyperbolic rotation parameters, and scalar factors of the Householder transformations as returned by MB02CU.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = -23, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. TYPEG = 'D': LDWORK >= MAX(1,N); (TYPEG = 'C' or TYPEG = 'R') and NB <= 0: LDWORK >= MAX(1,N); (TYPEG = 'C' or TYPEG = 'R') and NB >= 1: LDWORK >= MAX(1,( N + K )*NB).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Numerical Aspects
The algorithm requires 0(N*K*( P + Q )) floating point operations.Method
The Householder transformations and modified hyperbolic rotations computed by SLICOT Library routine MB02CU are applied to the corresponding parts of the matrices F1, F2 and G.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To bring the first blocks of a generator in proper form. The columns / rows of the positive and negative generators are contained in the arrays A and B, respectively. Transformation information will be stored and can be applied via SLICOT Library routine MB02CY.Specification
SUBROUTINE MB02CX( TYPET, P, Q, K, A, LDA, B, LDB, CS, LCS, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TYPET INTEGER INFO, K, LDA, LDB, LCS, LDWORK, P, Q C .. Array Arguments .. DOUBLE PRECISION A(LDA, *), B(LDB, *), CS(*), DWORK(*)Arguments
Mode Parameters
TYPET CHARACTER*1 Specifies the type of the generator, as follows: = 'R': A and B are the first blocks of the rows of the positive and negative generators; = 'C': A and B are the first blocks of the columns of the positive and negative generators. Note: in the sequel, the notation x / y means that x corresponds to TYPET = 'R' and y corresponds to TYPET = 'C'.Input/Output Parameters
P (input) INTEGER The number of rows / columns in A containing the positive generators. P >= 0. Q (input) INTEGER The number of rows / columns in B containing the negative generators. Q >= 0. K (input) INTEGER The number of columns / rows in A and B to be processed. Normally, the size of the first block. P >= K >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA, K) / (LDA, P) On entry, the leading P-by-K upper / K-by-P lower triangular part of this array must contain the rows / columns of the positive part in the first block of the generator. On exit, the leading P-by-K upper / K-by-P lower triangular part of this array contains the rows / columns of the positive part in the first block of the proper generator. The lower / upper trapezoidal part is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,P), if TYPET = 'R'; LDA >= MAX(1,K), if TYPET = 'C'. B (input/output) DOUBLE PRECISION array, dimension (LDB, K) / (LDB, Q) On entry, the leading Q-by-K / K-by-Q part of this array must contain the rows / columns of the negative part in the first block of the generator. On exit, the leading Q-by-K / K-by-Q part of this array contains part of the necessary information for the Householder transformations. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,Q), if TYPET = 'R'; LDB >= MAX(1,K), if TYPET = 'C'. CS (output) DOUBLE PRECISION array, dimension (LCS) On exit, the leading 2*K + MIN(K,Q) part of this array contains necessary information for the SLICOT Library routine MB02CY (modified hyperbolic rotation parameters and scalar factors of the Householder transformations). LCS INTEGER The length of the array CS. LCS >= 2*K + MIN(K,Q).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -12, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,K). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction algorithm failed. The matrix associated with the generator is not (numerically) positive definite.Method
If TYPET = 'R', a QR decomposition of B is first computed. Then, the elements below the first row of each column i of B are annihilated by a Householder transformation modifying the first element in that column. This first element, in turn, is then annihilated by a modified hyperbolic rotation, acting also on the i-th row of A. If TYPET = 'C', an LQ decomposition of B is first computed. Then, the elements on the right of the first column of each row i of B are annihilated by a Householder transformation modifying the first element in that row. This first element, in turn, is then annihilated by a modified hyperbolic rotation, acting also on the i-th column of A.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To apply the transformations created by the SLICOT Library routine MB02CX on other columns / rows of the generator, contained in the arrays A and B of positive and negative generators, respectively.Specification
SUBROUTINE MB02CY( TYPET, STRUCG, P, Q, N, K, A, LDA, B, LDB, H, $ LDH, CS, LCS, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, K, LDA, LDB, LCS, LDH, LDWORK, N, P, Q CHARACTER STRUCG, TYPET C .. Array Arguments .. DOUBLE PRECISION A(LDA, *), B(LDB, *), CS(*), DWORK(*), H(LDH,*)Arguments
Mode Parameters
TYPET CHARACTER*1 Specifies the type of the generator, as follows: = 'R': A and B are additional columns of the generator; = 'C': A and B are additional rows of the generator. Note: in the sequel, the notation x / y means that x corresponds to TYPET = 'R' and y corresponds to TYPET = 'C'. STRUCG CHARACTER*1 Information about the structure of the two generators, as follows: = 'T': the trailing block of the positive generator is lower / upper triangular, and the trailing block of the negative generator is zero; = 'N': no special structure to mention.Input/Output Parameters
P (input) INTEGER The number of rows / columns in A containing the positive generators. P >= 0. Q (input) INTEGER The number of rows / columns in B containing the negative generators. Q >= 0. N (input) INTEGER The number of columns / rows in A and B to be processed. N >= 0. K (input) INTEGER The number of columns / rows in H. P >= K >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA, N) / (LDA, P) On entry, the leading P-by-N / N-by-P part of this array must contain the positive part of the generator. On exit, the leading P-by-N / N-by-P part of this array contains the transformed positive part of the generator. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,P), if TYPET = 'R'; LDA >= MAX(1,N), if TYPET = 'C'. B (input/output) DOUBLE PRECISION array, dimension (LDB, N) / (LDB, Q) On entry, the leading Q-by-N / N-by-Q part of this array must contain the negative part of the generator. On exit, the leading Q-by-N / N-by-Q part of this array contains the transformed negative part of the generator. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,Q), if TYPET = 'R'; LDB >= MAX(1,N), if TYPET = 'C'. H (input) DOUBLE PRECISION array, dimension (LDH, K) / (LDH, Q) The leading Q-by-K / K-by-Q part of this array must contain part of the necessary information for the Householder transformations computed by SLICOT Library routine MB02CX. LDH INTEGER The leading dimension of the array H. LDH >= MAX(1,Q), if TYPET = 'R'; LDH >= MAX(1,K), if TYPET = 'C'. CS (input) DOUBLE PRECISION array, dimension (LCS) The leading 2*K + MIN(K,Q) part of this array must contain the necessary information for modified hyperbolic rotations and the scalar factors of the Householder transformations computed by SLICOT Library routine MB02CX. LCS INTEGER The length of the array CS. LCS >= 2*K + MIN(K,Q).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -16, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The Householder transformations and modified hyperbolic rotations computed by SLICOT Library routine MB02CX are applied to the corresponding parts of the matrices A and B.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To update the Cholesky factor and the generator and/or the Cholesky factor of the inverse of a symmetric positive definite (s.p.d.) block Toeplitz matrix T, given the information from a previous factorization and additional blocks in TA of its first block row, or its first block column, depending on the routine parameter TYPET. Transformation information is stored.Specification
SUBROUTINE MB02DD( JOB, TYPET, K, M, N, TA, LDTA, T, LDT, G, $ LDG, R, LDR, L, LDL, CS, LCS, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER JOB, TYPET INTEGER INFO, K, LCS, LDG, LDL, LDR, LDT, LDTA, LDWORK, $ M, N C .. Array Arguments .. DOUBLE PRECISION CS(*), DWORK(*), G(LDG, *), L(LDL,*), R(LDR,*), $ T(LDT,*), TA(LDTA,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the output of the routine, as follows: = 'R': updates the generator G of the inverse and computes the new columns / rows for the Cholesky factor R of T; = 'A': updates the generator G, computes the new columns / rows for the Cholesky factor R of T and the new rows / columns for the Cholesky factor L of the inverse; = 'O': only computes the new columns / rows for the Cholesky factor R of T. TYPET CHARACTER*1 Specifies the type of T, as follows: = 'R': the first block row of an s.p.d. block Toeplitz matrix was/is defined; if demanded, the Cholesky factors R and L are upper and lower triangular, respectively, and G contains the transposed generator of the inverse; = 'C': the first block column of an s.p.d. block Toeplitz matrix was/is defined; if demanded, the Cholesky factors R and L are lower and upper triangular, respectively, and G contains the generator of the inverse. This choice results in a column oriented algorithm which is usually faster. Note: in this routine, the notation x / y means that x corresponds to TYPET = 'R' and y corresponds to TYPET = 'C'.Input/Output Parameters
K (input) INTEGER The number of rows / columns in T, which should be equal to the blocksize. K >= 0. M (input) INTEGER The number of blocks in TA. M >= 0. N (input) INTEGER The number of blocks in T. N >= 0. TA (input/output) DOUBLE PRECISION array, dimension (LDTA,M*K) / (LDTA,K) On entry, the leading K-by-M*K / M*K-by-K part of this array must contain the (N+1)-th to (N+M)-th blocks in the first block row / column of an s.p.d. block Toeplitz matrix. On exit, if INFO = 0, the leading K-by-M*K / M*K-by-K part of this array contains information on the Householder transformations used, such that the array [ T TA ] / [ T ] [ TA ] serves as the new transformation matrix T for further applications of this routine. LDTA INTEGER The leading dimension of the array TA. LDTA >= MAX(1,K), if TYPET = 'R'; LDTA >= MAX(1,M*K), if TYPET = 'C'. T (input) DOUBLE PRECISION array, dimension (LDT,N*K) / (LDT,K) The leading K-by-N*K / N*K-by-K part of this array must contain transformation information generated by the SLICOT Library routine MB02CD, i.e., in the first K-by-K block, the upper / lower Cholesky factor of T(1:K,1:K), and in the remaining part, the Householder transformations applied during the initial factorization process. LDT INTEGER The leading dimension of the array T. LDT >= MAX(1,K), if TYPET = 'R'; LDT >= MAX(1,N*K), if TYPET = 'C'. G (input/output) DOUBLE PRECISION array, dimension (LDG,( N + M )*K) / (LDG,2*K) On entry, if JOB = 'R', or 'A', then the leading 2*K-by-N*K / N*K-by-2*K part of this array must contain, in the first K-by-K block of the second block row / column, the lower right block of the Cholesky factor of the inverse of T, and in the remaining part, the generator of the inverse of T. On exit, if INFO = 0 and JOB = 'R', or 'A', then the leading 2*K-by-( N + M )*K / ( N + M )*K-by-2*K part of this array contains the same information as on entry, now for the updated Toeplitz matrix. Actually, to obtain a generator of the inverse one has to set G(K+1:2*K, 1:K) = 0, if TYPET = 'R'; G(1:K, K+1:2*K) = 0, if TYPET = 'C'. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,2*K), if TYPET = 'R' and JOB = 'R', or 'A'; LDG >= MAX(1,( N + M )*K), if TYPET = 'C' and JOB = 'R', or 'A'; LDG >= 1, if JOB = 'O'. R (input/output) DOUBLE PRECISION array, dimension (LDR,M*K) / (LDR,( N + M )*K) On input, the leading N*K-by-K part of R(K+1,1) / K-by-N*K part of R(1,K+1) contains the last block column / row of the previous Cholesky factor R. On exit, if INFO = 0, then the leading ( N + M )*K-by-M*K / M*K-by-( N + M )*K part of this array contains the last M*K columns / rows of the upper / lower Cholesky factor of T. The elements in the strictly lower / upper triangular part are not referenced. LDR INTEGER The leading dimension of the array R. LDR >= MAX(1, ( N + M )*K), if TYPET = 'R'; LDR >= MAX(1, M*K), if TYPET = 'C'. L (output) DOUBLE PRECISION array, dimension (LDL,( N + M )*K) / (LDL,M*K) If INFO = 0 and JOB = 'A', then the leading M*K-by-( N + M )*K / ( N + M )*K-by-M*K part of this array contains the last M*K rows / columns of the lower / upper Cholesky factor of the inverse of T. The elements in the strictly upper / lower triangular part are not referenced. LDL INTEGER The leading dimension of the array L. LDL >= MAX(1, M*K), if TYPET = 'R' and JOB = 'A'; LDL >= MAX(1, ( N + M )*K), if TYPET = 'C' and JOB = 'A'; LDL >= 1, if JOB = 'R', or 'O'. CS (input/output) DOUBLE PRECISION array, dimension (LCS) On input, the leading 3*(N-1)*K part of this array must contain the necessary information about the hyperbolic rotations and Householder transformations applied previously by SLICOT Library routine MB02CD. On exit, if INFO = 0, then the leading 3*(N+M-1)*K part of this array contains information about all the hyperbolic rotations and Householder transformations applied during the whole process. LCS INTEGER The length of the array CS. LCS >= 3*(N+M-1)*K.Workspace
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 >= MAX(1,(N+M-1)*K). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction algorithm failed. The block Toeplitz matrix associated with [ T TA ] / [ T' TA' ]' is not (numerically) positive definite.Method
Householder transformations and modified hyperbolic rotations are used in the Schur algorithm [1], [2].References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
The implemented method is numerically stable. 3 2 The algorithm requires 0(K ( N M + M ) ) floating point operations.Further Comments
For min(K,N,M) = 0, the routine sets DWORK(1) = 1 and returns. Although the calculations could still be performed when N = 0, but min(K,M) > 0, this case is not considered as an "update". SLICOT Library routine MB02CD should be called with the argument M instead of N.Example
Program Text
* MB02DD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, MMAX, NMAX PARAMETER ( KMAX = 20, MMAX = 20, NMAX = 20 ) INTEGER LCS, LDG, LDL, LDR, LDT, LDWORK PARAMETER ( LDG = KMAX*( MMAX + NMAX ), $ LDL = KMAX*( MMAX + NMAX ), $ LDR = KMAX*( MMAX + NMAX ), $ LDT = KMAX*( MMAX + NMAX ), $ LDWORK = ( MMAX + NMAX - 1 )*KMAX ) PARAMETER ( LCS = 3*LDWORK ) * .. Local Scalars .. INTEGER I, INFO, J, K, M, N, S CHARACTER JOB, TYPET * .. Local Arrays .. * The arrays are dimensioned for both TYPET = 'R' and TYPET = 'C'. * Arrays G and T could be smaller. * For array G, it is assumed that MMAX + NMAX >= 2. * The matrix TA is also stored in the array T. DOUBLE PRECISION CS(LCS), DWORK(LDWORK), $ G(LDG, KMAX*( MMAX + NMAX )), $ L(LDL, KMAX*( MMAX + NMAX )), $ R(LDR, KMAX*( MMAX + NMAX )), $ T(LDT, KMAX*( MMAX + NMAX )) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DLACPY, MB02CD, MB02DD * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, K, M, JOB, TYPET S = ( N + M )*K IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99989 ) N ELSE IF ( K.LE.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99988 ) K ELSE IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE IF ( LSAME( TYPET, 'R' ) ) THEN READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,S ), I = 1,K ) ELSE READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,K ), I = 1,S ) END IF * Compute the Cholesky factors. CALL MB02CD( JOB, TYPET, K, N, T, LDT, G, LDG, R, LDR, L, $ LDL, CS, LCS, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N*K WRITE ( NOUT, FMT = 99990 ) ( R(I,J), J = 1, N*K ) 10 CONTINUE IF ( LSAME( JOB, 'R' ) .OR. LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99995 ) IF ( LSAME( TYPET, 'R' ) ) THEN DO 20 I = 1, 2*K WRITE ( NOUT, FMT = 99990 ) $ ( G(I,J), J = 1, N*K ) 20 CONTINUE ELSE DO 30 I = 1, N*K WRITE ( NOUT, FMT = 99990 ) $ ( G(I,J), J = 1, 2*K ) 30 CONTINUE END IF END IF IF ( LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, N*K WRITE ( NOUT, FMT = 99990 ) $ ( L(I,J), J = 1, N*K ) 40 CONTINUE END IF * Update the Cholesky factors. IF ( LSAME( TYPET, 'R' ) ) THEN * Copy the last block column of R. CALL DLACPY( 'All', N*K, K, R(1,(N-1)*K+1), LDR, $ R(K+1,N*K+1), LDR ) CALL MB02DD( JOB, TYPET, K, M, N, T(1,N*K+1), LDT, $ T, LDT, G, LDG, R(1,N*K+1), LDR, $ L(N*K+1,1), LDL, CS, LCS, DWORK, $ LDWORK, INFO ) ELSE * Copy the last block row of R. CALL DLACPY( 'All', K, N*K, R((N-1)*K+1,1), LDR, $ R(N*K+1,K+1), LDR ) CALL MB02DD( JOB, TYPET, K, M, N, T(N*K+1,1), LDT, $ T, LDT, G, LDG, R(N*K+1,1), LDR, $ L(1,N*K+1), LDL, CS, LCS, DWORK, $ LDWORK, INFO ) END IF IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99993 ) DO 50 I = 1, S WRITE ( NOUT, FMT = 99990 ) ( R(I,J), J = 1, S ) 50 CONTINUE IF ( LSAME( JOB, 'R' ) .OR. LSAME( JOB, 'A' ) ) $ THEN WRITE ( NOUT, FMT = 99992 ) IF ( LSAME( TYPET, 'R' ) ) THEN DO 60 I = 1, 2*K WRITE ( NOUT, FMT = 99990 ) $ ( G(I,J), J = 1, S ) 60 CONTINUE ELSE DO 70 I = 1, S WRITE ( NOUT, FMT = 99990 ) $ ( G(I,J), J = 1, 2*K ) 70 CONTINUE END IF END IF IF ( LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99991 ) DO 80 I = 1, S WRITE ( NOUT, FMT = 99990 ) $ ( L(I,J), J = 1, S ) 80 CONTINUE END IF END IF END IF END IF END IF END IF STOP * 99999 FORMAT ( ' MB02DD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT ( ' INFO on exit from MB02CD = ',I2) 99997 FORMAT ( ' INFO on exit from MB02DD = ',I2) 99996 FORMAT ( ' The Cholesky factor is ') 99995 FORMAT (/' The inverse generator is ') 99994 FORMAT (/' The inverse Cholesky factor is ') 99993 FORMAT (/' The updated Cholesky factor is ') 99992 FORMAT (/' The updated inverse generator is ') 99991 FORMAT (/' The updated inverse Cholesky factor is ') 99990 FORMAT (20(1X,F8.4)) 99989 FORMAT (/' N is out of range.',/' N = ',I5) 99988 FORMAT (/' K is out of range.',/' K = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
MB02DD EXAMPLE PROGRAM DATA 3 2 2 A R 3.0000 1.0000 0.1000 0.1000 0.2000 0.0500 0.1000 0.0400 0.01 0.02 1.0000 4.0000 0.4000 0.1000 0.0400 0.2000 0.0300 0.0200 0.03 0.01Program Results
MB02DD EXAMPLE PROGRAM RESULTS The Cholesky factor is 1.7321 0.5774 0.0577 0.0577 0.1155 0.0289 0.0000 1.9149 0.1915 0.0348 -0.0139 0.0957 0.0000 0.0000 1.7205 0.5754 0.0558 0.0465 0.0000 0.0000 0.0000 1.9142 0.1890 0.0357 0.0000 0.0000 0.0000 0.0000 1.7169 0.5759 0.0000 0.0000 0.0000 0.0000 0.0000 1.9118 The inverse generator is -0.2355 0.5231 -0.0642 0.0077 0.0187 -0.0265 -0.5568 -0.0568 0.0229 0.0060 0.0363 0.0000 0.5825 0.0000 -0.0387 0.0052 0.0003 -0.0575 -0.1754 0.5231 0.0119 -0.0265 -0.0110 0.0076 The inverse Cholesky factor is 0.5774 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1741 0.5222 0.0000 0.0000 0.0000 0.0000 0.0000 -0.0581 0.5812 0.0000 0.0000 0.0000 -0.0142 0.0080 -0.1747 0.5224 0.0000 0.0000 -0.0387 0.0052 0.0003 -0.0575 0.5825 0.0000 0.0119 -0.0265 -0.0110 0.0076 -0.1754 0.5231 The updated Cholesky factor is 1.7321 0.5774 0.0577 0.0577 0.1155 0.0289 0.0577 0.0231 0.0058 0.0115 0.0000 1.9149 0.1915 0.0348 -0.0139 0.0957 -0.0017 0.0035 0.0139 0.0017 0.0000 0.0000 1.7205 0.5754 0.0558 0.0465 0.1145 0.0279 0.0564 0.0227 0.0000 0.0000 0.0000 1.9142 0.1890 0.0357 -0.0152 0.0953 -0.0017 0.0033 0.0000 0.0000 0.0000 0.0000 1.7169 0.5759 0.0523 0.0453 0.1146 0.0273 0.0000 0.0000 0.0000 0.0000 0.0000 1.9118 0.1902 0.0357 -0.0157 0.0955 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.7159 0.5757 0.0526 0.0450 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.9118 0.1901 0.0357 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.7159 0.5757 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.9117 The updated inverse generator is -0.5599 0.3310 -0.0305 0.0098 0.0392 -0.0209 0.0191 -0.0010 -0.0045 0.0035 -0.2289 -0.4091 0.0612 -0.0012 0.0125 0.0182 0.0042 0.0017 0.0014 0.0000 0.5828 0.0000 0.0027 -0.0029 -0.0195 0.0072 -0.0393 0.0057 0.0016 -0.0580 -0.1755 0.5231 -0.0037 0.0022 0.0005 -0.0022 0.0125 -0.0266 -0.0109 0.0077 The updated inverse Cholesky factor is 0.5774 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1741 0.5222 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.0581 0.5812 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.0142 0.0080 -0.1747 0.5224 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.0387 0.0052 0.0003 -0.0575 0.5825 0.0000 0.0000 0.0000 0.0000 0.0000 0.0119 -0.0265 -0.0110 0.0076 -0.1754 0.5231 0.0000 0.0000 0.0000 0.0000 -0.0199 0.0073 -0.0391 0.0056 0.0017 -0.0580 0.5828 0.0000 0.0000 0.0000 0.0007 -0.0023 0.0122 -0.0265 -0.0110 0.0077 -0.1755 0.5231 0.0000 0.0000 0.0027 -0.0029 -0.0195 0.0072 -0.0393 0.0057 0.0016 -0.0580 0.5828 0.0000 -0.0037 0.0022 0.0005 -0.0022 0.0125 -0.0266 -0.0109 0.0077 -0.1755 0.5231
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02ED.html 0000664 0000000 0000000 00000022423 14560147231 0020326 0 ustar 00root root 0000000 0000000
Purpose
To solve a system of linear equations T*X = B or X*T = B with a symmetric positive definite (s.p.d.) block Toeplitz matrix T. T is defined either by its first block row or its first block column, depending on the parameter TYPET.Specification
SUBROUTINE MB02ED( TYPET, K, N, NRHS, T, LDT, B, LDB, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TYPET INTEGER INFO, K, LDB, LDT, LDWORK, N, NRHS C .. Array Arguments .. DOUBLE PRECISION B(LDB,*), DWORK(*), T(LDT,*)Arguments
Mode Parameters
TYPET CHARACTER*1 Specifies the type of T, as follows: = 'R': T contains the first block row of an s.p.d. block Toeplitz matrix, and the system X*T = B is solved; = 'C': T contains the first block column of an s.p.d. block Toeplitz matrix, and the system T*X = B is solved. Note: in the sequel, the notation x / y means that x corresponds to TYPET = 'R' and y corresponds to TYPET = 'C'.Input/Output Parameters
K (input) INTEGER The number of rows / columns in T, which should be equal to the blocksize. K >= 0. N (input) INTEGER The number of blocks in T. N >= 0. NRHS (input) INTEGER The number of right hand sides. NRHS >= 0. T (input/output) DOUBLE PRECISION array, dimension (LDT,N*K) / (LDT,K) On entry, the leading K-by-N*K / N*K-by-K part of this array must contain the first block row / column of an s.p.d. block Toeplitz matrix. On exit, if INFO = 0 and NRHS > 0, then the leading K-by-N*K / N*K-by-K part of this array contains the last row / column of the Cholesky factor of inv(T). LDT INTEGER The leading dimension of the array T. LDT >= MAX(1,K), if TYPET = 'R'; LDT >= MAX(1,N*K), if TYPET = 'C'. B (input/output) DOUBLE PRECISION array, dimension (LDB,N*K) / (LDB,NRHS) On entry, the leading NRHS-by-N*K / N*K-by-NRHS part of this array must contain the right hand side matrix B. On exit, the leading NRHS-by-N*K / N*K-by-NRHS part of this array contains the solution matrix X. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,NRHS), if TYPET = 'R'; LDB >= MAX(1,N*K), if TYPET = 'C'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -10, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*K*K+(N+2)*K). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction algorithm failed. The Toeplitz matrix associated with T is not (numerically) positive definite.Method
Householder transformations, modified hyperbolic rotations and block Gaussian eliminations are used in the Schur algorithm [1], [2].References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
The implemented method is numerically equivalent with forming the Cholesky factor R and the inverse Cholesky factor of T, using the generalized Schur algorithm, and solving the systems of equations R*X = L*B or X*R = B*L by a blocked backward substitution algorithm. 3 2 2 2 The algorithm requires 0(K N + K N NRHS) floating point operations.Further Comments
NoneExample
Program Text
* MB02ED EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, NMAX PARAMETER ( KMAX = 20, NMAX = 20 ) INTEGER LDB, LDT, LDWORK PARAMETER ( LDB = KMAX*NMAX, LDT = KMAX*NMAX, $ LDWORK = NMAX*KMAX*KMAX + ( NMAX+2 )*KMAX ) * .. Local Scalars .. INTEGER I, INFO, J, K, M, N, NRHS CHARACTER TYPET * .. Local Arrays .. * The arrays B and T are dimensioned for both TYPET = 'R' and * TYPET = 'C'. * NRHS is assumed to be not larger than KMAX*NMAX. DOUBLE PRECISION B(LDB, KMAX*NMAX), DWORK(LDWORK), $ T(LDT, KMAX*NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB02ED * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, K, NRHS, TYPET M = N*K IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE IF ( K.LE.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99993 ) K ELSE IF ( NRHS.LE.0 .OR. NRHS.GT.KMAX*NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) NRHS ELSE IF ( LSAME( TYPET, 'R' ) ) THEN READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,M ), I = 1,K ) ELSE READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,K ), I = 1,M ) END IF IF ( LSAME( TYPET, 'R' ) ) THEN READ (NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, $ NRHS ) ELSE READ (NIN, FMT = * ) ( ( B(I,J), J = 1,NRHS ), I = 1, $ M ) END IF * Compute the solution of X T = B or T X = B. CALL MB02ED( TYPET, K, N, NRHS, T, LDT, B, LDB, DWORK, $ LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( TYPET, 'R' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, NRHS WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M ) 10 CONTINUE ELSE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, $ NRHS ) 20 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' MB02ED EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02ED = ',I2) 99997 FORMAT (' The solution of X*T = B is ') 99996 FORMAT (' The solution of T*X = B is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' K is out of range.',/' K = ',I5) 99992 FORMAT (/' NRHS is out of range.',/' NRHS = ',I5) ENDProgram Data
MB02ED EXAMPLE PROGRAM DATA 3 3 2 C 3.0000 1.0000 0.2000 1.0000 4.0000 0.4000 0.2000 0.4000 5.0000 0.1000 0.1000 0.2000 0.2000 0.0400 0.0300 0.0500 0.2000 0.1000 0.1000 0.0300 0.1000 0.0400 0.0200 0.2000 0.0100 0.0300 0.0200 1.0000 2.0000 1.0000 2.0000 1.0000 2.0000 1.0000 2.0000 1.0000 2.0000 1.0000 2.0000 1.0000 2.0000 1.0000 2.0000 1.0000 2.0000Program Results
MB02ED EXAMPLE PROGRAM RESULTS The solution of T*X = B is 0.2408 0.4816 0.1558 0.3116 0.1534 0.3068 0.2302 0.4603 0.1467 0.2934 0.1537 0.3075 0.2349 0.4698 0.1498 0.2995 0.1653 0.3307
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02FD.html 0000664 0000000 0000000 00000033212 14560147231 0020325 0 ustar 00root root 0000000 0000000
Purpose
To compute the incomplete Cholesky (ICC) factor of a symmetric positive definite (s.p.d.) block Toeplitz matrix T, defined by either its first block row, or its first block column, depending on the routine parameter TYPET. By subsequent calls of this routine, further rows / columns of the Cholesky factor can be added. Furthermore, the generator of the Schur complement of the leading (P+S)*K-by-(P+S)*K block in T is available, which can be used, e.g., for measuring the quality of the ICC factorization.Specification
SUBROUTINE MB02FD( TYPET, K, N, P, S, T, LDT, R, LDR, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TYPET INTEGER INFO, K, LDR, LDT, LDWORK, N, P, S C .. Array Arguments .. DOUBLE PRECISION DWORK(*), R(LDR,*), T(LDT,*)Arguments
Mode Parameters
TYPET CHARACTER*1 Specifies the type of T, as follows: = 'R': T contains the first block row of an s.p.d. block Toeplitz matrix; the ICC factor R is upper trapezoidal; = 'C': T contains the first block column of an s.p.d. block Toeplitz matrix; the ICC factor R is lower trapezoidal; this choice leads to better localized memory references and hence a faster algorithm. Note: in the sequel, the notation x / y means that x corresponds to TYPET = 'R' and y corresponds to TYPET = 'C'.Input/Output Parameters
K (input) INTEGER The number of rows / columns in T, which should be equal to the blocksize. K >= 0. N (input) INTEGER The number of blocks in T. N >= 0. P (input) INTEGER The number of previously computed block rows / columns of R. 0 <= P <= N. S (input) INTEGER The number of block rows / columns of R to compute. 0 <= S <= N-P. T (input/output) DOUBLE PRECISION array, dimension (LDT,(N-P)*K) / (LDT,K) On entry, if P = 0, then the leading K-by-N*K / N*K-by-K part of this array must contain the first block row / column of an s.p.d. block Toeplitz matrix. If P > 0, the leading K-by-(N-P)*K / (N-P)*K-by-K must contain the negative generator of the Schur complement of the leading P*K-by-P*K part in T, computed from previous calls of this routine. On exit, if INFO = 0, then the leading K-by-(N-P)*K / (N-P)*K-by-K part of this array contains, in the first K-by-K block, the upper / lower Cholesky factor of T(1:K,1:K), in the following S-1 K-by-K blocks, the Householder transformations applied during the process, and in the remaining part, the negative generator of the Schur complement of the leading (P+S)*K-by(P+S)*K part in T. LDT INTEGER The leading dimension of the array T. LDT >= MAX(1,K), if TYPET = 'R'; LDT >= MAX(1,(N-P)*K), if TYPET = 'C'. R (input/output) DOUBLE PRECISION array, dimension (LDR, N*K) / (LDR, S*K ) if P = 0; (LDR, (N-P+1)*K) / (LDR, (S+1)*K ) if P > 0. On entry, if P > 0, then the leading K-by-(N-P+1)*K / (N-P+1)*K-by-K part of this array must contain the nonzero blocks of the last block row / column in the ICC factor from a previous call of this routine. Note that this part is identical with the positive generator of the Schur complement of the leading P*K-by-P*K part in T. If P = 0, then R is only an output parameter. On exit, if INFO = 0 and P = 0, then the leading S*K-by-N*K / N*K-by-S*K part of this array contains the upper / lower trapezoidal ICC factor. On exit, if INFO = 0 and P > 0, then the leading (S+1)*K-by-(N-P+1)*K / (N-P+1)*K-by-(S+1)*K part of this array contains the upper / lower trapezoidal part of the P-th to (P+S)-th block rows / columns of the ICC factor. The elements in the strictly lower / upper trapezoidal part are not referenced. LDR INTEGER The leading dimension of the array R. LDR >= MAX(1, S*K ), if TYPET = 'R' and P = 0; LDR >= MAX(1, (S+1)*K ), if TYPET = 'R' and P > 0; LDR >= MAX(1, N*K ), if TYPET = 'C' and P = 0; LDR >= MAX(1, (N-P+1)*K ), if TYPET = 'C' and P > 0.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -11, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,(N+1)*K,4*K), if P = 0; LDWORK >= MAX(1,(N-P+2)*K,4*K), if P > 0. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction algorithm failed; the Toeplitz matrix associated with T is not (numerically) positive definite in its leading (P+S)*K-by-(P+S)*K part.Method
Householder transformations and modified hyperbolic rotations are used in the Schur algorithm [1], [2].References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
The implemented method is numerically stable. 3 The algorithm requires 0(K S (N-P)) floating point operations.Further Comments
NoneExample
Program Text
* MB02FD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER ITMAX, KMAX, NMAX PARAMETER ( ITMAX = 10, KMAX = 20, NMAX = 20 ) INTEGER LDR, LDT, LDWORK PARAMETER ( LDR = NMAX*KMAX, LDT = KMAX, $ LDWORK = ( NMAX + 1 )*KMAX ) * .. Local Scalars .. INTEGER I, INFO, IT, J, K, LEN, M, N, P, PIT, POS, POSR, $ S1, SCIT CHARACTER TYPET DOUBLE PRECISION NNRM * .. Local Arrays .. (Dimensioned for TYPET = 'R'.) INTEGER S(ITMAX) DOUBLE PRECISION DWORK(LDWORK), R(LDR, NMAX*KMAX), $ T(LDT, NMAX*KMAX), V(NMAX*KMAX), W(NMAX*KMAX), $ Z(NMAX*KMAX) * .. External Functions .. LOGICAL LSAME DOUBLE PRECISION DNRM2 EXTERNAL DNRM2, LSAME * .. External Subroutines .. EXTERNAL DAXPY, DCOPY, DGEMV, DLASET, DSCAL, DTRMV, MB02FD * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, K, IT TYPET = 'R' M = N*K IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE IF( K.LE.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99992 ) K ELSE IF( IT.LE.0 .OR. IT.GT.ITMAX ) THEN WRITE ( NOUT, FMT = 99991 ) IT ELSE READ ( NIN, FMT = * ) ( S(I), I = 1, IT ) READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,M ), I = 1,K ) P = 0 POS = 1 WRITE ( NOUT, FMT = 99997 ) DO 90 SCIT = 1, IT CALL MB02FD( TYPET, K, N, P, S(SCIT), T(1,POS), LDT, $ R(POS,POS), LDR, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO STOP END IF S1 = S(SCIT) + P IF ( S1.EQ.0 ) THEN * Estimate the 2-norm of the Toeplitz matrix with 5 power * iterations. LEN = N*K CALL DLASET( 'All', LEN, 1, ONE, ONE, V, 1 ) DO 30 PIT = 1, 5 DO 10 I = 1, N CALL DGEMV( 'NoTranspose', K, LEN-(I-1)*K, ONE, T, $ LDT, V((I-1)*K+1), 1, ZERO, $ W((I-1)*K+1), 1 ) 10 CONTINUE DO 20 I = 1, N-1 CALL DGEMV( 'Transpose', K, (N-I)*K, ONE, $ T(1,K+1), LDT, V((I-1)*K+1), 1, $ ONE, W(I*K+1), 1 ) 20 CONTINUE CALL DCOPY( LEN, W, 1, V, 1 ) NNRM = DNRM2( LEN, V, 1 ) CALL DSCAL( LEN, ONE/NNRM, V, 1 ) 30 CONTINUE ELSE * Estimate the 2-norm of the Schur complement with 5 power * iterations. LEN = ( N - S1 )*K CALL DLASET( 'All', LEN, 1, ONE, ONE, V, 1 ) DO 80 PIT = 1, 5 POSR = ( S1 - 1 )*K + 1 DO 40 I = 1, N - S1 CALL DGEMV( 'NoTranspose', K, LEN-(I-1)*K, ONE, $ T(1,POSR+K), LDT, V((I-1)*K+1), 1, $ ZERO, W((I-1)*K+1), 1 ) 40 CONTINUE DO 50 I = 1, N - S1 CALL DTRMV( 'Upper', 'NoTranspose', 'NonUnit', K, $ R(POSR,POSR), LDR, V((I-1)*K+1), 1 ) CALL DGEMV( 'NoTranspose', K, LEN-I*K, ONE, $ R(POSR,POSR+K), LDR, V(I*K+1), 1, ONE, $ V((I-1)*K+1), 1 ) 50 CONTINUE CALL DLASET( 'All', LEN, 1, ZERO, ZERO, Z, 1 ) DO 60 I = 1, N - S1 CALL DGEMV( 'Transpose', K, LEN-I*K, ONE, $ R(POSR,POSR+K), LDR, V((I-1)*K+1), 1, $ ONE, Z(I*K+1), 1 ) CALL DTRMV( 'Upper', 'Transpose', 'NonUnit', K, $ R(POSR,POSR), LDR, V((I-1)*K+1), 1 ) CALL DAXPY( K, ONE, V((I-1)*K+1), 1, Z((I-1)*K+1), $ 1 ) 60 CONTINUE CALL DLASET( 'All', LEN, 1, ZERO, ZERO, V, 1 ) DO 70 I = 1, N - S1 CALL DGEMV( 'Transpose', K, LEN-(I-1)*K, ONE, $ T(1,POSR+K), LDT, W((I-1)*K+1), 1, $ ONE, V((I-1)*K+1), 1 ) 70 CONTINUE CALL DAXPY( LEN, -ONE, Z, 1, V, 1 ) NNRM = DNRM2( LEN, V, 1 ) CALL DSCAL( LEN, -ONE/NNRM, V, 1 ) 80 CONTINUE POS = ( S1 - 1 )*K + 1 P = S1 END IF WRITE ( NOUT, FMT = 99995 ) P*K, NNRM 90 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 100 I = 1, P*K WRITE ( NOUT, FMT = 99994 ) ( R(I,J), J = 1, M ) 100 CONTINUE END IF STOP * 99999 FORMAT (' MB02FD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02FD = ',I2) 99997 FORMAT (' Incomplete Cholesky factorization ', $ //' rows norm(Schur complement)',/) 99996 FORMAT (/' The upper ICC factor of the block Toeplitz matrix is ' $ ) 99995 FORMAT (I4,5X,F8.4) 99994 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' K is out of range.',/' K = ',I5) 99991 FORMAT (/' IT is out of range.',/' IT = ',I5) ENDProgram Data
MB02FD EXAMPLE 4 2 3 0 1 1 3.0000 1.0000 0.1000 0.1000 0.2000 0.0500 0.2000 0.3000 1.0000 4.0000 0.4000 0.1000 0.0400 0.2000 0.1000 0.2000Program Results
MB02FD EXAMPLE PROGRAM RESULTS Incomplete Cholesky factorization rows norm(Schur complement) 0 5.5509 2 5.1590 4 4.8766 The upper ICC factor of the block Toeplitz matrix is 1.7321 0.5774 0.0577 0.0577 0.1155 0.0289 0.1155 0.1732 0.0000 1.9149 0.1915 0.0348 -0.0139 0.0957 0.0174 0.0522 0.0000 0.0000 1.7205 0.5754 0.0558 0.0465 0.1104 0.0174 0.0000 0.0000 0.0000 1.9142 0.1890 0.0357 -0.0161 0.0931
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02GD.html 0000664 0000000 0000000 00000026010 14560147231 0020324 0 ustar 00root root 0000000 0000000
Purpose
To compute the Cholesky factor of a banded symmetric positive definite (s.p.d.) block Toeplitz matrix, defined by either its first block row, or its first block column, depending on the routine parameter TYPET. By subsequent calls of this routine the Cholesky factor can be computed block column by block column.Specification
SUBROUTINE MB02GD( TYPET, TRIU, K, N, NL, P, S, T, LDT, RB, LDRB, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRIU, TYPET INTEGER INFO, K, LDRB, LDT, LDWORK, N, NL, P, S C .. Array Arguments .. DOUBLE PRECISION DWORK(LDWORK), RB(LDRB,*), T(LDT,*)Arguments
Mode Parameters
TYPET CHARACTER*1 Specifies the type of T, as follows: = 'R': T contains the first block row of an s.p.d. block Toeplitz matrix; the Cholesky factor is upper triangular; = 'C': T contains the first block column of an s.p.d. block Toeplitz matrix; the Cholesky factor is lower triangular. This choice results in a column oriented algorithm which is usually faster. Note: in the sequel, the notation x / y means that x corresponds to TYPET = 'R' and y corresponds to TYPET = 'C'. TRIU CHARACTER*1 Specifies the structure of the last block in T, as follows: = 'N': the last block has no special structure; = 'T': the last block is lower / upper triangular.Input/Output Parameters
K (input) INTEGER The number of rows / columns in T, which should be equal to the blocksize. K >= 0. N (input) INTEGER The number of blocks in T. N >= 1. If TRIU = 'N', N >= 1; if TRIU = 'T', N >= 2. NL (input) INTEGER The lower block bandwidth, i.e., NL + 1 is the number of nonzero blocks in the first block column of the block Toeplitz matrix. If TRIU = 'N', 0 <= NL < N; if TRIU = 'T', 1 <= NL < N. P (input) INTEGER The number of previously computed block rows / columns of the Cholesky factor. 0 <= P <= N. S (input) INTEGER The number of block rows / columns of the Cholesky factor to compute. 0 <= S <= N - P. T (input/output) DOUBLE PRECISION array, dimension (LDT,(NL+1)*K) / (LDT,K) On entry, if P = 0, the leading K-by-(NL+1)*K / (NL+1)*K-by-K part of this array must contain the first block row / column of an s.p.d. block Toeplitz matrix. On entry, if P > 0, the leading K-by-(NL+1)*K / (NL+1)*K-by-K part of this array must contain the P-th block row / column of the Cholesky factor. On exit, if INFO = 0, then the leading K-by-(NL+1)*K / (NL+1)*K-by-K part of this array contains the (P+S)-th block row / column of the Cholesky factor. LDT INTEGER The leading dimension of the array T. LDT >= MAX(1,K) / MAX(1,(NL+1)*K). RB (input/output) DOUBLE PRECISION array, dimension (LDRB,MIN(P+NL+S,N)*K) / (LDRB,MIN(P+S,N)*K) On entry, if TYPET = 'R' and TRIU = 'N' and P > 0, the leading (NL+1)*K-by-MIN(NL,N-P)*K part of this array must contain the (P*K+1)-st to ((P+NL)*K)-th columns of the upper Cholesky factor in banded format from a previous call of this routine. On entry, if TYPET = 'R' and TRIU = 'T' and P > 0, the leading (NL*K+1)-by-MIN(NL,N-P)*K part of this array must contain the (P*K+1)-st to (MIN(P+NL,N)*K)-th columns of the upper Cholesky factor in banded format from a previous call of this routine. On exit, if TYPET = 'R' and TRIU = 'N', the leading (NL+1)*K-by-MIN(NL+S,N-P)*K part of this array contains the (P*K+1)-st to (MIN(P+NL+S,N)*K)-th columns of the upper Cholesky factor in banded format. On exit, if TYPET = 'R' and TRIU = 'T', the leading (NL*K+1)-by-MIN(NL+S,N-P)*K part of this array contains the (P*K+1)-st to (MIN(P+NL+S,N)*K)-th columns of the upper Cholesky factor in banded format. On exit, if TYPET = 'C' and TRIU = 'N', the leading (NL+1)*K-by-MIN(S,N-P)*K part of this array contains the (P*K+1)-st to (MIN(P+S,N)*K)-th columns of the lower Cholesky factor in banded format. On exit, if TYPET = 'C' and TRIU = 'T', the leading (NL*K+1)-by-MIN(S,N-P)*K part of this array contains the (P*K+1)-st to (MIN(P+S,N)*K)-th columns of the lower Cholesky factor in banded format. For further details regarding the band storage scheme see the documentation of the LAPACK routine DPBTF2. LDRB INTEGER The leading dimension of the array RB. If TRIU = 'N', LDRB >= MAX( (NL+1)*K,1 ); if TRIU = 'T', LDRB >= NL*K+1.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -13, DWORK(1) returns the minimum value of LDWORK. The first 1 + ( NL + 1 )*K*K elements of DWORK should be preserved during successive calls of the routine. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1 + ( NL + 1 )*K*K + NL*K. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction algorithm failed. The Toeplitz matrix associated with T is not (numerically) positive definite.Method
Householder transformations and modified hyperbolic rotations are used in the Schur algorithm [1], [2].References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
The implemented method is numerically stable. 3 The algorithm requires O( K *N*NL ) floating point operations.Further Comments
NoneExample
Program Text
* MB02GD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, NMAX, NLMAX PARAMETER ( KMAX = 20, NMAX = 20, NLMAX = 20 ) INTEGER LDRB, LDT, LDWORK PARAMETER ( LDRB = ( NLMAX + 1 )*KMAX, LDT = KMAX*NMAX, $ LDWORK = ( NLMAX + 1 )*KMAX*KMAX + $ ( 3 + NLMAX )*KMAX ) * .. Local Scalars .. INTEGER I, J, INFO, K, M, N, NL, SIZR CHARACTER TRIU, TYPET * .. Local Arrays dimensioned for TYPET = 'R' .. DOUBLE PRECISION DWORK(LDWORK), RB(LDRB, NMAX*KMAX), $ T(LDT, NMAX*KMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB02GD * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) K, N, NL, TRIU TYPET = 'R' M = ( NL + 1 )*K IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE IF( NL.LE.0 .OR. NL.GT.NLMAX ) THEN WRITE ( NOUT, FMT = 99994 ) NL ELSE IF( K.LE.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99993 ) K ELSE READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,M ), I = 1,K ) * Compute the banded Cholesky factor. CALL MB02GD( TYPET, TRIU, K, N, NL, 0, N, T, LDT, RB, LDRB, $ DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) IF ( LSAME( TRIU, 'T' ) ) THEN SIZR = NL*K + 1 ELSE SIZR = ( NL + 1 )*K END IF DO 10 I = 1, SIZR WRITE ( NOUT, FMT = 99996 ) ( RB(I,J), J = 1, N*K ) 10 CONTINUE END IF END IF STOP * 99999 FORMAT (' MB02GD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02GD = ',I2) 99997 FORMAT (/' The upper Cholesky factor in banded storage format ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' NL is out of range.',/' NL = ',I5) 99993 FORMAT (/' K is out of range.',/' K = ',I5) ENDProgram Data
MB02GD EXAMPLE PROGRAM DATA 2 4 2 T 3.0000 1.0000 0.1000 0.4000 0.2000 0.0000 0.0000 4.0000 0.1000 0.1000 0.0500 0.2000Program Results
MB02GD EXAMPLE PROGRAM RESULTS The upper Cholesky factor in banded storage format 0.0000 0.0000 0.0000 0.0000 0.1155 0.1044 0.1156 0.1051 0.0000 0.0000 0.0000 0.2309 -0.0087 0.2290 -0.0084 0.2302 0.0000 0.0000 0.0577 -0.0174 0.0541 -0.0151 0.0544 -0.0159 0.0000 0.5774 0.0348 0.5704 0.0222 0.5725 0.0223 0.5724 1.7321 1.9149 1.7307 1.9029 1.7272 1.8996 1.7272 1.8995
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02HD.html 0000664 0000000 0000000 00000030206 14560147231 0020327 0 ustar 00root root 0000000 0000000
Purpose
To compute, for a banded K*M-by-L*N block Toeplitz matrix T with block size (K,L), specified by the nonzero blocks of its first block column TC and row TR, a LOWER triangular matrix R (in band storage scheme) such that T T T T = R R . (1) It is assumed that the first MIN(M*K, N*L) columns of T are linearly independent. By subsequent calls of this routine, the matrix R can be computed block column by block column.Specification
SUBROUTINE MB02HD( TRIU, K, L, M, ML, N, NU, P, S, TC, LDTC, TR, $ LDTR, RB, LDRB, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRIU INTEGER INFO, K, L, LDRB, LDTC, LDTR, LDWORK, M, ML, N, $ NU, P, S C .. Array Arguments .. DOUBLE PRECISION DWORK(LDWORK), RB(LDRB,*), TC(LDTC,*), $ TR(LDTR,*)Arguments
Mode Parameters
TRIU CHARACTER*1 Specifies the structure, if any, of the last blocks in TC and TR, as follows: = 'N': TC and TR have no special structure; = 'T': TC and TR are upper and lower triangular, respectively. Depending on the block sizes, two different shapes of the last blocks in TC and TR are possible, as illustrated below: 1) TC TR 2) TC TR x x x x 0 0 x x x x x 0 0 0 0 x x x x 0 0 x x x x x 0 0 0 0 x x x x 0 0 x x x x x 0 0 0 0 x x xInput/Output Parameters
K (input) INTEGER The number of rows in the blocks of T. K >= 0. L (input) INTEGER The number of columns in the blocks of T. L >= 0. M (input) INTEGER The number of blocks in the first block column of T. M >= 1. ML (input) INTEGER The lower block bandwidth, i.e., ML + 1 is the number of nonzero blocks in the first block column of T. 0 <= ML < M and (ML + 1)*K >= L and if ( M*K <= N*L ), ML >= M - INT( ( M*K - 1 )/L ) - 1; ML >= M - INT( M*K/L ) or MOD( M*K, L ) >= K; if ( M*K >= N*L ), ML*K >= N*( L - K ). N (input) INTEGER The number of blocks in the first block row of T. N >= 1. NU (input) INTEGER The upper block bandwidth, i.e., NU + 1 is the number of nonzero blocks in the first block row of T. If TRIU = 'N', 0 <= NU < N and (M + NU)*L >= MIN( M*K, N*L ); if TRIU = 'T', MAX(1-ML,0) <= NU < N and (M + NU)*L >= MIN( M*K, N*L ). P (input) INTEGER The number of previously computed block columns of R. P*L < MIN( M*K,N*L ) + L and P >= 0. S (input) INTEGER The number of block columns of R to compute. (P+S)*L < MIN( M*K,N*L ) + L and S >= 0. TC (input) DOUBLE PRECISION array, dimension (LDTC,L) On entry, if P = 0, the leading (ML+1)*K-by-L part of this array must contain the nonzero blocks in the first block column of T. LDTC INTEGER The leading dimension of the array TC. LDTC >= MAX(1,(ML+1)*K), if P = 0. TR (input) DOUBLE PRECISION array, dimension (LDTR,NU*L) On entry, if P = 0, the leading K-by-NU*L part of this array must contain the 2nd to the (NU+1)-st blocks of the first block row of T. LDTR INTEGER The leading dimension of the array TR. LDTR >= MAX(1,K), if P = 0. RB (output) DOUBLE PRECISION array, dimension (LDRB,MIN( S*L,MIN( M*K,N*L )-P*L )) On exit, if INFO = 0 and TRIU = 'N', the leading MIN( ML+NU+1,N )*L-by-MIN( S*L,MIN( M*K,N*L )-P*L ) part of this array contains the (P+1)-th to (P+S)-th block column of the lower R factor (1) in band storage format. On exit, if INFO = 0 and TRIU = 'T', the leading MIN( (ML+NU)*L+1,N*L )-by-MIN( S*L,MIN( M*K,N*L )-P*L ) part of this array contains the (P+1)-th to (P+S)-th block column of the lower R factor (1) in band storage format. For further details regarding the band storage scheme see the documentation of the LAPACK routine DPBTF2. LDRB INTEGER The leading dimension of the array RB. LDRB >= MAX( MIN( ML+NU+1,N )*L,1 ), if TRIU = 'N'; LDRB >= MAX( MIN( (ML+NU)*L+1,N*L ),1 ), if TRIU = 'T'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -17, DWORK(1) returns the minimum value of LDWORK. The first 1 + 2*MIN( ML+NU+1,N )*L*(K+L) elements of DWORK should be preserved during successive calls of the routine. LDWORK INTEGER The length of the array DWORK. Let x = MIN( ML+NU+1,N ), then LDWORK >= 1 + MAX( x*L*L + (2*NU+1)*L*K, 2*x*L*(K+L) + (6+x)*L ), if P = 0; LDWORK >= 1 + 2*x*L*(K+L) + (6+x)*L, if P > 0. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the full rank condition for the first MIN(M*K, N*L) columns of T is (numerically) violated.Method
Householder transformations and modified hyperbolic rotations are used in the Schur algorithm [1], [2].References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
The implemented method yields a factor R which has comparable accuracy with the Cholesky factor of T^T * T. The algorithm requires 2 2 O( L *K*N*( ML + NU ) + N*( ML + NU )*L *( L + K ) ) floating point operations.Further Comments
NoneExample
Program Text
* MB02HD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, LMAX, MMAX, MLMAX, NMAX, NUMAX PARAMETER ( KMAX = 20, LMAX = 20, MMAX = 20, MLMAX = 10, $ NMAX = 20, NUMAX = 10 ) INTEGER LDRB, LDTC, LDTR, LDWORK PARAMETER ( LDRB = ( MLMAX + NUMAX + 1 )*LMAX, $ LDTC = ( MLMAX + 1 )*KMAX, LDTR = KMAX ) PARAMETER ( LDWORK = LDRB*LMAX + ( 2*NUMAX + 1 )*LMAX*KMAX $ + 2*LDRB*( KMAX + LMAX ) + LDRB $ + 6*LMAX ) * .. Local Scalars .. INTEGER I, INFO, J, K, L, LENR, M, ML, N, NU, S CHARACTER TRIU * .. Local Arrays .. DOUBLE PRECISION DWORK(LDWORK), RB(LDRB,NMAX*LMAX), $ TC(LDTC,LMAX), TR(LDTR,NMAX*LMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB02HD * .. Intrinsic Functions .. INTRINSIC MIN * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) K, L, M, ML, N, NU, TRIU IF( K.LT.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99990 ) K ELSE IF( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99991 ) L ELSE IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE IF( ML.LT.0 .OR. ML.GT.MLMAX ) THEN WRITE ( NOUT, FMT = 99993 ) ML ELSE IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE IF( NU.LT.0 .OR. NU.GT.NUMAX ) THEN WRITE ( NOUT, FMT = 99995 ) NU ELSE READ ( NIN, FMT = * ) ( ( TC(I,J), J = 1,L ), I = 1,(ML+1)*K ) READ ( NIN, FMT = * ) ( ( TR(I,J), J = 1,NU*L ), I = 1,K ) S = ( MIN( M*K, N*L ) + L - 1 ) / L * Compute the banded R factor. CALL MB02HD( TRIU, K, L, M, ML, N, NU, 0, S, TC, LDTC, TR, $ LDTR, RB, LDRB, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) LENR = ( ML + NU + 1 )*L IF ( LSAME( TRIU, 'T' ) ) LENR = ( ML + NU )*L + 1 LENR = MIN( LENR, N*L ) DO 10 I = 1, LENR WRITE ( NOUT, FMT = 99996 ) ( RB(I,J), J = 1, $ MIN( N*L, M*K ) ) 10 CONTINUE END IF END IF STOP * 99999 FORMAT (' MB02HD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02HD = ',I2) 99997 FORMAT (/' The lower triangular factor R in banded storage ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' NU is out of range.',/' NU = ',I5) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' ML is out of range.',/' ML = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' L is out of range.',/' L = ',I5) 99990 FORMAT (/' K is out of range.',/' K = ',I5) ENDProgram Data
MB02HD EXAMPLE PROGRAM DATA 2 2 6 2 5 1 N 4.0 4.0 1.0 3.0 2.0 1.0 2.0 2.0 4.0 4.0 3.0 4.0 1.0 3.0 2.0 1.0Program Results
MB02HD EXAMPLE PROGRAM RESULTS The lower triangular factor R in banded storage -7.0711 -2.4125 6.0822 2.9967 5.9732 2.8593 5.8497 2.7914 2.7298 1.9557 -7.4953 -0.0829 5.8986 -0.5571 5.5329 0.2059 5.6797 0.3414 0.9565 0.0000 -4.2426 0.9202 2.4747 -1.6425 2.9472 -1.0052 2.4396 -0.7785 0.0000 0.0000 -5.2326 0.6218 2.8391 -0.0820 3.2670 0.6327 2.7067 0.0000 0.0000 0.0000 -3.5355 0.8207 3.1160 -0.4451 3.5758 0.5701 0.0000 0.0000 0.0000 0.0000 -4.6669 -0.5803 3.9454 0.7682 4.5481 0.0000 0.0000 0.0000 0.0000 0.0000 -1.4142 -0.0415 1.6441 0.4848 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -2.1213 0.0000 2.4662 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02ID.html 0000664 0000000 0000000 00000027607 14560147231 0020343 0 ustar 00root root 0000000 0000000
Purpose
To solve the overdetermined or underdetermined real linear systems involving an M*K-by-N*L block Toeplitz matrix T that is specified by its first block column and row. It is assumed that T has full rank. The following options are provided: 1. If JOB = 'O' or JOB = 'A' : find the least squares solution of an overdetermined system, i.e., solve the least squares problem minimize || B - T*X ||. (1) 2. If JOB = 'U' or JOB = 'A' : find the minimum norm solution of the undetermined system T T * X = C. (2)Specification
SUBROUTINE MB02ID( JOB, K, L, M, N, RB, RC, TC, LDTC, TR, LDTR, B, $ LDB, C, LDC, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER INFO, K, L, LDB, LDC, LDTC, LDTR, LDWORK, M, N, $ RB, RC C .. Array Arguments .. DOUBLE PRECISION B(LDB,*), C(LDC,*), DWORK(LDWORK), TC(LDTC,*), $ TR(LDTR,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the problem to be solved as follows = 'O': solve the overdetermined system (1); = 'U': solve the underdetermined system (2); = 'A': solve (1) and (2).Input/Output Parameters
K (input) INTEGER The number of rows in the blocks of T. K >= 0. L (input) INTEGER The number of columns in the blocks of T. L >= 0. M (input) INTEGER The number of blocks in the first block column of T. M >= 0. N (input) INTEGER The number of blocks in the first block row of T. 0 <= N <= M*K / L. RB (input) INTEGER If JOB = 'O' or 'A', the number of columns in B. RB >= 0. RC (input) INTEGER If JOB = 'U' or 'A', the number of columns in C. RC >= 0. TC (input) DOUBLE PRECISION array, dimension (LDTC,L) On entry, the leading M*K-by-L part of this array must contain the first block column of T. LDTC INTEGER The leading dimension of the array TC. LDTC >= MAX(1,M*K) TR (input) DOUBLE PRECISION array, dimension (LDTR,(N-1)*L) On entry, the leading K-by-(N-1)*L part of this array must contain the 2nd to the N-th blocks of the first block row of T. LDTR INTEGER The leading dimension of the array TR. LDTR >= MAX(1,K). B (input/output) DOUBLE PRECISION array, dimension (LDB,RB) On entry, if JOB = 'O' or JOB = 'A', the leading M*K-by-RB part of this array must contain the right hand side matrix B of the overdetermined system (1). On exit, if JOB = 'O' or JOB = 'A', the leading N*L-by-RB part of this array contains the solution of the overdetermined system (1). This array is not referenced if JOB = 'U'. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,M*K), if JOB = 'O' or JOB = 'A'; LDB >= 1, if JOB = 'U'. C (input) DOUBLE PRECISION array, dimension (LDC,RC) On entry, if JOB = 'U' or JOB = 'A', the leading N*L-by-RC part of this array must contain the right hand side matrix C of the underdetermined system (2). On exit, if JOB = 'U' or JOB = 'A', the leading M*K-by-RC part of this array contains the solution of the underdetermined system (2). This array is not referenced if JOB = 'O'. LDC INTEGER The leading dimension of the array C. LDB >= 1, if JOB = 'O'; LDB >= MAX(1,M*K), if JOB = 'U' or JOB = 'A'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -17, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. Let x = MAX( 2*N*L*(L+K) + (6+N)*L,(N*L+M*K+1)*L + M*K ) and y = N*M*K*L + N*L, then if MIN( M,N ) = 1 and JOB = 'O', LDWORK >= MAX( y + MAX( M*K,RB ),1 ); if MIN( M,N ) = 1 and JOB = 'U', LDWORK >= MAX( y + MAX( M*K,RC ),1 ); if MIN( M,N ) = 1 and JOB = 'A', LDWORK >= MAX( y +MAX( M*K,MAX( RB,RC ),1 ); if MIN( M,N ) > 1 and JOB = 'O', LDWORK >= MAX( x,N*L*RB + 1 ); if MIN( M,N ) > 1 and JOB = 'U', LDWORK >= MAX( x,N*L*RC + 1 ); if MIN( M,N ) > 1 and JOB = 'A', LDWORK >= MAX( x,N*L*MAX( RB,RC ) + 1 ). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction algorithm failed. The Toeplitz matrix associated with T is (numerically) not of full rank.Method
Householder transformations and modified hyperbolic rotations are used in the Schur algorithm [1], [2].References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
The algorithm requires O( L*L*K*(N+M)*log(N+M) + N*N*L*L*(L+K) ) and additionally if JOB = 'O' or JOB = 'A', O( (K*L+RB*L+K*RB)*(N+M)*log(N+M) + N*N*L*L*RB ); if JOB = 'U' or JOB = 'A', O( (K*L+RC*L+K*RC)*(N+M)*log(N+M) + N*N*L*L*RC ); floating point operations.Further Comments
NoneExample
Program Text
* MB02ID EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, LMAX, MMAX, NMAX, RBMAX, RCMAX PARAMETER ( KMAX = 20, LMAX = 20, MMAX = 20, NMAX = 20, $ RBMAX = 20, RCMAX = 20 ) INTEGER LDB, LDC, LDTC, LDTR, LDWORK PARAMETER ( LDB = KMAX*MMAX, LDC = KMAX*MMAX, $ LDTC = MMAX*KMAX, LDTR = KMAX, $ LDWORK = 2*NMAX*LMAX*( LMAX + KMAX ) + $ ( 6 + NMAX )*LMAX + $ MMAX*KMAX*( LMAX + 1 ) + $ RBMAX + RCMAX ) * .. Local Scalars .. INTEGER I, INFO, J, K, L, M, N, RB, RC CHARACTER JOB DOUBLE PRECISION B(LDB,RBMAX), C(LDC,RCMAX), DWORK(LDWORK), $ TC(LDTC,LMAX), TR(LDTR,NMAX*LMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB02ID * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) K, L, M, N, RB, RC, JOB IF( K.LE.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99994 ) K ELSE IF( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99993 ) L ELSE IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE IF ( ( LSAME( JOB, 'O' ) .OR. LSAME( JOB, 'A' ) ) $ .AND. ( ( RB.LE.0 ) .OR. ( RB.GT.RBMAX ) ) ) THEN WRITE ( NOUT, FMT = 99990 ) RB ELSE IF ( ( LSAME( JOB, 'U' ) .OR. LSAME( JOB, 'A' ) ) $ .AND. ( ( RC.LE.0 ) .OR. ( RC.GT.RCMAX ) ) ) THEN WRITE ( NOUT, FMT = 99989 ) RC ELSE READ ( NIN, FMT = * ) ( ( TC(I,J), J = 1,L ), I = 1,M*K ) READ ( NIN, FMT = * ) ( ( TR(I,J), J = 1,(N-1)*L ), I = 1,K ) IF ( LSAME( JOB, 'O' ) .OR. LSAME( JOB, 'A' ) ) THEN READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,RB ), I = 1,M*K ) END IF IF ( LSAME( JOB, 'U' ) .OR. LSAME( JOB, 'A' ) ) THEN READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,RC ), I = 1,N*L ) END IF CALL MB02ID( JOB, K, L, M, N, RB, RC, TC, LDTC, TR, LDTR, B, $ LDB, C, LDC, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( JOB, 'O' ) .OR. LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N*L WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, RB ) 10 CONTINUE END IF IF ( LSAME( JOB, 'U' ) .OR. LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, M*K WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1, RC ) 20 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' MB02ID EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02ID = ',I2) 99997 FORMAT (' The least squares solution of T * X = B is ') 99996 FORMAT (' The minimum norm solution of T^T * X = C is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' K is out of range.',/' K = ',I5) 99993 FORMAT (/' L is out of range.',/' L = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' N is out of range.',/' N = ',I5) 99990 FORMAT (/' RB is out of range.',/' RB = ',I5) 99989 FORMAT (/' RC is out of range.',/' RC = ',I5) ENDProgram Data
MB02ID EXAMPLE PROGRAM DATA 3 2 4 3 1 1 A 5.0 2.0 1.0 2.0 4.0 3.0 4.0 0.0 2.0 2.0 3.0 3.0 5.0 1.0 3.0 3.0 1.0 1.0 2.0 3.0 1.0 3.0 2.0 2.0 1.0 4.0 2.0 3.0 2.0 2.0 2.0 4.0 3.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0Program Results
MB02ID EXAMPLE PROGRAM RESULTS The least squares solution of T * X = B is 0.0379 0.1677 0.0485 -0.0038 0.0429 0.1365 The minimum norm solution of T^T * X = C is 0.0509 0.0547 0.0218 0.0008 0.0436 0.0404 0.0031 0.0451 0.0421 0.0243 0.0556 0.0472
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02JD.html 0000664 0000000 0000000 00000030075 14560147231 0020335 0 ustar 00root root 0000000 0000000
Purpose
To compute a lower triangular matrix R and a matrix Q with Q^T Q = I such that T T = Q R , where T is a K*M-by-L*N block Toeplitz matrix with blocks of size (K,L). The first column of T will be denoted by TC and the first row by TR. It is assumed that the first MIN(M*K, N*L) columns of T have full rank. By subsequent calls of this routine the factors Q and R can be computed block column by block column.Specification
SUBROUTINE MB02JD( JOB, K, L, M, N, P, S, TC, LDTC, TR, LDTR, Q, $ LDQ, R, LDR, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER INFO, K, L, LDQ, LDR, LDTC, LDTR, LDWORK, $ M, N, P, S C .. Array Arguments .. DOUBLE PRECISION DWORK(LDWORK), Q(LDQ,*), R(LDR,*), TC(LDTC,*), $ TR(LDTR,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the output of the routine as follows: = 'Q': computes Q and R; = 'R': only computes R.Input/Output Parameters
K (input) INTEGER The number of rows in one block of T. K >= 0. L (input) INTEGER The number of columns in one block of T. L >= 0. M (input) INTEGER The number of blocks in one block column of T. M >= 0. N (input) INTEGER The number of blocks in one block row of T. N >= 0. P (input) INTEGER The number of previously computed block columns of R. P*L < MIN( M*K,N*L ) + L and P >= 0. S (input) INTEGER The number of block columns of R to compute. (P+S)*L < MIN( M*K,N*L ) + L and S >= 0. TC (input) DOUBLE PRECISION array, dimension (LDTC, L) On entry, if P = 0, the leading M*K-by-L part of this array must contain the first block column of T. LDTC INTEGER The leading dimension of the array TC. LDTC >= MAX(1,M*K). TR (input) DOUBLE PRECISION array, dimension (LDTR,(N-1)*L) On entry, if P = 0, the leading K-by-(N-1)*L part of this array must contain the first block row of T without the leading K-by-L block. LDTR INTEGER The leading dimension of the array TR. LDTR >= MAX(1,K). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,MIN( S*L, MIN( M*K,N*L )-P*L )) On entry, if JOB = 'Q' and P > 0, the leading M*K-by-L part of this array must contain the last block column of Q from a previous call of this routine. On exit, if JOB = 'Q' and INFO = 0, the leading M*K-by-MIN( S*L, MIN( M*K,N*L )-P*L ) part of this array contains the P-th to (P+S)-th block columns of the factor Q. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,M*K), if JOB = 'Q'; LDQ >= 1, if JOB = 'R'. R (input/output) DOUBLE PRECISION array, dimension (LDR,MIN( S*L, MIN( M*K,N*L )-P*L )) On entry, if P > 0, the leading (N-P+1)*L-by-L part of this array must contain the nozero part of the last block column of R from a previous call of this routine. One exit, if INFO = 0, the leading MIN( N, N-P+1 )*L-by-MIN( S*L, MIN( M*K,N*L )-P*L ) part of this array contains the nonzero parts of the P-th to (P+S)-th block columns of the lower triangular factor R. Note that elements in the strictly upper triangular part will not be referenced. LDR INTEGER The leading dimension of the array R. LDR >= MAX( 1, MIN( N, N-P+1 )*L )Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -17, DWORK(1) returns the minimum value of LDWORK. If JOB = 'Q', the first 1 + ( (N-1)*L + M*K )*( 2*K + L ) elements of DWORK should be preserved during successive calls of the routine. If JOB = 'R', the first 1 + (N-1)*L*( 2*K + L ) elements of DWORK should be preserved during successive calls of the routine. LDWORK INTEGER The length of the array DWORK. JOB = 'Q': LDWORK >= 1 + ( M*K + ( N - 1 )*L )*( L + 2*K ) + 6*L + MAX( M*K,( N - MAX( 1,P )*L ) ); JOB = 'R': If P = 0, LDWORK >= MAX( 1 + ( N - 1 )*L*( L + 2*K ) + 6*L + (N-1)*L, M*K*( L + 1 ) + L ); If P > 0, LDWORK >= 1 + (N-1)*L*( L + 2*K ) + 6*L + (N-P)*L. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the full rank condition for the first MIN(M*K, N*L) columns of T is (numerically) violated.Method
Block Householder transformations and modified hyperbolic rotations are used in the Schur algorithm [1], [2].References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
The implemented method yields a factor R which has comparable accuracy with the Cholesky factor of T^T * T. Q is implicitly computed from the formula Q = T * inv(R^T R) * R, i.e., for ill conditioned problems this factor is of very limited value. 2 The algorithm requires 0(K*L *M*N) floating point operations.Further Comments
NoneExample
Program Text
* MB02JD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, LMAX, MMAX, NMAX PARAMETER ( KMAX = 10, LMAX = 10, MMAX = 20, NMAX = 20 ) INTEGER LDR, LDQ, LDTC, LDTR, LDWORK PARAMETER ( LDR = NMAX*LMAX, LDQ = MMAX*KMAX, $ LDTC = MMAX*KMAX, LDTR = KMAX, $ LDWORK = ( MMAX*KMAX + NMAX*LMAX ) $ *( LMAX + 2*KMAX ) + 6*LMAX $ + MMAX*KMAX + NMAX*LMAX ) * .. Local Scalars .. INTEGER I, INFO, J, K, L, M, N, S CHARACTER JOB * .. Local Arrays .. DOUBLE PRECISION DWORK(LDWORK), Q(LDQ,NMAX*LMAX), $ R(LDR,NMAX*LMAX), TC(LDTC,LMAX), $ TR(LDTR,NMAX*LMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB02JD * .. Intrinsic Functions .. INTRINSIC MIN * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) K, L, M, N, JOB IF( K.LE.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99994 ) K ELSE IF( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99993 ) L ELSE IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE READ ( NIN, FMT = * ) ( ( TC(I,J), J = 1,L ), I = 1,M*K ) READ ( NIN, FMT = * ) ( ( TR(I,J), J = 1,( N - 1 )*L ), $ I = 1,K ) S = ( MIN( M*K, N*L ) + L - 1 ) / L * Compute the required part of the QR factorization. CALL MB02JD( JOB, K, L, M, N, 0, S, TC, LDTC, TR, LDTR, Q, LDQ, $ R, LDR, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( JOB, 'Q' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, M*K WRITE ( NOUT, FMT = 99995 ) $ ( Q(I,J), J = 1, MIN( N*L, M*K ) ) 10 CONTINUE END IF WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N*L WRITE ( NOUT, FMT = 99995 ) $ ( R(I,J), J = 1, MIN( N*L, M*K ) ) 20 CONTINUE END IF END IF * STOP * 99999 FORMAT (' MB02JD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02JD = ',I2) 99997 FORMAT (/' The factor Q is ') 99996 FORMAT (/' The factor R is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' K is out of range.',/' K = ',I5) 99993 FORMAT (/' L is out of range.',/' L = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB02JD EXAMPLE PROGRAM DATA 2 3 4 3 Q 1.0 4.0 0.0 4.0 1.0 2.0 4.0 2.0 2.0 5.0 3.0 2.0 2.0 4.0 4.0 5.0 3.0 4.0 2.0 2.0 5.0 4.0 2.0 3.0 3.0 4.0 2.0 5.0 0.0 4.0 5.0 1.0 1.0 2.0 4.0 1.0Program Results
MB02JD EXAMPLE PROGRAM RESULTS The factor Q is -0.0967 0.7166 -0.4651 0.1272 0.4357 0.0435 0.2201 0.0673 -0.3867 -0.3108 -0.0534 0.5251 0.0963 -0.3894 0.1466 0.5412 -0.3867 -0.0990 -0.1443 -0.7021 0.3056 -0.3367 -0.3233 0.1249 -0.4834 -0.0178 -0.3368 -0.1763 -0.5446 0.5100 0.1503 0.2054 -0.1933 0.5859 0.3214 0.1156 -0.4670 -0.3199 -0.4185 0.0842 -0.4834 -0.0178 0.1072 0.0357 -0.0575 -0.2859 0.4339 -0.6928 -0.1933 0.1623 0.7251 -0.1966 0.2736 0.3058 0.3398 0.2968 -0.3867 -0.0990 0.0777 0.3615 0.3386 0.4421 -0.5693 -0.2641 The factor R is -10.3441 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -6.3805 4.7212 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -7.3472 1.9320 4.5040 0.0000 0.0000 0.0000 0.0000 0.0000 -10.0541 2.5101 0.5065 3.6550 0.0000 0.0000 0.0000 0.0000 -6.5738 3.6127 1.2702 -1.3146 3.5202 0.0000 0.0000 0.0000 -5.2204 2.4764 2.4113 1.3890 1.2780 2.4976 0.0000 0.0000 -9.6674 3.2445 -0.5099 -0.0224 2.6548 2.9491 1.0049 0.0000 -6.3805 0.6968 1.9483 0.3050 0.7002 -2.0220 -2.8246 2.3147 -4.1570 2.4309 -0.7190 -0.1455 3.0149 0.5454 0.9394 -0.0548
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02JX.html 0000664 0000000 0000000 00000032270 14560147231 0020360 0 ustar 00root root 0000000 0000000
Purpose
To compute a low rank QR factorization with column pivoting of a K*M-by-L*N block Toeplitz matrix T with blocks of size (K,L); specifically, T T P = Q R , where R is lower trapezoidal, P is a block permutation matrix and Q^T Q = I. The number of columns in R is equivalent to the numerical rank of T with respect to the given tolerance TOL1. Note that the pivoting scheme is local, i.e., only columns belonging to the same block in T are permuted.Specification
SUBROUTINE MB02JX( JOB, K, L, M, N, TC, LDTC, TR, LDTR, RNK, Q, $ LDQ, R, LDR, JPVT, TOL1, TOL2, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER INFO, K, L, LDQ, LDR, LDTC, LDTR, LDWORK, M, N, $ RNK DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. DOUBLE PRECISION DWORK(LDWORK), Q(LDQ,*), R(LDR,*), TC(LDTC,*), $ TR(LDTR,*) INTEGER JPVT(*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the output of the routine as follows: = 'Q': computes Q and R; = 'R': only computes R.Input/Output Parameters
K (input) INTEGER The number of rows in one block of T. K >= 0. L (input) INTEGER The number of columns in one block of T. L >= 0. M (input) INTEGER The number of blocks in one block column of T. M >= 0. N (input) INTEGER The number of blocks in one block row of T. N >= 0. TC (input) DOUBLE PRECISION array, dimension (LDTC, L) The leading M*K-by-L part of this array must contain the first block column of T. LDTC INTEGER The leading dimension of the array TC. LDTC >= MAX(1,M*K). TR (input) DOUBLE PRECISION array, dimension (LDTR,(N-1)*L) The leading K-by-(N-1)*L part of this array must contain the first block row of T without the leading K-by-L block. LDTR INTEGER The leading dimension of the array TR. LDTR >= MAX(1,K). RNK (output) INTEGER The number of columns in R, which is equivalent to the numerical rank of T. Q (output) DOUBLE PRECISION array, dimension (LDQ,RNK) If JOB = 'Q', then the leading M*K-by-RNK part of this array contains the factor Q. If JOB = 'R', then this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,M*K), if JOB = 'Q'; LDQ >= 1, if JOB = 'R'. R (output) DOUBLE PRECISION array, dimension (LDR,RNK) The leading N*L-by-RNK part of this array contains the lower trapezoidal factor R. LDR INTEGER The leading dimension of the array R. LDR >= MAX(1,N*L) JPVT (output) INTEGER array, dimension (MIN(M*K,N*L)) This array records the column pivoting performed. If JPVT(j) = k, then the j-th column of T*P was the k-th column of T.Tolerances
TOL1 DOUBLE PRECISION If TOL1 >= 0.0, the user supplied diagonal tolerance; if TOL1 < 0.0, a default diagonal tolerance is used. TOL2 DOUBLE PRECISION If TOL2 >= 0.0, the user supplied offdiagonal tolerance; if TOL2 < 0.0, a default offdiagonal tolerance is used.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK; DWORK(2) and DWORK(3) return the used values for TOL1 and TOL2, respectively. On exit, if INFO = -19, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 3, ( M*K + ( N - 1 )*L )*( L + 2*K ) + 9*L + MAX(M*K,(N-1)*L) ), if JOB = 'Q'; LDWORK >= MAX( 3, ( N - 1 )*L*( L + 2*K + 1 ) + 9*L, M*K*( L + 1 ) + L ), if JOB = 'R'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: due to perturbations induced by roundoff errors, or removal of nearly linearly dependent columns of the generator, the Schur algorithm encountered a situation where a diagonal element in the negative generator is larger in magnitude than the corresponding diagonal element in the positive generator (modulo TOL1); = 2: due to perturbations induced by roundoff errors, or removal of nearly linearly dependent columns of the generator, the Schur algorithm encountered a situation where diagonal elements in the positive and negative generator are equal in magnitude (modulo TOL1), but the offdiagonal elements suggest that these columns are not linearly dependent (modulo TOL2*ABS(diagonal element)).Method
Householder transformations and modified hyperbolic rotations are used in the Schur algorithm [1], [2]. If, during the process, the hyperbolic norm of a row in the leading part of the generator is found to be less than or equal to TOL1, then this row is not reduced. If the difference of the corresponding columns has a norm less than or equal to TOL2 times the magnitude of the leading element, then this column is removed from the generator, as well as from R. Otherwise, the algorithm breaks down. TOL1 is set to norm(TC)*sqrt(eps) and TOL2 is set to N*L*sqrt(eps) by default. If M*K > L, the columns of T are permuted so that the diagonal elements in one block column of R have decreasing magnitudes.References
[1] Kailath, T. and Sayed, A. Fast Reliable Algorithms for Matrices with Structure. SIAM Publications, Philadelphia, 1999. [2] Kressner, D. and Van Dooren, P. Factorizations and linear system solvers for matrices with Toeplitz structure. SLICOT Working Note 2000-2, 2000.Numerical Aspects
The algorithm requires 0(K*RNK*L*M*N) floating point operations.Further Comments
NoneExample
Program Text
* MB02JX EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, LMAX, MMAX, NMAX PARAMETER ( KMAX = 20, LMAX = 20, MMAX = 20, NMAX = 20 ) INTEGER LDR, LDQ, LDTC, LDTR, LDWORK PARAMETER ( LDR = NMAX*LMAX, LDQ = MMAX*KMAX, $ LDTC = MMAX*KMAX, LDTR = KMAX, $ LDWORK = ( MMAX*KMAX + NMAX*LMAX ) $ *( LMAX + 2*KMAX ) + 5*LMAX $ + MMAX*KMAX + NMAX*LMAX ) * .. Local Scalars .. CHARACTER JOB INTEGER I, INFO, J, K, L, M, N, RNK DOUBLE PRECISION TOL1, TOL2 * .. Local Arrays .. INTEGER JPVT(NMAX*LMAX) DOUBLE PRECISION DWORK(LDWORK), Q(LDQ,NMAX*LMAX), $ R(LDR,NMAX*LMAX), TC(LDTC,LMAX), $ TR(LDTR,NMAX*LMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB02JX * .. Intrinsic Functions .. INTRINSIC MIN * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) K, L, M, N, TOL1, TOL2, JOB IF( K.LE.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99991 ) K ELSE IF( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99990 ) L ELSE IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( TC(I,J), J = 1,L ), I = 1,M*K ) READ ( NIN, FMT = * ) ( ( TR(I,J), J = 1,( N - 1 )*L ), $ I = 1,K ) * Compute the required part of the QR factorization. CALL MB02JX( JOB, K, L, M, N, TC, LDTC, TR, LDTR, RNK, Q, LDQ, $ R, LDR, JPVT, TOL1, TOL2, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) RNK IF ( LSAME( JOB, 'Q' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, M*K WRITE ( NOUT, FMT = 99993 ) ( Q(I,J), J = 1, RNK ) 10 CONTINUE END IF WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N*L WRITE ( NOUT, FMT = 99993 ) ( R(I,J), J = 1, RNK ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) WRITE ( NOUT, FMT = 99992 ) ( JPVT(I), $ I = 1, MIN( M*K, N*L ) ) END IF END IF STOP * 99999 FORMAT (' MB02JX EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02JX = ',I2) 99997 FORMAT (/' The factor Q is ') 99996 FORMAT (/' The factor R is ') 99995 FORMAT (/' The column permutation is ') 99994 FORMAT (/' Numerical rank ',/' RNK = ',I5) 99993 FORMAT (20(1X,F8.4)) 99992 FORMAT (20(1X,I4)) 99991 FORMAT (/' K is out of range.',/' K = ',I5) 99990 FORMAT (/' L is out of range.',/' L = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB02JX EXAMPLE PROGRAM DATA 3 3 4 4 -1.0D0 -1.0D0 Q 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 0.0 1.0 1.0 1.0 0.0 2.0 2.0 0.0 1.0 2.0 3.0 1.0 2.0 3.0 0.0 1.0 1.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 1.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 1.0 1.0 1.0 2.0 3.0 1.0 2.0 3.0 0.0 1.0 0.0Program Results
MB02JX EXAMPLE PROGRAM RESULTS Numerical rank RNK = 7 The factor Q is -0.3313 -0.0105 -0.0353 0.0000 -0.4714 -0.8165 0.0000 -0.3313 -0.0105 -0.0353 0.0000 -0.4714 0.4082 0.7071 -0.3313 -0.0105 -0.0353 0.0000 -0.4714 0.4082 -0.7071 -0.3313 -0.0105 -0.0353 0.0000 0.2357 0.0000 0.0000 -0.3313 -0.0105 -0.0353 0.0000 0.2357 0.0000 0.0000 -0.3313 -0.0105 -0.0353 0.0000 0.2357 0.0000 0.0000 -0.3313 -0.0105 -0.0353 0.0000 0.2357 0.0000 0.0000 -0.3313 -0.0105 -0.0353 0.0000 0.2357 0.0000 0.0000 -0.3313 -0.0105 -0.0353 0.0000 0.2357 0.0000 0.0000 -0.1104 0.2824 0.9529 0.0000 0.0000 0.0000 0.0000 0.0000 0.4288 -0.1271 0.8944 0.0000 0.0000 0.0000 0.0000 0.8576 -0.2541 -0.4472 0.0000 0.0000 0.0000 The factor R is -9.0554 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -3.0921 2.3322 0.0000 0.0000 0.0000 0.0000 0.0000 -5.9633 1.9557 -1.2706 0.0000 0.0000 0.0000 0.0000 -9.2762 4.4238 0.7623 1.3416 0.0000 0.0000 0.0000 -6.1842 2.9492 0.5082 0.8944 0.0000 0.0000 0.0000 -3.0921 1.4746 0.2541 0.4472 0.0000 0.0000 0.0000 -9.2762 4.4238 0.7623 1.3416 0.0000 0.0000 0.0000 -6.1842 2.9492 0.5082 0.8944 0.0000 0.0000 0.0000 -3.0921 1.4746 0.2541 0.4472 0.0000 0.0000 0.0000 -7.2885 4.4866 0.9741 1.3416 2.8284 0.0000 0.0000 -2.7608 1.4851 0.2894 0.4472 0.4714 0.8165 0.0000 -5.5216 2.9701 0.5788 0.8944 0.9428 0.4082 0.7071 The column permutation is 3 1 2 6 5 4 9 8 7 12 10 11
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02KD.html 0000664 0000000 0000000 00000026224 14560147231 0020337 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrix product C = alpha*op( T )*B + beta*C, where alpha and beta are scalars and T is a block Toeplitz matrix specified by its first block column TC and first block row TR; B and C are general matrices of appropriate dimensions.Specification
SUBROUTINE MB02KD( LDBLK, TRANS, K, L, M, N, R, ALPHA, BETA, $ TC, LDTC, TR, LDTR, B, LDB, C, LDC, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER LDBLK, TRANS INTEGER INFO, K, L, LDB, LDC, LDTC, LDTR, LDWORK, M, N, $ R DOUBLE PRECISION ALPHA, BETA C .. Array Arguments .. DOUBLE PRECISION B(LDB,*), C(LDC,*), DWORK(*), TC(LDTC,*), $ TR(LDTR,*)Arguments
Mode Parameters
LDBLK CHARACTER*1 Specifies where the (1,1)-block of T is stored, as follows: = 'C': in the first block of TC; = 'R': in the first block of TR. TRANS CHARACTER*1 Specifies the form of op( T ) to be used in the matrix multiplication as follows: = 'N': op( T ) = T; = 'T': op( T ) = T'; = 'C': op( T ) = T'.Input/Output Parameters
K (input) INTEGER The number of rows in the blocks of T. K >= 0. L (input) INTEGER The number of columns in the blocks of T. L >= 0. M (input) INTEGER The number of blocks in the first block column of T. M >= 0. N (input) INTEGER The number of blocks in the first block row of T. N >= 0. R (input) INTEGER The number of columns in B and C. R >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then TC, TR and B are not referenced. BETA (input) DOUBLE PRECISION The scalar beta. When beta is zero then C need not be set before entry. TC (input) DOUBLE PRECISION array, dimension (LDTC,L) On entry with LDBLK = 'C', the leading M*K-by-L part of this array must contain the first block column of T. On entry with LDBLK = 'R', the leading (M-1)*K-by-L part of this array must contain the 2nd to the M-th blocks of the first block column of T. LDTC INTEGER The leading dimension of the array TC. LDTC >= MAX(1,M*K), if LDBLK = 'C'; LDTC >= MAX(1,(M-1)*K), if LDBLK = 'R'. TR (input) DOUBLE PRECISION array, dimension (LDTR,k) where k is (N-1)*L when LDBLK = 'C' and is N*L when LDBLK = 'R'. On entry with LDBLK = 'C', the leading K-by-(N-1)*L part of this array must contain the 2nd to the N-th blocks of the first block row of T. On entry with LDBLK = 'R', the leading K-by-N*L part of this array must contain the first block row of T. LDTR INTEGER The leading dimension of the array TR. LDTR >= MAX(1,K). B (input) DOUBLE PRECISION array, dimension (LDB,R) On entry with TRANS = 'N', the leading N*L-by-R part of this array must contain the matrix B. On entry with TRANS = 'T' or TRANS = 'C', the leading M*K-by-R part of this array must contain the matrix B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N*L), if TRANS = 'N'; LDB >= MAX(1,M*K), if TRANS = 'T' or TRANS = 'C'. C (input/output) DOUBLE PRECISION array, dimension (LDC,R) On entry with TRANS = 'N', the leading M*K-by-R part of this array must contain the matrix C. On entry with TRANS = 'T' or TRANS = 'C', the leading N*L-by-R part of this array must contain the matrix C. On exit with TRANS = 'N', the leading M*K-by-R part of this array contains the updated matrix C. On exit with TRANS = 'T' or TRANS = 'C', the leading N*L-by-R part of this array contains the updated matrix C. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M*K), if TRANS = 'N'; LDC >= MAX(1,N*L), if TRANS = 'T' or TRANS = 'C'.Workspace
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 >= 1. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
For point Toeplitz matrices or sufficiently large block Toeplitz matrices, this algorithm uses convolution algorithms based on the fast Hartley transforms [1]. Otherwise, TC is copied in reversed order into the workspace such that C can be computed from barely M matrix-by-matrix multiplications.References
[1] Van Loan, Charles. Computational frameworks for the fast Fourier transform. SIAM, 1992.Numerical Aspects
The algorithm requires O( (K*L+R*L+K*R)*(N+M)*log(N+M) + K*L*R ) floating point operations.Further Comments
NoneExample
Program Text
* MB02KD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, LMAX, MMAX, NMAX, RMAX PARAMETER ( KMAX = 20, LMAX = 20, MMAX = 20, NMAX = 20, $ RMAX = 20 ) INTEGER LDB, LDC, LDTC, LDTR, LDWORK PARAMETER ( LDB = LMAX*NMAX, LDC = KMAX*MMAX, $ LDTC = MMAX*KMAX, LDTR = KMAX, $ LDWORK = 2*( KMAX*LMAX + KMAX*RMAX $ + LMAX*RMAX + 1 )*( MMAX + NMAX ) ) * .. Local Scalars .. INTEGER I, INFO, J, K, L, M, N, R CHARACTER LDBLK, TRANS DOUBLE PRECISION ALPHA, BETA * .. Local Arrays .. (Dimensioned for TRANS = 'N'.) DOUBLE PRECISION B(LDB,RMAX), C(LDC,RMAX), DWORK(LDWORK), $ TC(LDTC,LMAX), TR(LDTR,NMAX*LMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB02KD * .. Intrinsic Functions .. INTRINSIC MAX * * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) K, L, M, N, R, LDBLK, TRANS IF( K.LE.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99994 ) K ELSE IF( L.LE.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99993 ) L ELSE IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE IF( R.LE.0 .OR. R.GT.RMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE IF ( LSAME( LDBLK, 'R' ) ) THEN READ ( NIN, FMT = * ) ( ( TC(I,J), J = 1,L ), $ I = 1,(M-1)*K ) READ ( NIN, FMT = * ) ( ( TR(I,J), J = 1,N*L ), I = 1,K ) ELSE READ ( NIN, FMT = * ) ( ( TC(I,J), J = 1,L ), I = 1,M*K ) READ ( NIN, FMT = * ) ( ( TR(I,J), J = 1,(N-1)*L ), $ I = 1,K ) END IF IF ( LSAME( TRANS, 'N' ) ) THEN READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,R ), I = 1,N*L ) ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,R ), I = 1,M*K ) END IF ALPHA = ONE BETA = ZERO CALL MB02KD( LDBLK, TRANS, K, L, M, N, R, ALPHA, BETA, TC, $ LDTC, TR, LDTR, B, LDB, C, LDC, DWORK, LDWORK, $ INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( TRANS, 'N' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, M*K WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,R ) 10 CONTINUE ELSE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N*L WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,R ) 20 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' MB02KD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02KD = ',I2) 99997 FORMAT (' The product C = T * B is ') 99996 FORMAT (' The product C = T^T * B is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' K is out of range.',/' K = ',I5) 99993 FORMAT (/' L is out of range.',/' L = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' N is out of range.',/' N = ',I5) 99990 FORMAT (/' R is out of range.',/' R = ',I5) ENDProgram Data
MB02KD EXAMPLE PROGRAM DATA 3 2 4 5 1 C N 4.0 1.0 3.0 5.0 2.0 1.0 4.0 1.0 3.0 4.0 2.0 4.0 3.0 1.0 3.0 0.0 4.0 4.0 5.0 1.0 3.0 1.0 4.0 3.0 5.0 2.0 2.0 2.0 2.0 1.0 1.0 3.0 4.0 1.0 5.0 4.0 5.0 4.0 1.0 2.0 2.0 3.0 4.0 1.0 3.0 3.0 3.0 3.0 0.0 2.0 2.0 2.0 1.0 3.0 3.0 4.0 2.0 3.0Program Results
MB02KD EXAMPLE PROGRAM RESULTS The product C = T * B is 45.0000 76.0000 55.0000 44.0000 84.0000 56.0000 52.0000 70.0000 54.0000 49.0000 63.0000 59.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02MD.html 0000664 0000000 0000000 00000041311 14560147231 0020333 0 ustar 00root root 0000000 0000000
Purpose
To solve the Total Least Squares (TLS) problem using a Singular Value Decomposition (SVD) approach. The TLS problem assumes an overdetermined set of linear equations AX = B, where both the data matrix A as well as the observation matrix B are inaccurate. The routine also solves determined and underdetermined sets of equations by computing the minimum norm solution. It is assumed that all preprocessing measures (scaling, coordinate transformations, whitening, ... ) of the data have been performed in advance.Specification
SUBROUTINE MB02MD( JOB, M, N, L, RANK, C, LDC, S, X, LDX, TOL, $ IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER INFO, IWARN, L, LDC, LDWORK, LDX, M, N, RANK DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION C(LDC,*), DWORK(*), S(*), X(LDX,*)Arguments
Mode Parameters
JOB CHARACTER*1 Determines whether the values of the parameters RANK and TOL are to be specified by the user or computed by the routine as follows: = 'R': Compute RANK only; = 'T': Compute TOL only; = 'B': Compute both RANK and TOL; = 'N': Compute neither RANK nor TOL.Input/Output Parameters
M (input) INTEGER The number of rows in the data matrix A and the observation matrix B. M >= 0. N (input) INTEGER The number of columns in the data matrix A. N >= 0. L (input) INTEGER The number of columns in the observation matrix B. L >= 0. RANK (input/output) INTEGER On entry, if JOB = 'T' or JOB = 'N', then RANK must specify r, the rank of the TLS approximation [A+DA|B+DB]. RANK <= min(M,N). Otherwise, r is computed by the routine. On exit, if JOB = 'R' or JOB = 'B', and INFO = 0, then RANK contains the computed (effective) rank of the TLS approximation [A+DA|B+DB]. Otherwise, the user-supplied value of RANK may be changed by the routine on exit if the RANK-th and the (RANK+1)-th singular values of C = [A|B] are considered to be equal, or if the upper triangular matrix F (as defined in METHOD) is (numerically) singular. C (input/output) DOUBLE PRECISION array, dimension (LDC,N+L) On entry, the leading M-by-(N+L) part of this array must contain the matrices A and B. Specifically, the first N columns must contain the data matrix A and the last L columns the observation matrix B (right-hand sides). On exit, the leading (N+L)-by-(N+L) part of this array contains the (transformed) right singular vectors, including null space vectors, if any, of C = [A|B]. Specifically, the leading (N+L)-by-RANK part of this array always contains the first RANK right singular vectors, corresponding to the largest singular values of C. If L = 0, or if RANK = 0 and IWARN <> 2, the remaining (N+L)-by-(N+L-RANK) top-right part of this array contains the remaining N+L-RANK right singular vectors. Otherwise, this part contains the matrix V2 transformed as described in Step 3 of the TLS algorithm (see METHOD). LDC INTEGER The leading dimension of array C. LDC >= max(1,M,N+L). S (output) DOUBLE PRECISION array, dimension (min(M,N+L)) If INFO = 0, the singular values of matrix C, ordered such that S(1) >= S(2) >= ... >= S(p-1) >= S(p) >= 0, where p = min(M,N+L). X (output) DOUBLE PRECISION array, dimension (LDX,L) If INFO = 0, the leading N-by-L part of this array contains the solution X to the TLS problem specified by A and B. LDX INTEGER The leading dimension of array X. LDX >= max(1,N).Tolerances
TOL DOUBLE PRECISION A tolerance used to determine the rank of the TLS approximation [A+DA|B+DB] and to check the multiplicity of the singular values of matrix C. Specifically, S(i) and S(j) (i < j) are considered to be equal if SQRT(S(i)**2 - S(j)**2) <= TOL, and the TLS approximation [A+DA|B+DB] has rank r if S(i) > TOL*S(1) (or S(i) > TOL, if TOL specifies sdev (see below)), for i = 1,2,...,r. TOL is also used to check the singularity of the upper triangular matrix F (as defined in METHOD). If JOB = 'R' or JOB = 'N', then TOL must specify the desired tolerance. If the user sets TOL to be less than or equal to 0, the tolerance is taken as EPS, where EPS is the machine precision (see LAPACK Library routine DLAMCH). Otherwise, the tolerance is computed by the routine and the user must supply the non-negative value sdev, i.e. the estimated standard deviation of the error on each element of the matrix C, as input value of TOL.Workspace
IWORK INTEGER array, dimension (L) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and DWORK(2) returns the reciprocal of the condition number of the matrix F. If INFO > 0, DWORK(1:min(M,N+L)-1) contain the unconverged non-diagonal elements of the bidiagonal matrix whose diagonal is in S (see LAPACK Library routine DGESVD). LDWORK INTEGER The length of the array DWORK. LDWORK = max(2, 3*(N+L) + M, 5*(N+L)), if M >= N+L; LDWORK = max(2, M*(N+L) + max( 3M+N+L, 5*M), 3*L), if M < N+L. For optimum performance LDWORK should 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.Warning Indicator
IWARN INTEGER = 0: no warnings; = 1: if the rank of matrix C has been lowered because a singular value of multiplicity greater than 1 was found; = 2: if the rank of matrix C has been lowered because the upper triangular matrix F is (numerically) singular.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if the SVD algorithm (in LAPACK Library routine DBDSQR) has failed to converge. In this case, S(1), S(2), ..., S(INFO) may not have been found correctly and the remaining singular values may not be the smallest. This failure is not likely to occur.Method
The method used is an extension (see [3,4,5]) of the classical TLS algorithm proposed by Golub and Van Loan [1]. Let [A|B] denote the matrix formed by adjoining the columns of B to the columns of A on the right. Total Least Squares (TLS) definition: ------------------------------------- Given matrices A and B, find a matrix X satisfying (A + DA) X = B + DB, where A and DA are M-by-N matrices, B and DB are M-by-L matrices and X is an N-by-L matrix. The solution X must be such that the Frobenius norm of [DA|DB] is a minimum and each column of B + DB is in the range of A + DA. Whenever the solution is not unique, the routine singles out the minimum norm solution X. Define matrix C = [A|B] and s(i) as its i-th singular value for i = 1,2,...,min(M,NL), where NL = N + L. If M < NL, then s(j) = 0 for j = M+1,...,NL. The Classical TLS algorithm proceeds as follows (see [3,4,5]): Step 1: Compute part of the singular value decomposition (SVD) USV' of C = [A|B], namely compute S and V'. (An initial QR factorization of C is used when M is larger enough than NL.) Step 2: If not fixed by the user, compute the rank r0 of the data [A|B] based on TOL as follows: if JOB = 'R' or JOB = 'N', s(1) >= ... >= s(r0) > TOL*s(1) >= ... >= s(NL). Otherwise, using [2], TOL can be computed from the standard deviation sdev of the errors on [A|B]: TOL = SQRT(2 * max(M,NL)) * sdev, and the rank r0 is determined (if JOB = 'R' or 'B') using s(1) >= ... >= s(r0) > TOL >= ... >= s(NL). The rank r of the approximation [A+DA|B+DB] is then equal to the minimum of N and r0. Step 3: Let V2 be the matrix of the columns of V corresponding to the (NL - r) smallest singular values of C, i.e. the last (NL - r) columns of V. Compute with Householder transformations the orthogonal matrix Q such that: |VH Y| V2 x Q = | | |0 F| where VH is an N-by-(N - r) matrix, Y is an N-by-L matrix and F is an L-by-L upper triangular matrix. If F is singular, then lower the rank r with the multiplicity of s(r) and repeat this step. Step 4: If F is nonsingular then the solution X is obtained by solving the following equations by forward elimination: X F = -Y. Notes : The TLS solution is unique if r = N, F is nonsingular and s(N) > s(N+1). If F is singular, however, then the computed solution is infinite and hence does not satisfy the second TLS criterion (see TLS definition). For these cases, Golub and Van Loan [1] claim that the TLS problem has no solution. The properties of these so-called nongeneric problems are described in [4] and the TLS computations are generalized in order to solve them. As proven in [4], the proposed generalization satisfies the TLS criteria for any number L of observation vectors in B provided that, in addition, the solution | X| is constrained to be orthogonal to all vectors |-I| of the form |w| which belong to the space generated by the columns |0| of the submatrix |Y|. |F|References
[1] Golub, G.H. and Van Loan, C.F. An Analysis of the Total Least-Squares Problem. SIAM J. Numer. Anal., 17, pp. 883-893, 1980. [2] Staar, J., Vandewalle, J. and Wemans, M. Realization of Truncated Impulse Response Sequences with Prescribed Uncertainty. Proc. 8th IFAC World Congress, Kyoto, I, pp. 7-12, 1981. [3] Van Huffel, S. Analysis of the Total Least Squares Problem and its Use in Parameter Estimation. Doctoral dissertation, Dept. of Electr. Eng., Katholieke Universiteit Leuven, Belgium, June 1987. [4] Van Huffel, S. and Vandewalle, J. Analysis and Solution of the Nongeneric Total Least Squares Problem. SIAM J. Matr. Anal. and Appl., 9, pp. 360-372, 1988. [5] Van Huffel, S. and Vandewalle, J. The Total Least Squares Problem: Computational Aspects and Analysis. Series "Frontiers in Applied Mathematics", Vol. 9, SIAM, Philadelphia, 1991.Numerical Aspects
The algorithm consists in (backward) stable steps.Further Comments
NoneExample
Program Text
* MB02MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX, LMAX PARAMETER ( MMAX = 20, NMAX = 20, LMAX = 20 ) INTEGER LDC, LDX PARAMETER ( LDC = MAX( MMAX,NMAX+LMAX ), LDX = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MMAX*(NMAX+LMAX) + $ MAX( 3*MIN(MMAX,NMAX+LMAX) + $ MAX(MMAX,NMAX+LMAX), $ 5*MIN(MMAX,NMAX+LMAX), $ 3*LMAX ) ) INTEGER LIWORK PARAMETER ( LIWORK = LMAX ) INTEGER LENGS PARAMETER ( LENGS = MIN( MMAX, NMAX+LMAX ) ) * .. Local Scalars .. DOUBLE PRECISION SDEV, TOL INTEGER I, INFO, IWARN, J, L, M, N, RANK CHARACTER*1 JOB * .. Local Arrays .. DOUBLE PRECISION C(LDC,NMAX+LMAX), DWORK(LDWORK), S(LENGS), $ X(LDX,LMAX) INTEGER IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB02MD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, L, JOB * IF ( LSAME( JOB, 'R' ) ) THEN READ ( NIN, FMT = * ) TOL ELSE IF ( LSAME( JOB, 'T' ) ) THEN READ ( NIN, FMT = * ) RANK, SDEV TOL = SDEV ELSE IF ( LSAME( JOB, 'N' ) ) THEN READ ( NIN, FMT = * ) RANK, TOL ELSE READ ( NIN, FMT = * ) SDEV TOL = SDEV END IF * IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99990 ) M ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99989 ) L ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N+L ), I = 1,M ) * Compute the solution to the TLS problem Ax = b. CALL MB02MD( JOB, M, N, L, RANK, C, LDC, S, X, LDX, TOL, IWORK, $ DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) IWARN WRITE ( NOUT, FMT = 99996 ) RANK ELSE IF ( ( LSAME( JOB, 'R' ) ) .OR. ( LSAME( JOB, 'B' ) ) ) $ WRITE ( NOUT, FMT = 99996 ) RANK END IF WRITE ( NOUT, FMT = 99995 ) DO 40 J = 1, L DO 20 I = 1, N WRITE ( NOUT, FMT = 99994 ) X(I,J) 20 CONTINUE IF ( J.LT.L ) WRITE ( NOUT, FMT = 99993 ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) ( S(J),J = 1, MIN( M, N+L ) ) END IF END IF STOP * 99999 FORMAT (' MB02MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02MD = ',I2) 99997 FORMAT (' IWARN on exit from MB02MD = ',I2,/) 99996 FORMAT (' The computed rank of the TLS approximation = ',I3,/) 99995 FORMAT (' The solution X to the TLS problem is ',/) 99994 FORMAT (1X,F8.4) 99993 FORMAT (' ') 99992 FORMAT (/' The singular values of C are ',//(1X,F8.4)) 99991 FORMAT (/' N is out of range.',/' N = ',I5) 99990 FORMAT (/' M is out of range.',/' M = ',I5) 99989 FORMAT (/' L is out of range.',/' L = ',I5) ENDProgram Data
MB02MD EXAMPLE PROGRAM DATA 6 3 1 B 0.0 0.80010 0.39985 0.60005 0.89999 0.29996 0.69990 0.39997 0.82997 0.49994 0.60003 0.20012 0.79011 0.90013 0.20016 0.79995 0.85002 0.39998 0.80006 0.49985 0.99016 0.20002 0.90007 0.70009 1.02994Program Results
MB02MD EXAMPLE PROGRAM RESULTS The computed rank of the TLS approximation = 3 The solution X to the TLS problem is 0.5003 0.8003 0.2995 The singular values of C are 3.2281 0.8716 0.3697 0.0001
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02ND.html 0000664 0000000 0000000 00000055234 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To solve the Total Least Squares (TLS) problem using a Partial Singular Value Decomposition (PSVD) approach. The TLS problem assumes an overdetermined set of linear equations AX = B, where both the data matrix A as well as the observation matrix B are inaccurate. The routine also solves determined and underdetermined sets of equations by computing the minimum norm solution. It is assumed that all preprocessing measures (scaling, coordinate transformations, whitening, ... ) of the data have been performed in advance.Specification
SUBROUTINE MB02ND( M, N, L, RANK, THETA, C, LDC, X, LDX, Q, INUL, $ TOL, RELTOL, IWORK, DWORK, LDWORK, BWORK, $ IWARN, INFO ) C .. Scalar Arguments .. INTEGER INFO, IWARN, L, LDC, LDWORK, LDX, M, N, RANK DOUBLE PRECISION RELTOL, THETA, TOL C .. Array Arguments .. LOGICAL BWORK(*), INUL(*) INTEGER IWORK(*) DOUBLE PRECISION C(LDC,*), DWORK(*), Q(*), X(LDX,*)Arguments
Input/Output Parameters
M (input) INTEGER The number of rows in the data matrix A and the observation matrix B. M >= 0. N (input) INTEGER The number of columns in the data matrix A. N >= 0. L (input) INTEGER The number of columns in the observation matrix B. L >= 0. RANK (input/output) INTEGER On entry, if RANK < 0, then the rank of the TLS approximation [A+DA|B+DB] (r say) is computed by the routine. Otherwise, RANK must specify the value of r. RANK <= min(M,N). On exit, if RANK < 0 on entry and INFO = 0, then RANK contains the computed rank of the TLS approximation [A+DA|B+DB]. Otherwise, the user-supplied value of RANK may be changed by the routine on exit if the RANK-th and the (RANK+1)-th singular values of C = [A|B] are considered to be equal, or if the upper triangular matrix F (as defined in METHOD) is (numerically) singular. THETA (input/output) DOUBLE PRECISION On entry, if RANK < 0, then the rank of the TLS approximation [A+DA|B+DB] is computed using THETA as (min(M,N+L) - d), where d is the number of singular values of [A|B] <= THETA. THETA >= 0.0. Otherwise, THETA is an initial estimate (t say) for computing a lower bound on the RANK largest singular values of [A|B]. If THETA < 0.0 on entry however, then t is computed by the routine. On exit, if RANK >= 0 on entry, then THETA contains the computed bound such that precisely RANK singular values of C = [A|B] are greater than THETA + TOL. Otherwise, THETA is unchanged. C (input/output) DOUBLE PRECISION array, dimension (LDC,N+L) On entry, the leading M-by-(N+L) part of this array must contain the matrices A and B. Specifically, the first N columns must contain the data matrix A and the last L columns the observation matrix B (right-hand sides). On exit, if INFO = 0, the first N+L components of the columns of this array whose index i corresponds with INUL(i) = .TRUE., are the possibly transformed (N+L-RANK) base vectors of the right singular subspace corresponding to the singular values of C = [A|B] which are less than or equal to THETA. Specifically, if L = 0, or if RANK = 0 and IWARN <> 2, these vectors are indeed the base vectors above. Otherwise, these vectors form the matrix V2, transformed as described in Step 4 of the PTLS algorithm (see METHOD). The TLS solution is computed from these vectors. The other columns of array C contain no useful information. LDC INTEGER The leading dimension of array C. LDC >= max(1,M,N+L). X (output) DOUBLE PRECISION array, dimension (LDX,L) If INFO = 0, the leading N-by-L part of this array contains the solution X to the TLS problem specified by A and B. LDX INTEGER The leading dimension of array X. LDX >= max(1,N). Q (output) DOUBLE PRECISION array, dimension (max(1,2*min(M,N+L)-1)) This array contains the partially diagonalized bidiagonal matrix J computed from C, at the moment that the desired singular subspace has been found. Specifically, the leading p = min(M,N+L) entries of Q contain the diagonal elements q(1),q(2),...,q(p) and the entries Q(p+1),Q(p+2), ...,Q(2*p-1) contain the superdiagonal elements e(1),e(2), ...,e(p-1) of J. INUL (output) LOGICAL array, dimension (N+L) The indices of the elements of this array with value .TRUE. indicate the columns in C containing the base vectors of the right singular subspace of C from which the TLS solution has been computed.Tolerances
TOL DOUBLE PRECISION This parameter defines the multiplicity of singular values by considering all singular values within an interval of length TOL as coinciding. TOL is used in checking how many singular values are less than or equal to THETA. Also in computing an appropriate upper bound THETA by a bisection method, TOL is used as a stopping criterion defining the minimum (absolute) subinterval width. TOL is also taken as an absolute tolerance for negligible elements in the QR/QL iterations. If the user sets TOL to be less than or equal to 0, then the tolerance is taken as specified in SLICOT Library routine MB04YD document. RELTOL DOUBLE PRECISION This parameter specifies the minimum relative width of an interval. When an interval is narrower than TOL, or than RELTOL times the larger (in magnitude) endpoint, then it is considered to be sufficiently small and bisection has converged. If the user sets RELTOL to be less than BASE * EPS, where BASE is machine radix and EPS is machine precision (see LAPACK Library routine DLAMCH), then the tolerance is taken as BASE * EPS.Workspace
IWORK INTEGER array, dimension (N+2*L) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and DWORK(2) returns the reciprocal of the condition number of the matrix F. LDWORK INTEGER The length of the array DWORK. LDWORK = max(2, max(M,N+L) + 2*min(M,N+L), min(M,N+L) + LW + max(6*(N+L)-5, L*L+max(N+L,3*L)), where LW = (N+L)*(N+L-1)/2, if M >= N+L, LW = M*(N+L-(M-1)/2), if M < N+L. For optimum performance LDWORK should 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. BWORK LOGICAL array, dimension (N+L)Warning Indicator
IWARN INTEGER = 0: no warnings; = 1: if the rank of matrix C has been lowered because a singular value of multiplicity greater than 1 was found; = 2: if the rank of matrix C has been lowered because the upper triangular matrix F is (numerically) singular.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the maximum number of QR/QL iteration steps (30*MIN(M,N)) has been exceeded; = 2: if the computed rank of the TLS approximation [A+DA|B+DB] exceeds MIN(M,N). Try increasing the value of THETA or set the value of RANK to min(M,N).Method
The method used is the Partial Total Least Squares (PTLS) approach proposed by Van Huffel and Vandewalle [5]. Let C = [A|B] denote the matrix formed by adjoining the columns of B to the columns of A on the right. Total Least Squares (TLS) definition: ------------------------------------- Given matrices A and B, find a matrix X satisfying (A + DA) X = B + DB, where A and DA are M-by-N matrices, B and DB are M-by-L matrices and X is an N-by-L matrix. The solution X must be such that the Frobenius norm of [DA|DB] is a minimum and each column of B + DB is in the range of A + DA. Whenever the solution is not unique, the routine singles out the minimum norm solution X. Let V denote the right singular subspace of C. Since the TLS solution can be computed from any orthogonal basis of the subspace of V corresponding to the smallest singular values of C, the Partial Singular Value Decomposition (PSVD) can be used instead of the classical SVD. The dimension of this subspace of V may be determined by the rank of C or by an upper bound for those smallest singular values. The PTLS algorithm proceeds as follows (see [2 - 5]): Step 1: Bidiagonalization phase ----------------------- (a) If M is large enough than N + L, transform C into upper triangular form R by Householder transformations. (b) Transform C (or R) into upper bidiagonal form (p = min(M,N+L)): |q(1) e(1) 0 ... 0 | (0) | 0 q(2) e(2) . | J = | . . | | . e(p-1)| | 0 ... q(p) | if M >= N + L, or lower bidiagonal form: |q(1) 0 0 ... 0 0 | (0) |e(1) q(2) 0 . . | J = | . . . | | . q(p) . | | 0 ... e(p-1) q(p)| if M < N + L, using Householder transformations. In the second case, transform the matrix to the upper bidiagonal form by applying Givens rotations. (c) Initialize the right singular base matrix with the identity matrix. Step 2: Partial diagonalization phase ----------------------------- If the upper bound THETA is not given, then compute THETA such that precisely p - RANK singular values (p=min(M,N+L)) of the bidiagonal matrix are less than or equal to THETA, using a bisection method [5]. Diagonalize the given bidiagonal matrix J partially, using either QL iterations (if the upper left diagonal element of the considered bidiagonal submatrix is smaller than the lower right diagonal element) or QR iterations, such that J is split into unreduced bidiagonal submatrices whose singular values are either all larger than THETA or are all less than or equal to THETA. Accumulate the Givens rotations in V. Step 3: Back transformation phase ------------------------- Apply the Householder transformations of Step 1(b) onto the base vectors of V associated with the bidiagonal submatrices with all singular values less than or equal to THETA. Step 4: Computation of F and Y ---------------------- Let V2 be the matrix of the columns of V corresponding to the (N + L - RANK) smallest singular values of C. Compute with Householder transformations the matrices F and Y such that: |VH Y| V2 x Q = | | |0 F| where Q is an orthogonal matrix, VH is an N-by-(N-RANK) matrix, Y is an N-by-L matrix and F is an L-by-L upper triangular matrix. If F is singular, then reduce the value of RANK by one and repeat Steps 2, 3 and 4. Step 5: Computation of the TLS solution ------------------------------- If F is non-singular then the solution X is obtained by solving the following equations by forward elimination: X F = -Y. Notes: If RANK is lowered in Step 4, some additional base vectors must be computed in Step 2. The additional computations are kept to a minimum. If RANK is lowered in Step 4 but the multiplicity of the RANK-th singular value is larger than 1, then the value of RANK is further lowered with its multiplicity defined by the parameter TOL. This is done at the beginning of Step 2 by calling SLICOT Library routine MB03MD (from MB04YD), which estimates THETA using a bisection method. If F in Step 4 is singular, then the computed solution is infinite and hence does not satisfy the second TLS criterion (see TLS definition). For these cases, Golub and Van Loan [1] claim that the TLS problem has no solution. The properties of these so-called nongeneric problems are described in [6] and the TLS computations are generalized in order to solve them. As proven in [6], the proposed generalization satisfies the TLS criteria for any number L of observation vectors in B provided that, in addition, the solution | X| is constrained to be |-I| orthogonal to all vectors of the form |w| which belong to the |0| space generated by the columns of the submatrix |Y|. |F|References
[1] Golub, G.H. and Van Loan, C.F. An Analysis of the Total Least-Squares Problem. SIAM J. Numer. Anal., 17, pp. 883-893, 1980. [2] Van Huffel, S., Vandewalle, J. and Haegemans, A. An Efficient and Reliable Algorithm for Computing the Singular Subspace of a Matrix Associated with its Smallest Singular Values. J. Comput. and Appl. Math., 19, pp. 313-330, 1987. [3] Van Huffel, S. Analysis of the Total Least Squares Problem and its Use in Parameter Estimation. Doctoral dissertation, Dept. of Electr. Eng., Katholieke Universiteit Leuven, Belgium, June 1987. [4] Chan, T.F. An Improved Algorithm for Computing the Singular Value Decomposition. ACM TOMS, 8, pp. 72-83, 1982. [5] Van Huffel, S. and Vandewalle, J. The Partial Total Least Squares Algorithm. J. Comput. Appl. Math., 21, pp. 333-341, 1988. [6] Van Huffel, S. and Vandewalle, J. Analysis and Solution of the Nongeneric Total Least Squares Problem. SIAM J. Matr. Anal. and Appl., 9, pp. 360-372, 1988.Numerical Aspects
The computational efficiency of the PTLS algorithm compared with the classical TLS algorithm (see [2 - 5]) is obtained by making use of PSVD (see [1]) instead of performing the entire SVD. Depending on the gap between the RANK-th and the (RANK+1)-th singular values of C, the number (N + L - RANK) of base vectors to be computed with respect to the column dimension (N + L) of C and the desired accuracy RELTOL, the algorithm used by this routine is approximately twice as fast as the classical TLS algorithm at the expense of extra storage requirements, namely: (N + L) x (N + L - 1)/2 if M >= N + L or M x (N + L - (M - 1)/2) if M < N + L. This is because the Householder transformations performed on the rows of C in the bidiagonalization phase (see Step 1) must be kept until the end (Step 5).Further Comments
NoneExample
Program Text
* MB02ND EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX, LMAX PARAMETER ( MMAX = 20, NMAX = 20, LMAX = 20 ) INTEGER LDC, LDX PARAMETER ( LDC = MAX( MMAX, NMAX+LMAX ), LDX = NMAX ) INTEGER LENGQ PARAMETER ( LENGQ = 2*MIN(MMAX,NMAX+LMAX)-1 ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX+2*LMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX(2, MAX( MMAX, NMAX+LMAX ) + $ 2*MIN( MMAX, NMAX+LMAX ), $ MIN( MMAX, NMAX+LMAX ) + $ MAX( ( NMAX+LMAX )*( NMAX+LMAX-1 )/2, $ MMAX*( NMAX+LMAX-( MMAX-1 )/2 ) ) + $ MAX( 6*(NMAX+LMAX)-5, LMAX*LMAX + $ MAX( NMAX+LMAX, 3*LMAX ) ) ) ) INTEGER LBWORK PARAMETER ( LBWORK = NMAX+LMAX ) * .. Local Scalars .. DOUBLE PRECISION RELTOL, THETA, THETA1, TOL INTEGER I, INFO, IWARN, J, K, L, LOOP, M, MINMNL, N, $ RANK, RANK1 * .. Local Arrays .. DOUBLE PRECISION C(LDC,NMAX+LMAX), DWORK(LDWORK), $ Q(LENGQ), X(LDX,LMAX) INTEGER IWORK(LIWORK) LOGICAL BWORK(LBWORK), INUL(NMAX+LMAX) * .. External Subroutines .. EXTERNAL MB02ND * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, L, RANK, THETA, TOL, RELTOL IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99982 ) M ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99983 ) N ELSE IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99981 ) L ELSE IF ( RANK.GT.MIN( MMAX, NMAX ) ) THEN WRITE ( NOUT, FMT = 99980 ) RANK ELSE IF ( RANK.LT.0 .AND. THETA.LT.ZERO ) THEN WRITE ( NOUT, FMT = 99979 ) THETA ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N+L ), I = 1,M ) RANK1 = RANK THETA1 = THETA * Compute the solution to the TLS problem Ax = b. CALL MB02ND( M, N, L, RANK, THETA, C, LDC, X, LDX, Q, INUL, $ TOL, RELTOL, IWORK, DWORK, LDWORK, BWORK, IWARN, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) IWARN WRITE ( NOUT, FMT = 99996 ) RANK ELSE IF ( RANK1.LT.0 ) WRITE ( NOUT, FMT = 99996 ) RANK END IF IF ( THETA1.LT.ZERO ) WRITE ( NOUT, FMT = 99995 ) THETA WRITE ( NOUT, FMT = 99994 ) MINMNL = MIN( M, N+L ) LOOP = MINMNL - 1 DO 20 I = 1, LOOP K = I + MINMNL WRITE ( NOUT, FMT = 99993 ) I, I, Q(I), I, I + 1, Q(K) 20 CONTINUE WRITE ( NOUT, FMT = 99992 ) MINMNL, MINMNL, Q(MINMNL) WRITE ( NOUT, FMT = 99991 ) DO 60 J = 1, L DO 40 I = 1, N WRITE ( NOUT, FMT = 99990 ) X(I,J) 40 CONTINUE IF ( J.LT.L ) WRITE ( NOUT, FMT = 99989 ) 60 CONTINUE WRITE ( NOUT, FMT = 99987 ) N + L, N + L WRITE ( NOUT, FMT = 99985 ) DO 80 I = 1, MAX( M, N + L ) WRITE ( NOUT, FMT = 99984 ) ( C(I,J), J = 1,N+L ) 80 CONTINUE WRITE ( NOUT, FMT = 99986 ) DO 100 J = 1, N + L WRITE ( NOUT, FMT = 99988 ) J, INUL(J) 100 CONTINUE END IF END IF STOP * 99999 FORMAT (' MB02ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02ND = ',I2) 99997 FORMAT (' IWARN on exit from MB02ND = ',I2,/) 99996 FORMAT (' The computed rank of the TLS approximation = ',I3,/) 99995 FORMAT (' The computed value of THETA = ',F7.4,/) 99994 FORMAT (' The elements of the partially diagonalized bidiagonal ', $ 'matrix are',/) 99993 FORMAT (2(' (',I1,',',I1,') = ',F7.4,2X)) 99992 FORMAT (' (',I1,',',I1,') = ',F7.4,/) 99991 FORMAT (' The solution X to the TLS problem is ',/) 99990 FORMAT (1X,F8.4) 99989 FORMAT (' ') 99988 FORMAT (I3,L8) 99987 FORMAT (/' Right singular subspace corresponds to the first ',I2, $ ' components of the j-th ',/' column of C for which INUL(', $ 'j) = .TRUE., j = 1,...,',I2,/) 99986 FORMAT (/' j INUL(j)',/) 99985 FORMAT (' Matrix C',/) 99984 FORMAT (20(1X,F8.4)) 99983 FORMAT (/' N is out of range.',/' N = ',I5) 99982 FORMAT (/' M is out of range.',/' M = ',I5) 99981 FORMAT (/' L is out of range.',/' L = ',I5) 99980 FORMAT (/' RANK is out of range.',/' RANK = ',I5) 99979 FORMAT (/' THETA must be at least zero.',/' THETA = ',F8.4) ENDProgram Data
MB02ND EXAMPLE PROGRAM DATA 6 3 1 -1 0.001 0.0 0.0 0.80010 0.39985 0.60005 0.89999 0.29996 0.69990 0.39997 0.82997 0.49994 0.60003 0.20012 0.79011 0.90013 0.20016 0.79995 0.85002 0.39998 0.80006 0.49985 0.99016 0.20002 0.90007 0.70009 1.02994Program Results
MB02ND EXAMPLE PROGRAM RESULTS The computed rank of the TLS approximation = 3 The elements of the partially diagonalized bidiagonal matrix are (1,1) = 3.2280 (1,2) = -0.0287 (2,2) = 0.8714 (2,3) = 0.0168 (3,3) = 0.3698 (3,4) = 0.0000 (4,4) = 0.0001 The solution X to the TLS problem is 0.5003 0.8003 0.2995 Right singular subspace corresponds to the first 4 components of the j-th column of C for which INUL(j) = .TRUE., j = 1,..., 4 Matrix C -0.3967 -0.7096 0.4612 -0.3555 0.9150 -0.2557 0.2414 -0.5687 -0.0728 0.6526 0.5215 -0.2128 0.0000 0.0720 0.6761 0.7106 0.1809 0.3209 0.0247 -0.4139 0.0905 0.4609 -0.3528 0.5128 j INUL(j) 1 F 2 F 3 F 4 T
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02NY.html 0000664 0000000 0000000 00000015470 14560147231 0020370 0 ustar 00root root 0000000 0000000
Purpose
To separate a zero singular value of a bidiagonal submatrix of order k, k <= p, of the bidiagonal matrix |Q(1) E(1) 0 ... 0 | | 0 Q(2) E(2) . | J = | . . | | . E(p-1)| | 0 ... ... ... Q(p) | with p = MIN(M,N), by annihilating one or two superdiagonal elements E(i-1) (if i > 1) and/or E(i) (if i < k).Specification
SUBROUTINE MB02NY( UPDATU, UPDATV, M, N, I, K, Q, E, U, LDU, V, $ LDV, DWORK ) C .. Scalar Arguments .. LOGICAL UPDATU, UPDATV INTEGER I, K, LDU, LDV, M, N C .. Array Arguments .. DOUBLE PRECISION DWORK(*), E(*), Q(*), U(LDU,*), V(LDV,*)Arguments
Mode Parameters
UPDATU LOGICAL Indicates whether the user wishes to accumulate in a matrix U the left-hand Givens rotations S, as follows: = .FALSE.: Do not form U; = .TRUE. : The given matrix U is updated (postmultiplied) by the left-hand Givens rotations S. UPDATV LOGICAL Indicates whether the user wishes to accumulate in a matrix V the right-hand Givens rotations T, as follows: = .FALSE.: Do not form V; = .TRUE. : The given matrix V is updated (postmultiplied) by the right-hand Givens rotations T.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix U. M >= 0. N (input) INTEGER The number of rows of the matrix V. N >= 0. I (input) INTEGER The index of the negligible diagonal entry Q(I) of the bidiagonal matrix J, I <= p. K (input) INTEGER The index of the last diagonal entry of the considered bidiagonal submatrix of J, i.e., E(K-1) is considered negligible, K <= p. Q (input/output) DOUBLE PRECISION array, dimension (p) where p = MIN(M,N). On entry, Q must contain the diagonal entries of the bidiagonal matrix J. On exit, Q contains the diagonal entries of the transformed bidiagonal matrix S' J T. E (input/output) DOUBLE PRECISION array, dimension (p-1) On entry, E must contain the superdiagonal entries of J. On exit, E contains the superdiagonal entries of the transformed bidiagonal matrix S' J T. U (input/output) DOUBLE PRECISION array, dimension (LDU,p) On entry, if UPDATU = .TRUE., U must contain the M-by-p left transformation matrix. On exit, if UPDATU = .TRUE., the Givens rotations S on the left, annihilating E(i) if i < k, have been postmultiplied into U. U is not referenced if UPDATU = .FALSE.. LDU INTEGER The leading dimension of the array U. LDU >= max(1,M) if UPDATU = .TRUE.; LDU >= 1 if UPDATU = .FALSE.. V (input/output) DOUBLE PRECISION array, dimension (LDV,p) On entry, if UPDATV = .TRUE., V must contain the N-by-p right transformation matrix. On exit, if UPDATV = .TRUE., the Givens rotations T on the right, annihilating E(i-1) if i > 1, have been postmultiplied into V. V is not referenced if UPDATV = .FALSE.. LDV INTEGER The leading dimension of the array V. LDV >= max(1,N) if UPDATV = .TRUE.; LDV >= 1 if UPDATV = .FALSE..Workspace
DWORK DOUBLE PRECISION array, dimension (MAX(1,LDWORK)) LDWORK >= 2*MAX(K-I,I-1), if UPDATV = UPDATU = .TRUE.; LDWORK >= 2*(K-I), if UPDATU = .TRUE., UPDATV = .FALSE.; LDWORK >= 2*(I-1), if UPDATV = .TRUE., UPDATU = .FALSE.; LDWORK >= 1, if UPDATU = UPDATV = .FALSE..Method
Let the considered bidiagonal submatrix be |Q(1) E(1) 0 ... 0 | | 0 Q(2) E(2) . | | . . | | . Q(i-1) E(i-1) . | Jk = | . Q(i) E(i) . |. | . Q(i+1) . . | | . .. . | | . E(k-1)| | 0 ... ... Q(k) | A zero singular value of Jk manifests itself by a zero diagonal entry Q(i) or in practice, a negligible value of Q(i). When a negligible diagonal element Q(i) in Jk is present, the bidiagonal submatrix Jk is split by the routine into 2 or 3 unreduced bidiagonal submatrices by annihilating E(i) (if i < k) using Givens rotations S on the left and by annihilating E(i-1) (if i > 1) using Givens rotations T on the right until Jk is reduced to the form: |Q(1) E(1) 0 ... 0 | | 0 . ... . | | . ... . | | . Q(i-1) 0 . | S' Jk T = | . 0 0 . |. | . Q(i+1) . . | | . .. . | | . E(k-1)| | 0 ... ... Q(k) | For more details, see [1, pp.11.12-11.14].References
[1] Dongarra, J.J., Bunch, J.R., Moler C.B. and Stewart, G.W. LINPACK User's Guide. SIAM, Philadelphia, 1979.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve (if well-conditioned) one of the matrix equations op( A )*X = alpha*B, or X*op( A ) = alpha*B, where alpha is a scalar, X and B are m-by-n matrices, A is a unit, or non-unit, upper or lower triangular matrix and op( A ) is one of op( A ) = A or op( A ) = A'. An estimate of the reciprocal of the condition number of the triangular matrix A, in either the 1-norm or the infinity-norm, is also computed as RCOND = 1 / ( norm(A) * norm(inv(A)) ). and the specified matrix equation is solved only if RCOND is larger than a given tolerance TOL. In that case, the matrix X is overwritten on B.Specification
SUBROUTINE MB02OD( SIDE, UPLO, TRANS, DIAG, NORM, M, N, ALPHA, A, $ LDA, B, LDB, RCOND, TOL, IWORK, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER DIAG, NORM, SIDE, TRANS, UPLO INTEGER INFO, LDA, LDB, M, N DOUBLE PRECISION ALPHA, RCOND, TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*)Arguments
Mode Parameters
SIDE CHARACTER*1 Specifies whether op( A ) appears on the left or right of X as follows: = 'L': op( A )*X = alpha*B; = 'R': X*op( A ) = alpha*B. UPLO CHARACTER*1 Specifies whether the matrix A is an upper or lower triangular matrix as follows: = 'U': A is an upper triangular matrix; = 'L': A is a lower triangular matrix. TRANS CHARACTER*1 Specifies the form of op( A ) to be used in the matrix multiplication as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'. DIAG CHARACTER*1 Specifies whether or not A is unit triangular as follows: = 'U': A is assumed to be unit triangular; = 'N': A is not assumed to be unit triangular. NORM CHARACTER*1 Specifies whether the 1-norm condition number or the infinity-norm condition number is required: = '1' or 'O': 1-norm; = 'I': Infinity-norm.Input/Output Parameters
M (input) INTEGER The number of rows of B. M >= 0. N (input) INTEGER The number of columns of B. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then A is not referenced and B need not be set before entry. A (input) DOUBLE PRECISION array, dimension (LDA,k), where k is M when SIDE = 'L' and is N when SIDE = 'R'. On entry with UPLO = 'U', the leading k-by-k upper triangular part of this array must contain the upper triangular matrix and the strictly lower triangular part of A is not referenced. On entry with UPLO = 'L', the leading k-by-k lower triangular part of this array must contain the lower triangular matrix and the strictly upper triangular part of A is not referenced. Note that when DIAG = 'U', the diagonal elements of A are not referenced either, but are assumed to be unity. LDA INTEGER The leading dimension of array A. LDA >= max(1,M) when SIDE = 'L'; LDA >= max(1,N) when SIDE = 'R'. B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading M-by-N part of this array must contain the right-hand side matrix B. On exit, if INFO = 0, the leading M-by-N part of this array contains the solution matrix X. Otherwise, this array is not modified by the routine. LDB INTEGER The leading dimension of array B. LDB >= max(1,M). RCOND (output) DOUBLE PRECISION The reciprocal of the condition number of the matrix A, computed as RCOND = 1/(norm(A) * norm(inv(A))).Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity of the matrix A. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number of that matrix; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = k*k*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (k) DWORK DOUBLE PRECISION array, dimension (3*k)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the matrix A is numerically singular, i.e. the condition number estimate of A (in the specified norm) exceeds 1/TOL.Method
An estimate of the reciprocal of the condition number of the triangular matrix A (in the specified norm) is computed, and if this estimate is larger then the given (or default) tolerance, the specified matrix equation is solved using Level 3 BLAS routine DTRSM.References
None.Numerical Aspects
2 The algorithm requires k N/2 operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02PD.html 0000664 0000000 0000000 00000033441 14560147231 0020343 0 ustar 00root root 0000000 0000000
Purpose
To solve (if well-conditioned) the matrix equations op( A )*X = B, where X and B are N-by-NRHS matrices, A is an N-by-N matrix and op( A ) is one of op( A ) = A or op( A ) = A'. Error bounds on the solution and a condition estimate are also provided.Specification
SUBROUTINE MB02PD( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, $ EQUED, R, C, B, LDB, X, LDX, RCOND, FERR, BERR, $ IWORK, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUED, FACT, TRANS INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS DOUBLE PRECISION RCOND C .. Array Arguments .. INTEGER IPIV( * ), IWORK( * ) DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), B( LDB, * ), $ BERR( * ), C( * ), DWORK( * ), FERR( * ), $ R( * ), X( LDX, * )Arguments
Mode Parameters
FACT CHARACTER*1 Specifies whether or not the factored form of the matrix A is supplied on entry, and if not, whether the matrix A should be equilibrated before it is factored. = 'F': On entry, AF and IPIV contain the factored form of A. If EQUED is not 'N', the matrix A has been equilibrated with scaling factors given by R and C. A, AF, and IPIV are not modified. = 'N': The matrix A will be copied to AF and factored. = 'E': The matrix A will be equilibrated if necessary, then copied to AF and factored. TRANS CHARACTER*1 Specifies the form of the system of equations as follows: = 'N': A * X = B (No transpose); = 'T': A**T * X = B (Transpose); = 'C': A**H * X = B (Transpose).Input/Output Parameters
N (input) INTEGER The number of linear equations, i.e., the order of the matrix A. N >= 0. NRHS (input) INTEGER The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 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. If FACT = 'F' and EQUED is not 'N', then A must have been equilibrated by the scaling factors in R and/or C. A is not modified if FACT = 'F' or 'N', or if FACT = 'E' and EQUED = 'N' on exit. On exit, if EQUED .NE. 'N', the leading N-by-N part of this array contains the matrix A scaled as follows: EQUED = 'R': A := diag(R) * A; EQUED = 'C': A := A * diag(C); EQUED = 'B': A := diag(R) * A * diag(C). LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). AF (input or output) DOUBLE PRECISION array, dimension (LDAF,N) If FACT = 'F', then AF is an input argument and on entry the leading N-by-N part of this array must contain the factors L and U from the factorization A = P*L*U as computed by DGETRF. If EQUED .NE. 'N', then AF is the factored form of the equilibrated matrix A. If FACT = 'N', then AF is an output argument and on exit the leading N-by-N part of this array contains the factors L and U from the factorization A = P*L*U of the original matrix A. If FACT = 'E', then AF is an output argument and on exit the leading N-by-N part of this array contains the factors L and U from the factorization A = P*L*U of the equilibrated matrix A (see the description of A for the form of the equilibrated matrix). LDAF (input) INTEGER The leading dimension of the array AF. LDAF >= max(1,N). IPIV (input or output) INTEGER array, dimension (N) If FACT = 'F', then IPIV is an input argument and on entry it must contain the pivot indices from the factorization A = P*L*U as computed by DGETRF; row i of the matrix was interchanged with row IPIV(i). If FACT = 'N', then IPIV is an output argument and on exit it contains the pivot indices from the factorization A = P*L*U of the original matrix A. If FACT = 'E', then IPIV is an output argument and on exit it contains the pivot indices from the factorization A = P*L*U of the equilibrated matrix A. EQUED (input or output) CHARACTER*1 Specifies the form of equilibration that was done as follows: = 'N': No equilibration (always true if FACT = 'N'); = 'R': Row equilibration, i.e., A has been premultiplied by diag(R); = 'C': Column equilibration, i.e., A has been postmultiplied by diag(C); = 'B': Both row and column equilibration, i.e., A has been replaced by diag(R) * A * diag(C). EQUED is an input argument if FACT = 'F'; otherwise, it is an output argument. R (input or output) DOUBLE PRECISION array, dimension (N) The row scale factors for A. If EQUED = 'R' or 'B', A is multiplied on the left by diag(R); if EQUED = 'N' or 'C', R is not accessed. R is an input argument if FACT = 'F'; otherwise, R is an output argument. If FACT = 'F' and EQUED = 'R' or 'B', each element of R must be positive. C (input or output) DOUBLE PRECISION array, dimension (N) The column scale factors for A. If EQUED = 'C' or 'B', A is multiplied on the right by diag(C); if EQUED = 'N' or 'R', C is not accessed. C is an input argument if FACT = 'F'; otherwise, C is an output argument. If FACT = 'F' and EQUED = 'C' or 'B', each element of C must be positive. B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) On entry, the leading N-by-NRHS part of this array must contain the right-hand side matrix B. On exit, if EQUED = 'N', B is not modified; if TRANS = 'N' and EQUED = 'R' or 'B', the leading N-by-NRHS part of this array contains diag(R)*B; if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', the leading N-by-NRHS part of this array contains diag(C)*B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). X (output) DOUBLE PRECISION array, dimension (LDX,NRHS) If INFO = 0 or INFO = N+1, the leading N-by-NRHS part of this array contains the solution matrix X to the original system of equations. Note that A and B are modified on exit if EQUED .NE. 'N', and the solution to the equilibrated system is inv(diag(C))*X if TRANS = 'N' and EQUED = 'C' or 'B', or inv(diag(R))*X if TRANS = 'T' or 'C' and EQUED = 'R' or 'B'. LDX (input) INTEGER The leading dimension of the array X. LDX >= max(1,N). RCOND (output) DOUBLE PRECISION The estimate of the reciprocal condition number of the matrix A after equilibration (if done). If RCOND is less than the machine precision (in particular, if RCOND = 0), the matrix is singular to working precision. This condition is indicated by a return code of INFO > 0. For efficiency reasons, RCOND is computed only when the matrix A is factored, i.e., for FACT = 'N' or 'E'. For FACT = 'F', RCOND is not used, but it is assumed that it has been computed and checked before the routine call. FERR (output) DOUBLE PRECISION array, dimension (NRHS) The estimated forward error bound for each solution vector X(j) (the j-th column of the solution matrix X). If XTRUE is the true solution corresponding to X(j), FERR(j) is an estimated upper bound for the magnitude of the largest element in (X(j) - XTRUE) divided by the magnitude of the largest element in X(j). The estimate is as reliable as the estimate for RCOND, and is almost always a slight overestimate of the true error. BERR (output) DOUBLE PRECISION array, dimension (NRHS) The componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution).Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (4*N) On entry, if FACT = 'F', DWORK(1) contains the reciprocal pivot growth factor norm(A)/norm(U), computed previously by this routine, with FACT <> 'N', for the same matrix A. On exit, DWORK(1) contains the reciprocal pivot growth factor norm(A)/norm(U). The "max absolute element" norm is used. If DWORK(1) is much less than 1, then the stability of the LU factorization of the (equilibrated) matrix A could be poor. This also means that the solution X, condition estimator RCOND, and forward error bound FERR could be unreliable. If factorization fails with 0 < INFO <= N, then DWORK(1) contains the reciprocal pivot growth factor for the leading INFO columns of A.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, and i is <= N: U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution and error bounds could not be computed. RCOND = 0 is returned. = N+1: U is nonsingular, but RCOND is less than machine precision, meaning that the matrix is singular to working precision. Nevertheless, the solution and error bounds are computed because there are a number of situations where the computed solution can be more accurate than the value of RCOND would suggest. The positive values for INFO are set only when the matrix A is factored, i.e., for FACT = 'N' or 'E'.Method
The following steps are performed: 1. If FACT = 'E', real scaling factors are computed to equilibrate the system: TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B Whether or not the system will be equilibrated depends on the scaling of the matrix A, but if equilibration is used, A is overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N') or diag(C)*B (if TRANS = 'T' or 'C'). 2. If FACT = 'N' or 'E', the LU decomposition is used to factor the matrix A (after equilibration if FACT = 'E') as A = P * L * U, where P is a permutation matrix, L is a unit lower triangular matrix, and U is upper triangular. 3. If some U(i,i)=0, so that U is exactly singular, then the routine returns with INFO = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A. If the reciprocal of the condition number is less than machine precision, INFO = N+1 is returned as a warning, but the routine still goes on to solve for X and compute error bounds as described below. 4. The system of equations is solved for X using the factored form of A. 5. Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it. 6. If equilibration was used, the matrix X is premultiplied by diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so that it solves the original system before equilibration.References
[1] Anderson, E., Bai, Z., Bischof, C., Demmel, J., Dongarra, J., Du Croz, J., Greenbaum, A., Hammarling, S., McKenney, A., Ostrouchov, S., Sorensen, D. LAPACK Users' Guide: Second Edition, SIAM, Philadelphia, 1995.Further Comments
This is a simplified version of the LAPACK Library routine DGESVX, useful when several sets of matrix equations with the same coefficient matrix A and/or A' should be solved.Numerical Aspects
3 The algorithm requires 0(N ) operations.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02QD.html 0000664 0000000 0000000 00000031611 14560147231 0020341 0 ustar 00root root 0000000 0000000
Purpose
To compute a solution, optionally corresponding to specified free elements, to a real linear least squares problem: minimize || A * X - B || using a complete orthogonal factorization of the M-by-N matrix A, which may be rank-deficient. Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix X.Specification
SUBROUTINE MB02QD( JOB, INIPER, M, N, NRHS, RCOND, SVLMAX, A, LDA, $ B, LDB, Y, JPVT, RANK, SVAL, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER INIPER, JOB INTEGER INFO, LDA, LDB, LDWORK, M, N, NRHS, RANK DOUBLE PRECISION RCOND, SVLMAX C .. Array Arguments .. INTEGER JPVT( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), $ SVAL( 3 ), Y ( * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies whether or not a standard least squares solution must be computed, as follows: = 'L': Compute a standard least squares solution (Y = 0); = 'F': Compute a solution with specified free elements (given in Y). INIPER CHARACTER*1 Specifies whether an initial column permutation, defined by JPVT, must be performed, as follows: = 'P': Perform an initial column permutation; = 'N': Do not perform an initial column permutation.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. NRHS (input) INTEGER The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0. RCOND (input) DOUBLE PRECISION RCOND is used to determine the effective rank of A, which is defined as the order of the largest leading triangular submatrix R11 in the QR factorization with pivoting of A, whose estimated condition number is less than 1/RCOND. 0 <= RCOND <= 1. SVLMAX (input) DOUBLE PRECISION If A is a submatrix of another matrix C, and the rank decision should be related to that matrix, then SVLMAX should be an estimate of the largest singular value of C (for instance, the Frobenius norm of C). If this is not the case, the input value SVLMAX = 0 should work. SVLMAX >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M-by-N part of this array must contain the given matrix A. On exit, the leading M-by-N part of this array contains details of its complete orthogonal factorization: the leading RANK-by-RANK upper triangular part contains the upper triangular factor T11 (see METHOD); the elements below the diagonal, with the entries 2 to min(M,N)+1 of the array DWORK, represent the orthogonal matrix Q as a product of min(M,N) elementary reflectors (see METHOD); the elements of the subarray A(1:RANK,RANK+1:N), with the next RANK entries of the array DWORK, represent the orthogonal matrix Z as a product of RANK elementary reflectors (see METHOD). LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) On entry, the leading M-by-NRHS part of this array must contain the right hand side matrix B. On exit, the leading N-by-NRHS part of this array contains the solution matrix X. If M >= N and RANK = N, the residual sum-of-squares for the solution in the i-th column is given by the sum of squares of elements N+1:M in that column. If NRHS = 0, this array is not referenced, and the routine returns the effective rank of A, and its QR factorization. LDB INTEGER The leading dimension of the array B. LDB >= max(1,M,N). Y (input) DOUBLE PRECISION array, dimension ( N*NRHS ) If JOB = 'F', the elements Y(1:(N-RANK)*NRHS) are used as free elements in computing the solution (see METHOD). The remaining elements are not referenced. If JOB = 'L', or NRHS = 0, this array is not referenced. JPVT (input/output) INTEGER array, dimension (N) On entry with INIPER = 'P', if JPVT(i) <> 0, the i-th column of A is an initial column, otherwise it is a free column. Before the QR factorization of A, all initial columns are permuted to the leading positions; only the remaining free columns are moved as a result of column pivoting during the factorization. If INIPER = 'N', JPVT need not be set on entry. On exit, if JPVT(i) = k, then the i-th column of A*P was the k-th column of A. RANK (output) INTEGER The effective rank of A, i.e., the order of the submatrix R11. This is the same as the order of the submatrix T11 in the complete orthogonal factorization of A. SVAL (output) DOUBLE PRECISION array, dimension ( 3 ) The estimates of some of the singular values of the triangular factor R11: SVAL(1): largest singular value of R(1:RANK,1:RANK); SVAL(2): smallest singular value of R(1:RANK,1:RANK); SVAL(3): smallest singular value of R(1:RANK+1,1:RANK+1), if RANK < MIN( M, N ), or of R(1:RANK,1:RANK), otherwise. If the triangular factorization is a rank-revealing one (which will be the case if the leading columns were well- conditioned), then SVAL(1) will also be an estimate for the largest singular value of A, and SVAL(2) and SVAL(3) will be estimates for the RANK-th and (RANK+1)-st singular values of A, respectively. By examining these values, one can confirm that the rank is well defined with respect to the chosen value of RCOND. The ratio SVAL(1)/SVAL(2) is an estimate of the condition number of R(1:RANK,1:RANK).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and the entries 2 to min(M,N) + RANK + 1 contain the scalar factors of the elementary reflectors used in the complete orthogonal factorization of A. Among the entries 2 to min(M,N) + 1, only the first RANK elements are useful, if INIPER = 'N'. LDWORK INTEGER The length of the array DWORK. LDWORK >= max( min(M,N)+3*N+1, 2*min(M,N)+NRHS ) For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
If INIPER = 'P', the routine first computes a QR factorization with column pivoting: A * P = Q * [ R11 R12 ] [ 0 R22 ] with R11 defined as the largest leading submatrix whose estimated condition number is less than 1/RCOND. The order of R11, RANK, is the effective rank of A. If INIPER = 'N', the effective rank is estimated during a truncated QR factorization (with column pivoting) process, and the submatrix R22 is not upper triangular, but full and of small norm. (See SLICOT Library routines MB03OD or MB03OY, respectively, for further details.) Then, R22 is considered to be negligible, and R12 is annihilated by orthogonal transformations from the right, arriving at the complete orthogonal factorization: A * P = Q * [ T11 0 ] * Z [ 0 0 ] The solution is then X = P * Z' [ inv(T11)*Q1'*B ] [ Y ] where Q1 consists of the first RANK columns of Q, and Y contains free elements (if JOB = 'F'), or is zero (if JOB = 'L').Numerical Aspects
The algorithm is backward stable.Further Comments
Significant gain in efficiency is possible for small-rank problems using truncated QR factorization (option INIPER = 'N').Example
Program Text
* MB02QD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, NRHSMX PARAMETER ( NMAX = 20, MMAX = 20, NRHSMX = 20 ) INTEGER LDA, LDB PARAMETER ( LDA = MMAX, LDB = MAX( MMAX, NMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( MIN( MMAX, NMAX) + 3*NMAX + 1, $ 2*MIN( MMAX, NMAX) + NRHSMX ) ) * .. Local Scalars .. DOUBLE PRECISION RCOND, SVLMAX INTEGER I, INFO, J, M, N, NRHS, RANK CHARACTER*1 INIPER, JOB * .. Local Arrays .. INTEGER JPVT(NMAX) DOUBLE PRECISION A(LDA,NMAX), B(LDB,NRHSMX), DWORK(LDWORK), $ SVAL(3), Y(NMAX*NRHSMX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB02QD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, NRHS, RCOND, SVLMAX, JOB, INIPER IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99994 ) M ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE IF ( NRHS.LT.0 .OR. NRHS.GT.NRHSMX ) THEN WRITE ( NOUT, FMT = 99992 ) NRHS ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,M ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,NRHS ), I = 1,M ) IF ( LSAME( JOB, 'F' ) ) $ READ ( NIN, FMT = * ) ( Y(I), I = 1,N*NRHS ) IF ( LSAME( INIPER, 'P' ) ) $ READ ( NIN, FMT = * ) ( JPVT(I), I = 1,N ) * Find the least squares solution. CALL MB02QD( JOB, INIPER, M, N, NRHS, RCOND, SVLMAX, A, $ LDA, B, LDB, Y, JPVT, RANK, SVAL, DWORK, $ LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) RANK, SVAL WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,NRHS ) 10 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' MB02QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02QD =',I2) 99997 FORMAT (' The effective rank of A =',I2,/ $ ' Estimates of the singular values SVAL = '/3(1X,F8.4)) 99996 FORMAT (' The least squares solution is') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' M is out of range.',/' M = ',I5) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' NRHS is out of range.',/' NRHS = ',I5) ENDProgram Data
MB02QD EXAMPLE PROGRAM DATA 4 3 2 2.3D-16 0.0 L N 2.0 2.0 -3.0 3.0 3.0 -1.0 4.0 4.0 -5.0 -1.0 -1.0 -2.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0Program Results
MB02QD EXAMPLE PROGRAM RESULTS The effective rank of A = 2 Estimates of the singular values SVAL = 7.8659 2.6698 0.0000 The least squares solution is -0.0034 -0.1054 -0.0034 -0.1054 -0.0816 -0.1973
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02QY.html 0000664 0000000 0000000 00000014120 14560147231 0020362 0 ustar 00root root 0000000 0000000
Purpose
To determine the minimum-norm solution to a real linear least squares problem: minimize || A * X - B ||, using the rank-revealing QR factorization of a real general M-by-N matrix A, computed by SLICOT Library routine MB03OD.Specification
SUBROUTINE MB02QY( M, N, NRHS, RANK, A, LDA, JPVT, B, LDB, TAU, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDWORK, M, N, NRHS, RANK C .. Array Arguments .. INTEGER JPVT( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), TAU( * )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrices A and B. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. NRHS (input) INTEGER The number of columns of the matrix B. NRHS >= 0. RANK (input) INTEGER The effective rank of A, as returned by SLICOT Library routine MB03OD. min(M,N) >= RANK >= 0. A (input/output) DOUBLE PRECISION array, dimension ( LDA, N ) On entry, the leading min(M,N)-by-N upper trapezoidal part of this array contains the triangular factor R, as returned by SLICOT Library routine MB03OD. The strict lower trapezoidal part of A is not referenced. On exit, if RANK < N, the leading RANK-by-RANK upper triangular part of this array contains the upper triangular matrix R of the complete orthogonal factorization of A, and the submatrix (1:RANK,RANK+1:N) of this array, with the array TAU, represent the orthogonal matrix Z (of the complete orthogonal factorization of A), as a product of RANK elementary reflectors. On exit, if RANK = N, this array is unchanged. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). JPVT (input) INTEGER array, dimension ( N ) The recorded permutations performed by SLICOT Library routine MB03OD; if JPVT(i) = k, then the i-th column of A*P was the k-th column of the original matrix A. B (input/output) DOUBLE PRECISION array, dimension ( LDB, NRHS ) On entry, if NRHS > 0, the leading M-by-NRHS part of this array must contain the matrix B (corresponding to the transformed matrix A, returned by SLICOT Library routine MB03OD). On exit, if NRHS > 0, the leading N-by-NRHS part of this array contains the solution matrix X. If M >= N and RANK = N, the residual sum-of-squares for the solution in the i-th column is given by the sum of squares of elements N+1:M in that column. If NRHS = 0, the array B is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= max(1,M,N), if NRHS > 0. LDB >= 1, if NRHS = 0. TAU (output) DOUBLE PRECISION array, dimension ( min(M,N) ) The scalar factors of the elementary reflectors. If RANK = N, the array TAU is not referenced.Workspace
DWORK DOUBLE PRECISION array, dimension ( LDWORK ) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= max( 1, N, NRHS ). For good performance, LDWORK should sometimes 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine uses a QR factorization with column pivoting: A * P = Q * R = Q * [ R11 R12 ], [ 0 R22 ] where R11 is an upper triangular submatrix of estimated rank RANK, the effective rank of A. The submatrix R22 can be considered as negligible. If RANK < N, then R12 is annihilated by orthogonal transformations from the right, arriving at the complete orthogonal factorization: A * P = Q * [ T11 0 ] * Z. [ 0 0 ] The minimum-norm solution is then X = P * Z' [ inv(T11)*Q1'*B ], [ 0 ] where Q1 consists of the first RANK columns of Q. The input data for MB02QY are the transformed matrices Q' * A (returned by SLICOT Library routine MB03OD) and Q' * B. Matrix Q is not needed.Numerical Aspects
The implemented method is numerically stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve a system of linear equations H * X = B or H' * X = B with an upper Hessenberg N-by-N matrix H using the LU factorization computed by MB02SD.Specification
SUBROUTINE MB02RD( TRANS, N, NRHS, H, LDH, IPIV, B, LDB, INFO ) C .. Scalar Arguments .. CHARACTER TRANS INTEGER INFO, LDB, LDH, N, NRHS C .. Array Arguments .. INTEGER IPIV( * ) DOUBLE PRECISION B( LDB, * ), H( LDH, * )Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies the form of the system of equations: = 'N': H * X = B (No transpose) = 'T': H'* X = B (Transpose) = 'C': H'* X = B (Conjugate transpose = Transpose)Input/Output Parameters
N (input) INTEGER The order of the matrix H. N >= 0. NRHS (input) INTEGER The number of right hand sides, i.e., the number of columns of the matrix B. NRHS >= 0. H (input) DOUBLE PRECISION array, dimension (LDH,N) The factors L and U from the factorization H = P*L*U as computed by MB02SD. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). IPIV (input) INTEGER array, dimension (N) The pivot indices from MB02SD; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i). B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) On entry, the right hand side matrix B. On exit, the solution matrix X. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N).Error Indicator
INFO (output) INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine uses the factorization H = P * L * U where P is a permutation matrix, L is lower triangular with unit diagonal elements (and one nonzero subdiagonal), and U is upper triangular.References
-Numerical Aspects
2 The algorithm requires 0( N x NRHS ) operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02RZ.html 0000664 0000000 0000000 00000006500 14560147231 0020367 0 ustar 00root root 0000000 0000000
Purpose
To solve a system of linear equations H * X = B, H' * X = B or H**H * X = B with a complex upper Hessenberg N-by-N matrix H using the LU factorization computed by MB02SZ.Specification
SUBROUTINE MB02RZ( TRANS, N, NRHS, H, LDH, IPIV, B, LDB, INFO ) C .. Scalar Arguments .. CHARACTER TRANS INTEGER INFO, LDB, LDH, N, NRHS C .. Array Arguments .. INTEGER IPIV( * ) COMPLEX*16 B( LDB, * ), H( LDH, * )Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies the form of the system of equations: = 'N': H * X = B (No transpose) = 'T': H'* X = B (Transpose) = 'C': H**H * X = B (Conjugate transpose)Input/Output Parameters
N (input) INTEGER The order of the matrix H. N >= 0. NRHS (input) INTEGER The number of right hand sides, i.e., the number of columns of the matrix B. NRHS >= 0. H (input) COMPLEX*16 array, dimension (LDH,N) The factors L and U from the factorization H = P*L*U as computed by MB02SZ. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). IPIV (input) INTEGER array, dimension (N) The pivot indices from MB02SZ; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i). B (input/output) COMPLEX*16 array, dimension (LDB,NRHS) On entry, the right hand side matrix B. On exit, the solution matrix X. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). INFO (output) INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine uses the factorization H = P * L * U where P is a permutation matrix, L is lower triangular with unit diagonal elements (and one nonzero subdiagonal), and U is upper triangular.References
-Numerical Aspects
2 The algorithm requires 0( N x NRHS ) complex operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02SD.html 0000664 0000000 0000000 00000014623 14560147231 0020347 0 ustar 00root root 0000000 0000000
Purpose
To compute an LU factorization of an n-by-n upper Hessenberg matrix H using partial pivoting with row interchanges.Specification
SUBROUTINE MB02SD( N, H, LDH, IPIV, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDH, N C .. Array Arguments .. INTEGER IPIV(*) DOUBLE PRECISION H(LDH,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix H. N >= 0. H (input/output) DOUBLE PRECISION array, dimension (LDH,N) On entry, the n-by-n upper Hessenberg matrix to be factored. On exit, the factors L and U from the factorization H = P*L*U; the unit diagonal elements of L are not stored, and L is lower bidiagonal. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). IPIV (output) INTEGER array, dimension (N) The pivot indices; for 1 <= i <= N, row i of the matrix was interchanged with row IPIV(i).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.Method
The factorization has the form H = P * L * U where P is a permutation matrix, L is lower triangular with unit diagonal elements (and one nonzero subdiagonal), and U is upper triangular. This is the right-looking Level 1 BLAS version of the algorithm (adapted after DGETF2).References
-Numerical Aspects
2 The algorithm requires 0( N ) operations.Further Comments
NoneExample
Program Text
* MB02SD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, NRHMAX PARAMETER ( NMAX = 20, NRHMAX = 20 ) INTEGER LDB, LDH PARAMETER ( LDB = NMAX, LDH = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX ) * .. Local Scalars .. DOUBLE PRECISION HNORM, RCOND INTEGER I, INFO, INFO1, J, N, NRHS CHARACTER*1 NORM, TRANS * .. Local Arrays .. DOUBLE PRECISION H(LDH,NMAX), B(LDB,NRHMAX), DWORK(LDWORK) INTEGER IPIV(NMAX), IWORK(LIWORK) * .. External Functions .. DOUBLE PRECISION DLAMCH, DLANHS EXTERNAL DLAMCH, DLANHS * .. External Subroutines .. EXTERNAL DLASET, MB02RD, MB02SD, MB02TD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, NRHS, NORM, TRANS IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( H(I,J), J = 1,N ), I = 1,N ) IF ( NRHS.LT.0 .OR. NRHS.GT.NRHMAX ) THEN WRITE ( NOUT, FMT = 99993 ) NRHS ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,NRHS ), I = 1,N ) IF ( N.GT.2 ) $ CALL DLASET( 'Lower', N-2, N-2, ZERO, ZERO, H(3,1), LDH ) * Compute the LU factorization of the upper Hessenberg matrix. CALL MB02SD( N, H, LDH, IPIV, INFO ) * Estimate the reciprocal condition number of the matrix. HNORM = DLANHS( NORM, N, H, LDH, DWORK ) CALL MB02TD( NORM, N, HNORM, H, LDH, IPIV, RCOND, IWORK, $ DWORK, INFO1 ) IF ( INFO.EQ.0 .AND. RCOND.GT.DLAMCH( 'Epsilon' ) ) THEN * Solve the linear system. CALL MB02RD( TRANS, N, NRHS, H, LDH, IPIV, B, LDB, INFO ) * WRITE ( NOUT, FMT = 99997 ) ELSE WRITE ( NOUT, FMT = 99998 ) INFO END IF DO 10 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,NRHS ) 10 CONTINUE WRITE ( NOUT, FMT = 99995 ) RCOND END IF END IF STOP * 99999 FORMAT (' MB02SD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02SD = ',I2) 99997 FORMAT (' The solution matrix is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' Reciprocal condition number = ',D12.4) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' NRHS is out of range.',/' NRHS = ',I5) ENDProgram Data
MB02SD EXAMPLE PROGRAM DATA 5 4 O N 1. 2. 6. 3. 5. -2. -1. -1. 0. -2. 0. 3. 1. 5. 1. 0. 0. 2. 0. -4. 0. 0. 0. 1. 4. 5. 5. 1. 5. -2. 1. 3. 1. 0. 0. 4. 5. 2. 1. 1. 3. -1. 3. 3. 1.Program Results
MB02SD EXAMPLE PROGRAM RESULTS The solution matrix is 0.0435 1.2029 1.6377 1.1014 1.0870 -4.4275 -5.5580 -2.9638 0.9130 0.7609 -0.1087 0.6304 -0.8261 2.4783 4.2174 2.7391 -0.0435 0.1304 -0.3043 -0.4348 Reciprocal condition number = 0.1554D-01
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02SZ.html 0000664 0000000 0000000 00000006054 14560147231 0020374 0 ustar 00root root 0000000 0000000
Purpose
To compute an LU factorization of a complex n-by-n upper Hessenberg matrix H using partial pivoting with row interchanges.Specification
SUBROUTINE MB02SZ( N, H, LDH, IPIV, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDH, N C .. Array Arguments .. INTEGER IPIV(*) COMPLEX*16 H(LDH,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix H. N >= 0. H (input/output) COMPLEX*16 array, dimension (LDH,N) On entry, the n-by-n upper Hessenberg matrix to be factored. On exit, the factors L and U from the factorization H = P*L*U; the unit diagonal elements of L are not stored, and L is lower bidiagonal. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). IPIV (output) INTEGER array, dimension (N) The pivot indices; for 1 <= i <= N, row i of the matrix was interchanged with row IPIV(i).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.Method
The factorization has the form H = P * L * U where P is a permutation matrix, L is lower triangular with unit diagonal elements (and one nonzero subdiagonal), and U is upper triangular. This is the right-looking Level 2 BLAS version of the algorithm (adapted after ZGETF2).References
-Numerical Aspects
2 The algorithm requires 0( N ) complex operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02TD.html 0000664 0000000 0000000 00000006632 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To estimate the reciprocal of the condition number of an upper Hessenberg matrix H, in either the 1-norm or the infinity-norm, using the LU factorization computed by MB02SD.Specification
SUBROUTINE MB02TD( NORM, N, HNORM, H, LDH, IPIV, RCOND, IWORK, $ DWORK, INFO ) C .. Scalar Arguments .. CHARACTER NORM INTEGER INFO, LDH, N DOUBLE PRECISION HNORM, RCOND C .. Array Arguments .. INTEGER IPIV( * ), IWORK( * ) DOUBLE PRECISION DWORK( * ), H( LDH, * )Arguments
Mode Parameters
NORM CHARACTER*1 Specifies whether the 1-norm condition number or the infinity-norm condition number is required: = '1' or 'O': 1-norm; = 'I': Infinity-norm.Input/Output Parameters
N (input) INTEGER The order of the matrix H. N >= 0. HNORM (input) DOUBLE PRECISION If NORM = '1' or 'O', the 1-norm of the original matrix H. If NORM = 'I', the infinity-norm of the original matrix H. H (input) DOUBLE PRECISION array, dimension (LDH,N) The factors L and U from the factorization H = P*L*U as computed by MB02SD. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). IPIV (input) INTEGER array, dimension (N) The pivot indices; for 1 <= i <= N, row i of the matrix was interchanged with row IPIV(i). RCOND (output) DOUBLE PRECISION The reciprocal of the condition number of the matrix H, computed as RCOND = 1/(norm(H) * norm(inv(H))).Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (3*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
An estimate is obtained for norm(inv(H)), and the reciprocal of the condition number is computed as RCOND = 1 / ( norm(H) * norm(inv(H)) ).References
-Numerical Aspects
2 The algorithm requires 0( N ) operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02TZ.html 0000664 0000000 0000000 00000006703 14560147231 0020376 0 ustar 00root root 0000000 0000000
Purpose
To estimate the reciprocal of the condition number of a complex upper Hessenberg matrix H, in either the 1-norm or the infinity-norm, using the LU factorization computed by MB02SZ.Specification
SUBROUTINE MB02TZ( NORM, N, HNORM, H, LDH, IPIV, RCOND, DWORK, $ ZWORK, INFO ) C .. Scalar Arguments .. CHARACTER NORM INTEGER INFO, LDH, N DOUBLE PRECISION HNORM, RCOND C .. Array Arguments .. INTEGER IPIV(*) DOUBLE PRECISION DWORK( * ) COMPLEX*16 H( LDH, * ), ZWORK( * )Arguments
Mode Parameters
NORM CHARACTER*1 Specifies whether the 1-norm condition number or the infinity-norm condition number is required: = '1' or 'O': 1-norm; = 'I': Infinity-norm.Input/Output Parameters
N (input) INTEGER The order of the matrix H. N >= 0. HNORM (input) DOUBLE PRECISION If NORM = '1' or 'O', the 1-norm of the original matrix H. If NORM = 'I', the infinity-norm of the original matrix H. H (input) COMPLEX*16 array, dimension (LDH,N) The factors L and U from the factorization H = P*L*U as computed by MB02SZ. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). IPIV (input) INTEGER array, dimension (N) The pivot indices; for 1 <= i <= N, row i of the matrix was interchanged with row IPIV(i). RCOND (output) DOUBLE PRECISION The reciprocal of the condition number of the matrix H, computed as RCOND = 1/(norm(H) * norm(inv(H))).Workspace
DWORK DOUBLE PRECISION array, dimension (N) ZWORK COMPLEX*16 array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
An estimate is obtained for norm(inv(H)), and the reciprocal of the condition number is computed as RCOND = 1 / ( norm(H) * norm(inv(H)) ).References
-Numerical Aspects
2 The algorithm requires 0( N ) complex operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02UD.html 0000664 0000000 0000000 00000023340 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To compute the minimum norm least squares solution of one of the following linear systems op(R)*X = alpha*B, (1) X*op(R) = alpha*B, (2) where alpha is a real scalar, op(R) is either R or its transpose, R', R is an L-by-L real upper triangular matrix, B is an M-by-N real matrix, and L = M for (1), or L = N for (2). Singular value decomposition, R = Q*S*P', is used, assuming that R is rank deficient.Specification
SUBROUTINE MB02UD( FACT, SIDE, TRANS, JOBP, M, N, ALPHA, RCOND, $ RANK, R, LDR, Q, LDQ, SV, B, LDB, RP, LDRP, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER FACT, JOBP, SIDE, TRANS INTEGER INFO, LDB, LDQ, LDR, LDRP, LDWORK, M, N, RANK DOUBLE PRECISION ALPHA, RCOND C .. Array Arguments .. DOUBLE PRECISION B(LDB,*), DWORK(*), Q(LDQ,*), R(LDR,*), $ RP(LDRP,*), SV(*)Arguments
Mode Parameters
FACT CHARACTER*1 Specifies whether R has been previously factored or not, as follows: = 'F': R has been factored and its rank and singular value decomposition, R = Q*S*P', are available; = 'N': R has not been factored and its singular value decomposition, R = Q*S*P', should be computed. SIDE CHARACTER*1 Specifies whether op(R) appears on the left or right of X as follows: = 'L': Solve op(R)*X = alpha*B (op(R) is on the left); = 'R': Solve X*op(R) = alpha*B (op(R) is on the right). TRANS CHARACTER*1 Specifies the form of op(R) to be used as follows: = 'N': op(R) = R; = 'T': op(R) = R'; = 'C': op(R) = R'. JOBP CHARACTER*1 Specifies whether or not the pseudoinverse of R is to be computed or it is available as follows: = 'P': Compute pinv(R), if FACT = 'N', or use pinv(R), if FACT = 'F'; = 'N': Do not compute or use pinv(R).Input/Output Parameters
M (input) INTEGER The number of rows of the matrix B. M >= 0. N (input) INTEGER The number of columns of the matrix B. N >= 0. ALPHA (input) DOUBLE PRECISION The scalar alpha. When alpha is zero then B need not be set before entry. RCOND (input) DOUBLE PRECISION RCOND is used to determine the effective rank of R. Singular values of R satisfying Sv(i) <= RCOND*Sv(1) are treated as zero. If RCOND <= 0, then EPS is used instead, where EPS is the relative machine precision (see LAPACK Library routine DLAMCH). RCOND <= 1. RCOND is not used if FACT = 'F'. RANK (input or output) INTEGER The rank of matrix R. RANK is an input parameter when FACT = 'F', and an output parameter when FACT = 'N'. L >= RANK >= 0. R (input/output) DOUBLE PRECISION array, dimension (LDR,L) On entry, if FACT = 'F', the leading L-by-L part of this array must contain the L-by-L orthogonal matrix P' from singular value decomposition, R = Q*S*P', of the matrix R; if JOBP = 'P', the first RANK rows of P' are assumed to be scaled by inv(S(1:RANK,1:RANK)). On entry, if FACT = 'N', the leading L-by-L upper triangular part of this array must contain the upper triangular matrix R. On exit, if INFO = 0, the leading L-by-L part of this array contains the L-by-L orthogonal matrix P', with its first RANK rows scaled by inv(S(1:RANK,1:RANK)), when JOBP = 'P'. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,L). Q (input or output) DOUBLE PRECISION array, dimension (LDQ,L) On entry, if FACT = 'F', the leading L-by-L part of this array must contain the L-by-L orthogonal matrix Q from singular value decomposition, R = Q*S*P', of the matrix R. If FACT = 'N', this array need not be set on entry, and on exit, if INFO = 0, the leading L-by-L part of this array contains the orthogonal matrix Q. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,L). SV (input or output) DOUBLE PRECISION array, dimension (L) On entry, if FACT = 'F', the first RANK entries of this array must contain the reciprocal of the largest RANK singular values of the matrix R, and the last L-RANK entries of this array must contain the remaining singular values of R sorted in descending order. If FACT = 'N', this array need not be set on input, and on exit, if INFO = 0, the first RANK entries of this array contain the reciprocal of the largest RANK singular values of the matrix R, and the last L-RANK entries of this array contain the remaining singular values of R sorted in descending order. B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, if ALPHA <> 0, the leading M-by-N part of this array must contain the matrix B. On exit, if INFO = 0 and RANK > 0, the leading M-by-N part of this array contains the M-by-N solution matrix X. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M). RP (input or output) DOUBLE PRECISION array, dimension (LDRP,L) On entry, if FACT = 'F', JOBP = 'P', and RANK > 0, the leading L-by-L part of this array must contain the L-by-L matrix pinv(R), the Moore-Penrose pseudoinverse of R. On exit, if FACT = 'N', JOBP = 'P', and RANK > 0, the leading L-by-L part of this array contains the L-by-L matrix pinv(R), the Moore-Penrose pseudoinverse of R. If JOBP = 'N', this array is not referenced. LDRP INTEGER The leading dimension of array RP. LDRP >= MAX(1,L), if JOBP = 'P'. LDRP >= 1, if JOBP = 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK; if INFO = i, 1 <= i <= L, then DWORK(2:L) contain the unconverged superdiagonal elements of an upper bidiagonal matrix D whose diagonal is in SV (not necessarily sorted). D satisfies R = Q*D*P', so it has the same singular values as R, and singular vectors related by Q and P'. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,L), if FACT = 'F'; LDWORK >= MAX(1,5*L), if FACT = 'N'. For optimum performance LDWORK should be larger than MAX(1,L,M*N), if FACT = 'F'; MAX(1,5*L,M*N), if FACT = 'N'. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, i = 1:L, the SVD algorithm has failed to converge. In this case INFO specifies how many superdiagonals did not converge (see the description of DWORK); this failure is not likely to occur.Method
The L-by-L upper triangular matrix R is factored as R = Q*S*P', if FACT = 'N', using SLICOT Library routine MB03UD, where Q and P are L-by-L orthogonal matrices and S is an L-by-L diagonal matrix with non-negative diagonal elements, SV(1), SV(2), ..., SV(L), ordered decreasingly. Then, the effective rank of R is estimated, and matrix (or matrix-vector) products and scalings are used to compute X. If FACT = 'F', only matrix (or matrix-vector) products and scalings are performed.Further Comments
Option JOBP = 'P' should be used only if the pseudoinverse is really needed. Usually, it is possible to avoid the use of pseudoinverse, by computing least squares solutions. The routine uses BLAS 3 calculations if LDWORK >= M*N, and BLAS 2 calculations, otherwise. No advantage of any additional workspace larger than L is taken for matrix products, but the routine can be called repeatedly for chunks of columns of B, if LDWORK < M*N.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02UU.html 0000664 0000000 0000000 00000005574 14560147231 0020377 0 ustar 00root root 0000000 0000000
Purpose
To solve for x in A * x = scale * RHS, using the LU factorization of the N-by-N matrix A computed by SLICOT Library routine MB02UV. The factorization has the form A = P * L * U * Q, where P and Q are permutation matrices, L is unit lower triangular and U is upper triangular.Specification
SUBROUTINE MB02UU( N, A, LDA, RHS, IPIV, JPIV, SCALE ) C .. Scalar Arguments .. INTEGER LDA, N DOUBLE PRECISION SCALE C .. Array Arguments .. INTEGER IPIV( * ), JPIV( * ) DOUBLE PRECISION A( LDA, * ), RHS( * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. A (input) DOUBLE PRECISION array, dimension (LDA, N) The leading N-by-N part of this array must contain the LU part of the factorization of the matrix A computed by SLICOT Library routine MB02UV: A = P * L * U * Q. LDA INTEGER The leading dimension of the array A. LDA >= max(1, N). RHS (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the right hand side of the system. On exit, this array contains the solution of the system. IPIV (input) INTEGER array, dimension (N) The pivot indices; for 1 <= i <= N, row i of the matrix has been interchanged with row IPIV(i). JPIV (input) INTEGER array, dimension (N) The pivot indices; for 1 <= j <= N, column j of the matrix has been interchanged with column JPIV(j). SCALE (output) DOUBLE PRECISION The scale factor, chosen 0 < SCALE <= 1 to prevent overflow in the solution.Further Comments
In the interest of speed, this routine does not check the input for errors. It should only be used if the order of the matrix A is very small.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute an LU factorization, using complete pivoting, of the N-by-N matrix A. The factorization has the form A = P * L * U * Q, where P and Q are permutation matrices, L is lower triangular with unit diagonal elements and U is upper triangular.Specification
SUBROUTINE MB02UV( N, A, LDA, IPIV, JPIV, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, N C .. Array Arguments .. INTEGER IPIV( * ), JPIV( * ) DOUBLE PRECISION A( LDA, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. 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 to be factored. On exit, the leading N-by-N part of this array contains the factors L and U from the factorization A = P*L*U*Q; the unit diagonal elements of L are not stored. If U(k, k) appears to be less than SMIN, U(k, k) is given the value of SMIN, giving a nonsingular perturbed system. LDA INTEGER The leading dimension of the array A. LDA >= max(1, N). IPIV (output) INTEGER array, dimension (N) The pivot indices; for 1 <= i <= N, row i of the matrix has been interchanged with row IPIV(i). JPIV (output) INTEGER array, dimension (N) The pivot indices; for 1 <= j <= N, column j of the matrix has been interchanged with column JPIV(j).Error Indicator
INFO INTEGER = 0: successful exit; = k: U(k, k) is likely to produce owerflow if one tries to solve for x in Ax = b. So U is perturbed to get a nonsingular system. This is a warning.Further Comments
In the interests of speed, this routine does not check the input for errors. It should only be used to factorize matrices A of very small order.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve a system of the form A X = s B or A' X = s B with possible scaling ("s") and perturbation of A. (A' means A-transpose.) A is an N-by-N real matrix, and X and B are N-by-M matrices. N may be 1 or 2. The scalar "s" is a scaling factor (.LE. 1), computed by this subroutine, which is so chosen that X can be computed without overflow. X is further scaled if necessary to assure that norm(A)*norm(X) is less than overflow.Specification
SUBROUTINE MB02UW( LTRANS, N, M, PAR, A, LDA, B, LDB, SCALE, $ IWARN ) C .. Scalar Arguments .. LOGICAL LTRANS INTEGER IWARN, LDA, LDB, N, M DOUBLE PRECISION SCALE, SMIN C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), PAR( * )Arguments
Mode Parameters
LTRANS LOGICAL Specifies if A or A-transpose is to be used, as follows: =.TRUE. : A-transpose will be used; =.FALSE.: A will be used (not transposed).Input/Output Parameters
N (input) INTEGER The order of the matrix A. It may (only) be 1 or 2. M (input) INTEGER The number of right hand size vectors. PAR (input) DOUBLE PRECISION array, dimension (3) Machine related parameters: PAR(1) =: PREC (machine precision)*base, DLAMCH( 'P' ); PAR(2) =: SFMIN safe minimum, DLAMCH( 'S' ); PAR(3) =: SMIN The desired lower bound on the singular values of A. This should be a safe distance away from underflow or overflow, say, between (underflow/machine precision) and (machine precision * overflow). A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= N. B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the matrix B (right-hand side). On exit, the leading N-by-M part of this array contains the N-by-M matrix X (unknowns). LDB INTEGER The leading dimension of the array B. LDB >= N. SCALE (output) DOUBLE PRECISION The scale factor that B must be multiplied by to insure that overflow does not occur when computing X. Thus, A X will be SCALE*B, not B (ignoring perturbations of A). SCALE will be at most 1.Warning Indicator
IWARN INTEGER = 0: no warnings (A did not have to be perturbed); = 1: A had to be perturbed to make its smallest (or only) singular value greater than SMIN (see below).Method
Gaussian elimination with complete pivoting is used. The matrix A is slightly perturbed if it is (close to being) singular.Further Comments
If both singular values of A are less than SMIN, SMIN*identity will be used instead of A. If only one singular value is less than SMIN, one element of A will be perturbed enough to make the smallest singular value roughly SMIN. If both singular values are at least SMIN, A will not be perturbed. In any case, the perturbation will be at most some small multiple of max( SMIN, EPS*norm(A) ), where EPS is the machine precision (see LAPACK Library routine DLAMCH). The singular values are computed by infinity-norm approximations, and thus will only be correct to a factor of 2 or so. Note: all input quantities are assumed to be smaller than overflow by a reasonable factor. (See BIGNUM.) In the interests of speed, this routine does not check the inputs for errors.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the solution to a real system of linear equations X * op(A) = B, where op(A) is either A or its transpose, A is an N-by-N matrix, and X and B are M-by-N matrices. The LU decomposition with partial pivoting and row interchanges, A = P * L * U, is used, where P is a permutation matrix, L is unit lower triangular, and U is upper triangular.Specification
SUBROUTINE MB02VD( TRANS, M, N, A, LDA, IPIV, B, LDB, INFO ) C .. Scalar Arguments .. CHARACTER TRANS INTEGER INFO, LDA, LDB, M, N C .. Array Arguments .. INTEGER IPIV( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * )Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies the form of op(A) to be used as follows: = 'N': op(A) = A; = 'T': op(A) = A'; = 'C': op(A) = A'.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix B. M >= 0. N (input) INTEGER The number of columns of the matrix B, and the order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the coefficient matrix A. On exit, the leading N-by-N part of this array contains the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). IPIV (output) INTEGER array, dimension (N) The pivot indices that define the permutation matrix P; row i of the matrix was interchanged with row IPIV(i). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading M-by-N part of this array must contain the right hand side matrix B. On exit, if INFO = 0, the leading M-by-N part of this array contains the solution matrix X. LDB (input) INTEGER The leading dimension of the array B. LDB >= max(1,M). INFO (output) INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution could not be computed.Method
The LU decomposition with partial pivoting and row interchanges is used to factor A as A = P * L * U, where P is a permutation matrix, L is unit lower triangular, and U is upper triangular. The factored form of A is then used to solve the system of equations X * A = B or X * A' = B.Further Comments
This routine enables to solve the system X * A = B or X * A' = B as easily and efficiently as possible; it is similar to the LAPACK Library routine DGESV, which solves A * X = B.Example
Program Text
* MB02VD EXAMPLE PROGRAM TEXT * INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER LDA, LDB PARAMETER ( LDA = NMAX, LDB = MMAX ) * .. Local Scalars .. INTEGER I, INFO, J, M, N CHARACTER*1 TRANS * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,NMAX) INTEGER IPIV(NMAX) * .. External Subroutines .. EXTERNAL MB02VD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, TRANS IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99994 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,M ) * Solve the linear system using the LU factorization. CALL MB02VD( TRANS, M, N, A, LDA, IPIV, B, LDB, INFO ) * IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,N ) 10 CONTINUE ELSE WRITE ( NOUT, FMT = 99998 ) INFO END IF END IF END IF STOP * 99999 FORMAT (' MB02VD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB02VD = ',I2) 99997 FORMAT (' The solution matrix is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
MB02VD EXAMPLE PROGRAM DATA 5 4 N 1. 2. 6. 3. -2. -1. -1. 0. 2. 3. 1. 5. 1. -1. 2. 0. 0. 0. 0. 1. 5. 5. 1. 5. -2. 1. 3. 1. 0. 0. 4. 5. 2. 1. 1. 3.Program Results
MB02VD EXAMPLE PROGRAM RESULTS The solution matrix is -0.0690 0.3333 0.2414 0.2529 -0.1724 -1.6667 1.1034 -0.3678 0.9655 0.6667 -0.3793 -0.8736 0.3448 1.6667 0.7931 1.4023 -0.2069 0.0000 0.7241 0.7586
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB02WD.html 0000664 0000000 0000000 00000025046 14560147231 0020354 0 ustar 00root root 0000000 0000000
Purpose
To solve the system of linear equations Ax = b, with A symmetric, positive definite, or, in the implicit form, f(A, x) = b, where y = f(A, x) is a symmetric positive definite linear mapping from x to y, using the conjugate gradient (CG) algorithm without preconditioning.Specification
SUBROUTINE MB02WD( FORM, F, N, IPAR, LIPAR, DPAR, LDPAR, ITMAX, $ A, LDA, B, INCB, X, INCX, TOL, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER FORM INTEGER INCB, INCX, INFO, ITMAX, IWARN, LDA, LDPAR, $ LDWORK, LIPAR, N DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(*), DPAR(*), DWORK(*), X(*) INTEGER IPAR(*)Arguments
Mode Parameters
FORM CHARACTER*1 Specifies the form of the system of equations, as follows: = 'U' : Ax = b, the upper triagular part of A is used; = 'L' : Ax = b, the lower triagular part of A is used; = 'F' : the implicit, function form, f(A, x) = b.Function Parameters
F EXTERNAL If FORM = 'F', then F is a subroutine which calculates the value of f(A, x), for given A and x. If FORM <> 'F', then F is not called. F must have the following interface: SUBROUTINE F( N, IPAR, LIPAR, DPAR, LDPAR, A, LDA, X, $ INCX, DWORK, LDWORK, INFO ) where N (input) INTEGER The dimension of the vector x. N >= 0. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix A. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 0. DPAR (input) DOUBLE PRECISION array, dimension (LDPAR) The real parameters needed for solving the problem. LDPAR (input) INTEGER The length of the array DPAR. LDPAR >= 0. A (input) DOUBLE PRECISION array, dimension (LDA, NC), where NC is the number of columns. The leading NR-by-NC part of this array must contain the (compressed) representation of the matrix A, where NR is the number of rows of A (function of IPAR entries). LDA (input) INTEGER The leading dimension of the array A. LDA >= MAX(1,NR). X (input/output) DOUBLE PRECISION array, dimension (1+(N-1)*INCX) On entry, this incremented array must contain the vector x. On exit, this incremented array contains the value of the function f, y = f(A, x). INCX (input) INTEGER The increment for the elements of X. INCX > 0. DWORK DOUBLE PRECISION array, dimension (LDWORK) The workspace array for subroutine F. LDWORK (input) INTEGER The size of the array DWORK (as large as needed in the subroutine F). INFO INTEGER Error indicator, set to a negative value if an input scalar argument is erroneous, and to positive values for other possible errors in the subroutine F. The LAPACK Library routine XERBLA should be used in conjunction with negative INFO. INFO must be zero if the subroutine finished successfully. Parameters marked with "(input)" must not be changed.Input/Output Parameters
N (input) INTEGER The dimension of the vector x. N >= 0. If FORM = 'U' or FORM = 'L', N is also the number of rows and columns of the matrix A. IPAR (input) INTEGER array, dimension (LIPAR) If FORM = 'F', the integer parameters describing the structure of the matrix A. This parameter is ignored if FORM = 'U' or FORM = 'L'. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 0. DPAR (input) DOUBLE PRECISION array, dimension (LDPAR) If FORM = 'F', the real parameters needed for solving the problem. This parameter is ignored if FORM = 'U' or FORM = 'L'. LDPAR (input) INTEGER The length of the array DPAR. LDPAR >= 0. ITMAX (input) INTEGER The maximal number of iterations to do. ITMAX >= 0. A (input) DOUBLE PRECISION array, dimension (LDA, NC), if FORM = 'F', dimension (LDA, N), otherwise. If FORM = 'F', the leading NR-by-NC part of this array must contain the (compressed) representation of the matrix A, where NR and NC are the number of rows and columns, respectively, of the matrix A. The array A is not referenced by this routine itself, except in the calls to the routine F. If FORM <> 'F', the leading N-by-N part of this array must contain the matrix A, assumed to be symmetric; only the triangular part specified by FORM is referenced. LDA (input) INTEGER The leading dimension of array A. LDA >= MAX(1,NR), if FORM = 'F'; LDA >= MAX(1,N), if FORM = 'U' or FORM = 'L'. B (input) DOUBLE PRECISION array, dimension (1+(N-1)*INCB) The incremented vector b. INCB (input) INTEGER The increment for the elements of B. INCB > 0. X (input/output) DOUBLE PRECISION array, dimension (1+(N-1)*INCX) On entry, this incremented array must contain an initial approximation of the solution. If an approximation is not known, setting all elements of x to zero is recommended. On exit, this incremented array contains the computed solution x of the system of linear equations. INCX (input) INTEGER The increment for the elements of X. INCX > 0.Tolerances
TOL DOUBLE PRECISION If TOL > 0, absolute tolerance for the iterative process. The algorithm will stop if || Ax - b ||_2 <= TOL. Since it is advisable to use a relative tolerance, say TOLER, TOL should be chosen as TOLER*|| b ||_2. If TOL <= 0, a default relative tolerance, TOLDEF = N*EPS*|| b ||_2, is used, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the number of iterations performed and DWORK(2) returns the remaining residual, || Ax - b ||_2. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(2,3*N + DWORK(F)), if FORM = 'F', where DWORK(F) is the workspace needed by F; LDWORK >= MAX(2,3*N), if FORM = 'U' or FORM = 'L'.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: the algorithm finished after ITMAX > 0 iterations, without achieving the desired precision TOL; = 2: ITMAX is zero; in this case, DWORK(2) is not set.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, then F returned with INFO = i.Method
The following CG iteration is used for solving Ax = b: Start: q(0) = r(0) = Ax - b < q(k), r(k) > ALPHA(k) = - ---------------- < q(k), Aq(k) > x(k+1) = x(k) - ALPHA(k) * q(k) r(k+1) = r(k) - ALPHA(k) * Aq(k) < r(k+1), r(k+1) > BETA(k) = -------------------- < r(k) , r(k) > q(k+1) = r(k+1) + BETA(k) * q(k) where <.,.> denotes the scalar product.References
[1] Golub, G.H. and van Loan, C.F. Matrix Computations. Third Edition. M. D. Johns Hopkins University Press, Baltimore, pp. 520-528, 1996. [2] Luenberger, G. Introduction to Linear and Nonlinear Programming. Addison-Wesley, Reading, MA, p.187, York, 1973.Numerical Aspects
Since the residuals are orthogonal in the scalar product <x, y> = y'Ax, the algorithm is theoretically finite. But rounding errors cause a loss of orthogonality, so a finite termination cannot be guaranteed. However, one can prove [2] that || x-x_k ||_A := sqrt( (x-x_k)' * A * (x-x_k) ) sqrt( kappa_2(A) ) - 1 <= 2 || x-x_0 ||_A * ------------------------ , sqrt( kappa_2(A) ) + 1 where kappa_2 is the condition number. The approximate number of floating point operations is (k*(N**2 + 15*N) + N**2 + 3*N)/2, if FORM <> 'F', k*(f + 7*N) + f, if FORM = 'F', where k is the number of CG iterations performed, and f is the number of floating point operations required by the subroutine F.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve a set of systems of linear equations, A'*A*X = B, or, in the implicit form, f(A)*X = B, with A'*A or f(A) positive definite, using symmetric Gaussian elimination.Specification
SUBROUTINE MB02XD( FORM, STOR, UPLO, F, M, N, NRHS, IPAR, LIPAR, $ DPAR, LDPAR, A, LDA, B, LDB, ATA, LDATA, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER FORM, STOR, UPLO INTEGER INFO, LDA, LDATA, LDB, LDPAR, LDWORK, LIPAR, M, $ N, NRHS C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), ATA(*), B(LDB,*), DPAR(*), DWORK(*) INTEGER IPAR(*)Arguments
Mode Parameters
FORM CHARACTER*1 Specifies the form in which the matrix A is provided, as follows: = 'S' : standard form, the matrix A is given; = 'F' : the implicit, function form f(A) is provided. If FORM = 'F', then the routine F is called to compute the matrix A'*A. STOR CHARACTER*1 Specifies the storage scheme for the symmetric matrix A'*A, as follows: = 'F' : full storage is used; = 'P' : packed storage is used. UPLO CHARACTER*1 Specifies which part of the matrix A'*A is stored, as follows: = 'U' : the upper triagular part is stored; = 'L' : the lower triagular part is stored.Function Parameters
F EXTERNAL If FORM = 'F', then F is a subroutine which calculates the value of f(A) = A'*A, for given A. If FORM = 'S', then F is not called. F must have the following interface: SUBROUTINE F( STOR, UPLO, N, IPAR, LIPAR, DPAR, LDPAR, A, $ LDA, ATA, LDATA, DWORK, LDWORK, INFO ) where STOR (input) CHARACTER*1 Specifies the storage scheme for the symmetric matrix A'*A, as follows: = 'F' : full storage is used; = 'P' : packed storage is used. UPLO (input) CHARACTER*1 Specifies which part of the matrix A'*A is stored, as follows: = 'U' : the upper triagular part is stored; = 'L' : the lower triagular part is stored. N (input) INTEGER The order of the matrix A'*A. N >= 0. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix A. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 0. DPAR (input) DOUBLE PRECISION array, dimension (LDPAR) The real parameters needed for solving the problem. LDPAR (input) INTEGER The length of the array DPAR. LDPAR >= 0. A (input) DOUBLE PRECISION array, dimension (LDA, NC), where NC is the number of columns. The leading NR-by-NC part of this array must contain the (compressed) representation of the matrix A, where NR is the number of rows of A (function of IPAR entries). LDA (input) INTEGER The leading dimension of the array A. LDA >= MAX(1,NR). ATA (output) DOUBLE PRECISION array, dimension (LDATA,N), if STOR = 'F', dimension (N*(N+1)/2), if STOR = 'P'. The leading N-by-N (if STOR = 'F'), or N*(N+1)/2 (if STOR = 'P') part of this array contains the upper or lower triangle of the matrix A'*A, depending on UPLO = 'U', or UPLO = 'L', respectively, stored either as a two-dimensional, or one-dimensional array, depending on STOR. LDATA (input) INTEGER The leading dimension of the array ATA. LDATA >= MAX(1,N), if STOR = 'F'. LDATA >= 1, if STOR = 'P'. DWORK DOUBLE PRECISION array, dimension (LDWORK) The workspace array for subroutine F. LDWORK (input) INTEGER The size of the array DWORK (as large as needed in the subroutine F). INFO INTEGER Error indicator, set to a negative value if an input scalar argument is erroneous, and to positive values for other possible errors in the subroutine F. The LAPACK Library routine XERBLA should be used in conjunction with negative INFO. INFO must be zero if the subroutine finished successfully. Parameters marked with "(input)" must not be changed.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The order of the matrix A'*A, the number of columns of the matrix A, and the number of rows of the matrix X. N >= 0. NRHS (input) INTEGER The number of columns of the matrices B and X. NRHS >= 0. IPAR (input) INTEGER array, dimension (LIPAR) If FORM = 'F', the integer parameters describing the structure of the matrix A. This parameter is ignored if FORM = 'S'. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 0. DPAR (input) DOUBLE PRECISION array, dimension (LDPAR) If FORM = 'F', the real parameters needed for solving the problem. This parameter is ignored if FORM = 'S'. LDPAR (input) INTEGER The length of the array DPAR. LDPAR >= 0. A (input) DOUBLE PRECISION array, dimension (LDA, N), if FORM = 'S', dimension (LDA, NC), if FORM = 'F', where NC is the number of columns. If FORM = 'S', the leading M-by-N part of this array must contain the matrix A. If FORM = 'F', the leading NR-by-NC part of this array must contain an appropriate representation of matrix A, where NR is the number of rows. If FORM = 'F', this array is not referenced by this routine itself, except in the call to the routine F. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M), if FORM = 'S'; LDA >= MAX(1,NR), if FORM = 'F'. B (input/output) DOUBLE PRECISION array, dimension (LDB, NRHS) On entry, the leading N-by-NRHS part of this array must contain the right hand side matrix B. On exit, if INFO = 0 and M (or NR) is nonzero, the leading N-by-NRHS part of this array contains the solution X of the set of systems of linear equations A'*A*X = B or f(A)*X = B. If M (or NR) is zero, then B is unchanged. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). ATA (output) DOUBLE PRECISION array, dimension (LDATA,N), if STOR = 'F', dimension (N*(N+1)/2), if STOR = 'P'. The leading N-by-N (if STOR = 'F'), or N*(N+1)/2 (if STOR = 'P') part of this array contains the upper or lower triangular Cholesky factor of the matrix A'*A, depending on UPLO = 'U', or UPLO = 'L', respectively, stored either as a two-dimensional, or one-dimensional array, depending on STOR. LDATA INTEGER The leading dimension of the array ATA. LDATA >= MAX(1,N), if STOR = 'F'. LDATA >= 1, if STOR = 'P'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, then the (i,i) element of the triangular factor of the matrix A'*A is exactly zero (the matrix A'*A is exactly singular); if INFO = j > n, then F returned with INFO = j-n.Method
The matrix A'*A is built either directly (if FORM = 'S'), or implicitly, by calling the routine F. Then, A'*A is Cholesky factored and its factor is used to solve the set of systems of linear equations, A'*A*X = B.References
[1] Golub, G.H. and van Loan, C.F. Matrix Computations. Third Edition. M. D. Johns Hopkins University Press, Baltimore, 1996. [2] Anderson, E., Bai, Z., Bischof, C., Blackford, Demmel, J., Dongarra, J., Du Croz, J., Greenbaum, A., Hammarling, S., McKenney, A., Sorensen, D. LAPACK Users' Guide: Third Edition, SIAM, Philadelphia, 1999.Numerical Aspects
For speed, this routine does not check for near singularity of the matrix A'*A. If the matrix A is nearly rank deficient, then the computed X could be inaccurate. Estimates of the reciprocal condition numbers of the matrices A and A'*A can be obtained using LAPACK routines DGECON and DPOCON (DPPCON), respectively. The approximate number of floating point operations is (M+3)*N**2/2 + N**3/6 + NRHS*N**2, if FORM = 'S', f + N**3/6 + NRHS*N**2, if FORM = 'F', where M is the number of rows of A, and f is the number of floating point operations required by the subroutine F.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To determine a vector x which solves the system of linear equations A*x = b , D*x = 0 , in the least squares sense, where A is an m-by-n matrix, D is an n-by-n diagonal matrix, and b is an m-vector. It is assumed that a QR factorization, with column pivoting, of A is available, that is, A*P = Q*R, where P is a permutation matrix, Q has orthogonal columns, and R is an upper triangular matrix with diagonal elements of nonincreasing magnitude. The routine needs the full upper triangle of R, the permutation matrix P, and the first n components of Q'*b (' denotes the transpose). The system A*x = b, D*x = 0, is then equivalent to R*z = Q'*b , P'*D*P*z = 0 , (1) where x = P*z. If this system does not have full rank, then a least squares solution is obtained. On output, MB02YD also provides an upper triangular matrix S such that P'*(A'*A + D*D)*P = S'*S . The system (1) is equivalent to S*z = c , where c contains the first n components of the vector obtained by applying to [ (Q'*b)' 0 ]' the transformations which triangularized [ R' P'*D*P ]', getting S.Specification
SUBROUTINE MB02YD( COND, N, R, LDR, IPVT, DIAG, QTB, RANK, X, TOL, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COND INTEGER INFO, LDR, LDWORK, N, RANK DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IPVT(*) DOUBLE PRECISION DIAG(*), DWORK(*), QTB(*), R(LDR,*), X(*)Arguments
Mode Parameters
COND CHARACTER*1 Specifies whether the condition of the matrix S should be estimated, as follows: = 'E' : use incremental condition estimation and store the numerical rank of S in RANK; = 'N' : do not use condition estimation, but check the diagonal entries of S for zero values; = 'U' : use the rank already stored in RANK.Input/Output Parameters
N (input) INTEGER The order of the matrix R. N >= 0. R (input/output) DOUBLE PRECISION array, dimension (LDR, N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix R. On exit, the full upper triangle is unaltered, and the strict lower triangle contains the strict upper triangle (transposed) of the upper triangular matrix S. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). IPVT (input) INTEGER array, dimension (N) This array must define the permutation matrix P such that A*P = Q*R. Column j of P is column IPVT(j) of the identity matrix. DIAG (input) DOUBLE PRECISION array, dimension (N) This array must contain the diagonal elements of the matrix D. QTB (input) DOUBLE PRECISION array, dimension (N) This array must contain the first n elements of the vector Q'*b. RANK (input or output) INTEGER On entry, if COND = 'U', this parameter must contain the (numerical) rank of the matrix S. On exit, if COND = 'E' or 'N', this parameter contains the numerical rank of the matrix S, estimated according to the value of COND. X (output) DOUBLE PRECISION array, dimension (N) This array contains the least squares solution of the system A*x = b, D*x = 0.Tolerances
TOL DOUBLE PRECISION If COND = 'E', the tolerance to be used for finding the rank of the matrix S. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not relevant if COND = 'U' or 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, the first N elements of this array contain the diagonal elements of the upper triangular matrix S, and the next N elements contain the solution z. LDWORK INTEGER The length of the array DWORK. LDWORK >= 4*N, if COND = 'E'; LDWORK >= 2*N, if COND <> 'E'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Standard plane rotations are used to annihilate the elements of the diagonal matrix D, updating the upper triangular matrix R and the first n elements of the vector Q'*b. A basic least squares solution is computed.References
[1] More, J.J., Garbow, B.S, and Hillstrom, K.E. User's Guide for MINPACK-1. Applied Math. Division, Argonne National Laboratory, Argonne, Illinois, Report ANL-80-74, 1980.Numerical Aspects
2 The algorithm requires 0(N ) operations and is backward stable.Further Comments
This routine is a LAPACK-based modification of QRSOLV from the MINPACK package [1], and with optional condition estimation. The option COND = 'U' is useful when dealing with several right-hand side vectors.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute two Givens rotations (C1,S1) and (C2,S2) such that the orthogonal matrix [ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ] Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ], [ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ] makes the first column of the real Wilkinson double shift polynomial of the product of matrices in periodic upper Hessenberg form, stored in the array A, parallel to the first unit vector. Only the rotation defined by C1 and S1 is needed for the real Wilkinson single shift polynomial (see the SLICOT Library routines MB03BE or MB03BF). The shifts are defined based on the eigenvalues (computed externally by the SLICOT Library routine MB03BB) of the trailing 2-by-2 submatrix of the matrix product. See the definitions of the arguments W1 and W2.Specification
SUBROUTINE MB03AB( SHFT, K, N, AMAP, S, SINV, A, LDA1, LDA2, W1, $ W2, C1, S1, C2, S2 ) C .. Scalar Arguments .. CHARACTER SHFT INTEGER K, LDA1, LDA2, N, SINV DOUBLE PRECISION C1, C2, S1, S2, W1, W2 C .. Array Arguments .. INTEGER AMAP(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*)Arguments
Mode Parameters
SHFT CHARACTER*1 Specifies the number and type of shifts employed by the shift polynomial, as follows: = 'C': two complex conjugate shifts; = 'D': two real identical shifts; = 'R': two real shifts; = 'S': one real shift. When the eigenvalues are complex conjugate, this argument must be set to 'C'.Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. N (input) INTEGER The order of the factors in the array A. N >= 2, for a single shift polynomial; N >= 3, for a double shift polynomial. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. AMAP(1) is the pointer to the Hessenberg matrix, defined by A(:,:,AMAP(1)). S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) The leading N-by-N-by-K part of this array must contain an n-by-n product (implicitly represented by its K factors) in periodic upper Hessenberg form. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= N. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= N. W1 (input) DOUBLE PRECISION The real part of the first eigenvalue. If SHFT = 'S', this argument is not used. W2 (input) DOUBLE PRECISION The second eigenvalue, if both eigenvalues are real, else the imaginary part of the complex conjugate pair. C1 (output) DOUBLE PRECISION S1 (output) DOUBLE PRECISION On exit, C1 and S1 contain the parameters for the first Givens rotation. C2 (output) DOUBLE PRECISION S2 (output) DOUBLE PRECISION On exit, C2 and S2 contain the parameters for the second Givens rotation. If SHFT = 'S', C2 = 1, S2 = 0.Method
Givens rotations are properly computed and applied.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute two Givens rotations (C1,S1) and (C2,S2) such that the orthogonal matrix [ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ] Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ], [ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ] makes the first column of the real Wilkinson double shift polynomial of the product of matrices in periodic upper Hessenberg form, stored in the array A, parallel to the first unit vector. Only the rotation defined by C1 and S1 is used for the real Wilkinson single shift polynomial (see SLICOT Library routine MB03BE).Specification
SUBROUTINE MB03AD( SHFT, K, N, AMAP, S, SINV, A, LDA1, LDA2, C1, $ S1, C2, S2 ) C .. Scalar Arguments .. CHARACTER SHFT INTEGER K, LDA1, LDA2, N, SINV DOUBLE PRECISION C1, C2, S1, S2 C .. Array Arguments .. INTEGER AMAP(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*)Arguments
Mode Parameters
SHFT CHARACTER*1 Specifies the number of shifts employed by the shift polynomial, as follows: = 'D': two shifts (assumes N > 2); = 'S': one real shift.Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. N (input) INTEGER The order of the factors in the array A. N >= 2, for a single shift polynomial; N >= 3, for a double shift polynomial. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. AMAP(1) is the pointer to the Hessenberg matrix. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) The leading N-by-N-by-K part of this array must contain the product (implicitly represented by its K factors) in periodic upper Hessenberg form. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= N. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= N. C1 (output) DOUBLE PRECISION S1 (output) DOUBLE PRECISION On exit, C1 and S1 contain the parameters for the first Givens rotation. C2 (output) DOUBLE PRECISION S2 (output) DOUBLE PRECISION On exit, if SHFT = 'D' and N > 2, C2 and S2 contain the parameters for the second Givens rotation. Otherwise, C2 = 1, S2 = 0.Method
Two Givens rotations are properly computed and applied.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute two Givens rotations (C1,S1) and (C2,S2) such that the orthogonal matrix [ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ] Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ], [ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ] makes the first column of the real Wilkinson double shift polynomial of the product of matrices in periodic upper Hessenberg form, stored in the array A, parallel to the first unit vector. Only the rotation defined by C1 and S1 is used for the real Wilkinson single shift polynomial (see SLICOT Library routines MB03BE or MB03BF). All factors whose exponents differ from that of the Hessenberg factor are assumed nonsingular. The trailing 2-by-2 submatrix and the five nonzero elements in the first two columns of the matrix product are evaluated when a double shift is used.Specification
SUBROUTINE MB03AE( SHFT, K, N, AMAP, S, SINV, A, LDA1, LDA2, C1, $ S1, C2, S2 ) C .. Scalar Arguments .. CHARACTER SHFT INTEGER K, LDA1, LDA2, N, SINV DOUBLE PRECISION C1, C2, S1, S2 C .. Array Arguments .. INTEGER AMAP(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*)Arguments
Mode Parameters
SHFT CHARACTER*1 Specifies the number of shifts employed by the shift polynomial, as follows: = 'D': two shifts (assumes N > 2); = 'S': one real shift.Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. N (input) INTEGER The order of the factors. N >= 2. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. AMAP(1) is the pointer to the Hessenberg matrix. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) The leading N-by-N-by-K part of this array must contain the product (implicitly represented by its K factors) in periodic upper Hessenberg form. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= N. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= N. C1 (output) DOUBLE PRECISION S1 (output) DOUBLE PRECISION On exit, C1 and S1 contain the parameters for the first Givens rotation. C2 (output) DOUBLE PRECISION S2 (output) DOUBLE PRECISION On exit, if SHFT = 'D' and N > 2, C2 and S2 contain the parameters for the second Givens rotation. Otherwise, C2 = 1, S2 = 0.Method
The necessary elements of the real Wilkinson double/single shift polynomial are computed, and suitable Givens rotations are found. For numerical reasons, this routine should be called when convergence difficulties are encountered.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute two Givens rotations (C1,S1) and (C2,S2) such that the orthogonal matrix [ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ] Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ], [ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ] makes the first column of the real Wilkinson double shift polynomial of the product of matrices in periodic upper Hessenberg form, stored in the array A, parallel to the first unit vector. Only the rotation defined by C1 and S1 is used for the real Wilkinson single shift polynomial (see SLICOT Library routines MB03BE or MB03BF).Specification
SUBROUTINE MB03AF( SHFT, K, N, AMAP, S, SINV, A, LDA1, LDA2, C1, $ S1, C2, S2 ) C .. Scalar Arguments .. CHARACTER SHFT INTEGER K, LDA1, LDA2, N, SINV DOUBLE PRECISION C1, C2, S1, S2 C .. Array Arguments .. INTEGER AMAP(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*)Arguments
Mode Parameters
SHFT CHARACTER*1 Specifies the number of shifts employed by the shift polynomial, as follows: = 'D': two real shifts; = 'S': one real shift.Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. N (input) INTEGER The order of the factors in the array A. N >= 2, for a single shift polynomial; N >= 3, for a double shift polynomial. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. AMAP(K) is the pointer to the Hessenberg matrix. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. S(K) is not used, but assumed to be 1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) On entry, the leading N-by-N-by-K part of this array must contain a n-by-n product (implicitly represented by its K factors) in periodic upper Hessenberg form. The Hessenberg matrix is assumed to be the last one in the product. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= N. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= N. C1 (output) DOUBLE PRECISION S1 (output) DOUBLE PRECISION On exit, C1 and S1 contain the parameters for the first Givens rotation. C2 (output) DOUBLE PRECISION S2 (output) DOUBLE PRECISION On exit, if SHFT = 'D', C2 and S2 contain the parameters for the second Givens rotation. Otherwise, C2 = 1, S2 = 0.Method
Givens rotations are properly computed and applied.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute two Givens rotations (C1,S1) and (C2,S2) such that the orthogonal matrix [ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ] Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ], [ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ] makes the first column of the real Wilkinson double shift polynomial of the product of matrices in periodic upper Hessenberg form, stored in the array A, parallel to the first unit vector. Only the rotation defined by C1 and S1 is used for the real Wilkinson single shift polynomial (see SLICOT Library routines MB03BE or MB03BF). All factors whose exponents differ from that of the Hessenberg factor are assumed nonsingular. The matrix product is evaluated.Specification
SUBROUTINE MB03AG( SHFT, K, N, AMAP, S, SINV, A, LDA1, LDA2, C1, $ S1, C2, S2, IWORK, DWORK ) C .. Scalar Arguments .. CHARACTER SHFT INTEGER K, LDA1, LDA2, N, SINV DOUBLE PRECISION C1, C2, S1, S2 C .. Array Arguments .. INTEGER AMAP(*), IWORK(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*), DWORK(*)Arguments
Mode Parameters
SHFT CHARACTER*1 Specifies the number of shifts employed by the shift polynomial, as follows: = 'D': two shifts (assumes N > 2); = 'S': one real shift.Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. N (input) INTEGER The order of the factors. N >= 2. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. AMAP(1) is the pointer to the Hessenberg matrix. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) The leading N-by-N-by-K part of this array must contain the product (implicitly represented by its K factors) in periodic upper Hessenberg form. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= N. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= N. C1 (output) DOUBLE PRECISION S1 (output) DOUBLE PRECISION On exit, C1 and S1 contain the parameters for the first Givens rotation. C2 (output) DOUBLE PRECISION S2 (output) DOUBLE PRECISION On exit, if SHFT = 'D', C2 and S2 contain the parameters for the second Givens rotation. Otherwise, C2 = 1, S2 = 0.Workspace
IWORK INTEGER array, dimension (2*N) DWORK DOUBLE PRECISION array, dimension (2*N*N) On exit, DWORK(N*N+1:N*N+N) and DWORK(N*N+N+1:N*N+2*N) contain the real and imaginary parts, respectively, of the eigenvalues of the matrix product.Method
The necessary elements of the real Wilkinson double shift polynomial are computed, and suitable Givens rotations are found. For numerical reasons, this routine should be called when convergence difficulties are encountered for small order matrices and small K, e.g., N, K <= 6.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute two Givens rotations (C1,S1) and (C2,S2) such that the orthogonal matrix [ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ] Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ], [ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ] makes the first column of the real Wilkinson double shift polynomial of the product of matrices in periodic upper Hessenberg form, stored in the array A, parallel to the first unit vector. Only the rotation defined by C1 and S1 is used for the real Wilkinson single shift polynomial (see SLICOT Library routines MB03BE or MB03BF). All factors whose exponents differ from that of the Hessenberg factor are assumed nonsingular. The trailing 2-by-2 submatrix and the five nonzero elements in the first two columns of the matrix product are evaluated when a double shift is used.Specification
SUBROUTINE MB03AH( SHFT, K, N, AMAP, S, SINV, A, LDA1, LDA2, C1, $ S1, C2, S2 ) C .. Scalar Arguments .. CHARACTER SHFT INTEGER K, LDA1, LDA2, N, SINV DOUBLE PRECISION C1, C2, S1, S2 C .. Array Arguments .. INTEGER AMAP(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*)Arguments
Mode Parameters
SHFT CHARACTER*1 Specifies the number of shifts employed by the shift polynomial, as follows: = 'D': two shifts (assumes N > 2); = 'S': one real shift.Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. N (input) INTEGER The order of the factors. N >= 2. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. AMAP(K) is the pointer to the Hessenberg matrix. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) The leading N-by-N-by-K part of this array must contain the product (implicitly represented by its K factors) in periodic upper Hessenberg form. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= N. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= N. C1 (output) DOUBLE PRECISION S1 (output) DOUBLE PRECISION On exit, C1 and S1 contain the parameters for the first Givens rotation. C2 (output) DOUBLE PRECISION S2 (output) DOUBLE PRECISION On exit, if SHFT = 'D' and N > 2, C2 and S2 contain the parameters for the second Givens rotation. Otherwise, C2 = 1, S2 = 0.Method
The necessary elements of the real Wilkinson double/single shift polynomial are computed, and suitable Givens rotations are found. For numerical reasons, this routine should be called when convergence difficulties are encountered. For a double shift, if there are two real eigenvalues of the trailing 2-by-2 part of the product, both shifts are chosen equal to the eigenvalue with minimum modulus. The trailing element of the product is used as a single shift. If SINV is negative, the shift(s) correspond to the reciprocals of the eigenvalues of the product, as required by the SLICOT Library routine MB03BD.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute two Givens rotations (C1,S1) and (C2,S2) such that the orthogonal matrix [ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ] Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ], [ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ] makes the first column of the real Wilkinson double shift polynomial of the product of matrices in periodic upper Hessenberg form, stored in the array A, parallel to the first unit vector. Only the rotation defined by C1 and S1 is used for the real Wilkinson single shift polynomial (see SLICOT Library routines MB03BE or MB03BF). All factors whose exponents differ from that of the Hessenberg factor are assumed nonsingular. The matrix product is evaluated.Specification
SUBROUTINE MB03AI( SHFT, K, N, AMAP, S, SINV, A, LDA1, LDA2, C1, $ S1, C2, S2, DWORK ) C .. Scalar Arguments .. CHARACTER SHFT INTEGER K, LDA1, LDA2, N, SINV DOUBLE PRECISION C1, C2, S1, S2 C .. Array Arguments .. INTEGER AMAP(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*), DWORK(*)Arguments
Mode Parameters
SHFT CHARACTER*1 Specifies the number of shifts employed by the shift polynomial, as follows: = 'D': two shifts (assumes N > 2); = 'S': one real shift.Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. N (input) INTEGER The order of the factors. N >= 2. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. AMAP(K) is the pointer to the Hessenberg matrix. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) The leading N-by-N-by-K part of this array must contain the product (implicitly represented by its K factors) in periodic upper Hessenberg form. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= N. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= N. C1 (output) DOUBLE PRECISION S1 (output) DOUBLE PRECISION On exit, C1 and S1 contain the parameters for the first Givens rotation. C2 (output) DOUBLE PRECISION S2 (output) DOUBLE PRECISION On exit, if SHFT = 'D', C2 and S2 contain the parameters for the second Givens rotation. Otherwise, C2 = 1, S2 = 0.Workspace
DWORK DOUBLE PRECISION array, dimension (N*(N+2))Method
The necessary elements of the real Wilkinson double shift polynomial are computed, and suitable Givens rotations are found. For numerical reasons, this routine should be called when convergence difficulties are encountered for small order matrices and small K, e.g., N, K <= 6.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the suitable maps for Hessenberg index H and signature array S. Auxiliary routine for the periodic QZ algorithms.Specification
SUBROUTINE MB03BA( K, H, S, SMULT, AMAP, QMAP ) C .. Scalar Arguments .. INTEGER K, H, SMULT C .. Array Arguments .. INTEGER AMAP(*), QMAP(*), S(*)Arguments
Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. H (input) INTEGER Index which corresponds to A_1. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SMULT (output) INTEGER Signature multiplier. Entries of S are virtually multiplied by SMULT. AMAP (output) INTEGER array, dimension (K) The map for accessing the factors, that is, if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. QMAP (output) INTEGER array, dimension (K) The map for accessing the orthognal transformation matrices, that is, if QMAP(I) = J, then the matrix Q_I is stored at the J-th position in Q.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the eigenvalues of a general 2-by-2 matrix product via a complex single shifted periodic QZ algorithm.Specification
SUBROUTINE MB03BB( BASE, LGBAS, ULP, K, AMAP, S, SINV, A, LDA1, $ LDA2, ALPHAR, ALPHAI, BETA, SCAL, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, K, LDA1, LDA2, SINV DOUBLE PRECISION BASE, LGBAS, ULP C .. Array Arguments .. DOUBLE PRECISION A(LDA1,LDA2,*), ALPHAI(2), ALPHAR(2), BETA(2), $ DWORK(*) INTEGER AMAP(*), S(*), SCAL(2)Arguments
Input/Output Parameters
BASE (input) DOUBLE PRECISION Machine base. LGBAS (input) DOUBLE PRECISION Logarithm of BASE. ULP (input) DOUBLE PRECISION Machine precision. K (input) INTEGER The number of factors. K >= 1. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) On entry, the leading 2-by-2-by-K part of this array must contain a 2-by-2 product (implicitly represented by its K factors) in upper Hessenberg-triangular form. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= 2. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= 2. ALPHAR (output) DOUBLE PRECISION array, dimension (2) On exit, this array contains the scaled real part of the two eigenvalues. If BETA(I) <> 0, then the I-th eigenvalue (I = 1 : 2) is given by (ALPHAR(I) + ALPHAI(I)*SQRT(-1) ) * (BASE)**SCAL(I). ALPHAI (output) DOUBLE PRECISION array, dimension (2) On exit, this array contains the scaled imaginary part of the two eigenvalues. ALPHAI(1) >= 0. BETA (output) DOUBLE PRECISION array, dimension (2) On exit, this array contains information about infinite eigenvalues. If BETA(I) = 0, then the I-th eigenvalue is infinite. Otherwise, BETA(I) = 1.0. SCAL (output) INTEGER array, dimension (2) On exit, this array contains the scaling exponents for the two eigenvalues.Workspace
DWORK DOUBLE PRECISION array, dimension (8*K)Error Indicator
INFO INTEGER = 0: successful exit; = 1: the periodic QZ algorithm did not converge; = 2: the computed eigenvalues might be inaccurate. Both values might be taken as warnings, since approximations of eigenvalues are returned.Method
A complex single shifted periodic QZ iteration is applied.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the product singular value decomposition of the K-1 triangular factors corresponding to a 2-by-2 product of K factors in upper Hessenberg-triangular form. For a general product of 2-by-2 triangular matrices S(2) S(3) S(K) A = A(:,:,2) A(:,:,3) ... A(:,:,K), Givens rotations are computed so that S(i) [ CV(i-1) SV(i-1) ] [ A(1,1,i)(in) A(1,2,i)(in) ] [ -SV(i-1) CV(i-1) ] [ 0 A(2,2,i)(in) ] S(i) [ A(1,1,i)(out) A(1,2,i)(out) ] [ CV(i) SV(i) ] = [ 0 A(2,2,i)(out) ] [ -SV(i) CV(i) ] stays upper triangular and [ CV(1) SV(1) ] [ CV(K) -SV(K) ] [ -SV(1) CV(1) ] * A * [ SV(K) CV(K) ] is diagonal.Specification
SUBROUTINE MB03BC( K, AMAP, S, SINV, A, LDA1, LDA2, MACPAR, CV, $ SV, DWORK ) C .. Scalar Arguments .. INTEGER K, LDA1, LDA2, SINV C .. Array Arguments .. INTEGER AMAP(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*), CV(*), DWORK(*), MACPAR(*), $ SV(*)Arguments
Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input/output) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) On entry, the leading 2-by-2-by-K part of this array must contain a 2-by-2 product (implicitly represented by its K factors) in upper Hessenberg-triangular form. On exit, the leading 2-by-2-by-K part of this array contains modified triangular factors such that their product is diagonal. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= 2. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= 2. MACPAR (input) DOUBLE PRECISION array, dimension (5) Machine parameters: MACPAR(1) overflow threshold, DLAMCH( 'O' ); MACPAR(2) underflow threshold, DLAMCH( 'U' ); MACPAR(3) safe minimum, DLAMCH( 'S' ); MACPAR(4) relative machine precision, DLAMCH( 'E' ); MACPAR(5) base of the machine, DLAMCH( 'B' ). CV (output) DOUBLE PRECISION array, dimension (K) On exit, the first K elements of this array contain the cosines of the Givens rotations. SV (output) DOUBLE PRECISION array, dimension (K) On exit, the first K elements of this array contain the sines of the Givens rotations.Workspace
DWORK DOUBLE PRECISION array, dimension (3*(K-1))Method
The product singular value decomposition of the K-1 triangular factors are computed as described in [1].References
[1] Bojanczyk, A. and Van Dooren, P. On propagating orthogonal transformations in a product of 2x2 triangular matrices. In Reichel, Ruttan and Varga: 'Numerical Linear Algebra', pp. 1-9, 1993.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To find the eigenvalues of the generalized matrix product S(1) S(2) S(K) A(:,:,1) * A(:,:,2) * ... * A(:,:,K) where A(:,:,H) is upper Hessenberg and A(:,:,i), i <> H, is upper triangular, using a double-shift version of the periodic QZ method. In addition, A may be reduced to periodic Schur form: A(:,:,H) is upper quasi-triangular and all the other factors A(:,:,I) are upper triangular. Optionally, the 2-by-2 triangular matrices corresponding to 2-by-2 diagonal blocks in A(:,:,H) are so reduced that their product is a 2-by-2 diagonal matrix. If COMPQ = 'U' or COMPQ = 'I', then the orthogonal factors are computed and stored in the array Q so that for S(I) = 1, T Q(:,:,I)(in) A(:,:,I)(in) Q(:,:,MOD(I,K)+1)(in) T (1) = Q(:,:,I)(out) A(:,:,I)(out) Q(:,:,MOD(I,K)+1)(out), and for S(I) = -1, T Q(:,:,MOD(I,K)+1)(in) A(:,:,I)(in) Q(:,:,I)(in) T (2) = Q(:,:,MOD(I,K)+1)(out) A(:,:,I)(out) Q(:,:,I)(out). A partial generation of the orthogonal factors can be realized via the array QIND.Specification
SUBROUTINE MB03BD( JOB, DEFL, COMPQ, QIND, K, N, H, ILO, IHI, S, $ A, LDA1, LDA2, Q, LDQ1, LDQ2, ALPHAR, ALPHAI, $ BETA, SCAL, IWORK, LIWORK, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, DEFL, JOB INTEGER H, IHI, ILO, INFO, IWARN, K, LDA1, LDA2, LDQ1, $ LDQ2, LDWORK, LIWORK, N C .. Array Arguments .. INTEGER IWORK(*), QIND(*), S(*), SCAL(*) DOUBLE PRECISION A(LDA1,LDA2,*), ALPHAI(*), ALPHAR(*), BETA(*), $ DWORK(*), Q(LDQ1,LDQ2,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; A will not necessarily be put into periodic Schur form; = 'S': put A into periodic Schur form, and return the eigenvalues in ALPHAR, ALPHAI, BETA, and SCAL; = 'T': as JOB = 'S', but A is put into standardized periodic Schur form, that is, the general product of the 2-by-2 triangular matrices corresponding to a complex eigenvalue is diagonal. DEFL CHARACTER*1 Specifies the deflation strategy to be used, as follows: = 'C': apply a careful deflation strategy, that is, the criteria are based on the magnitudes of neighboring elements and infinite eigenvalues are only deflated at the top; this is the recommended option; = 'A': apply a more aggressive strategy, that is, elements on the subdiagonal or diagonal are set to zero as soon as they become smaller in magnitude than eps times the norm of the corresponding factor; this option is only recommended if balancing is applied beforehand and convergence problems are observed. COMPQ CHARACTER*1 Specifies whether or not the orthogonal transformations should be accumulated in the array Q, as follows: = 'N': do not modify Q; = 'U': modify (update) the array Q by the orthogonal transformations that are applied to the matrices in the array A to reduce them to periodic Schur form; = 'I': like COMPQ = 'U', except that each matrix in the array Q will be first initialized to the identity matrix; = 'P': use the parameters as encoded in QIND. QIND INTEGER array, dimension (K) If COMPQ = 'P', then this array describes the generation of the orthogonal factors as follows: If QIND(I) > 0, then the array Q(:,:,QIND(I)) is modified by the transformations corresponding to the i-th orthogonal factor in (1) and (2). If QIND(I) < 0, then the array Q(:,:,-QIND(I)) is initialized to the identity and modified by the transformations corresponding to the i-th orthogonal factor in (1) and (2). If QIND(I) = 0, then the transformations corresponding to the i-th orthogonal factor in (1), (2) are not applied.Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. N (input) INTEGER The order of each factor in the array A. N >= 0. H (input) INTEGER Hessenberg index. The factor A(:,:,H) is on entry in upper Hessenberg form. 1 <= H <= K. ILO (input) INTEGER IHI (input) INTEGER It is assumed that each factor in A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. 1 <= ILO <= IHI <= N, if N > 0; ILO = 1 and IHI = 0, if N = 0. S (input) INTEGER array, dimension (K) The leading K elements of this array must contain the signatures of the factors. Each entry in S must be either 1 or -1. A (input/output) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) On entry, the leading N-by-N-by-K part of this array must contain the factors in upper Hessenberg-triangular form, that is, A(:,:,H) is upper Hessenberg and the other factors are upper triangular. On exit, if JOB = 'S' and INFO = 0, the leading N-by-N-by-K part of this array contains the factors of A in periodic Schur form, that is, A(:,:,H) is upper quasi triangular and the other factors are upper triangular. On exit, if JOB = 'T' and INFO = 0, the leading N-by-N-by-K part of this array contains the factors of A as for the option JOB = 'S', but the product of the triangular factors corresponding to a 2-by-2 block in A(:,:,H) is diagonal. On exit, if JOB = 'E', then the leading N-by-N-by-K part of this array contains meaningless elements in the off- diagonal blocks. Consequently, the formulas (1) and (2) do not hold for the returned A and Q (if COMPQ <> 'N') in this case. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= MAX(1,N). LDA2 INTEGER The second leading dimension of the array A. LDA2 >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ1,LDQ2,K) On entry, if COMPQ = 'U', the leading N-by-N-by-K part of this array must contain the initial orthogonal factors as described in (1) and (2). On entry, if COMPQ = 'P', only parts of the leading N-by-N-by-K part of this array must contain some orthogonal factors as described by the parameters QIND. If COMPQ = 'I', this array should not be set on entry. On exit, if COMPQ = 'U' or COMPQ = 'I', the leading N-by-N-by-K part of this array contains the modified orthogonal factors as described in (1) and (2). On exit, if COMPQ = 'P', only parts of the leading N-by-N-by-K part contain some modified orthogonal factors as described by the parameters QIND. This array is not referenced if COMPQ = 'N'. LDQ1 INTEGER The first leading dimension of the array Q. LDQ1 >= 1, and, if COMPQ <> 'N', LDQ1 >= MAX(1,N). LDQ2 INTEGER The second leading dimension of the array Q. LDQ2 >= 1, and, if COMPQ <> 'N', LDQ2 >= MAX(1,N). ALPHAR (output) DOUBLE PRECISION array, dimension (N) On exit, if INFO = 0, the leading N elements of this array contain the scaled real parts of the eigenvalues of the matrix product A. The i-th eigenvalue of A is given by (ALPHAR(I) + ALPHAI(I)*SQRT(-1))/BETA(I) * BASE**SCAL(I), where BASE is the machine base (often 2.0). Complex conjugate eigenvalues appear in consecutive locations. ALPHAI (output) DOUBLE PRECISION array, dimension (N) On exit, if INFO = 0, the leading N elements of this array contain the scaled imaginary parts of the eigenvalues of A. BETA (output) DOUBLE PRECISION array, dimension (N) On exit, if INFO = 0, the leading N elements of this array contain indicators for infinite eigenvalues. That is, if BETA(I) = 0.0, then the i-th eigenvalue is infinite. Otherwise BETA(I) is set to 1.0. SCAL (output) INTEGER array, dimension (N) On exit, if INFO = 0, the leading N elements of this array contain the scaling parameters for the eigenvalues of A.Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK, and if IWARN > N, the nonzero absolute values in IWORK(2), ..., IWORK(N+1) are indices of the possibly inaccurate eigenvalues, as well as of the corresponding 1-by-1 or 2-by-2 diagonal blocks of the factors in the array A. The 2-by-2 blocks correspond to negative values in IWORK. One negative value is stored for each such eigenvalue pair. Its modulus indicates the starting index of a 2-by-2 block. This is also done for any value of IWARN, if a 2-by-2 block is found to have two real eigenvalues. On exit, if INFO = -22, IWORK(1) returns the minimum value of LIWORK. LIWORK INTEGER The length of the array IWORK. LIWORK >= 2*K+N. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK, and DWORK(2), ..., DWORK(1+K) contain the Frobenius norms of the factors of the formal matrix product used by the algorithm. On exit, if INFO = -24, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= K + MAX( 2*N, 8*K ).Warning Indicator
IWARN INTEGER = 0 : no warnings; = 1,..,N-1 : A is in periodic Schur form, but the algorithm was not able to reveal information about the eigenvalues from the 2-by-2 blocks. ALPHAR(i), ALPHAI(i), BETA(i) and SCAL(i), can be incorrect for i = 1, ..., IWARN+1; = N : some eigenvalues might be inaccurate; = N+1 : some eigenvalues might be inaccurate, and details can be found in IWORK.Error Indicator
INFO INTEGER = 0 : succesful exit; < 0 : if INFO = -i, the i-th argument had an illegal value; = 1,..,N : the periodic QZ iteration did not converge. A is not in periodic Schur form, but ALPHAR(i), ALPHAI(i), BETA(i) and SCAL(i), for i = INFO+1,...,N should be correct.Method
A modified version of the periodic QZ algorithm is used [1], [2].References
[1] Bojanczyk, A., Golub, G. H. and Van Dooren, P. The periodic Schur decomposition: algorithms and applications. In F.T. Luk (editor), Advanced Signal Processing Algorithms, Architectures, and Implementations III, Proc. SPIE Conference, vol. 1770, pp. 31-42, 1992. [2] Kressner, D. An efficient and reliable implementation of the periodic QZ algorithm. IFAC Workshop on Periodic Control Systems (PSYCO 2001), Como (Italy), August 27-28 2001. Periodic Control Systems 2001 (IFAC Proceedings Volumes), Pergamon.Numerical Aspects
The implemented method is numerically backward stable. 3 The algorithm requires 0(K N ) floating point operations.Further Comments
NoneExample
Program Text
* MB03BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, NMAX PARAMETER ( KMAX = 6, NMAX = 50 ) INTEGER LDA1, LDA2, LDQ1, LDQ2, LDWORK, LIWORK PARAMETER ( LDA1 = NMAX, LDA2 = NMAX, LDQ1 = NMAX, $ LDQ2 = NMAX, $ LDWORK = KMAX + MAX( 2*NMAX, 8*KMAX ), $ LIWORK = 2*KMAX + NMAX ) * * .. Local Scalars .. CHARACTER COMPQ, DEFL, JOB INTEGER H, I, IHI, ILO, INFO, IWARN, J, K, L, N * * .. Local Arrays .. INTEGER IWORK( LIWORK ), QIND( KMAX ), S( KMAX ), $ SCAL( NMAX ) DOUBLE PRECISION A( LDA1, LDA2, KMAX ), ALPHAI( NMAX ), $ ALPHAR( NMAX ), BETA( NMAX ), DWORK( LDWORK), $ Q( LDQ1, LDQ2, KMAX ) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB03BD * * .. Intrinsic Functions .. INTRINSIC MAX * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) JOB, DEFL, COMPQ, K, N, H, ILO, IHI IF( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE READ( NIN, FMT = * ) ( S( I ), I = 1, K ) READ( NIN, FMT = * ) ( ( ( A( I, J, L ), J = 1, N ), $ I = 1, N ), L = 1, K ) IF( LSAME( COMPQ, 'U' ) ) $ READ( NIN, FMT = * ) ( ( ( Q( I, J, L ), J = 1, N ), $ I = 1, N ), L = 1, K ) IF( LSAME( COMPQ, 'P' ) ) THEN READ( NIN, FMT = * ) ( QIND( I ), I = 1, K ) DO 10 L = 1, K IF( QIND( L ).GT.0 ) $ READ( NIN, FMT = * ) ( ( Q( I, J, QIND( L ) ), $ J = 1, N ), I = 1, N ) 10 CONTINUE END IF * Compute the eigenvalues and the transformed matrices, if * required. CALL MB03BD( JOB, DEFL, COMPQ, QIND, K, N, H, ILO, IHI, S, A, $ LDA1, LDA2, Q, LDQ1, LDQ2, ALPHAR, ALPHAI, BETA, $ SCAL, IWORK, LIWORK, DWORK, LDWORK, IWARN, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE IF( IWARN.EQ.0 ) THEN IF( LSAME( JOB, 'S' ) .OR. LSAME( JOB, 'T' ) ) THEN WRITE( NOUT, FMT = 99996 ) DO 30 L = 1, K WRITE( NOUT, FMT = 99988 ) L DO 20 I = 1, N WRITE( NOUT, FMT = 99995 ) ( A( I, J, L ), J = 1, N $ ) 20 CONTINUE 30 CONTINUE END IF IF( LSAME( COMPQ, 'U' ) .OR. LSAME( COMPQ, 'I' ) ) THEN WRITE( NOUT, FMT = 99994 ) DO 50 L = 1, K WRITE( NOUT, FMT = 99988 ) L DO 40 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q( I, J, L ), J = 1, N $ ) 40 CONTINUE 50 CONTINUE ELSE IF( LSAME( COMPQ, 'P' ) ) THEN WRITE( NOUT, FMT = 99994 ) DO 70 L = 1, K IF( QIND( L ).GT.0 ) THEN WRITE( NOUT, FMT = 99988 ) QIND( L ) DO 60 I = 1, N WRITE( NOUT, FMT = 99995 ) $ ( Q( I, J, QIND( L ) ), J = 1, N ) 60 CONTINUE END IF 70 CONTINUE END IF WRITE( NOUT, FMT = 99993 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAR( I ), I = 1, N ) WRITE( NOUT, FMT = 99992 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAI( I ), I = 1, N ) WRITE( NOUT, FMT = 99991 ) WRITE( NOUT, FMT = 99995 ) ( BETA( I ), I = 1, N ) WRITE( NOUT, FMT = 99990 ) WRITE( NOUT, FMT = 99989 ) ( SCAL( I ), I = 1, N ) ELSE WRITE( NOUT, FMT = 99987 ) IWARN END IF END IF STOP * 99999 FORMAT( 'MB03BD EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT( 'INFO on exit from MB03BD = ', I2 ) 99996 FORMAT( 'The matrix A on exit is ' ) 99995 FORMAT( 50( 1X, F8.4 ) ) 99994 FORMAT( 'The matrix Q on exit is ' ) 99993 FORMAT( 'The vector ALPHAR is ' ) 99992 FORMAT( 'The vector ALPHAI is ' ) 99991 FORMAT( 'The vector BETA is ' ) 99990 FORMAT( 'The vector SCAL is ' ) 99989 FORMAT( 50( 1X, I8 ) ) 99988 FORMAT( 'The factor ', I2, ' is ' ) 99987 FORMAT( 'IWARN on exit from MB03BD = ', I2 ) ENDProgram Data
MB03BD EXAMPLE PROGRAM DATA S C I 3 3 2 1 3 -1 1 -1 2.0 0.0 1.0 0.0 -2.0 -1.0 0.0 0.0 3.0 1.0 2.0 0.0 4.0 -1.0 3.0 0.0 3.0 1.0 1.0 0.0 1.0 0.0 4.0 -1.0 0.0 0.0 -2.0Program Results
MB03BD EXAMPLE PROGRAM RESULTS The matrix A on exit is The factor 1 is -2.1306 0.8205 0.7462 0.0000 2.8786 1.0564 0.0000 0.0000 1.9566 The factor 2 is -4.0763 -1.0376 -2.6948 -1.9525 1.8283 2.2987 0.0000 0.0000 1.8990 The factor 3 is 3.3463 -2.3239 -0.5623 0.0000 1.0778 -0.0646 0.0000 0.0000 -2.2180 The matrix Q on exit is The factor 1 is 0.2594 0.7715 -0.5809 -0.9552 0.1162 -0.2723 -0.1426 0.6255 0.7671 The factor 2 is -0.1766 0.8037 -0.5683 -0.9636 -0.0234 0.2664 0.2008 0.5946 0.7785 The factor 3 is 0.6295 0.7315 0.2619 -0.7394 0.4605 0.4911 0.2386 -0.5028 0.8308 The vector ALPHAR is 0.3230 0.3230 -0.8752 The vector ALPHAI is 0.5694 -0.5694 0.0000 The vector BETA is 1.0000 1.0000 1.0000 The vector SCAL is 0 0 -1
Purpose
To apply at most 20 iterations of a real single shifted periodic QZ algorithm to the 2-by-2 product of matrices stored in the array A.Specification
SUBROUTINE MB03BE( K, AMAP, S, SINV, A, LDA1, LDA2 ) C .. Scalar Arguments .. INTEGER K, LDA1, LDA2, SINV C .. Array Arguments .. INTEGER AMAP(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*)Arguments
Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input/output) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) On entry, the leading 2-by-2-by-K part of this array must contain a 2-by-2 product (implicitly represented by its K factors) in upper Hessenberg form. On exit, the leading 2-by-2-by-K part of this array contains the product after at most 20 iterations of a real shifted periodic QZ algorithm. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= 2. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= 2.Method
Ten iterations of a real single shifted periodic QZ algorithm are applied to the 2-by-2 matrix product A.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To apply at most 20 iterations of a real single shifted periodic QZ algorithm to the 2-by-2 product of matrices stored in the array A. The Hessenberg matrix is the last one of the formal matrix product.Specification
SUBROUTINE MB03BF( K, AMAP, S, SINV, A, LDA1, LDA2, ULP ) C .. Scalar Arguments .. INTEGER K, LDA1, LDA2, SINV DOUBLE PRECISION ULP C .. Array Arguments .. INTEGER AMAP(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*)Arguments
Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. AMAP (input) INTEGER array, dimension (K) The map for accessing the factors, i.e., if AMAP(I) = J, then the factor A_I is stored at the J-th position in A. S (input) INTEGER array, dimension (K) The signature array. Each entry of S must be 1 or -1. SINV (input) INTEGER Signature multiplier. Entries of S are virtually multiplied by SINV. A (input/output) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) On entry, the leading 2-by-2-by-K part of this array must contain a 2-by-2 product (implicitly represented by its K factors) in upper Hessenberg form. The Hessenberg matrix is the last one of the formal matrix product. On exit, the leading 2-by-2-by-K part of this array contains the product after at most 20 iterations of a real shifted periodic QZ algorithm. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= 2. LDA2 INTEGER The second leading dimension of the array A. LDA2 >= 2. ULP INTEGER The machine relation precision.Method
Twenty iterations of a real single shifted periodic QZ algorithm are applied to the 2-by-2 matrix product A.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To find the eigenvalues of the complex generalized matrix product S(1) S(2) S(K) A(:,:,1) * A(:,:,2) * ... * A(:,:,K) , S(1) = 1, where A(:,:,1) is upper Hessenberg and A(:,:,i) is upper triangular, i = 2, ..., K, using a single-shift version of the periodic QZ method. In addition, A may be reduced to periodic Schur form by unitary transformations: all factors A(:,:,i) become upper triangular. If COMPQ = 'V' or COMPQ = 'I', then the unitary factors are computed and stored in the array Q so that for S(I) = 1, H Q(:,:,I)(in) A(:,:,I)(in) Q(:,:,MOD(I,K)+1)(in) H (1) = Q(:,:,I)(out) A(:,:,I)(out) Q(:,:,MOD(I,K)+1)(out), and for S(I) = -1, H Q(:,:,MOD(I,K)+1)(in) A(:,:,I)(in) Q(:,:,I)(in) H (2) = Q(:,:,MOD(I,K)+1)(out) A(:,:,I)(out) Q(:,:,I)(out).Specification
SUBROUTINE MB03BZ( JOB, COMPQ, K, N, ILO, IHI, S, A, LDA1, LDA2, $ Q, LDQ1, LDQ2, ALPHA, BETA, SCAL, DWORK, $ LDWORK, ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, JOB INTEGER IHI, ILO, INFO, K, LDA1, LDA2, LDQ1, LDQ2, $ LDWORK, LZWORK, N C .. Array Arguments .. INTEGER S(*), SCAL(*) DOUBLE PRECISION DWORK(*) COMPLEX*16 A(LDA1, LDA2, *), ALPHA(*), BETA(*), $ Q(LDQ1, LDQ2, *), ZWORK(*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; A will not necessarily be put into periodic Schur form; = 'S': put A into periodic Schur form, and return the eigenvalues in ALPHA, BETA, and SCAL. COMPQ CHARACTER*1 Specifies whether or not the unitary transformations should be accumulated in the array Q, as follows: = 'N': do not modify Q; = 'V': modify the array Q by the unitary transformations that are applied to the matrices in the array A to reduce them to periodic Schur form; = 'I': like COMPQ = 'V', except that each matrix in the array Q will be first initialized to the identity matrix.Input/Output Parameters
K (input) INTEGER The number of factors. K >= 1. N (input) INTEGER The order of each factor in the array A. N >= 0. ILO (input) INTEGER IHI (input) INTEGER It is assumed that each factor in A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. 1 <= ILO <= IHI <= N, if N > 0; ILO = 1 and IHI = 0, if N = 0. S (input) INTEGER array, dimension (K) The leading K elements of this array must contain the signatures of the factors. Each entry in S must be either 1 or -1. By definition, S(1) must be set to 1. A (input/output) COMPLEX*16 array, dimension (LDA1,LDA2,K) On entry, the leading N-by-N-by-K part of this array must contain the factors in upper Hessenberg-triangular form, that is, A(:,:,1) is upper Hessenberg and the other factors are upper triangular. On exit, if JOB = 'S' and INFO = 0, the leading N-by-N-by-K part of this array contains the factors of A in periodic Schur form. All factors are reduced to upper triangular form and, moreover, A(:,:,2), ..., A(:,:,K) are normalized so that their diagonals contain nonnegative real numbers. On exit, if JOB = 'E', then the leading N-by-N-by-K part of this array contains meaningless elements. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= MAX(1,N). LDA2 INTEGER The second leading dimension of the array A. LDA2 >= MAX(1,N). Q (input/output) COMPLEX*16 array, dimension (LDQ1,LDQ2,K) On entry, if COMPQ = 'V', the leading N-by-N-by-K part of this array must contain the initial unitary factors as described in (1) and (2). On exit, if COMPQ = 'V' or COMPQ = 'I', the leading N-by-N-by-K part of this array contains the modified unitary factors as described in (1) and (2). This array is not referenced if COMPQ = 'N'. LDQ1 INTEGER The first leading dimension of the array Q. LDQ1 >= 1, and, if COMPQ <> 'N', LDQ1 >= MAX(1,N). LDQ2 INTEGER The second leading dimension of the array Q. LDQ2 >= 1, and, if COMPQ <> 'N', LDQ2 >= MAX(1,N). ALPHA (output) COMPLEX*16 array, dimension (N) On exit, if INFO = 0, the leading N elements of this array contain the scaled eigenvalues of the matrix product A. The i-th eigenvalue of A is given by ALPHA(I) / BETA(I) * BASE**(SCAL(I)), where ABS(ALPHA(I)) = 0.0 or 1.0 <= ABS(ALPHA(I)) < BASE, and BASE is the machine base (normally 2.0). BETA (output) COMPLEX*16 array, dimension (N) On exit, if INFO = 0, the leading N elements of this array contain indicators for infinite eigenvalues. That is, if BETA(I) = 0.0, then the i-th eigenvalue is infinite. Otherwise BETA(I) is set to 1.0. SCAL (output) INTEGER array, dimension (N) On exit, if INFO = 0, the leading N elements of this array contain the scaling parameters for the eigenvalues of A.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the minimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N). ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the minimal value of LZWORK. LZWORK INTEGER The length of the array ZWORK. LZWORK >= MAX(1,N).Error Indicator
INFO INTEGER = 0 : succesful exit; < 0 : if INFO = -i, the i-th argument had an illegal value; = 1,..,N : the periodic QZ iteration did not converge. A is not in periodic Schur form, but ALPHA(I), BETA(I), and SCAL(I), for I = INFO+1,...,N should be correct.Method
A slightly modified version of the periodic QZ algorithm is used. For more details, see [2].References
[1] Bojanczyk, A., Golub, G. H. and Van Dooren, P. The periodic Schur decomposition: algorithms and applications. In F.T. Luk (editor), Advanced Signal Processing Algorithms, Architectures, and Implementations III, Proc. SPIE Conference, vol. 1770, pp. 31-42, 1992. [2] Kressner, D. An efficient and reliable implementation of the periodic QZ algorithm. IFAC Workshop on Periodic Control Systems (PSYCO 2001), Como (Italy), August 27-28 2001. Periodic Control Systems 2001 (IFAC Proceedings Volumes), Pergamon.Numerical Aspects
The implemented method is numerically backward stable. 3 The algorithm requires 0(K N ) floating point operations.Further Comments
NoneExample
Program Text
* MB03BZ EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, NMAX PARAMETER ( KMAX = 6, NMAX = 50 ) INTEGER LDA1, LDA2, LDQ1, LDQ2, LDWORK, LZWORK PARAMETER ( LDA1 = NMAX, LDA2 = NMAX, LDQ1 = NMAX, $ LDQ2 = NMAX, LDWORK = NMAX, LZWORK = NMAX ) * * .. Local Scalars .. CHARACTER COMPQ, JOB INTEGER I, IHI, ILO, INFO, J, K, L, N * * .. Local Arrays .. COMPLEX*16 A( LDA1, LDA2, KMAX ), ALPHA( NMAX ), $ BETA( NMAX ), Q( LDQ1, LDQ2, KMAX ), $ ZWORK( LZWORK ) DOUBLE PRECISION DWORK( LDWORK) INTEGER S( KMAX ), SCAL( NMAX ) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB03BZ * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) JOB, COMPQ, K, N, ILO, IHI IF( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE READ( NIN, FMT = * ) ( S( I ), I = 1, K ) READ( NIN, FMT = * ) ( ( ( A( I, J, L ), J = 1, N ), $ I = 1, N ), L = 1, K ) IF( LSAME( COMPQ, 'V' ) ) $ READ( NIN, FMT = * ) ( ( ( Q( I, J, L ), J = 1, N ), $ I = 1, N ), L = 1, K ) * Compute the eigenvalues and the transformed matrices, if * required. CALL MB03BZ( JOB, COMPQ, K, N, ILO, IHI, S, A, LDA1, LDA2, $ Q, LDQ1, LDQ2, ALPHA, BETA, SCAL, DWORK, LDWORK, $ ZWORK, LZWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE IF( LSAME( JOB, 'S' ) ) THEN WRITE( NOUT, FMT = 99996 ) DO 20 L = 1, K WRITE( NOUT, FMT = 99995 ) L DO 10 I = 1, N WRITE( NOUT, FMT = 99994 ) ( A( I, J, L ), J = 1, N $ ) 10 CONTINUE 20 CONTINUE END IF IF( .NOT.LSAME( COMPQ, 'N' ) ) THEN WRITE( NOUT, FMT = 99993 ) DO 40 L = 1, K WRITE( NOUT, FMT = 99995 ) L DO 30 I = 1, N WRITE( NOUT, FMT = 99994 ) ( Q( I, J, L ), J = 1, N $ ) 30 CONTINUE 40 CONTINUE END IF WRITE( NOUT, FMT = 99992 ) WRITE( NOUT, FMT = 99994 ) ( ALPHA( I ), I = 1, N ) WRITE( NOUT, FMT = 99991 ) WRITE( NOUT, FMT = 99994 ) ( BETA( I ), I = 1, N ) WRITE( NOUT, FMT = 99990 ) WRITE( NOUT, FMT = 99989 ) ( SCAL( I ), I = 1, N ) END IF END IF STOP * 99999 FORMAT( 'MB03BZ EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT( 'INFO on exit from MB03BZ = ', I2 ) 99996 FORMAT(/'The matrix A on exit is ' ) 99995 FORMAT( 'The factor ', I2, ' is ' ) 99994 FORMAT( 50( 1X, F9.4, SP, F9.4, S, 'i ') ) 99993 FORMAT(/'The matrix Q on exit is ' ) 99992 FORMAT(/'The vector ALPHA is ' ) 99991 FORMAT( 'The vector BETA is ' ) 99990 FORMAT( 'The vector SCAL is ' ) 99989 FORMAT( 50( 1X, I8 ) ) ENDProgram Data
MB03BZ EXAMPLE PROGRAM DATA S I 3 4 1 4 1 -1 1 (0.8637,0.9326) (0.8819,0.4850) (0.5920,0.8826) (0.8991,0.9040) (0.6994,0.8588) (0.9527,0.2672) (0.5087,0.0621) (0.9653,0.5715) 0 (0.1561,0.1898) (0.9514,0.9266) (0.6582,0.3102) 0 0 (0.8649,0.1265) (0.1701,0.0013) (0.5113,0.7375) (0.6869,0.7692) (0.7812,0.1467) (0.7216,0.9498) 0 (0.1319,0.9137) (0.5879,0.0201) (0.9834,0.0549) 0 0 (0.7711,0.2422) (0.9468,0.3280) 0 0 0 (0.2219,0.3971) (0.0158,0.4042) (0.0082,0.2033) (0.1028,0.9913) (0.6954,0.1987) 0 (0.5066,0.4587) (0.1060,0.6949) (0.5402,0.0970) 0 0 (0.4494,0.3700) (0.8492,0.4882) 0 0 0 (0.2110,0.5824)Program Results
MB03BZ EXAMPLE PROGRAM RESULTS The matrix A on exit is The factor 1 is 0.6053 +1.0311i -1.7227 -0.5753i 1.2428 -1.2632i 0.9445 -0.4317i 0.0000 +0.0000i -0.2596 +1.0235i 0.4673 -0.2403i -0.5579 -1.1564i 0.0000 +0.0000i 0.0000 +0.0000i -0.3336 -0.3367i 0.0687 +0.0261i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.2014 +0.0057i The factor 2 is 1.1118 +0.0000i -1.4173 +1.1607i 0.3271 -0.5800i 0.5291 -0.6341i 0.0000 +0.0000i 0.9051 +0.0000i 0.1710 +0.1014i -0.2696 -0.3549i 0.0000 +0.0000i 0.0000 +0.0000i 0.3599 +0.0000i 0.0231 -0.5865i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.8410 +0.0000i The factor 3 is 1.1554 +0.0000i -0.7577 +0.0825i 0.1284 -0.0063i 1.1175 -0.0778i 0.0000 +0.0000i 0.5216 +0.0000i -0.5761 +0.2972i -0.3534 -0.3595i 0.0000 +0.0000i 0.0000 +0.0000i 0.2750 +0.0000i 0.2587 -0.1664i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.6015 +0.0000i The matrix Q on exit is The factor 1 is 0.6033 -0.4021i 0.3478 -0.1834i -0.0029 -0.4458i -0.3157 +0.1462i 0.1519 -0.3002i 0.6010 +0.1411i 0.0134 +0.5692i 0.4223 -0.0574i 0.1002 -0.5387i -0.4199 +0.3933i 0.1148 +0.2694i -0.3713 -0.3810i -0.0599 -0.2395i -0.0968 +0.3521i 0.2342 -0.5801i 0.6247 -0.1555i The factor 2 is 0.3325 +0.6289i 0.0930 +0.3421i -0.1849 -0.1715i -0.5470 -0.0734i 0.3247 -0.4396i 0.1766 -0.1691i 0.2307 -0.3746i -0.2617 -0.6160i 0.2180 -0.2074i -0.3853 +0.1978i -0.6852 +0.2781i 0.1492 -0.3909i -0.0268 -0.3223i -0.0623 +0.7893i 0.0957 -0.4323i 0.1716 +0.2072i The factor 3 is 0.6791 +0.1138i 0.0183 +0.2703i 0.3289 -0.2770i -0.2355 -0.4605i 0.5111 -0.1775i 0.3990 +0.1941i -0.0851 +0.4779i 0.4563 +0.2580i 0.2687 -0.3788i -0.7974 -0.0691i -0.2836 +0.1192i 0.1765 -0.1340i 0.1098 -0.0739i -0.2845 -0.0903i 0.6651 +0.2062i -0.2810 +0.5741i The vector ALPHA is 0.6290 +1.0715i -0.2992 +1.1797i -1.0195 -1.0290i -1.1523 +0.0326i The vector BETA is 1.0000 +0.0000i 1.0000 +0.0000i 1.0000 +0.0000i 1.0000 +0.0000i The vector SCAL is 0 -1 -2 -3
Purpose
To compute orthogonal matrices Q1, Q2, Q3 for a real 2-by-2, 3-by-3, or 4-by-4 regular block upper triangular pencil ( A11 A12 ) ( B11 B12 ) ( D11 D12 ) aAB - bD = a ( ) ( ) - b ( ), (1) ( 0 A22 ) ( 0 B22 ) ( 0 D22 ) such that the pencil a(Q3' A Q2 )(Q2' B Q1 ) - b(Q3' D Q1) is still in block upper triangular form, but the eigenvalues in Spec(A11 B11, D11), Spec(A22 B22, D22) are exchanged, where Spec(X,Y) denotes the spectrum of the matrix pencil (X,Y), and M' denotes the transpose of the matrix M. Optionally, to upper triangularize the real regular pencil in block lower triangular form ( A11 0 ) ( B11 0 ) ( D11 0 ) aAB - bD = a ( ) ( ) - b ( ), (2) ( A21 A22 ) ( B21 B22 ) ( D21 D22 ) while keeping the eigenvalues in the same diagonal position.Specification
SUBROUTINE MB03CD( UPLO, N1, N2, PREC, A, LDA, B, LDB, D, LDD, Q1, $ LDQ1, Q2, LDQ2, Q3, LDQ3, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER INFO, LDA, LDB, LDD, LDQ1, LDQ2, LDQ3, LDWORK, $ N1, N2 DOUBLE PRECISION PREC C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), D( LDD, * ), $ DWORK( * ), Q1( LDQ1, * ), Q2( LDQ2, * ), $ Q3( LDQ3, * )Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies if the pencil is in lower or upper block triangular form on entry, as follows: = 'U': Upper block triangular, eigenvalues are exchanged on exit; = 'L': Lower block triangular, eigenvalues are not exchanged on exit.Input/Output Parameters
N1 (input/output) INTEGER Size of the upper left block, N1 <= 2. If UPLO = 'U' and INFO = 0, or UPLO = 'L' and INFO <> 0, N1 and N2 are exchanged on exit; otherwise, N1 is unchanged on exit. N2 (input/output) INTEGER Size of the lower right block, N2 <= 2. If UPLO = 'U' and INFO = 0, or UPLO = 'L' and INFO <> 0, N1 and N2 are exchanged on exit; otherwise, N2 is unchanged on exit. PREC (input) DOUBLE PRECISION The machine precision, (relative machine precision)*base. See the LAPACK Library routine DLAMCH. A (input or input/output) DOUBLE PRECISION array, dimension (LDA, N1+N2) On entry, the leading (N1+N2)-by-(N1+N2) part of this array must contain the matrix A of the pencil aAB - bD. The (2,1) block, if UPLO = 'U', or the (1,2) block, if UPLO = 'L', need not be set to zero. On exit, if N1 = N2 = 1, this array contains the matrix [ 0 1 ] J' A J, where J = [ -1 0 ]; otherwise, this array is unchanged on exit. LDA INTEGER The leading dimension of the array A. LDA >= N1+N2. B (input or input/output) DOUBLE PRECISION array, dimension (LDB, N1+N2) On entry, the leading (N1+N2)-by-(N1+N2) part of this array must contain the matrix B of the pencil aAB - bD. The (2,1) block, if UPLO = 'U', or the (1,2) block, if UPLO = 'L', need not be set to zero. On exit, if N1 = N2 = 1, this array contains the matrix J' B J; otherwise, this array is unchanged on exit. LDB INTEGER The leading dimension of the array B. LDB >= N1+N2. D (input/output) DOUBLE PRECISION array, dimension (LDD, N1+N2) On entry, the leading (N1+N2)-by-(N1+N2) part of this array must contain the matrix D of the pencil aAB - bD. On exit, if N1 = 2 or N2 = 2, the leading (N1+N2)-by-(N1+N2) part of this array contains the transformed matrix D in real Schur form. If N1 = 1 and N2 = 1, this array contains the matrix J' D J. LDD INTEGER The leading dimension of the array D. LDD >= N1+N2. Q1 (output) DOUBLE PRECISION array, dimension (LDQ1, N1+N2) The leading (N1+N2)-by-(N1+N2) part of this array contains the first orthogonal transformation matrix. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= N1+N2. Q2 (output) DOUBLE PRECISION array, dimension (LDQ2, N1+N2) The leading (N1+N2)-by-(N1+N2) part of this array contains the second orthogonal transformation matrix. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= N1+N2. Q3 (output) DOUBLE PRECISION array, dimension (LDQ3, N1+N2) The leading (N1+N2)-by-(N1+N2) part of this array contains the third orthogonal transformation matrix. LDQ3 INTEGER The leading dimension of the array Q3. LDQ3 >= N1+N2.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) If N1+N2 = 2 then DWORK is not referenced. LDWORK INTEGER The dimension of the array DWORK. If N1+N2 = 2, then LDWORK = 0; otherwise, LDWORK >= 16*N1 + 10*N2 + 23, UPLO = 'U'; LDWORK >= 10*N1 + 16*N2 + 23, UPLO = 'L'.Error Indicator
INFO INTEGER = 0: succesful exit; = 1: the QZ iteration failed in the LAPACK routine DGGEV; = 2: another error occured while executing a routine in DGGEV; = 3: the QZ iteration failed in the LAPACK routine DGGES; = 4: another error occured during execution of DGGES; = 5: reordering of aA*B - bD in the LAPACK routine DTGSEN failed because the transformed matrix pencil aA*B - bD would be too far from generalized Schur form; the problem is very ill-conditioned.Method
The algorithm uses orthogonal transformations as described in [2] (page 21). The QZ algorithm is used for N1 = 2 or N2 = 2, but it always acts on an upper block triangular pencil.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical computation of deflating subspaces of skew- Hamiltonian/Hamiltonian pencils. SIAM J. Matrix Anal. Appl., 24 (1), pp. 165-190, 2002. [2] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute unitary matrices Q1, Q2, and Q3 for a complex 2-by-2 regular pencil aAB - bD, with A, B, D upper triangular, such that Q3' A Q2, Q2' B Q1, Q3' D Q1 are still upper triangular, but the eigenvalues are in reversed order. The matrices Q1, Q2, and Q3 are represented by ( CO1 SI1 ) ( CO2 SI2 ) ( CO3 SI3 ) Q1 = ( ), Q2 = ( ), Q3 = ( ). ( -SI1' CO1 ) ( -SI2' CO2 ) ( -SI3' CO3 ) The notation M' denotes the conjugate transpose of the matrix M.Specification
SUBROUTINE MB03CZ( A, LDA, B, LDB, D, LDD, CO1, SI1, CO2, SI2, $ CO3, SI3 ) C .. Scalar Arguments .. INTEGER LDA, LDB, LDD DOUBLE PRECISION CO1, CO2, CO3 COMPLEX*16 SI1, SI2, SI3 C .. Array Arguments .. COMPLEX*16 A( LDA, * ), B( LDB, * ), D( LDD, * )Arguments
Input/Output Parameters
A (input) COMPLEX*16 array, dimension (LDA, 2) On entry, the leading 2-by-2 upper triangular part of this array must contain the matrix A of the pencil. The (2,1) entry is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= 2. B (input) COMPLEX*16 array, dimension (LDB, 2) On entry, the leading 2-by-2 upper triangular part of this array must contain the matrix B of the pencil. The (2,1) entry is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= 2. D (input) COMPLEX*16 array, dimension (LDD, 2) On entry, the leading 2-by-2 upper triangular part of this array must contain the matrix D of the pencil. The (2,1) entry is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= 2. CO1 (output) DOUBLE PRECISION The upper left element of the unitary matrix Q1. SI1 (output) COMPLEX*16 The upper right element of the unitary matrix Q1. CO2 (output) DOUBLE PRECISION The upper left element of the unitary matrix Q2. SI2 (output) COMPLEX*16 The upper right element of the unitary matrix Q2. CO3 (output) DOUBLE PRECISION The upper left element of the unitary matrix Q3. SI3 (output) COMPLEX*16 The upper right element of the unitary matrix Q3.Method
The algorithm uses unitary transformations as described on page 37 in [1].References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute orthogonal matrices Q1 and Q2 for a real 2-by-2, 3-by-3, or 4-by-4 regular block upper triangular pencil ( A11 A12 ) ( B11 B12 ) aA - bB = a ( ) - b ( ), (1) ( 0 A22 ) ( 0 B22 ) such that the pencil a(Q2' A Q1) - b(Q2' B Q1) is still in block upper triangular form, but the eigenvalues in Spec(A11, B11), Spec(A22, B22) are exchanged, where Spec(X,Y) denotes the spectrum of the matrix pencil (X,Y) and the notation M' denotes the transpose of the matrix M. Optionally, to upper triangularize the real regular pencil in block lower triangular form ( A11 0 ) ( B11 0 ) aA - bB = a ( ) - b ( ), (2) ( A21 A22 ) ( B21 B22 ) while keeping the eigenvalues in the same diagonal position.Specification
SUBROUTINE MB03DD( UPLO, N1, N2, PREC, A, LDA, B, LDB, Q1, LDQ1, $ Q2, LDQ2, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER INFO, LDA, LDB, LDQ1, LDQ2, LDWORK, N1, N2 DOUBLE PRECISION PREC C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), $ Q1( LDQ1, * ), Q2( LDQ2, * )Arguments
Mode Parameters
UPLO CHARACTER*1 Specifies if the pencil is in lower or upper block triangular form on entry, as follows: = 'U': Upper block triangular, eigenvalues are exchanged on exit; = 'T': Upper block triangular, B triangular, eigenvalues are exchanged on exit; = 'L': Lower block triangular, eigenvalues are not exchanged on exit.Input/Output Parameters
N1 (input/output) INTEGER Size of the upper left block, N1 <= 2. If UPLO = 'U' or UPLO = 'T' and INFO = 0, or UPLO = 'L' and INFO <> 0, N1 and N2 are exchanged on exit; otherwise, N1 is unchanged on exit. N2 (input/output) INTEGER Size of the lower right block, N2 <= 2. If UPLO = 'U' or UPLO = 'T' and INFO = 0, or UPLO = 'L' and INFO <> 0, N1 and N2 are exchanged on exit; otherwise, N2 is unchanged on exit. PREC (input) DOUBLE PRECISION The machine precision, (relative machine precision)*base. See the LAPACK Library routine DLAMCH. A (input/output) DOUBLE PRECISION array, dimension (LDA, N1+N2) On entry, the leading (N1+N2)-by-(N1+N2) part of this array must contain the matrix A of the pencil aA - bB. On exit, if N1 = N2 = 1, this array is unchanged, if UPLO = 'U' or UPLO = 'T', but, if UPLO = 'L', it contains [ 0 1 ] the matrix J' A J, where J = [ -1 0 ]; otherwise, this array contains the transformed quasi-triangular matrix in generalized real Schur form. LDA INTEGER The leading dimension of the array A. LDA >= N1+N2. B (input/output) DOUBLE PRECISION array, dimension (LDB, N1+N2) On entry, the leading (N1+N2)-by-(N1+N2) part of this array must contain the matrix B of the pencil aA - bB. On exit, if N1 = N2 = 1, this array is unchanged, if UPLO = 'U' or UPLO = 'T', but, if UPLO = 'L', it contains the matrix J' B J; otherwise, this array contains the transformed upper triangular matrix in generalized real Schur form. LDB INTEGER The leading dimension of the array B. LDB >= N1+N2. Q1 (output) DOUBLE PRECISION array, dimension (LDQ1, N1+N2) The leading (N1+N2)-by-(N1+N2) part of this array contains the first orthogonal transformation matrix. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= N1+N2. Q2 (output) DOUBLE PRECISION array, dimension (LDQ2, N1+N2) The leading (N1+N2)-by-(N1+N2) part of this array contains the second orthogonal transformation matrix. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= N1+N2.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) If N1+N2 = 2 then DWORK is not referenced. LDWORK INTEGER The dimension of the array DWORK. If N1+N2 = 2, then LDWORK = 0; otherwise, LDWORK >= 16*N1 + 10*N2 + 23, if UPLO = 'U'; LDWORK >= 7*N1 + 7*N2 + 16, if UPLO = 'T'; LDWORK >= 10*N1 + 16*N2 + 23, if UPLO = 'L'. For good performance LDWORK should be generally larger.Error Indicator
INFO INTEGER = 0: succesful exit; = 3: the QZ iteration failed in the LAPACK routine DGGES (if UPLO <> 'T') or DHGEQZ (if UPLO = 'T'); = 4: another error occured during execution of DHGEQZ; = 5: reordering of aA - bB in the LAPACK routine DTGSEN failed because the transformed matrix pencil aA - bB would be too far from generalized Schur form; the problem is very ill-conditioned.Method
The algorithm uses orthogonal transformations as described in [2] (page 30). The QZ algorithm is used for N1 = 2 or N2 = 2, but it always acts on an upper block triangular pencil.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical computation of deflating subspaces of skew- Hamiltonian/Hamiltonian pencils. SIAM J. Matrix Anal. Appl., 24 (1), pp. 165-190, 2002. [2] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute unitary matrices Q1 and Q2 for a complex 2-by-2 regular pencil aA - bB with A, B upper triangular, such that Q2' (aA - bB) Q1 is still upper triangular but the eigenvalues are in reversed order. The matrices Q1 and Q2 are represented by ( CO1 SI1 ) ( CO2 SI2 ) Q1 = ( ), Q2 = ( ). ( -SI1' CO1 ) ( -SI2' CO2 ) The notation M' denotes the conjugate transpose of the matrix M.Specification
SUBROUTINE MB03DZ( A, LDA, B, LDB, CO1, SI1, CO2, SI2 ) C .. Scalar Arguments .. INTEGER LDA, LDB DOUBLE PRECISION CO1, CO2 COMPLEX*16 SI1, SI2 C .. Array Arguments .. COMPLEX*16 A( LDA, * ), B( LDB, * )Arguments
Input/Output Parameters
A (input) COMPLEX*16 array, dimension (LDA, 2) On entry, the leading 2-by-2 upper triangular part of this array must contain the matrix A of the pencil. The (2,1) entry is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= 2. B (input) COMPLEX*16 array, dimension (LDB, 2) On entry, the leading 2-by-2 upper triangular part of this array must contain the matrix B of the pencil. The (2,1) entry is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= 2. CO1 (output) DOUBLE PRECISION The upper left element of the unitary matrix Q1. SI1 (output) COMPLEX*16 The upper right element of the unitary matrix Q1. CO2 (output) DOUBLE PRECISION The upper left element of the unitary matrix Q2. SI2 (output) COMPLEX*16 The upper right element of the unitary matrix Q2.Method
The algorithm uses unitary transformations as described on page 42 in [1].References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute orthogonal matrices Q1, Q2, Q3 for a real 2-by-2 or 4-by-4 regular pencil ( A11 0 ) ( B11 0 ) ( 0 D12 ) aAB - bD = a ( ) ( ) - b ( ), (1) ( 0 A22 ) ( 0 B22 ) ( D21 0 ) such that Q3' A Q2 and Q2' B Q1 are upper triangular, Q3' D Q1 is upper quasi-triangular, and the eigenvalues with negative real parts (if there are any) are allocated on the top. The notation M' denotes the transpose of the matrix M. The submatrices A11, A22, B11, B22 and D12 are upper triangular. If D21 is 2-by-2, then all other blocks are nonsingular and the product -1 -1 -1 -1 A22 D21 B11 A11 D12 B22 has a pair of complex conjugate eigenvalues.Specification
SUBROUTINE MB03ED( N, PREC, A, LDA, B, LDB, D, LDD, Q1, LDQ1, Q2, $ LDQ2, Q3, LDQ3, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDD, LDQ1, LDQ2, LDQ3, LDWORK, $ N DOUBLE PRECISION PREC C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), D( LDD, * ), $ DWORK( * ), Q1( LDQ1, * ), Q2( LDQ2, * ), $ Q3( LDQ3, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the input pencil, N = 2 or N = 4. PREC (input) DOUBLE PRECISION The machine precision, (relative machine precision)*base. See the LAPACK Library routine DLAMCH. A (input) DOUBLE PRECISION array, dimension (LDA, N) The leading N-by-N upper triangular part of this array must contain the upper triangular matrix A of the pencil aAB - bD. The strictly lower triangular part and the entries of the (1,2) block are not referenced. LDA INTEGER The leading dimension of the array A. LDA >= N. B (input) DOUBLE PRECISION array, dimension (LDB, N) The leading N-by-N upper triangular part of this array must contain the upper triangular matrix B of the pencil aAB - bD. The strictly lower triangular part and the entries of the (1,2) block are not referenced. LDB INTEGER The leading dimension of the array B. LDB >= N. D (input/output) DOUBLE PRECISION array, dimension (LDD, N) On entry, the leading N-by-N part of this array must contain the matrix D of the pencil aAB - bD. On exit, if N = 4, the leading N-by-N part of this array contains the transformed matrix D in real Schur form. If N = 2, this array is unchanged on exit. LDD INTEGER The leading dimension of the array D. LDD >= N. Q1 (output) DOUBLE PRECISION array, dimension (LDQ1, N) The leading N-by-N part of this array contains the first orthogonal transformation matrix. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= N. Q2 (output) DOUBLE PRECISION array, dimension (LDQ2, N) The leading N-by-N part of this array contains the second orthogonal transformation matrix. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= N. Q3 (output) DOUBLE PRECISION array, dimension (LDQ3, N) The leading N-by-N part of this array contains the third orthogonal transformation matrix. LDQ3 INTEGER The leading dimension of the array Q3. LDQ3 >= N.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) If N = 2, then DWORK is not referenced. LDWORK INTEGER The dimension of the array DWORK. If N = 4, then LDWORK >= 79. For good performance LDWORK should be generally larger. If N = 2, then LDWORK >= 0.Error Indicator
INFO INTEGER = 0: succesful exit; = 1: the QZ iteration failed in the LAPACK routine DGGES; = 2: another error occured during execution of DGGES.Method
The algorithm uses orthogonal transformations as described on page 20 in [2].References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical computation of deflating subspaces of skew- Hamiltonian/Hamiltonian pencils. SIAM J. Matrix Anal. Appl., 24 (1), pp. 165-190, 2002. [2] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute orthogonal matrices Q1 and Q2 for a real 2-by-2 or 4-by-4 regular pencil ( A11 0 ) ( 0 B12 ) aA - bB = a ( ) - b ( ), (1) ( 0 A22 ) ( B21 0 ) such that Q2' A Q1 is upper triangular, Q2' B Q1 is upper quasi- triangular, and the eigenvalues with negative real parts (if there are any) are allocated on the top. The notation M' denotes the transpose of the matrix M. The submatrices A11, A22, and B12 are upper triangular. If B21 is 2-by-2, then all the other blocks are -1 -1 nonsingular and the product A11 B12 A22 B21 has a pair of complex conjugate eigenvalues.Specification
SUBROUTINE MB03FD( N, PREC, A, LDA, B, LDB, Q1, LDQ1, Q2, LDQ2, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDQ1, LDQ2, LDWORK, N DOUBLE PRECISION PREC C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), $ Q1( LDQ1, * ), Q2( LDQ2, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the input pencil, N = 2 or N = 4. PREC (input) DOUBLE PRECISION The machine precision, (relative machine precision)*base. See the LAPACK Library routine DLAMCH. 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 of the pencil aA - bB. If N = 2, the diagonal elements only are referenced. On exit, if N = 4, the leading N-by-N part of this array contains the transformed upper triangular matrix of the generalized real Schur form of the pencil aA - bB. If N = 2, this array is unchanged on exit. LDA INTEGER The leading dimension of the array A. LDA >= N. B (input/output) DOUBLE PRECISION array, dimension (LDB, N) On entry, the leading N-by-N part of this array must contain the matrix B of the pencil aA - bB. If N = 2, the anti-diagonal elements only are referenced. On exit, if N = 4, the leading N-by-N part of this array contains the transformed real Schur matrix of the generalized real Schur form of the pencil aA - bB. If N = 2, this array is unchanged on exit. LDB INTEGER The leading dimension of the array B. LDB >= N. Q1 (output) DOUBLE PRECISION array, dimension (LDQ1, N) The leading N-by-N part of this array contains the first orthogonal transformation matrix. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= N. Q2 (output) DOUBLE PRECISION array, dimension (LDQ2, N) The leading N-by-N part of this array contains the second orthogonal transformation matrix. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= N.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) If N = 2, then DWORK is not referenced. LDWORK INTEGER The dimension of the array DWORK. If N = 4, then LDWORK >= 63. For good performance LDWORK should be generally larger. If N = 2, then LDWORK >= 0.Error Indicator
INFO INTEGER = 0: succesful exit; = 1: the QZ iteration failed in the LAPACK routine DGGES; = 2: another error occured during execution of DGGES.Method
The algorithm uses orthogonal transformations as described on page 29 in [2].References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical computation of deflating subspaces of skew- Hamiltonian/Hamiltonian pencils. SIAM J. Matrix Anal. Appl., 24 (1), pp. 165-190, 2002. [2] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the eigenvalues of a complex N-by-N skew-Hamiltonian/ Hamiltonian pencil aS - bH, with ( B F ) ( Z11 Z12 ) S = J Z' J' Z and H = ( ), Z = ( ), ( G -B' ) ( Z21 Z22 ) (1) ( 0 I ) J = ( ). ( -I 0 ) The structured Schur form of the embedded real skew-Hamiltonian/ skew-Hamiltonian pencil, aB_S - bB_T, with B_S = J B_Z' J' B_Z, ( Re(Z11) -Im(Z11) | Re(Z12) -Im(Z12) ) ( | ) ( Im(Z11) Re(Z11) | Im(Z12) Re(Z12) ) ( | ) B_Z = (---------------------+---------------------) , ( | ) ( Re(Z21) -Im(Z21) | Re(Z22) -Im(Z22) ) ( | ) ( Im(Z21) Re(Z21) | Im(Z22) Re(Z22) ) (2) ( -Im(B) -Re(B) | -Im(F) -Re(F) ) ( | ) ( Re(B) -Im(B) | Re(F) -Im(F) ) ( | ) B_T = (-----------------+-----------------) , T = i*H, ( | ) ( -Im(G) -Re(G) | -Im(B') Re(B') ) ( | ) ( Re(G) -Im(G) | -Re(B') -Im(B') ) is determined and used to compute the eigenvalues. Optionally, if COMPQ = 'C', an orthonormal basis of the right deflating subspace, Def_-(S, H), of the pencil aS - bH in (1), corresponding to the eigenvalues with strictly negative real part, is computed. Namely, after transforming aB_S - bB_H, in the factored form, by unitary matrices, we have B_Sout = J B_Zout' J' B_Zout, ( BA BD ) ( BB BF ) B_Zout = ( ) and B_Hout = ( ), (3) ( 0 BC ) ( 0 -BB' ) and the eigenvalues with strictly negative real part of the complex pencil aB_Sout - bB_Hout are moved to the top. The notation M' denotes the conjugate transpose of the matrix M. Optionally, if COMPU = 'C', an orthonormal basis of the companion subspace, range(P_U) [1], which corresponds to the eigenvalues with negative real part, is computed. The embedding doubles the multiplicities of the eigenvalues of the pencil aS - bH.Specification
SUBROUTINE MB03FZ( COMPQ, COMPU, ORTH, N, Z, LDZ, B, LDB, FG, $ LDFG, NEIG, D, LDD, C, LDC, Q, LDQ, U, LDU, $ ALPHAR, ALPHAI, BETA, IWORK, LIWORK, DWORK, $ LDWORK, ZWORK, LZWORK, BWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPU, ORTH INTEGER INFO, LDB, LDC, LDD, LDFG, LDQ, LDU, LDWORK, $ LDZ, LIWORK, LZWORK, N, NEIG C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION ALPHAI( * ), ALPHAR( * ), BETA( * ), DWORK( * ) COMPLEX*16 B( LDB, * ), C( LDC, * ), D( LDD, * ), $ FG( LDFG, * ), Q( LDQ, * ), U( LDU, * ), $ Z( LDZ, * ), ZWORK( * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether to compute the right deflating subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. = 'N': do not compute the deflating subspace; = 'C': compute the deflating subspace and store it in the leading subarray of Q. COMPU CHARACTER*1 Specifies whether to compute the companion subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. = 'N': do not compute the companion subspace; = 'C': compute the companion subspace and store it in the leading subarray of U. ORTH CHARACTER*1 If COMPQ = 'C' or COMPU = 'C', specifies the technique for computing the orthonormal bases of the deflating subspace and companion subspace, as follows: = 'P': QR factorization with column pivoting; = 'S': singular value decomposition. If COMPQ = 'N' and COMPU = 'N', the ORTH value is not used.Input/Output Parameters
N (input) INTEGER Order of the pencil aS - bH. N >= 0, even. Z (input/output) COMPLEX*16 array, dimension (LDZ, N) On entry, the leading N-by-N part of this array must contain the non-trivial factor Z in the factorization S = J Z' J' Z of the skew-Hamiltonian matrix S. On exit, if COMPQ = 'C' or COMPU = 'C', the leading N-by-N part of this array contains the upper triangular matrix BA in (3) (see also METHOD). The strictly lower triangular part is not zeroed. If COMPQ = 'N' and COMPU = 'N', this array is unchanged on exit. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1, N). B (input/output) COMPLEX*16 array, dimension (LDB, N) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if COMPQ = 'C' or COMPU = 'C', the leading N-by-N part of this array contains the upper triangular matrix BB in (3) (see also METHOD). The strictly lower triangular part is not zeroed. If COMPQ = 'N' and COMPU = 'N', this array is unchanged on exit. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N). FG (input/output) COMPLEX*16 array, dimension (LDFG, N) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the Hermitian matrix G, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the Hermitian matrix F. On exit, if COMPQ = 'C' or COMPU = 'C', the leading N-by-N part of this array contains the Hermitian matrix BF in (3) (see also METHOD). The strictly lower triangular part of the input matrix is preserved. The diagonal elements might have tiny imaginary parts. If COMPQ = 'N' and COMPU = 'N', this array is unchanged on exit. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, N). NEIG (output) INTEGER If COMPQ = 'C' or COMPU = 'C', the number of eigenvalues in aS - bH with strictly negative real part. D (output) COMPLEX*16 array, dimension (LDD, N) If COMPQ = 'C' or COMPU = 'C', the leading N-by-N part of this array contains the matrix BD in (3) (see METHOD). If COMPQ = 'N' and COMPU = 'N', this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= 1, if COMPQ = 'N' and COMPU = 'N'; LDD >= MAX(1, N), if COMPQ = 'C' or COMPU = 'C'. C (output) COMPLEX*16 array, dimension (LDC, N) If COMPQ = 'C' or COMPU = 'C', the leading N-by-N part of this array contains the lower triangular matrix BC in (3) (see also METHOD). The strictly upper triangular part is not zeroed. If COMPQ = 'N' and COMPU = 'N', this array is not referenced. LDC INTEGER The leading dimension of the array C. LDC >= 1, if COMPQ = 'N' and COMPU = 'N'; LDC >= MAX(1, N), if COMPQ = 'C' or COMPU = 'C'. Q (output) COMPLEX*16 array, dimension (LDQ, 2*N) On exit, if COMPQ = 'C', the leading N-by-NEIG part of this array contains an orthonormal basis of the right deflating subspace corresponding to the eigenvalues of the pencil aS - bH with strictly negative real part. The remaining entries are meaningless. If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, 2*N), if COMPQ = 'C'. U (output) COMPLEX*16 array, dimension (LDU, 2*N) On exit, if COMPU = 'C', the leading N-by-NEIG part of this array contains an orthonormal basis of the companion subspace corresponding to the eigenvalues of the pencil aS - bH with strictly negative real part. The remaining entries are meaningless. If COMPU = 'N', this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= 1, if COMPU = 'N'; LDU >= MAX(1, N), if COMPU = 'C'. ALPHAR (output) DOUBLE PRECISION array, dimension (N) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER The dimension of the array IWORK. LIWORK >= 2*N+9. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. On exit, if INFO = -26, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= c*N**2 + N + MAX(6*N, 27), where c = 18, if COMPU = 'C'; c = 16, if COMPQ = 'C' and COMPU = 'N'; c = 13, if COMPQ = 'N' and COMPU = 'N'. For good performance LDWORK should be generally 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. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal LZWORK. On exit, if INFO = -28, ZWORK(1) returns the minimum value of LZWORK. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= 8*N + 28, if COMPQ = 'C'; LZWORK >= 6*N + 28, if COMPQ = 'N' and COMPU = 'C'; LZWORK >= 1, if COMPQ = 'N' and COMPU = 'N'. For good performance LZWORK should be generally larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA. BWORK LOGICAL array, dimension (LBWORK) LBWORK >= 0, if COMPQ = 'N' and COMPU = 'N'; LBWORK >= N, if COMPQ = 'C' or COMPU = 'C'.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the algorithm was not able to reveal information about the eigenvalues from the 2-by-2 blocks in the SLICOT Library routine MB03BD (called by MB04ED); = 2: periodic QZ iteration failed in the SLICOT Library routines MB03BD or MB03BZ when trying to triangularize the 2-by-2 blocks; = 3: the singular value decomposition failed in the LAPACK routine ZGESVD (for ORTH = 'S').Method
First T = i*H is set. Then, the embeddings, B_Z and B_T, of the matrices S and T, are determined and, subsequently, the SLICOT Library routine MB04ED is applied to compute the structured Schur form, i.e., the factorizations ~ ( BZ11 BZ12 ) B_Z = U' B_Z Q = ( ) and ( 0 BZ22 ) ~ ( T11 T12 ) B_T = J Q' J' B_T Q = ( ), ( 0 T11' ) where Q is real orthogonal, U is real orthogonal symplectic, BZ11, BZ22' are upper triangular and T11 is upper quasi-triangular. Second, the SLICOT Library routine MB03IZ is applied, to compute a ~ ~ unitary matrix Q and a unitary symplectic matrix U, such that ~ ~ ~ ~ ~ ( Z11 Z12 ) U' B_Z Q = ( ~ ) =: B_Zout, ( 0 Z22 ) ~ ~ ~ ( H11 H12 ) J Q' J'(-i*B_T) Q = ( ) =: B_Hout, ( 0 -H11' ) ~ ~ with Z11, Z22', H11 upper triangular, and such that the spectrum ~ ~ ~ Spec_-(J B_Z' J' B_Z, -i*B_T) is contained in the spectrum of the ~ ~ 2*NEIG-by-2*NEIG leading principal subpencil aZ22'*Z11 - bH11. Finally, the right deflating subspace and the companion subspace are computed. See also page 21 in [1] for more details.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) complex floating point operations.Further Comments
This routine does not perform any scaling of the matrices. Scaling might sometimes be useful, and it should be done externally.Example
Program Text
* MB03FZ EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 50 ) INTEGER LDB, LDC, LDD, LDFG, LDQ, LDU, LDWORK, LDZ, $ LIWORK, LZWORK PARAMETER ( LDB = NMAX, LDC = NMAX, LDD = NMAX, $ LDFG = NMAX, LDQ = 2*NMAX, LDU = NMAX, $ LDWORK = 18*NMAX*NMAX + NMAX + 3 + $ MAX( 2*NMAX, 24 ), LDZ = NMAX, $ LIWORK = 2*NMAX + 9, LZWORK = 8*NMAX + 28 ) * * .. Local Scalars .. CHARACTER COMPQ, COMPU, ORTH INTEGER I, INFO, J, M, N, NEIG * * .. Local Arrays .. COMPLEX*16 B( LDB, NMAX ), C( LDC, NMAX ), D( LDD, NMAX ), $ FG( LDFG, NMAX ), Q( LDQ, 2*NMAX ), $ U( LDU, 2*NMAX ), Z( LDZ, NMAX ), $ ZWORK( LZWORK ) DOUBLE PRECISION ALPHAI( NMAX ), ALPHAR( NMAX ), BETA( NMAX ), $ DWORK( LDWORK ) INTEGER IWORK( LIWORK ) LOGICAL BWORK( NMAX ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB03FZ * * .. Intrinsic Functions .. INTRINSIC MAX, MOD * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) COMPQ, COMPU, ORTH, N IF( N.LT.0 .OR. N.GT.NMAX .OR. MOD( N, 2 ).NE.0 ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE M = N/2 READ( NIN, FMT = * ) ( ( Z( I, J ), J = 1, N ), I = 1, N ) READ( NIN, FMT = * ) ( ( B( I, J ), J = 1, M ), I = 1, M ) READ( NIN, FMT = * ) ( ( FG( I, J ), J = 1, M+1 ), I = 1, M ) * Compute the eigenvalues and orthogonal bases of the right * deflating subspace and companion subspace of a complex * skew-Hamiltonian/Hamiltonian pencil, corresponding to the * eigenvalues with strictly negative real part. CALL MB03FZ( COMPQ, COMPU, ORTH, N, Z, LDZ, B, LDB, FG, LDFG, $ NEIG, D, LDD, C, LDC, Q, LDQ, U, LDU, ALPHAR, $ ALPHAI, BETA, IWORK, LIWORK, DWORK, LDWORK, ZWORK, $ LZWORK, BWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Z( I, J ), J = 1, N ) 10 CONTINUE IF( LSAME( COMPQ, 'C' ) .OR. LSAME( COMPU, 'C' ) ) THEN WRITE( NOUT, FMT = 99994 ) DO 20 I = 1, N WRITE( NOUT, FMT = 99995 ) ( D( I, J ), J = 1, N ) 20 CONTINUE WRITE( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE( NOUT, FMT = 99995 ) ( C( I, J ), J = 1, N ) 30 CONTINUE WRITE( NOUT, FMT = 99992 ) DO 40 I = 1, N WRITE( NOUT, FMT = 99995 ) ( B( I, J ), J = 1, N ) 40 CONTINUE WRITE( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE( NOUT, FMT = 99995 ) ( FG( I, J ), J = 1, N ) 50 CONTINUE END IF WRITE( NOUT, FMT = 99990 ) WRITE( NOUT, FMT = 99989 ) ( ALPHAR( I ), I = 1, N ) WRITE( NOUT, FMT = 99988 ) WRITE( NOUT, FMT = 99989 ) ( ALPHAI( I ), I = 1, N ) WRITE( NOUT, FMT = 99987 ) WRITE( NOUT, FMT = 99989 ) ( BETA( I ), I = 1, N ) IF( LSAME( COMPQ, 'C' ) .AND. NEIG.GT.0 ) THEN WRITE( NOUT, FMT = 99986 ) DO 60 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q( I, J ), J = 1, NEIG ) 60 CONTINUE END IF IF( LSAME( COMPU, 'C' ) .AND. NEIG.GT.0 ) THEN WRITE( NOUT, FMT = 99985 ) DO 70 I = 1, N WRITE( NOUT, FMT = 99995 ) ( U( I, J ), J = 1, NEIG ) 70 CONTINUE END IF IF( LSAME( COMPQ, 'C' ) .OR. LSAME( COMPU, 'C' ) ) $ WRITE( NOUT, FMT = 99984 ) NEIG END IF END IF STOP * 99999 FORMAT ( 'MB03FZ EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT ( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT ( 'INFO on exit from MB03FZ = ', I2 ) 99996 FORMAT (/'The matrix Z on exit is ' ) 99995 FORMAT ( 20( 1X, F9.4, SP, F9.4, S, 'i ') ) 99994 FORMAT (/'The matrix D is ' ) 99993 FORMAT (/'The matrix C is ' ) 99992 FORMAT (/'The matrix B on exit is ' ) 99991 FORMAT (/'The matrix F on exit is ' ) 99990 FORMAT (/'The vector ALPHAR is ' ) 99989 FORMAT ( 50( 1X, F8.4 ) ) 99988 FORMAT (/'The vector ALPHAI is ' ) 99987 FORMAT (/'The vector BETA is ' ) 99986 FORMAT (/'The deflating subspace corresponding to the ', $ 'eigenvalues with negative real part is ' ) 99985 FORMAT (/'The companion subspace corresponding to the ', $ 'eigenvalues with negative real part is ' ) 99984 FORMAT (/'The number of eigenvalues in the initial pencil with ', $ 'negative real part is ', I2 ) ENDProgram Data
MB03FZ EXAMPLE PROGRAM DATA C C P 4 (0.0328,0.9611) (0.6428,0.2585) (0.7033,0.4254) (0.2552,0.7053) (0.0501,0.2510) (0.2827,0.8865) (0.4719,0.5387) (0.0389,0.5676) (0.5551,0.4242) (0.0643,0.2716) (0.1165,0.7875) (0.9144,0.3891) (0.0539,0.7931) (0.0408,0.2654) (0.9912,0.0989) (0.0991,0.6585) (0.0547,0.8726) (0.4008,0.8722) (0.7423,0.6166) (0.2631,0.5872) 0.8740 0.3697 (0.9178,0.6418) (0.7748,0.5358) 0.1652 0.2441Program Results
MB03FZ EXAMPLE PROGRAM RESULTS The matrix Z on exit is 1.1347 -0.1694i 0.0920 -0.0894i 0.5253 +0.0280i -0.0597 +0.1098i 0.0000 +0.0000i -0.9874 -0.6015i 0.2523 -0.0600i 0.3178 -0.0902i 0.5551 +0.4242i 0.0643 +0.2716i 0.7553 -0.3356i 0.4772 -0.3177i 0.0539 +0.7931i 0.0408 +0.2654i 0.9912 +0.0989i 0.9064 -0.1055i The matrix D is -0.7634 -0.2773i -0.8466 -0.9586i -0.0308 -0.0175i -0.2754 -0.0715i 1.2612 -0.2643i -0.7291 -0.3165i 0.0282 -0.1748i 0.4091 +0.0233i 0.3773 -0.1536i -0.3937 -0.0480i -0.1635 +0.1617i -0.1775 +0.1277i 0.7540 -0.0280i -0.6860 -0.8306i -0.2446 +0.0943i -0.0722 +0.0517i The matrix C is 0.5063 +0.1548i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.0046 +0.1049i 0.3884 +0.3420i 0.0000 +0.0000i 0.0000 +0.0000i -1.1206 +0.1313i -0.2270 -0.1753i 0.4300 -0.6107i 0.0000 +0.0000i -0.6127 -0.1939i -0.5713 -0.7913i 0.3739 -0.2943i -1.1501 -0.0850i The matrix B on exit is 0.3322 +1.9093i -0.1216 -0.1193i -0.0030 +0.0330i 0.0405 +0.0592i 0.0000 +0.0000i 0.1863 -1.8998i 0.2983 +0.2974i 0.6636 +0.5916i 0.0000 +0.0000i 0.0000 +0.0000i 0.4459 -0.7452i -0.0625 +0.2197i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.1418 +0.7392i The matrix F on exit is 0.0258 +0.0000i -0.0878 +0.1090i 0.3547 +0.5306i -0.0138 -0.8770i 0.7748 +0.5358i 0.0864 +0.0000i -0.3788 -0.2829i -0.3303 -0.0415i 0.0000 +0.0000i 0.0000 +0.0000i -0.0184 +0.0000i 0.1077 -0.0795i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.0938 +0.0000i The vector ALPHAR is 0.4295 -0.4295 0.0000 0.0000 The vector ALPHAI is 1.5363 1.5363 -1.4069 -0.7153 The vector BETA is 0.5000 0.5000 1.0000 1.0000 The deflating subspace corresponding to the eigenvalues with negative real part is -0.2249 +0.4158i -0.1984 -0.3100i 0.7286 -0.0427i 0.3282 -0.0251i The companion subspace corresponding to the eigenvalues with negative real part is -0.1542 -0.0712i -0.4162 -0.3021i -0.0806 -0.6946i -0.4580 -0.0889i The number of eigenvalues in the initial pencil with negative real part is 1
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03GD.html 0000664 0000000 0000000 00000011142 14560147231 0020325 0 ustar 00root root 0000000 0000000
Purpose
To compute an orthogonal matrix Q and an orthogonal symplectic matrix U for a real regular 2-by-2 or 4-by-4 skew-Hamiltonian/ Hamiltonian pencil a J B' J' B - b D with ( B11 B12 ) ( D11 D12 ) ( 0 I ) B = ( ), D = ( ), J = ( ), ( 0 B22 ) ( 0 -D11' ) ( -I 0 ) such that J Q' J' D Q and U' B Q keep block triangular form, but the eigenvalues are reordered. The notation M' denotes the transpose of the matrix M.Specification
SUBROUTINE MB03GD( N, B, LDB, D, LDD, MACPAR, Q, LDQ, U, LDU, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDB, LDD, LDQ, LDU, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION B( LDB, * ), D( LDD, * ), DWORK( * ), $ MACPAR( * ), Q( LDQ, * ), U( LDU, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the pencil a J B' J' B - b D. N = 2 or N = 4. B (input) DOUBLE PRECISION array, dimension (LDB, N) The leading N-by-N part of this array must contain the non-trivial factor of the decomposition of the skew-Hamiltonian input matrix J B' J' B. The (2,1) block is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= N. D (input) DOUBLE PRECISION array, dimension (LDD, N) The leading N/2-by-N part of this array must contain the first block row of the second matrix of a J B' J' B - b D. The matrix D has to be Hamiltonian. The strict lower triangle of the (1,2) block is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= N/2. MACPAR (input) DOUBLE PRECISION array, dimension (2) Machine parameters: MACPAR(1) (machine precision)*base, DLAMCH( 'P' ); MACPAR(2) safe minimum, DLAMCH( 'S' ). This argument is not used for N = 2. Q (output) DOUBLE PRECISION array, dimension (LDQ, N) The leading N-by-N part of this array contains the orthogonal transformation matrix Q. LDQ INTEGER The leading dimension of the array Q. LDQ >= N. U (output) DOUBLE PRECISION array, dimension (LDU, N) The leading N-by-N part of this array contains the orthogonal symplectic transformation matrix U. LDU INTEGER The leading dimension of the array U. LDU >= N.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) If N = 2 then DWORK is not referenced. LDWORK INTEGER The length of the array DWORK. If N = 2 then LDWORK >= 0; if N = 4 then LDWORK >= 12.Error Indicator
INFO INTEGER = 0: succesful exit; = 1: B11 or B22 is a (numerically) singular matrix.Method
The algorithm uses orthogonal transformations as described on page 22 in [1], but with an improved implementation.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a unitary matrix Q and a unitary symplectic matrix U for a complex regular 2-by-2 skew-Hamiltonian/Hamiltonian pencil aS - bH with S = J Z' J' Z, where ( Z11 Z12 ) ( H11 H12 ) Z = ( ) and H = ( ), ( 0 Z22 ) ( 0 -H11' ) such that U' Z Q, (J Q J' )' H Q are both upper triangular, but the eigenvalues of (J Q J')' ( aS - bH ) Q are in reversed order. The matrices Q and U are represented by ( CO1 SI1 ) ( CO2 SI2 ) Q = ( ) and U = ( ), respectively. ( -SI1' CO1 ) ( -SI2' CO2 ) The notation M' denotes the conjugate transpose of the matrix M.Specification
SUBROUTINE MB03GZ( Z11, Z12, Z22, H11, H12, CO1, SI1, CO2, SI2 ) C .. Scalar Arguments .. DOUBLE PRECISION CO1, CO2 COMPLEX*16 H11, H12, SI1, SI2, Z11, Z12, Z22Arguments
Input/Output Parameters
Z11 (input) COMPLEX*16 Upper left element of the non-trivial factor Z in the factorization of S. Z12 (input) COMPLEX*16 Upper right element of the non-trivial factor Z in the factorization of S. Z22 (input) COMPLEX*16 Lower right element of the non-trivial factor Z in the factorization of S. H11 (input) COMPLEX*16 Upper left element of the Hamiltonian matrix H. H12 (input) COMPLEX*16 Upper right element of the Hamiltonian matrix H. CO1 (output) DOUBLE PRECISION Upper left element of Q. SI1 (output) COMPLEX*16 Upper right element of Q. CO2 (output) DOUBLE PRECISION Upper left element of U. SI2 (output) COMPLEX*16 Upper right element of U.Method
The algorithm uses unitary and unitary symplectic transformations as described on page 37 in [1].References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To determine an orthogonal matrix Q, for a real regular 2-by-2 or 4-by-4 skew-Hamiltonian/Hamiltonian pencil ( A11 A12 ) ( B11 B12 ) aA - bB = a ( ) - b ( ) ( 0 A11' ) ( 0 -B11' ) in structured Schur form, such that J Q' J' (aA - bB) Q is still in structured Schur form but the eigenvalues are exchanged. The notation M' denotes the transpose of the matrix M.Specification
SUBROUTINE MB03HD( N, A, LDA, B, LDB, MACPAR, Q, LDQ, DWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDQ, N C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), $ MACPAR( * ), Q( LDQ, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the pencil aA - bB. N = 2 or N = 4. A (input) DOUBLE PRECISION array, dimension (LDA, N) If N = 4, the leading N/2-by-N upper trapezoidal part of this array must contain the first block row of the skew- Hamiltonian matrix A of the pencil aA - bB in structured Schur form. Only the entries (1,1), (1,2), (1,4), and (2,2) are referenced. If N = 2, this array is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= N/2. B (input) DOUBLE PRECISION array, dimension (LDB, N) The leading N/2-by-N part of this array must contain the first block row of the Hamiltonian matrix B of the pencil aA - bB in structured Schur form. The entry (2,3) is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= N/2. MACPAR (input) DOUBLE PRECISION array, dimension (2) Machine parameters: MACPAR(1) (machine precision)*base, DLAMCH( 'P' ); MACPAR(2) safe minimum, DLAMCH( 'S' ). This argument is not used for N = 2. Q (output) DOUBLE PRECISION array, dimension (LDQ, N) The leading N-by-N part of this array contains the orthogonal transformation matrix Q. LDQ INTEGER The leading dimension of the array Q. LDQ >= N.Workspace
DWORK DOUBLE PRECISION array, dimension (24) If N = 2, then DWORK is not referenced.Error Indicator
INFO INTEGER = 0: succesful exit; = 1: the leading N/2-by-N/2 block of the matrix B is numerically singular, but slightly perturbed values have been used. This is a warning.Method
The algorithm uses orthogonal transformations as described on page 31 in [2]. The structure is exploited.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical computation of deflating subspaces of skew- Hamiltonian/Hamiltonian pencils. SIAM J. Matrix Anal. Appl., 24 (1), pp. 165-190, 2002. [2] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a unitary matrix Q for a complex regular 2-by-2 skew-Hamiltonian/Hamiltonian pencil aS - bH with ( S11 S12 ) ( H11 H12 ) S = ( ), H = ( ), ( 0 S11' ) ( 0 -H11' ) such that J Q' J' (aS - bH) Q is upper triangular but the eigenvalues are in reversed order. The matrix Q is represented by ( CO SI ) Q = ( ). ( -SI' CO ) The notation M' denotes the conjugate transpose of the matrix M.Specification
SUBROUTINE MB03HZ( S11, S12, H11, H12, CO, SI ) C .. Scalar Arguments .. DOUBLE PRECISION CO COMPLEX*16 H11, H12, S11, S12, SIArguments
Input/Output Parameters
S11 (input) COMPLEX*16 Upper left element of the skew-Hamiltonian matrix S. S12 (input) COMPLEX*16 Upper right element of the skew-Hamiltonian matrix S. H11 (input) COMPLEX*16 Upper left element of the Hamiltonian matrix H. H12 (input) COMPLEX*16 Upper right element of the Hamiltonian matrix H. CO (output) DOUBLE PRECISION Upper left element of Q. SI (output) COMPLEX*16 Upper right element of Q.Method
The algorithm uses unitary transformations as described on page 43 in [1].References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To move the eigenvalues with strictly negative real parts of an N-by-N real skew-Hamiltonian/Hamiltonian pencil aS - bH in structured Schur form, with ( 0 I ) ( A D ) ( B F ) S = J Z' J' Z, J = ( ), Z = ( ), H = ( ), ( -I 0 ) ( 0 C ) ( 0 -B' ) to the leading principal subpencil, while keeping the triangular form. Above, A is upper triangular, B is upper quasi-triangular, and C is lower triangular. The matrices Z and H are transformed by an orthogonal symplectic matrix U and an orthogonal matrix Q such that ( Aout Dout ) Zout = U' Z Q = ( ), and ( 0 Cout ) (1) ( Bout Fout ) Hout = J Q' J' H Q = ( ), ( 0 -Bout' ) where Aout, Bout and Cout remain in triangular form. The notation M' denotes the transpose of the matrix M. Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal matrix Q that fulfills (1) is computed. Optionally, if COMPU = 'I' or COMPU = 'U', the orthogonal symplectic matrix ( U1 U2 ) U = ( ) ( -U2 U1 ) that fulfills (1) is computed.Specification
SUBROUTINE MB03ID( COMPQ, COMPU, N, A, LDA, C, LDC, D, LDD, B, $ LDB, F, LDF, Q, LDQ, U1, LDU1, U2, LDU2, NEIG, $ IWORK, LIWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPU INTEGER INFO, LDA, LDB, LDC, LDD, LDF, LDQ, LDU1, LDU2, $ LDWORK, LIWORK, N, NEIG C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), DWORK( * ), F( LDF, * ), $ Q( LDQ, * ), U1( LDU1, * ), U2( LDU2, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether or not the orthogonal transformations should be accumulated in the array Q, as follows: = 'N': Q is not computed; = 'I': the array Q is initialized internally to the unit matrix, and the orthogonal matrix Q is returned; = 'U': the array Q contains an orthogonal matrix Q0 on entry, and the matrix Q0*Q is returned, where Q is the product of the orthogonal transformations that are applied to the pencil aS - bH to reorder the eigenvalues. COMPU CHARACTER*1 Specifies whether or not the orthogonal symplectic transformations should be accumulated in the arrays U1 and U2, as follows: = 'N': U1 and U2 are not computed; = 'I': the arrays U1 and U2 are initialized internally, and the submatrices U1 and U2 defining the orthogonal symplectic matrix U are returned; = 'U': the arrays U1 and U2 contain the corresponding submatrices of an orthogonal symplectic matrix U0 on entry, and the updated submatrices U1 and U2 of the matrix product U0*U are returned, where U is the product of the orthogonal symplectic transformations that are applied to the pencil aS - bH to reorder the eigenvalues.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular matrix A. The elements of the strictly lower triangular part of this array are not used. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Aout. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). C (input/output) DOUBLE PRECISION array, dimension (LDC, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the lower triangular matrix C. The elements of the strictly upper triangular part of this array are not used. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Cout. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1, N/2). D (input/output) DOUBLE PRECISION array, dimension (LDD, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix D. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Dout. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1, N/2). B (input/output) DOUBLE PRECISION array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper quasi-triangular matrix B. On exit, the leading N/2-by-N/2 part of this array contains the transformed upper quasi-triangular part of the matrix Bout. The part below the first subdiagonal of this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). F (input/output) DOUBLE PRECISION array, dimension (LDF, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the symmetric matrix F. On exit, the leading N/2-by-N/2 part of this array contains the transformed upper triangular part of the matrix Fout. The strictly lower triangular part of this array is not referenced, except for the element F(N/2,N/2-1), but its initial value is preserved. LDF INTEGER The leading dimension of the array F. LDF >= MAX(1, N/2). Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N) On entry, if COMPQ = 'U', then the leading N-by-N part of this array must contain a given matrix Q0, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q0 and the transformation matrix Q used to transform the matrices Z and H. On exit, if COMPQ = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q. If COMPQ = 'N' this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, N), if COMPQ = 'I' or COMPQ = 'U'. U1 (input/output) DOUBLE PRECISION array, dimension (LDU1, N/2) On entry, if COMPU = 'U', then the leading N/2-by-N/2 part of this array must contain the upper left block of a given matrix U0, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper left block U1 of the product of the input matrix U0 and the transformation matrix U used to transform the matrices Z and H. On exit, if COMPU = 'I', then the leading N/2-by-N/2 part of this array contains the upper left block U1 of the orthogonal symplectic transformation matrix U. If COMPU = 'N' this array is not referenced. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= 1, if COMPU = 'N'; LDU1 >= MAX(1, N/2), if COMPU = 'I' or COMPU = 'U'. U2 (input/output) DOUBLE PRECISION array, dimension (LDU2, N/2) On entry, if COMPU = 'U', then the leading N/2-by-N/2 part of this array must contain the upper right block of a given matrix U0, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper right block U2 of the product of the input matrix U0 and the transformation matrix U used to transform the matrices Z and H. On exit, if COMPU = 'I', then the leading N/2-by-N/2 part of this array contains the upper right block U2 of the orthogonal symplectic transformation matrix U. If COMPU = 'N' this array is not referenced. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= 1, if COMPU = 'N'; LDU2 >= MAX(1, N/2), if COMPU = 'I' or COMPU = 'U'. NEIG (output) INTEGER The number of eigenvalues in aS - bH with strictly negative real part.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER The dimension of the array IWORK. LIWORK >= N+1. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The dimension of the array DWORK. If COMPQ = 'N', LDWORK >= MAX(2*N+48,171); if COMPQ = 'I' or COMPQ = 'U', LDWORK >= MAX(4*N+48,171).Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the periodic QZ algorithm did not converge in SLICOT Library routine MB03BB; = 2: an error occured during the execution of MB03CD; = 3: an error occured during the execution of MB03GD.Method
The algorithm reorders the eigenvalues like the following scheme: Step 1: Reorder the eigenvalues in the subpencil aC'*A - bB. I. Reorder the eigenvalues with negative real parts to the top. II. Reorder the eigenvalues with positive real parts to the bottom. Step 2: Reorder the remaining eigenvalues with negative real parts in the pencil aS - bH. I. Exchange the eigenvalues between the last diagonal block in aC'*A - bB and the last diagonal block in aS - bH. II. Move the eigenvalues of the R-th block to the (MM+1)-th block, where R denotes the number of upper quasi- triangular blocks in aC'*A - bB and MM denotes the current number of blocks in aC'*A - bB with eigenvalues with negative real parts. The algorithm uses a sequence of orthogonal transformations as described on page 25 in [1]. To achieve those transformations the elementary subroutines MB03CD and MB03GD are called for the corresponding matrix structures.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To move the eigenvalues with strictly negative real parts of an N-by-N complex skew-Hamiltonian/Hamiltonian pencil aS - bH in structured Schur form, with ( 0 I ) S = J Z' J' Z, where J = ( ), ( -I 0 ) to the leading principal subpencil, while keeping the triangular form. On entry, we have ( A D ) ( B F ) Z = ( ), H = ( ), ( 0 C ) ( 0 -B' ) where A and B are upper triangular and C is lower triangular. Z and H are transformed by a unitary symplectic matrix U and a unitary matrix Q such that ( Aout Dout ) Zout = U' Z Q = ( ), and ( 0 Cout ) (1) ( Bout Fout ) Hout = J Q' J' H Q = ( ), ( 0 -Bout' ) where Aout, Bout and Cout remain in triangular form. The notation M' denotes the conjugate transpose of the matrix M. Optionally, if COMPQ = 'I' or COMPQ = 'U', the unitary matrix Q that fulfills (1) is computed. Optionally, if COMPU = 'I' or COMPU = 'U', the unitary symplectic matrix ( U1 U2 ) U = ( ) ( -U2 U1 ) that fulfills (1) is computed.Specification
SUBROUTINE MB03IZ( COMPQ, COMPU, N, A, LDA, C, LDC, D, LDD, B, $ LDB, F, LDF, Q, LDQ, U1, LDU1, U2, LDU2, NEIG, $ TOL, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPU INTEGER INFO, LDA, LDB, LDC, LDD, LDF, LDQ, LDU1, LDU2, $ N, NEIG DOUBLE PRECISION TOL C .. Array Arguments .. COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), F( LDF, * ), Q( LDQ, * ), $ U1( LDU1, * ), U2( LDU2, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether or not the unitary transformations should be accumulated in the array Q, as follows: = 'N': Q is not computed; = 'I': the array Q is initialized internally to the unit matrix, and the unitary matrix Q is returned; = 'U': the array Q contains a unitary matrix Q0 on entry, and the matrix Q0*Q is returned, where Q is the product of the unitary transformations that are applied to the pencil aS - bH to reorder the eigenvalues. COMPU CHARACTER*1 Specifies whether or not the unitary symplectic transformations should be accumulated in the arrays U1 and U2, as follows: = 'N': U1 and U2 are not computed; = 'I': the arrays U1 and U2 are initialized internally, and the submatrices U1 and U2 defining the unitary symplectic matrix U are returned; = 'U': the arrays U1 and U2 contain the corresponding submatrices of a unitary symplectic matrix U0 on entry, and the updated submatrices U1 and U2 of the matrix product U0*U are returned, where U is the product of the unitary symplectic transformations that are applied to the pencil aS - bH to reorder the eigenvalues.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) COMPLEX*16 array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular matrix A. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Aout. The strictly lower triangular part of this array is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). C (input/output) COMPLEX*16 array, dimension (LDC, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the lower triangular matrix C. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Cout. The strictly upper triangular part of this array is not referenced. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1, N/2). D (input/output) COMPLEX*16 array, dimension (LDD, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix D. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Dout. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1, N/2). B (input/output) COMPLEX*16 array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular matrix B. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Bout. The strictly lower triangular part of this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). F (input/output) COMPLEX*16 array, dimension (LDF, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the Hermitian matrix F. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Fout. The strictly lower triangular part of this array is not referenced. LDF INTEGER The leading dimension of the array F. LDF >= MAX(1, N/2). Q (input/output) COMPLEX*16 array, dimension (LDQ, N) On entry, if COMPQ = 'U', then the leading N-by-N part of this array must contain a given matrix Q0, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q0 and the transformation matrix Q used to transform the matrices S and H. On exit, if COMPQ = 'I', then the leading N-by-N part of this array contains the unitary transformation matrix Q. If COMPQ = 'N' this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, N), if COMPQ = 'I' or COMPQ = 'U'. U1 (input/output) COMPLEX*16 array, dimension (LDU1, N/2) On entry, if COMPU = 'U', then the leading N/2-by-N/2 part of this array must contain the upper left block of a given matrix U0, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper left block U1 of the product of the input matrix U0 and the transformation matrix U used to transform the matrices S and H. On exit, if COMPU = 'I', then the leading N/2-by-N/2 part of this array contains the upper left block U1 of the unitary symplectic transformation matrix U. If COMPU = 'N' this array is not referenced. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= 1, if COMPU = 'N'; LDU1 >= MAX(1, N/2), if COMPU = 'I' or COMPU = 'U'. U2 (input/output) COMPLEX*16 array, dimension (LDU2, N/2) On entry, if COMPU = 'U', then the leading N/2-by-N/2 part of this array must contain the upper right block of a given matrix U0, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper right block U2 of the product of the input matrix U0 and the transformation matrix U used to transform the matrices S and H. On exit, if COMPU = 'I', then the leading N/2-by-N/2 part of this array contains the upper right block U2 of the unitary symplectic transformation matrix U. If COMPU = 'N' this array is not referenced. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= 1, if COMPU = 'N'; LDU2 >= MAX(1, N/2), if COMPU = 'I' or COMPU = 'U'. NEIG (output) INTEGER The number of eigenvalues in aS - bH with strictly negative real part.Tolerances
TOL DOUBLE PRECISION The tolerance used to decide the sign of the eigenvalues. If the user sets TOL > 0, then the given value of TOL is used. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by MIN(N,10)*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). A larger value might be needed for pencils with multiple eigenvalues.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The algorithm reorders the eigenvalues like the following scheme: Step 1: Reorder the eigenvalues in the subpencil aC'*A - bB. I. Reorder the eigenvalues with negative real parts to the top. II. Reorder the eigenvalues with positive real parts to the bottom. Step 2: Reorder the remaining eigenvalues with negative real parts. I. Exchange the eigenvalues between the last diagonal block in aC'*A - bB and the last diagonal block in aS - bH. II. Move the eigenvalues in the N/2-th place to the (MM+1)-th place, where MM denotes the current number of eigenvalues with negative real parts in aC'*A - bB. The algorithm uses a sequence of unitary transformations as described on page 38 in [1]. To achieve those transformations the elementary SLICOT Library subroutines MB03CZ and MB03GZ are called for the corresponding matrix structures.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) complex floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To move the eigenvalues with strictly negative real parts of an N-by-N real skew-Hamiltonian/Hamiltonian pencil aS - bH in structured Schur form, ( A D ) ( B F ) S = ( ), H = ( ), ( 0 A' ) ( 0 -B' ) with A upper triangular and B upper quasi-triangular, to the leading principal subpencil, while keeping the triangular form. The notation M' denotes the transpose of the matrix M. The matrices S and H are transformed by an orthogonal matrix Q such that ( Aout Dout ) Sout = J Q' J' S Q = ( ), ( 0 Aout' ) (1) ( Bout Fout ) ( 0 I ) Hout = J Q' J' H Q = ( ), with J = ( ), ( 0 -Bout' ) ( -I 0 ) where Aout is upper triangular and Bout is upper quasi-triangular. Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal matrix Q that fulfills (1), is computed.Specification
SUBROUTINE MB03JD( COMPQ, N, A, LDA, D, LDD, B, LDB, F, LDF, Q, $ LDQ, NEIG, IWORK, LIWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ INTEGER INFO, LDA, LDB, LDD, LDF, LDQ, LDWORK, LIWORK, $ N, NEIG C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), D( LDD, * ), $ DWORK( * ), F( LDF, * ), Q( LDQ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether or not the orthogonal transformations should be accumulated in the array Q, as follows: = 'N': Q is not computed; = 'I': the array Q is initialized internally to the unit matrix, and the orthogonal matrix Q is returned; = 'U': the array Q contains an orthogonal matrix Q0 on entry, and the matrix Q0*Q is returned, where Q is the product of the orthogonal transformations that are applied to the pencil aS - bH to reorder the eigenvalues.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular matrix A. The elements of the strictly lower triangular part of this array are not used. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Aout. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). D (input/output) DOUBLE PRECISION array, dimension (LDD, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the skew-symmetric matrix D. The diagonal need not be set to zero. On exit, the leading N/2-by-N/2 part of this array contains the transformed upper triangular part of the matrix Dout. The strictly lower triangular part of this array is not referenced, except for the element D(N/2,N/2-1), but its initial value is preserved. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1, N/2). B (input/output) DOUBLE PRECISION array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper quasi-triangular matrix B. On exit, the leading N/2-by-N/2 part of this array contains the transformed upper quasi-triangular part of the matrix Bout. The part below the first subdiagonal of this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). F (input/output) DOUBLE PRECISION array, dimension (LDF, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the symmetric matrix F. On exit, the leading N/2-by-N/2 part of this array contains the transformed upper triangular part of the matrix Fout. The strictly lower triangular part of this array is not referenced, except for the element F(N/2,N/2-1), but its initial value is preserved. LDF INTEGER The leading dimension of the array F. LDF >= MAX(1, N/2). Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N) On entry, if COMPQ = 'U', then the leading N-by-N part of this array must contain a given matrix Q0, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q0 and the transformation matrix Q used to transform the matrices S and H. On exit, if COMPQ = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q. If COMPQ = 'N' this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, N), if COMPQ = 'I' or COMPQ = 'U'. NEIG (output) INTEGER The number of eigenvalues in aS - bH with strictly negative real part.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER The dimension of the array IWORK. LIWORK >= N+1. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The dimension of the array DWORK. If COMPQ = 'N', LDWORK >= MAX(2*N+32,108); if COMPQ = 'I' or COMPQ = 'U', LDWORK >= MAX(4*N+32,108).Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: error occured during execution of MB03DD; = 2: error occured during execution of MB03HD.Method
The algorithm reorders the eigenvalues like the following scheme: Step 1: Reorder the eigenvalues in the subpencil aA - bB. I. Reorder the eigenvalues with negative real parts to the top. II. Reorder the eigenvalues with positive real parts to the bottom. Step 2: Reorder the remaining eigenvalues with negative real parts in the pencil aS - bH. I. Exchange the eigenvalues between the last diagonal block in aA - bB and the last diagonal block in aS - bH. II. Move the eigenvalues of the R-th block to the (MM+1)-th block, where R denotes the number of upper quasi- triangular blocks in aA - bB and MM denotes the current number of blocks in aA - bB with eigenvalues with negative real parts. The algorithm uses a sequence of orthogonal transformations as described on page 33 in [1]. To achieve those transformations the elementary subroutines MB03DD and MB03HD are called for the corresponding matrix structures.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To move the eigenvalues with strictly negative real parts of an N-by-N real skew-Hamiltonian/Hamiltonian pencil aS - bH in structured Schur form, ( A D ) ( B F ) S = ( ), H = ( ), ( 0 A' ) ( 0 -B' ) with A upper triangular and B upper quasi-triangular, to the leading principal subpencil, while keeping the triangular form. The notation M' denotes the transpose of the matrix M. The matrices S and H are transformed by an orthogonal matrix Q such that ( Aout Dout ) Sout = J Q' J' S Q = ( ), ( 0 Aout' ) (1) ( Bout Fout ) ( 0 I ) Hout = J Q' J' H Q = ( ), with J = ( ), ( 0 -Bout' ) ( -I 0 ) where Aout is upper triangular and Bout is upper quasi-triangular. Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal matrix Q that fulfills (1), is computed.Specification
SUBROUTINE MB03JP( COMPQ, N, A, LDA, D, LDD, B, LDB, F, LDF, Q, $ LDQ, NEIG, IWORK, LIWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ INTEGER INFO, LDA, LDB, LDD, LDF, LDQ, LDWORK, LIWORK, $ N, NEIG C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), D( LDD, * ), $ DWORK( * ), F( LDF, * ), Q( LDQ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether or not the orthogonal transformations should be accumulated in the array Q, as follows: = 'N': Q is not computed; = 'I': the array Q is initialized internally to the unit matrix, and the orthogonal matrix Q is returned; = 'U': the array Q contains an orthogonal matrix Q0 on entry, and the matrix Q0*Q is returned, where Q is the product of the orthogonal transformations that are applied to the pencil aS - bH to reorder the eigenvalues.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular matrix A. The elements of the strictly lower triangular part of this array are not used. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Aout. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). D (input/output) DOUBLE PRECISION array, dimension (LDD, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the skew-symmetric matrix D. The diagonal need not be set to zero. On exit, the leading N/2-by-N/2 part of this array contains the transformed upper triangular part of the matrix Dout. The strictly lower triangular part of this array is not referenced, except for the element D(N/2,N/2-1), but its initial value is preserved. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1, N/2). B (input/output) DOUBLE PRECISION array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper quasi-triangular matrix B. On exit, the leading N/2-by-N/2 part of this array contains the transformed upper quasi-triangular part of the matrix Bout. The part below the first subdiagonal of this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). F (input/output) DOUBLE PRECISION array, dimension (LDF, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the symmetric matrix F. On exit, the leading N/2-by-N/2 part of this array contains the transformed upper triangular part of the matrix Fout. The strictly lower triangular part of this array is not referenced, except for the element F(N/2,N/2-1), but its initial value is preserved. LDF INTEGER The leading dimension of the array F. LDF >= MAX(1, N/2). Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N) On entry, if COMPQ = 'U', then the leading N-by-N part of this array must contain a given matrix Q0, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q0 and the transformation matrix Q used to transform the matrices S and H. On exit, if COMPQ = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q. If COMPQ = 'N' this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, N), if COMPQ = 'I' or COMPQ = 'U'. NEIG (output) INTEGER The number of eigenvalues in aS - bH with strictly negative real part.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER The dimension of the array IWORK. LIWORK >= 3*N-3. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The dimension of the array DWORK. If COMPQ = 'N', LDWORK >= MAX(2*N+32,108)+5*N/2; if COMPQ = 'I' or COMPQ = 'U', LDWORK >= MAX(4*N+32,108)+5*N/2.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: error occured during execution of MB03DD; = 2: error occured during execution of MB03HD.Method
The algorithm reorders the eigenvalues like the following scheme: Step 1: Reorder the eigenvalues in the subpencil aA - bB. I. Reorder the eigenvalues with negative real parts to the top. II. Reorder the eigenvalues with positive real parts to the bottom. Step 2: Reorder the remaining eigenvalues with negative real parts in the pencil aS - bH. I. Exchange the eigenvalues between the last diagonal block in aA - bB and the last diagonal block in aS - bH. II. Move the eigenvalues of the R-th block to the (MM+1)-th block, where R denotes the number of upper quasi- triangular blocks in aA - bB and MM denotes the current number of blocks in aA - bB with eigenvalues with negative real parts. The algorithm uses a sequence of orthogonal transformations as described on page 33 in [1]. To achieve those transformations the elementary subroutines MB03DD and MB03HD are called for the corresponding matrix structures.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
For large values of N, the routine applies the transformations on panels of columns. The user may specify in INFO the desired number of columns. If on entry INFO <= 0, then the routine estimates a suitable value of this number.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To move the eigenvalues with strictly negative real parts of an N-by-N complex skew-Hamiltonian/Hamiltonian pencil aS - bH in structured Schur form to the leading principal subpencil, while keeping the triangular form. On entry, we have ( A D ) ( B F ) S = ( ), H = ( ), ( 0 A' ) ( 0 -B' ) where A and B are upper triangular. S and H are transformed by a unitary matrix Q such that ( Aout Dout ) Sout = J Q' J' S Q = ( ), and ( 0 Aout' ) (1) ( Bout Fout ) ( 0 I ) Hout = J Q' J' H Q = ( ), with J = ( ), ( 0 -Bout' ) ( -I 0 ) where Aout and Bout remain in upper triangular form. The notation M' denotes the conjugate transpose of the matrix M. Optionally, if COMPQ = 'I' or COMPQ = 'U', the unitary matrix Q that fulfills (1) is computed.Specification
SUBROUTINE MB03JZ( COMPQ, N, A, LDA, D, LDD, B, LDB, F, LDF, Q, $ LDQ, NEIG, TOL, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ INTEGER INFO, LDA, LDB, LDD, LDF, LDQ, N, NEIG DOUBLE PRECISION TOL C .. Array Arguments .. COMPLEX*16 A( LDA, * ), B( LDB, * ), D( LDD, * ), $ F( LDF, * ), Q( LDQ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether or not the unitary transformations should be accumulated in the array Q, as follows: = 'N': Q is not computed; = 'I': the array Q is initialized internally to the unit matrix, and the unitary matrix Q is returned; = 'U': the array Q contains a unitary matrix Q0 on entry, and the matrix Q0*Q is returned, where Q is the product of the unitary transformations that are applied to the pencil aS - bH to reorder the eigenvalues.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) COMPLEX*16 array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular matrix A. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Aout. The strictly lower triangular part of this array is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). D (input/output) COMPLEX*16 array, dimension (LDD, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the skew-Hermitian matrix D. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Dout. The strictly lower triangular part of this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1, N/2). B (input/output) COMPLEX*16 array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular matrix B. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Bout. The strictly lower triangular part of this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). F (input/output) COMPLEX*16 array, dimension (LDF, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the Hermitian matrix F. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Fout. The strictly lower triangular part of this array is not referenced. LDF INTEGER The leading dimension of the array F. LDF >= MAX(1, N/2). Q (input/output) COMPLEX*16 array, dimension (LDQ, N) On entry, if COMPQ = 'U', then the leading N-by-N part of this array must contain a given matrix Q0, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q0 and the transformation matrix Q used to transform the matrices S and H. On exit, if COMPQ = 'I', then the leading N-by-N part of this array contains the unitary transformation matrix Q. If COMPQ = 'N' this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, N), if COMPQ = 'I' or COMPQ = 'U'. NEIG (output) INTEGER The number of eigenvalues in aS - bH with strictly negative real part.Tolerances
TOL DOUBLE PRECISION The tolerance used to decide the sign of the eigenvalues. If the user sets TOL > 0, then the given value of TOL is used. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by MIN(N,10)*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). A larger value might be needed for pencils with multiple eigenvalues.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The algorithm reorders the eigenvalues like the following scheme: Step 1: Reorder the eigenvalues in the subpencil aA - bB. I. Reorder the eigenvalues with negative real parts to the top. II. Reorder the eigenvalues with positive real parts to the bottom. Step 2: Reorder the remaining eigenvalues with negative real parts. I. Exchange the eigenvalues between the last diagonal block in aA - bB and the last diagonal block in aS - bH. II. Move the eigenvalues in the N/2-th place to the (MM+1)-th place, where MM denotes the current number of eigenvalues with negative real parts in aA - bB. The algorithm uses a sequence of unitary transformations as described on page 43 in [1]. To achieve those transformations the elementary SLICOT Library subroutines MB03DZ and MB03HZ are called for the corresponding matrix structures.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) complex floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reorder the diagonal blocks of the formal matrix product T22_K^S(K) * T22_K-1^S(K-1) * ... * T22_1^S(1), (1) of length K, in the generalized periodic Schur form [ T11_k T12_k T13_k ] T_k = [ 0 T22_k T23_k ], k = 1, ..., K, (2) [ 0 0 T33_k ] where - the submatrices T11_k are NI(k+1)-by-NI(k), if S(k) = 1, or NI(k)-by-NI(k+1), if S(k) = -1, and contain dimension-induced infinite eigenvalues, - the submatrices T22_k are NC-by-NC and contain core eigenvalues, which are generically neither zero nor infinite, - the submatrices T33_k contain dimension-induced zero eigenvalues, such that the block with starting row index IFST in (1) is moved to row index ILST. The indices refer to the T22_k submatrices. Optionally, the transformation matrices Q_1,...,Q_K from the reduction into generalized periodic Schur form are updated with respect to the performed reordering.Specification
SUBROUTINE MB03KA( COMPQ, WHICHQ, WS, K, NC, KSCHUR, IFST, ILST, $ N, NI, S, T, LDT, IXT, Q, LDQ, IXQ, TOL, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ LOGICAL WS INTEGER IFST, ILST, INFO, K, KSCHUR, LDWORK, NC C .. Array Arguments .. INTEGER IWORK( * ), IXQ( * ), IXT( * ), LDQ( * ), $ LDT( * ), N( * ), NI( * ), S( * ), WHICHQ( * ) DOUBLE PRECISION DWORK( * ), Q( * ), T( * ), TOL( * )Arguments
Mode Parameters
COMPQ CHARACTER*1 = 'N': do not compute any of the matrices Q_k; = 'U': each coefficient of Q must contain an orthogonal matrix Q1_k on entry, and the products Q1_k*Q_k are returned, where Q_k, k = 1, ..., K, performed the reordering; = 'W': the computation of each Q_k is specified individually in the array WHICHQ. WHICHQ INTEGER array, dimension (K) If COMPQ = 'W', WHICHQ(k) specifies the computation of Q_k as follows: = 0: do not compute Q_k; > 0: the kth coefficient of Q must contain an orthogonal matrix Q1_k on entry, and the product Q1_k*Q_k is returned. This array is not referenced if COMPQ <> 'W'. WS LOGICAL = .FALSE. : do not perform the strong stability tests; = .TRUE. : perform the strong stability tests; often, this is not needed, and omitting them can save some computations.Input/Output Parameters
K (input) INTEGER The period of the periodic matrix sequences T and Q (the number of factors in the matrix product). K >= 2. (For K = 1, a standard eigenvalue reordering problem is obtained.) NC (input) INTEGER The number of core eigenvalues. 0 <= NC <= min(N). KSCHUR (input) INTEGER The index for which the matrix T22_kschur is upper quasi- triangular. All other T22 matrices are upper triangular. IFST (input/output) INTEGER ILST (input/output) INTEGER Specify the reordering of the diagonal blocks, as follows: The block with starting row index IFST in (1) is moved to row index ILST by a sequence of direct swaps between adjacent blocks in the product. On exit, if IFST pointed on entry to the second row of a 2-by-2 block in the product, it is changed to point to the first row; ILST always points to the first row of the block in its final position in the product (which may differ from its input value by +1 or -1). 1 <= IFST <= NC, 1 <= ILST <= NC. N (input) INTEGER array, dimension (K) The leading K elements of this array must contain the dimensions of the factors of the formal matrix product T, such that the k-th coefficient T_k is an N(k+1)-by-N(k) matrix, if S(k) = 1, or an N(k)-by-N(k+1) matrix, if S(k) = -1, k = 1, ..., K, where N(K+1) = N(1). NI (input) INTEGER array, dimension (K) The leading K elements of this array must contain the dimensions of the factors of the matrix sequence T11_k. N(k) >= NI(k) + NC >= 0. S (input) INTEGER array, dimension (K) The leading K elements of this array must contain the signatures (exponents) of the factors in the K-periodic matrix sequence. Each entry in S must be either 1 or -1; the value S(k) = -1 corresponds to using the inverse of the factor T_k. T (input/output) DOUBLE PRECISION array, dimension (*) On entry, this array must contain at position IXT(k) the matrix T_k, which is at least N(k+1)-by-N(k), if S(k) = 1, or at least N(k)-by-N(k+1), if S(k) = -1, in periodic Schur form. On exit, the matrices T_k are overwritten by the reordered periodic Schur form. LDT INTEGER array, dimension (K) The leading dimensions of the matrices T_k in the one- dimensional array T. LDT(k) >= max(1,N(k+1)), if S(k) = 1, LDT(k) >= max(1,N(k)), if S(k) = -1. IXT INTEGER array, dimension (K) Start indices of the matrices T_k in the one-dimensional array T. Q (input/output) DOUBLE PRECISION array, dimension (*) On entry, this array must contain at position IXQ(k) a matrix Q_k of size at least N(k)-by-N(k), provided that COMPQ = 'U', or COMPQ = 'W' and WHICHQ(k) > 0. On exit, if COMPQ = 'U', or COMPQ = 'W' and WHICHQ(k) > 0, Q_k is post-multiplied with the orthogonal matrix that performed the reordering. This array is not referenced if COMPQ = 'N'. LDQ INTEGER array, dimension (K) The leading dimensions of the matrices Q_k in the one- dimensional array Q. LDQ(k) >= max(1,N(k)), if COMPQ = 'U', or COMPQ = 'W' and WHICHQ(k) > 0; This array is not referenced if COMPQ = 'N'. IXQ INTEGER array, dimension (K) Start indices of the matrices Q_k in the one-dimensional array Q. This array is not referenced if COMPQ = 'N'.Tolerances
TOL DOUBLE PRECISION array, dimension (3) This array contains tolerance parameters. The weak and strong stability tests use a threshold computed by the formula MAX( c*EPS*NRM, SMLNUM ), where c is a constant, NRM is the Frobenius norm of the current matrix formed by concatenating K pairs of adjacent diagonal blocks of sizes 1 and/or 2 in the T22_k submatrices from (2), which are swapped, and EPS and SMLNUM are the machine precision and safe minimum divided by EPS, respectively (see LAPACK Library routine DLAMCH). The norm NRM is computed by this routine; the other values are stored in the array TOL. TOL(1), TOL(2), and TOL(3) contain c, EPS, and SMLNUM, respectively. TOL(1) should normally be at least 10.Workspace
IWORK INTEGER array, dimension (4*K) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 10*K + MN, if all blocks between IFST and ILST have order 1; LDWORK >= 25*K + MN, if there is at least a block of order 2, but no adjacent blocks of order 2 can appear between IFST and ILST during reordering; LDWORK >= MAX(42*K + MN, 80*K - 48), if at least a pair of adjacent blocks of order 2 can appear between IFST and ILST during reordering; where MN = MXN, if MXN > 10, and MN = 0, otherwise, with MXN = MAX(N(k),k=1,...,K). If LDWORK = -1 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 is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -21, the LDWORK argument was too small; = 1: the reordering of T failed because some eigenvalues are too close to separate (the problem is very ill- conditioned); T may have been partially reordered. The returned value of ILST is the index where this was detected.Method
An adaptation of the LAPACK Library routine DTGEXC is used.Numerical Aspects
The implemented method is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reorder the diagonal blocks of the formal matrix product T22_K^S(K) * T22_K-1^S(K-1) * ... * T22_1^S(1) (1) of length K in the generalized periodic Schur form [ T11_k T12_k T13_k ] T_k = [ 0 T22_k T23_k ], k = 1, ..., K, (2) [ 0 0 T33_k ] where - the submatrices T11_k are NI(k+1)-by-NI(k), if S(k) = 1, or NI(k)-by-NI(k+1), if S(k) = -1, and contain dimension-induced infinite eigenvalues, - the submatrices T22_k are NC-by-NC and contain core eigenvalues, which are generically neither zero nor infinite, - the submatrices T33_k contain dimension-induced zero eigenvalues, such that pairs of adjacent diagonal blocks of sizes 1 and/or 2 in the product (1) are swapped. Optionally, the transformation matrices Q_1,...,Q_K from the reduction into generalized periodic Schur form are updated with respect to the performed reordering.Specification
SUBROUTINE MB03KB( COMPQ, WHICHQ, WS, K, NC, KSCHUR, J1, N1, N2, $ N, NI, S, T, LDT, IXT, Q, LDQ, IXQ, TOL, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ LOGICAL WS INTEGER INFO, J1, K, KSCHUR, LDWORK, N1, N2, NC C .. Array Arguments .. INTEGER IWORK( * ), IXQ( * ), IXT( * ), LDQ( * ), $ LDT( * ), N( * ), NI( * ), S( * ), WHICHQ( * ) DOUBLE PRECISION DWORK( * ), Q( * ), T( * ), TOL( * )Arguments
Mode Parameters
COMPQ CHARACTER*1 = 'N': do not compute any of the matrices Q_k; = 'U': each coefficient of Q must contain an orthogonal matrix Q1_k on entry, and the products Q1_k*Q_k are returned, where Q_k, k = 1, ..., K, performed the reordering; = 'W': the computation of each Q_k is specified individually in the array WHICHQ. WHICHQ INTEGER array, dimension (K) If COMPQ = 'W', WHICHQ(k) specifies the computation of Q_k as follows: = 0: do not compute Q_k; > 0: the kth coefficient of Q must contain an orthogonal matrix Q1_k on entry, and the product Q1_k*Q_k is returned. This array is not referenced if COMPQ <> 'W'. WS LOGICAL = .FALSE. : do not perform the strong stability tests; = .TRUE. : perform the strong stability tests; often, this is not needed, and omitting them can save some computations.Input/Output Parameters
K (input) INTEGER The period of the periodic matrix sequences T and Q (the number of factors in the matrix product). K >= 2. (For K = 1, a standard eigenvalue reordering problem is obtained.) NC (input) INTEGER The number of core eigenvalues. 0 <= NC <= min(N). KSCHUR (input) INTEGER The index for which the matrix T22_kschur is upper quasi- triangular. J1 (input) INTEGER The index of the first row and column of the first block to swap in T22_k. 1 <= J1 <= NC-N1-N2+1. N1 (input) INTEGER The order of the first block to swap. N1 = 0, 1 or 2. N2 (input) INTEGER The order of the second block to swap. N2 = 0, 1 or 2. N (input) INTEGER array, dimension (K) The leading K elements of this array must contain the dimensions of the factors of the formal matrix product T, such that the k-th coefficient T_k is an N(k+1)-by-N(k) matrix, if S(k) = 1, or an N(k)-by-N(k+1) matrix, if S(k) = -1, k = 1, ..., K, where N(K+1) = N(1). NI (input) INTEGER array, dimension (K) The leading K elements of this array must contain the dimensions of the factors of the matrix sequence T11_k. N(k) >= NI(k) + NC >= 0. S (input) INTEGER array, dimension (K) The leading K elements of this array must contain the signatures (exponents) of the factors in the K-periodic matrix sequence. Each entry in S must be either 1 or -1; the value S(k) = -1 corresponds to using the inverse of the factor T_k. T (input/output) DOUBLE PRECISION array, dimension (*) On entry, this array must contain at position IXT(k) the matrix T_k, which is at least N(k+1)-by-N(k), if S(k) = 1, or at least N(k)-by-N(k+1), if S(k) = -1, in periodic Schur form. On exit, the matrices T_k are overwritten by the reordered periodic Schur form. LDT INTEGER array, dimension (K) The leading dimensions of the matrices T_k in the one- dimensional array T. LDT(k) >= max(1,N(k+1)), if S(k) = 1, LDT(k) >= max(1,N(k)), if S(k) = -1. IXT INTEGER array, dimension (K) Start indices of the matrices T_k in the one-dimensional array T. Q (input/output) DOUBLE PRECISION array, dimension (*) On entry, this array must contain at position IXQ(k) a matrix Q_k of size at least N(k)-by-N(k), provided that COMPQ = 'U', or COMPQ = 'W' and WHICHQ(k) > 0. On exit, if COMPQ = 'U', or COMPQ = 'W' and WHICHQ(k) > 0, Q_k is post-multiplied with the orthogonal matrix that performed the reordering. This array is not referenced if COMPQ = 'N'. LDQ INTEGER array, dimension (K) The leading dimensions of the matrices Q_k in the one- dimensional array Q. LDQ(k) >= 1, and LDQ(k) >= max(1,N(k)), if COMPQ = 'U', or COMPQ = 'W' and WHICHQ(k) > 0; This array is not referenced if COMPQ = 'N'. IXQ INTEGER array, dimension (K) Start indices of the matrices Q_k in the one-dimensional array Q. This array is not referenced if COMPQ = 'N'.Tolerances
TOL DOUBLE PRECISION array, dimension (3) This array contains tolerance parameters. The weak and strong stability tests use a threshold computed by the formula MAX( c*EPS*NRM, SMLNUM ), where c is a constant, NRM is the Frobenius norm of the matrix formed by concatenating K pairs of adjacent diagonal blocks of sizes 1 and/or 2 in the T22_k submatrices from (2), which are swapped, and EPS and SMLNUM are the machine precision and safe minimum divided by EPS, respectively (see LAPACK Library routine DLAMCH). The norm NRM is computed by this routine; the other values are stored in the array TOL. TOL(1), TOL(2), and TOL(3) contain c, EPS, and SMLNUM, respectively. TOL(1) should normally be at least 10.Workspace
IWORK INTEGER array, dimension (4*K) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 10*K + MN, if N1 = 1, N2 = 1; LDWORK >= 25*K + MN, if N1 = 1, N2 = 2; LDWORK >= MAX(23*K + MN, 25*K - 12), if N1 = 2, N2 = 1; LDWORK >= MAX(42*K + MN, 80*K - 48), if N1 = 2, N2 = 2; where MN = MXN, if MXN > 10, and MN = 0, otherwise, with MXN = MAX(N(k),k=1,...,K). If LDWORK = -1 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 is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -22, then LDWORK is too small; appropriate value for LDWORK is returned in DWORK(1); the other arguments are not tested, for efficiency; = 1: the swap was rejected from stability reasons; the blocks are not swapped and T and Q are unchanged.Method
The algorithm described in [1] is used. Both weak and strong stability tests are performed.References
[1] Granat, R., Kagstrom, B. and Kressner, D. Computing periodic deflating subspaces associated with a specified set of eigenvalues. BIT Numerical Mathematics, vol. 47, 763-791, 2007.Numerical Aspects
The implemented method is numerically backward stable. 3 The algorithm requires 0(K NC ) floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce a 2-by-2 general, formal matrix product A of length K, A_K^s(K) * A_K-1^s(K-1) * ... * A_1^s(1), to the periodic Hessenberg-triangular form using a K-periodic sequence of elementary reflectors (Householder matrices). The matrices A_k, k = 1, ..., K, are stored in the N-by-N-by-K array A starting in the R-th row and column, and N can be 3 or 4. Each elementary reflector H_k is represented as H_k = I - tau_k * v_k * v_k', (1) where I is the 2-by-2 identity, tau_k is a real scalar, and v_k is a vector of length 2, k = 1,...,K, and it is constructed such that the following holds for k = 1,...,K: H_{k+1} * A_k * H_k = T_k, if s(k) = 1, (2) H_k * A_k * H_{k+1} = T_k, if s(k) = -1, with H_{K+1} = H_1 and all T_k upper triangular except for T_{khess} which is full. Clearly, T_K^s(K) *...* T_1^s(1) = H_1 * A_K^s(K) *...* A_1^s(1) * H_1. The reflectors are suitably applied to the whole, extended N-by-N matrices Ae_k, not only to the submatrices A_k, k = 1, ..., K.Specification
SUBROUTINE MB03KC( K, KHESS, N, R, S, A, LDA, V, TAU ) C .. Scalar Arguments .. INTEGER K, KHESS, LDA, N, R C .. Array Arguments .. INTEGER S( * ) DOUBLE PRECISION A( * ), TAU( * ), V( * )Arguments
Input/Output Parameters
K (input) INTEGER The number of matrices in the sequence A_k. K >= 2. KHESS (input) INTEGER The index for which the returned matrix A_khess should be in the Hessenberg form on output. 1 <= KHESS <= K. N (input) INTEGER The order of the extended matrices. N = 3 or N = 4. R (input) INTEGER The starting row and column index for the 2-by-2 submatrices. R = 1, or R = N-1. S (input) INTEGER array, dimension (K) The leading K elements of this array must contain the signatures of the factors. Each entry in S must be either 1 or -1; the value S(k) = -1 corresponds to using the inverse of the factor A_k. A (input/output) DOUBLE PRECISION array, dimension (*) On entry, this array must contain at position IXA(k) = (k-1)*N*LDA+1 the N-by-N matrix Ae_k stored with leading dimension LDA. On exit, this array contains at position IXA(k) the N-by-N matrix Te_k stored with leading dimension LDA. LDA INTEGER Leading dimension of the matrices Ae_k and Te_k in the one-dimensional array A. LDA >= N. V (output) DOUBLE PRECISION array, dimension (2*K) On exit, this array contains the K vectors v_k, k = 1,...,K, defining the elementary reflectors H_k as in (1). The k-th reflector is stored in V(2*k-1:2*k). TAU (output) DOUBLE PRECISION array, dimension (K) On exit, this array contains the K values of tau_k, k = 1,...,K, defining the elementary reflectors H_k as in (1).Method
A K-periodic sequence of elementary reflectors (Householder matrices) is used. The computations start for k = khess with the left reflector in (1), which is the identity matrix.Numerical Aspects
The implemented method is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reorder the diagonal blocks of the formal matrix product T22_K^S(K) * T22_K-1^S(K-1) * ... * T22_1^S(1), (1) of length K, in the generalized periodic Schur form, [ T11_k T12_k T13_k ] T_k = [ 0 T22_k T23_k ], k = 1, ..., K, (2) [ 0 0 T33_k ] where - the submatrices T11_k are NI(k+1)-by-NI(k), if S(k) = 1, or NI(k)-by-NI(k+1), if S(k) = -1, and contain dimension-induced infinite eigenvalues, - the submatrices T22_k are NC-by-NC and contain core eigenvalues, which are generically neither zero nor infinite, - the submatrices T33_k contain dimension-induced zero eigenvalues, such that the M selected eigenvalues pointed to by the logical vector SELECT end up in the leading part of the matrix sequence T22_k. Given that N(k) = N(k+1) for all k where S(k) = -1, the T11_k are void and the first M columns of the updated orthogonal transformation matrix sequence Q_1, ..., Q_K span a periodic deflating subspace corresponding to the same eigenvalues.Specification
SUBROUTINE MB03KD( COMPQ, WHICHQ, STRONG, K, NC, KSCHUR, N, NI, S, $ SELECT, T, LDT, IXT, Q, LDQ, IXQ, M, TOL, $ IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, STRONG INTEGER INFO, K, KSCHUR, LDWORK, M, NC DOUBLE PRECISION TOL C .. Array Arguments .. LOGICAL SELECT( * ) INTEGER IWORK( * ), IXQ( * ), IXT( * ), LDQ( * ), $ LDT( * ), N( * ), NI( * ), S( * ), WHICHQ( * ) DOUBLE PRECISION DWORK( * ), Q( * ), T( * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether to compute the orthogonal transformation matrices Q_k, as follows: = 'N': do not compute any of the matrices Q_k; = 'I': each coefficient of Q is initialized internally to the identity matrix, and the orthogonal matrices Q_k are returned, where Q_k, k = 1, ..., K, performed the reordering; = 'U': each coefficient of Q must contain an orthogonal matrix Q1_k on entry, and the products Q1_k*Q_k are returned; = 'W': the computation of each Q_k is specified individually in the array WHICHQ. WHICHQ INTEGER array, dimension (K) If COMPQ = 'W', WHICHQ(k) specifies the computation of Q_k as follows: = 0: do not compute Q_k; = 1: the kth coefficient of Q is initialized to the identity matrix, and the orthogonal matrix Q_k is returned; = 2: the kth coefficient of Q must contain an orthogonal matrix Q1_k on entry, and the product Q1_k*Q_k is returned. This array is not referenced if COMPQ <> 'W'. STRONG CHARACTER*1 Specifies whether to perform the strong stability tests, as follows: = 'N': do not perform the strong stability tests; = 'S': perform the strong stability tests; often, this is not needed, and omitting them can save some computations.Input/Output Parameters
K (input) INTEGER The period of the periodic matrix sequences T and Q (the number of factors in the matrix product). K >= 2. (For K = 1, a standard eigenvalue reordering problem is obtained.) NC (input) INTEGER The number of core eigenvalues. 0 <= NC <= min(N). KSCHUR (input) INTEGER The index for which the matrix T22_kschur is upper quasi- triangular. All other T22 matrices are upper triangular. N (input) INTEGER array, dimension (K) The leading K elements of this array must contain the dimensions of the factors of the formal matrix product T, such that the k-th coefficient T_k is an N(k+1)-by-N(k) matrix, if S(k) = 1, or an N(k)-by-N(k+1) matrix, if S(k) = -1, k = 1, ..., K, where N(K+1) = N(1). NI (input) INTEGER array, dimension (K) The leading K elements of this array must contain the dimensions of the factors of the matrix sequence T11_k. N(k) >= NI(k) + NC >= 0. S (input) INTEGER array, dimension (K) The leading K elements of this array must contain the signatures (exponents) of the factors in the K-periodic matrix sequence. Each entry in S must be either 1 or -1; the value S(k) = -1 corresponds to using the inverse of the factor T_k. SELECT (input) LOGICAL array, dimension (NC) SELECT specifies the eigenvalues in the selected cluster. To select a real eigenvalue w(j), SELECT(j) must be set to .TRUE.. To select a complex conjugate pair of eigenvalues w(j) and w(j+1), corresponding to a 2-by-2 diagonal block, either SELECT(j) or SELECT(j+1) or both must be set to .TRUE.; a complex conjugate pair of eigenvalues must be either both included in the cluster or both excluded. T (input/output) DOUBLE PRECISION array, dimension (*) On entry, this array must contain at position IXT(k) the matrix T_k, which is at least N(k+1)-by-N(k), if S(k) = 1, or at least N(k)-by-N(k+1), if S(k) = -1, in periodic Schur form. On exit, the matrices T_k are overwritten by the reordered periodic Schur form. LDT INTEGER array, dimension (K) The leading dimensions of the matrices T_k in the one- dimensional array T. LDT(k) >= max(1,N(k+1)), if S(k) = 1, LDT(k) >= max(1,N(k)), if S(k) = -1. IXT INTEGER array, dimension (K) Start indices of the matrices T_k in the one-dimensional array T. Q (input/output) DOUBLE PRECISION array, dimension (*) On entry, this array must contain at position IXQ(k) a matrix Q_k of size at least N(k)-by-N(k), provided that COMPQ = 'U', or COMPQ = 'W' and WHICHQ(k) = 2. On exit, if COMPQ = 'I' or COMPQ = 'W' and WHICHQ(k) = 1, Q_k contains the orthogonal matrix that performed the reordering. If COMPQ = 'U', or COMPQ = 'W' and WHICHQ(k) = 2, Q_k is post-multiplied with the orthogonal matrix that performed the reordering. This array is not referenced if COMPQ = 'N'. LDQ INTEGER array, dimension (K) The leading dimensions of the matrices Q_k in the one- dimensional array Q. LDQ(k) >= max(1,N(k)), if COMPQ = 'I', or COMPQ = 'U', or COMPQ = 'W' and WHICHQ(k) > 0; This array is not referenced if COMPQ = 'N'. IXQ INTEGER array, dimension (K) Start indices of the matrices Q_k in the one-dimensional array Q. This array is not referenced if COMPQ = 'N'. M (output) INTEGER The number of selected core eigenvalues which were reordered to the top of T22_k.Tolerances
TOL DOUBLE PRECISION The tolerance parameter c. The weak and strong stability tests performed for checking the reordering use a threshold computed by the formula MAX(c*EPS*NRM, SMLNUM), where NRM is the varying Frobenius norm of the matrices formed by concatenating K pairs of adjacent diagonal blocks of sizes 1 and/or 2 in the T22_k submatrices from (2), which are swapped, and EPS and SMLNUM are the machine precision and safe minimum divided by EPS, respectively (see LAPACK Library routine DLAMCH). The value c should normally be at least 10.Workspace
IWORK INTEGER array, dimension (4*K) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 10*K + MN, if all blocks involved in reordering have order 1; LDWORK >= 25*K + MN, if there is at least a block of order 2, but no adjacent blocks of order 2 are involved in reordering; LDWORK >= MAX(42*K + MN, 80*K - 48), if there is at least a pair of adjacent blocks of order 2 involved in reordering; where MN = MXN, if MXN > 10, and MN = 0, otherwise, with MXN = MAX(N(k),k=1,...,K). If LDWORK = -1 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 is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reordering of T failed because some eigenvalues are too close to separate (the problem is very ill- conditioned); T may have been partially reordered.Method
An adaptation of the LAPACK Library routine DTGSEN is used.Numerical Aspects
The implemented method is numerically backward stable.Further Comments
NoneExample
Program Text
* MB03KD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX, NMAX PARAMETER ( KMAX = 6, NMAX = 50 ) INTEGER LDA1, LDA2, LDQ1, LDQ2, LDWORK, LIWORK PARAMETER ( LDA1 = NMAX, LDA2 = NMAX, LDQ1 = NMAX, $ LDQ2 = NMAX, $ LDWORK = MAX( 42*KMAX + NMAX, 80*KMAX - 48, $ KMAX + MAX( 2*NMAX, 8*KMAX ) ), $ LIWORK = MAX( 4*KMAX, 2*KMAX + NMAX ) ) DOUBLE PRECISION HUND, ZERO PARAMETER ( HUND = 1.0D2, ZERO = 0.0D0 ) * * .. Local Scalars .. CHARACTER COMPQ, DEFL, JOB, STRONG INTEGER H, I, IHI, ILO, INFO, IWARN, J, K, L, M, N, P DOUBLE PRECISION TOL * * .. Local Arrays .. LOGICAL SELECT( NMAX ) INTEGER IWORK( LIWORK ), IXQ( KMAX ), IXT( KMAX ), $ LDQ( KMAX ), LDT( KMAX ), ND( KMAX ), $ NI( KMAX ), QIND( KMAX ), S( KMAX ), $ SCAL( NMAX ) DOUBLE PRECISION A( LDA1, LDA2, KMAX ), ALPHAI( NMAX ), $ ALPHAR( NMAX ), BETA( NMAX ), DWORK( LDWORK), $ Q( LDQ1, LDQ2, KMAX ), QK( NMAX*NMAX*KMAX ), $ T( NMAX*NMAX*KMAX ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL DLACPY, MB03BD, MB03KD * * .. Intrinsic Functions .. INTRINSIC INT, MAX * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) JOB, DEFL, COMPQ, STRONG, K, N, H, ILO, IHI IF( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE TOL = HUND READ( NIN, FMT = * ) ( S( I ), I = 1, K ) READ( NIN, FMT = * ) ( ( ( A( I, J, L ), J = 1, N ), $ I = 1, N ), L = 1, K ) IF( LSAME( COMPQ, 'U' ) ) $ READ( NIN, FMT = * ) ( ( ( Q( I, J, L ), J = 1, N ), $ I = 1, N ), L = 1, K ) IF( LSAME( COMPQ, 'P' ) ) THEN READ( NIN, FMT = * ) ( QIND( I ), I = 1, K ) DO 10 L = 1, K IF( QIND( L ).GT.0 ) $ READ( NIN, FMT = * ) ( ( Q( I, J, QIND( L ) ), $ J = 1, N ), I = 1, N ) 10 CONTINUE END IF IF( LSAME( JOB, 'E' ) ) $ JOB = 'S' * Compute the eigenvalues and the transformed matrices. CALL MB03BD( JOB, DEFL, COMPQ, QIND, K, N, H, ILO, IHI, S, A, $ LDA1, LDA2, Q, LDQ1, LDQ2, ALPHAR, ALPHAI, BETA, $ SCAL, IWORK, LIWORK, DWORK, LDWORK, IWARN, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE IF( IWARN.EQ.0 ) THEN * Prepare the data for calling MB03KD, which uses different * data structures and reverse ordering of the factors. DO 20 L = 1, K ND( L ) = MAX( 1, N ) NI( L ) = 0 LDT( L ) = MAX( 1, N ) IXT( L ) = ( L - 1 )*LDT( L )*N + 1 LDQ( L ) = MAX( 1, N ) IXQ( L ) = IXT( L ) IF( L.LE.INT( K/2 ) ) THEN I = S( K - L + 1 ) S( K - L + 1 ) = S( L ) S( L ) = I END IF 20 CONTINUE DO 30 L = 1, K CALL DLACPY( 'Full', N, N, A( 1, 1, K-L+1 ), LDA1, $ T( IXT( L ) ), LDT( L ) ) 30 CONTINUE IF( LSAME( COMPQ, 'U' ) .OR. LSAME( COMPQ, 'I' ) ) THEN COMPQ = 'U' DO 40 L = 1, K CALL DLACPY( 'Full', N, N, Q( 1, 1, K-L+1 ), LDQ1, $ QK( IXQ( L ) ), LDQ( L ) ) 40 CONTINUE ELSE IF( LSAME( COMPQ, 'P' ) ) THEN COMPQ = 'W' DO 50 L = 1, K IF( QIND( L ).LT.0 ) $ QIND( L ) = 2 P = QIND( L ) IF( P.NE.0 ) $ CALL DLACPY( 'Full', N, N, Q( 1, 1, K-P+1 ), LDQ1, $ QK( IXQ( P ) ), LDQ( P ) ) 50 CONTINUE END IF * Select eigenvalues with negative real part. DO 60 I = 1, N SELECT( I ) = ALPHAR( I ).LT.ZERO 60 CONTINUE WRITE( NOUT, FMT = 99996 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAR( I ), I = 1, N ) WRITE( NOUT, FMT = 99994 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAI( I ), I = 1, N ) WRITE( NOUT, FMT = 99993 ) WRITE( NOUT, FMT = 99995 ) ( BETA( I ), I = 1, N ) WRITE( NOUT, FMT = 99992 ) WRITE( NOUT, FMT = 99991 ) ( SCAL( I ), I = 1, N ) * Compute the transformed matrices, after reordering the * eigenvalues. CALL MB03KD( COMPQ, QIND, STRONG, K, N, H, ND, NI, S, $ SELECT, T, LDT, IXT, QK, LDQ, IXQ, M, TOL, $ IWORK, DWORK, LDWORK, INFO ) IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99990 ) INFO ELSE WRITE( NOUT, FMT = 99989 ) DO 80 L = 1, K P = K - L + 1 WRITE( NOUT, FMT = 99988 ) L DO 70 I = 1, N WRITE( NOUT, FMT = 99995 ) $ ( T( IXT( P ) + I - 1 + ( J - 1 )*LDT( P ) ), $ J = 1, N ) 70 CONTINUE 80 CONTINUE IF( LSAME( COMPQ, 'U' ) .OR. LSAME( COMPQ, 'I' ) ) THEN WRITE( NOUT, FMT = 99987 ) DO 100 L = 1, K P = K - L + 1 WRITE( NOUT, FMT = 99988 ) L DO 90 I = 1, N WRITE( NOUT, FMT = 99995 ) $ ( QK( IXQ( P ) + I - 1 + $ ( J - 1 )*LDQ( P ) ), J = 1, N ) 90 CONTINUE 100 CONTINUE ELSE IF( LSAME( COMPQ, 'W' ) ) THEN WRITE( NOUT, FMT = 99987 ) DO 120 L = 1, K IF( QIND( L ).GT.0 ) THEN P = K - QIND( L ) + 1 WRITE( NOUT, FMT = 99988 ) QIND( L ) DO 110 I = 1, N WRITE( NOUT, FMT = 99995 ) $ ( QK( IXQ( P ) + I - 1 + $ ( J - 1 )*LDQ( P ) ), J = 1, N ) 110 CONTINUE END IF 120 CONTINUE END IF END IF ELSE WRITE( NOUT, FMT = 99979 ) IWARN END IF END IF STOP * 99999 FORMAT( 'MB03KD EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT( 'INFO on exit from MB03BD = ', I2 ) 99996 FORMAT( 'The vector ALPHAR is ' ) 99995 FORMAT( 50( 1X, F8.4 ) ) 99994 FORMAT( 'The vector ALPHAI is ' ) 99993 FORMAT( 'The vector BETA is ' ) 99992 FORMAT( 'The vector SCAL is ' ) 99991 FORMAT( 50( 1X, I5 ) ) 99990 FORMAT( 'INFO on exit from MB03KD = ', I2 ) 99989 FORMAT( 'The matrix A on exit is ' ) 99988 FORMAT( 'The factor ', I2, ' is ' ) 99987 FORMAT( 'The matrix Q on exit is ' ) 99986 FORMAT( 'LDT', 3I5 ) 99985 FORMAT( 'IXT', 3I5 ) 99984 FORMAT( 'LDQ', 3I5 ) 99983 FORMAT( 'IXQ', 3I5 ) 99982 FORMAT( 'ND' , 3I5 ) 99981 FORMAT( 'NI' , 3I5) 99980 FORMAT( 'SELECT', 3L5 ) 99979 FORMAT( 'IWARN on exit from MB03BD = ', I2 ) ENDProgram Data
MB03KD EXAMPLE PROGRAM DATA S C I N 3 3 2 1 3 -1 1 -1 2.0 0.0 1.0 0.0 -2.0 -1.0 0.0 0.0 3.0 1.0 2.0 0.0 4.0 -1.0 3.0 0.0 3.0 1.0 1.0 0.0 1.0 0.0 4.0 -1.0 0.0 0.0 -2.0Program Results
MB03KD EXAMPLE PROGRAM RESULTS The vector ALPHAR is 0.3230 0.3230 -0.8752 The vector ALPHAI is 0.5694 -0.5694 0.0000 The vector BETA is 1.0000 1.0000 1.0000 The vector SCAL is 0 0 -1 The matrix A on exit is The factor 1 is 2.5997 -0.0087 1.6898 0.0000 1.9846 0.1942 0.0000 0.0000 2.3259 The factor 2 is -2.0990 -1.0831 -2.5601 0.0000 3.4838 0.2950 0.0000 3.4552 -2.1690 The factor 3 is 1.8451 0.9260 1.2717 0.0000 1.3976 -2.3544 0.0000 0.0000 -3.1023 The matrix Q on exit is The factor 1 is -0.2052 0.4647 -0.8614 0.2033 0.8811 0.4270 -0.9574 0.0875 0.2753 The factor 2 is -0.7743 -0.1384 0.6176 0.6070 -0.4386 0.6627 0.1791 0.8880 0.4236 The factor 3 is -0.6714 0.7225 -0.1651 -0.3658 -0.5168 -0.7740 -0.6446 -0.4593 0.6112
Purpose
To solve small periodic Sylvester-like equations (PSLE) op(A(i))*X( i ) + isgn*X(i+1)*op(B(i)) = -scale*C(i), S(i) = 1, op(A(i))*X(i+1) + isgn*X( i )*op(B(i)) = -scale*C(i), S(i) = -1. i = 1, ..., K, where op(A) means A or A**T, for the K-periodic matrix sequence X(i) = X(i+K), where A, B and C are K-periodic matrix sequences and A and B are in periodic real Schur form. The matrices A(i) are M-by-M and B(i) are N-by-N, with 1 <= M, N <= 2.Specification
SUBROUTINE MB03KE( TRANA, TRANB, ISGN, K, M, N, PREC, SMIN, S, A, $ B, C, SCALE, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. LOGICAL TRANA, TRANB INTEGER INFO, ISGN, K, LDWORK, M, N DOUBLE PRECISION PREC, SCALE, SMIN C .. Array Arguments .. INTEGER S( * ) DOUBLE PRECISION A( * ), B( * ), C( * ), DWORK( * )Arguments
Mode Parameters
TRANA LOGICAL Specifies the form of op(A) to be used, as follows: = .FALSE.: op(A) = A, = .TRUE. : op(A) = A**T. TRANB LOGICAL Specifies the form of op(B) to be used, as follows: = .FALSE.: op(B) = B, = .TRUE. : op(B) = B**T. ISGN INTEGER Specifies which sign variant of the equations to solve. ISGN = 1 or ISGN = -1.Input/Output Parameters
K (input) INTEGER The period of the periodic matrix sequences A, B, C and X. K >= 2. (For K = 1, a standard Sylvester equation is obtained.) M (input) INTEGER The order of the matrices A(i) and the number of rows of the matrices C(i) and X(i), i = 1, ..., K. 1 <= M <= 2. N (input) INTEGER The order of the matrices B(i) and the number of columns of the matrices C(i) and X(i), i = 1, ..., K. 1 <= N <= 2. PREC (input) DOUBLE PRECISION The relative machine precision. See the LAPACK Library routine DLAMCH. SMIN (input) DOUBLE PRECISION The machine safe minimum divided by PREC. S (input) INTEGER array, dimension (K) The leading K elements of this array must contain the signatures (exponents) of the factors in the K-periodic matrix sequences for A and B. Each entry in S must be either 1 or -1. Notice that it is assumed that the same exponents are tied to both A and B on reduction to the periodic Schur form. A (input) DOUBLE PRECISION array, dimension (M*M*K) On entry, this array must contain the M-by-M matrices A(i), for i = 1, ..., K, stored with the leading dimension M. Matrix A(i) is stored starting at position M*M*(i-1)+1. B (input) DOUBLE PRECISION array, dimension (N*N*K) On entry, this array must contain the N-by-N matrices B(i), for i = 1, ..., K, stored with the leading dimension N. Matrix B(i) is stored starting at position N*N*(i-1)+1. C (input/output) DOUBLE PRECISION array, dimension (M*N*K) On entry, this array must contain the M-by-N matrices C(i), for i = 1, ..., K, stored with the leading dimension M. Matrix C(i) is stored starting at position M*N*(i-1)+1. On exit, the matrices C(i) are overwritten by the solution sequence X(i). SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to avoid overflow in X.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. On exit, if INFO = -21, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= (4*K-3) * (M*N)**2 + K * M*N. If LDWORK = -1 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 is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -21, then LDWORK is too small; appropriate value for LDWORK is returned in DWORK(1); the other arguments are not tested, for efficiency; = 1: the solution would overflow with scale = 1, so SCALE was set less than 1. This is a warning, not an error.Method
A version of the algorithm described in [1] is used. The routine uses a sparse Kronecker product representation Z of the PSLE and solves for X(i) from an associated linear system Z*x = c using structured (overlapping) variants of QR factorization and backward substitution.References
[1] Granat, R., Kagstrom, B. and Kressner, D. Computing periodic deflating subspaces associated with a specified set of eigenvalues. BIT Numerical Mathematics, vol. 47, 763-791, 2007.Numerical Aspects
The implemented method is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the relevant eigenvalues of a real N-by-N skew- Hamiltonian/Hamiltonian pencil aS - bH, with ( A D ) ( B F ) S = ( ) and H = ( ), (1) ( E A' ) ( G -B' ) where the notation M' denotes the transpose of the matrix M. Optionally, if COMPQ = 'C', an orthogonal basis of the right deflating subspace of aS - bH corresponding to the eigenvalues with strictly negative real part is computed.Specification
SUBROUTINE MB03LD( COMPQ, ORTH, N, A, LDA, DE, LDDE, B, LDB, FG, $ LDFG, NEIG, Q, LDQ, ALPHAR, ALPHAI, BETA, $ IWORK, LIWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, ORTH INTEGER INFO, LDA, LDB, LDDE, LDFG, LDQ, LDWORK, $ LIWORK, N, NEIG C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ), $ B( LDB, * ), BETA( * ), DE( LDDE, * ), $ DWORK( * ), FG( LDFG, * ), Q( LDQ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether to compute the right deflating subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. = 'N': do not compute the deflating subspace; = 'C': compute the deflating subspace and store it in the leading subarray of Q. ORTH CHARACTER*1 If COMPQ = 'C', specifies the technique for computing an orthogonal basis of the deflating subspace, as follows: = 'P': QR factorization with column pivoting; = 'S': singular value decomposition. If COMPQ = 'N', the ORTH value is not used.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix A. On exit, if COMPQ = 'C', the leading N/2-by-N/2 part of this array contains the upper triangular matrix Aout (see METHOD); otherwise, it contains the upper triangular matrix A obtained just before the application of the periodic QZ algorithm (see SLICOT Library routine MB04BD). LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). DE (input/output) DOUBLE PRECISION array, dimension (LDDE, N/2+1) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the skew-symmetric matrix E, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the skew-symmetric matrix D. The entries on the diagonal and the first superdiagonal of this array need not be set, but are assumed to be zero. On exit, if COMPQ = 'C', the leading N/2-by-N/2 lower triangular part and the first superdiagonal contain the transpose of the upper quasi-triangular matrix C2out (see METHOD), and the (N/2-1)-by-(N/2-1) upper triangular part of the submatrix in the columns 3 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix Dout (see METHOD), without the main diagonal, which is zero. On exit, if COMPQ = 'N', the leading N/2-by-N/2 lower triangular part and the first superdiagonal contain the transpose of the upper Hessenberg matrix C2, and the (N/2-1)-by-(N/2-1) upper triangular part of the submatrix in the columns 3 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix D (without the main diagonal) just before the application of the periodic QZ algorithm. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N/2). B (input/output) DOUBLE PRECISION array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if COMPQ = 'C', the leading N/2-by-N/2 part of this array contains the upper triangular matrix C1out (see METHOD); otherwise, it contains the upper triangular matrix C1 obtained just before the application of the periodic QZ algorithm. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). FG (input/output) DOUBLE PRECISION array, dimension (LDFG, N/2+1) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the symmetric matrix G, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the symmetric matrix F. On exit, if COMPQ = 'C', the leading N/2-by-N/2 part of the submatrix in the columns 2 to N/2+1 of this array contains the matrix Vout (see METHOD); otherwise, it contains the matrix V obtained just before the application of the periodic QZ algorithm. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, N/2). NEIG (output) INTEGER If COMPQ = 'C', the number of eigenvalues in aS - bH with strictly negative real part. Q (output) DOUBLE PRECISION array, dimension (LDQ, 2*N) On exit, if COMPQ = 'C', the leading N-by-NEIG part of this array contains an orthogonal basis of the right deflating subspace corresponding to the eigenvalues of aA - bB with strictly negative real part. The remaining part of this array is used as workspace. If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, 2*N), if COMPQ = 'C'. ALPHAR (output) DOUBLE PRECISION array, dimension (N/2) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N/2) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N/2) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed. Due to the skew-Hamiltonian/Hamiltonian structure of the pencil, for every eigenvalue lambda, -lambda is also an eigenvalue, and thus it has only to be saved once in ALPHAR, ALPHAI and BETA. Specifically, only eigenvalues with imaginary parts greater than or equal to zero are stored; their conjugate eigenvalues are not stored. If imaginary parts are zero (i.e., for real eigenvalues), only positive eigenvalues are stored. The remaining eigenvalues have opposite signs.Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = -19, IWORK(1) returns the minimum value of LIWORK. LIWORK INTEGER The dimension of the array IWORK. LIWORK = 1, if N = 0, LIWORK >= MAX( N + 12, 2*N + 3 ), if COMPQ = 'N', LIWORK >= MAX( 32, 2*N + 3 ), if COMPQ = 'C'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. On exit, if INFO = -21, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK = 1, if N = 0, LDWORK >= 3*(N/2)**2 + N**2 + MAX( L, 36 ), if COMPQ = 'N', where L = 4*N + 4, if N/2 is even, and L = 4*N , if N/2 is odd; LDWORK >= 8*N**2 + MAX( 8*N + 32, 272 ), if COMPQ = 'C'. For good performance LDWORK should be generally larger. If LDWORK = -1 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 is issued by XERBLA. BWORK LOGICAL array, dimension (N/2)Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: periodic QZ iteration failed in the SLICOT Library routines MB04BD or MB04HD (QZ iteration did not converge or computation of the shifts failed); = 2: standard QZ iteration failed in the SLICOT Library routines MB04HD or MB03DD (called by MB03JD); = 3: a numerically singular matrix was found in the SLICOT Library routine MB03HD (called by MB03JD); = 4: the singular value decomposition failed in the LAPACK routine DGESVD (for ORTH = 'S'); = 5: some eigenvalues might be inaccurate. This is a warning.Method
First, the decompositions of S and H are computed via orthogonal transformations Q1 and Q2 as follows: ( Aout Dout ) Q1' S J Q1 J' = ( ), ( 0 Aout' ) ( Bout Fout ) J' Q2' J S Q2 = ( ) =: T, (2) ( 0 Bout' ) ( C1out Vout ) ( 0 I ) Q1' H Q2 = ( ), where J = ( ), ( 0 C2out' ) ( -I 0 ) and Aout, Bout, C1out are upper triangular, C2out is upper quasi- triangular and Dout and Fout are skew-symmetric. Then, orthogonal matrices Q3 and Q4 are found, for the extended matrices ( Aout 0 ) ( 0 C1out ) Se = ( ) and He = ( ), ( 0 Bout ) ( -C2out 0 ) such that S11 := Q4' Se Q3 is upper triangular and H11 := Q4' He Q3 is upper quasi-triangular. The following matrices are computed: ( Dout 0 ) ( 0 Vout ) S12 := Q4' ( ) Q4 and H12 := Q4' ( ) Q4. ( 0 Fout ) ( Vout' 0 ) Then, an orthogonal matrix Q is found such that the eigenvalues with strictly negative real parts of the pencil ( S11 S12 ) ( H11 H12 ) a ( ) - b ( ) ( 0 S11' ) ( 0 -H11' ) are moved to the top of this pencil. Finally, an orthogonal basis of the right deflating subspace corresponding to the eigenvalues with strictly negative real part is computed. See also page 12 in [1] for more details.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) floating point operations.Further Comments
This routine does not perform any scaling of the matrices. Scaling might sometimes be useful, and it should be done externally.Example
Program Text
* MB03LD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 50 ) INTEGER LDA, LDB, LDDE, LDFG, LDQ, LDWORK, LIWORK PARAMETER ( LDA = NMAX/2, LDB = NMAX/2, LDDE = NMAX/2, $ LDFG = NMAX/2, LDQ = 2*NMAX, $ LDWORK = 8*NMAX*NMAX + $ MAX( 8*NMAX + 32, NMAX/2 + 168, $ 272 ), $ LIWORK = MAX( 32, NMAX + 12, NMAX*2 + 3 ) ) * * .. Local Scalars .. CHARACTER COMPQ, ORTH INTEGER I, INFO, J, M, N, NEIG * * .. Local Arrays .. LOGICAL BWORK( NMAX/2 ) INTEGER IWORK( LIWORK ) DOUBLE PRECISION A( LDA, NMAX/2 ), ALPHAI( NMAX/2 ), $ ALPHAR( NMAX/2 ), B( LDB, NMAX/2 ), $ BETA( NMAX/2 ), DE( LDDE, NMAX/2+1 ), $ DWORK( LDWORK ), FG( LDFG, NMAX/2+1 ), $ Q( LDQ, 2*NMAX ) * * .. External Subroutines .. EXTERNAL MB03LD * * .. Intrinsic Functions .. INTRINSIC MAX * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) COMPQ, ORTH, N IF( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE M = N/2 READ( NIN, FMT = * ) ( ( A( I, J ), J = 1, M ), I = 1, M ) READ( NIN, FMT = * ) ( ( DE( I, J ), J = 1, M+1 ), I = 1, M ) READ( NIN, FMT = * ) ( ( B( I, J ), J = 1, M ), I = 1, M ) READ( NIN, FMT = * ) ( ( FG( I, J ), J = 1, M+1 ), I = 1, M ) * Compute the eigenvalues and an orthogonal basis of the right * deflating subspace of a real skew-Hamiltonian/Hamiltonian * pencil, corresponding to the eigenvalues with strictly negative * real part. CALL MB03LD( COMPQ, ORTH, N, A, LDA, DE, LDDE, B, LDB, FG, $ LDFG, NEIG, Q, LDQ, ALPHAR, ALPHAI, BETA, IWORK, $ LIWORK, DWORK, LDWORK, BWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, M WRITE( NOUT, FMT = 99995 ) ( A( I, J ), J = 1, M ) 10 CONTINUE WRITE( NOUT, FMT = 99994 ) DO 20 I = 1, M WRITE( NOUT, FMT = 99995 ) ( DE( I, J ), J = 1, M+1 ) 20 CONTINUE WRITE( NOUT, FMT = 99993 ) DO 30 I = 1, M WRITE( NOUT, FMT = 99995 ) ( B( I, J ), J = 1, M ) 30 CONTINUE WRITE( NOUT, FMT = 99992 ) DO 40 I = 1, M WRITE( NOUT, FMT = 99995 ) ( FG( I, J ), J = 2, M+1 ) 40 CONTINUE WRITE( NOUT, FMT = 99991 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAR( I ), I = 1, M ) WRITE( NOUT, FMT = 99990 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAI( I ), I = 1, M ) WRITE( NOUT, FMT = 99989 ) WRITE( NOUT, FMT = 99995 ) ( BETA( I ), I = 1, M ) IF( LSAME( COMPQ, 'C' ) .AND. NEIG.GT.0 ) THEN WRITE( NOUT, FMT = 99988 ) DO 50 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q( I, J ), J = 1, NEIG ) 50 CONTINUE END IF END IF END IF STOP * 99999 FORMAT( 'MB03LD EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT( 'INFO on exit from MB03LD = ', I2 ) 99996 FORMAT( 'The matrix A on exit is ' ) 99995 FORMAT( 50( 1X, F8.4 ) ) 99994 FORMAT( 'The matrix DE on exit is ' ) 99993 FORMAT( 'The matrix C1 on exit is ' ) 99992 FORMAT( 'The matrix V on exit is ' ) 99991 FORMAT( 'The vector ALPHAR is ' ) 99990 FORMAT( 'The vector ALPHAI is ' ) 99989 FORMAT( 'The vector BETA is ' ) 99988 FORMAT( 'The matrix Q is ' ) ENDProgram Data
MB03LD EXAMPLE PROGRAM DATA C P 8 3.1472 1.3236 4.5751 4.5717 4.0579 -4.0246 4.6489 -0.1462 -3.7301 -2.2150 -3.4239 3.0028 4.1338 0.4688 4.7059 -3.5811 0.0000 0.0000 -1.5510 -4.5974 -2.5127 3.5071 0.0000 0.0000 1.5961 2.4490 -3.1428 2.5648 0.0000 0.0000 -0.0596 3.0340 2.4892 -1.1604 0.0000 0.0000 0.6882 -3.3782 -3.3435 1.8921 -0.3061 2.9428 1.0198 2.4815 -4.8810 -1.8878 -2.3703 -0.4946 -1.6288 0.2853 1.5408 -4.1618 -2.4013 -2.7102 0.3834 -3.9335 3.1730 -3.1815 -2.3620 4.9613 4.6190 3.6869 3.6929 0.7970 0.4986 -4.9537 -4.1556 3.5303 1.2206 -1.4905 0.1325 -1.0022Program Results
MB03LD EXAMPLE PROGRAM RESULTS The matrix A on exit is -4.7460 4.1855 3.2696 -0.2244 0.0000 6.4157 2.8287 1.4553 0.0000 0.0000 7.4626 1.5726 0.0000 0.0000 0.0000 8.8702 The matrix DE on exit is -5.4562 2.5550 -1.3137 -6.3615 -0.8940 -2.1348 -7.9616 0.0000 1.0704 -0.0659 4.9694 1.1516 4.8504 0.0000 -0.6922 -2.2744 3.4912 0.5046 4.4394 0.0000 The matrix C1 on exit is 6.9525 -4.9881 2.3661 4.2188 0.0000 8.5009 0.7182 5.5533 0.0000 0.0000 -4.6650 -2.8177 0.0000 0.0000 0.0000 1.5124 The matrix V on exit is 0.9136 4.1106 -0.0079 3.5789 -1.1553 -1.4785 -1.5155 -0.8018 -2.2167 4.8029 1.3645 2.5202 -1.0994 -0.6144 0.3970 2.0730 The vector ALPHAR is 0.8314 -0.8314 0.8131 0.0000 The vector ALPHAI is 0.4372 0.4372 0.0000 0.9164 The vector BETA is 0.7071 0.7071 1.4142 2.8284 The matrix Q is -0.5844 -0.2949 0.1692 0.5470 -0.2324 -0.4524 0.0382 0.4673 -0.3092 -0.0378 0.0904 -0.4451 -0.0255 0.1497 -0.1929 -0.1286 -0.6067 -0.2275 -0.2260 0.4901 0.0951 0.5367 -0.0430 0.6123
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03LF.html 0000664 0000000 0000000 00000050077 14560147231 0020346 0 ustar 00root root 0000000 0000000
Purpose
To compute the relevant eigenvalues of a real N-by-N skew- Hamiltonian/Hamiltonian pencil aS - bH, with ( B F ) ( 0 I ) S = T Z = J Z' J' Z and H = ( ), J = ( ), (1) ( G -B' ) ( -I 0 ) where the notation M' denotes the transpose of the matrix M. Optionally, if COMPQ = 'C', an orthogonal basis of the right deflating subspace of aS - bH corresponding to the eigenvalues with strictly negative real part is computed. Optionally, if COMPU = 'C', an orthonormal basis of the companion subspace, range(P_U) [1], which corresponds to the eigenvalues with strictly negative real part, is computed.Specification
SUBROUTINE MB03LF( COMPQ, COMPU, ORTH, N, Z, LDZ, B, LDB, FG, $ LDFG, NEIG, Q, LDQ, U, LDU, ALPHAR, ALPHAI, $ BETA, IWORK, LIWORK, DWORK, LDWORK, BWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPU, ORTH INTEGER INFO, IWARN, LDB, LDFG, LDQ, LDU, LDWORK, LDZ, $ LIWORK, N, NEIG C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION ALPHAI( * ), ALPHAR( * ), B( LDB, * ), $ BETA( * ), DWORK( * ), FG( LDFG, * ), $ Q( LDQ, * ), U( LDU, * ), Z( LDZ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether to compute the right deflating subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. = 'N': do not compute the deflating subspace; = 'C': compute the deflating subspace and store it in the leading subarray of Q. COMPU CHARACTER*1 Specifies whether to compute the companion subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. = 'N': do not compute the companion subspace; = 'C': compute the companion subspace and store it in the leading subarray of U. ORTH CHARACTER*1 If COMPQ = 'C' and/or COMPU = 'C', specifies the technique for computing the orthogonal basis of the deflating subspace, and/or of the companion subspace, as follows: = 'P': QR factorization with column pivoting; = 'S': singular value decomposition. If COMPQ = 'N' and COMPU = 'N', the ORTH value is not used.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N) On entry, the leading N-by-N part of this array must contain the non-trivial factor Z in the factorization S = J Z' J' Z of the skew-Hamiltonian matrix S. On exit, if COMPQ = 'C' or COMPU = 'C', the leading N-by-N part of this array contains the transformed upper ~ triangular matrix Z11 (see METHOD), after moving the eigenvalues with strictly negative real part to the top of the pencil (3). The strictly lower triangular part is not zeroed. If COMPQ = 'N' and COMPU = 'N', the leading N-by-N part of this array contains the matrix Z obtained by the SLICOT Library routine MB04AD just before the application of the periodic QZ algorithm. The elements of the (2,1) block, i.e., in the rows N/2+1 to N and in the columns 1 to N/2 are not set to zero, but are unchanged on exit. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1, N). B (input) DOUBLE PRECISION array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). FG (input) DOUBLE PRECISION array, dimension (LDFG, N/2+1) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the symmetric matrix G, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the symmetric matrix F. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, N/2). NEIG (output) INTEGER If COMPQ = 'C' or COMPU = 'C', the number of eigenvalues in aS - bH with strictly negative real part. Q (output) DOUBLE PRECISION array, dimension (LDQ, 2*N) On exit, if COMPQ = 'C', the leading N-by-NEIG part of this array contains an orthogonal basis of the right deflating subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. The remaining part of this array is used as workspace. If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, 2*N), if COMPQ = 'C'. U (output) DOUBLE PRECISION array, dimension (LDU, 2*N) On exit, if COMPU = 'C', the leading N-by-NEIG part of this array contains an orthogonal basis of the companion subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. The remaining part of this array is used as workspace. If COMPU = 'N', this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= 1, if COMPU = 'N'; LDU >= MAX(1, N), if COMPU = 'C'. ALPHAR (output) DOUBLE PRECISION array, dimension (N/2) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N/2) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N/2) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed. Due to the skew-Hamiltonian/Hamiltonian structure of the pencil, for every eigenvalue lambda, -lambda is also an eigenvalue, and thus it has only to be saved once in ALPHAR, ALPHAI and BETA. Specifically, only eigenvalues with imaginary parts greater than or equal to zero are stored; their conjugate eigenvalues are not stored. If imaginary parts are zero (i.e., for real eigenvalues), only positive eigenvalues are stored. The remaining eigenvalues have opposite signs. As a consequence, pairs of complex eigenvalues, stored in consecutive locations, are not complex conjugate.Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = -20, IWORK(1) returns the minimum value of LIWORK. LIWORK INTEGER The dimension of the array IWORK. LIWORK >= N + 18, if COMPQ = 'N' and COMPU = 'N'; LIWORK >= MAX( 2*N+1, 48 ), otherwise. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -22, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= b*N*N + 3*N*N/2 + MAX( 6*N, 54 ), if COMPQ = 'N' and COMPU = 'N'; LDWORK >= d*N*N + MAX( N/2+252, 432 ), otherwise, where b = a, d = c, if COMPU = 'N', b = a+1, d = c+1, if COMPU = 'C', and a = 2, c = 7, if COMPQ = 'N', a = 4, c = 10, if COMPQ = 'C'. For good performance LDWORK should be generally larger. If LDWORK = -1 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 is issued by XERBLA. BWORK LOGICAL array, dimension (N/2)Warning Indicator
IWARN INTEGER = 0: no warning; = 1: some eigenvalues might be unreliable. More details can be obtained by running the SLICOT routine MB04AD.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: periodic QZ iteration failed in the SLICOT Library routines MB04AD, MB04CD or MB03BB (QZ iteration did not converge or computation of the shifts failed); = 2: standard QZ iteration failed in the SLICOT Library routines MB04CD or MB03CD (called by MB03ID); = 3: a numerically singular matrix was found in the SLICOT Library routine MB03GD (called by MB03ID); = 4: the singular value decomposition failed in the LAPACK routine DGESVD (for ORTH = 'S').Method
First, the decompositions of S and H are computed via orthogonal matrices Q1 and Q2 and orthogonal symplectic matrices U1 and U2, such that ( T11 T12 ) Q1' T U1 = Q1' J Z' J' U1 = ( ), ( 0 T22 ) ( Z11 Z12 ) U2' Z Q2 = ( ), (2) ( 0 Z22 ) ( H11 H12 ) Q1' H Q2 = ( ), ( 0 H22 ) where T11, T22', Z11, Z22', H11 are upper triangular and H22' is upper quasi-triangular. Then, orthogonal matrices Q3, Q4 and U3 are found, for the matrices ~ ( T22' 0 ) ~ ( T11' 0 ) ~ ( 0 H11 ) Z11 = ( ), Z22 = ( ), H = ( ), ( 0 Z11 ) ( 0 Z22 ) ( -H22' 0 ) ~ ~ ~ ~ such that Z11 := U3' Z11 Q4, Z22 := U3' Z22 Q3 are upper ~ ~ triangular and H11 := Q3' H Q4 is upper quasi-triangular. The following matrices are computed: ~ ( -T12' 0 ) ~ ( 0 H12 ) Z12 := U3' ( ) Q3 and H12 := Q3' ( ) Q3. ( 0 Z12 ) ( H12' 0 ) Then, an orthogonal matrix Q and an orthogonal symplectic matrix U are found such that the eigenvalues with strictly negative real parts of the pencil ~ ~ ~ ~ ~ ~ ( Z11 Z12 )' ( Z11 Z12 ) ( H11 H12 ) a J ( ~ ) J' ( ~ ) - b ( ~ ) (3) ( 0 Z22 ) ( 0 Z22 ) ( 0 -H11' ) are moved to the top of this pencil. Finally, an orthogonal basis of the right deflating subspace and an orthogonal basis of the companion subspace corresponding to the eigenvalues with strictly negative real part are computed. See also page 11 in [1] for more details.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) floating point operations.Further Comments
This routine does not perform any scaling of the matrices. Scaling might sometimes be useful, and it should be done externally.Example
Program Text
* MB03LF EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 50 ) INTEGER LDB, LDFG, LDQ, LDU, LDWORK, LDZ, LIWORK PARAMETER ( LDB = NMAX/2, LDFG = NMAX/2, LDQ = 2*NMAX, $ LDU = NMAX, LDZ = NMAX, $ LDWORK = 10*NMAX*NMAX + $ MAX( NMAX*NMAX + $ MAX( NMAX/2 + 252, 432 ), $ MAX( 8*NMAX + 48, 171 ) ), $ LIWORK = MAX( NMAX + 18, NMAX/2 + 48, $ 5*NMAX/2 + 1 ) ) * * .. Local Scalars .. CHARACTER COMPQ, COMPU, ORTH INTEGER I, INFO, IWARN, J, M, N, NEIG * * .. Local Arrays .. LOGICAL BWORK( NMAX/2 ) INTEGER IWORK( LIWORK ) DOUBLE PRECISION ALPHAI( NMAX/2 ), ALPHAR( NMAX/2 ), $ B( LDB, NMAX/2 ), BETA( NMAX/2 ), $ DWORK( LDWORK ), FG( LDFG, NMAX/2+1 ), $ Q( LDQ, 2*NMAX ), U( LDU, 2*NMAX ), $ Z( LDZ, NMAX ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB03LF * * .. Intrinsic Functions .. INTRINSIC MAX, MOD * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) COMPQ, COMPU, ORTH, N IF( N.LT.0 .OR. N.GT.NMAX .OR. MOD( N, 2 ).NE.0 ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE M = N/2 READ( NIN, FMT = * ) ( ( Z( I, J ), J = 1, N ), I = 1, N ) READ( NIN, FMT = * ) ( ( B( I, J ), J = 1, M ), I = 1, M ) READ( NIN, FMT = * ) ( ( FG( I, J ), J = 1, M+1 ), I = 1, M ) * Compute the eigenvalues and orthogonal bases of the right * deflating subspace and companion subspace of a real * skew-Hamiltonian/Hamiltonian pencil, corresponding to the * eigenvalues with strictly negative real part. CALL MB03LF( COMPQ, COMPU, ORTH, N, Z, LDZ, B, LDB, FG, LDFG, $ NEIG, Q, LDQ, U, LDU, ALPHAR, ALPHAI, BETA, IWORK, $ LIWORK, DWORK, LDWORK, BWORK, IWARN, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Z( I, J ), J = 1, N ) 10 CONTINUE WRITE( NOUT, FMT = 99994 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAR( I ), I = 1, M ) WRITE( NOUT, FMT = 99993 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAI( I ), I = 1, M ) WRITE( NOUT, FMT = 99992 ) WRITE( NOUT, FMT = 99995 ) ( BETA( I ), I = 1, M ) IF( LSAME( COMPQ, 'C' ) .AND. NEIG.GT.0 ) THEN WRITE( NOUT, FMT = 99991 ) DO 20 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q( I, J ), J = 1, NEIG ) 20 CONTINUE END IF IF( LSAME( COMPU, 'C' ) .AND. NEIG.GT.0 ) THEN WRITE( NOUT, FMT = 99990 ) DO 30 I = 1, N WRITE( NOUT, FMT = 99995 ) ( U( I, J ), J = 1, NEIG ) 30 CONTINUE END IF IF( LSAME( COMPQ, 'C' ) .OR. LSAME( COMPU, 'C' ) ) $ WRITE( NOUT, FMT = 99989 ) NEIG END IF END IF STOP * 99999 FORMAT ( 'MB03LF EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT ( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT ( 'INFO on exit from MB03LF = ', I2 ) 99996 FORMAT (/'The matrix Z on exit is ' ) 99995 FORMAT ( 50( 1X, F8.4 ) ) 99994 FORMAT (/'The vector ALPHAR is ' ) 99993 FORMAT (/'The vector ALPHAI is ' ) 99992 FORMAT (/'The vector BETA is ' ) 99991 FORMAT (/'The deflating subspace corresponding to the ', $ 'eigenvalues with negative real part is ' ) 99990 FORMAT (/'The companion subspace corresponding to the ', $ 'eigenvalues with negative real part is ' ) 99989 FORMAT (/'The number of eigenvalues in the initial pencil with ', $ 'negative real part is ', I2 ) ENDProgram Data
MB03LF EXAMPLE PROGRAM DATA C C P 8 3.1472 4.5751 -0.7824 1.7874 -2.2308 -0.6126 2.0936 4.5974 4.0579 4.6489 4.1574 2.5774 -4.5383 -1.1844 2.5469 -1.5961 -3.7301 -3.4239 2.9221 2.4313 -4.0287 2.6552 -2.2397 0.8527 4.1338 4.7059 4.5949 -1.0777 3.2346 2.9520 1.7970 -2.7619 1.3236 4.5717 1.5574 1.5548 1.9483 -3.1313 1.5510 2.5127 -4.0246 -0.1462 -4.6429 -3.2881 -1.8290 -0.1024 -3.3739 -2.4490 -2.2150 3.0028 3.4913 2.0605 4.5022 -0.5441 -3.8100 0.0596 0.4688 -3.5811 4.3399 -4.6817 -4.6555 1.4631 -0.0164 1.9908 0.6882 -3.3782 -3.3435 1.8921 -0.3061 2.9428 1.0198 2.4815 -4.8810 -1.8878 -2.3703 -0.4946 -1.6288 0.2853 1.5408 -4.1618 -2.4013 -2.7102 0.3834 -3.9335 3.1730 -3.1815 -2.3620 4.9613 4.6190 3.6869 3.6929 0.7970 0.4986 -4.9537 -4.1556 3.5303 1.2206 -1.4905 0.1325 -1.0022Program Results
MB03LF EXAMPLE PROGRAM RESULTS The matrix Z on exit is 4.4128 0.1059 -1.8709 1.2963 -4.3448 2.7633 2.3580 2.1931 0.0000 10.0337 -1.9797 1.8052 -1.0112 1.1335 1.2374 0.3107 0.0000 0.0000 8.9476 1.8523 -1.8578 -0.5807 -1.4157 1.3007 0.0000 0.0000 0.0000 -7.0889 -2.1193 -2.1634 -2.4393 0.1148 0.0765 1.0139 0.0000 -1.5390 -8.3187 -5.0172 0.7738 -2.8626 1.1884 -0.9225 0.0000 0.2905 0.0000 6.4090 2.1994 -2.5933 -0.5931 0.1981 0.0000 -0.5280 0.0000 0.0000 4.7155 2.3817 1.8591 -1.8416 0.0000 -0.0807 0.0000 0.0000 0.0000 -5.3153 The vector ALPHAR is 0.7353 0.0000 0.5168 -0.5168 The vector ALPHAI is 0.0000 0.7190 0.5610 0.5610 The vector BETA is 2.0000 2.8284 11.3137 11.3137 The deflating subspace corresponding to the eigenvalues with negative real part is -0.2509 0.3670 0.0416 -0.3267 -0.7968 -0.1019 0.0263 0.0338 -0.5795 -0.0139 -0.0491 -0.5217 -0.4637 0.2992 -0.4403 -0.1345 0.3071 -0.0917 -0.1364 0.2013 0.3447 -0.7601 -0.0495 0.2426 The companion subspace corresponding to the eigenvalues with negative real part is -0.3219 0.6590 0.1693 -0.5216 -0.1829 -0.0689 -0.0413 -0.4664 -0.1359 0.1310 -0.1702 0.4543 -0.3598 0.2660 0.3355 -0.5082 -0.0512 -0.6035 -0.3582 -0.4513 0.4649 0.2991 0.0932 -0.2207 The number of eigenvalues in the initial pencil with negative real part is 3
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03LP.html 0000664 0000000 0000000 00000032744 14560147231 0020361 0 ustar 00root root 0000000 0000000
Purpose
To compute the relevant eigenvalues of a real N-by-N skew- Hamiltonian/Hamiltonian pencil aS - bH, with ( A D ) ( B F ) S = ( ) and H = ( ), (1) ( E A' ) ( G -B' ) where the notation M' denotes the transpose of the matrix M. Optionally, if COMPQ = 'C', an orthogonal basis of the right deflating subspace of aS - bH corresponding to the eigenvalues with strictly negative real part is computed.Specification
SUBROUTINE MB03LP( COMPQ, ORTH, N, A, LDA, DE, LDDE, B, LDB, FG, $ LDFG, NEIG, Q, LDQ, ALPHAR, ALPHAI, BETA, $ IWORK, LIWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, ORTH INTEGER INFO, LDA, LDB, LDDE, LDFG, LDQ, LDWORK, $ LIWORK, N, NEIG C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ), $ B( LDB, * ), BETA( * ), DE( LDDE, * ), $ DWORK( * ), FG( LDFG, * ), Q( LDQ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether to compute the right deflating subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. = 'N': do not compute the deflating subspace; = 'C': compute the deflating subspace and store it in the leading subarray of Q. ORTH CHARACTER*1 If COMPQ = 'C', specifies the technique for computing an orthogonal basis of the deflating subspace, as follows: = 'P': QR factorization with column pivoting; = 'S': singular value decomposition. If COMPQ = 'N', the ORTH value is not used.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix A. On exit, if COMPQ = 'C', the leading N/2-by-N/2 part of this array contains the upper triangular matrix Aout (see METHOD); otherwise, it contains the upper triangular matrix A obtained just before the application of the periodic QZ algorithm (see SLICOT Library routine MB04BP). LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). DE (input/output) DOUBLE PRECISION array, dimension (LDDE, N/2+1) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the skew-symmetric matrix E, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the skew-symmetric matrix D. The entries on the diagonal and the first superdiagonal of this array need not be set, but are assumed to be zero. On exit, if COMPQ = 'C', the leading N/2-by-N/2 lower triangular part and the first superdiagonal contain the transpose of the upper quasi-triangular matrix C2out (see METHOD), and the (N/2-1)-by-(N/2-1) upper triangular part of the submatrix in the columns 3 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix Dout (see METHOD), without the main diagonal, which is zero. On exit, if COMPQ = 'N', the leading N/2-by-N/2 lower triangular part and the first superdiagonal contain the transpose of the upper Hessenberg matrix C2, and the (N/2-1)-by-(N/2-1) upper triangular part of the submatrix in the columns 3 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix D (without the main diagonal) just before the application of the periodic QZ algorithm. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N/2). B (input/output) DOUBLE PRECISION array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if COMPQ = 'C', the leading N/2-by-N/2 part of this array contains the upper triangular matrix C1out (see METHOD); otherwise, it contains the upper triangular matrix C1 obtained just before the application of the periodic QZ algorithm. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). FG (input/output) DOUBLE PRECISION array, dimension (LDFG, N/2+1) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the symmetric matrix G, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the symmetric matrix F. On exit, if COMPQ = 'C', the leading N/2-by-N/2 part of the submatrix in the columns 2 to N/2+1 of this array contains the matrix Vout (see METHOD); otherwise, it contains the matrix V obtained just before the application of the periodic QZ algorithm. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, N/2). NEIG (output) INTEGER If COMPQ = 'C', the number of eigenvalues in aS - bH with strictly negative real part. Q (output) DOUBLE PRECISION array, dimension (LDQ, 2*N) On exit, if COMPQ = 'C', the leading N-by-NEIG part of this array contains an orthogonal basis of the right deflating subspace corresponding to the eigenvalues of aA - bB with strictly negative real part. The remaining part of this array is used as workspace. If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, 2*N), if COMPQ = 'C'. ALPHAR (output) DOUBLE PRECISION array, dimension (N/2) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N/2) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N/2) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed. Due to the skew-Hamiltonian/Hamiltonian structure of the pencil, for every eigenvalue lambda, -lambda is also an eigenvalue, and thus it has only to be saved once in ALPHAR, ALPHAI and BETA. Specifically, only eigenvalues with imaginary parts greater than or equal to zero are stored; their conjugate eigenvalues are not stored. If imaginary parts are zero (i.e., for real eigenvalues), only positive eigenvalues are stored. The remaining eigenvalues have opposite signs.Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = -19, IWORK(1) returns the minimum value of LIWORK. LIWORK INTEGER The dimension of the array IWORK. LIWORK = 1, if N = 0, LIWORK >= MAX( N + 12, 2*N + 3 ), if COMPQ = 'N', LIWORK >= MAX( 32, 6*N - 3 ), if COMPQ = 'C'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. On exit, if INFO = -21, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK = 1, if N = 0, LDWORK >= 3*(N/2)**2 + N**2 + MAX( L, 36 ), if COMPQ = 'N', where L = 4*N + 4, if N/2 is even, and L = 4*N , if N/2 is odd; LDWORK >= 8*N**2 + MAX( 13*N + 32, 272 ), if COMPQ = 'C'. For good performance LDWORK should be generally larger. If LDWORK = -1 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 is issued by XERBLA. BWORK LOGICAL array, dimension (N/2)Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: periodic QZ iteration failed in the SLICOT Library routines MB04BP or MB04HD (QZ iteration did not converge or computation of the shifts failed); = 2: standard QZ iteration failed in the SLICOT Library routines MB04HD or MB03DD (called by MB03JP); = 3: a numerically singular matrix was found in the SLICOT Library routine MB03HD (called by MB03JP); = 4: the singular value decomposition failed in the LAPACK routine DGESVD (for ORTH = 'S'); = 5: some eigenvalues might be inaccurate. This is a warning.Method
First, the decompositions of S and H are computed via orthogonal transformations Q1 and Q2 as follows: ( Aout Dout ) Q1' S J Q1 J' = ( ), ( 0 Aout' ) ( Bout Fout ) J' Q2' J S Q2 = ( ) =: T, (2) ( 0 Bout' ) ( C1out Vout ) ( 0 I ) Q1' H Q2 = ( ), where J = ( ), ( 0 C2out' ) ( -I 0 ) and Aout, Bout, C1out are upper triangular, C2out is upper quasi- triangular and Dout and Fout are skew-symmetric. Then, orthogonal matrices Q3 and Q4 are found, for the extended matrices ( Aout 0 ) ( 0 C1out ) Se = ( ) and He = ( ), ( 0 Bout ) ( -C2out 0 ) such that S11 := Q4' Se Q3 is upper triangular and H11 := Q4' He Q3 is upper quasi-triangular. The following matrices are computed: ( Dout 0 ) ( 0 Vout ) S12 := Q4' ( ) Q4 and H12 := Q4' ( ) Q4. ( 0 Fout ) ( Vout' 0 ) Then, an orthogonal matrix Q is found such that the eigenvalues with strictly negative real parts of the pencil ( S11 S12 ) ( H11 H12 ) a ( ) - b ( ) ( 0 S11' ) ( 0 -H11' ) are moved to the top of this pencil. Finally, an orthogonal basis of the right deflating subspace corresponding to the eigenvalues with strictly negative real part is computed. See also page 12 in [1] for more details.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) floating point operations.Further Comments
This routine does not perform any scaling of the matrices. Scaling might sometimes be useful, and it should be done externally. For large values of N, the routine applies the transformations on panels of columns. The user may specify in INFO the desired number of columns. If on entry INFO <= 0, then the routine estimates a suitable value of this number.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03LZ.html 0000664 0000000 0000000 00000050064 14560147231 0020366 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of a complex N-by-N skew-Hamiltonian/ Hamiltonian pencil aS - bH, with ( A D ) ( B F ) S = ( ) and H = ( ). (1) ( E A' ) ( G -B' ) The structured Schur form of the embedded real skew-Hamiltonian/ skew-Hamiltonian pencil aB_S - bB_T, defined as ( Re(A) -Im(A) | Re(D) -Im(D) ) ( | ) ( Im(A) Re(A) | Im(D) Re(D) ) ( | ) B_S = (-----------------+-----------------) , and ( | ) ( Re(E) -Im(E) | Re(A') Im(A') ) ( | ) ( Im(E) Re(E) | -Im(A') Re(A') ) (2) ( -Im(B) -Re(B) | -Im(F) -Re(F) ) ( | ) ( Re(B) -Im(B) | Re(F) -Im(F) ) ( | ) B_T = (-----------------+-----------------) , T = i*H, ( | ) ( -Im(G) -Re(G) | -Im(B') Re(B') ) ( | ) ( Re(G) -Im(G) | -Re(B') -Im(B') ) is determined and used to compute the eigenvalues. The notation M' denotes the conjugate transpose of the matrix M. Optionally, if COMPQ = 'C', an orthonormal basis of the right deflating subspace of the pencil aS - bH, corresponding to the eigenvalues with strictly negative real part, is computed. Namely, after transforming aB_S - bB_H by unitary matrices, we have ( BA BD ) ( BB BF ) B_Sout = ( ) and B_Hout = ( ), (3) ( 0 BA' ) ( 0 -BB' ) and the eigenvalues with strictly negative real part of the complex pencil aB_Sout - bB_Hout are moved to the top. The embedding doubles the multiplicities of the eigenvalues of the pencil aS - bH.Specification
SUBROUTINE MB03LZ( COMPQ, ORTH, N, A, LDA, DE, LDDE, B, LDB, FG, $ LDFG, NEIG, Q, LDQ, ALPHAR, ALPHAI, BETA, $ IWORK, DWORK, LDWORK, ZWORK, LZWORK, BWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, ORTH INTEGER INFO, LDA, LDB, LDDE, LDFG, LDQ, LDWORK, $ LZWORK, N, NEIG C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION ALPHAI( * ), ALPHAR( * ), BETA( * ), DWORK( * ) COMPLEX*16 A( LDA, * ), B( LDB, * ), DE( LDDE, * ), $ FG( LDFG, * ), Q( LDQ, * ), ZWORK( * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether to compute the deflating subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. = 'N': do not compute the deflating subspace; compute the eigenvalues only; = 'C': compute the deflating subspace and store it in the leading subarray of Q. ORTH CHARACTER*1 If COMPQ = 'C', specifies the technique for computing an orthonormal basis of the deflating subspace, as follows: = 'P': QR factorization with column pivoting; = 'S': singular value decomposition. If COMPQ = 'N', the ORTH value is not used.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) COMPLEX*16 array, dimension (LDA, N) On entry, the leading N/2-by-N/2 part of this array must contain the matrix A. On exit, if COMPQ = 'C', the leading N-by-N part of this array contains the upper triangular matrix BA in (3) (see also METHOD). The strictly lower triangular part is not zeroed; it is preserved in the leading N/2-by-N/2 part. If COMPQ = 'N', this array is unchanged on exit. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N). DE (input/output) COMPLEX*16 array, dimension (LDDE, N) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the skew-Hermitian matrix E, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the skew-Hermitian matrix D. On exit, if COMPQ = 'C', the leading N-by-N part of this array contains the skew-Hermitian matrix BD in (3) (see also METHOD). The strictly lower triangular part of the input matrix is preserved. If COMPQ = 'N', this array is unchanged on exit. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N). B (input/output) COMPLEX*16 array, dimension (LDB, N) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if COMPQ = 'C', the leading N-by-N part of this array contains the upper triangular matrix BB in (3) (see also METHOD). The strictly lower triangular part is not zeroed; the elements below the first subdiagonal of the input matrix are preserved. If COMPQ = 'N', this array is unchanged on exit. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N). FG (input/output) COMPLEX*16 array, dimension (LDFG, N) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the Hermitian matrix G, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the Hermitian matrix F. On exit, if COMPQ = 'C', the leading N-by-N part of this array contains the Hermitian matrix BF in (3) (see also METHOD). The strictly lower triangular part of the input matrix is preserved. The diagonal elements might have tiny imaginary parts. If COMPQ = 'N', this array is unchanged on exit. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, N). NEIG (output) INTEGER If COMPQ = 'C', the number of eigenvalues in aS - bH with strictly negative real part. Q (output) COMPLEX*16 array, dimension (LDQ, 2*N) On exit, if COMPQ = 'C', the leading N-by-NEIG part of this array contains an orthonormal basis of the right deflating subspace corresponding to the eigenvalues of the pencil aS - bH with strictly negative real part. The remaining entries are meaningless. If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, 2*N), if COMPQ = 'C'. ALPHAR (output) DOUBLE PRECISION array, dimension (N) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed.Workspace
IWORK INTEGER array, dimension (N+1) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. On exit, if INFO = -20, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX( 4*N*N + 2*N + MAX(3,N) ), if COMPQ = 'N'; LDWORK >= MAX( 1, 11*N*N + 2*N ), if COMPQ = 'C'. For good performance LDWORK should be generally 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. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal LZWORK. On exit, if INFO = -22, ZWORK(1) returns the minimum value of LZWORK. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= 1, if COMPQ = 'N'; LZWORK >= 8*N + 4, if COMPQ = 'C'. For good performance LZWORK should be generally larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA. BWORK LOGICAL array, dimension (LBWORK) LBWORK >= 0, if COMPQ = 'N'; LBWORK >= N - 1, if COMPQ = 'C'.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: QZ iteration failed in the SLICOT Library routine MB04FD (QZ iteration did not converge or computation of the shifts failed); = 2: QZ iteration failed in the LAPACK routine ZHGEQZ when trying to triangularize the 2-by-2 blocks; = 3: the singular value decomposition failed in the LAPACK routine ZGESVD (for ORTH = 'S'); = 4: warning: the pencil is numerically singular.Method
First, T = i*H is set. Then, the embeddings, B_S and B_T, of the matrices S and T, are determined and, subsequently, the SLICOT Library routine MB04FD is applied to compute the structured Schur form, i.e., the factorizations ~ ( S11 S12 ) B_S = J Q' J' B_S Q = ( ) and ( 0 S11' ) ~ ( T11 T12 ) ( 0 I ) B_T = J Q' J' B_T Q = ( ), with J = ( ), ( 0 T11' ) ( -I 0 ) where Q is real orthogonal, S11 is upper triangular, and T11 is upper quasi-triangular. Second, the SLICOT Library routine MB03JZ is applied, to compute a ~ unitary matrix Q, such that ~ ~ ~ ~ ~ ( S11 S12 ) J Q' J' B_S Q = ( ~ ) =: B_Sout, ( 0 S11' ) ~ ~ ~ ( H11 H12 ) J Q' J'(-i*B_T) Q = ( ) =: B_Hout, ( 0 -H11' ) ~ ~ ~ with S11, H11 upper triangular, and such that Spec_-(B_S, -i*B_T) is contained in the spectrum of the 2*NEIG-by-2*NEIG leading ~ principal subpencil aS11 - bH11. Finally, the right deflating subspace is computed. See also page 22 in [1] for more details.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) complex floating point operations.Further Comments
This routine does not perform any scaling of the matrices. Scaling might sometimes be useful, and it should be done externally.Example
Program Text
* MB03LZ EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 50 ) INTEGER LDA, LDB, LDDE, LDFG, LDQ, LDWORK, LZWORK PARAMETER ( LDA = NMAX, LDB = NMAX, LDDE = NMAX, $ LDFG = NMAX, LDQ = 2*NMAX, $ LDWORK = 11*NMAX*NMAX + 2*NMAX, $ LZWORK = 8*NMAX + 4 ) * * .. Local Scalars .. CHARACTER*1 COMPQ, ORTH INTEGER I, INFO, J, N, NEIG * * .. Local Arrays .. COMPLEX*16 A( LDA, NMAX ), B( LDB, NMAX ), $ DE( LDDE, NMAX ), FG( LDFG, NMAX ), $ Q( LDQ, 2*NMAX ), ZWORK( LZWORK ) DOUBLE PRECISION ALPHAI( NMAX ), ALPHAR( NMAX ), BETA( NMAX ), $ DWORK( LDWORK ) INTEGER IWORK( NMAX + 1 ) LOGICAL BWORK( NMAX ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB03LZ * * .. Intrinsic Functions .. INTRINSIC MOD * * .. Executable statements .. * WRITE( NOUT, FMT = 99999 ) * * Skip first line in data file. * READ( NIN, FMT = * ) READ( NIN, FMT = * ) COMPQ, ORTH, N READ( NIN, FMT = * ) ( ( A( I, J ), J = 1, N/2 ), I = 1, N/2 ) READ( NIN, FMT = * ) ( ( DE( I, J ), J = 1, N/2+1 ), I = 1, N/2 ) READ( NIN, FMT = * ) ( ( B( I, J ), J = 1, N/2 ), I = 1, N/2 ) READ( NIN, FMT = * ) ( ( FG( I, J ), J = 1, N/2+1 ), I = 1, N/2 ) IF( N.LT.0 .OR. N.GT.NMAX .OR. MOD( N, 2 ).NE.0 ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE * Compute the eigenvalues and an orthogonal basis of the right * deflating subspace of a complex skew-Hamiltonian/Hamiltonian * pencil, corresponding to the eigenvalues with strictly negative * real part. CALL MB03LZ( COMPQ, ORTH, N, A, LDA, DE, LDDE, B, LDB, FG, $ LDFG, NEIG, Q, LDQ, ALPHAR, ALPHAI, BETA, IWORK, $ DWORK, LDWORK, ZWORK, LZWORK, BWORK, INFO ) IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE IF( LSAME( COMPQ, 'C' ) ) THEN WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE( NOUT, FMT = 99995 ) ( A( I, J ), J = 1, N ) 10 CONTINUE WRITE( NOUT, FMT = 99994 ) DO 20 I = 1, N WRITE( NOUT, FMT = 99995 ) ( DE( I, J ), J = 1, N ) 20 CONTINUE WRITE( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE( NOUT, FMT = 99995 ) ( B( I, J ), J = 1, N ) 30 CONTINUE WRITE( NOUT, FMT = 99992 ) DO 40 I = 1, N WRITE( NOUT, FMT = 99995 ) ( FG( I, J ), J = 1, N ) 40 CONTINUE END IF WRITE( NOUT, FMT = 99991 ) WRITE( NOUT, FMT = 99990 ) ( ALPHAR( I ), I = 1, N ) WRITE( NOUT, FMT = 99989 ) WRITE( NOUT, FMT = 99990 ) ( ALPHAI( I ), I = 1, N ) WRITE( NOUT, FMT = 99988 ) WRITE( NOUT, FMT = 99990 ) ( BETA( I ), I = 1, N ) IF( LSAME( COMPQ, 'C' ) .AND. NEIG.GT.0 ) THEN WRITE( NOUT, FMT = 99987 ) DO 50 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q( I, J ), J = 1, NEIG ) 50 CONTINUE END IF IF( LSAME( COMPQ, 'C' ) ) $ WRITE( NOUT, FMT = 99986 ) NEIG END IF END IF STOP 99999 FORMAT ( 'MB03LZ EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT ( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT ( 'INFO on exit from MB03LZ = ', I2 ) 99996 FORMAT (/'The matrix A on exit is ' ) 99995 FORMAT ( 20( 1X, F9.4, SP, F9.4, S, 'i ') ) 99994 FORMAT (/'The matrix D on exit is ' ) 99993 FORMAT (/'The matrix B on exit is ' ) 99992 FORMAT (/'The matrix F on exit is ' ) 99991 FORMAT ( 'The vector ALPHAR is ' ) 99990 FORMAT ( 50( 1X, F8.4 ) ) 99989 FORMAT (/'The vector ALPHAI is ' ) 99988 FORMAT (/'The vector BETA is ' ) 99987 FORMAT (/'The deflating subspace corresponding to the ', $ 'eigenvalues with negative real part is ' ) 99986 FORMAT (/'The number of eigenvalues in the initial pencil with ', $ 'negative real part is ', I2 ) ENDProgram Data
MB03LZ EXAMPLE PROGRAM DATA C P 4 (0.0604,0.6568) (0.5268,0.2919) (0.3992,0.6279) (0.4167,0.4316) (0,0.4896) (0,0.9516) (0.3724,0.0526) (0.9840,0.3394) (0,0.9203) (0,0.7378) (0.2691,0.4177) (0.5478,0.3014) (0.4228,0.9830) (0.9427,0.7010) 0.6663 0.6981 (0.1781,0.8818) (0.5391,0.1711) 0.6665 0.1280Program Results
MB03LZ EXAMPLE PROGRAM RESULTS The matrix A on exit is 0.7430 +0.0000i -0.1431 -0.1304i -0.4169 -0.0495i 0.0650 -0.0262i 0.3992 +0.6279i 0.7398 -1.2647i -0.0861 -0.1075i 0.2826 +0.7725i 0.0000 +0.0000i 0.0000 +0.0000i 1.4799 +0.1442i -0.1094 -0.1061i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.6816 +0.2278i The matrix D on exit is 0.0000 -0.6858i -0.3122 -0.1018i -0.7813 -0.4163i -0.1343 +0.3259i 0.9840 +0.3394i 0.0000 +0.1465i -0.1678 +0.2971i -0.0728 -0.6524i 0.0000 +0.0000i 0.0000 +0.0000i -0.0000 +0.2979i -0.0728 +0.3971i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.2414i The matrix B on exit is -1.5832 +0.5069i -0.0819 -0.1073i 0.7749 -0.0519i 0.0635 -0.0052i 0.0000 +0.0000i -0.1916 -0.0106i -0.0074 +0.0165i -0.1546 -0.6817i 0.0000 +0.0000i 0.0000 +0.0000i -0.0716 -0.1811i 0.3146 +0.1558i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -1.6078 -0.0203i The matrix F on exit is 0.3382 0.0000i -0.0622 +0.8488i 0.0042 +0.9053i -0.1584 +0.0726i 0.5391 +0.1711i -0.5888 +0.0000i 0.4089 +0.2018i -0.6913 -0.5011i 0.0000 +0.0000i 0.0000 +0.0000i -0.2712 +0.0000i 0.5114 +0.3726i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.5218 +0.0000i The vector ALPHAR is -1.5832 1.5832 -0.0842 0.0842 The vector ALPHAI is 0.5069 0.5069 -0.1642 -0.1642 The vector BETA is 0.7430 0.7430 1.4085 1.4085 The deflating subspace corresponding to the eigenvalues with negative real part is -0.0793 -0.1949i 0.4845 -0.5472i 0.4349 +0.1710i -0.2878 +0.0952i -0.1266 +0.1505i 0.1364 -0.4776i -0.5035 +0.6671i 0.1628 +0.3174i The number of eigenvalues in the initial pencil with negative real part is 2
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03MD.html 0000664 0000000 0000000 00000026672 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To compute an upper bound THETA using a bisection method such that the bidiagonal matrix |q(1) e(1) 0 ... 0 | | 0 q(2) e(2) . | J = | . . | | . e(N-1)| | 0 ... ... q(N) | has precisely L singular values less than or equal to THETA plus a given tolerance TOL. This routine is mainly intended to be called only by other SLICOT routines.Specification
SUBROUTINE MB03MD( N, L, THETA, Q, E, Q2, E2, PIVMIN, TOL, RELTOL, $ IWARN, INFO ) C .. Scalar Arguments .. INTEGER INFO, IWARN, L, N DOUBLE PRECISION PIVMIN, RELTOL, THETA, TOL C .. Array Arguments .. DOUBLE PRECISION E(*), E2(*), Q(*), Q2(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the bidiagonal matrix J. N >= 0. L (input/output) INTEGER On entry, L must contain the number of singular values of J which must be less than or equal to the upper bound computed by the routine. 0 <= L <= N. On exit, L may be increased if the L-th smallest singular value of J has multiplicity greater than 1. In this case, L is increased by the number of singular values of J which are larger than its L-th smallest one and approach the L-th smallest singular value of J within a distance less than TOL. If L has been increased, then the routine returns with IWARN set to 1. THETA (input/output) DOUBLE PRECISION On entry, THETA must contain an initial estimate for the upper bound to be computed. If THETA < 0.0 on entry, then one of the following default values is used. If L = 0, THETA is set to 0.0 irrespective of the input value of THETA; if L = 1, then THETA is taken as MIN(ABS(Q(i))), for i = 1,2,...,N; otherwise, THETA is taken as ABS(Q(N-L+1)). On exit, THETA contains the computed upper bound such that the bidiagonal matrix J has precisely L singular values less than or equal to THETA + TOL. Q (input) DOUBLE PRECISION array, dimension (N) This array must contain the diagonal elements q(1), q(2),...,q(N) of the bidiagonal matrix J. That is, Q(i) = J(i,i) for i = 1,2,...,N. E (input) DOUBLE PRECISION array, dimension (N-1) This array must contain the superdiagonal elements e(1),e(2),...,e(N-1) of the bidiagonal matrix J. That is, E(k) = J(k,k+1) for k = 1,2,...,N-1. Q2 (input) DOUBLE PRECISION array, dimension (N) This array must contain the squares of the diagonal elements q(1),q(2),...,q(N) of the bidiagonal matrix J. That is, Q2(i) = J(i,i)**2 for i = 1,2,...,N. E2 (input) DOUBLE PRECISION array, dimension (N-1) This array must contain the squares of the superdiagonal elements e(1),e(2),...,e(N-1) of the bidiagonal matrix J. That is, E2(k) = J(k,k+1)**2 for k = 1,2,...,N-1. PIVMIN (input) DOUBLE PRECISION The minimum absolute value of a "pivot" in the Sturm sequence loop. PIVMIN >= max( max( |q(i)|, |e(k)| )**2*sf_min, sf_min ), where i = 1,2,...,N, k = 1,2,...,N-1, and sf_min is at least the smallest number that can divide one without overflow (see LAPACK Library routine DLAMCH). Note that this condition is not checked by the routine.Tolerances
TOL DOUBLE PRECISION This parameter defines the multiplicity of singular values by considering all singular values within an interval of length TOL as coinciding. TOL is used in checking how many singular values are less than or equal to THETA. Also in computing an appropriate upper bound THETA by a bisection method, TOL is used as a stopping criterion defining the minimum (absolute) subinterval width. TOL >= 0. RELTOL DOUBLE PRECISION This parameter specifies the minimum relative width of an interval. When an interval is narrower than TOL, or than RELTOL times the larger (in magnitude) endpoint, then it is considered to be sufficiently small and bisection has converged. RELTOL >= BASE * EPS, where BASE is machine radix and EPS is machine precision (see LAPACK Library routine DLAMCH).Warning Indicator
IWARN INTEGER = 0: no warnings; = 1: if the value of L has been increased as the L-th smallest singular value of J coincides with the (L+1)-th smallest one.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Let s(i), i = 1,2,...,N, be the N non-negative singular values of the bidiagonal matrix J arranged so that s(1) >= ... >= s(N) >= 0. The routine then computes an upper bound T such that s(N-L) > T >= s(N-L+1) as follows (see [2]). First, if the initial estimate of THETA is not specified by the user then the routine initialises THETA to be an estimate which is close to the requested value of THETA if s(N-L) >> s(N-L+1). Second, a bisection method (see [1, 8.5]) is used which generates a sequence of shrinking intervals [Y,Z] such that either THETA in [Y,Z] was found (so that J has L singular values less than or equal to THETA), or (number of s(i) <= Y) < L < (number of s(i) <= Z). This bisection method is applied to an associated 2N-by-2N symmetric tridiagonal matrix T" whose eigenvalues (see [1]) are given by s(1),s(2),...,s(N),-s(1),-s(2),...,-s(N). One of the starting values for the bisection method is the initial value of THETA. If this value is an upper bound, then the initial lower bound is set to zero, else the initial upper bound is computed from the Gershgorin Circle Theorem [1, Theorem 7.2-1], applied to T". The computation of the "number of s(i) <= Y (or Z)" is achieved by calling SLICOT Library routine MB03ND, which applies Sylvester's Law of Inertia or equivalently Sturm sequences [1, 8.5] to the associated matrix T". If Z - Y <= MAX( TOL, PIVMIN, RELTOL*MAX( ABS( Y ), ABS( Z ) ) ) at some stage of the bisection method, then at least two singular values of J lie in the interval [Y,Z] within a distance less than TOL from each other. In this case, s(N-L) and s(N-L+1) are assumed to coincide, the upper bound T is set to the value of Z, the value of L is increased and IWARN is set to 1.References
[1] Golub, G.H. and Van Loan, C.F. Matrix Computations. The Johns Hopkins University Press, Baltimore, Maryland, 1983. [2] Van Huffel, S. and Vandewalle, J. The Partial Total Least Squares Algorithm. J. Comput. and Appl. Math., 21, pp. 333-341, 1988.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* MB03MD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) * .. Local Scalars .. DOUBLE PRECISION PIVMIN, RELTOL, SAFMIN, THETA, TOL INTEGER I, INFO, IWARN, L, N * .. Local Arrays .. DOUBLE PRECISION E(NMAX-1), E2(NMAX-1), Q(NMAX), Q2(NMAX) * .. External Functions .. DOUBLE PRECISION DLAMCH EXTERNAL DLAMCH * .. External Subroutines .. EXTERNAL MB03MD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, THETA, L, TOL, RELTOL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE IF ( L.LT.0 .OR. L.GT.N ) THEN WRITE ( NOUT, FMT = 99990 ) L ELSE READ ( NIN, FMT = * ) ( Q(I), I = 1,N ) READ ( NIN, FMT = * ) ( E(I), I = 1,N-1 ) * Print out the bidiagonal matrix J. WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, N - 1 WRITE ( NOUT, FMT = 99996 ) I, I, Q(I), I, (I+1), E(I) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) N, N, Q(N) * Compute Q**2, E**2, and PIVMIN. Q2(N) = Q(N)**2 PIVMIN = Q2(N) DO 40 I = 1, N - 1 Q2(I) = Q(I)**2 E2(I) = E(I)**2 PIVMIN = MAX( PIVMIN, Q2(I), E2(I) ) 40 CONTINUE SAFMIN = DLAMCH( 'Safe minimum' ) PIVMIN = MAX( PIVMIN*SAFMIN, SAFMIN ) TOL = MAX( TOL, ZERO ) IF ( RELTOL.LE.ZERO ) $ RELTOL = DLAMCH( 'Base' )*DLAMCH( 'Epsilon' ) * Compute an upper bound THETA such that J has 3 singular values * < = THETA. CALL MB03MD( N, L, THETA, Q, E, Q2, E2, PIVMIN, TOL, RELTOL, $ IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) WRITE ( NOUT, FMT = 99994 ) IWARN WRITE ( NOUT, FMT = 99993 ) THETA WRITE ( NOUT, FMT = 99992 ) L END IF END IF STOP * 99999 FORMAT (' MB03MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB03MD = ',I2) 99997 FORMAT (' The Bidiagonal Matrix J is',/) 99996 FORMAT (2(' (',I1,',',I1,') = ',F7.4,2X)) 99995 FORMAT (' (',I1,',',I1,') = ',F7.4) 99994 FORMAT (' IWARN on exit from MB03MD = ',I2,/) 99993 FORMAT (/' The computed value of THETA is ',F7.4) 99992 FORMAT (/' J has ',I2,' singular values < = THETA') 99991 FORMAT (/' N is out of range.',/' N = ',I5) 99990 FORMAT (/' L is out of range.',/' L = ',I5) ENDProgram Data
MB03MD EXAMPLE PROGRAM DATA 5 -3.0 3 0.0 0.0 1.0 2.0 3.0 4.0 5.0 2.0 3.0 4.0 5.0Program Results
MB03MD EXAMPLE PROGRAM RESULTS The Bidiagonal Matrix J is (1,1) = 1.0000 (1,2) = 2.0000 (2,2) = 2.0000 (2,3) = 3.0000 (3,3) = 3.0000 (3,4) = 4.0000 (4,4) = 4.0000 (4,5) = 5.0000 (5,5) = 5.0000 The computed value of THETA is 4.7500 J has 3 singular values < = THETA
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03ND.html 0000664 0000000 0000000 00000021014 14560147231 0020333 0 ustar 00root root 0000000 0000000
Purpose
To find the number of singular values of the bidiagonal matrix |q(1) e(1) . ... 0 | | 0 q(2) e(2) . | J = | . . | | . e(N-1)| | 0 ... ... 0 q(N) | which are less than or equal to a given bound THETA. This routine is intended to be called only by other SLICOT routines.Specification
INTEGER FUNCTION MB03ND( N, THETA, Q2, E2, PIVMIN, INFO ) C .. Scalar Arguments .. INTEGER INFO, N DOUBLE PRECISION PIVMIN, THETA C .. Array Arguments .. DOUBLE PRECISION E2(*), Q2(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the bidiagonal matrix J. N >= 0. THETA (input) DOUBLE PRECISION Given bound. Note: If THETA < 0.0 on entry, then MB03ND is set to 0 as the singular values of J are non-negative. Q2 (input) DOUBLE PRECISION array, dimension (N) This array must contain the squares of the diagonal elements q(1),q(2),...,q(N) of the bidiagonal matrix J. That is, Q2(i) = J(i,i)**2 for i = 1,2,...,N. E2 (input) DOUBLE PRECISION array, dimension (N-1) This array must contain the squares of the superdiagonal elements e(1),e(2),...,e(N-1) of the bidiagonal matrix J. That is, E2(k) = J(k,k+1)**2 for k = 1,2,...,N-1. PIVMIN (input) DOUBLE PRECISION The minimum absolute value of a "pivot" in the Sturm sequence loop. PIVMIN >= max( max( |q(i)|, |e(k)| )**2*sf_min, sf_min ), where i = 1,2,...,N, k = 1,2,...,N-1, and sf_min is at least the smallest number that can divide one without overflow (see LAPACK Library routine DLAMCH). Note that this condition is not checked by the routine.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The computation of the number of singular values s(i) of J which are less than or equal to THETA is based on applying Sylvester's Law of Inertia, or equivalently, Sturm sequences [1,p.52] to the unreduced symmetric tridiagonal matrices associated with J as follows. Let T be the following 2N-by-2N symmetric matrix associated with J: | 0 J'| T = | |. | J 0 | (The eigenvalues of T are given by s(1),s(2),...,s(N),-s(1),-s(2), ...,-s(N)). Then, by permuting the rows and columns of T into the order 1, N+1, 2, N+2, ..., N, 2N it follows that T is orthogonally similar to the tridiagonal matrix T" with zeros on its diagonal and q(1), e(1), q(2), e(2), ..., e(N-1), q(N) on its offdiagonals [3,4]. If q(1),q(2),...,q(N) and e(1),e(2),...,e(N-1) are nonzero, Sylvester's Law of Inertia may be applied directly to T". Otherwise, T" is block diagonal and each diagonal block (which is then unreduced) must be analysed separately by applying Sylvester's Law of Inertia.References
[1] Parlett, B.N. The Symmetric Eigenvalue Problem. Prentice Hall, Englewood Cliffs, New Jersey, 1980. [2] Demmel, J. and Kahan, W. Computing Small Singular Values of Bidiagonal Matrices with Guaranteed High Relative Accuracy. Technical Report, Courant Inst., New York, March 1988. [3] Van Huffel, S. and Vandewalle, J. The Partial Total Least-Squares Algorithm. J. Comput. and Appl. Math., 21, pp. 333-341, 1988. [4] Golub, G.H. and Kahan, W. Calculating the Singular Values and Pseudo-inverse of a Matrix. SIAM J. Numer. Anal., Ser. B, 2, pp. 205-224, 1965. [5] Demmel, J.W., Dhillon, I. and Ren, H. On the Correctness of Parallel Bisection in Floating Point. Computer Science Division Technical Report UCB//CSD-94-805, University of California, Berkeley, CA 94720, March 1994.Numerical Aspects
The singular values s(i) could also be obtained with the use of the symmetric tridiagonal matrix T = J'J, whose eigenvalues are the squared singular values of J [4,p.213]. However, the method actually used by the routine is more accurate and equally efficient (see [2]). To avoid overflow, matrix J should be scaled so that its largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value (and not much smaller than that, for maximal accuracy). With respect to accuracy the following condition holds (see [2]): If the established value is denoted by p, then at least p singular values of J are less than or equal to THETA/(1 - (3 x N - 1.5) x EPS) and no more than p singular values are less than or equal to THETA x (1 - (6 x N-2) x EPS)/(1 - (3 x N - 1.5) x EPS).Further Comments
NoneExample
Program Text
* MB03ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) * .. Local Scalars .. DOUBLE PRECISION PIVMIN, SAFMIN, THETA INTEGER I, INFO, N, NUMSV * .. Local Arrays .. DOUBLE PRECISION E(NMAX-1), E2(NMAX-1), Q(NMAX), Q2(NMAX) * .. External Functions .. DOUBLE PRECISION DLAMCH EXTERNAL DLAMCH * .. External Functions .. INTEGER MB03ND EXTERNAL MB03ND * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, THETA IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( Q(I), I = 1,N ) READ ( NIN, FMT = * ) ( E(I), I = 1,N-1 ) * Print out the bidiagonal matrix J. WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, N - 1 WRITE ( NOUT, FMT = 99996 ) I, I, Q(I), I, (I+1), E(I) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) N, N, Q(N) * Compute Q**2, E**2, and PIVMIN. Q2(N) = Q(N)**2 PIVMIN = Q2(N) DO 40 I = 1, N - 1 Q2(I) = Q(I)**2 E2(I) = E(I)**2 PIVMIN = MAX( PIVMIN, Q2(I), E2(I) ) 40 CONTINUE SAFMIN = DLAMCH( 'Safe minimum' ) PIVMIN = MAX( PIVMIN*SAFMIN, SAFMIN ) * Compute the number of singular values of J < = THETA. NUMSV = MB03ND( N, THETA, Q2, E2, PIVMIN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) NUMSV, THETA END IF END IF STOP * 99999 FORMAT (' MB03ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB03ND = ',I2) 99997 FORMAT (' The Bidiagonal Matrix J is',/) 99996 FORMAT (2(' (',I1,',',I1,') = ',F7.4,2X)) 99995 FORMAT (' (',I1,',',I1,') = ',F7.4) 99994 FORMAT (/' J has ',I2,' singular values < = ',F7.4) 99993 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB03ND EXAMPLE PROGRAM DATA 5 5.0 0.0 0.0 1.0 2.0 3.0 4.0 5.0 2.0 3.0 4.0 5.0Program Results
MB03ND EXAMPLE PROGRAM RESULTS The Bidiagonal Matrix J is (1,1) = 1.0000 (1,2) = 2.0000 (2,2) = 2.0000 (2,3) = 3.0000 (3,3) = 3.0000 (3,4) = 4.0000 (4,4) = 4.0000 (4,5) = 5.0000 (5,5) = 5.0000 J has 3 singular values < = 5.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03NY.html 0000664 0000000 0000000 00000007426 14560147231 0020373 0 ustar 00root root 0000000 0000000
Purpose
To compute the smallest singular value of A - jwI.Specification
DOUBLE PRECISION FUNCTION MB03NY( N, OMEGA, A, LDA, S, DWORK, $ LDWORK, CWORK, LCWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LCWORK, LDA, LDWORK, N DOUBLE PRECISION OMEGA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), S(*) COMPLEX*16 CWORK(*)Function Value
MB03NY DOUBLE PRECISION The smallest singular value of A - jwI (if INFO = 0). If N = 0, the function value is set to zero.Arguments
Input/Output Parameters
N (input) INTEGER The order of the the matrix A. N >= 0. OMEGA (input) DOUBLE PRECISION The constant factor of A - jwI. A (input/workspace) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the matrix A. On exit, if OMEGA = 0, the contents of this array are destroyed. Otherwise, this array is unchanged. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). S (output) DOUBLE PRECISION array, dimension (N) The singular values of A - jwI in decreasing order.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, 5*N ). For optimum performance LDWORK should be larger. CWORK COMPLEX*16 array, dimension (LCWORK) On exit, if INFO = 0 and OMEGA <> 0, CWORK(1) returns the optimal value of LCWORK. If OMEGA is zero, this array is not referenced. LCWORK INTEGER The length of the array CWORK. LCWORK >= 1, if OMEGA = 0; LCWORK >= MAX( 1, N*N+3*N ), if OMEGA <> 0. For optimum performance LCWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 2: The SVD algorithm (in either LAPACK Library routine DGESVD or ZGESVD) fails to converge; this error is very rare.Method
This procedure simply constructs the matrix A - jwI, and calls ZGESVD if w is not zero, or DGESVD if w = 0.Further Comments
This routine is not very efficient because it computes all singular values, but it is very accurate. The routine is intended to be called only from the SLICOT Library routine AB13FD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute (optionally) a rank-revealing QR factorization of a real general M-by-N matrix A, which may be rank-deficient, and estimate its effective rank using incremental condition estimation. The routine uses a QR factorization with column pivoting: A * P = Q * R, where R = [ R11 R12 ], [ 0 R22 ] with R11 defined as the largest leading submatrix whose estimated condition number is less than 1/RCOND. The order of R11, RANK, is the effective rank of A. MB03OD does not perform any scaling of the matrix A.Specification
SUBROUTINE MB03OD( JOBQR, M, N, A, LDA, JPVT, RCOND, SVLMAX, TAU, $ RANK, SVAL, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBQR INTEGER INFO, LDA, LDWORK, M, N, RANK DOUBLE PRECISION RCOND, SVLMAX C .. Array Arguments .. INTEGER JPVT( * ) DOUBLE PRECISION A( LDA, * ), SVAL( 3 ), TAU( * ), DWORK( * )Arguments
Mode Parameters
JOBQR CHARACTER*1 = 'Q': Perform a QR factorization with column pivoting; = 'N': Do not perform the QR factorization (but assume that it has been done outside).Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension ( LDA, N ) On entry with JOBQR = 'Q', the leading M by N part of this array must contain the given matrix A. On exit with JOBQR = 'Q', the leading min(M,N) by N upper triangular part of A contains the triangular factor R, and the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(M,N) elementary reflectors. On entry and on exit with JOBQR = 'N', the leading min(M,N) by N upper triangular part of A contains the triangular factor R, as determined by the QR factorization with pivoting. The elements below the diagonal of A are not referenced. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). JPVT (input/output) INTEGER array, dimension ( N ) On entry with JOBQR = 'Q', if JPVT(i) <> 0, the i-th column of A is an initial column, otherwise it is a free column. Before the QR factorization of A, all initial columns are permuted to the leading positions; only the remaining free columns are moved as a result of column pivoting during the factorization. For rank determination it is preferable that all columns be free. On exit with JOBQR = 'Q', if JPVT(i) = k, then the i-th column of A*P was the k-th column of A. Array JPVT is not referenced when JOBQR = 'N'. RCOND (input) DOUBLE PRECISION RCOND is used to determine the effective rank of A, which is defined as the order of the largest leading triangular submatrix R11 in the QR factorization with pivoting of A, whose estimated condition number is less than 1/RCOND. RCOND >= 0. NOTE that when SVLMAX > 0, the estimated rank could be less than that defined above (see SVLMAX). SVLMAX (input) DOUBLE PRECISION If A is a submatrix of another matrix B, and the rank decision should be related to that matrix, then SVLMAX should be an estimate of the largest singular value of B (for instance, the Frobenius norm of B). If this is not the case, the input value SVLMAX = 0 should work. SVLMAX >= 0. TAU (output) DOUBLE PRECISION array, dimension ( MIN( M, N ) ) On exit with JOBQR = 'Q', the leading min(M,N) elements of TAU contain the scalar factors of the elementary reflectors. Array TAU is not referenced when JOBQR = 'N'. RANK (output) INTEGER The effective (estimated) rank of A, i.e. the order of the submatrix R11. SVAL (output) DOUBLE PRECISION array, dimension ( 3 ) The estimates of some of the singular values of the triangular factor R: SVAL(1): largest singular value of R(1:RANK,1:RANK); SVAL(2): smallest singular value of R(1:RANK,1:RANK); SVAL(3): smallest singular value of R(1:RANK+1,1:RANK+1), if RANK < MIN( M, N ), or of R(1:RANK,1:RANK), otherwise. If the triangular factorization is a rank-revealing one (which will be the case if the leading columns were well- conditioned), then SVAL(1) will also be an estimate for the largest singular value of A, and SVAL(2) and SVAL(3) will be estimates for the RANK-th and (RANK+1)-st singular values of A, respectively. By examining these values, one can confirm that the rank is well defined with respect to the chosen value of RCOND. The ratio SVAL(1)/SVAL(2) is an estimate of the condition number of R(1:RANK,1:RANK).Workspace
DWORK DOUBLE PRECISION array, dimension ( LDWORK ) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 3*N + 1, if JOBQR = 'Q'; LDWORK >= max( 1, 2*min( M, N ) ), if JOBQR = 'N'. For good performance when JOBQR = 'Q', LDWORK should be larger. Specifically, LDWORK >= 2*N + ( N + 1 )*NB, where NB is the optimal block size for the LAPACK Library routine DGEQP3. 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.Error Indicator
INFO INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes or uses a QR factorization with column pivoting of A, A * P = Q * R, with R defined above, and then finds the largest leading submatrix whose estimated condition number is less than 1/RCOND, taking the possible positive value of SVLMAX into account. This is performed using the LAPACK incremental condition estimation scheme and a slightly modified rank decision test.Further Comments
NoneExample
Program Text
* MB03OD 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, MMAX PARAMETER ( NMAX = 10, MMAX = 10 ) INTEGER LDA PARAMETER ( LDA = NMAX ) INTEGER LDTAU PARAMETER ( LDTAU = MIN(MMAX,NMAX) ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX + 1 ) * .. Local Scalars .. CHARACTER*1 JOBQR INTEGER I, INFO, J, M, N, RANK DOUBLE PRECISION RCOND, SVAL(3), SVLMAX * .. * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), TAU(LDTAU) INTEGER JPVT(NMAX) * .. External Subroutines .. EXTERNAL MB03OD * .. Intrinsic Functions .. INTRINSIC MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, JOBQR, RCOND, SVLMAX IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99972 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99971 ) M ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,M ) * QR with column pivoting. DO 10 I = 1, N JPVT(I) = 0 10 CONTINUE CALL MB03OD( JOBQR, M, N, A, LDA, JPVT, RCOND, SVLMAX, TAU, $ RANK, SVAL, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99995 ) RANK WRITE ( NOUT, FMT = 99994 ) ( JPVT(I), I = 1,N ) WRITE ( NOUT, FMT = 99993 ) ( SVAL(I), I = 1,3 ) END IF END IF END IF * STOP * 99999 FORMAT (' MB03OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB03OD = ',I2) 99995 FORMAT (' The rank is ',I5) 99994 FORMAT (' Column permutations are ',/(20(I3,2X))) 99993 FORMAT (' SVAL vector is ',/(20(1X,F10.4))) 99972 FORMAT (/' N is out of range.',/' N = ',I5) 99971 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
MB03OD EXAMPLE PROGRAM DATA 6 5 Q 5.D-16 0.0 1. 2. 6. 3. 5. -2. -1. -1. 0. -2. 5. 5. 1. 5. 1. -2. -1. -1. 0. -2. 4. 8. 4. 20. 4. -2. -1. -1. 0. -2.Program Results
MB03OD EXAMPLE PROGRAM RESULTS The rank is 4 Column permutations are 4 3 1 5 2 SVAL vector is 22.7257 1.4330 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03OY.html 0000664 0000000 0000000 00000016610 14560147231 0020367 0 ustar 00root root 0000000 0000000
Purpose
To compute a rank-revealing QR factorization of a real general M-by-N matrix A, which may be rank-deficient, and estimate its effective rank using incremental condition estimation. The routine uses a truncated QR factorization with column pivoting [ R11 R12 ] A * P = Q * R, where R = [ ], [ 0 R22 ] with R11 defined as the largest leading upper triangular submatrix whose estimated condition number is less than 1/RCOND. The order of R11, RANK, is the effective rank of A. Condition estimation is performed during the QR factorization process. Matrix R22 is full (but of small norm), or empty. MB03OY does not perform any scaling of the matrix A.Specification
SUBROUTINE MB03OY( M, N, A, LDA, RCOND, SVLMAX, RANK, SVAL, JPVT, $ TAU, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, M, N, RANK DOUBLE PRECISION RCOND, SVLMAX C .. Array Arguments .. INTEGER JPVT( * ) DOUBLE PRECISION A( LDA, * ), DWORK( * ), SVAL( 3 ), TAU( * )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension ( LDA, N ) On entry, the leading M-by-N part of this array must contain the given matrix A. On exit, the leading RANK-by-RANK upper triangular part of A contains the triangular factor R11, and the elements below the diagonal in the first RANK columns, with the array TAU, represent the orthogonal matrix Q as a product of RANK elementary reflectors. The remaining N-RANK columns contain the result of the QR factorization process used. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). RCOND (input) DOUBLE PRECISION RCOND is used to determine the effective rank of A, which is defined as the order of the largest leading triangular submatrix R11 in the QR factorization with pivoting of A, whose estimated condition number is less than 1/RCOND. 0 <= RCOND <= 1. NOTE that when SVLMAX > 0, the estimated rank could be less than that defined above (see SVLMAX). SVLMAX (input) DOUBLE PRECISION If A is a submatrix of another matrix B, and the rank decision should be related to that matrix, then SVLMAX should be an estimate of the largest singular value of B (for instance, the Frobenius norm of B). If this is not the case, the input value SVLMAX = 0 should work. SVLMAX >= 0. RANK (output) INTEGER The effective (estimated) rank of A, i.e., the order of the submatrix R11. SVAL (output) DOUBLE PRECISION array, dimension ( 3 ) The estimates of some of the singular values of the triangular factor R: SVAL(1): largest singular value of R(1:RANK,1:RANK); SVAL(2): smallest singular value of R(1:RANK,1:RANK); SVAL(3): smallest singular value of R(1:RANK+1,1:RANK+1), if RANK < MIN( M, N ), or of R(1:RANK,1:RANK), otherwise. If the triangular factorization is a rank-revealing one (which will be the case if the leading columns were well- conditioned), then SVAL(1) will also be an estimate for the largest singular value of A, and SVAL(2) and SVAL(3) will be estimates for the RANK-th and (RANK+1)-st singular values of A, respectively. By examining these values, one can confirm that the rank is well defined with respect to the chosen value of RCOND. The ratio SVAL(1)/SVAL(2) is an estimate of the condition number of R(1:RANK,1:RANK). JPVT (output) INTEGER array, dimension ( N ) If JPVT(i) = k, then the i-th column of A*P was the k-th column of A. TAU (output) DOUBLE PRECISION array, dimension ( MIN( M, N ) ) The leading RANK elements of TAU contain the scalar factors of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension ( 3*N-1 )Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes a truncated QR factorization with column pivoting of A, A * P = Q * R, with R defined above, and, during this process, finds the largest leading submatrix whose estimated condition number is less than 1/RCOND, taking the possible positive value of SVLMAX into account. This is performed using the LAPACK incremental condition estimation scheme and a slightly modified rank decision test. The factorization process stops when RANK has been determined. The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = rank <= min(m,n). Each H(i) has the form H = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i). The matrix P is represented in jpvt as follows: If jpvt(j) = i then the jth column of P is the ith canonical unit vector.References
[1] Bischof, C.H. and P. Tang. Generalizing Incremental Condition Estimation. LAPACK Working Notes 32, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-132, May 1991. [2] Bischof, C.H. and P. Tang. Robust Incremental Condition Estimation. LAPACK Working Notes 33, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-133, May 1991.Numerical Aspects
The algorithm is backward stable.Further Comments
For a matrix with a small norm, the rank is set to zero if the largest column Euclidean norm is smaller than or equal to RCOND.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute (optionally) a rank-revealing RQ factorization of a real general M-by-N matrix A, which may be rank-deficient, and estimate its effective rank using incremental condition estimation. The routine uses an RQ factorization with row pivoting: P * A = R * Q, where R = [ R11 R12 ], [ 0 R22 ] with R22 defined as the largest trailing submatrix whose estimated condition number is less than 1/RCOND. The order of R22, RANK, is the effective rank of A. MB03PD does not perform any scaling of the matrix A.Specification
SUBROUTINE MB03PD( JOBRQ, M, N, A, LDA, JPVT, RCOND, SVLMAX, TAU, $ RANK, SVAL, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBRQ INTEGER INFO, LDA, M, N, RANK DOUBLE PRECISION RCOND, SVLMAX C .. Array Arguments .. INTEGER JPVT( * ) DOUBLE PRECISION A( LDA, * ), SVAL( 3 ), TAU( * ), DWORK( * )Arguments
Mode Parameters
JOBRQ CHARACTER*1 = 'R': Perform an RQ factorization with row pivoting; = 'N': Do not perform the RQ factorization (but assume that it has been done outside).Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension ( LDA, N ) On entry with JOBRQ = 'R', the leading M-by-N part of this array must contain the given matrix A. On exit with JOBRQ = 'R', if M <= N, the upper triangle of the subarray A(1:M,N-M+1:N) contains the M-by-M upper triangular matrix R; if M >= N, the elements on and above the (M-N)-th subdiagonal contain the M-by-N upper trapezoidal matrix R; the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of min(M,N) elementary reflectors (see METHOD). On entry and on exit with JOBRQ = 'N', if M <= N, the upper triangle of the subarray A(1:M,N-M+1:N) must contain the M-by-M upper triangular matrix R; if M >= N, the elements on and above the (M-N)-th subdiagonal must contain the M-by-N upper trapezoidal matrix R; the remaining elements are not referenced. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). JPVT (input/output) INTEGER array, dimension ( M ) On entry with JOBRQ = 'R', if JPVT(i) <> 0, the i-th row of A is a final row, otherwise it is a free row. Before the RQ factorization of A, all final rows are permuted to the trailing positions; only the remaining free rows are moved as a result of row pivoting during the factorization. For rank determination it is preferable that all rows be free. On exit with JOBRQ = 'R', if JPVT(i) = k, then the i-th row of P*A was the k-th row of A. Array JPVT is not referenced when JOBRQ = 'N'. RCOND (input) DOUBLE PRECISION RCOND is used to determine the effective rank of A, which is defined as the order of the largest trailing triangular submatrix R22 in the RQ factorization with pivoting of A, whose estimated condition number is less than 1/RCOND. RCOND >= 0. NOTE that when SVLMAX > 0, the estimated rank could be less than that defined above (see SVLMAX). SVLMAX (input) DOUBLE PRECISION If A is a submatrix of another matrix B, and the rank decision should be related to that matrix, then SVLMAX should be an estimate of the largest singular value of B (for instance, the Frobenius norm of B). If this is not the case, the input value SVLMAX = 0 should work. SVLMAX >= 0. TAU (output) DOUBLE PRECISION array, dimension ( MIN( M, N ) ) On exit with JOBRQ = 'R', the leading min(M,N) elements of TAU contain the scalar factors of the elementary reflectors. Array TAU is not referenced when JOBRQ = 'N'. RANK (output) INTEGER The effective (estimated) rank of A, i.e. the order of the submatrix R22. SVAL (output) DOUBLE PRECISION array, dimension ( 3 ) The estimates of some of the singular values of the triangular factor R: SVAL(1): largest singular value of R(M-RANK+1:M,N-RANK+1:N); SVAL(2): smallest singular value of R(M-RANK+1:M,N-RANK+1:N); SVAL(3): smallest singular value of R(M-RANK:M,N-RANK:N), if RANK < MIN( M, N ), or of R(M-RANK+1:M,N-RANK+1:N), otherwise. If the triangular factorization is a rank-revealing one (which will be the case if the trailing rows were well- conditioned), then SVAL(1) will also be an estimate for the largest singular value of A, and SVAL(2) and SVAL(3) will be estimates for the RANK-th and (RANK+1)-st singular values of A, respectively. By examining these values, one can confirm that the rank is well defined with respect to the chosen value of RCOND. The ratio SVAL(1)/SVAL(2) is an estimate of the condition number of R(M-RANK+1:M,N-RANK+1:N).Workspace
DWORK DOUBLE PRECISION array, dimension ( LDWORK ) where LDWORK = max( 1, 3*M ), if JOBRQ = 'R'; LDWORK = max( 1, 3*min( M, N ) ), if JOBRQ = 'N'.Error Indicator
INFO INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes or uses an RQ factorization with row pivoting of A, P * A = R * Q, with R defined above, and then finds the largest trailing submatrix whose estimated condition number is less than 1/RCOND, taking the possible positive value of SVLMAX into account. This is performed using an adaptation of the LAPACK incremental condition estimation scheme and a slightly modified rank decision test. The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n). Each H(i) has the form H = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(n-k+i+1:n) = 0 and v(n-k+i) = 1; v(1:n-k+i-1) is stored on exit in A(m-k+i,1:n-k+i-1), and tau in TAU(i). The matrix P is represented in jpvt as follows: If jpvt(j) = i then the jth row of P is the ith canonical unit vector.References
[1] Bischof, C.H. and P. Tang. Generalizing Incremental Condition Estimation. LAPACK Working Notes 32, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-132, May 1991. [2] Bischof, C.H. and P. Tang. Robust Incremental Condition Estimation. LAPACK Working Notes 33, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-133, May 1991.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
* MB03PD 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, MMAX PARAMETER ( NMAX = 10, MMAX = 10 ) INTEGER LDA PARAMETER ( LDA = NMAX ) INTEGER LDTAU PARAMETER ( LDTAU = MIN(MMAX,NMAX) ) INTEGER LDWORK PARAMETER ( LDWORK = 3*MMAX ) * .. Local Scalars .. CHARACTER*1 JOBRQ INTEGER I, INFO, J, M, N, RANK DOUBLE PRECISION RCOND, SVAL(3), SVLMAX * .. * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), TAU(LDTAU) INTEGER JPVT(MMAX) * .. External Subroutines .. EXTERNAL MB03PD * .. Intrinsic Functions .. INTRINSIC MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, JOBRQ, RCOND, SVLMAX IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99972 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99971 ) M ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,M ) * RQ with row pivoting. DO 10 I = 1, M JPVT(I) = 0 10 CONTINUE CALL MB03PD( JOBRQ, M, N, A, LDA, JPVT, RCOND, SVLMAX, TAU, $ RANK, SVAL, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99995 ) RANK WRITE ( NOUT, FMT = 99994 ) ( JPVT(I), I = 1,M ) WRITE ( NOUT, FMT = 99993 ) ( SVAL(I), I = 1,3 ) END IF END IF END IF * STOP * 99999 FORMAT (' MB03PD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB03PD = ',I2) 99995 FORMAT (' The rank is ',I5) 99994 FORMAT (' Row permutations are ',/(20(I3,2X))) 99993 FORMAT (' SVAL vector is ',/(20(1X,F10.4))) 99972 FORMAT (/' N is out of range.',/' N = ',I5) 99971 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
MB03PD EXAMPLE PROGRAM DATA 6 5 R 5.D-16 0.0 1. 2. 6. 3. 5. -2. -1. -1. 0. -2. 5. 5. 1. 5. 1. -2. -1. -1. 0. -2. 4. 8. 4. 20. 4. -2. -1. -1. 0. -2.Program Results
MB03PD EXAMPLE PROGRAM RESULTS The rank is 4 Row permutations are 2 4 6 3 1 5 SVAL vector is 24.5744 0.9580 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03PY.html 0000664 0000000 0000000 00000016613 14560147231 0020373 0 ustar 00root root 0000000 0000000
Purpose
To compute a rank-revealing RQ factorization of a real general M-by-N matrix A, which may be rank-deficient, and estimate its effective rank using incremental condition estimation. The routine uses a truncated RQ factorization with row pivoting: [ R11 R12 ] P * A = R * Q, where R = [ ], [ 0 R22 ] with R22 defined as the largest trailing upper triangular submatrix whose estimated condition number is less than 1/RCOND. The order of R22, RANK, is the effective rank of A. Condition estimation is performed during the RQ factorization process. Matrix R11 is full (but of small norm), or empty. MB03PY does not perform any scaling of the matrix A.Specification
SUBROUTINE MB03PY( M, N, A, LDA, RCOND, SVLMAX, RANK, SVAL, JPVT, $ TAU, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, M, N, RANK DOUBLE PRECISION RCOND, SVLMAX C .. Array Arguments .. INTEGER JPVT( * ) DOUBLE PRECISION A( LDA, * ), DWORK( * ), SVAL( 3 ), TAU( * )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension ( LDA, N ) On entry, the leading M-by-N part of this array must contain the given matrix A. On exit, the upper triangle of the subarray A(M-RANK+1:M,N-RANK+1:N) contains the RANK-by-RANK upper triangular matrix R22; the remaining elements in the last RANK rows, with the array TAU, represent the orthogonal matrix Q as a product of RANK elementary reflectors (see METHOD). The first M-RANK rows contain the result of the RQ factorization process used. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). RCOND (input) DOUBLE PRECISION RCOND is used to determine the effective rank of A, which is defined as the order of the largest trailing triangular submatrix R22 in the RQ factorization with pivoting of A, whose estimated condition number is less than 1/RCOND. 0 <= RCOND <= 1. NOTE that when SVLMAX > 0, the estimated rank could be less than that defined above (see SVLMAX). SVLMAX (input) DOUBLE PRECISION If A is a submatrix of another matrix B, and the rank decision should be related to that matrix, then SVLMAX should be an estimate of the largest singular value of B (for instance, the Frobenius norm of B). If this is not the case, the input value SVLMAX = 0 should work. SVLMAX >= 0. RANK (output) INTEGER The effective (estimated) rank of A, i.e., the order of the submatrix R22. SVAL (output) DOUBLE PRECISION array, dimension ( 3 ) The estimates of some of the singular values of the triangular factor R: SVAL(1): largest singular value of R(M-RANK+1:M,N-RANK+1:N); SVAL(2): smallest singular value of R(M-RANK+1:M,N-RANK+1:N); SVAL(3): smallest singular value of R(M-RANK:M,N-RANK:N), if RANK < MIN( M, N ), or of R(M-RANK+1:M,N-RANK+1:N), otherwise. If the triangular factorization is a rank-revealing one (which will be the case if the trailing rows were well- conditioned), then SVAL(1) will also be an estimate for the largest singular value of A, and SVAL(2) and SVAL(3) will be estimates for the RANK-th and (RANK+1)-st singular values of A, respectively. By examining these values, one can confirm that the rank is well defined with respect to the chosen value of RCOND. The ratio SVAL(1)/SVAL(2) is an estimate of the condition number of R(M-RANK+1:M,N-RANK+1:N). JPVT (output) INTEGER array, dimension ( M ) If JPVT(i) = k, then the i-th row of P*A was the k-th row of A. TAU (output) DOUBLE PRECISION array, dimension ( MIN( M, N ) ) The trailing RANK elements of TAU contain the scalar factors of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension ( 3*M-1 )Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes a truncated RQ factorization with row pivoting of A, P * A = R * Q, with R defined above, and, during this process, finds the largest trailing submatrix whose estimated condition number is less than 1/RCOND, taking the possible positive value of SVLMAX into account. This is performed using an adaptation of the LAPACK incremental condition estimation scheme and a slightly modified rank decision test. The factorization process stops when RANK has been determined. The matrix Q is represented as a product of elementary reflectors Q = H(k-rank+1) H(k-rank+2) . . . H(k), where k = min(m,n). Each H(i) has the form H = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(n-k+i+1:n) = 0 and v(n-k+i) = 1; v(1:n-k+i-1) is stored on exit in A(m-k+i,1:n-k+i-1), and tau in TAU(i). The matrix P is represented in jpvt as follows: If jpvt(j) = i then the jth row of P is the ith canonical unit vector.References
[1] Bischof, C.H. and P. Tang. Generalizing Incremental Condition Estimation. LAPACK Working Notes 32, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-132, May 1991. [2] Bischof, C.H. and P. Tang. Robust Incremental Condition Estimation. LAPACK Working Notes 33, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-133, May 1991.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reorder the diagonal blocks of a principal submatrix of an upper quasi-triangular matrix A together with their eigenvalues by constructing an orthogonal similarity transformation UT. After reordering, the leading block of the selected submatrix of A has eigenvalues in a suitably defined domain of interest, usually related to stability/instability in a continuous- or discrete-time sense.Specification
SUBROUTINE MB03QD( DICO, STDOM, JOBU, N, NLOW, NSUP, ALPHA, $ A, LDA, U, LDU, NDIM, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBU, STDOM INTEGER INFO, LDA, LDU, N, NDIM, NLOW, NSUP DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), U(LDU,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the spectrum separation to be performed as follows: = 'C': continuous-time sense; = 'D': discrete-time sense. STDOM CHARACTER*1 Specifies whether the domain of interest is of stability type (left part of complex plane or inside of a circle) or of instability type (right part of complex plane or outside of a circle) as follows: = 'S': stability type domain; = 'U': instability type domain. JOBU CHARACTER*1 Indicates how the performed orthogonal transformations UT are accumulated, as follows: = 'I': U is initialized to the unit matrix and the matrix UT is returned in U; = 'U': the given matrix U is updated and the matrix U*UT is returned in U.Input/Output Parameters
N (input) INTEGER The order of the matrices A and U. N >= 1. NLOW, (input) INTEGER NSUP NLOW and NSUP specify the boundary indices for the rows and columns of the principal submatrix of A whose diagonal blocks are to be reordered. 1 <= NLOW <= NSUP <= N. ALPHA (input) DOUBLE PRECISION The boundary of the domain of interest for the eigenvalues of A. If DICO = 'C', ALPHA is the boundary value for the real parts of eigenvalues, while for DICO = 'D', ALPHA >= 0 represents the boundary value for the moduli of eigenvalues. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain a matrix in a real Schur form whose 1-by-1 and 2-by-2 diagonal blocks between positions NLOW and NSUP are to be reordered. On exit, the leading N-by-N part contains the ordered real Schur matrix UT' * A * UT with the elements below the first subdiagonal set to zero. The leading NDIM-by-NDIM part of the principal submatrix D = A(NLOW:NSUP,NLOW:NSUP) has eigenvalues in the domain of interest and the trailing part of this submatrix has eigenvalues outside the domain of interest. The domain of interest for lambda(D), the eigenvalues of D, is defined by the parameters ALPHA, DICO and STDOM as follows: For DICO = 'C': Real(lambda(D)) < ALPHA if STDOM = 'S'; Real(lambda(D)) > ALPHA if STDOM = 'U'. For DICO = 'D': Abs(lambda(D)) < ALPHA if STDOM = 'S'; Abs(lambda(D)) > ALPHA if STDOM = 'U'. LDA INTEGER The leading dimension of array A. LDA >= N. U (input/output) DOUBLE PRECISION array, dimension (LDU,N) On entry with JOBU = 'U', the leading N-by-N part of this array must contain a transformation matrix (e.g. from a previous call to this routine). On exit, if JOBU = 'U', the leading N-by-N part of this array contains the product of the input matrix U and the orthogonal matrix UT used to reorder the diagonal blocks of A. On exit, if JOBU = 'I', the leading N-by-N part of this array contains the matrix UT of the performed orthogonal transformations. Array U need not be set on entry if JOBU = 'I'. LDU INTEGER The leading dimension of array U. LDU >= N. NDIM (output) INTEGER The number of eigenvalues of the selected principal submatrix lying inside the domain of interest. If NLOW = 1, NDIM is also the dimension of the invariant subspace corresponding to the eigenvalues of the leading NDIM-by-NDIM submatrix. In this case, if U is the orthogonal transformation matrix used to compute and reorder the real Schur form of A, its first NDIM columns form an orthonormal basis for the above invariant subspace.Workspace
DWORK DOUBLE PRECISION array, dimension (N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: A(NLOW,NLOW-1) is nonzero, i.e. A(NLOW,NLOW) is not the leading element of a 1-by-1 or 2-by-2 diagonal block of A, or A(NSUP+1,NSUP) is nonzero, i.e. A(NSUP,NSUP) is not the bottom element of a 1-by-1 or 2-by-2 diagonal block of A; = 2: two adjacent blocks are too close to swap (the problem is very ill-conditioned).Method
Given an upper quasi-triangular matrix A with 1-by-1 or 2-by-2 diagonal blocks, the routine reorders its diagonal blocks along with its eigenvalues by performing an orthogonal similarity transformation UT' * A * UT. The column transformation UT is also performed on the given (initial) transformation U (resulted from a possible previous step or initialized as the identity matrix). After reordering, the eigenvalues inside the region specified by the parameters ALPHA, DICO and STDOM appear at the top of the selected diagonal block between positions NLOW and NSUP. In other words, lambda(A(NLOW:NSUP,NLOW:NSUP)) are ordered such that lambda(A(NLOW:NLOW+NDIM-1,NLOW:NLOW+NDIM-1)) are inside and lambda(A(NLOW+NDIM:NSUP,NLOW+NDIM:NSUP)) are outside the domain of interest. If NLOW = 1, the first NDIM columns of U*UT span the corresponding invariant subspace of A.References
[1] Stewart, G.W. HQR3 and EXCHQZ: FORTRAN subroutines for calculating and ordering the eigenvalues of a real upper Hessenberg matrix. ACM TOMS, 2, pp. 275-280, 1976.Numerical Aspects
3 The algorithm requires less than 4*N operations.Further Comments
NoneExample
Program Text
* MB03QD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 10 ) INTEGER LDA, LDU PARAMETER ( LDA = NMAX, LDU = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX ) * .. Local Scalars .. CHARACTER*1 DICO, JOBU, STDOM INTEGER I, INFO, J, N, NDIM, NLOW, NSUP DOUBLE PRECISION ALPHA * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), U(LDU,NMAX), $ WI(NMAX), WR(NMAX) LOGICAL BWORK(NMAX) * .. External Functions .. LOGICAL SELECT * .. External Subroutines .. EXTERNAL DGEES, MB03QD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, NLOW, NSUP, ALPHA, DICO, STDOM, JOBU IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) * Compute Schur form, eigenvalues and Schur vectors. CALL DGEES( 'Vectors', 'Not sorted', SELECT, N, A, LDA, NDIM, $ WR, WI, U, LDU, DWORK, LDWORK, BWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE * Block reordering. CALL MB03QD( DICO, STDOM, JOBU, N, NLOW, NSUP, ALPHA, $ A, LDA, U, LDU, NDIM, DWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) NDIM WRITE ( NOUT, FMT = 99994 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( U(I,J), J = 1,N ) 20 CONTINUE END IF END IF END IF * STOP * 99999 FORMAT (' MB03QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DGEES = ',I2) 99997 FORMAT (' INFO on exit from MB03QD = ',I2) 99996 FORMAT (' The number of eigenvalues in the domain is ',I5) 99995 FORMAT (8X,20(1X,F8.4)) 99994 FORMAT (/' The ordered Schur form matrix is ') 99993 FORMAT (/' The transformation matrix is ') 99992 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB03QD EXAMPLE PROGRAM DATA 4 1 4 0.0 C S U -1.0 37.0 -12.0 -12.0 -1.0 -10.0 0.0 4.0 2.0 -4.0 7.0 -6.0 2.0 2.0 7.0 -9.0Program Results
MB03QD EXAMPLE PROGRAM RESULTS The number of eigenvalues in the domain is 4 The ordered Schur form matrix is -3.1300 -26.5066 27.2262 -16.2009 0.9070 -3.1300 13.6254 8.9206 0.0000 0.0000 -3.3700 0.3419 0.0000 0.0000 -1.7879 -3.3700 The transformation matrix is 0.9611 0.1784 0.2064 -0.0440 -0.1468 -0.2704 0.8116 -0.4965 -0.2224 0.7675 0.4555 0.3924 -0.0733 0.5531 -0.3018 -0.7730
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03QG.html 0000664 0000000 0000000 00000036570 14560147231 0020356 0 ustar 00root root 0000000 0000000
Purpose
To reorder the diagonal blocks of a principal subpencil of an upper quasi-triangular matrix pencil A-lambda*E together with their generalized eigenvalues, by constructing orthogonal similarity transformations UT and VT. After reordering, the leading block of the selected subpencil of A-lambda*E has generalized eigenvalues in a suitably defined domain of interest, usually related to stability/instability in a continuous- or discrete-time sense.Specification
SUBROUTINE MB03QG( DICO, STDOM, JOBU, JOBV, N, NLOW, NSUP, ALPHA, $ A, LDA, E, LDE, U, LDU, V, LDV, NDIM, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBU, JOBV, STDOM INTEGER INFO, LDA, LDE, LDU, LDV, LDWORK, N, NDIM, NLOW, $ NSUP DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), E(LDE,*), U(LDU,*), V(LDV,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the spectrum separation to be performed, as follows: = 'C': continuous-time sense; = 'D': discrete-time sense. STDOM CHARACTER*1 Specifies whether the domain of interest is of stability type (left part of complex plane or inside of a circle) or of instability type (right part of complex plane or outside of a circle), as follows: = 'S': stability type domain; = 'U': instability type domain. JOBU CHARACTER*1 Indicates how the performed orthogonal transformations UT are accumulated, as follows: = 'I': U is initialized to the unit matrix and the matrix UT is returned in U; = 'U': the given matrix U is updated and the matrix U*UT is returned in U. JOBV CHARACTER*1 Indicates how the performed orthogonal transformations VT are accumulated, as follows: = 'I': V is initialized to the unit matrix and the matrix VT is returned in V; = 'U': the given matrix V is updated and the matrix V*VT is returned in V.Input/Output Parameters
N (input) INTEGER The order of the matrices A, E, U, and V. N >= 0. NLOW, (input) INTEGER NSUP (input) INTEGER NLOW and NSUP specify the boundary indices for the rows and columns of the principal subpencil of A - lambda*E whose diagonal blocks are to be reordered. 0 <= NLOW <= NSUP <= N. ALPHA (input) DOUBLE PRECISION The boundary of the domain of interest for the eigenvalues of A. If DICO = 'C', ALPHA is the boundary value for the real parts of the generalized eigenvalues, while for DICO = 'D', ALPHA >= 0 represents the boundary value for the moduli of the generalized eigenvalues. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain a matrix in a real Schur form whose 1-by-1 and 2-by-2 diagonal blocks between positions NLOW and NSUP are to be reordered. On exit, the leading N-by-N part of this array contains a real Schur matrix UT' * A * VT, with the elements below the first subdiagonal set to zero. The leading NDIM-by-NDIM part of the principal subpencil B - lambda*C, defined with B := A(NLOW:NSUP,NLOW:NSUP), C := E(NLOW:NSUP,NLOW:NSUP), has generalized eigenvalues in the domain of interest and the trailing part of this subpencil has generalized eigenvalues outside the domain of interest. The domain of interest for eig(B,C), the generalized eigenvalues of the pair (B,C), is defined by the parameters ALPHA, DICO and STDOM as follows: For DICO = 'C': Real(eig(B,C)) < ALPHA if STDOM = 'S'; Real(eig(B,C)) > ALPHA if STDOM = 'U'. For DICO = 'D': Abs(eig(B,C)) < ALPHA if STDOM = 'S'; Abs(eig(B,C)) > ALPHA if STDOM = 'U'. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain a matrix in an upper triangular form. On exit, the leading N-by-N part of this array contains an upper triangular matrix UT' * E * VT, with the elements below the diagonal set to zero. The leading NDIM-by-NDIM part of the principal subpencil B - lambda*C, defined with B := A(NLOW:NSUP,NLOW:NSUP) C := E(NLOW:NSUP,NLOW:NSUP) has generalized eigenvalues in the domain of interest and the trailing part of this subpencil has generalized eigenvalues outside the domain of interest (see description of A). LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). U (input/output) DOUBLE PRECISION array, dimension (LDU,N) On entry with JOBU = 'U', the leading N-by-N part of this array must contain a transformation matrix (e.g., from a previous call to this routine). On exit, if JOBU = 'U', the leading N-by-N part of this array contains the product of the input matrix U and the orthogonal matrix UT used to reorder the diagonal blocks of A - lambda*E. On exit, if JOBU = 'I', the leading N-by-N part of this array contains the matrix UT of the performed orthogonal transformations. Array U need not be set on entry if JOBU = 'I'. LDU INTEGER The leading dimension of the array U. LDU >= MAX(1,N). V (input/output) DOUBLE PRECISION array, dimension (LDV,N) On entry with JOBV = 'U', the leading N-by-N part of this array must contain a transformation matrix (e.g., from a previous call to this routine). On exit, if JOBV = 'U', the leading N-by-N part of this array contains the product of the input matrix V and the orthogonal matrix VT used to reorder the diagonal blocks of A - lambda*E. On exit, if JOBV = 'I', the leading N-by-N part of this array contains the matrix VT of the performed orthogonal transformations. Array V need not be set on entry if JOBV = 'I'. LDV INTEGER The leading dimension of the array V. LDV >= MAX(1,N). NDIM (output) INTEGER The number of generalized eigenvalues of the selected principal subpencil lying inside the domain of interest. If NLOW = 1, NDIM is also the dimension of the deflating subspace corresponding to the generalized eigenvalues of the leading NDIM-by-NDIM subpencil. In this case, if U and V are the orthogonal transformation matrices used to compute and reorder the generalized real Schur form of the pair (A,E), then the first NDIM columns of V form an orthonormal basis for the above deflating subspace.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, and if N > 1, LDWORK >= 4*N + 16. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: A(NLOW,NLOW-1) is nonzero, i.e., A(NLOW,NLOW) is not the leading element of a 1-by-1 or 2-by-2 diagonal block of A, or A(NSUP+1,NSUP) is nonzero, i.e., A(NSUP,NSUP) is not the bottom element of a 1-by-1 or 2-by-2 diagonal block of A; = 2: two adjacent blocks are too close to swap (the problem is very ill-conditioned).Method
Given an upper quasi-triangular matrix pencil A - lambda*E with 1-by-1 or 2-by-2 diagonal blocks, the routine reorders its diagonal blocks along with its eigenvalues by performing an orthogonal equivalence transformation UT'*(A - lambda*E)* VT. The column transformations UT and VT are also performed on the given (initial) transformations U and V (resulted from a possible previous step or initialized as identity matrices). After reordering, the generalized eigenvalues inside the region specified by the parameters ALPHA, DICO and STDOM appear at the top of the selected diagonal subpencil between positions NLOW and NSUP. In other words, lambda(A(Select,Select),E(Select,Select)) are ordered such that lambda(A(Inside,Inside),E(Inside,Inside)) are inside, and lambda(A(Outside,Outside),E(Outside,Outside)) are outside the domain of interest, where Select = NLOW:NSUP, Inside = NLOW:NLOW+NDIM-1, and Outside = NLOW+NDIM:NSUP. If NLOW = 1, the first NDIM columns of V*VT span the corresponding right deflating subspace of (A,E).References
[1] Stewart, G.W. HQR3 and EXCHQZ: FORTRAN subroutines for calculating and ordering the eigenvalues of a real upper Hessenberg matrix. ACM TOMS, 2, pp. 275-280, 1976.Numerical Aspects
3 The algorithm requires less than 4*N operations.Further Comments
NoneExample
Program Text
* MB03QG EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 10 ) INTEGER LDA, LDE, LDU, LDV PARAMETER ( LDA = NMAX, LDE = NMAX, LDU = NMAX, LDV = NMAX) INTEGER LDWORK PARAMETER ( LDWORK = 8*NMAX + 16 ) * .. Local Scalars .. CHARACTER*1 DICO, JOBU, JOBV, STDOM INTEGER I, INFO, J, N, NDIM, NLOW, NSUP DOUBLE PRECISION ALPHA * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), BETA(NMAX), DWORK(LDWORK), $ E(LDE,NMAX), U(LDU,NMAX), V(LDV,NMAX), WI(NMAX), $ WR(NMAX) LOGICAL BWORK(NMAX) * .. External Functions .. LOGICAL DELCTG * .. External Subroutines .. EXTERNAL DGGES, MB03QG * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, NLOW, NSUP, ALPHA, DICO, STDOM, JOBU, $ JOBV IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) * Compute Schur form, eigenvalues and Schur vectors. CALL DGGES( 'Vectors', 'Vectors', 'Not sorted', DELCTG, N, $ A, LDA, E, LDE, NDIM, WR, WI, BETA, U, LDU, V, LDV, $ DWORK, LDWORK, BWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE * Block reordering. CALL MB03QG( DICO, STDOM, JOBU, JOBV, N, NLOW, NSUP, ALPHA, $ A, LDA, E, LDE, U, LDU, V, LDV, NDIM, DWORK, $ LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) NDIM WRITE ( NOUT, FMT = 99994 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( U(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( V(I,J), J = 1,N ) 40 CONTINUE END IF END IF END IF * STOP * 99999 FORMAT (' MB03QG EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DGEES = ',I2) 99997 FORMAT (' INFO on exit from MB03QG = ',I2) 99996 FORMAT (' The number of eigenvalues in the domain is ',I5) 99995 FORMAT (8X,20(1X,F8.4)) 99994 FORMAT (/' The ordered Schur form matrix is ') 99993 FORMAT (/' The ordered triangular matrix is ') 99992 FORMAT (/' The transformation matrix U is ') 99991 FORMAT (/' The transformation matrix V is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB03QG EXAMPLE PROGRAM DATA 4 1 4 0.0 C S U U -1.0 37.0 -12.0 -12.0 -1.0 -10.0 0.0 4.0 2.0 -4.0 7.0 -6.0 2.0 2.0 7.0 -9.0 1.0 3.0 2.0 -1.0 -2.0 5.0 3.0 2.0 2.0 4.0 5.0 6.0 3.0 7.0 6.0 9.0Program Results
MB03QG EXAMPLE PROGRAM RESULTS The number of eigenvalues in the domain is 2 The ordered Schur form matrix is -1.4394 2.5550 -12.5655 -4.0714 2.8887 -1.1242 9.2819 -2.6724 0.0000 0.0000 -19.7785 36.4447 0.0000 0.0000 0.0000 3.5537 The ordered triangular matrix is -16.0178 0.0000 2.3850 4.7645 0.0000 3.2809 -1.5640 1.9954 0.0000 0.0000 -3.0652 0.3039 0.0000 0.0000 0.0000 1.1671 The transformation matrix U is -0.1518 -0.0737 -0.9856 0.0140 -0.2865 -0.9466 0.1136 -0.0947 -0.5442 0.0924 0.0887 0.8292 -0.7738 0.3000 0.0890 -0.5508 The transformation matrix V is 0.2799 0.9041 0.2685 0.1794 0.4009 -0.0714 0.3780 -0.8315 0.7206 -0.4006 0.2628 0.5012 0.4917 0.1306 -0.8462 -0.1588
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03QV.html 0000664 0000000 0000000 00000005446 14560147231 0020373 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of an upper quasi-triangular matrix pencil.Specification
SUBROUTINE MB03QV( N, S, LDS, T, LDT, ALPHAR, ALPHAI, BETA, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDS, LDT, N C .. Array Arguments .. DOUBLE PRECISION ALPHAI(*), ALPHAR(*), BETA(*), S(LDS,*), T(LDT,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrices S and T. N >= 0. S (input) DOUBLE PRECISION array, dimension(LDS,N) The upper quasi-triangular matrix S. LDS INTEGER The leading dimension of the array S. LDS >= max(1,N). T (input) DOUBLE PRECISION array, dimension(LDT,N) The upper triangular matrix T. LDT INTEGER The leading dimension of the array T. LDT >= max(1,N). ALPHAR (output) DOUBLE PRECISION array, dimension (N) ALPHAI (output) DOUBLE PRECISION array, dimension (N) BETA (output) DOUBLE PRECISION array, dimension (N) On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, are the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i, and BETA(j),j=1,...,N, are the diagonals of the complex Schur form (S,T) that would result if the 2-by-2 diagonal blocks of the real Schur form of (A,B) were further reduced to triangular form using 2-by-2 complex unitary transformations. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the eigenvalues of a selected 2-by-2 diagonal block pair of an upper quasi-triangular pencil, to reduce the selected block pair to the standard form and to split it in the case of real eigenvalues, by constructing orthogonal matrices UT and VT. The transformations UT and VT are applied to the pair (A,E) by computing (UT'*A*VT, UT'*E*VT ), to the matrices U and V, by computing U*UT and V*VT.Specification
SUBROUTINE MB03QW( N, L, A, LDA, E, LDE, U, LDU, V, LDV, $ ALPHAR, ALPHAI, BETA, INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDA, LDE, LDU, LDV, N DOUBLE PRECISION ALPHAI(*), ALPHAR(*), BETA(*) C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), E(LDE,*), U(LDU,*), V(LDV,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrices A, E, UT and VT. N >= 2. L (input) INTEGER Specifies the position of the block. 1 <= L < N. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the upper quasi-triangular matrix A whose selected 2-by-2 diagonal block is to be processed. On exit, the leading N-by-N part of this array contains the upper quasi-triangular matrix A after its selected block has been split and/or put in the LAPACK standard form. LDA INTEGER The leading dimension of the array A. LDA >= N. E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the upper triangular matrix E whose selected 2-by-2 diagonal block is to be processed. On exit, the leading N-by-N part of this array contains the transformed upper triangular matrix E (in the LAPACK standard form). LDE INTEGER The leading dimension of the array E. LDE >= N. U (input/output) DOUBLE PRECISION array, dimension (LDU,N) On entry, the leading N-by-N part of this array must contain a transformation matrix U. On exit, the leading N-by-N part of this array contains U*UT, where UT is the transformation matrix used to split and/or standardize the selected block pair. LDU INTEGER The leading dimension of the array U. LDU >= N. V (input/output) DOUBLE PRECISION array, dimension (LDV,N) On entry, the leading N-by-N part of this array must contain a transformation matrix V. On exit, the leading N-by-N part of this array contains V*VT, where VT is the transformation matrix used to split and/or standardize the selected block pair. LDV INTEGER The leading dimension of the array V. LDV >= N. ALPHAR (output) DOUBLE PRECISION array, dimension (2) ALPHAI (output) DOUBLE PRECISION array, dimension (2) BETA (output) DOUBLE PRECISION array, dimension (2) (ALPHAR(k)+i*ALPHAI(k))/BETA(k) are the eigenvalues of the block pair of the pencil (A,B), k=1,2, i = sqrt(-1). Note that BETA(k) may be zero.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Let A1 = ( A(L,L) A(L,L+1) ), E1 = ( E(L,L) E(L,L+1) ), ( A(L+1,L) A(L+1,L+1) ) ( E(L+1,L) E(L+1,L+1) ) be the specified 2-by-2 diagonal block pair of the pencil (A,B). If the eigenvalues of (A1,E1) are complex, then they are computed and stored in ER and EI, where the real part is stored in ER and the positive imaginary part in EI. The 2-by-2 block pair is reduced if necessary to the standard form, such that A(L,L) = A(L+1,L+1), and A(L,L+1) and A(L+1,L) have oposite signs. If the eigenvalues are real, the 2-by-2 block pair is reduced to upper triangular form such that ABS(A(L,L)) >= ABS(A(L+1,L+1)). In both cases, an orthogonal rotation U1' is constructed such that U1'*A1*U1 has the appropriate form. Let UT be an extension of U1 to an N-by-N orthogonal matrix, using identity submatrices. Then A and E are replaced by UT'*A*UT and UT'*E*UT, and the contents of the arrays U and V are U * UT and V * VT, respectively.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the eigenvalues of an upper quasi-triangular matrix.Specification
SUBROUTINE MB03QX( N, T, LDT, WR, WI, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDT, N C .. Array Arguments .. DOUBLE PRECISION T(LDT, *), WI(*), WR(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix T. N >= 0. T (input) DOUBLE PRECISION array, dimension(LDT,N) The upper quasi-triangular matrix T. LDT INTEGER The leading dimension of the array T. LDT >= max(1,N). WR, WI (output) DOUBLE PRECISION arrays, dimension (N) The real and imaginary parts, respectively, of the eigenvalues of T. The eigenvalues are stored in the same order as on the diagonal of T. If T(i:i+1,i:i+1) is a 2-by-2 diagonal block with complex conjugated eigenvalues then WI(i) > 0 and WI(i+1) = -WI(i).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the eigenvalues of a selected 2-by-2 diagonal block of an upper quasi-triangular matrix, to reduce the selected block to the standard form and to split the block in the case of real eigenvalues by constructing an orthogonal transformation UT. This transformation is applied to A (by similarity) and to another matrix U from the right.Specification
SUBROUTINE MB03QY( N, L, A, LDA, U, LDU, E1, E2, INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDA, LDU, N DOUBLE PRECISION E1, E2 C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), U(LDU,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrices A and UT. N >= 2. L (input) INTEGER Specifies the position of the block. 1 <= L < N. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the upper quasi-triangular matrix A whose selected 2-by-2 diagonal block is to be processed. On exit, the leading N-by-N part of this array contains the upper quasi-triangular matrix A after its selected block has been splitt and/or put in the LAPACK standard form. LDA INTEGER The leading dimension of array A. LDA >= N. U (input/output) DOUBLE PRECISION array, dimension (LDU,N) On entry, the leading N-by-N part of this array must contain a transformation matrix U. On exit, the leading N-by-N part of this array contains U*UT, where UT is the transformation matrix used to split and/or standardize the selected block. LDU INTEGER The leading dimension of array U. LDU >= N. E1, E2 (output) DOUBLE PRECISION E1 and E2 contain either the real eigenvalues or the real and positive imaginary parts, respectively, of the complex eigenvalues of the selected 2-by-2 diagonal block of A.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Let A1 = ( A(L,L) A(L,L+1) ) ( A(L+1,L) A(L+1,L+1) ) be the specified 2-by-2 diagonal block of matrix A. If the eigenvalues of A1 are complex, then they are computed and stored in E1 and E2, where the real part is stored in E1 and the positive imaginary part in E2. The 2-by-2 block is reduced if necessary to the standard form, such that A(L,L) = A(L+1,L+1), and A(L,L+1) and A(L+1,L) have oposite signs. If the eigenvalues are real, the 2-by-2 block is reduced to an upper triangular form such that ABS(A(L,L)) >= ABS(A(L+1,L+1)). In both cases, an orthogonal rotation U1' is constructed such that U1'*A1*U1 has the appropriate form. Let UT be an extension of U1 to an N-by-N orthogonal matrix, using identity submatrices. Then A is replaced by UT'*A*UT and the contents of array U is U * UT.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce a matrix A in real Schur form to a block-diagonal form using well-conditioned non-orthogonal similarity transformations. The condition numbers of the transformations used for reduction are roughly bounded by PMAX, where PMAX is a given value. The transformations are optionally postmultiplied in a given matrix X. The real Schur form is optionally ordered, so that clustered eigenvalues are grouped in the same block.Specification
SUBROUTINE MB03RD( JOBX, SORT, N, PMAX, A, LDA, X, LDX, NBLCKS, $ BLSIZE, WR, WI, TOL, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBX, SORT INTEGER INFO, LDA, LDX, N, NBLCKS DOUBLE PRECISION PMAX, TOL C .. Array Arguments .. INTEGER BLSIZE(*) DOUBLE PRECISION A(LDA,*), DWORK(*), WI(*), WR(*), X(LDX,*)Arguments
Mode Parameters
JOBX CHARACTER*1 Specifies whether or not the transformations are accumulated, as follows: = 'N': The transformations are not accumulated; = 'U': The transformations are accumulated in X (the given matrix X is updated). SORT CHARACTER*1 Specifies whether or not the diagonal blocks of the real Schur form are reordered, as follows: = 'N': The diagonal blocks are not reordered; = 'S': The diagonal blocks are reordered before each step of reduction, so that clustered eigenvalues appear in the same block; = 'C': The diagonal blocks are not reordered, but the "closest-neighbour" strategy is used instead of the standard "closest to the mean" strategy (see METHOD); = 'B': The diagonal blocks are reordered before each step of reduction, and the "closest-neighbour" strategy is used (see METHOD).Input/Output Parameters
N (input) INTEGER The order of the matrices A and X. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the infinity norm of elementary submatrices of the individual transformations used for reduction (see METHOD). PMAX >= 1.0D0. 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 to be block-diagonalized, in real Schur form. On exit, the leading N-by-N part of this array contains the computed block-diagonal matrix, in real Schur canonical form. The non-diagonal blocks are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). X (input/output) DOUBLE PRECISION array, dimension (LDX,N) On entry, if JOBX = 'U', the leading N-by-N part of this array must contain a given matrix X. On exit, if JOBX = 'U', the leading N-by-N part of this array contains the product of the given matrix X and the transformation matrix that reduced A to block-diagonal form. The transformation matrix is itself a product of non-orthogonal similarity transformations having elements with magnitude less than or equal to PMAX. If JOBX = 'N', this array is not referenced. LDX INTEGER The leading dimension of array X. LDX >= 1, if JOBX = 'N'; LDX >= MAX(1,N), if JOBX = 'U'. NBLCKS (output) INTEGER The number of diagonal blocks of the matrix A. BLSIZE (output) INTEGER array, dimension (N) The first NBLCKS elements of this array contain the orders of the resulting diagonal blocks of the matrix A. WR, (output) DOUBLE PRECISION arrays, dimension (N) WI These arrays contain the real and imaginary parts, respectively, of the eigenvalues of the matrix A.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in the ordering of the diagonal blocks of the real Schur form matrix. If the user sets TOL > 0, then the given value of TOL is used as an absolute tolerance: a block i and a temporarily fixed block 1 (the first block of the current trailing submatrix to be reduced) are considered to belong to the same cluster if their eigenvalues satisfy | lambda_1 - lambda_i | <= TOL. If the user sets TOL < 0, then the given value of TOL is used as a relative tolerance: a block i and a temporarily fixed block 1 are considered to belong to the same cluster if their eigenvalues satisfy, for j = 1, ..., N, | lambda_1 - lambda_i | <= | TOL | * max | lambda_j |. If the user sets TOL = 0, then an implicitly computed, default tolerance, defined by TOL = SQRT( SQRT( EPS ) ) is used instead, as a relative tolerance, where EPS is the machine precision (see LAPACK Library routine DLAMCH). If SORT = 'N' or 'C', this parameter is not referenced.Workspace
DWORK DOUBLE PRECISION array, dimension (N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Consider first that SORT = 'N'. Let ( A A ) ( 11 12 ) A = ( ), ( 0 A ) ( 22 ) be the given matrix in real Schur form, where initially A is the 11 first diagonal block of dimension 1-by-1 or 2-by-2. An attempt is made to compute a transformation matrix X of the form ( I P ) X = ( ) (1) ( 0 I ) (partitioned as A), so that ( A 0 ) -1 ( 11 ) X A X = ( ), ( 0 A ) ( 22 ) and the elements of P do not exceed the value PMAX in magnitude. An adaptation of the standard method for solving Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2], is used to obtain matrix P. When this attempt failed, an 1-by-1 (or 2-by-2) diagonal block of A , whose eigenvalue(s) is (are) the closest to the mean of those 22 of A is selected, and moved by orthogonal similarity 11 transformations in the leading position of A ; the moved diagonal 22 block is then added to the block A , increasing its order by 1 11 (or 2). Another attempt is made to compute a suitable transformation matrix X with the new definitions of the blocks A 11 and A . After a successful transformation matrix X has been 22 obtained, it postmultiplies the current transformation matrix (if JOBX = 'U'), and the whole procedure is repeated for the matrix A . 22 When SORT = 'S', the diagonal blocks of the real Schur form are reordered before each step of the reduction, so that each cluster of eigenvalues, defined as specified in the definition of TOL, appears in adjacent blocks. The blocks for each cluster are merged together, and the procedure described above is applied to the larger blocks. Using the option SORT = 'S' will usually provide better efficiency than the standard option (SORT = 'N'), proposed in [2], because there could be no or few unsuccessful attempts to compute individual transformation matrices X of the form (1). However, the resulting dimensions of the blocks are usually larger; this could make subsequent calculations less efficient. When SORT = 'C' or 'B', the procedure is similar to that for SORT = 'N' or 'S', respectively, but the block of A whose 22 eigenvalue(s) is (are) the closest to those of A (not to their 11 mean) is selected and moved to the leading position of A . This 22 is called the "closest-neighbour" strategy.References
[1] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Bavely, C. and Stewart, G.W. An Algorithm for Computing Reducing Subspaces by Block Diagonalization. SIAM J. Numer. Anal., 16, pp. 359-367, 1979. [3] Demmel, J. The Condition Number of Equivalence Transformations that Block Diagonalize Matrix Pencils. SIAM J. Numer. Anal., 20, pp. 599-610, 1983.Numerical Aspects
3 4 The algorithm usually requires 0(N ) operations, but 0(N ) are possible in the worst case, when all diagonal blocks in the real Schur form of A are 1-by-1, and the matrix cannot be diagonalized by well-conditioned transformations.Further Comments
The individual non-orthogonal transformation matrices used in the reduction of A to a block-diagonal form have condition numbers of the order PMAX. This does not guarantee that their product is well-conditioned enough. The routine can be easily modified to provide estimates for the condition numbers of the clusters of eigenvalues.Example
Program Text
* MB03RD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 10 ) INTEGER LDA, LDX PARAMETER ( LDA = NMAX, LDX = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX ) * .. Local Scalars .. CHARACTER*1 JOBX, SORT INTEGER I, INFO, J, N, NBLCKS, SDIM DOUBLE PRECISION PMAX, TOL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), WI(NMAX), WR(NMAX), $ X(LDX,NMAX) INTEGER BLSIZE(NMAX) LOGICAL BWORK(NMAX) * .. External Functions .. LOGICAL SELECT * .. External Subroutines .. EXTERNAL DGEES, MB03RD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, PMAX, TOL, JOBX, SORT IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99972 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) * Compute Schur form, eigenvalues and Schur vectors. CALL DGEES( 'Vectors', 'Not sorted', SELECT, N, A, LDA, SDIM, $ WR, WI, X, LDX, DWORK, LDWORK, BWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE * Block-diagonalization. CALL MB03RD( JOBX, SORT, N, PMAX, A, LDA, X, LDX, NBLCKS, $ BLSIZE, WR, WI, TOL, DWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99995 ) NBLCKS WRITE ( NOUT, FMT = 99994 ) ( BLSIZE(I), I = 1,NBLCKS ) WRITE ( NOUT, FMT = 99993 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( X(I,J), J = 1,N ) 20 CONTINUE END IF END IF END IF * STOP * 99999 FORMAT (' MB03RD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DGEES = ',I2) 99997 FORMAT (' INFO on exit from MB03RD = ',I2) 99995 FORMAT (' The number of blocks is ',I5) 99994 FORMAT (' The orders of blocks are ',/(20(I3,2X))) 99993 FORMAT (' The block-diagonal matrix is ') 99992 FORMAT (8X,20(1X,F8.4)) 99991 FORMAT (' The transformation matrix is ') 99972 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB03RD EXAMPLE PROGRAM DATA 8 1.D03 1.D-2 U S 1. -1. 1. 2. 3. 1. 2. 3. 1. 1. 3. 4. 2. 3. 4. 2. 0. 0. 1. -1. 1. 5. 4. 1. 0. 0. 0. 1. -1. 3. 1. 2. 0. 0. 0. 1. 1. 2. 3. -1. 0. 0. 0. 0. 0. 1. 5. 1. 0. 0. 0. 0. 0. 0. 0.99999999 -0.99999999 0. 0. 0. 0. 0. 0. 0.99999999 0.99999999Program Results
MB03RD EXAMPLE PROGRAM RESULTS The number of blocks is 2 The orders of blocks are 6 2 The block-diagonal matrix is 1.0000 -1.0000 -1.2247 -0.7071 -3.4186 1.4577 0.0000 0.0000 1.0000 1.0000 0.0000 1.4142 -5.1390 3.1637 0.0000 0.0000 0.0000 0.0000 1.0000 -1.7321 -0.0016 2.0701 0.0000 0.0000 0.0000 0.0000 0.5774 1.0000 0.7516 1.1379 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 -5.8606 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.1706 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 -0.8850 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 The transformation matrix is 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.9045 0.1957 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 -0.3015 0.9755 0.0000 0.0000 0.8165 0.0000 -0.5768 -0.0156 -0.3015 0.0148 0.0000 0.0000 -0.4082 0.7071 -0.5768 -0.0156 0.0000 -0.0534 0.0000 0.0000 -0.4082 -0.7071 -0.5768 -0.0156 0.0000 0.0801 0.0000 0.0000 0.0000 0.0000 -0.0276 0.9805 0.0000 0.0267 0.0000 0.0000 0.0000 0.0000 0.0332 -0.0066 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0011 0.1948 0.0000 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03RW.html 0000664 0000000 0000000 00000013406 14560147231 0020370 0 ustar 00root root 0000000 0000000
Purpose
To solve the Sylvester equation -AX + XB = C, where A and B are complex M-by-M and N-by-N matrices, respectively, in Schur form. This routine is intended to be called only by SLICOT Library routine MB03RZ. For efficiency purposes, the computations are aborted when the absolute value of an element of X is greater than a given value PMAX.Specification
SUBROUTINE MB03RW( M, N, PMAX, A, LDA, B, LDB, C, LDC, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, M, N DOUBLE PRECISION PMAX C .. Array Arguments .. COMPLEX*16 A(LDA,*), B(LDB,*), C(LDC,*)Arguments
Input/Output Parameters
M (input) INTEGER The order of the matrix A and the number of rows of the matrices C and X. M >= 0. N (input) INTEGER The order of the matrix B and the number of columns of the matrices C and X. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the absolute value of the elements of X (see METHOD). A (input) COMPLEX*16 array, dimension (LDA,M) The leading M-by-M upper triangular part of this array must contain the matrix A of the Sylvester equation. The elements below the diagonal are not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). B (input) COMPLEX*16 array, dimension (LDB,N) The leading N-by-N upper triangular part of this array must contain the matrix B of the Sylvester equation. The elements below the diagonal are not referenced. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) COMPLEX*16 array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the matrix C of the Sylvester equation. On exit, if INFO = 0, the leading M-by-N part of this array contains the solution matrix X of the Sylvester equation, and each element of X (see METHOD) has the absolute value less than or equal to PMAX. On exit, if INFO = 1, the solution matrix X has not been computed completely, because an element of X had the absolute value greater than PMAX. Part of the matrix C has possibly been overwritten with the corresponding part of X. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M).Error Indicator
INFO INTEGER = 0: successful exit; = 1: an element of X had the absolute value greater than the given value PMAX. = 2: A and B have common or very close eigenvalues; perturbed values were used to solve the equation (but the matrices A and B are unchanged). This is a warning.Method
The routine uses an adaptation of the standard method for solving Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2]. The equation -AX + XB = C can be rewritten as m l-1 -A X + X B = C + sum A X - sum X B kk kl kl ll kl i=k+1 ki il j=1 kj jl for l = 1:n, and k = m:-1:1, where A , B , C , and X , are the kk ll kl kl elements defined by the partitioning induced by the Schur form of A and B. So, the elements of X are found column by column, starting from the bottom. If any such element has the absolute value greater than the given value PMAX, the calculations are ended.References
[1] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Bavely, C. and Stewart, G.W. An Algorithm for Computing Reducing Subspaces by Block Diagonalization. SIAM J. Numer. Anal., 16, pp. 359-367, 1979.Numerical Aspects
2 2 The algorithm requires 0(M N + MN ) operations.Further Comments
Let ( A C ) ( I X ) M = ( ), Y = ( ). ( 0 B ) ( 0 I ) Then -1 ( A 0 ) Y M Y = ( ), ( 0 B ) hence Y is a non-unitary transformation matrix which performs the reduction of M to a block-diagonal form. Bounding a norm of X is equivalent to setting an upper bound to the condition number of the transformation matrix Y.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reorder the diagonal blocks of the principal submatrix between the indices KL and KU (KU >= KL) of a real Schur form matrix A together with their eigenvalues, using orthogonal similarity transformations, such that the block specified by KU is moved in the position KL. The transformations are optionally postmultiplied in a given matrix X.Specification
SUBROUTINE MB03RX( JOBV, N, KL, KU, A, LDA, X, LDX, WR, WI, $ DWORK ) C .. Scalar Arguments .. CHARACTER JOBV INTEGER KL, KU, LDA, LDX, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), WI(*), WR(*), X(LDX,*)Arguments
Mode Parameters
JOBV CHARACTER*1 Specifies whether or not the transformations are accumulated, as follows: = 'N': The transformations are not accumulated; = 'V': The transformations are accumulated in X (the given matrix X is updated).Input/Output Parameters
N (input) INTEGER The order of the matrices A and X. N >= 0. KL (input) INTEGER The lower boundary index for the rows and columns of the principal submatrix of A whose diagonal blocks are to be reordered, and also the target position for the block to be moved. 1 <= KL <= KU <= N. KU (input/output) INTEGER On entry, KU specifies the upper boundary index for the rows and columns of the principal submatrix of A whose diagonal blocks are to be reordered, and also the original position for the block to be moved. 1 <= KL <= KU <= N. On exit, KU specifies the upper boundary index for the rows and columns of the principal submatrix of A whose diagonal blocks have been reordered. The given value will be increased by 1 if the moved block was 2-by-2 and it has been replaced by two 1-by-1 blocks. Otherwise, its input value is preserved. 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 in real Schur canonical form. On exit, the leading N-by-N part of this array contains the ordered real Schur canonical form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). X (input/output) DOUBLE PRECISION array, dimension (LDX,N) On entry, if JOBV = 'V', the leading N-by-N part of this array must contain a given matrix X. On exit, if JOBV = 'V', the leading N-by-N part of this array contains the product of the given matrix X and the transformation matrix that performed the reordering of A. If JOBV = 'N', this array is not referenced. LDX INTEGER The leading dimension of array X. LDX >= 1, if JOBV = 'N'; LDX >= MAX(1,N), if JOBV = 'V'. WR, (input/output) DOUBLE PRECISION arrays, dimension (N) WI On entry, these arrays must contain the real and imaginary parts, respectively, of the eigenvalues of the matrix A. On exit, these arrays contain the real and imaginary parts, respectively, of the eigenvalues of the matrix A, possibly reordered.Workspace
DWORK DOUBLE PRECISION array, dimension (N)Method
An attempt is made to move the block in the position (KU,KU) to the position (KL,KL) by a sequence of orthogonal similarity transformations, each swapping two consecutive blocks. The standard algorithm [1], [2] usually succeeds to perform this reordering. A failure of this algorithm means that two consecutive blocks (one of them being the desired block possibly moved) are too close to swap. In such a case, the leading block of the two is tried to be moved in the position (KL,KL) and the procedure is repeated.References
[1] Stewart, G.W. HQR3 and EXCHQZ: FORTRAN subroutines for calculating and ordering the eigenvalues of a real upper Hessenberg matrix. ACM TOMS, 2, pp. 275-280, 1976. [2] 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.Numerical Aspects
The algorithm is numerically stable. If some eigenvalues are ill-conditioned, their returned values could differ much from their input values.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve the Sylvester equation -AX + XB = C, where A and B are M-by-M and N-by-N matrices, respectively, in real Schur form. This routine is intended to be called only by SLICOT Library routine MB03RD. For efficiency purposes, the computations are aborted when the infinity norm of an elementary submatrix of X is greater than a given value PMAX.Specification
SUBROUTINE MB03RY( M, N, PMAX, A, LDA, B, LDB, C, LDC, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, M, N DOUBLE PRECISION PMAX C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*)Arguments
Input/Output Parameters
M (input) INTEGER The order of the matrix A and the number of rows of the matrices C and X. M >= 0. N (input) INTEGER The order of the matrix B and the number of columns of the matrices C and X. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the infinity norm of an elementary submatrix of X (see METHOD). A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain the matrix A of the Sylvester equation, in real Schur form. The elements below the real Schur form are not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). B (input) DOUBLE PRECISION array, dimension (LDB,N) The leading N-by-N part of this array must contain the matrix B of the Sylvester equation, in real Schur form. The elements below the real Schur form are not referenced. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the matrix C of the Sylvester equation. On exit, if INFO = 0, the leading M-by-N part of this array contains the solution matrix X of the Sylvester equation, and each elementary submatrix of X (see METHOD) has the infinity norm less than or equal to PMAX. On exit, if INFO = 1, the solution matrix X has not been computed completely, because an elementary submatrix of X had the infinity norm greater than PMAX. Part of the matrix C has possibly been overwritten with the corresponding part of X. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M).Error Indicator
INFO INTEGER = 0: successful exit; = 1: an elementary submatrix of X had the infinity norm greater than the given value PMAX.Method
The routine uses an adaptation of the standard method for solving Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2]. The equation -AX + XB = C can be rewritten as p l-1 -A X + X B = C + sum A X - sum X B kk kl kl ll kl i=k+1 ki il j=1 kj jl for l = 1:q, and k = p:-1:1, where A , B , C , and X , are kk ll kl kl block submatrices defined by the partitioning induced by the Schur form of A and B, and p and q are the numbers of the diagonal blocks of A and B, respectively. So, the elementary submatrices of X are found block column by block column, starting from the bottom. If any such elementary submatrix has the infinity norm greater than the given value PMAX, the calculations are ended.References
[1] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Bavely, C. and Stewart, G.W. An Algorithm for Computing Reducing Subspaces by Block Diagonalization. SIAM J. Numer. Anal., 16, pp. 359-367, 1979.Numerical Aspects
2 2 The algorithm requires 0(M N + MN ) operations.Further Comments
Let ( A C ) ( I X ) M = ( ), Y = ( ). ( 0 B ) ( 0 I ) Then -1 ( A 0 ) Y M Y = ( ), ( 0 B ) hence Y is an non-orthogonal transformation matrix which performs the reduction of M to a block-diagonal form. Bounding a norm of X is equivalent to setting an upper bound to the condition number of the transformation matrix Y.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce an upper triangular complex matrix A (Schur form) to a block-diagonal form using well-conditioned non-unitary similarity transformations. The condition numbers of the transformations used for reduction are roughly bounded by PMAX, where PMAX is a given value. The transformations are optionally postmultiplied in a given matrix X. The Schur form is optionally ordered, so that clustered eigenvalues are grouped in the same block.Specification
SUBROUTINE MB03RZ( JOBX, SORT, N, PMAX, A, LDA, X, LDX, NBLCKS, $ BLSIZE, W, TOL, INFO )C .. Scalar Arguments .. CHARACTER JOBX, SORT INTEGER INFO, LDA, LDX, N, NBLCKS DOUBLE PRECISION PMAX, TOL C .. Array Arguments .. INTEGER BLSIZE(*) COMPLEX*16 A(LDA,*), W(*), X(LDX,*)Arguments
Mode Parameters
JOBX CHARACTER*1 Specifies whether or not the transformations are accumulated, as follows: = 'N': The transformations are not accumulated; = 'U': The transformations are accumulated in X (the given matrix X is updated). SORT CHARACTER*1 Specifies whether or not the diagonal elements of the Schur form are reordered, as follows: = 'N': The diagonal elements are not reordered; = 'S': The diagonal elements are reordered before each step of reduction, so that clustered eigenvalues appear in the same block; = 'C': The diagonal elements are not reordered, but the "closest-neighbour" strategy is used instead of the standard "closest to the mean" strategy (see METHOD); = 'B': The diagonal elements are reordered before each step of reduction, and the "closest-neighbour" strategy is used (see METHOD).Input/Output Parameters
N (input) INTEGER The order of the matrices A and X. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the absolute value of the elements of the individual transformations used for reduction (see METHOD). PMAX >= 1.0D0. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix A to be block-diagonalized. On exit, the leading N-by-N upper triangular part of this array contains the computed block-diagonal matrix, in Schur form. The strictly lower triangular part is used as workspace, but it is set to zero before exit. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). X (input/output) COMPLEX*16 array, dimension (LDX,*) On entry, if JOBX = 'U', the leading N-by-N part of this array must contain a given matrix X. On exit, if JOBX = 'U', the leading N-by-N part of this array contains the product of the given matrix X and the transformation matrix that reduced A to block-diagonal form. The transformation matrix is itself a product of non-unitary similarity transformations having elements with magnitude less than or equal to PMAX. If JOBX = 'N', this array is not referenced. LDX INTEGER The leading dimension of array X. LDX >= 1, if JOBX = 'N'; LDX >= MAX(1,N), if JOBX = 'U'. NBLCKS (output) INTEGER The number of diagonal blocks of the matrix A. BLSIZE (output) INTEGER array, dimension (N) The first NBLCKS elements of this array contain the orders of the resulting diagonal blocks of the matrix A. W (output) COMPLEX*16 array, dimension (N) This array contains the eigenvalues of the matrix A.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in the ordering of the diagonal elements of the upper triangular matrix. If the user sets TOL > 0, then the given value of TOL is used as an absolute tolerance: an eigenvalue i and a temporarily fixed eigenvalue 1 (the first element of the current trailing submatrix to be reduced) are considered to belong to the same cluster if they satisfy | lambda_1 - lambda_i | <= TOL. If the user sets TOL < 0, then the given value of TOL is used as a relative tolerance: an eigenvalue i and a temporarily fixed eigenvalue 1 are considered to belong to the same cluster if they satisfy, for j = 1, ..., N, | lambda_1 - lambda_i | <= | TOL | * max | lambda_j |. If the user sets TOL = 0, then an implicitly computed, default tolerance, defined by TOL = SQRT( SQRT( EPS ) ) is used instead, as a relative tolerance, where EPS is the machine precision (see LAPACK Library routine DLAMCH). If SORT = 'N' or 'C', this parameter is not referenced.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Consider first that SORT = 'N'. Let ( A A ) ( 11 12 ) A = ( ), ( 0 A ) ( 22 ) be the given matrix in Schur form, where initially A is the 11 first diagonal element. An attempt is made to compute a transformation matrix X of the form ( I P ) X = ( ) (1) ( 0 I ) (partitioned as A), so that ( A 0 ) -1 ( 11 ) X A X = ( ), ( 0 A ) ( 22 ) and the elements of P do not exceed the value PMAX in magnitude. An adaptation of the standard method for solving Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2], is used to obtain matrix P. When this attempt failed, a diagonal element of A , closest to 22 the mean of those of A is selected, and moved by unitary 11 similarity transformations in the leading position of A ; the 22 moved diagonal element is then added to the block A , increasing 11 its order by 1. Another attempt is made to compute a suitable transformation matrix X with the new definitions of the blocks A 11 and A . After a successful transformation matrix X has been 22 obtained, it postmultiplies the current transformation matrix (if JOBX = 'U'), and the whole procedure is repeated for the block A . 22 When SORT = 'S', the diagonal elements of the Schur form are reordered before each step of the reduction, so that each cluster of eigenvalues, defined as specified in the definition of TOL, appears in adjacent elements. The elements for each cluster are merged together, and the procedure described above is applied to the larger blocks. Using the option SORT = 'S' will usually provide better efficiency than the standard option (SORT = 'N'), proposed in [2], because there could be no or few unsuccessful attempts to compute individual transformation matrices X of the form (1). However, the resulting dimensions of the blocks are usually larger; this could make subsequent calculations less efficient. When SORT = 'C' or 'B', the procedure is similar to that for SORT = 'N' or 'S', respectively, but the block of A whose 22 eigenvalue(s) is (are) the closest to those of A (not to their 11 mean) is selected and moved to the leading position of A . This 22 is called the "closest-neighbour" strategy.References
[1] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Bavely, C. and Stewart, G.W. An Algorithm for Computing Reducing Subspaces by Block Diagonalization. SIAM J. Numer. Anal., 16, pp. 359-367, 1979. [3] Demmel, J. The Condition Number of Equivalence Transformations that Block Diagonalize Matrix Pencils. SIAM J. Numer. Anal., 20, pp. 599-610, 1983.Numerical Aspects
3 4 The algorithm usually requires 0(N ) operations, but 0(N ) are possible in the worst case, when the matrix cannot be diagonalized by well-conditioned transformations.Further Comments
The individual non-unitary transformation matrices used in the reduction of A to a block-diagonal form have condition numbers of the order PMAX. This does not guarantee that their product is well-conditioned enough. The routine can be easily modified to provide estimates for the condition numbers of the clusters of eigenvalues.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03SD.html 0000664 0000000 0000000 00000022220 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of an N-by-N square-reduced Hamiltonian matrix ( A' G' ) H' = ( T ). (1) ( Q' -A' ) Here, A' is an N-by-N matrix, and G' and Q' are symmetric N-by-N matrices. It is assumed without a check that H' is square- reduced, i.e., that 2 ( A'' G'' ) H' = ( T ) with A'' upper Hessenberg. (2) ( 0 A'' ) T 2 (Equivalently, Q'A'- A' Q' = 0, A'' = A' + G'Q', and for i > j+1, A''(i,j) = 0.) Ordinarily, H' is the output from SLICOT Library routine MB04ZD. The eigenvalues of H' are computed as the square roots of the eigenvalues of A''.Specification
SUBROUTINE MB03SD( JOBSCL, N, A, LDA, QG, LDQG, WR, WI, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDQG, LDWORK, N CHARACTER JOBSCL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), QG(LDQG,*), WI(*), WR(*)Arguments
Mode Parameters
JOBSCL CHARACTER*1 Specifies whether or not balancing operations should be performed by the LAPACK subroutine DGEBAL on the Hessenberg matrix A'' in (2), as follows: = 'N': do not use balancing; = 'S': do scaling in order to equilibrate the rows and columns of A''. See LAPACK subroutine DGEBAL and Section METHOD below.Input/Output Parameters
N (input) INTEGER The order of the matrices A, G, and Q. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the upper left block A' of the square-reduced Hamiltonian matrix H' in (1), as produced by SLICOT Library routine MB04ZD. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). QG (input) DOUBLE PRECISION array, dimension (LDQG,N+1) The leading N-by-N lower triangular part of this array must contain the lower triangle of the lower left symmetric block Q' of the square-reduced Hamiltonian matrix H' in (1), and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array must contain the upper triangle of the upper right symmetric block G' of the square-reduced Hamiltonian matrix H' in (1), as produced by SLICOT Library routine MB04ZD. So, if i >= j, then Q'(i,j) is stored in QG(i,j) and G'(i,j) is stored in QG(j,i+1). LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N). WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) The arrays WR and WI contain the real and imaginary parts, respectively, of the N eigenvalues of H' with non-negative real part. The remaining N eigenvalues are the negatives of these eigenvalues. Eigenvalues are stored in WR and WI in decreasing order of magnitude of the real parts, i.e., WR(I) >= WR(I+1). (In particular, an eigenvalue closest to the imaginary axis is WR(N)+WI(N)i.) In addition, eigenvalues with zero real part are sorted in decreasing order of magnitude of imaginary parts. Note that non-real eigenvalues with non-zero real part appear in complex conjugate pairs, but eigenvalues with zero real part do not, in general, appear in complex conjugate pairs.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX(1,N*(N+1)). For good performance, LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, then the i-th argument had an illegal value; > 0: if INFO = i, i <= N, then LAPACK subroutine DHSEQR failed to converge while computing the i-th eigenvalue.Method
The routine forms the upper Hessenberg matrix A'' in (2) and calls LAPACK subroutines to calculate its eigenvalues. The eigenvalues of H' are the square roots of the eigenvalues of A''.References
[1] Van Loan, C. F. A Symplectic Method for Approximating All the Eigenvalues of a Hamiltonian Matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984. [2] Byers, R. Hamiltonian and Symplectic Algorithms for the Algebraic Riccati Equation. Ph. D. Thesis, Cornell University, Ithaca, NY, January 1983. [3] Benner, P., Byers, R., and Barth, E. Fortran 77 Subroutines for Computing the Eigenvalues of Hamiltonian Matrices. I: The Square-Reduced Method. ACM Trans. Math. Software, 26, 1, pp. 49-77, 2000.Numerical Aspects
The algorithm requires (32/3)*N**3 + O(N**2) floating point operations. Eigenvalues computed by this subroutine are exact eigenvalues of a perturbed Hamiltonian matrix H' + E where || E || <= c sqrt(eps) || H' ||, c is a modest constant depending on the dimension N and eps is the machine precision. Moreover, if the norm of H' and an eigenvalue are of roughly the same magnitude, the computed eigenvalue is essentially as accurate as the computed eigenvalue obtained by traditional methods. See [1] or [2].Further Comments
NoneExample
Program Text
* MB03SD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDQG PARAMETER ( LDA = NMAX, LDQG = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( NMAX+1 ) ) * .. Local Scalars .. INTEGER I, INFO, J, N CHARACTER*1 JOBSCL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), QG(LDQG,NMAX+1), $ WI(NMAX), WR(NMAX) * .. External Subroutines .. EXTERNAL MB03SD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. * NOTE: input must define a square-reduced Hamiltonian matrix. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, JOBSCL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99998 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( QG(J,I+1), I = J,N ), J = 1,N ) READ ( NIN, FMT = * ) ( ( QG(I,J), I = J,N ), J = 1,N ) * Compute the eigenvalues. CALL MB03SD( JOBSCL, N, A, LDA, QG, LDQG, WR, WI, DWORK, $ LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE * Show the computed eigenvalues. WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99995 ) WR(I), ' + (', WI(I), ')i' 10 CONTINUE DO 20 I = N, 1, -1 WRITE ( NOUT, FMT = 99995 ) -WR(I), ' + (', -WI(I), ')i' 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' MB03SD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' N is out of range.',/' N = ',I5) 99997 FORMAT (' INFO on exit from MB03SD = ',I2) 99996 FORMAT (/' The eigenvalues are ') 99995 FORMAT (1X,F8.4,A,F8.4,A) ENDProgram Data
MB03SD EXAMPLE PROGRAM DATA 3 S 2.0 0.0 0.0 0.0 1.0 2.0 0.0 -1.0 3.0 1.0 0.0 0.0 2.0 3.0 4.0 -2.0 0.0 0.0 0.0 0.0 0.0Program Results
MB03SD EXAMPLE PROGRAM RESULTS The eigenvalues are 2.0000 + ( 1.0000)i 2.0000 + ( -1.0000)i 1.4142 + ( 0.0000)i -1.4142 + ( 0.0000)i -2.0000 + ( 1.0000)i -2.0000 + ( -1.0000)i
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03TD.html 0000664 0000000 0000000 00000037052 14560147231 0020352 0 ustar 00root root 0000000 0000000
Purpose
To reorder a matrix X in skew-Hamiltonian Schur form: [ A G ] T X = [ T ], G = -G, [ 0 A ] or in Hamiltonian Schur form: [ A G ] T X = [ T ], G = G, [ 0 -A ] where A is in upper quasi-triangular form, so that a selected cluster of eigenvalues appears in the leading diagonal blocks of the matrix A (in X) and the leading columns of [ U1; -U2 ] form an orthonormal basis for the corresponding right invariant subspace. If X is skew-Hamiltonian, then each eigenvalue appears twice; one copy corresponds to the j-th diagonal element and the other to the (n+j)-th diagonal element of X. The logical array LOWER controls which copy is to be reordered to the leading part of A. If X is Hamiltonian then the eigenvalues appear in pairs (lambda,-lambda); lambda corresponds to the j-th diagonal element and -lambda to the (n+j)-th diagonal element of X. The logical array LOWER controls whether lambda or -lambda is to be reordered to the leading part of A. The matrix A must be in Schur canonical form (as returned by the LAPACK routine DHSEQR), that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign.Specification
SUBROUTINE MB03TD( TYP, COMPU, SELECT, LOWER, N, A, LDA, G, LDG, $ U1, LDU1, U2, LDU2, WR, WI, M, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER COMPU, TYP INTEGER INFO, LDA, LDG, LDU1, LDU2, LDWORK, M, N C .. Array Arguments .. LOGICAL LOWER(*), SELECT(*) DOUBLE PRECISION A(LDA,*), DWORK(*), G(LDG,*), U1(LDU1,*), $ U2(LDU2,*), WI(*), WR(*)Arguments
Mode Parameters
TYP CHARACTER*1 Specifies the type of the input matrix X: = 'S': X is skew-Hamiltonian; = 'H': X is Hamiltonian. COMPU CHARACTER*1 = 'U': update the matrices U1 and U2 containing the Schur vectors; = 'N': do not update U1 and U2. SELECT (input/output) LOGICAL array, dimension (N) SELECT specifies the eigenvalues in the selected cluster. To select a real eigenvalue w(j), SELECT(j) must be set to .TRUE.. To select a complex conjugate pair of eigenvalues w(j) and w(j+1), corresponding to a 2-by-2 diagonal block, both SELECT(j) and SELECT(j+1) must be set to .TRUE.; a complex conjugate pair of eigenvalues must be either both included in the cluster or both excluded. LOWER (input/output) LOGICAL array, dimension (N) LOWER controls which copy of a selected eigenvalue is included in the cluster. If SELECT(j) is set to .TRUE. for a real eigenvalue w(j); then LOWER(j) must be set to .TRUE. if the eigenvalue corresponding to the (n+j)-th diagonal element of X is to be reordered to the leading part; and LOWER(j) must be set to .FALSE. if the eigenvalue corresponding to the j-th diagonal element of X is to be reordered to the leading part. Similarly, for a complex conjugate pair of eigenvalues w(j) and w(j+1), both LOWER(j) and LOWER(j+1) must be set to .TRUE. if the eigenvalues corresponding to the (n+j:n+j+1,n+j:n+j+1) diagonal block of X are to be reordered to the leading part.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the upper quasi-triangular matrix A in Schur canonical form. On exit, the leading N-by-N part of this array contains the reordered matrix A, again in Schur canonical form, with the selected eigenvalues in the diagonal blocks. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). G (input/output) DOUBLE PRECISION array, dimension (LDG,N) On entry, if TYP = 'S', the leading N-by-N part of this array must contain the strictly upper triangular part of the skew-symmetric matrix G. The rest of this array is not referenced. On entry, if TYP = 'H', the leading N-by-N part of this array must contain the upper triangular part of the symmetric matrix G. The rest of this array is not referenced. On exit, if TYP = 'S', the leading N-by-N part of this array contains the strictly upper triangular part of the skew-symmetric matrix G, updated by the orthogonal symplectic transformation which reorders X. On exit, if TYP = 'H', the leading N-by-N part of this array contains the upper triangular part of the symmetric matrix G, updated by the orthogonal symplectic transformation which reorders X. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,N). U1 (input/output) DOUBLE PRECISION array, dimension (LDU1,N) On entry, if COMPU = 'U', the leading N-by-N part of this array must contain U1, the (1,1) block of an orthogonal symplectic matrix U = [ U1, U2; -U2, U1 ]. On exit, if COMPU = 'U', the leading N-by-N part of this array contains the (1,1) block of the matrix U, postmultiplied by the orthogonal symplectic transformation which reorders X. The leading M columns of U form an orthonormal basis for the specified invariant subspace. If COMPU = 'N', this array is not referenced. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= MAX(1,N), if COMPU = 'U'; LDU1 >= 1, otherwise. U2 (input/output) DOUBLE PRECISION array, dimension (LDU2,N) On entry, if COMPU = 'U', the leading N-by-N part of this array must contain U2, the (1,2) block of an orthogonal symplectic matrix U = [ U1, U2; -U2, U1 ]. On exit, if COMPU = 'U', the leading N-by-N part of this array contains the (1,2) block of the matrix U, postmultiplied by the orthogonal symplectic transformation which reorders X. If COMPU = 'N', this array is not referenced. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= MAX(1,N), if COMPU = 'U'; LDU2 >= 1, otherwise. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) The real and imaginary parts, respectively, of the reordered eigenvalues of A. The eigenvalues are stored in the same order as on the diagonal of A, with WR(i) = A(i,i) and, if A(i:i+1,i:i+1) is a 2-by-2 diagonal block, WI(i) > 0 and WI(i+1) = -WI(i). Note that if an eigenvalue is sufficiently ill-conditioned, then its value may differ significantly from its value before reordering. M (output) INTEGER The dimension of the specified invariant subspace. 0 <= M <= N.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -18, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value. = 1: reordering of X failed because some eigenvalue pairs are too close to separate (the problem is very ill-conditioned); X may have been partially reordered, and WR and WI contain the eigenvalues in the same order as in X.References
[1] Bai, Z. and Demmel, J.W. On Swapping Diagonal Blocks in Real Schur Form. Linear Algebra Appl., 186, pp. 73-95, 1993. [2] Benner, P., Kressner, D., and Mehrmann, V. Skew-Hamiltonian and Hamiltonian Eigenvalue Problems: Theory, Algorithms and Applications. Techn. Report, TU Berlin, 2003.Further Comments
NoneExample
Program Text
* MB03TD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 100 ) INTEGER LDA, LDG, LDRES, LDU1, LDU2, LDWORK PARAMETER ( LDA = NMAX, LDG = NMAX, LDRES = NMAX, $ LDU1 = NMAX, LDU2 = NMAX, LDWORK = 8*NMAX ) * .. Local Scalars .. CHARACTER*1 COMPU, TYP INTEGER I, INFO, J, N, M * .. Local Arrays .. LOGICAL LOWER(NMAX), SELECT(NMAX) DOUBLE PRECISION A(LDA, NMAX), DWORK(LDWORK), G(LDG, NMAX), $ RES(LDRES,NMAX), U1(LDU1,NMAX), U2(LDU2,NMAX), $ WR(NMAX), WI(NMAX) * .. External Functions .. LOGICAL LSAME DOUBLE PRECISION MA02JD EXTERNAL LSAME, MA02JD * .. External Subroutines .. EXTERNAL MB03TD * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, TYP, COMPU IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( SELECT(J), J = 1,N ) READ ( NIN, FMT = * ) ( LOWER(J), J = 1,N ) READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( G(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( COMPU, 'U' ) ) THEN READ ( NIN, FMT = * ) ( ( U1(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( U2(I,J), J = 1,N ), I = 1,N ) END IF CALL MB03TD( TYP, COMPU, SELECT, LOWER, N, A, LDA, G, LDG, U1, $ LDU1, U2, LDU2, WR, WI, M, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( COMPU, 'U' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99994 ) $ ( U1(I,J), J = 1,N ), ( U2(I,J), J = 1,N ) 10 CONTINUE DO 20 I = 1, N WRITE ( NOUT, FMT = 99994 ) $ ( -U2(I,J), J = 1,N ), ( U1(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99992 ) MA02JD( .FALSE., .FALSE., N, $ U1, LDU1, U2, LDU2, RES, LDRES ) END IF * WRITE ( NOUT, FMT = 99996 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( A(I,J), J = 1,N ) 30 CONTINUE * WRITE ( NOUT, FMT = 99995 ) IF ( LSAME( TYP, 'S' ) ) THEN DO 40 I = 1, N WRITE ( NOUT, FMT = 99994 ) $ ( -G(J,I), J = 1,I-1 ), ZERO, ( G(I,J), J = I+1,N ) 40 CONTINUE ELSE DO 50 I = 1, N WRITE ( NOUT, FMT = 99994 ) $ ( G(J,I), J = 1,I-1 ), ( G(I,J), J = I,N ) 50 CONTINUE END IF END IF END IF * 99999 FORMAT (' MB03TD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB03TD = ',I2) 99997 FORMAT (' The orthogonal symplectic factor U is ') 99996 FORMAT (/' The matrix A in reordered Schur canonical form is ') 99995 FORMAT (/' The matrix G is ') 99994 FORMAT (20(1X,F9.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' Orthogonality of U: || U''*U - I ||_F = ',G7.2) ENDProgram Data
MB03TD EXAMPLE PROGRAM DATA 5 S U .F. .T. .T. .F. .F. .F. .T. .T. .F. .F. 0.9501 0.7621 0.6154 0.4057 0.0579 0 0.4565 0.7919 0.9355 0.3529 0 -0.6822 0.4565 0.9169 0.8132 0 0 0 0.4103 0.0099 0 0 0 0 0.1389 0 -0.1834 -0.1851 0.5659 0.3040 0 0 0.4011 -0.9122 0.2435 0 0 0 0.4786 -0.2432 0 0 0 0 -0.5272 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0Program Results
MB03TD EXAMPLE PROGRAM RESULTS The orthogonal symplectic factor U is 0.0407 0.4847 0.8737 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.1245 -0.3866 0.2087 0.4509 -0.1047 0.3229 0.1248 -0.0843 0.1967 0.6415 -0.0933 0.4089 -0.2225 -0.4085 0.0709 -0.2171 0.2156 -0.1095 0.4348 0.5551 -0.1059 -0.5250 0.2962 -0.0295 0.2207 -0.6789 0.1133 -0.0312 0.2979 -0.1112 0.3937 0.3071 -0.1887 0.5332 -0.4351 -0.4423 0.0600 -0.0127 0.1679 -0.1179 0.0000 0.0000 0.0000 0.0000 0.0000 0.0407 0.4847 0.8737 0.0000 0.0000 -0.3229 -0.1248 0.0843 -0.1967 -0.6415 0.1245 -0.3866 0.2087 0.4509 -0.1047 0.2171 -0.2156 0.1095 -0.4348 -0.5551 -0.0933 0.4089 -0.2225 -0.4085 0.0709 0.6789 -0.1133 0.0312 -0.2979 0.1112 -0.1059 -0.5250 0.2962 -0.0295 0.2207 0.4423 -0.0600 0.0127 -0.1679 0.1179 0.3937 0.3071 -0.1887 0.5332 -0.4351 Orthogonality of U: || U'*U - I ||_F = .21E-14 The matrix A in reordered Schur canonical form is 0.4565 -0.4554 0.2756 -0.8651 -1.2050 1.1863 0.4565 0.2186 -0.0233 0.8293 0.0000 0.0000 0.9501 0.0625 -0.0064 0.0000 0.0000 0.0000 0.4103 0.5597 0.0000 0.0000 0.0000 0.0000 0.1389 The matrix G is 0.0000 0.3298 -0.0292 -0.1571 0.1751 -0.3298 0.0000 -0.0633 -0.2951 0.2396 0.0292 0.0633 0.0000 0.9567 0.7485 0.1571 0.2951 -0.9567 0.0000 0.2960 -0.1751 -0.2396 -0.7485 -0.2960 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03TS.html 0000664 0000000 0000000 00000014314 14560147231 0020365 0 ustar 00root root 0000000 0000000
Purpose
To swap diagonal blocks A11 and A22 of order 1 or 2 in the upper quasi-triangular matrix A contained in a skew-Hamiltonian matrix [ A G ] T X = [ T ], G = -G, [ 0 A ] or in a Hamiltonian matrix [ A G ] T X = [ T ], G = G. [ 0 -A ] This routine is a modified version of the LAPACK subroutine DLAEX2. The matrix A must be in Schur canonical form (as returned by the LAPACK routine DHSEQR), that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign.Specification
SUBROUTINE MB03TS( ISHAM, WANTU, N, A, LDA, G, LDG, U1, LDU1, U2, $ LDU2, J1, N1, N2, DWORK, INFO ) C .. Scalar Arguments .. LOGICAL ISHAM, WANTU INTEGER INFO, J1, LDA, LDG, LDU1, LDU2, N, N1, N2 C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), G(LDG,*), U1(LDU1,*), $ U2(LDU2,*)Arguments
Mode Parameters
ISHAM LOGIGAL Specifies the type of X: = .TRUE.: X is a Hamiltonian matrix; = .FALSE.: X is a skew-Hamiltonian matrix. WANTU LOGIGAL = .TRUE.: update the matrices U1 and U2 containing the Schur vectors; = .FALSE.: do not update U1 and U2.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the upper quasi-triangular matrix A, in Schur canonical form. On exit, the leading N-by-N part of this array contains the reordered matrix A, again in Schur canonical form. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). G (input/output) DOUBLE PRECISION array, dimension (LDG,N) On entry, the leading N-by-N part of this array must contain the upper triangular part of the symmetric matrix G, if ISHAM = .TRUE., or the strictly upper triangular part of the skew-symmetric matrix G, otherwise. The rest of this array is not referenced. On exit, the leading N-by-N part of this array contains the upper or strictly upper triangular part of the symmetric or skew-symmetric matrix G, respectively, updated by the orthogonal transformation which reorders A. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,N). U1 (input/output) DOUBLE PRECISION array, dimension (LDU1,N) On entry, if WANTU = .TRUE., the leading N-by-N part of this array must contain the matrix U1. On exit, if WANTU = .TRUE., the leading N-by-N part of this array contains U1, postmultiplied by the orthogonal transformation which reorders A. See the description in the SLICOT subroutine MB03TD for further details. If WANTU = .FALSE., this array is not referenced. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= MAX(1,N), if WANTU = .TRUE.; LDU1 >= 1, otherwise. U2 (input/output) DOUBLE PRECISION array, dimension (LDU2,N) On entry, if WANTU = .TRUE., the leading N-by-N part of this array must contain the matrix U2. On exit, if WANTU = .TRUE., the leading N-by-N part of this array contains U2, postmultiplied by the orthogonal transformation which reorders A. If WANTU = .FALSE., this array is not referenced. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= MAX(1,N), if WANTU = .TRUE.; LDU2 >= 1, otherwise. J1 (input) INTEGER The index of the first row of the first block A11. If J1+N1 < N, then A11 is swapped with the block starting at (J1+N1+1)-th diagonal element. If J1+N1 > N, then A11 is the last block in A and swapped with -A11', if ISHAM = .TRUE., or A11', if ISHAM = .FALSE.. N1 (input) INTEGER The order of the first block A11. N1 = 0, 1 or 2. N2 (input) INTEGER The order of the second block A22. N2 = 0, 1 or 2.Workspace
DWORK DOUBLE PRECISION array, dimension (N)Error Indicator
INFO INTEGER = 0: successful exit; = 1: the transformed matrix A would be too far from Schur form; the blocks are not swapped and A, G, U1 and U2 are unchanged.References
[1] Bai, Z., and Demmel, J.W. On swapping diagonal blocks in real Schur form. Linear Algebra Appl., 186, pp. 73-95, 1993. [2] Benner, P., Kressner, D., and Mehrmann, V. Skew-Hamiltonian and Hamiltonian Eigenvalue Problems: Theory, Algorithms and Applications. Techn. Report, TU Berlin, 2003.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute all, or part, of the singular value decomposition of a real upper triangular matrix. The N-by-N upper triangular matrix A is factored as A = Q*S*P', where Q and P are N-by-N orthogonal matrices and S is an N-by-N diagonal matrix with non-negative diagonal elements, SV(1), SV(2), ..., SV(N), ordered such that SV(1) >= SV(2) >= ... >= SV(N) >= 0. The columns of Q are the left singular vectors of A, the diagonal elements of S are the singular values of A and the columns of P are the right singular vectors of A. Either or both of Q and P' may be requested. When P' is computed, it is returned in A.Specification
SUBROUTINE MB03UD( JOBQ, JOBP, N, A, LDA, Q, LDQ, SV, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBP, JOBQ INTEGER INFO, LDA, LDQ, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), Q(LDQ,*), SV(*)Arguments
Mode Parameters
JOBQ CHARACTER*1 Specifies whether the user wishes to compute the matrix Q of left singular vectors as follows: = 'V': Left singular vectors are computed; = 'N': No left singular vectors are computed. JOBP CHARACTER*1 Specifies whether the user wishes to compute the matrix P' of right singular vectors as follows: = 'V': Right singular vectors are computed; = 'N': No right singular vectors are computed.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix A. On exit, if JOBP = 'V', the leading N-by-N part of this array contains the N-by-N orthogonal matrix P'; otherwise the N-by-N upper triangular part of A is used as internal workspace. The strictly lower triangular part of A is set internally to zero before the reduction to bidiagonal form is performed. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). Q (output) DOUBLE PRECISION array, dimension (LDQ,N) If JOBQ = 'V', the leading N-by-N part of this array contains the orthogonal matrix Q. If JOBQ = 'N', Q is not referenced. LDQ INTEGER The leading dimension of array Q. LDQ >= 1, and when JOBQ = 'V', LDQ >= MAX(1,N). SV (output) DOUBLE PRECISION array, dimension (N) The N singular values of the matrix A, sorted in descending order.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK; if INFO > 0, DWORK(2:N) contains the unconverged superdiagonal elements of an upper bidiagonal matrix B whose diagonal is in SV (not necessarily sorted). B satisfies A = Q*B*P', so it has the same singular values as A, and singular vectors related by Q and P'. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,5*N). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: the QR algorithm has failed to converge. In this case INFO specifies how many superdiagonals did not converge (see the description of DWORK). This failure is not likely to occur.Method
The routine reduces A to bidiagonal form by means of elementary reflectors and then uses the QR algorithm on the bidiagonal form.Further Comments
NoneExample
Program Text
* MB03UD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 10 ) INTEGER LDA, LDQ PARAMETER ( LDA = NMAX, LDQ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, 5*NMAX ) ) * .. Local Scalars .. CHARACTER*1 JOBQ, JOBP INTEGER I, INFO, J, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), Q(LDQ,NMAX), $ SV(NMAX) * .. External Functions .. LOGICAL LSAME * .. External Subroutines .. EXTERNAL MB03UD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, JOBQ, JOBP 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 ) * Compute the singular values and vectors. CALL MB03UD( JOBQ, JOBP, N, A, LDA, Q, LDQ, SV, DWORK, $ LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) WRITE ( NOUT, FMT = 99995 ) ( SV(I), I = 1,N ) IF ( LSAME( JOBP, 'V' ) ) THEN WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE END IF IF ( LSAME( JOBQ, 'V' ) ) THEN WRITE ( NOUT, FMT = 99994 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,N ) 20 CONTINUE END IF END IF END IF * STOP * 99999 FORMAT (' MB03UD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB03UD = ',I2) 99997 FORMAT (' Singular values are ',I5) 99996 FORMAT (/' The transpose of the right singular vectors matrix is ' $ ) 99995 FORMAT (8X,20(1X,F8.4)) 99994 FORMAT (/' The left singular vectors matrix is ') 99993 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB03UD EXAMPLE PROGRAM DATA 4 V V -1.0 37.0 -12.0 -12.0 0.0 -10.0 0.0 4.0 0.0 0.0 7.0 -6.0 0.0 0.0 0.0 -9.0Program Results
MB03UD EXAMPLE PROGRAM RESULTS Singular values are 42.0909 11.7764 5.4420 0.2336 The transpose of the right singular vectors matrix is 0.0230 -0.9084 0.2759 0.3132 0.0075 -0.1272 0.5312 -0.8376 0.0092 0.3978 0.8009 0.4476 0.9997 0.0182 -0.0177 -0.0050 The left singular vectors matrix is -0.9671 -0.0882 -0.0501 -0.2335 0.2456 -0.1765 -0.4020 -0.8643 0.0012 0.7425 0.5367 -0.4008 -0.0670 0.6401 -0.7402 0.1945
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03VD.html 0000664 0000000 0000000 00000032152 14560147231 0020350 0 ustar 00root root 0000000 0000000
Purpose
To reduce a product of p real general matrices A = A_1*A_2*...*A_p to upper Hessenberg form, H = H_1*H_2*...*H_p, where H_1 is upper Hessenberg, and H_2, ..., H_p are upper triangular, by using orthogonal similarity transformations on A, Q_1' * A_1 * Q_2 = H_1, Q_2' * A_2 * Q_3 = H_2, ... Q_p' * A_p * Q_1 = H_p.Specification
SUBROUTINE MB03VD( N, P, ILO, IHI, A, LDA1, LDA2, TAU, LDTAU, $ DWORK, INFO ) C .. Scalar Arguments .. INTEGER IHI, ILO, INFO, LDA1, LDA2, LDTAU, N, P C .. Array Arguments .. DOUBLE PRECISION A( LDA1, LDA2, * ), DWORK( * ), TAU( LDTAU, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the square matrices A_1, A_2, ..., A_p. N >= 0. P (input) INTEGER The number of matrices in the product A_1*A_2*...*A_p. P >= 1. ILO (input) INTEGER IHI (input) INTEGER It is assumed that all matrices A_j, j = 2, ..., p, are already upper triangular in rows and columns 1:ILO-1 and IHI+1:N, and A_1 is upper Hessenberg in rows and columns 1:ILO-1 and IHI+1:N, with A_1(ILO,ILO-1) = 0 (unless ILO = 1), and A_1(IHI+1,IHI) = 0 (unless IHI = N). If this is not the case, ILO and IHI should be set to 1 and N, respectively. 1 <= ILO <= max(1,N); min(ILO,N) <= IHI <= N. A (input/output) DOUBLE PRECISION array, dimension (LDA1,LDA2,P) On entry, the leading N-by-N-by-P part of this array must contain the matrices of factors to be reduced; specifically, A(*,*,j) must contain A_j, j = 1, ..., p. On exit, the leading N-by-N upper triangle and the first subdiagonal of A(*,*,1) contain the upper Hessenberg matrix H_1, and the elements below the first subdiagonal, with the first column of the array TAU represent the orthogonal matrix Q_1 as a product of elementary reflectors. See FURTHER COMMENTS. For j > 1, the leading N-by-N upper triangle of A(*,*,j) contains the upper triangular matrix H_j, and the elements below the diagonal, with the j-th column of the array TAU represent the orthogonal matrix Q_j as a product of elementary reflectors. See FURTHER COMMENTS. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= max(1,N). LDA2 INTEGER The second leading dimension of the array A. LDA2 >= max(1,N). TAU (output) DOUBLE PRECISION array, dimension (LDTAU,P) The leading N-1 elements in the j-th column contain the scalar factors of the elementary reflectors used to form the matrix Q_j, j = 1, ..., P. See FURTHER COMMENTS. LDTAU INTEGER The leading dimension of the array TAU. LDTAU >= max(1,N-1).Workspace
DWORK DOUBLE PRECISION array, dimension (N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The algorithm consists in ihi-ilo major steps. In each such step i, ilo <= i <= ihi-1, the subdiagonal elements in the i-th column of A_j are annihilated using a Householder transformation from the left, which is also applied to A_(j-1) from the right, for j = p:-1:2. Then, the elements below the subdiagonal of the i-th column of A_1 are annihilated, and the Householder transformation is also applied to A_p from the right. See FURTHER COMMENTS.References
[1] Bojanczyk, A.W., Golub, G. 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] Sreedhar, J. and Van Dooren, P. Periodic Schur form and some matrix equations. Proc. of the Symposium on the Mathematical Theory of Networks and Systems (MTNS'93), Regensburg, Germany (U. Helmke, R. Mennicken and J. Saurer, Eds.), Vol. 1, pp. 339-362, 1994.Numerical Aspects
The algorithm is numerically stable.Further Comments
Each matrix Q_j is represented as a product of (ihi-ilo) elementary reflectors, Q_j = H_j(ilo) H_j(ilo+1) . . . H_j(ihi-1). Each H_j(i), i = ilo, ..., ihi-1, has the form H_j(i) = I - tau_j * v_j * v_j', where tau_j is a real scalar, and v_j is a real vector with v_j(1:i) = 0, v_j(i+1) = 1 and v_j(ihi+1:n) = 0; v_j(i+2:ihi) is stored on exit in A_j(i+2:ihi,i), and tau_j in TAU(i,j). The contents of A_1 are illustrated by the following example for n = 7, ilo = 2, and ihi = 6: on entry on exit ( a a a a a a a ) ( a h h h h h a ) ( 0 a a a a a a ) ( 0 h h h h h a ) ( 0 a a a a a a ) ( 0 h h h h h h ) ( 0 a a a a a a ) ( 0 v2 h h h h h ) ( 0 a a a a a a ) ( 0 v2 v3 h h h h ) ( 0 a a a a a a ) ( 0 v2 v3 v4 h h h ) ( 0 0 0 0 0 0 a ) ( 0 0 0 0 0 0 a ) where a denotes an element of the original matrix A_1, h denotes a modified element of the upper Hessenberg matrix H_1, and vi denotes an element of the vector defining H_1(i). The contents of A_j, j > 1, are illustrated by the following example for n = 7, ilo = 2, and ihi = 6: on entry on exit ( a a a a a a a ) ( a h h h h h a ) ( 0 a a a a a a ) ( 0 h h h h h h ) ( 0 a a a a a a ) ( 0 v2 h h h h h ) ( 0 a a a a a a ) ( 0 v2 v3 h h h h ) ( 0 a a a a a a ) ( 0 v2 v3 v4 h h h ) ( 0 a a a a a a ) ( 0 v2 v3 v4 v5 h h ) ( 0 0 0 0 0 0 a ) ( 0 0 0 0 0 0 a ) where a denotes an element of the original matrix A_j, h denotes a modified element of the upper triangular matrix H_j, and vi denotes an element of the vector defining H_j(i). (The element (1,2) in A_p is also unchanged for this example.) Note that for P = 1, the LAPACK Library routine DGEHRD could be more efficient on some computer architectures than this routine (a BLAS 2 version).Example
Program Text
* MB03VD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, PMAX PARAMETER ( NMAX = 20, PMAX = 20 ) INTEGER LDA1, LDA2, LDQ1, LDQ2, LDTAU PARAMETER ( LDA1 = NMAX, LDA2 = NMAX, LDQ1 = NMAX, $ LDQ2 = NMAX, LDTAU = NMAX-1 ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX ) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) * .. Local Scalars .. DOUBLE PRECISION SSQ INTEGER I, IHI, ILO, INFO, J, K, KP1, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA1,LDA2,PMAX), AS(LDA1,LDA2,PMAX), $ DWORK(LDWORK), Q(LDQ1,LDQ2,PMAX), $ QTA(LDQ1,NMAX), TAU(LDTAU,PMAX) * .. External Functions .. DOUBLE PRECISION DLANGE, DLAPY2 EXTERNAL DLANGE, DLAPY2 * .. External Subroutines .. EXTERNAL DGEMM, DLACPY, DLASET, MB03VD, MB03VY * .. Intrinsic Functions .. INTRINSIC MIN * .. Executable Statements .. WRITE (NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, P, ILO, IHI IF ( N.LT.0 .OR. N.GT.MIN( LDA1, LDA2 ) ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99990 ) P ELSE * Read matrices A_1, ..., A_p from the input file. DO 10 K = 1, P READ ( NIN, FMT = * ) $ ( ( A(I,J,K), J = 1, N ), I = 1, N ) CALL DLACPY( 'F', N, N, A(1,1,K), LDA1, AS(1,1,K), LDA1 ) 10 CONTINUE * Reduce to the periodic Hessenberg form. CALL MB03VD( N, P, ILO, IHI, A, LDA1, LDA2, TAU, LDTAU, $ DWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) DO 30 K = 1, P CALL DLACPY( 'L', N, N, A(1,1,K), LDA1, Q(1,1,K), $ LDQ1 ) IF ( N.GT.1 ) THEN IF ( N.GT.2 .AND. K.EQ.1 ) THEN CALL DLASET( 'L', N-2, N-2, ZERO, ZERO, $ A(3,1,K), LDA1 ) ELSE IF ( K.GT.1 ) THEN CALL DLASET( 'L', N-1, N-1, ZERO, ZERO, $ A(2,1,K), LDA1 ) END IF END IF WRITE ( NOUT, FMT = 99995 ) K DO 20 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( A(I,J,K), J = 1, N ) 20 CONTINUE 30 CONTINUE * Accumulate the transformations. CALL MB03VY( N, P, ILO, IHI, Q, LDQ1, LDQ2, TAU, LDTAU, $ DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99993 ) DO 50 K = 1, P WRITE ( NOUT, FMT = 99995 ) K DO 40 I = 1, N WRITE ( NOUT, FMT = 99994 ) $ ( Q(I,J,K), J = 1, N ) 40 CONTINUE 50 CONTINUE * Compute error. SSQ = ZERO DO 60 K = 1, P KP1 = K+1 IF( KP1.GT.P ) KP1 = 1 * Compute NORM (Z' * A * Z - Aout) CALL DGEMM( 'T', 'N', N, N, N, ONE, Q(1,1,K), LDQ1, $ AS(1,1,K), LDA1, ZERO, QTA, LDQ1 ) CALL DGEMM( 'N', 'N', N, N, N, ONE, QTA, LDQ1, $ Q(1,1,KP1), LDQ1, -ONE, A(1,1,K), $ LDA1 ) SSQ = DLAPY2( SSQ, $ DLANGE( 'Frobenius', N, N, A(1,1,K), $ LDA1, DWORK ) ) 60 CONTINUE WRITE ( NOUT, FMT = 99992 ) SSQ END IF END IF END IF END IF STOP 99999 FORMAT (' MB03VD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from MB03VD = ', I2) 99997 FORMAT (' INFO on exit from MB03VY = ', I2) 99996 FORMAT (' Reduced matrices') 99995 FORMAT (/' K = ', I5) 99994 FORMAT (8F8.4) 99993 FORMAT (/' Transformation matrices') 99992 FORMAT (/,' NORM (Q''*A*Q - Aout) = ', 1PD12.5) 99991 FORMAT (/, ' N is out of range.',/' N = ', I5) 99990 FORMAT (/, ' P is out of range.',/' P = ', I5) ENDProgram Data
MB03VD EXAMPLE PROGRAM DATA 4 2 1 4 1.5 -.7 3.5 -.7 1. 0. 2. 3. 1.5 -.7 2.5 -.3 1. 0. 2. 1. 1.5 -.7 3.5 -.7 1. 0. 2. 3. 1.5 -.7 2.5 -.3 1. 0. 2. 1.Program Results
MB03VD EXAMPLE PROGRAM RESULTS Reduced matrices K = 1 -2.3926 2.7042 -0.9598 -1.2335 4.1417 -1.7046 1.3001 -1.3120 0.0000 -1.6247 -0.2534 1.6453 0.0000 0.0000 -0.0169 -0.4451 K = 2 -2.5495 2.3402 4.7021 0.2329 0.0000 1.9725 -0.2483 -2.3493 0.0000 0.0000 -0.6290 -0.5975 0.0000 0.0000 0.0000 -0.4426 Transformation matrices K = 1 1.0000 0.0000 0.0000 0.0000 0.0000 -0.7103 0.5504 -0.4388 0.0000 -0.4735 -0.8349 -0.2807 0.0000 -0.5209 0.0084 0.8536 K = 2 -0.5883 0.2947 0.7528 -0.0145 -0.3922 -0.8070 0.0009 -0.4415 -0.5883 0.4292 -0.6329 -0.2630 -0.3922 -0.2788 -0.1809 0.8577 NORM (Q'*A*Q - Aout) = 2.93760D-15
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03VW.html 0000664 0000000 0000000 00000020674 14560147231 0020401 0 ustar 00root root 0000000 0000000
Purpose
To reduce the generalized matrix product S(1) S(2) S(K) A(:,:,1) * A(:,:,2) * ... * A(:,:,K) to upper Hessenberg-triangular form, where A is N-by-N-by-K and S is the signature array with values 1 or -1. The H-th matrix of A is reduced to upper Hessenberg form while the other matrices are triangularized. Unblocked version. If COMPQ = 'U' or COMPZ = 'I', then the orthogonal factors are computed and stored in the array Q so that for S(I) = 1, T Q(:,:,I)(in) A(:,:,I)(in) Q(:,:,MOD(I,K)+1)(in) T (1) = Q(:,:,I)(out) A(:,:,I)(out) Q(:,:,MOD(I,K)+1)(out) , and for S(I) = -1, T Q(:,:,MOD(I,K)+1)(in) A(:,:,I)(in) Q(:,:,I)(in) T (2) = Q(:,:,MOD(I,K)+1)(out) A(:,:,I)(out) Q(:,:,I)(out) . A partial generation of the orthogonal factors can be realized via the array QIND.Specification
SUBROUTINE MB03VW( COMPQ, QIND, TRIU, N, K, H, ILO, IHI, S, A, $ LDA1, LDA2, Q, LDQ1, LDQ2, IWORK, LIWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, TRIU INTEGER H, IHI, ILO, INFO, K, LDA1, LDA2, LDQ1, LDQ2, $ LDWORK, LIWORK, N C .. Array Arguments .. INTEGER IWORK(*), QIND(*), S(*) DOUBLE PRECISION A(LDA1,LDA2,*), DWORK(LDWORK), Q(LDQ1,LDQ2,*)Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether or not the orthogonal transformations should be accumulated in the array Q, as follows: = 'N': do not modify Q; = 'U': modify (update) the array Q by the orthogonal transformations that are applied to the matrices in the array A to reduce them to periodic Hessenberg- triangular form; = 'I': like COMPQ = 'U', except that each matrix in the array Q will be first initialized to the identity matrix; = 'P': use the parameters as encoded in QIND. QIND INTEGER array, dimension (K) If COMPQ = 'P', then this array describes the generation of the orthogonal factors as follows: If QIND(I) > 0, then the array Q(:,:,QIND(I)) is modified by the transformations corresponding to the i-th orthogonal factor in (1) and (2). If QIND(I) < 0, then the array Q(:,:,-QIND(I)) is initialized to the identity and modified by the transformations corresponding to the i-th orthogonal factor in (1) and (2). If QIND(I) = 0, then the transformations corresponding to the i-th orthogonal factor in (1), (2) are not applied. TRIU CHARACTER*1 Indicates how many matrices are reduced to upper triangular form in the first stage of the algorithm, as follows = 'N': only matrices with negative signature; = 'A': all possible N - 1 matrices. The first choice minimizes the computational costs of the algorithm, whereas the second is more cache efficient and therefore faster on modern architectures.Input/Output Parameters
N (input) INTEGER The order of each factor in the array A. N >= 0. K (input) INTEGER The number of factors. K >= 0. H (input/output) INTEGER On entry, if H is in the interval [1,K] then the H-th factor of A will be transformed to upper Hessenberg form. Otherwise the most efficient H is chosen. On exit, H indicates the factor of A which is in upper Hessenberg form. ILO (input) INTEGER IHI (input) INTEGER It is assumed that each factor in A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. 1 <= ILO <= IHI <= N, if N > 0; ILO = 1 and IHI = 0, if N = 0. If ILO = IHI, all factors are upper triangular. S (input) INTEGER array, dimension (K) The leading K elements of this array must contain the signatures of the factors. Each entry in S must be either 1 or -1. A (input/output) DOUBLE PRECISION array, dimension (LDA1,LDA2,K) On entry, the leading N-by-N-by-K part of this array must contain the factors of the general product to be reduced. On exit, A(:,:,H) is overwritten by an upper Hessenberg matrix and each A(:,:,I), for I not equal to H, is overwritten by an upper triangular matrix. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= MAX(1,N). LDA2 INTEGER The second leading dimension of the array A. LDA2 >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ1,LDQ2,K) On entry, if COMPQ = 'U', the leading N-by-N-by-K part of this array must contain the initial orthogonal factors as described in (1) and (2). On entry, if COMPQ = 'P', only parts of the leading N-by-N-by-K part of this array must contain some orthogonal factors as described by the parameters QIND. If COMPQ = 'I', this array should not be set on entry. On exit, if COMPQ = 'U' or COMPQ = 'I', the leading N-by-N-by-K part of this array contains the modified orthogonal factors as described in (1) and (2). On exit, if COMPQ = 'P', only parts of the leading N-by-N-by-K part contain some modified orthogonal factors as described by the parameters QIND. This array is not referenced if COMPQ = 'N'. LDQ1 INTEGER The first leading dimension of the array Q. LDQ1 >= 1, and, if COMPQ <> 'N', LDQ1 >= MAX(1,N). LDQ2 INTEGER The second leading dimension of the array Q. LDQ2 >= 1, and, if COMPQ <> 'N', LDQ2 >= MAX(1,N).Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = -17, IWORK(1) returns the needed value of LIWORK. LIWORK INTEGER The length of the array IWORK. LIWORK >= MAX(1,3*K). 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 LIWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if MIN(N,K) = 0, or N = 1 or ILO = IHI; LDWORK >= M+MAX(IHI,N-ILO+1)), otherwise, where M = IHI-ILO+1. For optimum performance LDWORK should be larger. If LDWORK = -1 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 is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03VY.html 0000664 0000000 0000000 00000011461 14560147231 0020375 0 ustar 00root root 0000000 0000000
Purpose
To generate the real orthogonal matrices Q_1, Q_2, ..., Q_p, which are defined as the product of ihi-ilo elementary reflectors of order n, as returned by SLICOT Library routine MB03VD: Q_j = H_j(ilo) H_j(ilo+1) . . . H_j(ihi-1).Specification
SUBROUTINE MB03VY( N, P, ILO, IHI, A, LDA1, LDA2, TAU, LDTAU, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER IHI, ILO, INFO, LDA1, LDA2, LDTAU, LDWORK, N, P C .. Array Arguments .. DOUBLE PRECISION A( LDA1, LDA2, * ), DWORK( * ), TAU( LDTAU, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrices Q_1, Q_2, ..., Q_p. N >= 0. P (input) INTEGER The number p of transformation matrices. P >= 1. ILO (input) INTEGER IHI (input) INTEGER The values of the indices ilo and ihi, respectively, used in the previous call of the SLICOT Library routine MB03VD. 1 <= ILO <= max(1,N); min(ILO,N) <= IHI <= N. A (input/output) DOUBLE PRECISION array, dimension (LDA1,LDA2,N) On entry, the leading N-by-N strictly lower triangular part of A(*,*,j) must contain the vectors which define the elementary reflectors used for reducing A_j, as returned by SLICOT Library routine MB03VD, j = 1, ..., p. On exit, the leading N-by-N part of A(*,*,j) contains the N-by-N orthogonal matrix Q_j, j = 1, ..., p. LDA1 INTEGER The first leading dimension of the array A. LDA1 >= max(1,N). LDA2 INTEGER The second leading dimension of the array A. LDA2 >= max(1,N). TAU (input) DOUBLE PRECISION array, dimension (LDTAU,P) The leading N-1 elements in the j-th column must contain the scalar factors of the elementary reflectors used to form the matrix Q_j, as returned by SLICOT Library routine MB03VD. LDTAU INTEGER The leading dimension of the array TAU. LDTAU >= max(1,N-1).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Each matrix Q_j is generated as the product of the elementary reflectors used for reducing A_j. Standard LAPACK routines for Hessenberg and QR decompositions are used.References
[1] Bojanczyk, A.W., Golub, G. 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] Sreedhar, J. and Van Dooren, P. Periodic Schur form and some matrix equations. Proc. of the Symposium on the Mathematical Theory of Networks and Systems (MTNS'93), Regensburg, Germany (U. Helmke, R. Mennicken and J. Saurer, Eds.), Vol. 1, pp. 339-362, 1994.Numerical Aspects
The algorithm is numerically stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To swap adjacent diagonal blocks A11*B11 and A22*B22 of size 1-by-1 or 2-by-2 in an upper (quasi) triangular matrix product A*B by an orthogonal equivalence transformation. (A, B) must be in periodic real Schur canonical form (as returned by SLICOT Library routine MB03XP), i.e., A is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks, and B is upper triangular. Optionally, the matrices Q and Z of generalized Schur vectors are updated. Q(in) * A(in) * Z(in)' = Q(out) * A(out) * Z(out)', Z(in) * B(in) * Q(in)' = Z(out) * B(out) * Q(out)'. This routine is largely based on the LAPACK routine DTGEX2 developed by Bo Kagstrom and Peter Poromaa.Specification
SUBROUTINE MB03WA( WANTQ, WANTZ, N1, N2, A, LDA, B, LDB, Q, LDQ, $ Z, LDZ, INFO ) C .. Scalar Arguments .. LOGICAL WANTQ, WANTZ INTEGER INFO, LDA, LDB, LDQ, LDZ, N1, N2 C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
WANTQ LOGICAL Indicates whether or not the user wishes to accumulate the matrix Q as follows: = .TRUE. : The matrix Q is updated; = .FALSE.: the matrix Q is not required. WANTZ LOGICAL Indicates whether or not the user wishes to accumulate the matrix Z as follows: = .TRUE. : The matrix Z is updated; = .FALSE.: the matrix Z is not required.Input/Output Parameters
N1 (input) INTEGER The order of the first block A11*B11. N1 = 0, 1 or 2. N2 (input) INTEGER The order of the second block A22*B22. N2 = 0, 1 or 2. A (input/output) DOUBLE PRECISION array, dimension (LDA,N1+N2) On entry, the leading (N1+N2)-by-(N1+N2) part of this array must contain the matrix A. On exit, the leading (N1+N2)-by-(N1+N2) part of this array contains the matrix A of the reordered pair. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N1+N2). B (input/output) DOUBLE PRECISION array, dimension (LDB,N1+N2) On entry, the leading (N1+N2)-by-(N1+N2) part of this array must contain the matrix B. On exit, the leading (N1+N2)-by-(N1+N2) part of this array contains the matrix B of the reordered pair. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N1+N2). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N1+N2) On entry, if WANTQ = .TRUE., the leading (N1+N2)-by-(N1+N2) part of this array must contain the orthogonal matrix Q. On exit, the leading (N1+N2)-by-(N1+N2) part of this array contains the updated matrix Q. Q will be a rotation matrix for N1=N2=1. This array is not referenced if WANTQ = .FALSE.. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1. If WANTQ = .TRUE., LDQ >= N1+N2. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N1+N2) On entry, if WANTZ = .TRUE., the leading (N1+N2)-by-(N1+N2) part of this array must contain the orthogonal matrix Z. On exit, the leading (N1+N2)-by-(N1+N2) part of this array contains the updated matrix Z. Z will be a rotation matrix for N1=N2=1. This array is not referenced if WANTZ = .FALSE.. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1. If WANTZ = .TRUE., LDZ >= N1+N2.Error Indicator
INFO INTEGER = 0: successful exit; = 1: the transformed matrix (A, B) would be too far from periodic Schur form; the blocks are not swapped and (A,B) and (Q,Z) are unchanged.Method
In the current code both weak and strong stability tests are performed. The user can omit the strong stability test by changing the internal logical parameter WANDS to .FALSE.. See ref. [2] for details.References
[1] Kagstrom, B. A direct method for reordering eigenvalues in the generalized real Schur form of a regular matrix pair (A,B), in M.S. Moonen et al (eds.), Linear Algebra for Large Scale and Real-Time Applications, Kluwer Academic Publ., 1993, pp. 195-218. [2] Kagstrom, B., and Poromaa, P. Computing eigenspaces with specified eigenvalues of a regular matrix pair (A, B) and condition estimation: Theory, algorithms and software, Numer. Algorithms, 1996, vol. 12, pp. 369-407.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the Schur decomposition and the eigenvalues of a product of matrices, H = H_1*H_2*...*H_p, with H_1 an upper Hessenberg matrix and H_2, ..., H_p upper triangular matrices, without evaluating the product. Specifically, the matrices Z_i are computed, such that Z_1' * H_1 * Z_2 = T_1, Z_2' * H_2 * Z_3 = T_2, ... Z_p' * H_p * Z_1 = T_p, where T_1 is in real Schur form, and T_2, ..., T_p are upper triangular. The routine works primarily with the Hessenberg and triangular submatrices in rows and columns ILO to IHI, but optionally applies the transformations to all the rows and columns of the matrices H_i, i = 1,...,p. The transformations can be optionally accumulated.Specification
SUBROUTINE MB03WD( JOB, COMPZ, N, P, ILO, IHI, ILOZ, IHIZ, H, $ LDH1, LDH2, Z, LDZ1, LDZ2, WR, WI, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPZ, JOB INTEGER IHI, IHIZ, ILO, ILOZ, INFO, LDH1, LDH2, LDWORK, $ LDZ1, LDZ2, N, P C .. Array Arguments .. DOUBLE PRECISION DWORK( * ), H( LDH1, LDH2, * ), WI( * ), $ WR( * ), Z( LDZ1, LDZ2, * )Arguments
Mode Parameters
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 T_1, ..., T_p of the full Schur form, T = T_1*T_2*...*T_p. COMPZ CHARACTER*1 Indicates whether or not the user wishes to accumulate the matrices Z_1, ..., Z_p, as follows: = 'N': The matrices Z_1, ..., Z_p are not required; = 'I': Z_i is initialized to the unit matrix and the orthogonal transformation matrix Z_i is returned, i = 1, ..., p; = 'V': Z_i must contain an orthogonal matrix Q_i on entry, and the product Q_i*Z_i is returned, i = 1, ..., p.Input/Output Parameters
N (input) INTEGER The order of the matrix H. N >= 0. P (input) INTEGER The number of matrices in the product H_1*H_2*...*H_p. P >= 1. ILO (input) INTEGER IHI (input) INTEGER It is assumed that all matrices H_j, j = 2, ..., p, are already upper triangular in rows and columns 1:ILO-1 and IHI+1:N, and H_1 is upper quasi-triangular in rows and columns 1:ILO-1 and IHI+1:N, with H_1(ILO,ILO-1) = 0 (unless ILO = 1), and H_1(IHI+1,IHI) = 0 (unless IHI = N). The routine works primarily with the Hessenberg submatrix in rows and columns ILO to IHI, but applies the transformations to all the rows and columns of the matrices H_i, i = 1,...,p, if JOB = 'S'. 1 <= ILO <= max(1,N); min(ILO,N) <= IHI <= N. ILOZ (input) INTEGER IHIZ (input) INTEGER Specify the rows of Z to which the transformations must be applied if COMPZ = 'I' or COMPZ = 'V'. 1 <= ILOZ <= ILO; IHI <= IHIZ <= N. H (input/output) DOUBLE PRECISION array, dimension (LDH1,LDH2,P) On entry, the leading N-by-N part of H(*,*,1) must contain the upper Hessenberg matrix H_1 and the leading N-by-N part of H(*,*,j) for j > 1 must contain the upper triangular matrix H_j, j = 2, ..., p. On exit, if JOB = 'S', the leading N-by-N part of H(*,*,1) is upper quasi-triangular in rows and columns ILO:IHI, with any 2-by-2 diagonal blocks corresponding to a pair of complex conjugated eigenvalues, and the leading N-by-N part of H(*,*,j) for j > 1 contains the resulting upper triangular matrix T_j. If JOB = 'E', the contents of H are unspecified on exit. LDH1 INTEGER The first leading dimension of the array H. LDH1 >= max(1,N). LDH2 INTEGER The second leading dimension of the array H. LDH2 >= max(1,N). Z (input/output) DOUBLE PRECISION array, dimension (LDZ1,LDZ2,P) On entry, if COMPZ = 'V', the leading N-by-N-by-P part of this array must contain the current matrix Q of transformations accumulated by SLICOT Library routine MB03VY. If COMPZ = 'I', Z need not be set on entry. On exit, if COMPZ = 'V', or COMPZ = 'I', the leading N-by-N-by-P part of this array contains the transformation matrices which produced the Schur form; the transformations are applied only to the submatrices Z_j(ILOZ:IHIZ,ILO:IHI), j = 1, ..., P. If COMPZ = 'N', Z is not referenced. LDZ1 INTEGER The first leading dimension of the array Z. LDZ1 >= 1, if COMPZ = 'N'; LDZ1 >= max(1,N), if COMPZ = 'I' or COMPZ = 'V'. LDZ2 INTEGER The second leading dimension of the array Z. LDZ2 >= 1, if COMPZ = 'N'; LDZ2 >= max(1,N), if COMPZ = 'I' or COMPZ = 'V'. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) The real and imaginary parts, respectively, of the computed eigenvalues ILO to IHI are stored in the corresponding elements of WR and WI. If two eigenvalues are computed as a complex conjugate pair, they are stored in consecutive elements of WR and WI, say the i-th and (i+1)th, with WI(i) > 0 and WI(i+1) < 0. If JOB = 'S', the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in H.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= IHI-ILO+P-1.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, ILO <= i <= IHI, the QR algorithm failed to compute all the eigenvalues ILO to IHI in a total of 30*(IHI-ILO+1) iterations; the elements i+1:IHI of WR and WI contain those eigenvalues which have been successfully computed.Method
A refined version of the QR algorithm proposed in [1] and [2] is used. The elements of the subdiagonal, diagonal, and the first supradiagonal of current principal submatrix of H are computed in the process.References
[1] Bojanczyk, A.W., Golub, G. 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] Sreedhar, J. and Van Dooren, P. Periodic Schur form and some matrix equations. Proc. of the Symposium on the Mathematical Theory of Networks and Systems (MTNS'93), Regensburg, Germany (U. Helmke, R. Mennicken and J. Saurer, Eds.), Vol. 1, pp. 339-362, 1994.Numerical Aspects
The algorithm is numerically stable.Further Comments
Note that for P = 1, the LAPACK Library routine DHSEQR could be more efficient on some computer architectures than this routine, because DHSEQR uses a block multishift QR algorithm. When P is large and JOB = 'S', it could be more efficient to compute the product matrix H, and use the LAPACK Library routines.Example
Program Text
* MB03WD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, PMAX PARAMETER ( NMAX = 20, PMAX = 20 ) INTEGER LDA1, LDA2, LDTAU, LDZ1, LDZ2, LDZTA PARAMETER ( LDA1 = NMAX, LDA2 = NMAX, LDTAU = NMAX-1, $ LDZ1 = NMAX, LDZ2 = NMAX, LDZTA = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX, NMAX + PMAX - 2 ) ) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) * .. Local Scalars .. DOUBLE PRECISION SSQ INTEGER I, IHI, IHIZ, ILO, ILOZ, INFO, J, K, KP1, N, P CHARACTER COMPZ, JOB * .. Local Arrays .. DOUBLE PRECISION A(LDA1,LDA2,PMAX), AS(LDA1,LDA2,PMAX), $ DWORK(LDWORK), TAU(LDTAU,PMAX), WI(NMAX), $ WR(NMAX), Z(LDZ1,LDZ2,PMAX), ZTA(LDZTA,NMAX) * .. External Functions .. DOUBLE PRECISION DLANGE, DLAPY2 LOGICAL LSAME EXTERNAL DLANGE, DLAPY2, LSAME * .. External Subroutines .. EXTERNAL DGEMM, DLACPY, MB03VD, MB03VY, MB03WD, MB03WX * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. WRITE (NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, P, ILO, IHI, ILOZ, IHIZ, JOB, COMPZ IF ( N.LT.0 .OR. N.GT.MIN( LDA1, LDA2 ) ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99987 ) P ELSE * Read matrices A_1, ..., A_p from the input file. DO 10 K = 1, P READ ( NIN, FMT = * ) $ ( ( A(I,J,K), J = 1, N ), I = 1, N ) CALL DLACPY( 'F', N, N, A(1,1,K), LDA1, AS(1,1,K), LDA1 ) 10 CONTINUE * Reduce to the periodic Hessenberg form. CALL MB03VD( N, P, ILO, IHI, A, LDA1, LDA2, TAU, LDTAU, $ DWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE IF ( LSAME( COMPZ, 'V' ) ) THEN DO 20 K = 1, P CALL DLACPY( 'L', N, N, A(1,1,K), LDA1, Z(1,1,K), $ LDZ1 ) 20 CONTINUE * Accumulate the transformations. CALL MB03VY( N, P, ILO, IHI, Z, LDZ1, LDZ2, TAU, $ LDTAU, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99996 ) INFO STOP ELSE * Reduce to the periodic Schur form. CALL MB03WD( JOB, COMPZ, N, P, ILO, IHI, ILOZ, $ IHIZ, A, LDA1, LDA2, Z, LDZ1, LDZ2, $ WR, WI, DWORK, LDWORK, INFO ) IF ( INFO.GT.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO WRITE ( NOUT, FMT = 99991 ) DO 30 I = MAX( ILO, INFO + 1 ), IHI WRITE ( NOUT, FMT = 99990 ) WR(I), WI(I) 30 CONTINUE STOP END IF IF ( INFO.LT.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE * Store the isolated eigenvalues. CALL MB03WX( ILO-1, P, A, LDA1, LDA2, WR, WI, $ INFO ) IF ( IHI.LT.N ) $ CALL MB03WX( N-IHI, P, A(IHI+1,IHI+1,1), $ LDA1, LDA2, WR(IHI+1), $ WI(IHI+1), INFO ) WRITE ( NOUT, FMT = 99991 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99990 ) WR(I), WI(I) 40 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 60 K = 1, P WRITE ( NOUT, FMT = 99994 ) K DO 50 I = 1, N WRITE ( NOUT, FMT = 99993 ) $ ( A(I,J,K), J = 1, N ) 50 CONTINUE 60 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 80 K = 1, P WRITE ( NOUT, FMT = 99994 ) K DO 70 I = 1, N WRITE ( NOUT, FMT = 99993 ) $ ( Z(I,J,K), J = 1, N ) 70 CONTINUE 80 CONTINUE * Compute error. SSQ = ZERO DO 90 K = 1, P KP1 = K+1 IF( KP1.GT.P ) KP1 = 1 * Compute NORM (Z' * A * Z - Aout) CALL DGEMM( 'T', 'N', N, N, N, ONE, Z(1,1,K), $ LDZ1, AS(1,1,K), LDA1, ZERO, ZTA, $ LDZTA ) CALL DGEMM( 'N', 'N', N, N, N, ONE, ZTA, $ LDZTA, Z(1,1,KP1), LDZ1, -ONE, $ A(1,1,K), LDA1 ) SSQ = DLAPY2( SSQ, $ DLANGE( 'Frobenius', N, N, $ A(1,1,K), LDA1, $ DWORK ) ) 90 CONTINUE WRITE ( NOUT, FMT = 99989 ) SSQ END IF END IF END IF END IF END IF END IF STOP 99999 FORMAT (' MB03WD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from MB03WD = ', I2) 99997 FORMAT (' INFO on exit from MB03VD = ', I2) 99996 FORMAT (' INFO on exit from MB03VY = ', I2) 99995 FORMAT (/' Reduced matrices') 99994 FORMAT (/' K = ', I5) 99993 FORMAT (8F8.4) 99992 FORMAT (/' Transformation matrices') 99991 FORMAT ( ' Computed eigenvalues'/) 99990 FORMAT (4X,'( ', F17.6,' ,', F17.6,' )') 99989 FORMAT (/,' NORM (Z''*A*Z - Aout) = ', 1PD12.5) 99988 FORMAT (/, ' N is out of range.',/' N = ', I5) 99987 FORMAT (/, ' P is out of range.',/' P = ', I5) ENDProgram Data
MB03WD EXAMPLE PROGRAM DATA 4 2 1 4 1 4 S V 1.5 -.7 3.5 -.7 1. 0. 2. 3. 1.5 -.7 2.5 -.3 1. 0. 2. 1. 1.5 -.7 3.5 -.7 1. 0. 2. 3. 1.5 -.7 2.5 -.3 1. 0. 2. 1.Program Results
MB03WD EXAMPLE PROGRAM RESULTS Computed eigenvalues ( 6.449861 , 7.817717 ) ( 6.449861 , -7.817717 ) ( 0.091315 , 0.000000 ) ( 0.208964 , 0.000000 ) Reduced matrices K = 1 2.2112 4.3718 -2.3362 0.8907 -0.9179 2.7688 -0.6570 -2.2426 0.0000 0.0000 0.3022 0.1932 0.0000 0.0000 0.0000 -0.4571 K = 2 2.9169 3.4539 2.2016 1.2367 0.0000 3.4745 1.0209 -2.0720 0.0000 0.0000 0.3022 -0.1932 0.0000 0.0000 0.0000 -0.4571 Transformation matrices K = 1 0.3493 0.6751 -0.6490 0.0327 0.7483 -0.4863 -0.1249 -0.4336 0.2939 0.5504 0.7148 -0.3158 0.4813 -0.0700 0.2286 0.8433 K = 2 0.2372 0.7221 0.6490 0.0327 0.8163 -0.3608 0.1249 -0.4336 0.2025 0.5902 -0.7148 -0.3158 0.4863 0.0076 -0.2286 0.8433 NORM (Z'*A*Z - Aout) = 7.18432D-15
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03WX.html 0000664 0000000 0000000 00000005524 14560147231 0020400 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of a product of matrices, T = T_1*T_2*...*T_p, where T_1 is an upper quasi-triangular matrix and T_2, ..., T_p are upper triangular matrices.Specification
SUBROUTINE MB03WX( N, P, T, LDT1, LDT2, WR, WI, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDT1, LDT2, N, P C .. Array Arguments .. DOUBLE PRECISION T( LDT1, LDT2, * ), WI( * ), WR( * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix T. N >= 0. P (input) INTEGER The number of matrices in the product T_1*T_2*...*T_p. P >= 1. T (input) DOUBLE PRECISION array, dimension (LDT1,LDT2,P) The leading N-by-N part of T(*,*,1) must contain the upper quasi-triangular matrix T_1 and the leading N-by-N part of T(*,*,j) for j > 1 must contain the upper-triangular matrix T_j, j = 2, ..., p. The elements below the subdiagonal of T(*,*,1) and below the diagonal of T(*,*,j), j = 2, ..., p, are not referenced. LDT1 INTEGER The first leading dimension of the array T. LDT1 >= max(1,N). LDT2 INTEGER The second leading dimension of the array T. LDT2 >= max(1,N). WR, WI (output) DOUBLE PRECISION arrays, dimension (N) The real and imaginary parts, respectively, of the eigenvalues of T. The eigenvalues are stored in the same order as on the diagonal of T_1. If T(i:i+1,i:i+1,1) is a 2-by-2 diagonal block with complex conjugated eigenvalues then WI(i) > 0 and WI(i+1) = -WI(i).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the eigenvalues of a Hamiltonian matrix, [ A G ] T T H = [ T ], G = G, Q = Q, (1) [ Q -A ] where A, G and Q are real n-by-n matrices. Due to the structure of H all eigenvalues appear in pairs (lambda,-lambda). This routine computes the eigenvalues of H using an algorithm based on the symplectic URV and the periodic Schur decompositions as described in [1], T [ T G ] U H V = [ T ], (2) [ 0 S ] where U and V are 2n-by-2n orthogonal symplectic matrices, S is in real Schur form and T is upper triangular. The algorithm is backward stable and preserves the eigenvalue pairings in finite precision arithmetic. Optionally, a symplectic balancing transformation to improve the conditioning of eigenvalues is computed (see MB04DD). In this case, the matrix H in decomposition (2) must be replaced by the balanced matrix. The SLICOT Library routine MB03ZD can be used to compute invariant subspaces of H from the output of this routine.Specification
SUBROUTINE MB03XD( BALANC, JOB, JOBU, JOBV, N, A, LDA, QG, LDQG, $ T, LDT, U1, LDU1, U2, LDU2, V1, LDV1, V2, LDV2, $ WR, WI, ILO, SCALE, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER BALANC, JOB, JOBU, JOBV INTEGER ILO, INFO, LDA, LDQG, LDT, LDU1, LDU2, LDV1, $ LDV2, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), QG(LDQG,*), SCALE(*), $ T(LDT,*), U1(LDU1,*), U2(LDU2,*), V1(LDV1,*), $ V2(LDV2,*), WI(*), WR(*)Arguments
Mode Parameters
BALANC CHARACTER*1 Indicates how H should be diagonally scaled and/or permuted to reduce its norm. = 'N': Do not diagonally scale or permute; = 'P': Perform symplectic permutations to make the matrix closer to Hamiltonian Schur form. Do not diagonally scale; = 'S': Diagonally scale the matrix, i.e., replace A, G and Q by D*A*D**(-1), D*G*D and D**(-1)*Q*D**(-1) where D is a diagonal matrix chosen to make the rows and columns of H more equal in norm. Do not permute; = 'B': Both diagonally scale and permute A, G and Q. Permuting does not change the norm of H, but scaling does. JOB CHARACTER*1 Indicates whether the user wishes to compute the full decomposition (2) or the eigenvalues only, as follows: = 'E': compute the eigenvalues only; = 'S': compute matrices T and S of (2); = 'G': compute matrices T, S and G of (2). JOBU CHARACTER*1 Indicates whether or not the user wishes to compute the orthogonal symplectic matrix U of (2) as follows: = 'N': the matrix U is not computed; = 'U': the matrix U is computed. JOBV CHARACTER*1 Indicates whether or not the user wishes to compute the orthogonal symplectic matrix V of (2) as follows: = 'N': the matrix V is not computed; = 'V': the matrix V is computed.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 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, this array is overwritten. If JOB = 'S' or JOB = 'G', the leading N-by-N part of this array contains the matrix S in real Schur form of decomposition (2). LDA INTEGER The leading dimension of the array A. LDA >= 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 lower triangular part of the matrix Q and in columns 2:N+1 the upper triangular part of the matrix G. On exit, this array is overwritten. If JOB = 'G', the leading N-by-N+1 part of this array contains in columns 2:N+1 the matrix G of decomposition (2). LDQG INTEGER The leading dimension of the array QG. LDQG >= max(1,N). T (output) DOUBLE PRECISION array, dimension (LDT,N) On exit, if JOB = 'S' or JOB = 'G', the leading N-by-N part of this array contains the upper triangular matrix T of the decomposition (2). Otherwise, this array is used as workspace. LDT INTEGER The leading dimension of the array T. LDT >= MAX(1,N). U1 (output) DOUBLE PRECISION array, dimension (LDU1,N) On exit, if JOBU = 'U', the leading N-by-N part of this array contains the (1,1) block of the orthogonal symplectic matrix U of decomposition (2). LDU1 INTEGER The leading dimension of the array U1. LDU1 >= 1. LDU1 >= N, if JOBU = 'U'. U2 (output) DOUBLE PRECISION array, dimension (LDU2,N) On exit, if JOBU = 'U', the leading N-by-N part of this array contains the (2,1) block of the orthogonal symplectic matrix U of decomposition (2). LDU2 INTEGER The leading dimension of the array U2. LDU2 >= 1. LDU2 >= N, if JOBU = 'U'. V1 (output) DOUBLE PRECISION array, dimension (LDV1,N) On exit, if JOBV = 'V', the leading N-by-N part of this array contains the (1,1) block of the orthogonal symplectic matrix V of decomposition (2). LDV1 INTEGER The leading dimension of the array V1. LDV1 >= 1. LDV1 >= N, if JOBV = 'V'. V2 (output) DOUBLE PRECISION array, dimension (LDV2,N) On exit, if JOBV = 'V', the leading N-by-N part of this array contains the (2,1) block of the orthogonal symplectic matrix V of decomposition (2). LDV2 INTEGER The leading dimension of the array V2. LDV2 >= 1. LDV2 >= N, if JOBV = 'V'. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) On exit, the leading N elements of WR and WI contain the real and imaginary parts, respectively, of N eigenvalues that have nonnegative imaginary part. Their complex conjugate eigenvalues are not stored. If imaginary parts are zero (i.e., for real eigenvalues), only positive eigenvalues are stored. ILO (output) INTEGER ILO is an integer value determined when H was balanced. The balanced A(i,j) = 0 if I > J and J = 1,...,ILO-1. The balanced Q(i,j) = 0 if J = 1,...,ILO-1 or I = 1,...,ILO-1. SCALE (output) DOUBLE PRECISION array, dimension (N) On exit, if BALANC <> 'N', the leading N elements of this array contain details of the permutation and/or scaling factors applied when balancing H, see MB04DD. This array is not referenced if BALANC = 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and DWORK(2) returns the 1-norm of the scaled (if BALANC = 'S' or 'B') Hamiltonian matrix. On exit, if INFO = -25, DWORK(1) returns the minimum value of LDWORK. LDWORK (input) INTEGER The dimension of the array DWORK. LDWORK >= max( 2, 8*N ). Moreover: If JOB = 'E' or 'S' and JOBU = 'N' and JOBV = 'N', LDWORK >= 7*N+N*N. If JOB = 'G' and JOBU = 'N' and JOBV = 'N', LDWORK >= max( 7*N+N*N, 2*N+3*N*N ). If JOB = 'G' and JOBU = 'U' and JOBV = 'N', LDWORK >= 7*N+2*N*N. If JOB = 'G' and JOBU = 'N' and JOBV = 'V', LDWORK >= 7*N+2*N*N. If JOB = 'G' and JOBU = 'U' and JOBV = 'V', LDWORK >= 7*N+N*N. 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.Error Indicator
INFO (output) INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, the periodic QR algorithm failed to compute all the eigenvalues, elements i+1:N of WR and WI contain eigenvalues which have converged.References
[1] Benner, P., Mehrmann, V., and Xu, H. A numerically stable, structure preserving method for computing the eigenvalues of real Hamiltonian or symplectic pencils. Numer. Math., Vol. 78(3), pp. 329-358, 1998. [2] Benner, P., Mehrmann, V., and Xu, H. A new method for computing the stable invariant subspace of a real Hamiltonian matrix, J. Comput. Appl. Math., vol. 86, pp. 17-43, 1997.Further Comments
NoneExample
Program Text
* MB03XD 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 = 100 ) INTEGER LDA, LDQG, LDRES, LDT, LDU1, LDU2, LDV1, LDV2, $ LDWORK PARAMETER ( LDA = NMAX, LDQG = NMAX, LDRES = NMAX, $ LDT = NMAX, LDU1 = NMAX, LDU2 = NMAX, $ LDV1 = NMAX, LDV2 = NMAX, $ LDWORK = 3*NMAX*NMAX + 7*NMAX ) * .. Local Scalars .. CHARACTER*1 BALANC, JOB, JOBU, JOBV INTEGER I, ILO, INFO, J, N DOUBLE PRECISION TEMP * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), DWORK(LDWORK), QG(LDQG, NMAX+1), $ RES(LDRES,3*NMAX+1), SCALE(NMAX), T(LDT,NMAX), $ U1(LDU1,NMAX), U2(LDU2, NMAX), V1(LDV1,NMAX), $ V2(LDV2, NMAX), WI(NMAX), WR(NMAX) * .. External Functions .. LOGICAL LSAME DOUBLE PRECISION DLANGE, DLAPY2, MA02JD EXTERNAL DLANGE, DLAPY2, LSAME, MA02JD * .. External Subroutines .. EXTERNAL DGEMM, DLACPY, MB03XD, MB04DD * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, BALANC, JOB, JOBU, JOBV IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) 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 = * ) ( ( QG(I,J), J = 1,N+1 ), I = 1,N ) CALL DLACPY( 'All', N, N+1, QG, LDQG, RES(1,2*N+1), LDRES ) INFO = 0 CALL MB03XD( BALANC, JOB, JOBU, JOBV, N, A, LDA, QG, LDQG, $ T, LDT, U1, LDU1, U2, LDU2, V1, LDV1, V2, LDV2, $ WR, WI, ILO, SCALE, 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 ) I, WR(I), WI(I) 20 CONTINUE IF ( LSAME( JOB, 'S' ).OR.LSAME( JOB, 'G' ) ) THEN WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99990 ) ( A(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99990 ) ( T(I,J), J = 1,N ) 40 CONTINUE END IF IF ( LSAME( JOB, 'G' ) ) THEN WRITE ( NOUT, FMT = 99993 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99990 ) ( QG(I,J+1), J = 1,N ) 50 CONTINUE END IF C IF ( LSAME( JOB, 'G' ).AND.LSAME( JOBU, 'U' ).AND. $ LSAME( JOBV, 'V' ) ) THEN CALL MB04DD( BALANC, N, RES(1,N+1), LDRES, RES(1,2*N+1), $ LDRES, I, DWORK, INFO ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ RES(1,N+1), LDRES, V1, LDV1, ZERO, RES, $ LDRES ) CALL DSYMM ( 'Left', 'Upper', N, N, -ONE, RES(1,2*N+2), $ LDRES, V2, LDV2, ONE, RES, LDRES ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, $ -ONE, U1, LDU1, T, LDT, ONE, RES, LDRES ) TEMP = DLANGE( 'Frobenius', N, N, RES, LDRES, DWORK ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ RES(1,N+1), LDRES, V2, LDV2, ZERO, RES, $ LDRES ) CALL DSYMM( 'Left', 'Upper', N, N, ONE, RES(1,2*N+2), $ LDRES, V1, LDV1, ONE, RES, LDRES ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, $ -ONE, U1, LDU1, QG(1,2), LDQG, ONE, RES, $ LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, $ -ONE, U2, LDU2, A, LDA, ONE, RES, LDRES ) TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES, $ LDRES, DWORK ) ) CALL DSYMM( 'Left', 'Lower', N, N, ONE, RES(1,2*N+1), $ LDRES, V1, LDV1, ZERO, RES, LDRES ) CALL DGEMM( 'Transpose', 'No Transpose', N, N, N, ONE, $ RES(1,N+1), LDRES, V2, LDV2, ONE, RES, $ LDRES ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ U2, LDU2, T, LDT, ONE, RES, LDRES ) TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES, $ LDRES, DWORK ) ) CALL DSYMM( 'Left', 'Lower', N, N, ONE, RES(1,2*N+1), $ LDRES, V2, LDV2, ZERO, RES, LDRES ) CALL DGEMM( 'Transpose', 'No Transpose', N, N, N, -ONE, $ RES(1,N+1), LDRES, V1, LDV1, ONE, RES, $ LDRES ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ U2, LDU2, QG(1,2), LDQG, ONE, RES, LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, $ -ONE, U1, LDU1, A, LDA, ONE, RES, LDRES ) TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES, $ LDRES, DWORK ) ) WRITE ( NOUT, FMT = 99987 ) TEMP END IF C IF ( LSAME( JOBU, 'U' ) ) THEN WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99990 ) $ ( U1(I,J), J = 1,N ), ( U2(I,J), J = 1,N ) 60 CONTINUE DO 70 I = 1, N WRITE ( NOUT, FMT = 99990 ) $ ( -U2(I,J), J = 1,N ), ( U1(I,J), J = 1,N ) 70 CONTINUE WRITE ( NOUT, FMT = 99986 ) MA02JD( .FALSE., .FALSE., N, $ U1, LDU1, U2, LDU2, RES, LDRES ) END IF IF ( LSAME( JOBV, 'V' ) ) THEN WRITE ( NOUT, FMT = 99991 ) DO 80 I = 1, N WRITE ( NOUT, FMT = 99990 ) $ ( V1(I,J), J = 1,N ), ( V2(I,J), J = 1,N ) 80 CONTINUE DO 90 I = 1, N WRITE ( NOUT, FMT = 99990 ) $ ( -V2(I,J), J = 1,N ), ( V1(I,J), J = 1,N ) 90 CONTINUE WRITE ( NOUT, FMT = 99985 ) MA02JD( .FALSE., .FALSE., N, $ V1, LDV1, V2, LDV2, RES, LDRES ) END IF IF ( LSAME( BALANC, 'S' ).OR.LSAME( BALANC, 'B' ) ) THEN WRITE ( NOUT, FMT = 99989 ) DO 100 I = 1, N WRITE ( NOUT, FMT = 99996 ) I, SCALE(I) 100 CONTINUE END IF END IF END IF * 99999 FORMAT (' MB03XD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB03XD = ',I2) 99997 FORMAT (' The eigenvalues are',//' i',6X, $ 'WR(i)',6X,'WI(i)',/) 99996 FORMAT (I4,3X,F8.4,3X,F8.4) 99995 FORMAT (/' The matrix S of the reduced matrix is') 99994 FORMAT (/' The matrix T of the reduced matrix is') 99993 FORMAT (/' The matrix G of the reduced matrix is') 99992 FORMAT (/' The orthogonal symplectic factor U is') 99991 FORMAT (/' The orthogonal symplectic factor V is') 99990 FORMAT (20(1X,F19.16)) 99989 FORMAT (/' The diagonal scaling factors are ',//' i',6X, $ 'SCALE(i)',/) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' Residual: || H*V - U*R ||_F = ',G7.2) 99986 FORMAT (/' Orthogonality of U: || U^T U - I ||_F = ',G7.2) 99985 FORMAT (/' Orthogonality of V: || V^T V - I ||_F = ',G7.2) ENDProgram Data
MB03XD EXAMPLE PROGRAM DATA 5 N G U V 3.7588548168313685e-001 9.1995720669587144e-001 1.9389317998466821e-001 5.4878212553858818e-001 6.2731478808399666e-001 9.8764628987858052e-003 8.4472150190817474e-001 9.0481233416635698e-001 9.3158335257969060e-001 6.9908013774533750e-001 4.1985780631021896e-001 3.6775288246828447e-001 5.6920574967174709e-001 3.3519743020639464e-001 3.9718395379261456e-001 7.5366962581358721e-001 6.2080133182114383e-001 6.3178992922175603e-001 6.5553105501201447e-001 4.1362889533818031e-001 7.9387177473231862e-001 7.3127726446634478e-001 2.3441295540825388e-001 3.9190420688900335e-001 6.5521294635567051e-001 1.8015558545989005e-001 4.1879254941592853e-001 2.7203760737317784e-001 2.8147214090719214e-001 1.7731904815580199e-001 3.4718672159409536e-001 2.7989257702981651e-001 3.5042861661866559e-001 2.5565572408444881e-001 4.3977750345993827e-001 2.8855026075967616e-001 2.1496327083014577e-001 1.7341073886969158e-001 3.9913855375815932e-001 4.0151317011596516e-001 4.0331887464437133e-001 2.6723538667317948e-001 3.7110275606849241e-001 3.7832182695699140e-001 3.3812641389556752e-001 8.4360396433341395e-002 4.3672540277019672e-001 7.0022228267365608e-002 3.8210230186291916e-001 1.9548216143135175e-001 2.9055490787446736e-001 4.7670819669167425e-001 1.4636498713707141e-001 2.7670398401519275e-001 2.9431082727794898e-002Program Results
MB03XD EXAMPLE PROGRAM RESULTS The eigenvalues are i WR(i) WI(i) 1 3.1941 0.0000 2 0.1350 0.3179 3 -0.1350 0.3179 4 0.0595 0.2793 5 -0.0595 0.2793 The matrix S of the reduced matrix is -3.1844761777714723 0.1612357243439330 -0.0628592203751083 0.2449004200921966 0.1974400149992633 0.0000000000000000 -0.1510667773167795 0.4260444411622876 -0.1775026035208666 0.3447278421198404 0.0000000000000000 -0.1386140422054281 -0.3006779624777419 0.2944143257134117 0.3456440339120381 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.2710128384740589 0.0933189808067083 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.4844146572359630 0.2004347508746724 The matrix T of the reduced matrix is 3.2038208121776366 0.1805955192510636 0.2466389119377562 -0.2539149302433404 -0.0359238844381174 0.0000000000000000 -0.7196686433290822 0.0000000000000000 0.2428659121580382 -0.0594190100670709 0.0000000000000000 0.0000000000000000 -0.1891741194498124 -0.3309578443491325 -0.0303520731950498 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.4361574461961496 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.1530894573304220 The matrix G of the reduced matrix is -0.0370982242678458 0.0917788436945730 -0.0560402416315236 0.1345152517579191 0.0256668227276665 0.0652183678916926 -0.0700457231988328 0.0350041175858816 -0.2233868768749277 -0.1171980260782820 -0.0626428681377074 0.2327575351902838 -0.1251515732208133 -0.0177816046663209 0.3696921118421109 0.0746042309265569 -0.0828007611045243 0.0217427473546003 -0.1157775118548850 -0.3161183681200607 0.1374372236164838 0.1002727885506978 0.4021556774753987 -0.0431072263235625 0.1067394572547804 Residual: || H*V - U*R ||_F = .38E-14 The orthogonal symplectic factor U is 0.3806883009357249 -0.0347810363019666 -0.5014665065895627 0.5389691288472425 0.2685446895251499 -0.1795922007470744 0.1908329820840935 0.0868799433942041 0.3114741142062469 -0.2579907627915116 0.4642712665555327 -0.5942766860716397 0.4781179763952658 0.2334370556238072 0.0166790369048881 -0.2447897730222852 -0.1028403314750053 -0.1157840914576285 -0.1873268885694422 0.1700708002861556 0.2772789197782788 -0.0130145392695854 -0.2123817030594153 -0.2550292626960007 -0.5049268366774478 -0.2243335325285329 0.3180998613802498 0.3315380214794935 0.1977859924739816 0.5072476567310036 0.4209268575081797 0.1499593172661210 -0.1925590746592206 -0.5472292877802408 0.4543329704184014 -0.2128397588651423 -0.2740560593051884 0.1941418870268831 -0.3096684962457407 -0.0581576193198820 0.3969669479129447 0.6321903535930841 0.3329156356041941 0.0163533225344391 -0.2638879466190056 -0.2002027567371933 -0.0040094115506845 -0.3979373387545256 0.1520881534833996 -0.2010804514091296 0.1795922007470744 -0.1908329820840935 -0.0868799433942041 -0.3114741142062469 0.2579907627915116 0.3806883009357249 -0.0347810363019666 -0.5014665065895627 0.5389691288472425 0.2685446895251499 0.2447897730222852 0.1028403314750053 0.1157840914576285 0.1873268885694422 -0.1700708002861556 0.4642712665555327 -0.5942766860716397 0.4781179763952658 0.2334370556238072 0.0166790369048881 0.2243335325285329 -0.3180998613802498 -0.3315380214794935 -0.1977859924739816 -0.5072476567310036 0.2772789197782788 -0.0130145392695854 -0.2123817030594153 -0.2550292626960007 -0.5049268366774478 0.2128397588651423 0.2740560593051884 -0.1941418870268831 0.3096684962457407 0.0581576193198820 0.4209268575081797 0.1499593172661210 -0.1925590746592206 -0.5472292877802408 0.4543329704184014 0.2002027567371933 0.0040094115506845 0.3979373387545256 -0.1520881534833996 0.2010804514091296 0.3969669479129447 0.6321903535930841 0.3329156356041941 0.0163533225344391 -0.2638879466190056 Orthogonality of U: || U^T U - I ||_F = .28E-14 The orthogonal symplectic factor V is 0.4447147692018332 -0.6830166755147445 -0.0002576861753461 0.5781954611783305 -0.0375091627893695 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.5121756358795815 0.0297197140254867 0.4332229148788674 -0.3240527006890555 0.5330850295256576 0.0299719306696789 -0.2322624725320732 -0.0280846899680330 -0.3044255686880015 -0.1077641482535463 0.3664711365265602 0.3288511296455134 0.0588396016404466 0.1134221597062252 0.1047567336850027 -0.0069083614679702 0.3351358347080169 -0.4922707032978909 0.4293545450291777 0.4372821269061838 0.4535357098437908 0.1062866148880810 -0.3964092656837799 -0.2211800890450648 0.0350667323996154 0.0167847133528844 0.2843629278945263 0.5958979805231206 0.3097336757510830 -0.2086733033047175 0.4450432900616098 0.2950206358263727 -0.1617837757183794 -0.0376369332204945 -0.6746752660482708 0.0248567764822071 -0.2810759958040465 -0.1653113624869875 -0.3528780198620394 -0.0254898556119200 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.4447147692018332 -0.6830166755147445 -0.0002576861753461 0.5781954611783305 -0.0375091627893695 -0.0299719306696789 0.2322624725320732 0.0280846899680330 0.3044255686880015 0.1077641482535463 0.5121756358795815 0.0297197140254867 0.4332229148788674 -0.3240527006890555 0.5330850295256576 0.0069083614679702 -0.3351358347080169 0.4922707032978909 -0.4293545450291777 -0.4372821269061838 0.3664711365265602 0.3288511296455134 0.0588396016404466 0.1134221597062252 0.1047567336850027 -0.0167847133528844 -0.2843629278945263 -0.5958979805231206 -0.3097336757510830 0.2086733033047175 0.4535357098437908 0.1062866148880810 -0.3964092656837799 -0.2211800890450648 0.0350667323996154 -0.0248567764822071 0.2810759958040465 0.1653113624869875 0.3528780198620394 0.0254898556119200 0.4450432900616098 0.2950206358263727 -0.1617837757183794 -0.0376369332204945 -0.6746752660482708 Orthogonality of V: || V^T V - I ||_F = .25E-14
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03XP.html 0000664 0000000 0000000 00000043472 14560147231 0020375 0 ustar 00root root 0000000 0000000
Purpose
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.Specification
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,*)Arguments
Mode Parameters
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.Input/Output Parameters
N (input) INTEGER The order of the matrices A and B. N >= 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 <= ILO <= max(1,N+1); min(ILO,N) <= IHI <= 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 >= 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 >= 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 >= 1. If COMPQ <> 'N', LDQ >= 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 >= 1. If COMPZ <> 'N', LDZ >= 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 <= i <= 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.Workspace
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 >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 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.Method
The implemented algorithm is a multi-shift version of the periodic QR algorithm described in [1,3] with some minor modifications proposed in [2].References
[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.Numerical Aspects
The algorithm requires O(N**3) floating point operations and is backward stable.Further Comments
NoneExample
Program Text
* 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) ENDProgram Data
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.4199Program Results
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
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03XS.html 0000664 0000000 0000000 00000016631 14560147231 0020375 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues and real skew-Hamiltonian Schur form of a skew-Hamiltonian matrix, [ A G ] W = [ T ], [ Q A ] where A is an N-by-N matrix and G, Q are N-by-N skew-symmetric matrices. Specifically, an orthogonal symplectic matrix U is computed so that T [ Aout Gout ] U W U = [ T ] , [ 0 Aout ] where Aout is in Schur canonical form (as returned by the LAPACK routine DHSEQR). That is, Aout is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign. Optionally, the matrix U is returned in terms of its first N/2 rows [ U1 U2 ] U = [ ]. [ -U2 U1 ]Specification
SUBROUTINE MB03XS( JOBU, N, A, LDA, QG, LDQG, U1, LDU1, U2, LDU2, $ WR, WI, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBU INTEGER INFO, LDA, LDQG, LDU1, LDU2, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), QG(LDQG,*), U1(LDU1,*), $ U2(LDU2,*), WI(*), WR(*)Arguments
Mode Parameters
JOBU CHARACTER*1 Specifies whether matrix U is computed or not, as follows: = 'N': transformation matrix U is not computed; = 'U': transformation matrix U is computed.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 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 Aout in Schur canonical form. LDA INTEGER The leading dimension of the array A. LDA >= 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. On exit, the leading N-by-N+1 part of this array contains in columns 2:N+1 the strictly upper triangular part of the skew-symmetric matrix Gout. The part which contained the matrix Q is set to zero. Note that the parts containing the diagonal and the first superdiagonal of this array are not overwritten by zeros only if JOBU = 'U' or LDWORK >= 2*N*N - N. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N). U1 (output) DOUBLE PRECISION array, dimension (LDU1,N) On exit, if JOBU = 'U', the leading N-by-N part of this array contains the matrix U1. If JOBU = 'N', this array is not referenced. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= MAX(1,N), if JOBU = 'U'; LDU1 >= 1, if JOBU = 'N'. U2 (output) DOUBLE PRECISION array, dimension (LDU2,N) On exit, if JOBU = 'U', the leading N-by-N part of this array contains the matrix U2. If JOBU = 'N', this array is not referenced. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= MAX(1,N), if JOBU = 'U'; LDU2 >= 1, if JOBU = 'N'. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) The real and imaginary parts, respectively, of the eigenvalues of Aout, which are half of the eigenvalues of W. The eigenvalues are stored in the same order as on the diagonal of Aout, with WR(i) = Aout(i,i) and, if Aout(i:i+1,i:i+1) is a 2-by-2 diagonal block, WI(i) > 0 and WI(i+1) = -WI(i).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -14, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,(N+5)*N), if JOBU = 'U'; LDWORK >= MAX(1,5*N,(N+1)*N), if JOBU = 'N'. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, DHSEQR failed to compute all of the eigenvalues. Elements 1:ILO-1 and i+1:N of WR and WI contain those eigenvalues which have been successfully computed. The matrix A (and QG) has been partially reduced; namely, A is upper Hessenberg in the rows and columns ILO through i. (See DHSEQR for details.)Method
First, using the SLICOT Library routine MB04RB, an orthogonal symplectic matrix UP is computed so that T [ AP GP ] UP W UP = [ T ] [ 0 AP ] is in Paige/Van Loan form. Next, the LAPACK routine DHSEQR is applied to the matrix AP to compute an orthogonal matrix V so that Aout = V'*AP*V is in Schur canonical form. Finally, the transformations [ V 0 ] U = UP * [ ], Gout = V'*G*V, [ 0 V ] using the SLICOT Library routine MB01LD for the latter, are performed.References
[1] Van Loan, C.F. A symplectic method for approximating all the eigenvalues of a Hamiltonian matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984. [2] Kressner, D. Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce 2*nb columns and rows of a real (k+2n)-by-(k+2n) matrix H: [ op(A) G ] H = [ ], [ Q op(B) ] so that elements in the first nb columns below the k-th subdiagonal of the (k+n)-by-n matrix op(A), in the first nb columns and rows of the n-by-n matrix Q and in the first nb rows above the diagonal of the n-by-(k+n) matrix op(B) are zero. The reduction is performed by orthogonal symplectic transformations UU'*H*VV and matrices U, V, YA, YB, YG, YQ, XA, XB, XG, and XQ are returned so that [ op(Aout)+U*YA'+XA*V' G+U*YG'+XG*V' ] UU' H VV = [ ]. [ Qout+U*YQ'+XQ*V' op(Bout)+U*YB'+XB*V' ] This is an auxiliary routine called by MB04TB.Specification
SUBROUTINE MB03XU( LTRA, LTRB, N, K, NB, A, LDA, B, LDB, G, LDG, $ Q, LDQ, XA, LDXA, XB, LDXB, XG, LDXG, XQ, LDXQ, $ YA, LDYA, YB, LDYB, YG, LDYG, YQ, LDYQ, CSL, $ CSR, TAUL, TAUR, DWORK ) C .. Scalar Arguments .. LOGICAL LTRA, LTRB INTEGER K, LDA, LDB, LDG, LDQ, LDXA, LDXB, LDXG, LDXQ, $ LDYA, LDYB, LDYG, LDYQ, N, NB C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), CSL(*), CSR(*), DWORK(*), $ G(LDG,*), Q(LDQ,*), TAUL(*), TAUR(*), $ XA(LDXA,*), XB(LDXB,*), XG(LDXG,*), XQ(LDXQ,*), $ YA(LDYA,*), YB(LDYB,*), YG(LDYG,*), YQ(LDYQ,*)Arguments
Mode Parameters
LTRA LOGICAL Specifies the form of op( A ) as follows: = .FALSE.: op( A ) = A; = .TRUE.: op( A ) = A'. LTRB LOGICAL Specifies the form of op( B ) as follows: = .FALSE.: op( B ) = B; = .TRUE.: op( B ) = B'.Input/Output Parameters
N (input) INTEGER The order of the matrix Q. N >= 0. K (input) INTEGER The offset of the reduction. Elements below the K-th subdiagonal in the first NB columns of op(A) are reduced to zero. K >= 0. NB (input) INTEGER The number of columns/rows to be reduced. N > NB >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) if LTRA = .FALSE. (LDA,K+N) if LTRA = .TRUE. On entry with LTRA = .FALSE., the leading (K+N)-by-N part of this array must contain the matrix A. On entry with LTRA = .TRUE., the leading N-by-(K+N) part of this array must contain the matrix A. On exit with LTRA = .FALSE., the leading (K+N)-by-N part of this array contains the matrix Aout and, in the zero parts, information about the elementary reflectors used to compute the reduction. On exit with LTRA = .TRUE., the leading N-by-(K+N) part of this array contains the matrix Aout and in the zero parts information about the elementary reflectors. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,K+N), if LTRA = .FALSE.; LDA >= MAX(1,N), if LTRA = .TRUE.. B (input/output) DOUBLE PRECISION array, dimension (LDB,K+N) if LTRB = .FALSE. (LDB,N) if LTRB = .TRUE. On entry with LTRB = .FALSE., the leading N-by-(K+N) part of this array must contain the matrix B. On entry with LTRB = .TRUE., the leading (K+N)-by-N part of this array must contain the matrix B. On exit with LTRB = .FALSE., the leading N-by-(K+N) part of this array contains the matrix Bout and, in the zero parts, information about the elementary reflectors used to compute the reduction. On exit with LTRB = .TRUE., the leading (K+N)-by-N part of this array contains the matrix Bout and in the zero parts information about the elementary reflectors. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N), if LTRB = .FALSE.; LDB >= MAX(1,K+N), if LTRB = .TRUE.. G (input/output) DOUBLE PRECISION array, dimension (LDG,N) On entry, the leading N-by-N part of this array must contain the matrix G. On exit, the leading N-by-N part of this array contains the matrix Gout. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, the leading N-by-N part of this array must contain the matrix Q. On exit, the leading N-by-N part of this array contains the matrix Qout and in the zero parts information about the elementary reflectors used to compute the reduction. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). XA (output) DOUBLE PRECISION array, dimension (LDXA,2*NB) On exit, the leading N-by-(2*NB) part of this array contains the matrix XA. LDXA INTEGER The leading dimension of the array XA. LDXA >= MAX(1,N). XB (output) DOUBLE PRECISION array, dimension (LDXB,2*NB) On exit, the leading (K+N)-by-(2*NB) part of this array contains the matrix XB. LDXB INTEGER The leading dimension of the array XB. LDXB >= MAX(1,K+N). XG (output) DOUBLE PRECISION array, dimension (LDXG,2*NB) On exit, the leading (K+N)-by-(2*NB) part of this array contains the matrix XG. LDXG INTEGER The leading dimension of the array XG. LDXG >= MAX(1,K+N). XQ (output) DOUBLE PRECISION array, dimension (LDXQ,2*NB) On exit, the leading N-by-(2*NB) part of this array contains the matrix XQ. LDXQ INTEGER The leading dimension of the array XQ. LDXQ >= MAX(1,N). YA (output) DOUBLE PRECISION array, dimension (LDYA,2*NB) On exit, the leading (K+N)-by-(2*NB) part of this array contains the matrix YA. LDYA INTEGER The leading dimension of the array YA. LDYA >= MAX(1,K+N). YB (output) DOUBLE PRECISION array, dimension (LDYB,2*NB) On exit, the leading N-by-(2*NB) part of this array contains the matrix YB. LDYB INTEGER The leading dimension of the array YB. LDYB >= MAX(1,N). YG (output) DOUBLE PRECISION array, dimension (LDYG,2*NB) On exit, the leading (K+N)-by-(2*NB) part of this array contains the matrix YG. LDYG INTEGER The leading dimension of the array YG. LDYG >= MAX(1,K+N). YQ (output) DOUBLE PRECISION array, dimension (LDYQ,2*NB) On exit, the leading N-by-(2*NB) part of this array contains the matrix YQ. LDYQ INTEGER The leading dimension of the array YQ. LDYQ >= MAX(1,N). CSL (output) DOUBLE PRECISION array, dimension (2*NB) On exit, the first 2NB elements of this array contain the cosines and sines of the symplectic Givens rotations applied from the left-hand side used to compute the reduction. CSR (output) DOUBLE PRECISION array, dimension (2*NB) On exit, the first 2NB-2 elements of this array contain the cosines and sines of the symplectic Givens rotations applied from the right-hand side used to compute the reduction. TAUL (output) DOUBLE PRECISION array, dimension (NB) On exit, the first NB elements of this array contain the scalar factors of some of the elementary reflectors applied form the left-hand side. TAUR (output) DOUBLE PRECISION array, dimension (NB) On exit, the first NB-1 elements of this array contain the scalar factors of some of the elementary reflectors applied form the right-hand side.Workspace
DWORK DOUBLE PRECISION array, dimension (5*NB)Method
For details regarding the representation of the orthogonal symplectic matrices UU and VV within the arrays A, B, CSL, CSR, Q, TAUL and TAUR see the description of MB04TB. The contents of A, B, G and Q on exit are illustrated by the following example with op(A) = A, op(B) = B, n = 5, k = 2 and nb = 2: ( a r r a a ) ( g g g r r g g ) ( a r r a a ) ( g g g r r g g ) ( r r r r r ) ( r r r r r r r ) A = ( u2 r r r r ), G = ( r r r r r r r ), ( u2 u2 r a a ) ( g g g r r g g ) ( u2 u2 r a a ) ( g g g r r g g ) ( u2 u2 r a a ) ( g g g r r g g ) ( t t v1 v1 v1 ) ( r r r r r v2 v2 ) ( u1 t t v1 v1 ) ( r r r r r r v2 ) Q = ( u1 u1 r q q ), B = ( b b b r r b b ). ( u1 u1 r q q ) ( b b b r r b b ) ( u1 u1 r q q ) ( b b b r r b b ) where a, b, g and q denote elements of the original matrices, r denotes a modified element, t denotes a scalar factor of an applied elementary reflector, ui and vi denote elements of the matrices U and V, respectively.Numerical Aspects
The algorithm requires ( 16*K + 32*N + 42 )*N*NB + ( 16*K + 112*N - 208/3*NB - 69 )*NB*NB - 29/3*NB floating point operations and is numerically backward stable.References
[1] Benner, P., Mehrmann, V., and Xu, H. A numerically stable, structure preserving method for computing the eigenvalues of real Hamiltonian or symplectic pencils. Numer. Math., Vol. 78 (3), pp. 329-358, 1998. [2] Kressner, D. Block algorithms for orthogonal symplectic factorizations. BIT Numerical Mathematics, 43 (4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the eigenvalues of a Hamiltonian matrix, [ A G ] H H H = [ H ], G = G , Q = Q , (1) [ Q -A ] where A, G and Q are complex n-by-n matrices. Due to the structure of H, if lambda is an eigenvalue, then -conjugate(lambda) is also an eigenvalue. This does not mean that purely imaginary eigenvalues are necessarily multiple. The routine computes the eigenvalues of H using an embedding to a real skew- Hamiltonian matrix He, [ Ae Ge ] T T He = [ T ], Ge = -Ge , Qe = -Qe , (2) [ Qe Ae ] where Ae, Ge, and Qe are real 2*n-by-2*n matrices, defined by [ Im(A) Re(A) ] Ae = [ ], [ -Re(A) Im(A) ] [ triu(Im(G)) Re(G) ] triu(Ge) = [ ], [ 0 triu(Im(G)) ] [ tril(Im(Q)) 0 ] tril(Qe) = [ ], [ -Re(Q) tril(Im(Q)) ] and triu and tril denote the upper and lower triangle, respectively. Then, an orthogonal symplectic matrix Ue is used to reduce He to the structured real Schur form T [ Se De ] T Ue He Ue = [ T ], De = -De , (3) [ 0 Se ] where Ue is a 4n-by-4n real symplectic matrix, and Se is upper quasi-triangular (real Schur form). Optionally, if JOB = 'S', or JOB = 'G', the matrix i*He is further transformed to the structured complex Schur form H [ Sc Gc ] H U (i*He) U = [ H ], Gc = Gc , (4) [ 0 -Sc ] where U is a 4n-by-4n unitary symplectic matrix, and Sc is upper triangular (Schur form). The algorithm is backward stable and preserves the spectrum structure in finite precision arithmetic. Optionally, a symplectic balancing transformation to improve the conditioning of eigenvalues is computed (see the SLICOT Library routine MB04DZ). In this case, the matrix He in decompositions (3) and (4) must be replaced by the balanced matrix.Specification
SUBROUTINE MB03XZ( BALANC, JOB, JOBU, N, A, LDA, QG, LDQG, U1, $ LDU1, U2, LDU2, WR, WI, ILO, SCALE, DWORK, $ LDWORK, ZWORK, LZWORK, BWORK, INFO ) C .. Scalar Arguments .. CHARACTER BALANC, JOB, JOBU INTEGER ILO, INFO, LDA, LDQG, LDU1, LDU2, LDWORK, $ LZWORK, N C .. Array Arguments .. LOGICAL BWORK( * ) DOUBLE PRECISION DWORK( * ), SCALE( * ), WI( * ), WR( * ) COMPLEX*16 A( LDA, * ), QG( LDQG, * ), U1( LDU1, * ), $ U2( LDU2, * ), ZWORK( * )Arguments
Mode Parameters
BALANC CHARACTER*1 Indicates how H should be diagonally scaled and/or permuted to reduce its norm. = 'N': Do not diagonally scale or permute; = 'P': Perform symplectic permutations to make the matrix closer to skew-Hamiltonian Schur form. Do not diagonally scale; = 'S': Diagonally scale the matrix, i.e., replace A, G and Q by D*A*D**(-1), D*G*D and D**(-1)*Q*D**(-1) where D is a diagonal matrix chosen to make the rows and columns of H more equal in norm. Do not permute; = 'B': Both diagonally scale and permute A, G and Q. Permuting does not change the norm of H, but scaling does. JOB CHARACTER*1 Indicates whether the user wishes to compute the full decomposition (4) or the eigenvalues only, as follows: = 'E': compute the eigenvalues only; = 'S': compute the matrix Sc of (4); = 'G': compute the matrices Sc and Gc of (4). JOBU CHARACTER*1 Indicates whether or not the user wishes to compute the symplectic matrix Ue of (3), if JOB = 'E', or U of (4), if JOB = 'S' or JOB = 'G', as follows: = 'N': the matrix Ue or U is not computed; = 'U': the matrix Ue or U is computed.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) COMPLEX*16 array, dimension (LDA,K) where K = N, if JOB = 'E', and K = 2*N, if JOB <> 'E'. On entry, the leading N-by-N part of this array must contain the matrix A. On exit, if JOB = 'E', the leading N-by-N part of this array is unchanged, if BALANC = 'N', or it contains the balanced (permuted and/or scaled) matrix A, if BALANC <> 'N'. On exit, if JOB = 'S' or JOB = 'G', the leading 2*N-by-2*N upper triangular part of this array contains the matrix Sc (complex Schur form) of decomposition (4). LDA INTEGER The leading dimension of the array A. LDA >= max(1,K). QG (input/output) COMPLEX*16 array, dimension (LDQG,min(K+1,2*N)) On entry, the leading N-by-N+1 part of this array must contain in columns 1:N the lower triangular part of the matrix Q and in columns 2:N+1 the upper triangular part of the matrix G. On exit, if JOB <> 'G', the leading N-by-N+1 part of this array is unchanged, if BALANC = 'N', or it contains the balanced (permuted and/or scaled) parts of the matrices Q and G (as above), if BALANC <> 'N'. On exit, JOB = 'G', the leading 2*N-by-2*N upper triangular part of this array contains the upper triangular part of the matrix Gc in the decomposition (4). LDQG INTEGER The leading dimension of the array QG. LDQG >= max(1,K). U1 (output) COMPLEX*16 array, dimension (LDU1,2*N) On exit, if JOB = 'S' or JOB = 'G', and JOBU = 'U', the leading 2*N-by-2*N part of this array contains the (1,1) block of the unitary symplectic matrix U of the decomposition (4). If JOB = 'E' or JOBU = 'N', this array is not referenced. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= 1. LDU1 >= 2*N, if JOBU = 'U'. U2 (output) COMPLEX*16 array, dimension (LDU2,2*N) On exit, if JOB = 'S' or JOB = 'G', and JOBU = 'U', the leading 2*N-by-2*N part of this array contains the (1,2) block of the unitary symplectic matrix U of the decomposition (4). If JOB = 'E' or JOBU = 'N', this array is not referenced. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= 1. LDU2 >= 2*N, if JOBU = 'U'. WR (output) DOUBLE PRECISION array, dimension (2*N) WI (output) DOUBLE PRECISION array, dimension (2*N) On exit, the leading 2*N elements of WR and WI contain the real and imaginary parts, respectively, of the eigenvalues of the Hamiltonian matrix H. ILO (output) INTEGER ILO is an integer value determined when H was balanced. The balanced A(I,J) = 0 if I > J and J = 1,...,ILO-1. The balanced Q(I,J) = 0 if J = 1,...,ILO-1 or I = 1,...,ILO-1. SCALE (output) DOUBLE PRECISION array, dimension (N) On exit, if BALANC <> 'N', the leading N elements of this array contain details of the permutation and/or scaling factors applied when balancing H, see MB04DZ. This array is not referenced if BALANC = 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and DWORK(2) returns the 1-norm of the (scaled, if BALANC = 'S' or 'B') Hamiltonian matrix. Moreover, the next locations of this array have the following content: - The leading 2*N-by-2*N upper Hessenberg part in the locations 3:2+4*N*N contains the upper Hessenberg part of the real Schur matrix Se in the decomposition (3); - the leading 2*N-by-2*N upper triangular part in the locations 3+4*N*N+2*N:2+8*N*N+2*N contains the upper triangular part of the skew-symmetric matrix De in the decomposition (3). - If JOBU = 'U', the leading 2*N-by-2*N part in the locations 3+8*N*N+2*N:2+12*N*N+2*N contains the (1,1) block of the orthogonal symplectic matrix Ue of decomposition (3). - the leading 2*N-by-2*N part in the locations 3+12*N*N+2*N:2+16*N*N+2*N contains the (2,1) block of the orthogonal symplectic matrix Ue. On exit, if INFO = -18, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX( 12*N**2 + 4*N, 8*N**2 + 12*N ) + 2, if JOB = 'E' and JOBU = 'N'; LDWORK >= MAX( 2, 12*N**2 + 4*N, 8*N**2 + 12*N ), if JOB = 'S' or 'G' and JOBU = 'N'; LDWORK >= 20*N**2 + 12*N + 2, if JOB = 'E' and JOBU = 'U'; LDWORK >= MAX( 2, 20*N**2 + 12*N ), if JOB = 'S' or 'G' and JOBU = 'U'. 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. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. On exit, if INFO = -20, ZWORK(1) returns the minimum value of LZWORK. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= 1, if JOB = 'E'; LZWORK >= MAX( 1, 12*N - 6 ), if JOB = 'S' and JOBU = 'N'; LZWORK >= MAX( 1, 12*N - 2 ), if JOB = 'G' or JOBU = 'U'. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA. BWORK LOGICAL array, dimension (LBWORK) LBWORK >= 0, if JOB = 'E'; LBWORK >= 2*N-1, if JOB = 'S' or JOB = 'G'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues; elements i+1:2*N of WR and WI contain eigenvalues which have converged; = 2*N+1: the QR algorithm failed to compute the eigenvalues of a 2-by-2 real block.Method
First, the extended matrix He in (2) is built. Then, the structured real Schur form in (3) is computed, using the SLICOT Library routine MB03XS. The eigenvalues of Se immediately give the eigenvalues of H. Finally, if required, Se is further transformed by using the complex QR algorithm to triangularize its 2-by-2 blocks, and Ge and U are updated, to obtain (4).References
[1] Benner, P., Mehrmann, V. and Xu, H. A note on the numerical solution of complex Hamiltonian and skew-Hamiltonian eigenvalue problems. Electr. Trans. Num. Anal., 8, pp. 115-126, 1999. [2] Van Loan, C.F. A symplectic method for approximating all the eigenvalues of a Hamiltonian matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984.Further Comments
NoneExample
Program Text
* MB03XZ EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZER PARAMETER ( ZER = 0.0D0 ) COMPLEX*16 ZERO, ONE PARAMETER ( ZERO = (0.0D0,0.0D0), ONE = (1.0D0,0.0D0) ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 100 ) INTEGER LDA, LDAE, LDAS, LDGE, LDQG, LDQGE, LDQGS, LDRES, $ LDU1, LDU2, LDWORK, LZWORK PARAMETER ( LDA = 2*NMAX, LDAE = 2*NMAX, LDAS = NMAX, $ LDGE = 2*NMAX, LDQG = 2*NMAX, LDQGE = 2*NMAX, $ LDQGS = NMAX, LDRES = 2*NMAX, LDU1 = 2*NMAX, $ LDU2 = 2*NMAX, $ LDWORK = 20*NMAX*NMAX + 12*NMAX + 2, $ LZWORK = 12*NMAX - 2 ) * .. Local Scalars .. CHARACTER*1 BALANC, JOB, JOBU INTEGER I, ILO, INFO, J, M, N DOUBLE PRECISION TEMP * .. Local Arrays .. COMPLEX*16 A(LDA, 2*NMAX), AE(LDAE, 2*NMAX), AS(LDAS, NMAX), $ GE(LDGE, 2*NMAX), QG(LDQG, 2*NMAX+1), $ QGE(LDQGE, 2*NMAX+1), QGS(LDQGS, NMAX+1), $ RES(LDRES,2*NMAX), U1(LDU1,2*NMAX), $ U2(LDU2, 2*NMAX), ZWORK(LZWORK) DOUBLE PRECISION DWORK(LDWORK), SCALE(NMAX), WI(2*NMAX), $ WR(2*NMAX) LOGICAL BWORK(2*NMAX) * .. External Functions .. LOGICAL LSAME DOUBLE PRECISION DLAPY2, MA02JZ, ZLANGE EXTERNAL DLAPY2, LSAME, MA02JZ, ZLANGE * .. External Subroutines .. EXTERNAL MA02EZ, MB03XZ, MB04DZ, ZCOPY, ZGEMM, ZLACPY, $ ZLASET * ..Intrinsic Functions.. INTRINSIC DBLE, DCMPLX, DIMAG * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, BALANC, JOB, JOBU IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE M = 2*N READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) CALL ZLACPY( 'All', N, N, A, LDA, AS, LDAS ) READ ( NIN, FMT = * ) ( ( QG(I,J), J = 1,N+1 ), I = 1,N ) CALL ZLACPY( 'All', N, N+1, QG, LDQG, QGS, LDQGS ) * Compute the eigenvalues and the transformed Hamiltonian matrix. CALL MB03XZ( BALANC, JOB, JOBU, N, A, LDA, QG, LDQG, U1, LDU1, $ U2, LDU2, WR, WI, ILO, SCALE, DWORK, LDWORK, $ ZWORK, LZWORK, BWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, M WRITE ( NOUT, FMT = 99996 ) I, WR(I), WI(I) 10 CONTINUE IF ( LSAME( JOB, 'S' ).OR.LSAME( JOB, 'G' ) ) THEN WRITE ( NOUT, FMT = 99995 ) DO 20 I = 1, M WRITE ( NOUT, FMT = 99992 ) ( A(I,J), J = 1,M ) 20 CONTINUE END IF IF ( LSAME( JOB, 'G' ) ) THEN WRITE ( NOUT, FMT = 99994 ) DO 30 I = 1, M WRITE ( NOUT, FMT = 99992 ) ( QG(I,J), J = 1,M ) 30 CONTINUE END IF * IF ( LSAME( JOB, 'G' ).AND.LSAME( JOBU, 'U' ) ) THEN * Compute the residual of the formula (4) in MB03XZ. CALL MB04DZ( BALANC, N, AS, LDAS, QGS, LDQGS, I, DWORK, $ INFO ) CALL ZLASET( 'Lower', M-1, M-1, ZERO, ZERO, A(2,1), LDA ) CALL MA02EZ( 'Upper', 'Conjugate', 'Not skew', M, QG, $ LDQG ) * Compute Ae, Ge, and Qe. DO 60 J = 1, N DO 40 I = 1, N AE(I,J) = DCMPLX( ZER, DIMAG( AS(I,J) ) ) 40 CONTINUE DO 50 I = 1, N AE(I+N,J) = -DCMPLX( ZER, DBLE( AS(I,J) ) ) 50 CONTINUE 60 CONTINUE * DO 90 J = 1, N DO 70 I = 1, N AE(I,J+N) = -AE(I+N,J) 70 CONTINUE DO 80 I = 1, N AE(I+N,J+N) = AE(I,J) 80 CONTINUE 90 CONTINUE * DO 120 J = 1, N+1 DO 100 I = 1, N QGE(I,J) = DCMPLX( ZER, DIMAG( QGS(I,J) ) ) 100 CONTINUE DO 110 I = J, N QGE(I+N,J) = -DCMPLX( ZER, DBLE( QGS(I,J) ) ) 110 CONTINUE 120 CONTINUE * DO 150 J = 1, N DO 130 I = 1, J QGE(I,J+N+1) = DCMPLX( ZER, DBLE( QGS(I,J+1) ) ) 130 CONTINUE DO 140 I = 1, N QGE(I+N,J+N+1) = QGE(I,J+1) 140 CONTINUE 150 CONTINUE CALL ZCOPY( N, QGE, 1, QGE(N+1,N+1), 1 ) CALL MA02EZ( 'Lower', 'Transpose', 'Not Skew', N, $ QGE(N+1,1), LDQGE ) CALL MA02EZ( 'Upper', 'Transpose', 'Not Skew', N, $ QGE(1,N+2), LDQGE ) * CALL ZLACPY( 'Upper', M, M, QGE(1,2), LDQGE, GE, LDGE ) CALL MA02EZ( 'Upper', 'Transpose', 'Skew', M, GE, LDGE ) CALL MA02EZ( 'Lower', 'Transpose', 'Skew', M, QGE, $ LDQGE ) * Compute the residual of the (1,1) block in (4). CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, ONE, $ AE, LDAE, U1, LDU1, ZERO, RES, LDRES ) CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, $ -ONE, GE, LDGE, U2, LDU2, ONE, RES, LDRES ) CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, $ -ONE, U1, LDU1, A, LDA, ONE, RES, LDRES ) TEMP = ZLANGE( 'Frobenius', M, M, RES, LDRES, DWORK ) * Compute the residual of the (1,2) block in (4). CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, ONE, $ AE, LDAE, U2, LDU2, ZERO, RES, LDRES ) CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, ONE, $ GE, LDGE, U1, LDU1, ONE, RES, LDRES ) CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, $ -ONE, U1, LDU1, QG, LDQG, ONE, RES, LDRES ) CALL ZGEMM( 'No Transpose', 'Conj Transpose', M, M, M, $ ONE, U2, LDU2, A, LDA, ONE, RES, LDRES ) TEMP = DLAPY2( TEMP, ZLANGE( 'Frobenius', M, M, RES, $ LDRES, DWORK ) ) * Compute the residual of the (2,1) block in (4). CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, ONE, $ QGE, LDQGE, U1, LDU1, ZERO, RES, LDRES ) CALL ZGEMM( 'Transpose', 'No Transpose', M, M, M, $ -ONE, AE, LDAE, U2, LDU2, ONE, RES, LDRES ) CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, ONE, $ U2, LDU2, A, LDA, ONE, RES, LDRES ) TEMP = DLAPY2( TEMP, ZLANGE( 'Frobenius', M, M, RES, $ LDRES, DWORK ) ) * Compute the residual of the (2,2) block in (4). CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, ONE, $ QGE, LDQGE, U2, LDU2, ZERO, RES, LDRES ) CALL ZGEMM( 'Transpose', 'No Transpose', M, M, M, ONE, $ AE, LDAE, U1, LDU1, ONE, RES, LDRES ) CALL ZGEMM( 'No Transpose', 'No Transpose', M, M, M, ONE, $ U2, LDU2, QG, LDQG, ONE, RES, LDRES ) CALL ZGEMM( 'No Transpose', 'Conj Transpose', M, M, M, $ ONE, U1, LDU1, A, LDA, ONE, RES, LDRES ) TEMP = DLAPY2( TEMP, ZLANGE( 'Frobenius', M, M, RES, $ LDRES, DWORK ) ) WRITE ( NOUT, FMT = 99989 ) TEMP END IF * IF ( .NOT.LSAME( JOB, 'E' ).AND.LSAME( JOBU, 'U' ) ) THEN WRITE ( NOUT, FMT = 99993 ) DO 160 I = 1, M WRITE ( NOUT, FMT = 99992 ) $ ( U1(I,J), J = 1,M ), ( U2(I,J), J = 1,M ) 160 CONTINUE DO 170 I = 1, M WRITE ( NOUT, FMT = 99992 ) $ ( -U2(I,J), J = 1,M ), ( U1(I,J), J = 1,M ) 170 CONTINUE WRITE ( NOUT, FMT = 99988 ) MA02JZ( .FALSE., .FALSE., M, $ U1, LDU1, U2, LDU2, RES, LDRES ) END IF IF ( LSAME( BALANC, 'S' ).OR.LSAME( BALANC, 'B' ) ) THEN WRITE ( NOUT, FMT = 99991 ) DO 180 I = 1, N WRITE ( NOUT, FMT = 99996 ) I, SCALE(I) 180 CONTINUE END IF END IF END IF * 99999 FORMAT (' MB03XZ EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB03XZ = ',I2) 99997 FORMAT (' The eigenvalues are',//' i',6X, $ 'WR(i)',6X,'WI(i)',/) 99996 FORMAT (I4,3X,F8.4,3X,F8.4) 99995 FORMAT (/' The transformed matrix S is') 99994 FORMAT (/' The transformed matrix G is') 99993 FORMAT (/' The unitary symplectic factor U is') 99992 FORMAT (20(1X,F9.4,SP,F9.4,S,'i ')) 99991 FORMAT (/' The diagonal scaling factors are ',//' i',6X, $ 'SCALE(i)',/) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' Residual: || i*He*U - U*Hc ||_F = ',G9.2) 99988 FORMAT (/' Orthogonality of U: || U^H U - I ||_F = ',G9.2) ENDProgram Data
MB03XZ EXAMPLE PROGRAM DATA 4 N G U (0.8147,0.4217) (0.6323,0.6557) (0.9575,0.6787) (0.9571,0.6554) (0.9057,0.9157) (0.0975,0.0357) (0.9648,0.7577) (0.4853,0.1711) (0.1269,0.7922) (0.2784,0.8491) (0.1576,0.7431) (0.8002,0.7060) (0.9133,0.9594) (0.5468,0.9339) (0.9705,0.3922) (0.1418,0.0318) 0.2769 0.6948 (0.4387,0.7513) (0.1869,0.8909) (0.7094,0.1493) (0.0462,0.1626) 0.3171 0.3816 (0.4898,0.9593) (0.7547,0.2575) (0.0971,0.1190) (0.9502,0.5853) 0.7655 0.4456 (0.2760,0.8407) (0.8235,0.4984) (0.0344,0.2238) (0.7952,0.6991) 0.6463 0.6797Program Results
MB03XZ EXAMPLE PROGRAM RESULTS The eigenvalues are i WR(i) WI(i) 1 3.0844 2.7519 2 -3.0844 2.7519 3 0.5241 -1.3026 4 -0.5241 -1.3026 5 0.8824 -0.6918 6 -0.8824 -0.6918 7 0.4459 0.4748 8 -0.4459 0.4748 The transformed matrix S is 3.0844 +2.7519i 0.0618 +0.0000i -0.1952 +0.1977i 0.0439 +0.0628i 0.0599 -0.0344i -0.1543 -0.7126i -0.3906 +0.3615i 0.2877 +0.5766i 0.0000 +0.0000i -3.0844 +2.7519i -0.0458 -0.0727i -0.2607 +0.0867i 0.1505 -0.7137i -0.0717 +0.0066i -0.4008 +0.4356i 0.2819 +0.5317i 0.1269 +0.7922i 0.0000 +0.0000i 0.5241 -1.3026i -0.0175 +0.0350i -0.0676 +0.1183i 0.3695 -0.0335i -0.3138 -0.4268i 0.2973 -0.0042i 0.9133 +0.9594i 0.5468 +0.9339i 0.0000 +0.0000i -0.5241 -1.3026i 0.1453 +0.3375i 0.0590 -0.1483i 0.2795 +0.3002i -0.4594 -0.0099i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.8824 -0.6918i -0.1193 +0.0000i -0.1672 -0.0189i -0.1008 -0.2026i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.8824 -0.6918i 0.0539 -0.1852i 0.1978 -0.0688i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.4459 +0.4748i 0.2987 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.4459 +0.4748i The transformed matrix G is -0.2169 +0.0000i -0.0022 +0.0000i -0.2082 -0.0281i 0.0691 +0.0092i 0.0362 -0.0426i -0.2374 +0.4904i -0.2678 -0.5870i -0.2567 +0.3258i 0.0462 +0.1626i 0.2169 +0.0000i 0.0128 -0.0651i -0.0654 +0.2006i 0.2348 +0.4861i -0.0545 -0.0706i 0.1557 +0.4895i 0.3329 -0.4499i 0.0971 +0.1190i 0.9502 +0.5853i 0.1341 +0.0000i -0.0022 +0.0045i -0.0232 +0.0320i 0.3395 -0.3847i -0.0646 -0.2900i -0.0920 -0.1605i 0.8235 +0.4984i 0.0344 +0.2238i 0.7952 +0.6991i -0.1341 +0.0000i -0.1893 +0.4728i 0.0127 -0.0720i -0.0923 -0.0258i -0.3361 +0.0706i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.5145 +0.0000i 0.0348 +0.0000i -0.0662 -0.2049i 0.2987 -0.0488i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.5145 +0.0000i -0.3004 +0.0327i -0.0524 -0.2070i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0241 +0.0000i 0.0081 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.0241 +0.0000i Residual: || i*He*U - U*Hc ||_F = .11E-13 The unitary symplectic factor U is -0.3728 +0.1313i -0.3766 -0.1300i 0.1039 +0.2714i 0.1856 +0.2134i 0.4599 -0.0392i 0.4298 +0.0419i 0.1896 +0.1017i 0.2634 -0.0732i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.3079 +0.0989i -0.3110 -0.0979i -0.0062 +0.0288i 0.0277 +0.0067i -0.2041 +0.1907i -0.1908 -0.2040i -0.1357 -0.0260i -0.1886 +0.0187i 0.0570 -0.0194i 0.0576 +0.0192i -0.1622 +0.3576i 0.3834 +0.0034i 0.0436 +0.0676i 0.0408 -0.0723i -0.2802 +0.1272i -0.3893 -0.0915i -0.2929 -0.0333i -0.2958 +0.0330i 0.1727 -0.3337i -0.3677 +0.0166i 0.1022 +0.0500i 0.0956 -0.0535i -0.2588 -0.0951i -0.3596 +0.0684i 0.0887 -0.0452i 0.0896 +0.0448i 0.0357 +0.0168i -0.0021 +0.0404i -0.0614 +0.0720i -0.0574 -0.0770i 0.2713 -0.1920i 0.3769 +0.1382i -0.3061 +0.1212i -0.3092 -0.1200i -0.1737 -0.1180i -0.0210 -0.2121i -0.3424 -0.1782i -0.3201 +0.1906i 0.1698 +0.1487i 0.2359 -0.1070i 0.1763 -0.0047i 0.1781 +0.0046i 0.1017 -0.2162i -0.2335 +0.0013i 0.1817 +0.0174i 0.1699 -0.0186i 0.0902 +0.1296i 0.1253 -0.0933i 0.1153 +0.3771i 0.1164 -0.3734i 0.3105 +0.0106i -0.1350 +0.2928i -0.0741 +0.3559i -0.0692 -0.3808i 0.0178 +0.0002i 0.0247 -0.0002i -0.0148 -0.0576i -0.0150 +0.0570i 0.0145 -0.2255i -0.2011 -0.0837i 0.0523 +0.0093i 0.0488 -0.0099i 0.0689 +0.2345i 0.0957 -0.1688i 0.0856 +0.3022i 0.0864 -0.2992i 0.1935 +0.0888i -0.0133 +0.2179i -0.1613 -0.2850i -0.1508 +0.3049i -0.0548 +0.2795i -0.0761 -0.2011i -0.0226 -0.1038i -0.0228 +0.1027i 0.1693 +0.2699i 0.1539 +0.2735i -0.1978 -0.0842i -0.1849 +0.0901i 0.0400 -0.1732i 0.0556 +0.1246i -0.0241 +0.2666i -0.0243 -0.2639i -0.3169 -0.0146i 0.1346 -0.3005i 0.0045 +0.1961i 0.0042 -0.2098i 0.0873 -0.3068i 0.1213 +0.2208i -0.0669 -0.1453i -0.0676 +0.1439i 0.1604 +0.0320i -0.0469 +0.1627i -0.0078 -0.1319i -0.0073 +0.1411i -0.0086 -0.4118i -0.0120 +0.2963i 0.1102 +0.2727i 0.1113 -0.2699i -0.2494 -0.0928i 0.0359 -0.2715i 0.1998 -0.2115i 0.1867 +0.2263i -0.0988 -0.1334i -0.1373 +0.0960i -0.0318 -0.2136i -0.0321 +0.2115i -0.1467 +0.0498i 0.1110 -0.1148i -0.0279 +0.2616i -0.0261 -0.2799i 0.0611 +0.3196i 0.0849 -0.2300i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.3728 +0.1313i -0.3766 -0.1300i 0.1039 +0.2714i 0.1856 +0.2134i 0.4599 -0.0392i 0.4298 +0.0419i 0.1896 +0.1017i 0.2634 -0.0732i -0.0570 +0.0194i -0.0576 -0.0192i 0.1622 -0.3576i -0.3834 -0.0034i -0.0436 -0.0676i -0.0408 +0.0723i 0.2802 -0.1272i 0.3893 +0.0915i -0.3079 +0.0989i -0.3110 -0.0979i -0.0062 +0.0288i 0.0277 +0.0067i -0.2041 +0.1907i -0.1908 -0.2040i -0.1357 -0.0260i -0.1886 +0.0187i -0.0887 +0.0452i -0.0896 -0.0448i -0.0357 -0.0168i 0.0021 -0.0404i 0.0614 -0.0720i 0.0574 +0.0770i -0.2713 +0.1920i -0.3769 -0.1382i -0.2929 -0.0333i -0.2958 +0.0330i 0.1727 -0.3337i -0.3677 +0.0166i 0.1022 +0.0500i 0.0956 -0.0535i -0.2588 -0.0951i -0.3596 +0.0684i -0.1763 +0.0047i -0.1781 -0.0046i -0.1017 +0.2162i 0.2335 -0.0013i -0.1817 -0.0174i -0.1699 +0.0186i -0.0902 -0.1296i -0.1253 +0.0933i -0.3061 +0.1212i -0.3092 -0.1200i -0.1737 -0.1180i -0.0210 -0.2121i -0.3424 -0.1782i -0.3201 +0.1906i 0.1698 +0.1487i 0.2359 -0.1070i 0.0148 +0.0576i 0.0150 -0.0570i -0.0145 +0.2255i 0.2011 +0.0837i -0.0523 -0.0093i -0.0488 +0.0099i -0.0689 -0.2345i -0.0957 +0.1688i 0.1153 +0.3771i 0.1164 -0.3734i 0.3105 +0.0106i -0.1350 +0.2928i -0.0741 +0.3559i -0.0692 -0.3808i 0.0178 +0.0002i 0.0247 -0.0002i 0.0226 +0.1038i 0.0228 -0.1027i -0.1693 -0.2699i -0.1539 -0.2735i 0.1978 +0.0842i 0.1849 -0.0901i -0.0400 +0.1732i -0.0556 -0.1246i 0.0856 +0.3022i 0.0864 -0.2992i 0.1935 +0.0888i -0.0133 +0.2179i -0.1613 -0.2850i -0.1508 +0.3049i -0.0548 +0.2795i -0.0761 -0.2011i 0.0669 +0.1453i 0.0676 -0.1439i -0.1604 -0.0320i 0.0469 -0.1627i 0.0078 +0.1319i 0.0073 -0.1411i 0.0086 +0.4118i 0.0120 -0.2963i -0.0241 +0.2666i -0.0243 -0.2639i -0.3169 -0.0146i 0.1346 -0.3005i 0.0045 +0.1961i 0.0042 -0.2098i 0.0873 -0.3068i 0.1213 +0.2208i 0.0318 +0.2136i 0.0321 -0.2115i 0.1467 -0.0498i -0.1110 +0.1148i 0.0279 -0.2616i 0.0261 +0.2799i -0.0611 -0.3196i -0.0849 +0.2300i 0.1102 +0.2727i 0.1113 -0.2699i -0.2494 -0.0928i 0.0359 -0.2715i 0.1998 -0.2115i 0.1867 +0.2263i -0.0988 -0.1334i -0.1373 +0.0960i Orthogonality of U: || U^H U - I ||_F = .39E-14
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03YA.html 0000664 0000000 0000000 00000016264 14560147231 0020356 0 ustar 00root root 0000000 0000000
Purpose
To annihilate one or two entries on the subdiagonal of the Hessenberg matrix A for dealing with zero elements on the diagonal of the triangular matrix B. MB03YA is an auxiliary routine called by SLICOT Library routines MB03XP and MB03YD.Specification
SUBROUTINE MB03YA( WANTT, WANTQ, WANTZ, N, ILO, IHI, ILOQ, IHIQ, $ POS, A, LDA, B, LDB, Q, LDQ, Z, LDZ, INFO ) C .. Scalar Arguments .. LOGICAL WANTQ, WANTT, WANTZ INTEGER IHI, IHIQ, ILO, ILOQ, INFO, LDA, LDB, LDQ, LDZ, $ N, POS C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
WANTT LOGICAL Indicates whether the user wishes to compute the full Schur form or the eigenvalues only, as follows: = .TRUE. : Compute the full Schur form; = .FALSE.: compute the eigenvalues only. WANTQ LOGICAL Indicates whether or not the user wishes to accumulate the matrix Q as follows: = .TRUE. : The matrix Q is updated; = .FALSE.: the matrix Q is not required. WANTZ LOGICAL Indicates whether or not the user wishes to accumulate the matrix Z as follows: = .TRUE. : The matrix Z is updated; = .FALSE.: the matrix Z is not required.Input/Output Parameters
N (input) INTEGER The order of the matrices A and B. N >= 0. ILO (input) INTEGER IHI (input) INTEGER It is assumed that the matrices A and B are already (quasi) 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 WANTT = .TRUE.. 1 <= ILO <= max(1,N); min(ILO,N) <= IHI <= N. ILOQ (input) INTEGER IHIQ (input) INTEGER Specify the rows of Q and Z to which transformations must be applied if WANTQ = .TRUE. and WANTZ = .TRUE., respectively. 1 <= ILOQ <= ILO; IHI <= IHIQ <= N. POS (input) INTEGER The position of the zero element on the diagonal of B. ILO <= POS <= IHI. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the upper Hessenberg matrix A. On exit, the leading N-by-N part of this array contains the updated matrix A where A(POS,POS-1) = 0, if POS > ILO, and A(POS+1,POS) = 0, if POS < IHI. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N part of this array must contain an upper triangular matrix B with B(POS,POS) = 0. On exit, the leading N-by-N part of this array contains the updated upper triangular matrix B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, if WANTQ = .TRUE., then the leading N-by-N part of this array must contain the current matrix Q of transformations accumulated by MB03XP. On exit, if WANTQ = .TRUE., then the leading N-by-N part of this array contains the matrix Q updated in the submatrix Q(ILOQ:IHIQ,ILO:IHI). If WANTQ = .FALSE., Q is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1. If WANTQ = .TRUE., LDQ >= MAX(1,N). Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) On entry, if WANTZ = .TRUE., then the leading N-by-N part of this array must contain the current matrix Z of transformations accumulated by MB03XP. On exit, if WANTZ = .TRUE., then the leading N-by-N part of this array contains the matrix Z updated in the submatrix Z(ILOQ:IHIQ,ILO:IHI). If WANTZ = .FALSE., Z is not referenced. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1. If WANTZ = .TRUE., LDZ >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The method is illustrated by Wilkinson diagrams for N = 5, POS = 3: [ x x x x x ] [ x x x x x ] [ x x x x x ] [ o x x x x ] A = [ o x x x x ], B = [ o o o x x ]. [ o o x x x ] [ o o o x x ] [ o o o x x ] [ o o o o x ] First, a QR factorization is applied to A(1:3,1:3) and the resulting nonzero in the updated matrix B is immediately annihilated by a Givens rotation acting on columns 1 and 2: [ x x x x x ] [ x x x x x ] [ x x x x x ] [ o x x x x ] A = [ o o x x x ], B = [ o o o x x ]. [ o o x x x ] [ o o o x x ] [ o o o x x ] [ o o o o x ] Secondly, an RQ factorization is applied to A(4:5,4:5) and the resulting nonzero in the updated matrix B is immediately annihilated by a Givens rotation acting on rows 4 and 5: [ x x x x x ] [ x x x x x ] [ x x x x x ] [ o x x x x ] A = [ o o x x x ], B = [ o o o x x ]. [ o o o x x ] [ o o o x x ] [ o o o x x ] [ o o o o x ]References
[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.Numerical Aspects
The algorithm requires O(N**2) floating point operations and is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To deal with small subtasks of the product eigenvalue problem. MB03YD is an auxiliary routine called by SLICOT Library routine MB03XP.Specification
SUBROUTINE MB03YD( WANTT, WANTQ, WANTZ, N, ILO, IHI, ILOQ, IHIQ, $ A, LDA, B, LDB, Q, LDQ, Z, LDZ, ALPHAR, ALPHAI, $ BETA, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. LOGICAL WANTQ, WANTT, WANTZ INTEGER IHI, IHIQ, ILO, ILOQ, INFO, LDA, LDB, LDQ, $ LDWORK, LDZ, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), ALPHAI(*), ALPHAR(*), B(LDB,*), $ BETA(*), DWORK(*), Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
WANTT LOGICAL Indicates whether the user wishes to compute the full Schur form or the eigenvalues only, as follows: = .TRUE. : Compute the full Schur form; = .FALSE.: compute the eigenvalues only. WANTQ LOGICAL Indicates whether or not the user wishes to accumulate the matrix Q as follows: = .TRUE. : The matrix Q is updated; = .FALSE.: the matrix Q is not required. WANTZ LOGICAL Indicates whether or not the user wishes to accumulate the matrix Z as follows: = .TRUE. : The matrix Z is updated; = .FALSE.: the matrix Z is not required.Input/Output Parameters
N (input) INTEGER The order of the matrices A and B. N >= 0. ILO (input) INTEGER IHI (input) INTEGER It is assumed that the matrices A and B are already (quasi) 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 WANTT = .TRUE.. 1 <= ILO <= max(1,N); min(ILO,N) <= IHI <= N. ILOQ (input) INTEGER IHIQ (input) INTEGER Specify the rows of Q and Z to which transformations must be applied if WANTQ = .TRUE. and WANTZ = .TRUE., respectively. 1 <= ILOQ <= ILO; IHI <= IHIQ <= N. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the upper Hessenberg matrix A. On exit, if WANTT = .TRUE., the leading N-by-N part of this array is upper quasi-triangular in rows and columns ILO:IHI. If WANTT = .FALSE., 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 >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N part of this array must contain the upper triangular matrix B. On exit, if WANTT = .TRUE., 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 WANTT = .FALSE., 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 >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, if WANTQ = .TRUE., then the leading N-by-N part of this array must contain the current matrix Q of transformations accumulated by MB03XP. On exit, if WANTQ = .TRUE., then the leading N-by-N part of this array contains the matrix Q updated in the submatrix Q(ILOQ:IHIQ,ILO:IHI). If WANTQ = .FALSE., Q is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1. If WANTQ = .TRUE., LDQ >= MAX(1,N). Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) On entry, if WANTZ = .TRUE., then the leading N-by-N part of this array must contain the current matrix Z of transformations accumulated by MB03XP. On exit, if WANTZ = .TRUE., then the leading N-by-N part of this array contains the matrix Z updated in the submatrix Z(ILOQ:IHIQ,ILO:IHI). If WANTZ = .FALSE., Z is not referenced. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1. If WANTZ = .TRUE., LDZ >= 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 (ILO <= i <= IHI) 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 WANTT = .TRUE., the eigenvalues are stored in the same order as on the diagonals of the Schur forms of A and B.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = -19, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, then MB03YD failed to compute the Schur form in a total of 30*(IHI-ILO+1) iterations; elements i+1:n of ALPHAR, ALPHAI and BETA contain successfully computed eigenvalues.Method
The implemented algorithm is a double-shift version of the periodic QR algorithm described in [1,3] with some minor modifications [2]. The eigenvalues are computed via an implicit complex single shift algorithm.References
[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.Numerical Aspects
The algorithm requires O(N**3) floating point operations and is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB03YT.html 0000664 0000000 0000000 00000007747 14560147231 0020407 0 ustar 00root root 0000000 0000000
Purpose
To compute the periodic Schur factorization of a real 2-by-2 matrix pair (A,B) where B is upper triangular. This routine computes orthogonal (rotation) matrices given by CSL, SNL and CSR, SNR such that 1) if the pair (A,B) has two real eigenvalues, then [ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ] [ 0 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ] [ b11 b12 ] := [ CSR SNR ] [ b11 b12 ] [ CSL -SNL ] [ 0 b22 ] [ -SNR CSR ] [ 0 b22 ] [ SNL CSL ], 2) if the pair (A,B) has a pair of complex conjugate eigenvalues, then [ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ] [ a21 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ] [ b11 0 ] := [ CSR SNR ] [ b11 b12 ] [ CSL -SNL ] [ 0 b22 ] [ -SNR CSR ] [ 0 b22 ] [ SNL CSL ]. This is a modified version of the LAPACK routine DLAGV2 for computing the real, generalized Schur decomposition of a two-by-two matrix pencil.Specification
SUBROUTINE MB03YT( A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, CSL, SNL, $ CSR, SNR ) C .. Scalar Arguments .. INTEGER LDA, LDB DOUBLE PRECISION CSL, CSR, SNL, SNR C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), ALPHAI(2), ALPHAR(2), B(LDB,*), $ BETA(2)Arguments
Input/Output Parameters
A (input/output) DOUBLE PRECISION array, dimension (LDA,2) On entry, the leading 2-by-2 part of this array must contain the matrix A. On exit, the leading 2-by-2 part of this array contains the matrix A of the pair in periodic Schur form. LDA INTEGER The leading dimension of the array A. LDA >= 2. B (input/output) DOUBLE PRECISION array, dimension (LDB,2) On entry, the leading 2-by-2 part of this array must contain the upper triangular matrix B. On exit, the leading 2-by-2 part of this array contains the matrix B of the pair in periodic Schur form. LDB INTEGER The leading dimension of the array B. LDB >= 2. ALPHAR (output) DOUBLE PRECISION array, dimension (2) ALPHAI (output) DOUBLE PRECISION array, dimension (2) BETA (output) DOUBLE PRECISION array, dimension (2) (ALPHAR(k)+i*ALPHAI(k))*BETA(k) are the eigenvalues of the pair (A,B), k=1,2, i = sqrt(-1). ALPHAI(1) >= 0. CSL (output) DOUBLE PRECISION The cosine of the first rotation matrix. SNL (output) DOUBLE PRECISION The sine of the first rotation matrix. CSR (output) DOUBLE PRECISION The cosine of the second rotation matrix. SNR (output) DOUBLE PRECISION The sine of the second rotation matrix.References
[1] Van Loan, C. Generalized Singular Values with Algorithms and Applications. Ph. D. Thesis, University of Michigan, 1973.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
1. To compute, for a given matrix pair (A,B) in periodic Schur form, orthogonal matrices Ur and Vr so that T [ A11 A12 ] T [ B11 B12 ] Vr * A * Ur = [ ], Ur * B * Vr = [ ], (1) [ 0 A22 ] [ 0 B22 ] is in periodic Schur form, and the eigenvalues of A11*B11 form a selected cluster of eigenvalues. 2. To compute an orthogonal matrix W so that T [ 0 -A11 ] [ R11 R12 ] W * [ ] * W = [ ], (2) [ B11 0 ] [ 0 R22 ] where the eigenvalues of R11 and -R22 coincide and have positive real part. Optionally, the matrix C is overwritten by Ur'*C*Vr. All eigenvalues of A11*B11 must either be complex or real and negative.Specification
SUBROUTINE MB03ZA( COMPC, COMPU, COMPV, COMPW, WHICH, SELECT, N, $ A, LDA, B, LDB, C, LDC, U1, LDU1, U2, LDU2, V1, $ LDV1, V2, LDV2, W, LDW, WR, WI, M, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPC, COMPU, COMPV, COMPW, WHICH INTEGER INFO, LDA, LDB, LDC, LDU1, LDU2, LDV1, LDV2, $ LDW, LDWORK, M, N C .. Array Arguments .. LOGICAL SELECT(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ U1(LDU1,*), U2(LDU2,*), V1(LDV1,*), V2(LDV2,*), $ W(LDW,*), WI(*), WR(*)Arguments
Mode Parameters
COMPC CHARACTER*1 = 'U': update the matrix C; = 'N': do not update C. COMPU CHARACTER*1 = 'U': update the matrices U1 and U2; = 'N': do not update U1 and U2. See the description of U1 and U2. COMPV CHARACTER*1 = 'U': update the matrices V1 and V2; = 'N': do not update V1 and V2. See the description of V1 and V2. COMPW CHARACTER*1 Indicates whether or not the user wishes to accumulate the matrix W as follows: = 'N': the matrix W is not required; = 'I': W is initialized to the unit matrix and the orthogonal transformation matrix W is returned; = 'V': W must contain an orthogonal matrix Q on entry, and the product Q*W is returned. WHICH CHARACTER*1 = 'A': select all eigenvalues, this effectively means that Ur and Vr are identity matrices and A11 = A, B11 = B; = 'S': select a cluster of eigenvalues specified by SELECT. SELECT LOGICAL array, dimension (N) If WHICH = 'S', then SELECT specifies the eigenvalues of A*B in the selected cluster. To select a real eigenvalue w(j), SELECT(j) must be set to .TRUE.. To select a complex conjugate pair of eigenvalues w(j) and w(j+1), corresponding to a 2-by-2 diagonal block in A, both SELECT(j) and SELECT(j+1) must be set to .TRUE.; a complex conjugate pair of eigenvalues must be either both included in the cluster or both excluded.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the upper quasi-triangular matrix A of the matrix pair (A,B) in periodic Schur form. On exit, the leading M-by-M part of this array contains the matrix R22 in (2). LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N part of this array must contain the upper triangular matrix B of the matrix pair (A,B) in periodic Schur form. On exit, the leading N-by-N part of this array is overwritten. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, if COMPC = 'U', the leading N-by-N part of this array must contain a general matrix C. On exit, if COMPC = 'U', the leading N-by-N part of this array contains the updated matrix Ur'*C*Vr. If COMPC = 'N' or WHICH = 'A', this array is not referenced. LDC INTEGER The leading dimension of the array C. LDC >= 1. LDC >= N, if COMPC = 'U' and WHICH = 'S'. U1 (input/output) DOUBLE PRECISION array, dimension (LDU1,N) On entry, if COMPU = 'U' and WHICH = 'S', the leading N-by-N part of this array must contain U1, the (1,1) block of an orthogonal symplectic matrix U = [ U1, U2; -U2, U1 ]. On exit, if COMPU = 'U' and WHICH = 'S', the leading N-by-N part of this array contains U1*Ur. If COMPU = 'N' or WHICH = 'A', this array is not referenced. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= 1. LDU1 >= N, if COMPU = 'U' and WHICH = 'S'. U2 (input/output) DOUBLE PRECISION array, dimension (LDU2,N) On entry, if COMPU = 'U' and WHICH = 'S', the leading N-by-N part of this array must contain U2, the (1,2) block of an orthogonal symplectic matrix U = [ U1, U2; -U2, U1 ]. On exit, if COMPU = 'U' and WHICH = 'S', the leading N-by-N part of this array contains U2*Ur. If COMPU = 'N' or WHICH = 'A', this array is not referenced. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= 1. LDU2 >= N, if COMPU = 'U' and WHICH = 'S'. V1 (input/output) DOUBLE PRECISION array, dimension (LDV1,N) On entry, if COMPV = 'U' and WHICH = 'S', the leading N-by-N part of this array must contain V1, the (1,1) block of an orthogonal symplectic matrix V = [ V1, V2; -V2, V1 ]. On exit, if COMPV = 'U' and WHICH = 'S', the leading N-by-N part of this array contains V1*Vr. If COMPV = 'N' or WHICH = 'A', this array is not referenced. LDV1 INTEGER The leading dimension of the array V1. LDV1 >= 1. LDV1 >= N, if COMPV = 'U' and WHICH = 'S'. V2 (input/output) DOUBLE PRECISION array, dimension (LDV2,N) On entry, if COMPV = 'U' and WHICH = 'S', the leading N-by-N part of this array must contain V2, the (1,2) block of an orthogonal symplectic matrix V = [ V1, V2; -V2, V1 ]. On exit, if COMPV = 'U' and WHICH = 'S', the leading N-by-N part of this array contains V2*Vr. If COMPV = 'N' or WHICH = 'A', this array is not referenced. LDV2 INTEGER The leading dimension of the array V2. LDV2 >= 1. LDV2 >= N, if COMPV = 'U' and WHICH = 'S'. W (input/output) DOUBLE PRECISION array, dimension (LDW,2*M) On entry, if COMPW = 'V', then the leading 2*M-by-2*M part of this array must contain a matrix W. If COMPW = 'I', then W need not be set on entry, W is set to the identity matrix. On exit, if COMPW = 'I' or 'V' the leading 2*M-by-2*M part of this array is post-multiplied by the transformation matrix that produced (2). If COMPW = 'N', this array is not referenced. LDW INTEGER The leading dimension of the array W. LDW >= 1. LDW >= 2*M, if COMPW = 'I' or COMPW = 'V'. WR (output) DOUBLE PRECISION array, dimension (M) WI (output) DOUBLE PRECISION array, dimension (M) The real and imaginary parts, respectively, of the eigenvalues of R11. The eigenvalues are stored in the same order as on the diagonal of R22, with WR(i) = -R22(i,i) and, if R22(i:i+1,i:i+1) is a 2-by-2 diagonal block, WI(i) > 0 and WI(i+1) = -WI(i). In exact arithmetic, these eigenvalue are the positive square roots of the selected eigenvalues of the product A*B. However, if an eigenvalue is sufficiently ill-conditioned, then its value may differ significantly. M (output) INTEGER The number of selected eigenvalues.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = -28, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, 4*N, 8*M ).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: reordering of the product A*B in Step 1 failed because some eigenvalues are too close to separate; = 2: reordering of some submatrix in Step 2 failed because some eigenvalues are too close to separate; = 3: the QR algorithm failed to compute the Schur form of some submatrix in Step 2; = 4: the condition that all eigenvalues of A11*B11 must either be complex or real and negative is numerically violated.Method
Step 1 is performed using a reordering technique analogous to the LAPACK routine DTGSEN for reordering matrix pencils [1,2]. Step 2 is an implementation of Algorithm 2 in [3]. It requires O(M*N*N) floating point operations.References
[1] Kagstrom, B. A direct method for reordering eigenvalues in the generalized real Schur form of a regular matrix pair (A,B), in M.S. Moonen et al (eds), Linear Algebra for Large Scale and Real-Time Applications, Kluwer Academic Publ., 1993, pp. 195-218. [2] Kagstrom, B. and Poromaa P.: Computing eigenspaces with specified eigenvalues of a regular matrix pair (A, B) and condition estimation: Theory, algorithms and software, Numer. Algorithms, 1996, vol. 12, pp. 369-407. [3] Benner, P., Mehrmann, V., and Xu, H. A new method for computing the stable invariant subspace of a real Hamiltonian matrix, J. Comput. Appl. Math., 86, pp. 17-43, 1997.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the stable and unstable invariant subspaces for a Hamiltonian matrix with no eigenvalues on the imaginary axis, using the output of the SLICOT Library routine MB03XD.Specification
SUBROUTINE MB03ZD( WHICH, METH, STAB, BALANC, ORTBAL, SELECT, N, $ MM, ILO, SCALE, S, LDS, T, LDT, G, LDG, U1, $ LDU1, U2, LDU2, V1, LDV1, V2, LDV2, M, WR, WI, $ US, LDUS, UU, LDUU, LWORK, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER BALANC, METH, ORTBAL, STAB, WHICH INTEGER ILO, INFO, LDG, LDS, LDT, LDU1, LDU2, LDUS, $ LDUU, LDV1, LDV2, LDWORK, M, MM, N C .. Array Arguments .. LOGICAL LWORK(*), SELECT(*) INTEGER IWORK(*) DOUBLE PRECISION DWORK(*), G(LDG,*), S(LDS,*), SCALE(*), $ T(LDT,*), U1(LDU1,*), U2(LDU2,*), US(LDUS,*), $ UU(LDUU,*), V1(LDV1,*), V2(LDV2,*), WI(*), $ WR(*)Arguments
Mode Parameters
WHICH CHARACTER*1 Specifies the cluster of eigenvalues for which the invariant subspaces are computed: = 'A': select all n eigenvalues; = 'S': select a cluster of eigenvalues specified by SELECT. METH CHARACTER*1 If WHICH = 'A' this parameter specifies the method to be used for computing bases of the invariant subspaces: = 'S': compute the n-dimensional basis from a set of n vectors; = 'L': compute the n-dimensional basis from a set of 2*n vectors; = 'Q': quick return of the set of n vectors; = 'R': quick return of the set of 2*n vectors. When in doubt, use METH = 'S'. In some cases, METH = 'L' may result in more accurately computed invariant subspaces, see [1]. Options METH = 'Q' or METH = 'R' return the range vectors Y = [ Y1; Y2 ], where Y1 and Y2 have 2*n rows and n or 2*n columns, respectively, which can be directly used, e.g., for finding the (stabilizing) solution of a Riccati equation, by solving X*Y1 = Y2. Note that Y1 might be singular when METH = 'Q'. STAB CHARACTER*1 Specifies the type of invariant subspaces to be computed: = 'S': compute the stable invariant subspace, i.e., the invariant subspace belonging to those selected eigenvalues that have negative real part; = 'U': compute the unstable invariant subspace, i.e., the invariant subspace belonging to those selected eigenvalues that have positive real part; = 'B': compute both the stable and unstable invariant subspaces. BALANC CHARACTER*1 Specifies the type of inverse balancing transformation required: = 'N': do nothing; = 'P': do inverse transformation for permutation only; = 'S': do inverse transformation for scaling only; = 'B': do inverse transformations for both permutation and scaling. BALANC must be the same as the argument BALANC supplied to MB03XD. Note that if the data is further post-processed, e.g., for solving an algebraic Riccati equation, it is recommended to delay inverse balancing (in particular the scaling part) and apply it to the final result only, see [2]. Inverse balancing is not used by this routine if METH = 'Q' or METH = 'R'. ORTBAL CHARACTER*1 If BALANC <> 'N', this option specifies how inverse balancing is applied to the computed invariant subspaces: = 'B': apply inverse balancing before orthogonal bases for the invariant subspaces are computed; = 'A': apply inverse balancing after orthogonal bases for the invariant subspaces have been computed; this may yield non-orthogonal bases if BALANC = 'S' or BALANC = 'B'. SELECT (input) LOGICAL array, dimension (N) If WHICH = 'S', SELECT specifies the eigenvalues corresponding to the positive and negative square roots of the eigenvalues of S*T in the selected cluster. To select a real eigenvalue w(j), SELECT(j) must be set to .TRUE.. To select a complex conjugate pair of eigenvalues w(j) and w(j+1), corresponding to a 2-by-2 diagonal block, both SELECT(j) and SELECT(j+1) must be set to .TRUE.; a complex conjugate pair of eigenvalues must be either both included in the cluster or both excluded. This array is not referenced if WHICH = 'A'.Input/Output Parameters
N (input) INTEGER The order of the matrices S, T and G. N >= 0. MM (input) INTEGER The number of columns in the arrays US and/or UU. If WHICH = 'A' and (METH = 'S' or METH = 'Q'), MM = N; if WHICH = 'A' and (METH = 'L' or METH = 'R'), MM = 2*N; if WHICH = 'S', MM = M. The values above for MM give the numbers of vectors to be returned, if METH = 'Q' or METH = 'R', or the numbers of vectors to be used for computing a basis for the invariant subspace(s), if METH = 'S' or METH = 'L', or WHICH = 'S'. ILO (input) INTEGER If BALANC <> 'N', then ILO is the integer returned by MB03XD. 1 <= ILO <= N+1. SCALE (input) DOUBLE PRECISION array, dimension (N) If BALANC <> 'N', the leading N elements of this array must contain details of the permutation and scaling factors, as returned by MB03XD. This array is not referenced if BALANC = 'N'. S (input/output) DOUBLE PRECISION array, dimension (LDS,N) On entry, the leading N-by-N part of this array must contain the matrix S in real Schur form. On exit, the leading N-by-N part of this array is overwritten. LDS INTEGER The leading dimension of the array S. LDS >= max(1,N). T (input/output) DOUBLE PRECISION array, dimension (LDT,N) On entry, the leading N-by-N part of this array must contain the upper triangular matrix T. On exit, the leading N-by-N part of this array is overwritten. LDT INTEGER The leading dimension of the array T. LDT >= max(1,N). G (input/output) DOUBLE PRECISION array, dimension (LDG,N) On entry, if METH = 'L' or METH = 'R', the leading N-by-N part of this array must contain a general matrix G. On exit, if METH = 'L' or METH = 'R', the leading N-by-N part of this array is overwritten. This array is not referenced if METH = 'S' or METH = 'Q'. LDG INTEGER The leading dimension of the array G. LDG >= 1. LDG >= max(1,N) if METH = 'L' or METH = 'R'. U1 (input/output) DOUBLE PRECISION array, dimension (LDU1,N) On entry, the leading N-by-N part of this array must contain the (1,1) block of an orthogonal symplectic matrix U. On exit, this array is overwritten. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= MAX(1,N). U2 (input/output) DOUBLE PRECISION array, dimension (LDU2,N) On entry, the leading N-by-N part of this array must contain the (2,1) block of an orthogonal symplectic matrix U. On exit, this array is overwritten. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= MAX(1,N). V1 (input/output) DOUBLE PRECISION array, dimension (LDV1,N) On entry, the leading N-by-N part of this array must contain the (1,1) block of an orthogonal symplectic matrix V. On exit, this array is overwritten. LDV1 INTEGER The leading dimension of the array V1. LDV1 >= MAX(1,N). V2 (input/output) DOUBLE PRECISION array, dimension (LDV1,N) On entry, the leading N-by-N part of this array must contain the (2,1) block of an orthogonal symplectic matrix V. On exit, this array is overwritten. LDV2 INTEGER The leading dimension of the array V2. LDV2 >= MAX(1,N). M (output) INTEGER The number of selected eigenvalues. WR (output) DOUBLE PRECISION array, dimension (M) WI (output) DOUBLE PRECISION array, dimension (M) On exit, the leading M elements of WR and WI contain the real and imaginary parts, respectively, of the selected eigenvalues that have nonpositive real part. Complex conjugate pairs of eigenvalues with real part not equal to zero will appear consecutively with the eigenvalue having the positive imaginary part first. Note that, due to roundoff errors, these numbers may differ from the eigenvalues computed by MB03XD. US (output) DOUBLE PRECISION array, dimension (LDUS,MM) On exit, if STAB = 'S' or STAB = 'B', the leading 2*N-by-MM part of this array contains a basis for the stable invariant subspace belonging to the selected eigenvalues, if METH = 'S' or METH = 'L', or the range vectors Y, if METH = 'Q' or METH = 'R' (see parameter METH). This basis is orthogonal unless ORTBAL = 'A'. LDUS INTEGER The leading dimension of the array US. LDUS >= 1. If STAB = 'S' or STAB = 'B', LDUS >= 2*N. UU (output) DOUBLE PRECISION array, dimension (LDUU,MM) On exit, if STAB = 'U' or STAB = 'B', the leading 2*N-by-MM part of this array contains a basis for the unstable invariant subspace belonging to the selected eigenvalues, if METH = 'S' or METH = 'L', or the range vectors Y, if METH = 'Q' or METH = 'R' (see parameter METH). This basis is orthogonal unless ORTBAL = 'A'. LDUU INTEGER The leading dimension of the array UU. LDUU >= 1. If STAB = 'U' or STAB = 'B', LDUU >= 2*N.Workspace
LWORK LOGICAL array, dimension (2*N) This array is only referenced if WHICH = 'A' and (METH = 'L' or METH = 'R'). IWORK INTEGER array, dimension (LIWORK) LIWORK = 2*N, if WHICH = 'A' and METH = 'L'; LIWORK = N, if WHICH = 'A' and METH = 'S'; LIWORK = 0, if WHICH = 'A' and METH = 'Q' or METH = 'R'; LIWORK = M, if WHICH = 'S'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -35, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. If WHICH = 'S' or METH = 'S' or METH = 'Q': LDWORK >= MAX( 1, 4*M*M + MAX( 8*M, 4*N ) ). If WHICH = 'A' and (METH = 'L' or METH = 'R') and ( STAB = 'U' or STAB = 'S' ): LDWORK >= MAX( 1, 2*N*N + 2*N, 8*N ). If WHICH = 'A' and (METH = 'L' or METH = 'R') and STAB = 'B': LDWORK >= 8*N + 1. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: some of the selected eigenvalues are on or too close to the imaginary axis; = 2: reordering of the product S*T in routine MB03ZA failed because some eigenvalues are too close to separate; = 3: the QR algorithm failed to compute some Schur form in MB03ZA; = 4: reordering of the Hamiltonian Schur form in routine MB03TD failed because some eigenvalues are too close to separate; = 5: the computed stable invariant subspace for METH = 'S' is inaccurate. This may be taken as a warning and a suggestion to try METH = 'L'; = 6: the computed unstable invariant subspace for METH = 'S' is inaccurate. This may be taken as a warning and a suggestion to try METH = 'L'.Method
This is an implementation of Algorithm 1 in [1].Numerical Aspects
The method is strongly backward stable for an embedded (skew-)Hamiltonian matrix, see [1]. Although good results have been reported if the eigenvalues are not too close to the imaginary axis, the method is not backward stable for the original Hamiltonian matrix itself.References
[1] Benner, P., Mehrmann, V., and Xu, H. A new method for computing the stable invariant subspace of a real Hamiltonian matrix, J. Comput. Appl. Math., 86, pp. 17-43, 1997. [2] Benner, P. Symplectic balancing of Hamiltonian matrices. SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.Further Comments
NoneExample
Program Text
* MB03ZD 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 LDG, LDRES, LDS, LDT, LDU1, LDU2, LDUS, LDUU, $ LDV1, LDV2, LDWORK PARAMETER ( LDG = NMAX, LDRES = 2*NMAX, LDS = NMAX, $ LDT = NMAX, LDU1 = NMAX, LDU2 = NMAX, $ LDUS = 2*NMAX, LDUU = 2*NMAX, LDV1 = NMAX, $ LDV2 = NMAX, LDWORK = 3*NMAX*NMAX + 7*NMAX ) * .. Local Scalars .. CHARACTER*1 BALANC, METH, ORTBAL, STAB, WHICH INTEGER I, ILO, INFO, J, M, N * .. Local Arrays .. LOGICAL LWORK(2*NMAX), SELECT(NMAX) INTEGER IWORK(2*NMAX) DOUBLE PRECISION DWORK(LDWORK), G(LDG, NMAX), RES(LDRES,NMAX), $ S(LDS, NMAX), SCALE(NMAX), T(LDT,NMAX), $ U1(LDU1,NMAX), U2(LDU2, NMAX), US(LDUS,2*NMAX), $ UU(LDUU,2*NMAX), V1(LDV1,NMAX), V2(LDV2, NMAX), $ WI(NMAX), WR(NMAX) * .. External Functions .. EXTERNAL DLANGE, LSAME LOGICAL LSAME DOUBLE PRECISION DLANGE * .. External Subroutines .. EXTERNAL MB03ZD * .. 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, WHICH, METH, STAB, BALANC, ORTBAL IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE * IF ( LSAME( WHICH, 'S' ) ) $ READ ( NIN, FMT = * ) ( SELECT(I), I = 1,N ) READ ( NIN, FMT = * ) ( ( S(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( WHICH, 'A' ).AND.LSAME( METH, 'L' ) ) $ READ ( NIN, FMT = * ) ( ( G(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( BALANC, 'P' ).OR.LSAME( BALANC, 'S' ).OR. $ LSAME( BALANC, 'B' ) ) $ READ ( NIN, FMT = * ) ( SCALE(I), I = 1,N ) READ ( NIN, FMT = * ) ( ( U1(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( U2(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( V1(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( V2(I,J), J = 1,N ), I = 1,N ) * CALL MB03ZD( WHICH, METH, STAB, BALANC, ORTBAL, SELECT, N, 2*N, $ ILO, SCALE, S, LDS, T, LDT, G, LDG, U1, LDU1, U2, $ LDU2, V1, LDV1, V2, LDV2, M, WR, WI, US, LDUS, $ UU, LDUU, LWORK, IWORK, 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 ) I, WR(I), WI(I) 20 CONTINUE * IF ( LSAME( STAB, 'S' ).OR.LSAME( STAB, 'B' ) ) THEN WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, 2*N WRITE ( NOUT, FMT = 99993 ) ( US(I,J), J = 1,M ) 30 CONTINUE IF ( LSAME( ORTBAL, 'B' ).OR.LSAME( BALANC, 'N' ).OR. $ LSAME( BALANC, 'P' ) ) THEN CALL DGEMM( 'Transpose', 'No Transpose', M, M, 2*N, $ ONE, US, LDUS, US, LDUS, ZERO, RES, $ LDRES ) DO 40 I = 1, M RES(I,I) = RES(I,I) - ONE 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DLANGE( 'Frobenius', M, M, $ RES, LDRES, DWORK ) END IF CALL DGEMM( 'Transpose', 'No Transpose', M, M, N, ONE, $ US, LDUS, US(N+1,1), LDUS, ZERO, RES, LDRES ) CALL DGEMM( 'Transpose', 'No Transpose', M, M, N, -ONE, $ US(N+1,1), LDUS, US, LDUS, ONE, RES, LDRES ) WRITE ( NOUT, FMT = 99990 ) DLANGE( 'Frobenius', M, M, $ RES, LDRES, DWORK ) END IF * IF ( LSAME( STAB, 'U' ).OR.LSAME( STAB, 'B' ) ) THEN WRITE ( NOUT, FMT = 99994 ) DO 50 I = 1, 2*N WRITE ( NOUT, FMT = 99993 ) ( UU(I,J), J = 1,M ) 50 CONTINUE IF ( LSAME( ORTBAL, 'B' ).OR.LSAME( BALANC, 'N' ).OR. $ LSAME( BALANC, 'P' ) ) THEN CALL DGEMM( 'Transpose', 'No Transpose', M, M, 2*N, $ ONE, UU, LDUU, UU, LDUU, ZERO, RES, $ LDRES ) DO 60 I = 1, M RES(I,I) = RES(I,I) - ONE 60 CONTINUE WRITE ( NOUT, FMT = 99989 ) DLANGE( 'Frobenius', M, M, $ RES, LDRES, DWORK ) END IF CALL DGEMM( 'Transpose', 'No Transpose', M, M, N, ONE, $ UU, LDUU, UU(N+1,1), LDUU, ZERO, RES, LDRES ) CALL DGEMM( 'Transpose', 'No Transpose', M, M, N, -ONE, $ UU(N+1,1), LDUU, UU, LDUU, ONE, RES, LDRES ) WRITE ( NOUT, FMT = 99988 ) DLANGE( 'Frobenius', M, M, $ RES, LDRES, DWORK ) END IF END IF END IF * 99999 FORMAT (' MB03ZD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB03ZD = ',I2) 99997 FORMAT (' The stable eigenvalues are',//' i',6X, $ 'WR(i)',6X,'WI(i)',/) 99996 FORMAT (I4,3X,F8.4,3X,F8.4) 99995 FORMAT (/' A basis for the stable invariant subspace is') 99994 FORMAT (/' A basis for the unstable invariant subspace is') 99993 FORMAT (20(1X,F9.3)) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' Orthogonality of US: || US''*US - I ||_F = ',G7.2) 99990 FORMAT (/' Symplecticity of US: || US''*J*US ||_F = ',G7.2) 99989 FORMAT (/' Orthogonality of UU: || UU''*UU - I ||_F = ',G7.2) 99988 FORMAT (/' Symplecticity of UU: || UU''*J*UU ||_F = ',G7.2) ENDProgram Data
MB03ZD EXAMPLE PROGRAM DATA 5 1 A L B N B -3.1844761777714732 0.1612357243439331 -0.0628592203751138 0.2449004200921981 0.1974400149992579 0.0000000000000000 -0.1510667773167784 0.4260444411622838 -0.1775026035208615 0.3447278421198472 0.0000000000000000 -0.1386140422054264 -0.3006779624777515 0.2944143257134196 0.3456440339120323 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.2710128384740570 0.0933189808067138 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.4844146572359603 0.2004347508746697 3.2038208121776366 0.1805955192510651 0.2466389119377561 -0.2539149302433368 -0.0359238844381195 0.0000000000000000 -0.7196686433290816 0.0000000000000000 0.2428659121580384 -0.0594190100670832 0.0000000000000000 0.0000000000000000 -0.1891741194498107 -0.3309578443491266 -0.0303520731950515 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.4361574461961550 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.1530894573304220 -0.0370982242678464 0.0917788436945724 -0.0560402416315252 0.1345152517579192 0.0256668227276700 0.0652183678916931 -0.0700457231988297 0.0350041175858839 -0.2233868768749268 -0.1171980260782843 -0.0626428681377119 0.2327575351902772 -0.1251515732208170 -0.0177816046663201 0.3696921118421182 0.0746042309265599 -0.0828007611045140 0.0217427473546043 -0.1157775118548851 -0.3161183681200527 0.1374372236164812 0.1002727885506992 0.4021556774753973 -0.0431072263235579 0.1067394572547867 0.3806883009357247 -0.0347810363019649 -0.5014665065895758 0.5389691288472394 0.2685446895251367 0.4642712665555326 -0.5942766860716395 0.4781179763952615 0.2334370556238151 0.0166790369048933 0.2772789197782788 -0.0130145392695876 -0.2123817030594055 -0.2550292626960107 -0.5049268366774490 0.4209268575081796 0.1499593172661228 -0.1925590746592156 -0.5472292877802402 0.4543329704184054 0.3969669479129449 0.6321903535930828 0.3329156356041961 0.0163533225344433 -0.2638879466190024 -0.1795922007470742 0.1908329820840911 0.0868799433942070 0.3114741142062388 -0.2579907627915167 -0.2447897730222852 -0.1028403314750045 -0.1157840914576285 -0.1873268885694406 0.1700708002861580 -0.2243335325285328 0.3180998613802520 0.3315380214794822 0.1977859924739963 0.5072476567310013 -0.2128397588651423 -0.2740560593051881 0.1941418870268881 -0.3096684962457369 -0.0581576193198714 -0.2002027567371932 -0.0040094115506855 -0.3979373387545264 0.1520881534833910 -0.2010804514091372 0.4447147692018334 -0.6830166755147440 -0.0002576861753487 0.5781954611783305 -0.0375091627893805 0.5121756358795817 0.0297197140254773 0.4332229148788766 -0.3240527006890552 0.5330850295256511 0.3664711365265602 0.3288511296455119 0.0588396016404451 0.1134221597062257 0.1047567336850078 0.4535357098437908 0.1062866148880792 -0.3964092656837774 -0.2211800890450674 0.0350667323996222 0.4450432900616097 0.2950206358263853 -0.1617837757183893 -0.0376369332204927 -0.6746752660482623 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0299719306696789 -0.2322624725320701 -0.0280846899680325 -0.3044255686880000 -0.1077641482535519 -0.0069083614679702 0.3351358347080056 -0.4922707032978891 0.4293545450291714 0.4372821269062001 0.0167847133528843 0.2843629278945327 0.5958979805231146 0.3097336757510886 -0.2086733033047188 0.0248567764822071 -0.2810759958040470 -0.1653113624869834 -0.3528780198620412 -0.0254898556119252Program Results
MB03ZD EXAMPLE PROGRAM RESULTS The stable eigenvalues are i WR(i) WI(i) 1 -3.1941 0.0000 2 -0.1350 0.3179 3 -0.1350 -0.3179 4 -0.0595 0.2793 5 -0.0595 -0.2793 A basis for the stable invariant subspace is -0.102 -0.116 0.627 0.118 -0.605 -0.100 -0.510 -0.266 0.504 0.124 -0.179 0.015 -0.112 -0.142 0.413 -0.055 0.252 0.182 -0.134 0.100 -0.078 0.576 -0.271 -0.252 -0.177 0.340 -0.135 0.053 -0.234 -0.110 0.528 0.108 -0.205 0.219 -0.096 0.397 -0.429 0.161 -0.598 0.199 0.444 0.342 0.447 0.406 0.440 0.434 0.014 -0.383 0.072 -0.391 Orthogonality of US: || US'*US - I ||_F = .62E-15 Symplecticity of US: || US'*J*US ||_F = .23E-14 A basis for the unstable invariant subspace is -0.428 0.383 0.048 0.105 0.187 -0.506 -0.100 0.541 0.245 0.223 -0.334 -0.524 -0.044 -0.153 0.126 -0.453 0.076 0.103 -0.525 -0.268 -0.436 0.098 -0.752 0.209 -0.251 -0.093 -0.089 0.258 -0.114 -0.725 -0.112 -0.196 -0.186 -0.302 0.394 -0.120 -0.286 0.027 0.680 -0.119 -0.102 0.630 0.079 0.040 0.127 -0.091 -0.171 -0.136 -0.136 0.231 Orthogonality of UU: || UU'*UU - I ||_F = .69E-15 Symplecticity of UU: || UU'*J*UU ||_F = .10E-13
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04AD.html 0000664 0000000 0000000 00000075132 14560147231 0020331 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of a real N-by-N skew-Hamiltonian/ Hamiltonian pencil aS - bH with ( 0 I ) S = T Z = J Z' J' Z, where J = ( ), (1) ( -I 0 ) via generalized symplectic URV decomposition. That is, orthogonal matrices Q1 and Q2 and orthogonal symplectic matrices U1 and U2 are computed such that ( T11 T12 ) Q1' T U1 = Q1' J Z' J' U1 = ( ) = Tout, ( 0 T22 ) ( Z11 Z12 ) U2' Z Q2 = ( ) = Zout, (2) ( 0 Z22 ) ( H11 H12 ) Q1' H Q2 = ( ) = Hout, ( 0 H22 ) where T11, T22', Z11, Z22', H11 are upper triangular and H22' is upper quasi-triangular. The notation M' denotes the transpose of the matrix M. Optionally, if COMPQ1 = 'I' or COMPQ1 = 'U', the orthogonal transformation matrix Q1 will be computed. Optionally, if COMPQ2 = 'I' or COMPQ2 = 'U', the orthogonal transformation matrix Q2 will be computed. Optionally, if COMPU1 = 'I' or COMPU1 = 'U', the orthogonal symplectic transformation matrix ( U11 U12 ) U1 = ( ) ( -U12 U11 ) will be computed. Optionally, if COMPU2 = 'I' or COMPU2 = 'U', the orthogonal symplectic transformation matrix ( U21 U22 ) U2 = ( ) ( -U22 U21 ) will be computed.Specification
SUBROUTINE MB04AD( JOB, COMPQ1, COMPQ2, COMPU1, COMPU2, N, Z, LDZ, $ H, LDH, Q1, LDQ1, Q2, LDQ2, U11, LDU11, U12, $ LDU12, U21, LDU21, U22, LDU22, T, LDT, ALPHAR, $ ALPHAI, BETA, IWORK, LIWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER COMPQ1, COMPQ2, COMPU1, COMPU2, JOB INTEGER INFO, LDH, LDQ1, LDQ2, LDT, LDU11, LDU12, $ LDU21, LDU22, LDWORK, LDZ, LIWORK, N C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION ALPHAI( * ), ALPHAR( * ), BETA( * ), $ DWORK( * ), H( LDH, * ), Q1( LDQ1, * ), $ Q2( LDQ2, * ), T( LDT, * ), U11( LDU11, * ), $ U12( LDU12, * ), U21( LDU21, * ), $ U22( LDU22, * ), Z( LDZ, * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; Z, T, and H will not necessarily be put into the forms in (2); H22' is upper Hessenberg; = 'T': put Z, T, and H into the forms in (2), and return the eigenvalues in ALPHAR, ALPHAI and BETA. COMPQ1 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q1, as follows: = 'N': Q1 is not computed; = 'I': the array Q1 is initialized internally to the unit matrix, and the orthogonal matrix Q1 is returned; = 'U': the array Q1 contains an orthogonal matrix Q01 on entry, and the product Q01*Q1 is returned, where Q1 is the product of the orthogonal transformations that are applied to the pencil aT*Z - bH on the left to reduce T, Z, and H to the forms in (2), for COMPQ1 = 'I'. COMPQ2 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q2, as follows: = 'N': Q2 is not computed; = 'I': the array Q2 is initialized internally to the unit matrix, and the orthogonal matrix Q2 is returned; = 'U': the array Q2 contains an orthogonal matrix Q02 on entry, and the product Q02*Q2 is returned, where Q2 is the product of the orthogonal transformations that are applied to the pencil aT*Z - bH on the right to reduce T, Z, and H to the forms in (2), for COMPQ2 = 'I'. COMPU1 CHARACTER*1 Specifies whether to compute the orthogonal symplectic transformation matrix U1, as follows: = 'N': U1 is not computed; = 'I': the arrays U11 and U12 are initialized internally to the unit and zero matrices, respectively, and the corresponding submatrices of the orthogonal symplectic matrix U1 are returned; = 'U': the arrays U11 and U12 contain the corresponding submatrices of an orthogonal symplectic matrix U01 on entry, and the updated submatrices U11 and U12 of the matrix product U01*U1 are returned, where U1 is the product of the orthogonal symplectic transformations that are applied to the pencil aT*Z - bH to reduce T, Z, and H to the forms in (2), for COMPU1 = 'I'. COMPU2 CHARACTER*1 Specifies whether to compute the orthogonal symplectic transformation matrix U2, as follows: = 'N': U2 is not computed; = 'I': the arrays U21 and U22 are initialized internally to the unit and zero matrices, respectively, and the corresponding submatrices of the orthogonal symplectic matrix U2 are returned; = 'U': the arrays U21 and U22 contain the corresponding submatrices of an orthogonal symplectic matrix U02 on entry, and the updated submatrices U21 and U22 of the matrix product U02*U2 are returned, where U2 is the product of the orthogonal symplectic transformations that are applied to the pencil aT*Z - bH to reduce T, Z, and H to the forms in (2), for COMPU2 = 'I'.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N) On entry, the leading N-by-N part of this array must contain the matrix Z. On exit, if JOB = 'T', the leading N-by-N part of this array contains the matrix Zout; otherwise, it contains the matrix Z obtained just before the application of the periodic QZ algorithm. The elements of the (2,1) block, i.e., in the rows N/2+1 to N and in the columns 1 to N/2 are not set to zero, but are unchanged on exit. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1, N). H (input/output) DOUBLE PRECISION array, dimension (LDH, N) On entry, the leading N-by-N part of this array must contain the Hamiltonian matrix H (H22 = -H11', H12 = H12', H21 = H21'). On exit, if JOB = 'T', the leading N-by-N part of this array contains the matrix Hout; otherwise, it contains the matrix H obtained just before the application of the periodic QZ algorithm. LDH INTEGER The leading dimension of the array H. LDH >= MAX(1, N). Q1 (input/output) DOUBLE PRECISION array, dimension (LDQ1, N) On entry, if COMPQ1 = 'U', then the leading N-by-N part of this array must contain a given matrix Q01, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q01 and the transformation matrix Q1 used to transform the matrices Z, T and H. On exit, if COMPQ1 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q1. If COMPQ1 = 'N', this array is not referenced. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= 1, if COMPQ1 = 'N'; LDQ1 >= MAX(1, N), if COMPQ1 = 'I' or COMPQ1 = 'U'. Q2 (input/output) DOUBLE PRECISION array, dimension (LDQ2, N) On entry, if COMPQ2 = 'U', then the leading N-by-N part of this array must contain a given matrix Q02, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q02 and the transformation matrix Q2 used to transform the matrices Z, T and H. On exit, if COMPQ2 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q2. If COMPQ2 = 'N', this array is not referenced. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= 1, if COMPQ2 = 'N'; LDQ2 >= MAX(1, N), if COMPQ2 = 'I' or COMPQ2 = 'U'. U11 (input/output) DOUBLE PRECISION array, dimension (LDU11, N/2) On entry, if COMPU1 = 'U', then the leading N/2-by-N/2 part of this array must contain the upper left block of a given matrix U01, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper left block U11 of the product of the input matrix U01 and the transformation matrix U1 used to transform the matrices Z, T, and H. On exit, if COMPU1 = 'I', then the leading N/2-by-N/2 part of this array contains the upper left block U11 of the orthogonal symplectic transformation matrix U1. If COMPU1 = 'N' this array is not referenced. LDU11 INTEGER The leading dimension of the array U11. LDU11 >= 1, if COMPU1 = 'N'; LDU11 >= MAX(1, N/2), if COMPU1 = 'I' or COMPU1 = 'U'. U12 (input/output) DOUBLE PRECISION array, dimension (LDU12, N/2) On entry, if COMPU1 = 'U', then the leading N/2-by-N/2 part of this array must contain the upper right block of a given matrix U01, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper right block U12 of the product of the input matrix U01 and the transformation matrix U1 used to transform the matrices Z, T, and H. On exit, if COMPU1 = 'I', then the leading N/2-by-N/2 part of this array contains the upper right block U12 of the orthogonal symplectic transformation matrix U1. If COMPU1 = 'N' this array is not referenced. LDU12 INTEGER The leading dimension of the array U12. LDU12 >= 1, if COMPU1 = 'N'; LDU12 >= MAX(1, N/2), if COMPU1 = 'I' or COMPU1 = 'U'. U21 (input/output) DOUBLE PRECISION array, dimension (LDU21, N/2) On entry, if COMPU2 = 'U', then the leading N/2-by-N/2 part of this array must contain the upper left block of a given matrix U02, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper left block U21 of the product of the input matrix U02 and the transformation matrix U2 used to transform the matrices Z, T, and H. On exit, if COMPU2 = 'I', then the leading N/2-by-N/2 part of this array contains the upper left block U21 of the orthogonal symplectic transformation matrix U2. If COMPU2 = 'N' this array is not referenced. LDU21 INTEGER The leading dimension of the array U21. LDU21 >= 1, if COMPU2 = 'N'; LDU21 >= MAX(1, N/2), if COMPU2 = 'I' or COMPU2 = 'U'. U22 (input/output) DOUBLE PRECISION array, dimension (LDU22, N/2) On entry, if COMPU2 = 'U', then the leading N/2-by-N/2 part of this array must contain the upper right block of a given matrix U02, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper right block U22 of the product of the input matrix U02 and the transformation matrix U2 used to transform the matrices Z, T, and H. On exit, if COMPU2 = 'I', then the leading N/2-by-N/2 part of this array contains the upper right block U22 of the orthogonal symplectic transformation matrix U2. If COMPU2 = 'N' this array is not referenced. LDU22 INTEGER The leading dimension of the array U22. LDU22 >= 1, if COMPU2 = 'N'; LDU22 >= MAX(1, N/2), if COMPU2 = 'I' or COMPU2 = 'U'. T (output) DOUBLE PRECISION array, dimension (LDT, N) If JOB = 'T', the leading N-by-N part of this array contains the matrix Tout; otherwise, it contains the matrix T obtained just before the application of the periodic QZ algorithm. LDT INTEGER The leading dimension of the array T. LDT >= MAX(1, N). ALPHAR (output) DOUBLE PRECISION array, dimension (N/2) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N/2) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N/2) The scalars beta defining the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed. Due to the skew-Hamiltonian/Hamiltonian structure of the pencil, for every eigenvalue lambda, -lambda is also an eigenvalue, and thus it has only to be saved once in ALPHAR, ALPHAI and BETA. Specifically, only eigenvalues with imaginary parts greater than or equal to zero are stored; their conjugate eigenvalues are not stored. If imaginary parts are zero (i.e., for real eigenvalues), only positive eigenvalues are stored. The remaining eigenvalues have opposite signs. As a consequence, pairs of complex eigenvalues, stored in consecutive locations, are not complex conjugate.Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = 3, IWORK(1) contains the number of (pairs of) possibly inaccurate eigenvalues, q <= N/2, and IWORK(2), ..., IWORK(q+1) indicate their indices. Specifically, a positive value is an index of a real or purely imaginary eigenvalue, corresponding to a 1-by-1 block, while the absolute value of a negative entry in IWORK is an index to the first eigenvalue in a pair of consecutively stored eigenvalues, corresponding to a 2-by-2 block. A 2-by-2 block may have two complex, two real, two purely imaginary, or one real and one purely imaginary eigenvalue. For i = q+2, ..., 2*q+1, IWORK(i) contains a pointer to the starting location in DWORK of the i-th quadruple of 1-by-1 blocks, if IWORK(i-q) > 0, or 2-by-2 blocks, if IWORK(i-q) < 0, defining unreliable eigenvalues. IWORK(2*q+2) contains the number of the 1-by-1 blocks, and IWORK(2*q+3) contains the number of the 2-by-2 blocks, corresponding to unreliable eigenvalues. IWORK(2*q+4) contains the total number t of the 2-by-2 blocks. If INFO = 0, then q = 0, therefore IWORK(1) = 0. LIWORK INTEGER The dimension of the array IWORK. LIWORK >= N+18. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or INFO = 3, DWORK(1) returns the optimal LDWORK, and DWORK(2), ..., DWORK(7) contain the Frobenius norms of the factors of the formal matrix product used by the algorithm. In addition, DWORK(8), ..., DWORK(7+6*s) contain the s sextuple values corresponding to the 1-by-1 blocks. Their eigenvalues are real or purely imaginary. Such an eigenvalue is obtained from -i*sqrt((a1/a2/a3)*(a4/a5/a6)), but always taking a positive sign, where a1, ..., a6 are the corresponding sextuple values. Moreover, DWORK(8+6*s), ..., DWORK(7+6*s+24*t) contain the t groups of sextuple 2-by-2 matrices corresponding to the 2-by-2 blocks. Their eigenvalue pairs are either complex, or placed on the real and imaginary axes. Such an eigenvalue pair is obtained as -1i*sqrt(ev), but taking positive imaginary parts, where ev are the eigenvalues of the product A1*inv(A2)*inv(A3)*A4*inv(A5)*inv(A6), where A1, ..., A6 define the corresponding 2-by-2 matrix sextuple. On exit, if INFO = -31, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. If JOB = 'E' and COMPQ1 = 'N' and COMPQ2 = 'N' and COMPU1 = 'N' and COMPU2 = 'N', then LDWORK >= 3/2*N**2 + MAX(6*N,54); else, LDWORK >= 3*N**2 + MAX(6*N,54). For good performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the periodic QZ algorithm was not able to reveal information about the eigenvalues from the 2-by-2 blocks in the SLICOT Library routine MB03BD; = 2: the periodic QZ algorithm did not converge in the SLICOT Library routine MB03BD; = 3: some eigenvalues might be inaccurate, and details can be found in IWORK and DWORK. This is a warning.Method
The algorithm uses Givens rotations and Householder reflections to annihilate elements in T, Z, and H such that T11, T22', Z11, Z22', and H11 are upper triangular and H22' is upper Hessenberg. Finally the periodic QZ algorithm is applied to transform H22' to upper quasi-triangular form while T11, T22', Z11, Z22', and H11 stay in upper triangular form. See also page 17 in [1] for more details.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
NoneExample
Program Text
* MB04AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 50 ) INTEGER LDH, LDQ1, LDQ2, LDT, LDU11, LDU12, LDU21, $ LDU22, LDWORK, LDZ, LIWORK PARAMETER ( LDH = NMAX, LDQ1 = NMAX, LDQ2 = NMAX, $ LDT = NMAX, LDU11 = NMAX/2, LDU12 = NMAX/2, $ LDU21 = NMAX/2, LDU22 = NMAX/2, $ LDWORK = 3*NMAX*NMAX + MAX( NMAX, 48 ) + 6, $ LDZ = NMAX, LIWORK = NMAX + 18 ) DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) * * .. Local Scalars .. CHARACTER COMPQ1, COMPQ2, COMPU1, COMPU2, JOB INTEGER I, INFO, J, M, N * * .. Local Arrays .. INTEGER IWORK( LIWORK ) DOUBLE PRECISION ALPHAI( NMAX/2 ), ALPHAR( NMAX/2 ), $ BETA( NMAX/2 ), DWORK( LDWORK ), $ H( LDH, NMAX ), Q1( LDQ1, NMAX ), $ Q2( LDQ2, NMAX ), T( LDT, NMAX ), $ U11( LDU11, NMAX/2 ), U12( LDU12, NMAX/2 ), $ U21( LDU21, NMAX/2 ), U22( LDU22, NMAX/2 ), $ Z( LDZ, NMAX ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL DLASET, MB04AD * * .. Intrinsic Functions .. INTRINSIC MAX * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) JOB, COMPQ1, COMPQ2, COMPU1, COMPU2, N IF( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE READ( NIN, FMT = * ) ( ( Z( I, J ), J = 1, N ), I = 1, N ) READ( NIN, FMT = * ) ( ( H( I, J ), J = 1, N ), I = 1, N ) * Compute the eigenvalues of a real skew-Hamiltonian/Hamiltonian * pencil (factored version). CALL MB04AD( JOB, COMPQ1, COMPQ2, COMPU1, COMPU2, N, Z, LDZ, H, $ LDH, Q1, LDQ1, Q2, LDQ2, U11, LDU11, U12, LDU12, $ U21, LDU21, U22, LDU22, T, LDT, ALPHAR, ALPHAI, $ BETA, IWORK, LIWORK, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE M = N/2 CALL DLASET( 'Full', M, M, ZERO, ZERO, Z( M+1, 1 ), LDZ ) WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE( NOUT, FMT = 99995 ) ( T( I, J ), J = 1, N ) 10 CONTINUE WRITE( NOUT, FMT = 99994 ) DO 20 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Z( I, J ), J = 1, N ) 20 CONTINUE WRITE( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE( NOUT, FMT = 99995 ) ( H( I, J ), J = 1, N ) 30 CONTINUE IF( LSAME( COMPQ1, 'I' ) ) THEN WRITE( NOUT, FMT = 99992 ) DO 40 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q1( I, J ), J = 1, N ) 40 CONTINUE END IF IF( LSAME( COMPQ2, 'I' ) ) THEN WRITE( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q2( I, J ), J = 1, N ) 50 CONTINUE END IF IF( LSAME( COMPU1, 'I' ) ) THEN WRITE( NOUT, FMT = 99990 ) DO 60 I = 1, M WRITE( NOUT, FMT = 99995 ) ( U11( I, J ), J = 1, M ) 60 CONTINUE WRITE( NOUT, FMT = 99989 ) DO 70 I = 1, M WRITE( NOUT, FMT = 99995 ) ( U12( I, J ), J = 1, M ) 70 CONTINUE END IF IF( LSAME( COMPU2, 'I' ) ) THEN WRITE( NOUT, FMT = 99988 ) DO 80 I = 1, M WRITE( NOUT, FMT = 99995 ) ( U21( I, J ), J = 1, M ) 80 CONTINUE WRITE( NOUT, FMT = 99987 ) DO 90 I = 1, M WRITE( NOUT, FMT = 99995 ) ( U22( I, J ), J = 1, M ) 90 CONTINUE END IF WRITE( NOUT, FMT = 99986 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAR( I ), I = 1, M ) WRITE( NOUT, FMT = 99985 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAI( I ), I = 1, M ) WRITE( NOUT, FMT = 99984 ) WRITE( NOUT, FMT = 99995 ) ( BETA( I ), I = 1, M ) END IF END IF STOP * 99999 FORMAT( 'MB04AD EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT( 'INFO on exit from MB04AD = ', I2 ) 99996 FORMAT( 'The matrix T on exit is ' ) 99995 FORMAT( 50( 1X, F8.4 ) ) 99994 FORMAT( 'The matrix Z on exit is ' ) 99993 FORMAT( 'The matrix H is ' ) 99992 FORMAT( 'The matrix Q1 is ' ) 99991 FORMAT( 'The matrix Q2 is ' ) 99990 FORMAT( 'The upper left block of the matrix U1 is ' ) 99989 FORMAT( 'The upper right block of the matrix U1 is ' ) 99988 FORMAT( 'The upper left block of the matrix U2 is ' ) 99987 FORMAT( 'The upper right block of the matrix U2 is ' ) 99986 FORMAT( 'The vector ALPHAR is ' ) 99985 FORMAT( 'The vector ALPHAI is ' ) 99984 FORMAT( 'The vector BETA is ' ) ENDProgram Data
MB04AD EXAMPLE PROGRAM DATA T I I I I 8 3.1472 4.5751 -0.7824 1.7874 -2.2308 -0.6126 2.0936 4.5974 4.0579 4.6489 4.1574 2.5774 -4.5383 -1.1844 2.5469 -1.5961 -3.7301 -3.4239 2.9221 2.4313 -4.0287 2.6552 -2.2397 0.8527 4.1338 4.7059 4.5949 -1.0777 3.2346 2.9520 1.7970 -2.7619 1.3236 4.5717 1.5574 1.5548 1.9483 -3.1313 1.5510 2.5127 -4.0246 -0.1462 -4.6429 -3.2881 -1.8290 -0.1024 -3.3739 -2.4490 -2.2150 3.0028 3.4913 2.0605 4.5022 -0.5441 -3.8100 0.0596 0.4688 -3.5811 4.3399 -4.6817 -4.6555 1.4631 -0.0164 1.9908 3.9090 -3.5071 3.1428 -3.0340 -1.4834 3.7401 -0.1715 0.4026 4.5929 -2.4249 -2.5648 -2.4892 3.7401 -2.1416 1.6251 2.6645 0.4722 3.4072 4.2926 1.1604 -0.1715 1.6251 -4.2415 -0.0602 -3.6138 -2.4572 -1.5002 -0.2671 0.4026 2.6645 -0.0602 -3.7009 0.6882 -1.8421 -4.1122 0.1317 -3.9090 -4.5929 -0.4722 3.6138 -1.8421 2.9428 -0.4340 1.3834 3.5071 2.4249 -3.4072 2.4572 -4.1122 -0.4340 -2.3703 0.5231 -3.1428 2.5648 -4.2926 1.5002 0.1317 1.3834 0.5231 -4.1618 3.0340 2.4892 -1.1604 0.2671Program Results
MB04AD EXAMPLE PROGRAM RESULTS The matrix T on exit is -3.9699 3.7658 5.5815 -1.7750 -0.8818 -0.0511 -4.2158 1.9054 0.0000 5.3686 -5.9166 4.9163 1.3839 0.8870 3.9458 -4.9167 0.0000 0.0000 5.9641 1.9432 -2.0680 2.4402 -1.4091 5.8512 0.0000 0.0000 0.0000 5.9983 -3.8172 4.0147 -2.0739 -1.2570 0.0000 0.0000 0.0000 0.0000 8.2005 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.5732 8.0098 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.6017 2.4397 5.9751 0.0000 0.0000 0.0000 0.0000 0.0000 -2.5869 0.5598 0.2544 5.2129 The matrix Z on exit is -6.4705 -2.5511 -4.0551 -1.9895 -2.7642 0.7532 -4.1047 -2.2046 0.0000 7.3589 -4.4480 -2.7491 -1.5465 -1.4345 -0.9272 1.3121 0.0000 0.0000 4.9125 -0.4968 5.3574 3.8579 5.2547 -1.7324 0.0000 0.0000 0.0000 9.0822 0.0460 -0.3382 3.9302 3.1084 0.0000 0.0000 0.0000 0.0000 6.1869 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 5.5573 6.6549 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 2.7456 -3.5789 4.3432 0.0000 0.0000 0.0000 0.0000 0.0000 0.1549 3.5335 3.1346 4.1062 The matrix H is -7.4834 0.4404 2.3558 1.6724 -0.4630 1.9533 1.5724 -2.7254 0.0000 -7.3500 3.7414 3.7466 0.2837 0.6849 0.7727 -4.2140 0.0000 0.0000 -2.3493 -3.7994 -0.6872 1.1773 -2.6901 -5.1494 0.0000 0.0000 0.0000 -3.4719 5.3322 0.4182 1.9779 1.5175 0.0000 0.0000 0.0000 0.0000 -6.1880 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -3.3324 9.0833 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -1.8703 0.0799 -2.8180 0.0000 0.0000 0.0000 0.0000 0.0000 -2.3477 3.3110 0.6561 0.7281 The matrix Q1 is -0.2489 -0.1409 0.3615 0.6458 0.0113 0.6063 -0.0470 0.0238 -0.2436 0.1294 -0.0874 -0.4103 0.3408 0.3628 -0.3267 0.6272 -0.4316 -0.2352 0.5553 -0.2811 -0.2198 -0.2880 -0.4564 -0.1773 0.1992 -0.2176 -0.5198 0.1561 -0.1523 0.1299 -0.7281 -0.2197 0.0161 0.7390 0.1125 -0.2226 -0.1003 0.3608 -0.1118 -0.4886 -0.5824 0.0984 -0.3052 0.1996 0.5889 -0.2442 0.0060 -0.3341 -0.3246 0.4661 -0.1835 0.3523 -0.5153 -0.3034 -0.0865 0.3931 -0.4559 -0.2961 -0.3790 -0.3127 -0.4356 0.3452 0.3642 -0.1467 The matrix Q2 is 0.0288 -0.1842 -0.6791 -0.2115 -0.4790 0.4212 -0.0417 -0.2253 -0.0666 -0.0787 -0.3711 0.1737 -0.0482 -0.5770 -0.6785 0.1607 0.1506 0.6328 0.0518 -0.6266 0.0652 -0.0790 -0.2854 -0.2994 -0.2900 -0.2737 -0.0076 -0.3671 -0.2017 -0.6241 0.4521 -0.2675 0.3353 0.4107 0.0326 0.1400 -0.6447 -0.2043 0.2561 0.4187 0.0905 -0.1648 -0.2363 -0.5323 0.3180 0.0286 0.1252 0.7126 -0.7246 0.0468 0.3328 -0.1794 -0.3639 0.2257 -0.2623 0.2786 0.4922 -0.5353 0.4803 -0.2501 -0.2723 0.0199 -0.3194 -0.0371 The upper left block of the matrix U1 is 0.4144 0.2249 0.6015 -0.1964 -0.0198 0.5131 -0.2823 -0.3058 -0.6620 0.1508 0.2237 0.0240 -0.0743 -0.4323 -0.0332 -0.7263 The upper right block of the matrix U1 is -0.3474 0.1306 -0.3391 -0.3530 -0.3760 0.1550 0.6087 -0.1646 0.1707 0.6553 -0.1262 -0.1177 0.3048 -0.0773 0.0767 -0.4173 The upper left block of the matrix U2 is 0.1403 -0.6447 -0.6536 -0.3707 0.7069 0.2609 -0.0091 -0.1702 -0.1218 -0.1120 0.3766 -0.5154 0.0773 0.6349 -0.5070 -0.1810 The upper right block of the matrix U2 is 0.0000 0.0000 0.0000 0.0000 0.1182 0.1587 0.1930 -0.5716 0.6051 -0.2720 0.3364 0.1089 0.2823 -0.0386 -0.1529 0.4434 The vector ALPHAR is 0.0000 0.7122 0.0000 0.7450 The vector ALPHAI is 0.7540 0.0000 0.7465 0.0000 The vector BETA is 4.0000 4.0000 8.0000 16.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04AZ.html 0000664 0000000 0000000 00000064203 14560147231 0020354 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of a complex N-by-N skew-Hamiltonian/ Hamiltonian pencil aS - bH, with H T ( B F ) ( Z11 Z12 ) S = J Z J Z and H = ( H ), Z =: ( ). (1) ( G -B ) ( Z21 Z22 ) The structured Schur form of the embedded real skew-Hamiltonian/ H T skew-Hamiltonian pencil, aB_S - bB_T, with B_S = J B_Z J B_Z, ( Re(Z11) -Im(Z11) | Re(Z12) -Im(Z12) ) ( | ) ( Im(Z11) Re(Z11) | Im(Z12) Re(Z12) ) ( | ) B_Z = (---------------------+---------------------) , ( | ) ( Re(Z21) -Im(Z21) | Re(Z22) -Im(Z22) ) ( | ) ( Im(Z21) Re(Z21) | Im(Z22) Re(Z22) ) (2) ( -Im(B) -Re(B) | -Im(F) -Re(F) ) ( | ) ( Re(B) -Im(B) | Re(F) -Im(F) ) ( | ) B_T = (-----------------+-----------------) , T = i*H, ( | T T ) ( -Im(G) -Re(G) | -Im(B ) Re(B ) ) ( | T T ) ( Re(G) -Im(G) | -Re(B ) -Im(B ) ) is determined and used to compute the eigenvalues. Optionally, if JOB = 'T', the pencil aB_S - bB_H is transformed by a unitary matrix Q and a unitary symplectic matrix U to the structured Schur H T form aB_Sout - bB_Hout, with B_Sout = J B_Zout J B_Zout, ( BA BD ) ( BB BF ) B_Zout = ( ) and B_Hout = ( H ), (3) ( 0 BC ) ( 0 -BB ) where BA and BB are upper triangular, BC is lower triangular, and BF is Hermitian. B_H above is defined as B_H = -i*B_T. The embedding doubles the multiplicities of the eigenvalues of the pencil aS - bH. Optionally, if COMPQ = 'C', the unitary matrix Q is computed. Optionally, if COMPU = 'C', the unitary symplectic matrix U is computed.Specification
SUBROUTINE MB04AZ( JOB, COMPQ, COMPU, N, Z, LDZ, B, LDB, FG, $ LDFG, D, LDD, C, LDC, Q, LDQ, U, LDU, ALPHAR, $ ALPHAI, BETA, IWORK, LIWORK, DWORK, LDWORK, $ ZWORK, LZWORK, BWORK, INFO )C .. Scalar Arguments .. CHARACTER COMPQ, COMPU, JOB INTEGER INFO, LDB, LDC, LDD, LDFG, LDQ, LDU, LDWORK, $ LDZ, LIWORK, LZWORK, N C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION ALPHAI( * ), ALPHAR( * ), BETA( * ), DWORK( * ) COMPLEX*16 B( LDB, * ), C( LDC, * ), D( LDD, * ), $ FG( LDFG, * ), Q( LDQ, * ), U( LDU, * ), $ Z( LDZ, * ), ZWORK( * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; S and H will not necessarily be transformed as in (3). = 'T': put S and H into the forms in (3) and return the eigenvalues in ALPHAR, ALPHAI and BETA. COMPQ CHARACTER*1 Specifies whether to compute the unitary transformation matrix Q, as follows: = 'N': do not compute the unitary matrix Q; = 'C': the array Q is initialized internally to the unit matrix, and the unitary matrix Q is returned. COMPU CHARACTER*1 Specifies whether to compute the unitary symplectic transformation matrix U, as follows: = 'N': do not compute the unitary symplectic matrix U; = 'C': the array U is initialized internally to the unit matrix, and the unitary symplectic matrix U is returned.Input/Output Parameters
N (input) INTEGER Order of the pencil aS - bH. N >= 0, even. Z (input/output) COMPLEX*16 array, dimension (LDZ, N) On entry, the leading N-by-N part of this array must contain the non-trivial factor Z in the factorization H T S = J Z J Z of the skew-Hamiltonian matrix S. On exit, if JOB = 'T', the leading N-by-N part of this array contains the upper triangular matrix BA in (3) (see also METHOD). The strictly lower triangular part is not zeroed. The submatrix in the rows N/2+1 to N and the first N/2 columns is unchanged, except possibly for the entry (N/2+1,N/2), which might be set to zero. If JOB = 'E', this array is unchanged on exit. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1, N). B (input/output) COMPLEX*16 array, dimension (LDB, K), where K = N, if JOB = 'T', and K = M, if JOB = 'E'. On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if JOB = 'T', the leading N-by-N part of this array contains the upper triangular matrix BB in (3) (see also METHOD). The strictly lower triangular part is not zeroed. If JOB = 'E', this array is unchanged on exit. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, M), if JOB = 'E'; LDB >= MAX(1, N), if JOB = 'T'. FG (input/output) COMPLEX*16 array, dimension (LDFG, P), where P = MAX(M+1,N), if JOB = 'T', and P = M+1, if JOB = 'E'. On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the Hermitian matrix G, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the Hermitian matrix F. Accidental nonzero imaginary parts on the main diagonals of F and G do not perturb the results. On exit, if JOB = 'T', the leading N-by-N part of this array contains the Hermitian matrix BF in (3) (see also METHOD). The strictly lower triangular part of the input matrix is preserved. The diagonal elements might have tiny imaginary parts, since they have not been annihilated. If JOB = 'E', this array is unchanged on exit. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, M), if JOB = 'E'; LDFG >= MAX(1, N), if JOB = 'T'. D (output) COMPLEX*16 array, dimension (LDD, N) If JOB = 'T', the leading N-by-N part of this array contains the matrix BD in (3) (see also METHOD). If JOB = 'E', this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= 1, if JOB = 'E'; LDD >= MAX(1, N), if JOB = 'T'. C (output) COMPLEX*16 array, dimension (LDC, N) If JOB = 'T', the leading N-by-N part of this array contains the lower triangular matrix BC in (3) (see also METHOD). The part over the first superdiagonal is not set. If JOB = 'E', this array is not referenced. LDC INTEGER The leading dimension of the array C. LDC >= 1, if JOB = 'E'; LDC >= MAX(1, N), if JOB = 'T'. Q (output) COMPLEX*16 array, dimension (LDQ, 2*N) On exit, if COMPQ = 'C' and JOB = 'T', then the leading 2*N-by-2*N part of this array contains the unitary transformation matrix Q. If COMPQ = 'C' and JOB = 'E', this array contains the orthogonal transformation which reduced B_Z and B_T in the first step of the algorithm (see METHOD). If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, 2*N), if COMPQ = 'C'. U (output) COMPLEX*16 array, dimension (LDU, 2*N) On exit, if COMPU = 'C' and JOB = 'T', then the leading N-by-2*N part of this array contains the leading N-by-2*N part of the unitary symplectic transformation matrix U. If COMPU = 'C' and JOB = 'E', this array contains the first N rows of the transformation U which reduced B_Z and B_T in the first step of the algorithm (see METHOD). If COMPU = 'N', this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= 1, if COMPU = 'N'; LDU >= MAX(1, N), if COMPU = 'C'. ALPHAR (output) DOUBLE PRECISION array, dimension (N) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed.Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = 3, IWORK(1) contains the number of (pairs of) possibly inaccurate eigenvalues, q <= N/2, and IWORK(2), ..., IWORK(q+1) indicate their indices. Specifically, a positive value is an index of a real or purely imaginary eigenvalue, corresponding to a 1-by-1 block, while the absolute value of a negative entry in IWORK is an index to the first eigenvalue in a pair of consecutively stored eigenvalues, corresponding to a 2-by-2 block. A 2-by-2 block may have two complex, two real, two purely imaginary, or one real and one purely imaginary eigenvalue. The blocks are those in B_T and B_S. For i = q+2, ..., 2*q+1, IWORK(i) contains a pointer to the starting location in DWORK of the i-th triplet of 1-by-1 blocks, if IWORK(i-q) > 0, or 2-by-2 blocks, if IWORK(i-q) < 0, defining unreliable eigenvalues. IWORK(2*q+2) contains the number of the 1-by-1 blocks, and IWORK(2*q+3) contains the number of the 2-by-2 blocks, corresponding to unreliable eigenvalues. IWORK(2*q+4) contains the total number t of the 2-by-2 blocks. If INFO = 0, then q = 0, therefore IWORK(1) = 0. LIWORK INTEGER The dimension of the array IWORK. LIWORK >= 2*N+9. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or INFO = 3, DWORK(1) returns the optimal LDWORK, and DWORK(2), ..., DWORK(4) contain the Frobenius norms of the factors of the formal matrix product used by the algorithm. In addition, DWORK(5), ..., DWORK(4+3*s) contain the s triplet values corresponding to the 1-by-1 blocks. Their eigenvalues are real or purely imaginary. Such an eigenvalue is obtained as -a1/a2/a3*i, where a1, ..., a3 are the corresponding triplet values, and i is the purely imaginary unit. Moreover, DWORK(5+3*s), ..., DWORK(4+3*s+12*t) contain the t groups of triplet 2-by-2 matrices corresponding to the 2-by-2 blocks. Their eigenvalue pairs are either complex, or placed on the real and imaginary axes. Such an eigenvalue pair is given by imag( ev ) - real( ev )*i, where ev is the spectrum of the matrix product A1*inv(A2)*inv(A3), and A1, ..., A3 define the corresponding 2-by-2 matrix triplet. On exit, if INFO = -25, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= c*N**2 + N + MAX(6*N, 27), where c = 18, if COMPU = 'C'; c = 16, if COMPQ = 'C' and COMPU = 'N'; c = 13, if COMPQ = 'N' and COMPU = 'N'. For good performance LDWORK should be generally 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. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal LZWORK. On exit, if INFO = -27, ZWORK(1) returns the minimum value of LZWORK. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= 8*N + 28, if JOB = 'T' and COMPQ = 'C'; LZWORK >= 6*N + 28, if JOB = 'T' and COMPQ = 'N'; LZWORK >= 1, if JOB = 'E'. For good performance LZWORK should be generally larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA. BWORK LOGICAL array, dimension (LBWORK) LBWORK >= 0, if JOB = 'E'; LBWORK >= N, if JOB = 'T'.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the algorithm was not able to reveal information about the eigenvalues from the 2-by-2 blocks in the SLICOT Library routine MB03BD (called by MB04ED); = 2: periodic QZ iteration failed in the SLICOT Library routines MB03BD or MB03BZ when trying to triangularize the 2-by-2 blocks; = 3: some eigenvalues might be inaccurate. This is a warning.Method
First T = i*H is set. Then, the embeddings, B_Z and B_T, of the matrices S and T, are determined and, subsequently, the SLICOT Library routine MB04ED is applied to compute the structured Schur form, i.e., the factorizations ~ T ( BZ11 BZ12 ) B_Z = U B_Z Q = ( ) and ( 0 BZ22 ) ~ T T ( T11 T12 ) B_T = J Q J B_T Q = ( T ), ( 0 T11 ) where Q is real orthogonal, U is real orthogonal symplectic, BZ11, BZ22' are upper triangular and T11 is upper quasi-triangular. If JOB = 'T', the 2-by-2 blocks are triangularized using the periodic QZ algorithm.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) complex floating point operations.Further Comments
This routine does not perform any scaling of the matrices. Scaling might sometimes be useful, and it should be done externally.Example
Program Text
* MB04AZ EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 50 ) INTEGER LDB, LDC, LDD, LDFG, LDQ, LDU, LDWORK, LDZ, $ LIWORK, LZWORK PARAMETER ( LDB = NMAX, LDC = NMAX, LDD = NMAX, $ LDFG = NMAX, LDQ = 2*NMAX, LDU = NMAX, $ LDWORK = 18*NMAX*NMAX + NMAX + MAX( 2*NMAX, $ 24 ) + 3, $ LDZ = NMAX, LIWORK = 2*NMAX + 9, $ LZWORK = 8*NMAX + 28 ) * * .. Local Scalars .. CHARACTER COMPQ, COMPU, JOB INTEGER I, INFO, J, M, N * * .. Local Arrays .. COMPLEX*16 B( LDB, NMAX ), C( LDC, NMAX ), $ D( LDD, NMAX ), FG( LDFG, NMAX ), $ Q( LDQ, 2*NMAX ), U( LDU, 2*NMAX ), $ Z( LDZ, NMAX ), ZWORK( LZWORK ) DOUBLE PRECISION ALPHAI( NMAX ), ALPHAR( NMAX ), $ BETA( NMAX ), DWORK(LDWORK ) INTEGER IWORK( LIWORK ) LOGICAL BWORK( NMAX ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB04AZ * * .. Intrinsic Functions .. INTRINSIC MAX, MOD * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) JOB, COMPQ, COMPU, N IF( N.LT.0 .OR. N.GT.NMAX .OR. MOD( N, 2 ).NE.0 ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE READ( NIN, FMT = * ) ( ( Z( I, J ), J = 1, N ), I=1, N ) READ( NIN, FMT = * ) ( ( B( I, J ), J = 1, N/2 ), I=1, N/2 ) READ( NIN, FMT = * ) ( ( FG( I, J ), J = 1, N/2+1 ), I=1, N/2 ) * Compute the eigenvalues of a complex skew-Hamiltonian/ * Hamiltonian pencil (factored version). CALL MB04AZ( JOB, COMPQ, COMPU, N, Z, LDZ, B, LDB, FG, LDFG, $ D, LDD, C, LDC, Q, LDQ, U, LDU, ALPHAR, ALPHAI, $ BETA, IWORK, LIWORK, DWORK, LDWORK, ZWORK, LZWORK, $ BWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE M = N/2 IF( LSAME( JOB, 'T' ) ) THEN WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Z( I, J ), J = 1, N ) 10 CONTINUE WRITE( NOUT, FMT = 99994 ) DO 20 I = 1, N WRITE( NOUT, FMT = 99995 ) ( B( I, J ), J = 1, N ) 20 CONTINUE WRITE( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE( NOUT, FMT = 99995 ) ( FG( I, J ), J = 1, N ) 30 CONTINUE WRITE( NOUT, FMT = 99992 ) DO 40 I = 1, N WRITE( NOUT, FMT = 99995 ) ( D( I, J ), J = 1, N ) 40 CONTINUE WRITE( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE( NOUT, FMT = 99995 ) ( C( I, J ), J = 1, N ) 50 CONTINUE END IF IF( LSAME( COMPQ, 'C' ) ) THEN WRITE( NOUT, FMT = 99990 ) DO 60 I = 1, 2*N WRITE( NOUT, FMT = 99995 ) ( Q( I, J ), J = 1, 2*N ) 60 CONTINUE END IF IF( LSAME( COMPU, 'C' ) ) THEN WRITE( NOUT, FMT = 99989 ) DO 70 I = 1, N WRITE( NOUT, FMT = 99995 ) ( U( I, J ), J = 1, 2*N ) 70 CONTINUE END IF WRITE( NOUT, FMT = 99988 ) WRITE( NOUT, FMT = 99987 ) ( ALPHAR( I ), I = 1, N ) WRITE( NOUT, FMT = 99986 ) WRITE( NOUT, FMT = 99987 ) ( ALPHAI( I ), I = 1, N ) WRITE( NOUT, FMT = 99985 ) WRITE( NOUT, FMT = 99987 ) ( BETA( I ), I = 1, N ) END IF END IF STOP * 99999 FORMAT ( 'MB04AZ EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT ( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT ( 'INFO on exit from MB04AZ = ', I2 ) 99996 FORMAT (/' The transformed matrix Z is' ) 99995 FORMAT (20(1X,F9.4,SP,F9.4,S,'i ')) 99994 FORMAT (/' The transformed matrix B is' ) 99993 FORMAT (/' The transformed matrix FG is' ) 99992 FORMAT (/' The matrix D is' ) 99991 FORMAT (/' The matrix C is' ) 99990 FORMAT (/' The matrix Q is' ) 99989 FORMAT (/' The upper part of the matrix U is' ) 99988 FORMAT (/' The vector ALPHAR is ' ) 99987 FORMAT ( 50( 1X, F8.4 ) ) 99986 FORMAT (/' The vector ALPHAI is ' ) 99985 FORMAT (/' The vector BETA is ' ) ENDProgram Data
MB04AZ EXAMPLE PROGRAM DATA T C C 4 (0.4941,0.8054) (0.8909,0.8865) (0.0305,0.9786) (0.9047,0.0596) (0.7790,0.5767) (0.3341,0.0286) (0.7440,0.7126) (0.6098,0.6819) (0.7150,0.1829) (0.6987,0.4899) (0.5000,0.5004) (0.6176,0.0424) (0.9037,0.2399) (0.1978,0.1679) (0.4799,0.4710) (0.8594,0.0714) (0.5216,0.7224) (0.8181,0.6596) (0.0967,0.1498) (0.8175,0.5185) 0.9729 0.8003 (0.4323,0.8313) (0.6489,0.1331) 0.4537 0.8253Program Results
MB04AZ EXAMPLE PROGRAM RESULTS The transformed matrix Z is 0.4545 +0.0000i 0.7904 +0.0000i -0.1601 +0.0000i -0.2691 +0.0000i 0.7790 +0.5767i 0.4273 +0.0000i 0.1459 +0.0000i 0.1298 +0.0000i 0.7150 +0.1829i 0.6987 +0.4899i 0.6715 +0.0000i -0.3001 +0.0000i 0.9037 +0.2399i 0.1978 +0.1679i 0.4799 +0.4710i 0.7924 +0.0000i The transformed matrix B is 0.0000 -1.7219i 0.0000 +0.7762i 0.0000 +0.5342i 0.0000 +0.0845i 0.0000 +0.0000i 0.0000 +0.8862i 0.0000 +0.5186i 0.0000 -0.1429i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +1.1122i 0.0000 +0.2898i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.4889i The transformed matrix FG is 0.0000 +0.0000i 0.0000 +0.4145i 0.0000 -0.7921i 0.0000 +0.5630i 0.6489 +0.1331i 0.0000 +0.0000i 0.0000 +1.5982i 0.0000 +0.5818i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.5819i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i The matrix D is 2.2139 +0.0000i 0.0402 +0.0000i -0.2787 +0.0000i 1.0465 +0.0000i -0.5021 +0.0000i 0.5502 +0.0000i -0.2771 +0.0000i -0.4521 +0.0000i -0.0398 +0.0000i 0.4046 +0.0000i 0.0149 +0.0000i 0.7577 +0.0000i -0.1550 +0.0000i 2.0660 +0.0000i 1.6075 +0.0000i 0.5836 +0.0000i The matrix C is 0.3159 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.7819 +0.0000i -0.7575 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.3494 +0.0000i 0.8622 +0.0000i 0.7539 +0.0000i 0.0000 +0.0000i 1.1178 +0.0000i 0.3133 +0.0000i 0.4638 +0.0000i 1.2348 +0.0000i The matrix Q is -0.4983 +0.0000i 0.3694 +0.0000i -0.4754 +0.0000i 0.2791 +0.0000i 0.1950 +0.0000i 0.2416 +0.0000i 0.1869 +0.0000i 0.4242 +0.0000i -0.1045 +0.0000i 0.3309 +0.0000i 0.5730 +0.0000i -0.5566 +0.0000i 0.0877 +0.0000i 0.3543 +0.0000i 0.1761 +0.0000i 0.2779 +0.0000i -0.2586 +0.0000i -0.4457 +0.0000i -0.2838 +0.0000i -0.5436 +0.0000i 0.5524 +0.0000i -0.1064 +0.0000i -0.2040 +0.0000i 0.0205 +0.0000i -0.0040 +0.0000i 0.3845 +0.0000i 0.2469 +0.0000i 0.2965 +0.0000i 0.5799 +0.0000i 0.0840 +0.0000i -0.4788 +0.0000i -0.3614 +0.0000i 0.7958 +0.0000i 0.1597 +0.0000i -0.3420 +0.0000i -0.1047 +0.0000i 0.3370 +0.0000i 0.1813 +0.0000i 0.2275 +0.0000i 0.1229 +0.0000i -0.0600 +0.0000i -0.4599 +0.0000i 0.3487 +0.0000i 0.3910 +0.0000i 0.4005 +0.0000i 0.1010 +0.0000i 0.5819 +0.0000i -0.0345 +0.0000i -0.0539 +0.0000i 0.3817 +0.0000i 0.0501 +0.0000i -0.1114 +0.0000i 0.1751 +0.0000i -0.8212 +0.0000i 0.3606 +0.0000i -0.0380 +0.0000i 0.1846 +0.0000i -0.1577 +0.0000i 0.2510 +0.0000i 0.2293 +0.0000i 0.0911 +0.0000i -0.2834 +0.0000i -0.3779 +0.0000i 0.7708 +0.0000i The upper part of the matrix U is -0.2544 +0.0000i -0.1844 +0.0000i 0.7632 +0.0000i 0.5646 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.4272 +0.0000i -0.0454 +0.0000i -0.2918 +0.0000i 0.5721 +0.0000i 0.1446 +0.0000i -0.1611 +0.0000i 0.3609 +0.0000i -0.4752 +0.0000i 0.6936 +0.0000i 0.3812 +0.0000i 0.2606 +0.0000i 0.0848 +0.0000i -0.3359 +0.0000i -0.1592 +0.0000i -0.3242 +0.0000i 0.2348 +0.0000i 0.2320 +0.0000i -0.4483 +0.0000i -0.1629 +0.0000i 0.1784 +0.0000i -0.2898 +0.0000i 0.7525 +0.0000i -0.0511 +0.0000i 0.1841 +0.0000i The vector ALPHAR is 0.0000 0.0000 0.0000 0.0000 The vector ALPHAI is -1.4991 -1.3690 1.0985 0.9993 The vector BETA is 0.1250 0.5000 0.5000 2.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04BD.html 0000664 0000000 0000000 00000062130 14560147231 0020324 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of a real N-by-N skew-Hamiltonian/ Hamiltonian pencil aS - bH with ( A D ) ( C V ) S = ( ) and H = ( ). (1) ( E A' ) ( W -C' ) Optionally, if JOB = 'T', decompositions of S and H will be computed via orthogonal transformations Q1 and Q2 as follows: ( Aout Dout ) Q1' S J Q1 J' = ( ), ( 0 Aout' ) ( Bout Fout ) J' Q2' J S Q2 = ( ) =: T, (2) ( 0 Bout' ) ( C1out Vout ) ( 0 I ) Q1' H Q2 = ( ), where J = ( ) ( 0 C2out' ) ( -I 0 ) and Aout, Bout, C1out are upper triangular, C2out is upper quasi- triangular and Dout and Fout are skew-symmetric. The notation M' denotes the transpose of the matrix M. Optionally, if COMPQ1 = 'I' or COMPQ1 = 'U', then the orthogonal transformation matrix Q1 will be computed. Optionally, if COMPQ2 = 'I' or COMPQ2 = 'U', then the orthogonal transformation matrix Q2 will be computed.Specification
SUBROUTINE MB04BD( JOB, COMPQ1, COMPQ2, N, A, LDA, DE, LDDE, C1, $ LDC1, VW, LDVW, Q1, LDQ1, Q2, LDQ2, B, LDB, F, $ LDF, C2, LDC2, ALPHAR, ALPHAI, BETA, IWORK, $ LIWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ1, COMPQ2, JOB INTEGER INFO, LDA, LDB, LDC1, LDC2, LDDE, LDF, LDQ1, $ LDQ2, LDVW, LDWORK, LIWORK, N C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ), $ B( LDB, * ), BETA( * ), C1( LDC1, * ), $ C2( LDC2, * ), DE( LDDE, * ), DWORK( * ), $ F( LDF, * ), Q1( LDQ1, * ), Q2( LDQ2, * ), $ VW( LDVW, * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; S and H will not necessarily be transformed as in (2). = 'T': put S and H into the forms in (2) and return the eigenvalues in ALPHAR, ALPHAI and BETA. COMPQ1 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q1, as follows: = 'N': Q1 is not computed; = 'I': the array Q1 is initialized internally to the unit matrix, and the orthogonal matrix Q1 is returned; = 'U': the array Q1 contains an orthogonal matrix Q on entry, and the product Q*Q1 is returned, where Q1 is the product of the orthogonal transformations that are applied to the pencil aS - bH to reduce S and H to the forms in (2), for COMPQ1 = 'I'. COMPQ2 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q2, as follows: = 'N': Q2 is not computed; = 'I': on exit, the array Q2 contains the orthogonal matrix Q2; = 'U': on exit, the array Q2 contains the matrix product J*Q*J'*Q2, where Q2 is the product of the orthogonal transformations that are applied to the pencil aS - bH to reduce S and H to the forms in (2), for COMPQ2 = 'I'. Setting COMPQ2 <> 'N' assumes COMPQ2 = COMPQ1.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix A. On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix Aout; otherwise, it contains the upper triangular matrix A obtained just before the application of the periodic QZ algorithm. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). DE (input/output) DOUBLE PRECISION array, dimension (LDDE, N/2+1) On entry, the leading N/2-by-N/2 strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix E, and the N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the strictly upper triangular part of the skew-symmetric matrix D. The entries on the diagonal and the first superdiagonal of this array need not be set, but are assumed to be zero. On exit, if JOB = 'T', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix Dout. If JOB = 'E', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix D just before the application of the periodic QZ algorithm. The remaining entries are meaningless. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N/2). C1 (input/output) DOUBLE PRECISION array, dimension (LDC1, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix C1 = C. On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix C1out; otherwise, it contains the upper triangular matrix C1 obtained just before the application of the periodic QZ algorithm. LDC1 INTEGER The leading dimension of the array C1. LDC1 >= MAX(1, N/2). VW (input/output) DOUBLE PRECISION array, dimension (LDVW, N/2+1) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the symmetric matrix W, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the symmetric matrix V. On exit, if JOB = 'T', the N/2-by-N/2 part in the columns 2 to N/2+1 of this array contains the matrix Vout. If JOB = 'E', the N/2-by-N/2 part in the columns 2 to N/2+1 of this array contains the matrix V just before the application of the periodic QZ algorithm. LDVW INTEGER The leading dimension of the array VW. LDVW >= MAX(1, N/2). Q1 (input/output) DOUBLE PRECISION array, dimension (LDQ1, N) On entry, if COMPQ1 = 'U', then the leading N-by-N part of this array must contain a given matrix Q, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q and the transformation matrix Q1 used to transform the matrices S and H. On exit, if COMPQ1 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q1. If COMPQ1 = 'N', this array is not referenced. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= 1, if COMPQ1 = 'N'; LDQ1 >= MAX(1, N), if COMPQ1 = 'I' or COMPQ1 = 'U'. Q2 (output) DOUBLE PRECISION array, dimension (LDQ2, N) On exit, if COMPQ2 = 'U', then the leading N-by-N part of this array contains the product of the matrix J*Q*J' and the transformation matrix Q2 used to transform the matrices S and H. On exit, if COMPQ2 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q2. If COMPQ2 = 'N', this array is not referenced. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= 1, if COMPQ2 = 'N'; LDQ2 >= MAX(1, N), if COMPQ2 = 'I' or COMPQ2 = 'U'. B (output) DOUBLE PRECISION array, dimension (LDB, N/2) On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix Bout; otherwise, it contains the upper triangular matrix B obtained just before the application of the periodic QZ algorithm. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). F (output) DOUBLE PRECISION array, dimension (LDF, N/2) On exit, if JOB = 'T', the leading N/2-by-N/2 strictly upper triangular part of this array contains the strictly upper triangular part of the skew-symmetric matrix Fout. If JOB = 'E', the leading N/2-by-N/2 strictly upper triangular part of this array contains the strictly upper triangular part of the skew-symmetric matrix F just before the application of the periodic QZ algorithm. The entries on the leading N/2-by-N/2 lower triangular part of this array are not referenced. LDF INTEGER The leading dimension of the array F. LDF >= MAX(1, N/2). C2 (output) DOUBLE PRECISION array, dimension (LDC2, N/2) On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix C2out; otherwise, it contains the upper Hessenberg matrix C2 obtained just before the application of the periodic QZ algorithm. LDC2 INTEGER The leading dimension of the array C2. LDC2 >= MAX(1, N/2). ALPHAR (output) DOUBLE PRECISION array, dimension (N/2) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N/2) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N/2) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed. Due to the skew-Hamiltonian/Hamiltonian structure of the pencil, for every eigenvalue lambda, -lambda is also an eigenvalue, and thus it has only to be saved once in ALPHAR, ALPHAI and BETA. Specifically, only eigenvalues with imaginary parts greater than or equal to zero are stored; their conjugate eigenvalues are not stored. If imaginary parts are zero (i.e., for real eigenvalues), only positive eigenvalues are stored. The remaining eigenvalues have opposite signs. As a consequence, pairs of complex eigenvalues, stored in consecutive locations, are not complex conjugate.Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = 3, IWORK(1) contains the number of (pairs of) possibly inaccurate eigenvalues, q <= N/2, and IWORK(2), ..., IWORK(q+1) indicate their indices. Specifically, a positive value is an index of a real or purely imaginary eigenvalue, corresponding to a 1-by-1 block, while the absolute value of a negative entry in IWORK is an index to the first eigenvalue in a pair of consecutively stored eigenvalues, corresponding to a 2-by-2 block. A 2-by-2 block may have two complex, two real, two purely imaginary, or one real and one purely imaginary eigenvalue. For i = q+2, ..., 2*q+1, IWORK(i) contains a pointer to the starting location in DWORK of the (i-q-1)-th quadruple of 1-by-1 blocks, if IWORK(i-q) > 0, or 2-by-2 blocks, if IWORK(i-q) < 0, defining unreliable eigenvalues. IWORK(2*q+2) contains the number of the 1-by-1 blocks, and IWORK(2*q+3) contains the number of the 2-by-2 blocks, corresponding to unreliable eigenvalues. IWORK(2*q+4) contains the total number t of the 2-by-2 blocks. If INFO = 0, then q = 0, therefore IWORK(1) = 0. LIWORK INTEGER The dimension of the array IWORK. LIWORK >= N+12. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or INFO = 3, DWORK(1) returns the optimal LDWORK, and DWORK(2), ..., DWORK(5) contain the Frobenius norms of the factors of the formal matrix product used by the algorithm. In addition, DWORK(6), ..., DWORK(5+4*s) contain the s quadruple values corresponding to the 1-by-1 blocks. Their eigenvalues are real or purely imaginary. Such an eigenvalue is obtained from -i*sqrt(a1*a3/a2/a4), but always taking a positive sign, where a1, ..., a4 are the corresponding quadruple values. Moreover, DWORK(6+4*s), ..., DWORK(5+4*s+16*t) contain the t groups of quadruple 2-by-2 matrices corresponding to the 2-by-2 blocks. Their eigenvalue pairs are either complex, or placed on the real and imaginary axes. Such an eigenvalue pair is obtained as -1i*sqrt(ev), but taking positive imaginary parts, where ev are the eigenvalues of the product A1*inv(A2)*A3*inv(A4), where A1, ..., A4 define the corresponding 2-by-2 matrix quadruple. On exit, if INFO = -27, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. If JOB = 'E' and COMPQ1 = 'N' and COMPQ2 = 'N', LDWORK >= N**2 + MAX(L,36); if JOB = 'T' or COMPQ1 <> 'N' or COMPQ2 <> 'N', LDWORK >= 2*N**2 + MAX(L,36); where L = 4*N + 4, if N/2 is even, and L = 4*N, if N/2 is odd. For good performance LDWORK should generally be larger.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: problem during computation of the eigenvalues; = 2: periodic QZ algorithm did not converge in the SLICOT Library subroutine MB03BD; = 3: some eigenvalues might be inaccurate, and details can be found in IWORK and DWORK. This is a warning.Method
The algorithm uses Givens rotations and Householder reflections to annihilate elements in S, T, and H such that A, B, and C1 are upper triangular and C2 is upper Hessenberg. Finally, the periodic QZ algorithm is applied to transform C2 to upper quasi-triangular form while A, B, and C1 stay in upper triangular form. See also page 27 in [1] for more details.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
NoneExample
Program Text
* MB04BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 50 ) INTEGER LDA, LDB, LDC1, LDC2, LDDE, LDF, LDQ1, LDQ2, $ LDVW, LDWORK, LIWORK PARAMETER ( LDA = NMAX/2, LDB = NMAX/2, LDC1 = NMAX/2, $ LDC2 = NMAX/2, LDDE = NMAX/2, LDF = NMAX/2, $ LDQ1 = NMAX, LDQ2 = NMAX, LDVW = NMAX/2, $ LDWORK = 2*NMAX*NMAX + MAX( 4*NMAX, 36 ), $ LIWORK = MAX( NMAX + 12, 2*NMAX + 3 ) ) * * .. Local Scalars .. CHARACTER COMPQ1, COMPQ2, JOB INTEGER I, INFO, J, M, N * * .. Local Arrays .. INTEGER IWORK( LIWORK ) DOUBLE PRECISION A( LDA, NMAX/2 ), ALPHAI( NMAX/2 ), $ ALPHAR( NMAX/2 ), B( LDB, NMAX/2 ), $ BETA( NMAX/2 ), C1( LDC1, NMAX/2 ), $ C2( LDC2, NMAX/2 ), DE( LDDE, NMAX/2+1 ), $ DWORK( LDWORK ), F( LDF, NMAX/2 ), $ Q1( LDQ1, NMAX ), Q2( LDQ2, NMAX ), $ VW( LDVW, NMAX/2+1 ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB04BD * * .. Intrinsic Functions .. INTRINSIC MAX * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) JOB, COMPQ1, COMPQ2, N IF( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE M = N/2 READ( NIN, FMT = * ) ( ( A( I, J ), J = 1, M ), I = 1, M ) READ( NIN, FMT = * ) ( ( DE( I, J ), J = 1, M+1 ), I = 1, M ) READ( NIN, FMT = * ) ( ( C1( I, J ), J = 1, M ), I = 1, M ) READ( NIN, FMT = * ) ( ( VW( I, J ), J = 1, M+1 ), I = 1, M ) * Compute the eigenvalues of a real skew-Hamiltonian/Hamiltonian * pencil. CALL MB04BD( JOB, COMPQ1, COMPQ2, N, A, LDA, DE, LDDE, C1, $ LDC1, VW, LDVW, Q1, LDQ1, Q2, LDQ2, B, LDB, F, $ LDF, C2, LDC2, ALPHAR, ALPHAI, BETA, IWORK, $ LIWORK, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, M WRITE( NOUT, FMT = 99995 ) ( A( I, J ), J = 1, M ) 10 CONTINUE WRITE( NOUT, FMT = 99994 ) DO 20 I = 1, M WRITE( NOUT, FMT = 99995 ) ( DE( I, J ), J = 2, M+1 ) 20 CONTINUE WRITE( NOUT, FMT = 99993 ) DO 30 I = 1, M WRITE( NOUT, FMT = 99995 ) ( B( I, J ), J = 1, M ) 30 CONTINUE WRITE( NOUT, FMT = 99992 ) DO 40 I = 1, M WRITE( NOUT, FMT = 99995 ) ( F( I, J ), J = 1, M ) 40 CONTINUE WRITE( NOUT, FMT = 99991 ) DO 50 I = 1, M WRITE( NOUT, FMT = 99995 ) ( C1( I, J ), J = 1, M ) 50 CONTINUE WRITE( NOUT, FMT = 99990 ) DO 60 I = 1, M WRITE( NOUT, FMT = 99995 ) ( C2( I, J ), J = 1, M ) 60 CONTINUE WRITE( NOUT, FMT = 99989 ) DO 70 I = 1, M WRITE( NOUT, FMT = 99995 ) ( VW( I, J ), J = 2, M+1 ) 70 CONTINUE WRITE( NOUT, FMT = 99988 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAR( I ), I = 1, M ) WRITE( NOUT, FMT = 99987 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAI( I ), I = 1, M ) WRITE( NOUT, FMT = 99986 ) WRITE( NOUT, FMT = 99995 ) ( BETA( I ), I = 1, M ) WRITE( NOUT, FMT = 99985 ) IF( .NOT.LSAME( COMPQ1, 'N' ) ) THEN DO 80 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q1( I, J ), J = 1, N ) 80 CONTINUE END IF IF( .NOT.LSAME( COMPQ2, 'N' ) ) THEN WRITE( NOUT, FMT = 99984 ) DO 90 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q2( I, J ), J = 1, N ) 90 CONTINUE END IF END IF END IF STOP * 99999 FORMAT( 'MB04BD EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT( 'INFO on exit from MB04BD = ', I2 ) 99996 FORMAT( 'The matrix A on exit is ' ) 99995 FORMAT( 50( 1X, F8.4 ) ) 99994 FORMAT( 'The matrix D on exit is ' ) 99993 FORMAT( 'The matrix B on exit is ' ) 99992 FORMAT( 'The matrix F on exit is ' ) 99991 FORMAT( 'The matrix C1 on exit is ' ) 99990 FORMAT( 'The matrix C2 on exit is ' ) 99989 FORMAT( 'The matrix V on exit is ' ) 99988 FORMAT( 'The vector ALPHAR is ' ) 99987 FORMAT( 'The vector ALPHAI is ' ) 99986 FORMAT( 'The vector BETA is ' ) 99985 FORMAT( 'The matrix Q1 is ' ) 99984 FORMAT( 'The matrix Q2 is ' ) ENDProgram Data
MB04BD EXAMPLE PROGRAM DATA T I I 8 3.1472 1.3236 4.5751 4.5717 4.0579 -4.0246 4.6489 -0.1462 -3.7301 -2.2150 -3.4239 3.0028 4.1338 0.4688 4.7059 -3.5811 0.0000 0.0000 -1.5510 -4.5974 -2.5127 3.5071 0.0000 0.0000 1.5961 2.4490 -3.1428 2.5648 0.0000 0.0000 -0.0596 3.0340 2.4892 -1.1604 0.0000 0.0000 0.6882 -3.3782 -3.3435 1.8921 -0.3061 2.9428 1.0198 2.4815 -4.8810 -1.8878 -2.3703 -0.4946 -1.6288 0.2853 1.5408 -4.1618 -2.4013 -2.7102 0.3834 -3.9335 3.1730 -3.1815 -2.3620 4.9613 4.6190 3.6869 3.6929 0.7970 0.4986 -4.9537 -4.1556 3.5303 1.2206 -1.4905 0.1325 -1.0022Program Results
MB04BD EXAMPLE PROGRAM RESULTS The matrix A on exit is -4.7460 4.1855 3.2696 -0.2244 0.0000 6.4157 2.8287 1.4553 0.0000 0.0000 7.4626 1.5726 0.0000 0.0000 0.0000 8.8702 The matrix D on exit is 0.0000 -1.3137 -6.3615 -0.8940 0.0000 0.0000 1.0704 -0.0659 4.4324 0.0000 0.0000 -0.6922 0.5254 1.6653 0.0000 0.0000 The matrix B on exit is -6.4937 -2.1982 -1.3881 1.3477 0.0000 4.6929 0.6650 -4.1191 0.0000 0.0000 9.1725 3.4721 0.0000 0.0000 0.0000 7.2106 The matrix F on exit is 0.0000 -1.1367 2.2966 -1.0744 0.0000 0.0000 3.7875 0.9427 0.0000 0.0000 0.0000 -4.7136 0.0000 0.0000 0.0000 0.0000 The matrix C1 on exit is 6.9525 -4.9881 2.3661 4.2188 0.0000 8.5009 0.7182 5.5533 0.0000 0.0000 -4.6650 -2.8177 0.0000 0.0000 0.0000 1.5124 The matrix C2 on exit is -5.4562 -2.1348 4.9694 -2.2744 2.5550 -7.9616 1.1516 3.4912 0.0000 0.0000 4.8504 0.5046 0.0000 0.0000 0.0000 4.4394 The matrix V on exit is 0.9136 4.1106 -0.0079 3.5789 -1.1553 -1.4785 -1.5155 -0.8018 -2.2167 4.8029 1.3645 2.5202 -1.0994 -0.6144 0.3970 2.0730 The vector ALPHAR is 0.8314 -0.8314 0.8131 0.0000 The vector ALPHAI is 0.4372 0.4372 0.0000 0.9164 The vector BETA is 0.7071 0.7071 1.4142 2.8284 The matrix Q1 is -0.0098 0.1978 0.2402 0.5274 0.1105 -0.0149 -0.1028 0.7759 -0.6398 0.2356 0.2765 -0.1301 -0.5351 -0.3078 0.2435 0.0373 0.1766 -0.4781 0.2657 -0.5415 0.0968 -0.4663 -0.0983 0.3741 0.3207 -0.1980 0.1141 0.0240 -0.1712 0.2630 0.8513 0.1451 -0.6551 -0.2956 -0.0288 -0.1169 0.5593 0.3381 0.1753 0.1055 -0.0246 -0.2759 0.2470 -0.1408 -0.4837 0.6567 -0.4042 0.1172 -0.0772 -0.0121 -0.8394 -0.1852 -0.2673 0.0046 0.0159 0.4282 0.1442 0.6884 0.1257 -0.5860 0.2110 0.2699 0.0363 0.1657 The matrix Q2 is -0.2891 0.3096 0.6312 0.6498 0.0000 0.0000 0.0000 0.0000 0.1887 0.1936 -0.3857 0.3664 0.5660 0.1238 -0.2080 -0.5148 -0.2492 -0.2877 -0.0874 0.1110 -0.1081 -0.2999 0.6800 -0.5207 -0.7430 -0.0646 -0.4689 0.1556 -0.2401 0.0181 -0.3724 0.0562 -0.0999 -0.2026 -0.0355 0.0866 0.5587 -0.6625 -0.0114 0.4349 -0.4357 0.1209 0.0489 -0.2990 0.5094 0.5191 0.3837 0.1661 -0.2429 0.4131 0.2549 -0.5525 0.0749 -0.3829 -0.2690 -0.4190 0.0889 0.7439 -0.3960 0.0697 -0.1821 -0.1988 0.3687 0.2616
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04BP.html 0000664 0000000 0000000 00000042273 14560147231 0020346 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of a real N-by-N skew-Hamiltonian/ Hamiltonian pencil aS - bH with ( A D ) ( C V ) S = ( ) and H = ( ). (1) ( E A' ) ( W -C' ) Optionally, if JOB = 'T', decompositions of S and H will be computed via orthogonal transformations Q1 and Q2 as follows: ( Aout Dout ) Q1' S J Q1 J' = ( ), ( 0 Aout' ) ( Bout Fout ) J' Q2' J S Q2 = ( ) =: T, (2) ( 0 Bout' ) ( C1out Vout ) ( 0 I ) Q1' H Q2 = ( ), where J = ( ) ( 0 C2out' ) ( -I 0 ) and Aout, Bout, C1out are upper triangular, C2out is upper quasi- triangular and Dout and Fout are skew-symmetric. The notation M' denotes the transpose of the matrix M. Optionally, if COMPQ1 = 'I' or COMPQ1 = 'U', then the orthogonal transformation matrix Q1 will be computed. Optionally, if COMPQ2 = 'I' or COMPQ2 = 'U', then the orthogonal transformation matrix Q2 will be computed.Specification
SUBROUTINE MB04BP( JOB, COMPQ1, COMPQ2, N, A, LDA, DE, LDDE, C1, $ LDC1, VW, LDVW, Q1, LDQ1, Q2, LDQ2, B, LDB, F, $ LDF, C2, LDC2, ALPHAR, ALPHAI, BETA, IWORK, $ LIWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ1, COMPQ2, JOB INTEGER INFO, LDA, LDB, LDC1, LDC2, LDDE, LDF, LDQ1, $ LDQ2, LDVW, LDWORK, LIWORK, N C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ), $ B( LDB, * ), BETA( * ), C1( LDC1, * ), $ C2( LDC2, * ), DE( LDDE, * ), DWORK( * ), $ F( LDF, * ), Q1( LDQ1, * ), Q2( LDQ2, * ), $ VW( LDVW, * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; S and H will not necessarily be transformed as in (2). = 'T': put S and H into the forms in (2) and return the eigenvalues in ALPHAR, ALPHAI and BETA. COMPQ1 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q1, as follows: = 'N': Q1 is not computed; = 'I': the array Q1 is initialized internally to the unit matrix, and the orthogonal matrix Q1 is returned; = 'U': the array Q1 contains an orthogonal matrix Q on entry, and the product Q*Q1 is returned, where Q1 is the product of the orthogonal transformations that are applied to the pencil aS - bH to reduce S and H to the forms in (2), for COMPQ1 = 'I'. COMPQ2 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q2, as follows: = 'N': Q2 is not computed; = 'I': on exit, the array Q2 contains the orthogonal matrix Q2; = 'U': on exit, the array Q2 contains the matrix product J*Q*J'*Q2, where Q2 is the product of the orthogonal transformations that are applied to the pencil aS - bH to reduce S and H to the forms in (2), for COMPQ2 = 'I'. Setting COMPQ2 <> 'N' assumes COMPQ2 = COMPQ1.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix A. On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix Aout; otherwise, it contains the upper triangular matrix A obtained just before the application of the periodic QZ algorithm. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). DE (input/output) DOUBLE PRECISION array, dimension (LDDE, N/2+1) On entry, the leading N/2-by-N/2 strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix E, and the N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the strictly upper triangular part of the skew-symmetric matrix D. The entries on the diagonal and the first superdiagonal of this array need not be set, but are assumed to be zero. On exit, if JOB = 'T', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix Dout. If JOB = 'E', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix D just before the application of the periodic QZ algorithm. The remaining entries are meaningless. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N/2). C1 (input/output) DOUBLE PRECISION array, dimension (LDC1, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix C1 = C. On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix C1out; otherwise, it contains the upper triangular matrix C1 obtained just before the application of the periodic QZ algorithm. LDC1 INTEGER The leading dimension of the array C1. LDC1 >= MAX(1, N/2). VW (input/output) DOUBLE PRECISION array, dimension (LDVW, N/2+1) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the symmetric matrix W, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the symmetric matrix V. On exit, if JOB = 'T', the N/2-by-N/2 part in the columns 2 to N/2+1 of this array contains the matrix Vout. If JOB = 'E', the N/2-by-N/2 part in the columns 2 to N/2+1 of this array contains the matrix V just before the application of the periodic QZ algorithm. LDVW INTEGER The leading dimension of the array VW. LDVW >= MAX(1, N/2). Q1 (input/output) DOUBLE PRECISION array, dimension (LDQ1, N) On entry, if COMPQ1 = 'U', then the leading N-by-N part of this array must contain a given matrix Q, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q and the transformation matrix Q1 used to transform the matrices S and H. On exit, if COMPQ1 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q1. If COMPQ1 = 'N', this array is not referenced. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= 1, if COMPQ1 = 'N'; LDQ1 >= MAX(1, N), if COMPQ1 = 'I' or COMPQ1 = 'U'. Q2 (output) DOUBLE PRECISION array, dimension (LDQ2, N) On exit, if COMPQ2 = 'U', then the leading N-by-N part of this array contains the product of the matrix J*Q*J' and the transformation matrix Q2 used to transform the matrices S and H. On exit, if COMPQ2 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q2. If COMPQ2 = 'N', this array is not referenced. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= 1, if COMPQ2 = 'N'; LDQ2 >= MAX(1, N), if COMPQ2 = 'I' or COMPQ2 = 'U'. B (output) DOUBLE PRECISION array, dimension (LDB, N/2) On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix Bout; otherwise, it contains the upper triangular matrix B obtained just before the application of the periodic QZ algorithm. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). F (output) DOUBLE PRECISION array, dimension (LDF, N/2) On exit, if JOB = 'T', the leading N/2-by-N/2 strictly upper triangular part of this array contains the strictly upper triangular part of the skew-symmetric matrix Fout. If JOB = 'E', the leading N/2-by-N/2 strictly upper triangular part of this array contains the strictly upper triangular part of the skew-symmetric matrix F just before the application of the periodic QZ algorithm. The entries on the leading N/2-by-N/2 lower triangular part of this array are not referenced. LDF INTEGER The leading dimension of the array F. LDF >= MAX(1, N/2). C2 (output) DOUBLE PRECISION array, dimension (LDC2, N/2) On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix C2out; otherwise, it contains the upper Hessenberg matrix C2 obtained just before the application of the periodic QZ algorithm. LDC2 INTEGER The leading dimension of the array C2. LDC2 >= MAX(1, N/2). ALPHAR (output) DOUBLE PRECISION array, dimension (N/2) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N/2) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N/2) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed. Due to the skew-Hamiltonian/Hamiltonian structure of the pencil, for every eigenvalue lambda, -lambda is also an eigenvalue, and thus it has only to be saved once in ALPHAR, ALPHAI and BETA. Specifically, only eigenvalues with imaginary parts greater than or equal to zero are stored; their conjugate eigenvalues are not stored. If imaginary parts are zero (i.e., for real eigenvalues), only positive eigenvalues are stored. The remaining eigenvalues have opposite signs. As a consequence, pairs of complex eigenvalues, stored in consecutive locations, are not complex conjugate.Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = 3, IWORK(1) contains the number of (pairs of) possibly inaccurate eigenvalues, q <= N/2, and IWORK(2), ..., IWORK(q+1) indicate their indices. Specifically, a positive value is an index of a real or purely imaginary eigenvalue, corresponding to a 1-by-1 block, while the absolute value of a negative entry in IWORK is an index to the first eigenvalue in a pair of consecutively stored eigenvalues, corresponding to a 2-by-2 block. A 2-by-2 block may have two complex, two real, two purely imaginary, or one real and one purely imaginary eigenvalue. For i = q+2, ..., 2*q+1, IWORK(i) contains a pointer to the starting location in DWORK of the i-th quadruple of 1-by-1 blocks, if IWORK(i-q) > 0, or 2-by-2 blocks, if IWORK(i-q) < 0, defining unreliable eigenvalues. IWORK(2*q+2) contains the number of the 1-by-1 blocks, and IWORK(2*q+3) contains the number of the 2-by-2 blocks, corresponding to unreliable eigenvalues. IWORK(2*q+4) contains the total number t of the 2-by-2 blocks. If INFO = 0, then q = 0, therefore IWORK(1) = 0. LIWORK INTEGER The dimension of the array IWORK. LIWORK >= N+12. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or INFO = 3, DWORK(1) returns the optimal LDWORK, and DWORK(2), ..., DWORK(5) contain the Frobenius norms of the factors of the formal matrix product used by the algorithm. In addition, DWORK(6), ..., DWORK(5+4*s) contain the s quadruple values corresponding to the 1-by-1 blocks. Their eigenvalues are real or purely imaginary. Such an eigenvalue is obtained from -i*sqrt(a1*a3/a2/a4), but always taking a positive sign, where a1, ..., a4 are the corresponding quadruple values. Moreover, DWORK(6+4*s), ..., DWORK(5+4*s+16*t) contain the t groups of quadruple 2-by-2 matrices corresponding to the 2-by-2 blocks. Their eigenvalue pairs are either complex, or placed on the real and imaginary axes. Such an eigenvalue pair is obtained as -1i*sqrt(ev), but taking positive imaginary parts, where ev are the eigenvalues of the product A1*inv(A2)*A3*inv(A4), where A1, ..., A4 define the corresponding 2-by-2 matrix quadruple. On exit, if INFO = -27, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. If JOB = 'E' and COMPQ1 = 'N' and COMPQ2 = 'N', LDWORK >= N**2 + MAX(L,36); if JOB = 'T' or COMPQ1 <> 'N' or COMPQ2 <> 'N', LDWORK >= 2*N**2 + MAX(L,36); where L = 4*N + 4, if N/2 is even, and L = 4*N, if N/2 is odd. For good performance LDWORK should generally be larger.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: problem during computation of the eigenvalues; = 2: periodic QZ algorithm did not converge in the SLICOT Library subroutine MB03BD; = 3: some eigenvalues might be inaccurate, and details can be found in IWORK and DWORK. This is a warning.Method
The algorithm uses Givens rotations and Householder reflections to annihilate elements in S, T, and H such that A, B, and C1 are upper triangular and C2 is upper Hessenberg. Finally, the periodic QZ algorithm is applied to transform C2 to upper quasi-triangular form while A, B, and C1 stay in upper triangular form. See also page 27 in [1] for more details.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
For large values of N, the routine applies the transformations for reducing T on panels of columns. The user may specify in INFO the desired number of columns. If on entry INFO < 0, then the routine estimates a suitable value of this number. If INFO = 0, the routine MB04BD is directly called.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04BZ.html 0000664 0000000 0000000 00000054555 14560147231 0020366 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of a complex N-by-N skew-Hamiltonian/ Hamiltonian pencil aS - bH, with ( A D ) ( B F ) S = ( H ) and H = ( H ). (1) ( E A ) ( G -B ) This routine computes the eigenvalues using an embedding to a real skew-Hamiltonian/skew-Hamiltonian pencil aB_S - bB_T, defined as ( Re(A) -Im(A) | Re(D) -Im(D) ) ( | ) ( Im(A) Re(A) | Im(D) Re(D) ) ( | ) B_S = (-----------------+-----------------) , and ( | T T ) ( Re(E) -Im(E) | Re(A ) Im(A ) ) ( | T T ) ( Im(E) Re(E) | -Im(A ) Re(A ) ) (2) ( -Im(B) -Re(B) | -Im(F) -Re(F) ) ( | ) ( Re(B) -Im(B) | Re(F) -Im(F) ) ( | ) B_T = (-----------------+-----------------) , T = i*H. ( | T T ) ( -Im(G) -Re(G) | -Im(B ) Re(B ) ) ( | T T ) ( Re(G) -Im(G) | -Re(B ) -Im(B ) ) Optionally, if JOB = 'T', the pencil aB_S - bB_H (B_H = -i*B_T) is transformed by a unitary matrix Q to the structured Schur form ( BA BD ) ( BB BF ) B_Sout = ( H ) and B_Hout = ( H ), (3) ( 0 BA ) ( 0 -BB ) where BA and BB are upper triangular, BD is skew-Hermitian, and BF is Hermitian. The embedding doubles the multiplicities of the eigenvalues of the pencil aS - bH. Optionally, if COMPQ = 'C', the unitary matrix Q is computed.Specification
SUBROUTINE MB04BZ( JOB, COMPQ, N, A, LDA, DE, LDDE, B, LDB, FG, $ LDFG, Q, LDQ, ALPHAR, ALPHAI, BETA, IWORK, $ DWORK, LDWORK, ZWORK, LZWORK, BWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, JOB INTEGER INFO, LDA, LDB, LDDE, LDFG, LDQ, LDWORK, $ LZWORK, N C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION ALPHAI( * ), ALPHAR( * ), BETA( * ), DWORK( * ) COMPLEX*16 A( LDA, * ), B( LDB, * ), DE( LDDE, * ), $ FG( LDFG, * ), Q( LDQ, * ), ZWORK( * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; S and H will not necessarily be transformed as in (3). = 'T': put S and H into the forms in (3) and return the eigenvalues in ALPHAR, ALPHAI and BETA. COMPQ CHARACTER*1 Specifies whether to compute the unitary transformation matrix Q, as follows: = 'N': Q is not computed; = 'C': compute the unitary transformation matrix Q.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) COMPLEX*16 array, dimension (LDA, K) where K = N/2, if JOB = 'E', and K = N, if JOB = 'T'. On entry, the leading N/2-by-N/2 part of this array must contain the matrix A. On exit, if JOB = 'T', the leading N-by-N part of this array contains the upper triangular matrix BA in (3) (see also METHOD). The strictly lower triangular part is not zeroed, but it is preserved. If JOB = 'E', this array is unchanged on exit. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, K). DE (input/output) COMPLEX*16 array, dimension (LDDE, MIN(K+1,N)) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the skew-Hermitian matrix E, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the skew-Hermitian matrix D. On exit, if JOB = 'T', the leading N-by-N part of this array contains the skew-Hermitian matrix BD in (3) (see also METHOD). The strictly lower triangular part of the input matrix is preserved. If JOB = 'E', this array is unchanged on exit. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, K). B (input/output) COMPLEX*16 array, dimension (LDB, K) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if JOB = 'T', the leading N-by-N part of this array contains the upper triangular matrix BB in (3) (see also METHOD). The strictly lower triangular part is not zeroed; the elements below the first subdiagonal of the input matrix are preserved. If JOB = 'E', this array is unchanged on exit. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, K). FG (input/output) COMPLEX*16 array, dimension (LDFG, MIN(K+1,N)) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the Hermitian matrix G, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the Hermitian matrix F. On exit, if JOB = 'T', the leading N-by-N part of this array contains the Hermitian matrix BF in (3) (see also METHOD). The strictly lower triangular part of the input matrix is preserved. The diagonal elements might have tiny imaginary parts. If JOB = 'E', this array is unchanged on exit. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, K). Q (output) COMPLEX*16 array, dimension (LDQ, 2*N) On exit, if COMPQ = 'C', the leading 2*N-by-2*N part of this array contains the unitary transformation matrix Q that reduced the matrices B_S and B_H to the form in (3). However, if JOB = 'E', the reduction was possibly not completed: the matrix B_H may have 2-by-2 diagonal blocks, and the array Q returns the orthogonal matrix that performed the partial reduction. If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, 2*N), if COMPQ = 'C'. ALPHAR (output) DOUBLE PRECISION array, dimension (N) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed.Workspace
IWORK INTEGER array, dimension (2*N+4) On exit, IWORK(1) contains the number, q, of unreliable, possibly inaccurate (pairs of) eigenvalues, and the absolute values in IWORK(2), ..., IWORK(q+1) are their indices, as well as of the corresponding 1-by-1 and 2-by-2 diagonal blocks of the arrays B and A on exit, if JOB = 'T'. Specifically, a positive value is an index of a real or purely imaginary eigenvalue, corresponding to a 1-by-1 block, while the absolute value of a negative entry in IWORK is an index to the first eigenvalue in a pair of consecutively stored eigenvalues, corresponding to a 2-by-2 block. Moreover, IWORK(q+2),..., IWORK(2*q+1) contain pointers to the starting elements in DWORK where each block pair is stored. Specifically, if IWORK(i+1) > 0 then DWORK(r) and DWORK(r+1) store corresponding diagonal elements of T11 and S11, respectively, and if IWORK(i+1) < 0, then DWORK(r:r+3) and DWORK(r+4:r+7) store the elements of the block in T11 and S11, respectively (see Section METHOD), where r = IWORK(q+1+i). Moreover, IWORK(2*q+2) contains the number of the 1-by-1 blocks, and IWORK(2*q+3) contains the number of the 2-by-2 blocks, corresponding to unreliable eigenvalues. IWORK(2*q+4) contains the total number t of the 2-by-2 blocks. If INFO = 0, then q = 0, therefore IWORK(1) = 0. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or INFO = 3, DWORK(1) returns the optimal LDWORK, and DWORK(2) and DWORK(3) contain the Frobenius norms of the matrices B_S and B_T. These norms are used in the tests to decide that some eigenvalues are considered as numerically unreliable. Moreover, DWORK(4), ..., DWORK(3+2*s) contain the s pairs of values of the 1-by-1 diagonal elements of T11 and S11. The eigenvalue of such a block pair is obtained from -i*T11(i,i)/S11(i,i). Similarly, DWORK(4+2*s), ..., DWORK(3+2*s+8*t) contain the t groups of pairs of 2-by-2 diagonal submatrices of T11 and S11, stored column-wise. The spectrum of such a block pair is obtained from -i*ev, where ev are the eigenvalues of (T11(i:i+1,i:i+1),S11(i:i+1,i:i+1)). On exit, if INFO = -19, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. If COMPQ = 'N', LDWORK >= MAX( 3, 4*N*N + 3*N ), if JOB = 'E'; LDWORK >= MAX( 3, 5*N*N + 3*N ), if JOB = 'T'; LDWORK >= MAX( 3, 11*N*N + 2*N ), if COMPQ = 'C'. For good performance LDWORK should be generally 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. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal LZWORK. On exit, if INFO = -21, ZWORK(1) returns the minimum value of LZWORK. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= 1, if JOB = 'E'; otherwise, LZWORK >= 6*N + 4, if COMPQ = 'N'; LZWORK >= 8*N + 4, if COMPQ = 'C'. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA. BWORK LOGICAL array, dimension (LBWORK) LBWORK >= 0, if JOB = 'E'; LBWORK >= N, if JOB = 'T'.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: QZ iteration failed in the SLICOT Library routine MB04FD (QZ iteration did not converge or computation of the shifts failed); = 2: QZ iteration failed in the LAPACK routine ZHGEQZ when trying to triangularize the 2-by-2 blocks; = 3: warning: the pencil is numerically singular.Method
First, T = i*H is set. Then, the embeddings, B_S and B_T, of the matrices S and T, are determined and, subsequently, the SLICOT Library routine MB04FD is applied to compute the structured Schur form, i.e., the factorizations ~ T T ( S11 S12 ) B_S = J Q J B_S Q = ( T ) and ( 0 S11 ) ~ T T ( T11 T12 ) B_T = J Q J B_T Q = ( T ), ( 0 T11 ) where Q is real orthogonal, S11 is upper triangular, and T11 is upper quasi-triangular. If JOB = 'T', then the matrices above are ~ further transformed so that the 2-by-2 blocks in i*B_T are split into 1-by-1 blocks. If COMPQ = 'C', the transformations are accumulated in the unitary matrix Q. See also page 22 in [1] for more details.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) complex floating point operations.Further Comments
The returned eigenvalues are those of the pencil (-i*T11,S11), where i is the purely imaginary unit. If JOB = 'E', the returned matrix T11 is quasi-triangular. Note that the off-diagonal elements of the 2-by-2 blocks of S11 are zero by construction. If JOB = 'T', the returned eigenvalues correspond to the diagonal elements of BB and BA. This routine does not perform any scaling of the matrices. Scaling might sometimes be useful, and it should be done externally.Example
Program Text
* MB04BZ EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 50 ) INTEGER LDA, LDB, LDDE, LDFG, LDQ, LDWORK, LZWORK PARAMETER ( LDA = NMAX, LDB = NMAX, LDDE = NMAX, $ LDFG = NMAX, LDQ = 2*NMAX, $ LDWORK = 11*NMAX*NMAX + 2*NMAX, $ LZWORK = 8*NMAX + 4 ) * * .. Local Scalars .. CHARACTER COMPQ, JOB INTEGER I, INFO, J, M, N * * .. Local Arrays .. COMPLEX*16 A( LDA, NMAX ), B( LDB, NMAX ), $ DE( LDDE, NMAX ), FG( LDFG, NMAX ), $ Q( LDQ, 2*NMAX ), ZWORK( LZWORK ) DOUBLE PRECISION ALPHAI( NMAX ), ALPHAR( NMAX ), $ BETA( NMAX ), DWORK( LDWORK ) INTEGER IWORK( 2*NMAX+3 ) LOGICAL BWORK( NMAX ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB04BZ * * .. Intrinsic Functions .. INTRINSIC MOD * * .. Executable Statements .. * WRITE( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ( NIN, FMT = * ) READ( NIN, FMT = * ) JOB, COMPQ, N IF( N.LT.0 .OR. N.GT.NMAX .OR. MOD( N, 2 ).NE.0 ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE M = N/2 READ( NIN, FMT = * ) ( ( A( I, J ), J = 1, M ), I = 1, M ) READ( NIN, FMT = * ) ( ( DE( I, J ), J = 1, M+1 ), I = 1, M ) READ( NIN, FMT = * ) ( ( B( I, J ), J = 1, M ), I = 1, M ) READ( NIN, FMT = * ) ( ( FG( I, J ), J = 1, M+1 ), I = 1, M ) * Compute the eigenvalues of a complex skew-Hamiltonian/ * Hamiltonian pencil. CALL MB04BZ( JOB, COMPQ, N, A, LDA, DE, LDDE, B, LDB, FG, LDFG, $ Q, LDQ, ALPHAR, ALPHAI, BETA, IWORK, DWORK, $ LDWORK, ZWORK, LZWORK, BWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE IF( LSAME( JOB, 'T' ) ) THEN WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE( NOUT, FMT = 99995 ) ( A( I, J ), J = 1, N ) 10 CONTINUE WRITE( NOUT, FMT = 99994 ) DO 20 I = 1, N WRITE( NOUT, FMT = 99995 ) ( DE( I, J ), J = 1, N ) 20 CONTINUE WRITE( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE( NOUT, FMT = 99995 ) ( B( I, J ), J = 1, N ) 30 CONTINUE WRITE( NOUT, FMT = 99992 ) DO 40 I = 1, N WRITE( NOUT, FMT = 99995 ) ( FG( I, J ), J = 1, N ) 40 CONTINUE END IF IF( LSAME( COMPQ, 'C' ) ) THEN WRITE( NOUT, FMT = 99991 ) DO 50 I = 1, 2*N WRITE( NOUT, FMT = 99995 ) ( Q( I, J ), J = 1, 2*N ) 50 CONTINUE END IF WRITE( NOUT, FMT = 99990 ) WRITE( NOUT, FMT = 99989 ) ( ALPHAR( I ), I = 1, N ) WRITE( NOUT, FMT = 99988 ) WRITE( NOUT, FMT = 99989 ) ( ALPHAI( I ), I = 1, N ) WRITE( NOUT, FMT = 99987 ) WRITE( NOUT, FMT = 99989 ) ( BETA( I ), I = 1, N ) END IF END IF STOP * 99999 FORMAT ( 'MB04BZ EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT ( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT ( 'INFO on exit from MB04BZ = ', I2 ) 99996 FORMAT (/'The matrix A on exit is ' ) 99995 FORMAT (20( 1X, F9.4, SP, F9.4, S, 'i ') ) 99994 FORMAT (/'The matrix D on exit is ' ) 99993 FORMAT (/'The matrix B on exit is ' ) 99992 FORMAT (/'The matrix F on exit is ' ) 99991 FORMAT (/'The matrix Q is ' ) 99990 FORMAT (/'The vector ALPHAR is ' ) 99989 FORMAT ( 50( 1X, F8.4 ) ) 99988 FORMAT (/'The vector ALPHAI is ' ) 99987 FORMAT (/'The vector BETA is ' ) ENDProgram Data
MB04BZ EXAMPLE PROGRAM DATA T C 4 (0.0604,0.6568) (0.5268,0.2919) (0.3992,0.6279) (0.4167,0.4316) (0,0.4896) (0,0.9516) (0.3724,0.0526) (0.9840,0.3394) (0,0.9203) (0,0.7378) (0.2691,0.4177) (0.5478,0.3014) (0.4228,0.9830) (0.9427,0.7010) 0.6663 0.6981 (0.1781,0.8818) (0.5391,0.1711) 0.6665 0.1280Program Results
MB04BZ EXAMPLE PROGRAM RESULTS The matrix A on exit is 0.7430 +0.0000i 0.0389 -0.4330i -0.1155 -0.1366i -0.6586 -0.3210i 0.3992 +0.6279i 0.7548 +0.0000i 0.6099 -0.2308i 0.2140 +0.1260i 0.0000 +0.0000i 0.0000 +0.0000i 1.4085 +0.0000i 0.0848 +0.4972i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 1.4725 +0.0000i The matrix D on exit is 0.0000 -0.6858i 0.1839 -0.0474i -0.4428 -0.1290i 0.4759 +0.0380i 0.9840 +0.3394i 0.0000 +0.6858i -0.6339 +0.1358i 0.4204 -0.2140i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 -0.2110i -0.0159 -0.0338i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.2110i The matrix B on exit is -1.5832 +0.5069i -0.0097 +0.0866i 0.1032 -0.1431i -0.0426 +0.7942i 0.0000 +0.0000i 1.6085 +0.5150i -0.1342 -0.8180i 0.5143 +0.0178i 0.0000 +0.0000i 0.0000 +0.0000i -0.0842 -0.1642i 0.0246 -0.0264i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0880 -0.1716i The matrix F on exit is 0.3382 0.0000i 0.0234 +0.0907i -0.1619 +0.9033i -0.8227 +0.0204i 0.5391 +0.1711i -0.3382 +0.0000i -0.6525 +0.2455i -0.3532 -0.6409i 0.0000 +0.0000i 0.0000 +0.0000i 0.0120 0.0000i 0.0019 -0.0009i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.0120 +0.0000i The matrix Q is 0.1422 +0.5446i -0.3877 -0.1273i -0.4363 +0.1705i 0.0348 -0.5440i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.1594 -0.2382i 0.1967 -0.2467i -0.1376 -0.0961i -0.1070 -0.2058i -0.1273 +0.0585i -0.0852 +0.1020i 0.6125 -0.1059i -0.0172 +0.5589i -0.3659 -0.0211i -0.0291 +0.4967i -0.0729 +0.4236i 0.3169 -0.0008i 0.2947 -0.1080i 0.1614 -0.2342i 0.2867 -0.0578i -0.0170 +0.2603i 0.1846 +0.4089i -0.2815 -0.2018i 0.3220 -0.1600i -0.0526 +0.3937i 0.2747 -0.0655i 0.1045 -0.2159i 0.2085 -0.3104i -0.3052 +0.1463i -0.0201 -0.2898i 0.2131 -0.0081i -0.2165 -0.1055i -0.1324 -0.3133i 0.1660 -0.1635i 0.2250 -0.1390i -0.1590 -0.4634i -0.5310 -0.2239i 0.1342 -0.1295i 0.1128 -0.1990i -0.0712 -0.1686i -0.1490 -0.1336i 0.6198 +0.0113i 0.0281 -0.4762i -0.0462 +0.3244i 0.3464 +0.0086i 0.2305 -0.1358i 0.1292 -0.3311i -0.0106 +0.4992i 0.3906 +0.0997i 0.1429 +0.3376i -0.4310 -0.0866i -0.0894 -0.1336i -0.1601 -0.1055i -0.2601 +0.0835i -0.0940 +0.3652i -0.0213 -0.3116i -0.2502 -0.0995i 0.1361 +0.4589i -0.5898 -0.0730i 0.0294 -0.1192i -0.1253 +0.0085i The vector ALPHAR is -1.5832 1.5832 -0.0842 0.0842 The vector ALPHAI is 0.5069 0.5069 -0.1642 -0.1642 The vector BETA is 0.7430 0.7430 1.4085 1.4085
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04CD.html 0000664 0000000 0000000 00000034015 14560147231 0020326 0 ustar 00root root 0000000 0000000
Purpose
To compute the transformed matrices A, B and D, using orthogonal matrices Q1, Q2 and Q3 for a real N-by-N regular pencil ( A11 0 ) ( B11 0 ) ( 0 D12 ) aA*B - bD = a ( ) ( ) - b ( ), (1) ( 0 A22 ) ( 0 B22 ) ( D21 0 ) where A11, A22, B11, B22 and D12 are upper triangular, D21 is upper quasi-triangular and the generalized matrix product -1 -1 -1 -1 A11 D12 B22 A22 D21 B11 is upper quasi-triangular, such that Q3' A Q2, Q2' B Q1 are upper triangular, Q3' D Q1 is upper quasi-triangular and the transformed pencil a(Q3' A B Q1) - b(Q3' D Q1) is in generalized Schur form. The notation M' denotes the transpose of the matrix M.Specification
SUBROUTINE MB04CD( COMPQ1, COMPQ2, COMPQ3, N, A, LDA, B, LDB, D, $ LDD, Q1, LDQ1, Q2, LDQ2, Q3, LDQ3, IWORK, $ LIWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ1, COMPQ2, COMPQ3 INTEGER INFO, LDA, LDB, LDD, LDQ1, LDQ2, LDQ3, LDWORK, $ LIWORK, N C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), D( LDD, * ), $ DWORK( * ), Q1( LDQ1, * ), Q2( LDQ2, * ), $ Q3( LDQ3, * )Arguments
Mode Parameters
COMPQ1 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q1, as follows: = 'N': Q1 is not computed; = 'I': the array Q1 is initialized internally to the unit matrix, and the orthogonal matrix Q1 is returned; = 'U': the array Q1 contains an orthogonal matrix Q01 on entry, and the matrix Q01*Q1 is returned, where Q1 is the product of the orthogonal transformations that are applied on the right to the pencil aA*B - bD in (1). COMPQ2 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q2, as follows: = 'N': Q2 is not computed; = 'I': the array Q2 is initialized internally to the unit matrix, and the orthogonal matrix Q2 is returned; = 'U': the array Q2 contains an orthogonal matrix Q02 on entry, and the matrix Q02*Q2 is returned, where Q2 is the product of the orthogonal transformations that are applied on the left to the pencil aA*B - bD in (1). COMPQ3 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q3, as follows: = 'N': Q3 is not computed; = 'I': the array Q3 is initialized internally to the unit matrix, and the orthogonal matrix Q3 is returned; = 'U': the array Q3 contains an orthogonal matrix Q01 on entry, and the matrix Q03*Q3 is returned, where Q3 is the product of the orthogonal transformations that are applied on the right to the pencil aA*B - bD in (1).Input/Output Parameters
N (input) INTEGER Order of the pencil aA*B - bD. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N) On entry, the leading N-by-N block diagonal part of this array must contain the matrix A in (1). The off-diagonal blocks need not be set to zero. On exit, the leading N-by-N part of this array contains the transformed upper triangular matrix. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N). B (input/output) DOUBLE PRECISION array, dimension (LDB, N) On entry, the leading N-by-N block diagonal part of this array must contain the matrix B in (1). The off-diagonal blocks need not be set to zero. On exit, the leading N-by-N part of this array contains the transformed upper triangular matrix. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N). D (input/output) DOUBLE PRECISION array, dimension (LDD, N) On entry, the leading N-by-N block anti-diagonal part of this array must contain the matrix D in (1). The diagonal blocks need not be set to zero. On exit, the leading N-by-N part of this array contains the transformed upper quasi-triangular matrix. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1, N). Q1 (input/output) DOUBLE PRECISION array, dimension (LDQ1, N) On entry, if COMPQ1 = 'U', then the leading N-by-N part of this array must contain a given matrix Q01, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q01 and the transformation matrix Q1 used to transform the matrices A, B, and D. On exit, if COMPQ1 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q1. If COMPQ1 = 'N' this array is not referenced. LDQ1 INTEGER LDQ1 >= 1, if COMPQ1 = 'N'; LDQ1 >= MAX(1, N), if COMPQ1 = 'I' or COMPQ1 = 'U'. Q2 (input/output) DOUBLE PRECISION array, dimension (LDQ2, N) On entry, if COMPQ2 = 'U', then the leading N-by-N part of this array must contain a given matrix Q02, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q02 and the transformation matrix Q2 used to transform the matrices A, B, and D. On exit, if COMPQ2 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q2. If COMPQ2 = 'N' this array is not referenced. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= 1, if COMPQ2 = 'N'; LDQ2 >= MAX(1, N), if COMPQ2 = 'I' or COMPQ2 = 'U'. Q3 (input/output) DOUBLE PRECISION array, dimension (LDQ3, N) On entry, if COMPQ3 = 'U', then the leading N-by-N part of this array must contain a given matrix Q03, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q03 and the transformation matrix Q3 used to transform the matrices A, B and D. On exit, if COMPQ3 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q3. If COMPQ3 = 'N' this array is not referenced. LDQ3 INTEGER The leading dimension of the array Q3. LDQ3 >= 1, if COMPQ3 = 'N'; LDQ3 >= MAX(1, N), if COMPQ3 = 'I' or COMPQ3 = 'U'.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER The dimension of the array IWORK. LIWORK >= MAX( N/2+1, 48 ). DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. On exit, if INFO = -20, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 3*N*N + MAX( N/2 + 252, 432 ). For good performance LDWORK should be generally larger. If LDWORK = -1 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 is issued by XERBLA. BWORK LOGICAL array, dimension (N/2)Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the periodic QZ algorithm failed to reorder the eigenvalues (the problem is very ill-conditioned) in the SLICOT Library routine MB03KD; = 2: the standard QZ algorithm failed in the LAPACK routine DGGEV, called by the SLICOT routine MB03CD; = 3: the standard QZ algorithm failed in the LAPACK routines DGGES, called by the SLICOT routines MB03CD or MB03ED; = 4: the standard QZ algorithm failed to reorder the eigenvalues in the LAPACK routine DTGSEN, called by the SLICOT routine MB03CD.Method
First, the periodic QZ algorithm (see also [2] and [3]) is applied -1 -1 -1 -1 to the formal matrix product A11 D12 B22 A22 D21 B11 to reorder the eigenvalues, i.e., orthogonal matrices V1, V2, V3, V4, V5 and V6 are computed such that V2' A11 V1, V2' D12 V3, V4' B22 V3, V5' A22 V4, V5' D21 V6 and V1' B11 V6 keep the triangular form, but they can be partitioned into 2-by-2 block forms and the last diagonal blocks correspond to all nonpositive real eigenvalues of the formal product, and the first diagonal blocks correspond to the remaining eigenvalues. Second, Q1 = diag(V6, V3), Q2 = diag(V1, V4), Q3 = diag(V2, V5) and ( AA11 AA12 0 0 ) ( ) ( 0 AA22 0 0 ) A := Q3' A Q2 =: ( ), ( 0 0 AA33 AA34 ) ( ) ( 0 0 0 AA44 ) ( BB11 BB12 0 0 ) ( ) ( 0 BB22 0 0 ) B := Q2' B Q1 =: ( ), ( 0 0 BB33 BB34 ) ( ) ( 0 0 0 BB44 ) ( 0 0 DD13 DD14 ) ( ) ( 0 0 0 DD24 ) D := Q3' D Q1 =: ( ), ( DD31 DD32 0 0 ) ( ) ( 0 DD42 0 0 ) -1 -1 -1 -1 are set, such that AA22 DD24 BB44 AA44 DD42 BB22 has only nonpositive real eigenvalues. Third, the permutation matrix ( I 0 0 0 ) ( ) ( 0 0 I 0 ) P = ( ), ( 0 I 0 0 ) ( ) ( 0 0 0 I ) where I denotes the identity matrix of appropriate size is used to transform aA*B - bD to block upper triangular form ( AA11 0 | AA12 0 ) ( | ) ( 0 AA33 | 0 AA34 ) ( AA1 * ) A := P' A P = (-----------+-----------) = ( ), ( 0 0 | AA22 0 ) ( 0 AA2 ) ( | ) ( 0 0 | 0 AA44 ) ( BB11 0 | BB12 0 ) ( | ) ( 0 BB33 | 0 BB34 ) ( BB1 * ) B := P' B P = (-----------+-----------) = ( ), ( 0 0 | BB22 0 ) ( 0 BB2 ) ( | ) ( 0 0 | 0 BB44 ) ( 0 DD13 | 0 DD14 ) ( | ) ( DD31 0 | DD32 0 ) ( DD1 * ) D := P' D P = (-----------+-----------) = ( ). ( 0 0 | 0 DD24 ) ( 0 DD2 ) ( | ) ( 0 0 | DD42 0 ) Then, further orthogonal transformations that are provided by the SLICOT Library routines MB03ED and MB03CD are used to triangularize the subpencil aAA1 BB1 - bDD1. Finally, the subpencil aAA2 BB2 - bDD2 is triangularized by applying a special permutation matrix. See also page 22 in [1] for more details.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007. [2] Bojanczyk, A., Golub, G. H. and Van Dooren, P. The periodic Schur decomposition: algorithms and applications. In F.T. Luk (editor), Advanced Signal Processing Algorithms, Architectures, and Implementations III, Proc. SPIE Conference, vol. 1770, pp. 31-42, 1992. [3] Hench, J. J. and Laub, A. J. Numerical Solution of the discrete-time periodic Riccati equation. IEEE Trans. Automat. Control, 39, 1197-1210, 1994.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To apply from the left the inverse of a balancing transformation, computed by the SLICOT Library routine MB04DP, to the matrix [ V1 ] [ ], [ sgn*V2 ] where sgn is either +1 or -1.Specification
SUBROUTINE MB04DB( JOB, SGN, N, ILO, LSCALE, RSCALE, M, V1, LDV1, $ V2, LDV2, INFO ) C .. Scalar Arguments .. CHARACTER JOB, SGN INTEGER ILO, INFO, LDV1, LDV2, M, N C .. Array Arguments .. DOUBLE PRECISION LSCALE(*), RSCALE(*), V1(LDV1,*), V2(LDV2,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the type of inverse transformation required: = 'N': do nothing, return immediately; = 'P': do inverse transformation for permutation only; = 'S': do inverse transformation for scaling only; = 'B': do inverse transformations for both permutation and scaling. JOB must be the same as the argument JOB supplied to MB04DP. SGN CHARACTER*1 Specifies the sign to use for V2: = 'P': sgn = +1; = 'N': sgn = -1.Input/Output Parameters
N (input) INTEGER The number of rows of the matrices V1 and V2. N >= 0. ILO (input) INTEGER The integer ILO determined by MB04DP. 1 <= ILO <= N+1. LSCALE (input) DOUBLE PRECISION array, dimension (N) Details of the permutation and scaling factors applied from the left, as returned by MB04DP. RSCALE (input) DOUBLE PRECISION array, dimension (N) Details of the permutation and scaling factors applied from the right, as returned by MB04DP. M (input) INTEGER The number of columns of the matrices V1 and V2. M >= 0. V1 (input/output) DOUBLE PRECISION array, dimension (LDV1,M) On entry, the leading N-by-M part of this array must contain the matrix V1. On exit, the leading N-by-M part of this array is overwritten by the updated matrix V1 of the transformed matrix. LDV1 INTEGER The leading dimension of the array V1. LDV1 >= max(1,N). V2 (input/output) DOUBLE PRECISION array, dimension (LDV2,M) On entry, the leading N-by-M part of this array must contain the matrix V2. On exit, the leading N-by-M part of this array is overwritten by the updated matrix V2 of the transformed matrix. LDV2 INTEGER The leading dimension of the array V2. LDV2 >= max(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[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. [2] Benner, P. Symplectic balancing of Hamiltonian matrices. SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To balance a real Hamiltonian matrix, [ A G ] H = [ T ] , [ Q -A ] where A is an N-by-N matrix and G, Q are N-by-N symmetric matrices. This involves, first, permuting H 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.Specification
SUBROUTINE MB04DD( 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(*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the operations to be performed on H: = 'N': none, set ILO = 1, SCALE(I) = 1.0, I = 1 .. N; = 'P': permute only; = 'S': scale only; = 'B': both permute and scale.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 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 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 >= 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 the lower triangular part of the matrix Q and the upper triangular part of the matrix G. On exit, the leading N-by-N+1 part of this array contains the lower and upper triangular parts of the matrices Q and G, respectively, of the balanced Hamiltonian. In particular, the lower triangular part of the first ILO-1 columns of QG is zero. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N). ILO (output) INTEGER ILO-1 is the number of deflated eigenvalues in the balanced Hamiltonian matrix. SCALE (output) DOUBLE PRECISION array of dimension (N) Details of the permutations and scaling factors applied to H. For j = 1,...,ILO-1 let P(j) = SCALE(j). If P(j) <= 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) > 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Benner, P. Symplectic balancing of Hamiltonian matrices. SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.Further Comments
NoneExample
Program Text
* MB04DD 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 MB04DD * .. 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 MB04DD( 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, ILO-1, QG(1,1), LDQG, DUMMY ) ) END IF END IF END IF * 99999 FORMAT (' MB04DD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04DD = ',I2) 99997 FORMAT (' The balanced matrix A is ') 99996 FORMAT (/' The balanced matrix QG is ') 99995 FORMAT (20(1X,F12.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' ILO = ',I4) 99992 FORMAT (/' Norm of subdiagonal blocks: ',G7.2) ENDProgram Data
MB04DD EXAMPLE PROGRAM DATA 6 B 0 0 0 0 0 0 0.0994 0 0 0 0 0.9696 0.3248 0 0 0 0.4372 0.8308 0 0 0 0.0717 0 0 0 0 0 0 0 0.1976 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0651 0 0 0 0 0 0 0 0 0 0 0 0.0444 0 0 0.1957 0 0.8144 0 0 0 0.3652 0 0.9121 0.9023 0 0 0 0 0 1.0945Program Results
MB04DD EXAMPLE PROGRAM RESULTS The balanced matrix A is 0.0000 0.0000 0.0000 0.0000 0.0000 0.9696 0.0000 0.0000 0.0000 0.0000 -0.8144 -0.9023 0.0000 0.0000 0.0000 0.0000 0.1093 0.2077 0.0000 0.0000 0.0000 0.0717 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.1976 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The balanced matrix QG is 0.0000 0.0000 0.0994 0.0000 0.0651 0.0000 0.0000 0.0000 0.0000 0.0000 0.0812 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.1776 0.0000 0.0000 0.1957 0.0000 0.0000 0.0000 0.0000 0.0000 0.3652 0.0000 0.9121 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0945 ILO = 3 Norm of subdiagonal blocks: 0.0
Purpose
To apply the inverse of a balancing transformation, computed by the SLICOT Library routines MB04DD or MB04DS, to a 2*N-by-M matrix [ V1 ] [ ], [ sgn*V2 ] where sgn is either +1 or -1.Specification
SUBROUTINE MB04DI( JOB, SGN, N, ILO, SCALE, M, V1, LDV1, V2, LDV2, $ INFO ) C .. Scalar Arguments .. CHARACTER JOB, SGN INTEGER ILO, INFO, LDV1, LDV2, M, N C .. Array Arguments .. DOUBLE PRECISION SCALE(*), V1(LDV1,*), V2(LDV2,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the type of inverse transformation required: = 'N': do nothing, return immediately; = 'P': do inverse transformation for permutation only; = 'S': do inverse transformation for scaling only; = 'B': do inverse transformations for both permutation and scaling. JOB must be the same as the argument JOB supplied to MB04DD or MB04DS. SGN CHARACTER*1 Specifies the sign to use for V2: = 'P': sgn = +1; = 'N': sgn = -1.Input/Output Parameters
N (input) INTEGER The number of rows of the matrices V1 and V2. N >= 0. ILO (input) INTEGER The integer ILO determined by MB04DD or MB04DS. 1 <= ILO <= N+1. SCALE (input) DOUBLE PRECISION array, dimension (N) Details of the permutation and scaling factors, as returned by MB04DD or MB04DS. M (input) INTEGER The number of columns of the matrices V1 and V2. M >= 0. V1 (input/output) DOUBLE PRECISION array, dimension (LDV1,M) On entry, the leading N-by-M part of this array must contain the matrix V1. On exit, the leading N-by-M part of this array is overwritten by the updated matrix V1 of the transformed matrix. LDV1 INTEGER The leading dimension of the array V1. LDV1 >= max(1,N). V2 (input/output) DOUBLE PRECISION array, dimension (LDV2,M) On entry, the leading N-by-M part of this array must contain the matrix V2. On exit, the leading N-by-M part of this array is overwritten by the updated matrix V2 of the transformed matrix. LDV2 INTEGER The leading dimension of the array V2. LDV2 >= max(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Benner, P. Symplectic balancing of Hamiltonian matrices. SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To balance a pair of N-by-N real 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 DGGBAL.Specification
SUBROUTINE MB04DL( 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 A(LDA,*), B(LDB,*), DWORK(*), LSCALE(*), $ RSCALE(*)Arguments
Mode Parameters
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.Input/Output Parameters
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) 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 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) DOUBLE PRECISION 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.Workspace
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).Warning Indicator
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.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
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 DGGBAL [1]. Setting THRESH < 0, usually gives better results than DGGBAL for badly scaled matrix pencils.References
[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.Numerical Aspects
No rounding errors appear if JOB = 'P'.Further Comments
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).Example
Program Text
* MB04DL 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 .. DOUBLE PRECISION A(LDA, NMAX), B(LDB, NMAX), DWORK(8*NMAX), $ LSCALE(NMAX), RSCALE(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB04DL * .. 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 MB04DL( 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 = 99995 ) ( LSCALE(I), I = 1,N ) WRITE ( NOUT, FMT = 99990 ) WRITE ( NOUT, FMT = 99995 ) ( 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 = 99995 ) ( DWORK(I), I = 1,2 ) WRITE ( NOUT, FMT = 99988 ) WRITE ( NOUT, FMT = 99995 ) ( DWORK(I), I = 3,4 ) WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( DWORK(5) ) ELSE WRITE ( NOUT, FMT = 99986 ) IWARN END IF END IF END IF END IF * 99999 FORMAT (' MB04DL EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04DL = ',I2) 99997 FORMAT (' The balanced matrix A is ') 99996 FORMAT (/' The balanced matrix B is ') 99995 FORMAT (20(1X,G12.4)) 99994 FORMAT (/' ILO = ',I4) 99993 FORMAT (/' IHI = ',I4) 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 MB04DL = ',I2) 99985 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB04DL EXAMPLE PROGRAM DATA 4 B -3 1 0 -1e-12 0 0 -2 0 0 -1 -1 -1 0 -1 -1 0 2 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1Program Results
MB04DL EXAMPLE PROGRAM RESULTS The balanced matrix A is 2.000 -1.000 0.000 -1.000 0.000 1.000 -0.1000E-11 0.000 0.000 -1.000 -1.000 -1.000 0.000 0.000 0.000 -2.000 The balanced matrix B is 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 1.000 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.000 1.000 The final 1-norms of the (sub)matrices are 2.000 1.000 The threshold value finally used is 0.2500E-12
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04DP.html 0000664 0000000 0000000 00000043136 14560147231 0020347 0 ustar 00root root 0000000 0000000
Purpose
To balance the 2*N-by-2*N skew-Hamiltonian/Hamiltonian pencil aS - bH, with ( A D ) ( C V ) S = ( ) and H = ( ), A, C N-by-N, (1) ( E A' ) ( W -C' ) where D and E are skew-symmetric, and V and W are symmetric matrices. This involves, first, permuting aS - bH by a symplectic equivalence transformation to isolate eigenvalues in the first 1:ILO-1 elements on the diagonal of A and C; and second, applying a diagonal equivalence transformation to make the pairs of rows and columns ILO:N and N+ILO:2*N as close in 1-norm as possible. Both steps are optional. Balancing may reduce the 1-norms of the matrices S and H.Specification
SUBROUTINE MB04DP( JOB, N, THRESH, A, LDA, DE, LDDE, C, LDC, VW, $ LDVW, ILO, LSCALE, RSCALE, DWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER ILO, INFO, IWARN, LDA, LDC, LDDE, LDVW, N DOUBLE PRECISION THRESH C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), C(LDC,*), DE(LDDE,*), DWORK(*), $ LSCALE(*), RSCALE(*), VW(LDVW,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the operations to be performed on S and H: = '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.Input/Output Parameters
N (input) INTEGER The order of matrices A, D, E, C, V, and W. 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 S(s,s) and H(s,s), with s = [ILO:N,N+ILO:2*N]. 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(H(s,s),1)/norm(S(s,s),1), norm(S(s,s),1)/norm(H(s,s),1) ) (1) has the smallest value, for the threshold values used, where S(s,s) and H(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(H(s,s),1)*norm(S(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(ILO:N); RSCALE(ILO:N)] 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) 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 matrix S. 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 >= MAX(1,N). DE (input/output) DOUBLE PRECISION array, dimension (LDDE, N+1) On entry, the leading N-by-N strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix E, and the N-by-N strictly upper triangular part of the submatrix in the columns 2 to N+1 of this array must contain the strictly upper triangular part of the skew-symmetric matrix D. The entries on the diagonal and the first superdiagonal of this array need not be set, but are assumed to be zero. On exit, the leading N-by-N strictly lower triangular part of this array contains the strictly lower triangular part of the balanced matrix E, and the N-by-N strictly upper triangular part of the submatrix in the columns 2 to N+1 of this array contains the strictly upper triangular part of the balanced matrix D. In particular, the strictly lower triangular part of the first ILO-1 columns of DE is zero. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N). C (input/output) DOUBLE PRECISION array, dimension (LDC, N) On entry, the leading N-by-N part of this array must contain the matrix C. On exit, the leading N-by-N part of this array contains the matrix C of the balanced Hamiltonian matrix H. In particular, the strictly lower triangular part of the first ILO-1 columns of C is zero. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1, N). VW (input/output) DOUBLE PRECISION array, dimension (LDVW, N+1) On entry, the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix W, and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array must contain the upper triangular part of the symmetric matrix V. On exit, the leading N-by-N lower triangular part of this array contains the lower triangular part of the balanced matrix W, and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array contains the upper triangular part of the balanced matrix V. In particular, the lower triangular part of the first ILO-1 columns of VW is zero. LDVW INTEGER The leading dimension of the array VW. LDVW >= MAX(1, N). ILO (output) INTEGER ILO-1 is the number of deflated eigenvalues in the balanced skew-Hamiltonian/Hamiltonian matrix pencil. ILO is set to 1 if JOB = 'N' or JOB = 'S'. LSCALE (output) DOUBLE PRECISION array, dimension (N) Details of the permutations of S and H and scaling applied to A, D, C, and V from the left. For j = 1,...,ILO-1 let P(j) = LSCALE(j). If P(j) <= 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) > 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 LSCALE contains the factor of the scaling applied to row j of the matrices A, D, C, and V. RSCALE (output) DOUBLE PRECISION array, dimension (N) Details of the permutations of S and H and scaling applied to A, E, C, and W from the right. For j = 1,...,ILO-1 let P(j) = RSCALE(j). If P(j) <= 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) > 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 RSCALE contains the factor of the scaling applied to column j of the matrices A, E, C, and W.Workspace
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 S(s,s) and H(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 = N).Warning Indicator
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.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
Balancing consists of applying a (symplectic) equivalence transformation to isolate eigenvalues and/or to make the 1-norms of each pair of rows and columns indexed by s of S and H 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 0 ) ( A D ) ( Dr 0 ) ( Dl 0 ) ( C V ) ( Dr 0 ) ( ) ( ) ( ), ( ) ( ) ( ). ( 0 Dr ) ( E A' ) ( 0 Dl ) ( 0 Dr ) ( W -C' ) ( 0 Dl ) For THRESH = 0, the routine returns essentially the same results as the LAPACK subroutine DGGBAL [1]. Setting THRESH < 0, usually gives better results than DGGBAL for badly scaled matrix pencils.References
[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. [2] Benner, P. Symplectic balancing of Hamiltonian matrices. SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.Numerical Aspects
The transformations used preserve the skew-Hamiltonian/Hamiltonian structure and do not introduce significant rounding errors. No rounding errors appear if JOB = 'P'. If T is the global transformation matrix applied to the right, then J'*T*J is the global transformation matrix applied to the left, where J = [ 0 I; -I 0 ], with blocks of order N.Further Comments
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).Example
Program Text
* MB04DP EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 10 ) INTEGER LDA, LDC, LDDE, LDVW PARAMETER ( LDA = NMAX, LDC = NMAX, LDDE = NMAX, $ LDVW = NMAX ) * .. Local Scalars .. CHARACTER*1 JOB INTEGER I, ILO, INFO, IWARN, J, N DOUBLE PRECISION THRESH * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), DWORK(8*NMAX), C(LDC, NMAX), $ DE(LDDE, NMAX+1), LSCALE(NMAX), RSCALE(NMAX), $ VW(LDVW, NMAX+1) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB04DP * .. 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 = * ) ( ( DE(I,J), J = 1,N+1 ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( VW(I,J), J = 1,N+1 ), I = 1,N ) CALL MB04DP( JOB, N, THRESH, A, LDA, DE, LDDE, C, LDC, VW, $ LDVW, ILO, 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 = 99993 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99993 ) ( DE(I,J), J = 1,N+1 ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99993 ) ( C(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99993 ) ( VW(I,J), J = 1,N+1 ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) ILO WRITE ( NOUT, FMT = 99991 ) WRITE ( NOUT, FMT = 99993 ) ( LSCALE(I), I = 1,N ) WRITE ( NOUT, FMT = 99990 ) WRITE ( NOUT, FMT = 99993 ) ( 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 = 99993 ) ( DWORK(I), I = 1,2 ) WRITE ( NOUT, FMT = 99988 ) WRITE ( NOUT, FMT = 99993 ) ( DWORK(I), I = 3,4 ) WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99993 ) ( DWORK(5) ) ELSE WRITE ( NOUT, FMT = 99986 ) IWARN END IF END IF END IF END IF * 99999 FORMAT (' MB04DP EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04DP = ',I2) 99997 FORMAT (' The balanced matrix A is ') 99996 FORMAT (/' The balanced matrix DE is ') 99995 FORMAT (' The balanced matrix C is ') 99994 FORMAT (/' The balanced matrix VW is ') 99993 FORMAT (20(1X,G12.4)) 99992 FORMAT (/' ILO = ',I4) 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 MB04DP = ',I2) 99985 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB04DP EXAMPLE PROGRAM DATA 2 B -3 1 0 0 1 0 0 0 0 0 0 1 0 0 -2 -1 -1.0e-12 0 -1 -1 0Program Results
MB04DP EXAMPLE PROGRAM RESULTS The balanced matrix A is 1.000 0.000 0.000 1.000 The balanced matrix DE is 0.000 0.000 0.000 0.000 0.000 0.000 The balanced matrix C is 2.000 1.000 0.000 1.000 The balanced matrix VW is 0.000 1.000 0.000 0.000 -1.000 -0.1000E-11 ILO = 2 The permutations and left scaling factors are 4.000 1.000 The permutations and right scaling factors are 4.000 1.000 The initial 1-norms of the (sub)matrices are 1.000 2.000 The final 1-norms of the (sub)matrices are 1.000 2.000 The threshold value finally used is -3.000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04DS.html 0000664 0000000 0000000 00000021107 14560147231 0020344 0 ustar 00root root 0000000 0000000
Purpose
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.Specification
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(*)Arguments
Mode Parameters
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.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 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 >= 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 >= 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) <= 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) > 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Benner, P. Symplectic balancing of Hamiltonian matrices. SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.Further Comments
NoneExample
Program Text
* 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) ENDProgram Data
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 0Program Results
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
Purpose
To perform a symplectic scaling on the Hamiltonian matrix ( A G ) H = ( T ), (1) ( Q -A ) i.e., perform either the symplectic scaling transformation -1 ( A' G' ) ( D 0 ) ( A G ) ( D 0 ) H' <-- ( T ) = ( ) ( T ) ( -1 ), (2) ( Q' -A' ) ( 0 D ) ( Q -A ) ( 0 D ) where D is a diagonal scaling matrix, or the symplectic norm scaling transformation ( A'' G'' ) 1 ( A G/tau ) H'' <-- ( T ) = --- ( T ), (3) ( Q'' -A'' ) tau ( tau Q -A ) where tau is a real scalar. Note that if tau is not equal to 1, then (3) is NOT a similarity transformation. The eigenvalues of H are then tau times the eigenvalues of H''. For symplectic scaling (2), D is chosen to give the rows and columns of A' approximately equal 1-norms and to give Q' and G' approximately equal norms. (See METHOD below for details.) For norm scaling, tau = MAX(1, ||A||, ||G||, ||Q||) where ||.|| denotes the 1-norm (column sum norm).Specification
SUBROUTINE MB04DY( JOBSCL, N, A, LDA, QG, LDQG, D, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDQG, N CHARACTER JOBSCL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), D(*), DWORK(*), QG(LDQG,*)Arguments
Mode Parameters
JOBSCL CHARACTER*1 Indicates which scaling strategy is used, as follows: = 'S' : do the symplectic scaling (2); = '1' or 'O': do the 1-norm scaling (3); = 'N' : do nothing; set INFO and return.Input/Output Parameters
N (input) INTEGER The order of the matrices A, G, and Q. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On input, if JOBSCL <> 'N', the leading N-by-N part of this array must contain the upper left block A of the Hamiltonian matrix H in (1). On output, if JOBSCL <> 'N', the leading N-by-N part of this array contains the leading N-by-N part of the scaled Hamiltonian matrix H' in (2) or H'' in (3), depending on the setting of JOBSCL. If JOBSCL = 'N', this array is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N), if JOBSCL <> 'N'; LDA >= 1, if JOBSCL = 'N'. QG (input/output) DOUBLE PRECISION array, dimension (LDQG,N+1) On input, if JOBSCL <> 'N', the leading N-by-N lower triangular part of this array must contain the lower triangle of the lower left symmetric block Q of the Hamiltonian matrix H in (1), and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array must contain the upper triangle of the upper right symmetric block G of H in (1). So, if i >= j, then Q(i,j) = Q(j,i) is stored in QG(i,j) and G(i,j) = G(j,i) is stored in QG(j,i+1). On output, if JOBSCL <> 'N', the leading N-by-N lower triangular part of this array contains the lower triangle of the lower left symmetric block Q' or Q'', and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array contains the upper triangle of the upper right symmetric block G' or G'' of the scaled Hamiltonian matrix H' in (2) or H'' in (3), depending on the setting of JOBSCL. If JOBSCL = 'N', this array is not referenced. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N), if JOBSCL <> 'N'; LDQG >= 1, if JOBSCL = 'N'. D (output) DOUBLE PRECISION array, dimension (nd) If JOBSCL = 'S', then nd = N and D contains the diagonal elements of the diagonal scaling matrix in (2). If JOBSCL = '1' or 'O', then nd = 1 and D(1) is set to tau from (3). In this case, no other elements of D are referenced. If JOBSCL = 'N', this array is not referenced.Workspace
DWORK DOUBLE PRECISION array, dimension (N) If JOBSCL = 'N', this array is not referenced.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, then the i-th argument had an illegal value.Method
1. Symplectic scaling (JOBSCL = 'S'): First, LAPACK subroutine DGEBAL is used to equilibrate the 1-norms of the rows and columns of A using a diagonal scaling matrix D_A. Then, H is similarily transformed by the symplectic diagonal matrix D1 = diag(D_A,D_A**(-1)). Next, the off-diagonal blocks of the resulting Hamiltonian matrix are equilibrated in the 1-norm using the symplectic diagonal matrix D2 of the form ( I/rho 0 ) D2 = ( ) ( 0 rho*I ) where rho is a real scalar. Thus, in (2), D = D1*D2. 2. Norm scaling (JOBSCL = '1' or 'O'): The norm of the matrices A and G of (1) is reduced by setting A := A/tau and G := G/(tau**2) where tau is the power of the base of the arithmetic closest to MAX(1, ||A||, ||G||, ||Q||) and ||.|| denotes the 1-norm.References
[1] Benner, P., Byers, R., and Barth, E. Fortran 77 Subroutines for Computing the Eigenvalues of Hamiltonian Matrices. I: The Square-Reduced Method. ACM Trans. Math. Software, 26, 1, pp. 49-77, 2000.Numerical Aspects
For symplectic scaling, the complexity of the used algorithms is hard to estimate and depends upon how well the rows and columns of A in (1) are equilibrated. In one sweep, each row/column of A is scaled once, i.e., the cost of one sweep is N**2 multiplications. Usually, 3-6 sweeps are enough to equilibrate the norms of the rows and columns of a matrix. Roundoff errors are possible as LAPACK routine DGEBAL does NOT use powers of the machine base for scaling. The second stage (equilibrating ||G|| and ||Q||) requires N**2 multiplications. For norm scaling, 3*N**2 + O(N) multiplications are required and NO rounding errors occur as all multiplications are performed with powers of the machine base.Further Comments
NoneExample
Program Text
* MB04DY EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDQG PARAMETER ( LDA = NMAX, LDQG = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX ) * .. Local Scalars .. INTEGER I, INFO, J, N CHARACTER*1 JOBSCL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), D(NMAX), DWORK(LDWORK), $ QG(LDQG,NMAX+1) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB04DY * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, JOBSCL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99998 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( QG(J,I+1), I = J,N ), J = 1,N ) READ ( NIN, FMT = * ) ( ( QG(I,J), I = J,N ), J = 1,N ) * Scale the Hamiltonian matrix. CALL MB04DY( JOBSCL, N, A, LDA, QG, LDQG, D, DWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE * Show the scaled Hamiltonian matrix. WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99993 ) ( A(I,J), J = 1,N ), $ ( QG(J,I+1), J = 1,I-1 ), ( QG(I,J+1), J = I,N ) 10 CONTINUE DO 20 I = 1, N WRITE ( NOUT, FMT = 99993 ) ( QG(I,J), J = 1,I-1 ), $ ( QG(J,I), J = I,N ), ( -A(J,I), J = 1,N ) 20 CONTINUE * Show the scaling factors. IF ( LSAME( JOBSCL, 'S' ) ) THEN WRITE ( NOUT, FMT = 99995 ) WRITE ( NOUT, FMT = 99993 ) ( D(I), I = 1,N ) ELSE IF ( LSAME( JOBSCL, '1' ) .OR. LSAME( JOBSCL, 'O' ) ) $ THEN WRITE ( NOUT, FMT = 99994 ) WRITE ( NOUT, FMT = 99993 ) D(1) END IF ENDIF END IF STOP * 99999 FORMAT (' MB04DY EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' N is out of range.',/' N = ',I5) 99997 FORMAT (' INFO on exit from MB04DY = ',I2) 99996 FORMAT (/' The scaled Hamiltonian is ') 99995 format (/' The scaling factors are ') 99994 format (/' The scaling factor tau is ') 99993 FORMAT (1X,8(F10.4)) ENDProgram Data
MB04DY EXAMPLE PROGRAM DATA 3 S -0.4 0.05 0.0007 -4.7 0.8 0.025 81.0 29.0 -0.9 0.0034 0.0014 0.00077 -0.005 0.0004 0.003 -18.0 -12.0 43.0 99.0 420.0 -200.0Program Results
MB04DY EXAMPLE PROGRAM RESULTS The scaled Hamiltonian is -0.4000 0.4000 0.3584 418.4403 21.5374 0.1851 -0.5875 0.8000 1.6000 21.5374 -9.6149 0.0120 0.1582 0.4531 -0.9000 0.1851 0.0120 0.0014 -0.0001 -0.0008 0.1789 0.4000 0.5875 -0.1582 -0.0008 0.0515 13.9783 -0.4000 -0.8000 -0.4531 0.1789 13.9783 -426.0056 -0.3584 -1.6000 0.9000 The scaling factors are 0.0029 0.0228 1.4595
Purpose
To balance a complex Hamiltonian matrix, [ A G ] H = [ H ] , [ Q -A ] where A is an N-by-N matrix and G, Q are N-by-N Hermitian matrices. This involves, first, permuting H 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. Assuming ILO = 1, let D be a diagonal matrix of order N with the scaling factors on the diagonal. The scaled Hamiltonian is defined by [ D**-1*A*D D**-1*G*D**-1 ] Hs = [ H ] . [ D*Q*D -D*A *D**-1 ]Specification
SUBROUTINE MB04DZ( 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 SCALE(*) COMPLEX*16 A(LDA,*), QG(LDQG,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the operations to be performed on H: = 'N': none, set ILO = 1, SCALE(I) = 1.0, I = 1 .. N; = 'P': permute only; = 'S': scale only; = 'B': both permute and scale.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. 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 matrix A of the balanced 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 >= MAX(1,N). QG (input/output) COMPLEX*16 array, dimension (LDQG,N+1) On entry, the leading N-by-N+1 part of this array must contain the lower triangular part of the matrix Q and the upper triangular part of the matrix G. On exit, the leading N-by-N+1 part of this array contains the lower and upper triangular parts of the matrices Q and G, respectively, of the balanced Hamiltonian. In particular, the lower triangular part of the first ILO-1 columns of QG is zero. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N). ILO (output) INTEGER ILO-1 is the number of deflated eigenvalues in the balanced Hamiltonian matrix. SCALE (output) DOUBLE PRECISION array of dimension (N) Details of the permutations and scaling factors applied to H. For j = 1,...,ILO-1 let P(j) = SCALE(j). If P(j) <= 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) > 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Benner, P. Symplectic balancing of Hamiltonian matrices. SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.Further Comments
NoneExample
Program Text
* MB04DZ 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 .. COMPLEX*16 A(LDA, NMAX), QG(LDQG, NMAX+1) DOUBLE PRECISION DUMMY(1), SCALE(NMAX) * .. External Functions .. DOUBLE PRECISION DLAPY2, ZLANTR EXTERNAL DLAPY2, ZLANTR * .. External Subroutines .. EXTERNAL MB04DZ * .. 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 MB04DZ( 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 10 I = 1, N WRITE (NOUT, FMT = 99995) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE (NOUT, FMT = 99995) ( QG(I,J), J = 1,N+1 ) 20 CONTINUE WRITE (NOUT, FMT = 99993) ILO IF ( ILO.GT.1 ) THEN WRITE (NOUT, FMT = 99992) DLAPY2( ZLANTR( 'Frobenius', $ 'Lower', 'No Unit', N-1, ILO-1, A(2,1), LDA, $ DUMMY ), ZLANTR( 'Frobenius', 'Lower', 'No Unit', $ N, ILO-1, QG(1,1), LDQG, DUMMY ) ) END IF END IF END IF * 99999 FORMAT (' MB04DZ EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04DZ = ',I2) 99997 FORMAT (' The balanced matrix A is ') 99996 FORMAT (/' The balanced matrix QG is ') 99995 FORMAT (20(1X,F9.4,SP,F9.4,S,'i ')) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' ILO = ',I4) 99992 FORMAT (/' Norm of subdiagonal blocks: ',G7.2) ENDProgram Data
MB04DZ EXAMPLE PROGRAM DATA 6 B (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (.0994,0) (0,0) (0,0) (0,0) (0,0) (.9696,0) (.3248,0) (0,0) (0,0) (0,0) (.4372,0) (.8308,0) (0,0) (0,0) (0,0) (.0717,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (.1976,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (.0651,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (0,0) (.0444,0) (0,0) (0,0) (.1957,0) (0,0) (.8144,0) (0,0) (0,0) (0,0) (.3652,0) (0,0) (.9121,0) (.9023,0) (0,0) (0,0) (0,0) (0,0) (0,0) 1.0945,0)Program Results
MB04DZ EXAMPLE PROGRAM RESULTS The balanced matrix A is 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.9696 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.8144 +0.0000i -0.9023 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.1093 +0.0000i 0.2077 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0717 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.1976 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i The balanced matrix QG is 0.0000 +0.0000i 0.0000 +0.0000i 0.0994 +0.0000i 0.0000 +0.0000i 0.0651 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0812 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.1776 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.1957 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.3652 +0.0000i 0.0000 +0.0000i 0.9121 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 1.0945 +0.0000i ILO = 3 Norm of subdiagonal blocks: 0.0
Purpose
To compute the eigenvalues of a real N-by-N skew-Hamiltonian/ skew-Hamiltonian pencil aS - bT with ( B F ) ( 0 I ) S = J Z' J' Z and T = ( ), where J = ( ). (1) ( G B' ) ( -I 0 ) Optionally, if JOB = 'T', the pencil aS - bT will be transformed to the structured Schur form: an orthogonal transformation matrix Q and an orthogonal symplectic transformation matrix U are computed, such that ( Z11 Z12 ) U' Z Q = ( ) = Zout, and ( 0 Z22 ) (2) ( Bout Fout ) J Q' J' T Q = ( ), ( 0 Bout' ) where Z11 and Z22' are upper triangular and Bout is upper quasi- triangular. The notation M' denotes the transpose of the matrix M. Optionally, if COMPQ = 'I', the orthogonal transformation matrix Q will be computed. Optionally, if COMPU = 'I' or COMPU = 'U', the orthogonal symplectic transformation matrix ( U1 U2 ) U = ( ) ( -U2 U1 ) will be computed.Specification
SUBROUTINE MB04ED( JOB, COMPQ, COMPU, N, Z, LDZ, B, LDB, FG, LDFG, $ Q, LDQ, U1, LDU1, U2, LDU2, ALPHAR, ALPHAI, $ BETA, IWORK, LIWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPU, JOB INTEGER INFO, LDB, LDFG, LDQ, LDU1, LDU2, LDWORK, LDZ, $ LIWORK, N C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION ALPHAI( * ), ALPHAR( * ), B( LDB, * ), $ BETA( * ), DWORK( * ), FG( LDFG, * ), $ Q( LDQ, * ), U1( LDU1, * ), U2( LDU2, * ), $ Z( LDZ, * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; Z and T will not necessarily be put into the forms in (2); = 'T': put Z and T into the forms in (2), and return the eigenvalues in ALPHAR, ALPHAI and BETA. COMPQ CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q as follows: = 'N': Q is not computed; = 'I': the array Q is initialized internally to the unit matrix, and the orthogonal matrix Q is returned. COMPU CHARACTER*1 Specifies whether to compute the orthogonal symplectic transformation matrix U as follows: = 'N': U is not computed; = 'I': the array U is initialized internally to the unit matrix, and the orthogonal matrix U is returned; = 'U': the arrays U1 and U2 contain the corresponding submatrices of an orthogonal symplectic matrix U0 on entry, and the updated submatrices U1 and U2 of the matrix product U0*U are returned, where U is the product of the orthogonal symplectic transformations that are applied to the pencil aS - bT to reduce Z and T to the forms in (2), for COMPU = 'I'.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bT. N >= 0, even. Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N) On entry, the leading N-by-N part of this array must contain the matrix Z. On exit, if JOB = 'T', the leading N-by-N part of this array contains the matrix Zout; otherwise, it contains the matrix Z just before the application of the periodic QZ algorithm. The entries in the rows N/2+1 to N and the first N/2 columns are unchanged. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1, N). B (input/output) DOUBLE PRECISION array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix Bout; otherwise, it contains the matrix B just before the application of the periodic QZ algorithm. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). FG (input/output) DOUBLE PRECISION array, dimension (LDFG, N/2+1) On entry, the leading N/2-by-N/2 strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix G, and the N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the strictly upper triangular part of the skew-symmetric matrix F. On exit, if JOB = 'T', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix Fout. If JOB = 'E', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix F just before the application of the QZ algorithm. The entries on the diagonal and the first superdiagonal of this array are not referenced, but are assumed to be zero. Moreover, the diagonal and the first subdiagonal of this array on exit coincide to the corresponding diagonals of this array on entry. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, N/2). Q (output) DOUBLE PRECISION array, dimension (LDQ, N) On exit, if COMPQ = 'I', the leading N-by-N part of this array contains the orthogonal transformation matrix Q. On exit, if COMPQ = 'N', the leading N-by-N part of this array contains the orthogonal matrix Q1, such that ( Z11 Z12 ) Z*Q1 = ( ), ( 0 Z22 ) where Z11 and Z22' are upper triangular (the first step of the algorithm). LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1, N). U1 (input/output) DOUBLE PRECISION array, dimension (LDU1, N/2) On entry, if COMPU = 'U', then the leading N/2-by-N/2 part of this array must contain the upper left block of a given matrix U0, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper left block U1 of the product of the input matrix U0 and the transformation matrix U used to transform the matrices Z and T. On exit, if COMPU = 'I', then the leading N/2-by-N/2 part of this array contains the upper left block U1 of the orthogonal symplectic transformation matrix U. If COMPU = 'N' this array is not referenced. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= 1, if COMPU = 'N'; LDU1 >= MAX(1, N/2), if COMPU = 'I' or COMPU = 'U'. U2 (input/output) DOUBLE PRECISION array, dimension (LDU2, N/2) On entry, if COMPU = 'U', then the leading N/2-by-N/2 part of this array must contain the upper right block of a given matrix U0, and on exit, the leading N/2-by-N/2 part of this array contains the updated upper right block U2 of the product of the input matrix U0 and the transformation matrix U used to transform the matrices Z and T. On exit, if COMPU = 'I', then the leading N/2-by-N/2 part of this array contains the upper right block U2 of the orthogonal symplectic transformation matrix U. If COMPU = 'N' this array is not referenced. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= 1, if COMPU = 'N'; LDU2 >= MAX(1, N/2), if COMPU = 'I' or COMPU = 'U'. ALPHAR (output) DOUBLE PRECISION array, dimension (N/2) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bT. ALPHAI (output) DOUBLE PRECISION array, dimension (N/2) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bT. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) = -ALPHAI(j). BETA (output) DOUBLE PRECISION array, dimension (N/2) The scalars beta that define the eigenvalues of the pencil aS - bT. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bT, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed. Due to the skew-Hamiltonian/skew-Hamiltonian structure of the pencil, every eigenvalue occurs twice and thus it has only to be saved once in ALPHAR, ALPHAI and BETA.Workspace
IWORK INTEGER array, dimension (LIWORK) On exit, if INFO = 3, IWORK(1) contains the number of (pairs of) possibly inaccurate eigenvalues, q <= N/2, and IWORK(2), ..., IWORK(q+1) indicate their indices. Specifically, a positive value is an index of a real or purely imaginary eigenvalue, corresponding to a 1-by-1 block, while the absolute value of a negative entry in IWORK is an index to the first eigenvalue in a pair of consecutively stored eigenvalues, corresponding to a 2-by-2 block. A 2-by-2 block may have two complex, two real, two purely imaginary, or one real and one purely imaginary eigenvalue. For i = q+2, ..., 2*q+1, IWORK(i) contains a pointer to the starting location in DWORK of the i-th triplet of 1-by-1 blocks, if IWORK(i-q) > 0, or 2-by-2 blocks, if IWORK(i-q) < 0, defining unreliable eigenvalues. IWORK(2*q+2) contains the number of the 1-by-1 blocks, and IWORK(2*q+3) contains the number of the 2-by-2 blocks, corresponding to unreliable eigenvalues. IWORK(2*q+4) contains the total number t of the 2-by-2 blocks. If INFO = 0, then q = 0, therefore IWORK(1) = 0. LIWORK INTEGER The dimension of the array IWORK. LIWORK >= N+9. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or INFO = 3, DWORK(1) returns the optimal LDWORK, and DWORK(2), ..., DWORK(4) contain the Frobenius norms of the factors of the formal matrix product used by the algorithm. In addition, DWORK(5), ..., DWORK(4+3*s) contain the s triplet values corresponding to the 1-by-1 blocks. Their eigenvalues are real or purely imaginary. Such an eigenvalue is obtained as a1/a2/a3, where a1, ..., a3 are the corresponding triplet values. Moreover, DWORK(5+3*s), ..., DWORK(4+3*s+12*t) contain the t groups of triplet 2-by-2 matrices corresponding to the 2-by-2 blocks. Their eigenvalue pairs are either complex, or placed on the real and imaginary axes. Such an eigenvalue pair is the spectrum of the matrix product A1*inv(A2)*inv(A3), where A1, ..., A3 define the corresponding 2-by-2 matrix triplet. On exit, if INFO = -23, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. If JOB = 'E' and COMPQ = 'N' and COMPU = 'N', LDWORK >= 3/4*N**2+MAX(3*N, 27); else, LDWORK >= 3/2*N**2+MAX(3*N, 27). For good performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: problem during computation of the eigenvalues; = 2: periodic QZ algorithm did not converge in the SLICOT Library subroutine MB03BD; = 3: some eigenvalues might be inaccurate, and details can be found in IWORK and DWORK. This is a warning.Method
The algorithm uses Givens rotations and Householder reflections to annihilate elements in Z and T such that Z is in a special block triangular form and T is in skew-Hamiltonian Hessenberg form: ( Z11 Z12 ) ( B1 F1 ) Z = ( ), T = ( ), ( 0 Z22 ) ( 0 B1' ) with Z11 and Z22' upper triangular and B1 upper Hessenberg. Subsequently, the periodic QZ algorithm is applied to the pencil aZ22' Z11 - bB1 to determine orthogonal matrices Q1, Q2 and U such that U' Z11 Q1, Q2' Z22' U are upper triangular and Q2' B1 Q1 is upper quasi-triangular. See also page 35 in [1] for more details.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
NoneExample
Program Text
* MB04ED EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 60 ) INTEGER LDB, LDFG, LDQ, LDU1, LDU2, LDWORK, LDZ, $ LIWORK PARAMETER ( LDB = NMAX/2, LDFG = NMAX/2, $ LDQ = NMAX, LDU1 = NMAX/2, LDU2 = NMAX/2, $ LDWORK = 3*NMAX**2/2 + MAX( NMAX, 24 ) + 3, $ LDZ = NMAX, LIWORK = NMAX + 9 ) * * .. Local Scalars .. CHARACTER COMPQ, COMPU, JOB INTEGER I, INFO, J, N * * .. Local Arrays .. INTEGER IWORK( LIWORK ) DOUBLE PRECISION ALPHAI( NMAX/2 ), ALPHAR( NMAX/2 ), $ B( LDB, NMAX/2 ), BETA( NMAX/2 ), $ DWORK( LDWORK ), FG( LDFG, NMAX/2+1 ), $ Q( LDQ, NMAX ), U1( LDU1, NMAX/2 ), $ U2( LDU2, NMAX/2 ), Z( LDZ, NMAX ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB04ED * * .. Intrinsic Functions .. INTRINSIC MAX, MOD * * .. Executable statements .. * WRITE( NOUT, FMT = 99999 ) * * Skip first line in data file. * READ( NIN, FMT = * ) READ( NIN, FMT = * ) JOB, COMPQ, COMPU, N READ( NIN, FMT = * ) ( ( Z( I, J ), J = 1, N ), I = 1, N ) READ( NIN, FMT = * ) ( ( B( I, J ), J = 1, N/2 ), I = 1, N/2 ) READ( NIN, FMT = * ) ( ( FG( I, J ), J = 1, N/2+1 ), I = 1, N/2 ) IF( LSAME( COMPU, 'U' ) ) THEN READ( NIN, FMT = * ) ( ( U1( I, J ), J = 1, N/2 ), I = 1, N/2 ) READ( NIN, FMT = * ) ( ( U2( I, J ), J = 1, N/2 ), I = 1, N/2 ) END IF IF( N.LT.0 .OR. N.GT.NMAX .OR. MOD( N, 2 ).NE.0 ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE * * Test of MB04ED. * CALL MB04ED( JOB, COMPQ, COMPU, N, Z, LDZ, B, LDB, FG, LDFG, Q, $ LDQ, U1, LDU1, U2, LDU2, ALPHAR, ALPHAI, BETA, $ IWORK, LIWORK, DWORK, LDWORK, INFO ) IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Z(I,J), J = 1, N ) 10 CONTINUE WRITE( NOUT, FMT = 99994 ) DO 20 I = 1, N/2 WRITE( NOUT, FMT = 99995 ) ( B(I,J), J = 1, N/2 ) 20 CONTINUE WRITE( NOUT, FMT = 99993 ) DO 30 I = 1, N/2 WRITE( NOUT, FMT = 99995 ) ( FG(I,J), J = 1, N/2+1 ) 30 CONTINUE WRITE( NOUT, FMT = 99992 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAR(I), I = 1, N/2 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAI(I), I = 1, N/2 ) WRITE( NOUT, FMT = 99995 ) ( BETA(I), I = 1, N/2 ) WRITE( NOUT, FMT = 99991 ) DO 40 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q( I, J ), J = 1, N ) 40 CONTINUE IF ( .NOT.LSAME( COMPU, 'N' ) ) THEN WRITE( NOUT, FMT = 99990 ) DO 50 I = 1, N/2 WRITE( NOUT, FMT = 99995 ) ( U1( I, J ), J = 1, N/2 ) 50 CONTINUE WRITE( NOUT, FMT = 99989 ) DO 60 I = 1, N/2 WRITE( NOUT, FMT = 99995 ) ( U2( I, J ), J = 1, N/2 ) 60 CONTINUE END IF END IF END IF STOP 99999 FORMAT ( 'MB04ED EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT ( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT ( 'INFO on exit from MB04ED = ', I2 ) 99996 FORMAT (/' The transformed matrix Z is' ) 99995 FORMAT ( 60( 1X, F8.4 ) ) 99994 FORMAT (/' The transformed matrix B is' ) 99993 FORMAT (/' The transformed matrix FG is' ) 99992 FORMAT (/' The real, imaginary, and beta parts of eigenvalues are' $ ) 99991 FORMAT (/' The matrix Q is ' ) 99990 FORMAT (/' The upper left block of the matrix U is ' ) 99989 FORMAT (/' The upper right block of the matrix U is ' ) ENDProgram Data
MB04ED EXAMPLE PROGRAM DATA T I I 8 0.0949 3.3613 -4.7663 -0.5534 0.6408 -3.2793 3.4253 2.9654 0.1138 -1.5903 2.1837 -4.1648 -4.3775 -1.7454 0.1744 2.3262 2.7505 4.4048 4.4183 3.0478 2.7728 2.3048 -0.6451 -1.2045 3.6091 -4.1716 3.4461 3.6880 -0.0985 3.8458 0.2528 -1.3859 0.4352 -3.2829 3.7246 0.4794 -0.3690 -1.5562 -3.4817 -2.2902 1.3080 -3.9881 -3.5497 3.5020 2.2582 4.4764 -4.4080 -1.6818 1.1308 -1.5087 2.4730 2.1553 -1.7129 -4.8669 -2.4102 4.2274 4.7933 -4.3671 -0.0473 -2.0092 1.2439 -4.7385 3.4242 -0.2764 2.0936 1.5510 4.5974 2.5127 2.5469 -3.3739 -1.5961 -2.4490 -2.2397 -3.8100 0.8527 0.0596 1.7970 -0.0164 -2.7619 1.9908 1.0000 2.0000 -4.0500 1.3353 0.2899 -0.4318 2.0000 2.0000 -2.9860 -0.0160 1.0241 0.9469 2.0000 2.0000 1.3303 0.0946 -0.1272 -4.4003 2.0000 2.0000Program Results
MB04ED EXAMPLE PROGRAM RESULTS The transformed matrix Z is -2.5678 -2.9888 0.4304 -2.8719 2.7331 1.3072 1.7565 2.8246 0.0000 -3.8520 -6.0992 6.2935 -3.0386 -5.5317 -1.2189 3.9973 0.0000 0.0000 4.4560 4.4602 0.6080 -4.4326 3.7959 -0.6297 0.0000 0.0000 0.0000 7.0155 1.5557 2.1441 3.6649 -2.3864 0.4352 -3.2829 3.7246 0.4794 -5.3205 0.0000 0.0000 0.0000 1.3080 -3.9881 -3.5497 3.5020 2.2466 6.9633 0.0000 0.0000 1.1308 -1.5087 2.4730 2.1553 -1.7204 -0.8164 8.1468 0.0000 4.7933 -4.3671 -0.0473 -2.0092 -3.9547 0.2664 1.0382 5.5977 The transformed matrix B is 3.8629 -1.3266 0.1253 2.1882 0.0000 3.7258 -3.5913 -2.4583 0.0000 -3.6551 -2.5063 -0.8378 0.0000 0.0000 0.0000 -6.7384 The transformed matrix FG is 1.0000 2.0000 -0.7448 -1.2359 -1.3653 0.0158 2.0000 2.0000 3.4030 3.2344 -1.1665 2.5791 2.0000 2.0000 -0.4096 3.3823 -1.2344 3.9016 2.0000 2.0000 The real, imaginary, and beta parts of eigenvalues are 1.1310 -0.0697 -0.0697 -0.6864 0.0000 0.6035 -0.6035 0.0000 4.0000 4.0000 4.0000 4.0000 The matrix Q is -0.6042 -0.4139 -0.4742 0.1400 -0.2947 0.3462 -0.0980 0.0534 -0.3706 0.1367 0.4442 -0.1381 -0.1210 0.2913 0.7248 -0.0524 0.1325 -0.2735 -0.0515 -0.5084 -0.3163 -0.2855 0.1638 0.6619 0.2373 0.5514 -0.4988 0.3373 -0.3852 -0.0007 0.3329 0.1339 0.4777 -0.4517 0.2739 0.5172 -0.0775 0.3874 0.1088 0.2395 -0.0116 -0.4372 -0.1843 0.2474 0.1236 -0.6052 0.4772 -0.3228 0.1237 -0.0310 -0.4300 -0.2090 0.7209 0.3408 0.2898 0.1883 0.4245 -0.1871 -0.1803 -0.4655 -0.3304 0.2849 0.0623 -0.5843 The upper left block of the matrix U is 0.0154 -0.5058 -0.5272 0.6826 0.4829 -0.1519 -0.2921 -0.3491 0.4981 0.1532 0.1019 0.1810 -0.0188 0.6270 -0.5260 0.0587 The upper right block of the matrix U is 0.0000 0.0000 0.0000 0.0000 0.3179 -0.4312 -0.1802 -0.4659 0.5644 0.0873 0.4480 0.3979 -0.3137 -0.3330 0.3413 0.0239
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04FD.html 0000664 0000000 0000000 00000045266 14560147231 0020343 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of a real N-by-N skew-Hamiltonian/ skew-Hamiltonian pencil aS - bT with ( A D ) ( B F ) S = ( ) and T = ( ). (1) ( E A' ) ( G B' ) Optionally, if JOB = 'T', the pencil aS - bT will be transformed to the structured Schur form: an orthogonal transformation matrix Q is computed such that ( Aout Dout ) J Q' J' S Q = ( ), and ( 0 Aout' ) (2) ( Bout Fout ) ( 0 I ) J Q' J' T Q = ( ), where J = ( ), ( 0 Bout' ) ( -I 0 ) Aout is upper triangular, and Bout is upper quasi-triangular. The notation M' denotes the transpose of the matrix M. Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal transformation matrix Q will be computed.Specification
SUBROUTINE MB04FD( JOB, COMPQ, N, A, LDA, DE, LDDE, B, LDB, FG, $ LDFG, Q, LDQ, ALPHAR, ALPHAI, BETA, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, JOB INTEGER INFO, LDA, LDB, LDDE, LDFG, LDQ, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ), $ B( LDB, * ), BETA( * ), DE( LDDE, * ), $ DWORK( * ), FG( LDFG, * ), Q( LDQ, * ) INTEGER IWORK( * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; S and T will not necessarily be put into skew-Hamiltonian triangular form (2); = 'T': put S and T into skew-Hamiltonian triangular form (2), and return the eigenvalues in ALPHAR, ALPHAI and BETA. COMPQ CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q as follows: = 'N': Q is not computed; = 'I': the array Q is initialized internally to the unit matrix, and the orthogonal matrix Q is returned; = 'U': the array Q contains an orthogonal matrix Q0 on entry, and the product Q0*Q is returned, where Q is the product of the orthogonal transformations that are applied to the pencil aS - bT to reduce S and T to the forms in (2), for COMPQ = 'I'.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bT. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix A. On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix Aout; otherwise, it contains meaningless elements, except for the diagonal blocks, which are correctly set. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). DE (input/output) DOUBLE PRECISION array, dimension (LDDE, N/2+1) On entry, the leading N/2-by-N/2 strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix E, and the N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the strictly upper triangular part of the skew-symmetric matrix D. The entries on the diagonal and the first superdiagonal of this array are not referenced, but are assumed to be zero. On exit, if JOB = 'T', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix Dout. If JOB = 'E', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix D just before the application of the QZ algorithm. The remaining entries are meaningless. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N/2). B (input/output) DOUBLE PRECISION array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix Bout; otherwise, it contains meaningless elements, except for the diagonal 1-by-1 and 2-by-2 blocks, which are correctly set. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). FG (input/output) DOUBLE PRECISION array, dimension (LDFG, N/2+1) On entry, the leading N/2-by-N/2 strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix G, and the N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the strictly upper triangular part of the skew-symmetric matrix F. The entries on the diagonal and the first superdiagonal of this array are not referenced, but are assumed to be zero. On exit, if JOB = 'T', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix Fout. If JOB = 'E', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix F just before the application of the QZ algorithm. The remaining entries are meaningless. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, N/2). Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N) On entry, if COMPQ = 'U', then the leading N-by-N part of this array must contain a given matrix Q0, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q0 and the transformation matrix Q used to transform the matrices S and T. On exit, if COMPQ = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q. If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, N), if COMPQ = 'I' or COMPQ = 'U'. ALPHAR (output) DOUBLE PRECISION array, dimension (N/2) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bT. ALPHAI (output) DOUBLE PRECISION array, dimension (N/2) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bT. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair. BETA (output) DOUBLE PRECISION array, dimension (N/2) The scalars beta that define the eigenvalues of the pencil aS - bT. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bT, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed. Due to the skew-Hamiltonian/skew-Hamiltonian structure of the pencil, every eigenvalue occurs twice and thus it has only to be saved once in ALPHAR, ALPHAI and BETA.Workspace
IWORK INTEGER array, dimension (N/2+1) On exit, IWORK(1) contains the number of (pairs of) possibly inaccurate eigenvalues, q <= N/2, and the nonzero absolute values in IWORK(2), ..., IWORK(N/2+1) are indices of the possibly inaccurate eigenvalues, as well as of the corresponding 1-by-1 or 2-by-2 diagonal blocks in the arrays A and B on exit. The 2-by-2 blocks correspond to negative values in IWORK. One negative value is stored for each such eigenvalue pair. Its modulus indicates the starting index of a 2-by-2 block. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK; DWORK(2) and DWORK(3) contain the Frobenius norms of the matrices S and T on entry. These norms are used in the tests to decide that some eigenvalues are considered as unreliable. On exit, if INFO = -19, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX(3,N/2), if JOB = 'E' and COMPQ = 'N'; LDWORK >= MAX(3,N**2/4+N/2), if JOB = 'T' and COMPQ = 'N'; LDWORK >= MAX(1,3*N**2/4), if COMPQ<> 'N'. For good performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: QZ iteration failed in the LAPACK Library routine DHGEQZ. (QZ iteration did not converge or computation of the shifts failed.) = 2: warning: the pencil is numerically singular.Method
The algorithm uses Givens rotations and Householder reflections to annihilate elements in S and T such that S is in skew-Hamiltonian triangular form and T is in skew-Hamiltonian Hessenberg form: ( A1 D1 ) ( B1 F1 ) S = ( ), T = ( ), ( 0 A1' ) ( 0 B1' ) where A1 is upper triangular and B1 is upper Hessenberg. Subsequently, the QZ algorithm is applied to the pencil aA1 - bB1 to determine orthogonal matrices Q1 and Q2 such that Q2' A1 Q1 is upper triangular and Q2' B1 Q1 is upper quasi- triangular. See also page 40 in [1] for more details.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
NoneExample
Program Text
* MB04FD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 50 ) INTEGER LDA, LDB, LDDE, LDFG, LDQ, LDWORK PARAMETER ( LDA = NMAX/2, LDB = NMAX/2, LDDE = NMAX/2, $ LDFG = NMAX/2, LDQ = NMAX, LDWORK = $ 3*NMAX*NMAX/4 ) * * .. Local Scalars .. CHARACTER COMPQ, JOB INTEGER I, INFO, J, N * * .. Local Arrays .. DOUBLE PRECISION A( LDA, NMAX/2 ), ALPHAI( NMAX/2 ), $ ALPHAR( NMAX/2 ), B( LDB, NMAX/2 ), $ BETA( NMAX/2 ), DE( LDDE, NMAX/2+1 ), $ DWORK( LDWORK ), FG( LDFG, NMAX/2+1 ), $ Q( LDQ, NMAX ) INTEGER IWORK( NMAX/2+1 ) * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * * .. External Subroutines .. EXTERNAL MB04FD * * .. Intrinsic Functions .. INTRINSIC MOD * * .. Executable statements .. * WRITE( NOUT, FMT = 99999 ) * * Skip first line in data file. * READ( NIN, FMT = * ) READ( NIN, FMT = * ) JOB, COMPQ, N READ( NIN, FMT = * ) ( ( A( I, J ), J = 1, N/2 ), I = 1, N/2 ) READ( NIN, FMT = * ) ( ( DE( I, J ), J = 1, N/2+1 ), I = 1, N/2 ) READ( NIN, FMT = * ) ( ( B( I, J ), J = 1, N/2 ), I = 1, N/2 ) READ( NIN, FMT = * ) ( ( FG( I, J ), J = 1, N/2+1 ), I = 1, N/2 ) IF( LSAME( COMPQ, 'U' ) ) $ READ( NIN, FMT = * ) ( ( Q( I, J ), J = 1, N ), I = 1, N ) IF( N.LT.0 .OR. N.GT.NMAX .OR. MOD( N, 2 ).NE.0 ) THEN WRITE( NOUT, FMT = 99998 ) N ELSE * * Test of MB04FD. * CALL MB04FD( JOB, COMPQ, N, A, LDA, DE, LDDE, B, LDB, FG, LDFG, $ Q, LDQ, ALPHAR, ALPHAI, BETA, IWORK, DWORK, $ LDWORK, INFO ) IF( INFO.NE.0 ) THEN WRITE( NOUT, FMT = 99997 ) INFO ELSE IF( LSAME( JOB, 'T' ) ) THEN WRITE( NOUT, FMT = 99996 ) DO 10 I = 1, N/2 WRITE( NOUT, FMT = 99995 ) ( A( I, J ), J = 1, N/2 ) 10 CONTINUE END IF WRITE( NOUT, FMT = 99994 ) DO 20 I = 1, N/2 WRITE( NOUT, FMT = 99995 ) ( DE( I, J ), J = 1, N/2+1 ) 20 CONTINUE IF( LSAME( JOB, 'T' ) ) THEN WRITE( NOUT, FMT = 99993 ) DO 30 I = 1, N/2 WRITE( NOUT, FMT = 99995 ) ( B( I, J ), J = 1, N/2 ) 30 CONTINUE END IF WRITE( NOUT, FMT = 99992 ) DO 40 I = 1, N/2 WRITE( NOUT, FMT = 99995 ) ( FG( I, J ), J = 1, N/2+1 ) 40 CONTINUE IF( .NOT.LSAME( COMPQ, 'N' ) ) THEN WRITE( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE( NOUT, FMT = 99995 ) ( Q( I, J ), J = 1, N ) 50 CONTINUE END IF WRITE( NOUT, FMT = 99990 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAR(I), I = 1, N/2 ) WRITE( NOUT, FMT = 99995 ) ( ALPHAI(I), I = 1, N/2 ) WRITE( NOUT, FMT = 99995 ) ( BETA(I), I = 1, N/2 ) END IF END IF STOP 99999 FORMAT ( 'MB04FD EXAMPLE PROGRAM RESULTS', 1X ) 99998 FORMAT ( 'N is out of range.', /, 'N = ', I5 ) 99997 FORMAT ( 'INFO on exit from MB04FD = ', I2 ) 99996 FORMAT (/' The transformed matrix A is' ) 99995 FORMAT ( 51( 1X, F8.4 ) ) 99994 FORMAT (/' The transformed matrix DE is' ) 99993 FORMAT (/' The transformed matrix B is' ) 99992 FORMAT (/' The transformed matrix FG is' ) 99991 FORMAT (/' The transformed matrix Q is ' ) 99990 FORMAT (/' The real, imaginary, and beta parts of eigenvalues are' $ ) ENDProgram Data
MB04FD EXAMPLE PROGRAM DATA T I 8 0.8147 0.6323 0.9575 0.9571 0.9057 0.0975 0.9648 0.4853 0.1269 0.2784 0.1576 0.8002 0.9133 0.5468 0.9705 0.1418 0.4217 0.6557 0.6787 0.6554 0.2769 0.9157 0.0357 0.7577 0.1711 0.0461 0.7922 0.8491 0.7431 0.7060 0.0971 0.9594 0.9339 0.3922 0.0318 0.8234 0.6948 0.4387 0.1868 0.7093 0.3170 0.3815 0.4897 0.7546 0.9502 0.7655 0.4455 0.2760 0.0344 0.7951 0.6463 0.6797 0.6550 0.9597 0.7512 0.8909 0.1492 0.1626 0.3403 0.2550 0.9592 0.2575 0.1189 0.5852 0.5059 0.5472 0.8407 0.4983 0.2238 0.6990 0.1386 0.2542Program Results
MB04FD EXAMPLE PROGRAM RESULTS The transformed matrix A is 0.0550 -0.3064 0.1543 0.2170 0.0000 1.2189 0.3267 -1.3622 0.0000 0.0000 0.7734 -0.6215 0.0000 0.0000 0.0000 2.5172 The transformed matrix DE is 0.4217 0.6557 0.4277 -0.2877 -0.3980 -1.5448 0.0357 0.7577 -0.2582 -0.4775 0.3220 1.1004 0.7431 0.7060 -1.1102 0.3899 0.3463 0.4843 0.0318 0.8234 The transformed matrix B is 0.8482 -0.4425 -0.3643 0.8333 0.0000 -0.5919 -0.0987 -0.7923 0.0000 0.0000 1.1021 0.1926 0.0000 0.0000 0.0000 1.9788 The transformed matrix FG is 0.6550 0.9597 0.3266 -0.6059 -0.9618 -0.3151 0.3403 0.2550 -0.4771 -0.3005 0.1987 -0.0141 0.5059 0.5472 -0.4172 0.7914 0.0371 0.0000 0.1386 0.2542 The transformed matrix Q is 0.0762 0.7824 -0.2771 -0.5526 0.0000 0.0000 0.0000 0.0000 0.1786 -0.2450 0.4261 -0.5360 0.1843 -0.5857 0.2437 -0.0522 -0.2452 0.1425 0.4831 -0.0742 -0.1834 -0.0856 -0.6529 0.4620 -0.2123 -0.3870 -0.6431 -0.2548 0.3061 -0.1791 -0.2518 0.3707 -0.4085 0.0154 0.0784 -0.0738 0.3908 0.0160 -0.3950 -0.7157 0.6418 -0.2868 0.0258 -0.3305 -0.0286 0.4768 -0.3901 -0.1253 -0.0077 -0.1340 -0.2740 -0.0534 -0.7708 -0.3910 -0.1981 -0.3432 -0.5275 -0.2394 0.1131 -0.4684 -0.3018 0.4869 0.3216 0.0252 The real, imaginary, and beta parts of eigenvalues are 0.8482 -0.5919 1.1021 1.9788 0.0000 0.0000 0.0000 0.0000 0.0550 1.2189 0.7734 2.5172
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04FP.html 0000664 0000000 0000000 00000031527 14560147231 0020352 0 ustar 00root root 0000000 0000000
Purpose
To compute the eigenvalues of a real N-by-N skew-Hamiltonian/ skew-Hamiltonian pencil aS - bT with ( A D ) ( B F ) S = ( ) and T = ( ). (1) ( E A' ) ( G B' ) Optionally, if JOB = 'T', the pencil aS - bT will be transformed to the structured Schur form: an orthogonal transformation matrix Q is computed such that ( Aout Dout ) J Q' J' S Q = ( ), and ( 0 Aout' ) (2) ( Bout Fout ) ( 0 I ) J Q' J' T Q = ( ), where J = ( ), ( 0 Bout' ) ( -I 0 ) Aout is upper triangular, and Bout is upper quasi-triangular. The notation M' denotes the transpose of the matrix M. Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal transformation matrix Q will be computed.Specification
SUBROUTINE MB04FP( JOB, COMPQ, N, A, LDA, DE, LDDE, B, LDB, FG, $ LDFG, Q, LDQ, ALPHAR, ALPHAI, BETA, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, JOB INTEGER INFO, LDA, LDB, LDDE, LDFG, LDQ, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ), $ B( LDB, * ), BETA( * ), DE( LDDE, * ), $ DWORK( * ), FG( LDFG, * ), Q( LDQ, * ) INTEGER IWORK( * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'E': compute the eigenvalues only; S and T will not necessarily be put into skew-Hamiltonian triangular form (2); = 'T': put S and T into skew-Hamiltonian triangular form (2), and return the eigenvalues in ALPHAR, ALPHAI and BETA. COMPQ CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q as follows: = 'N': Q is not computed; = 'I': the array Q is initialized internally to the unit matrix, and the orthogonal matrix Q is returned; = 'U': the array Q contains an orthogonal matrix Q0 on entry, and the product Q0*Q is returned, where Q is the product of the orthogonal transformations that are applied to the pencil aS - bT to reduce S and T to the forms in (2), for COMPQ = 'I'.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bT. N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix A. On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix Aout; otherwise, it contains meaningless elements, except for the diagonal blocks, which are correctly set. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). DE (input/output) DOUBLE PRECISION array, dimension (LDDE, N/2+1) On entry, the leading N/2-by-N/2 strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix E, and the N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the strictly upper triangular part of the skew-symmetric matrix D. The entries on the diagonal and the first superdiagonal of this array are not referenced, but are assumed to be zero. On exit, if JOB = 'T', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix Dout. If JOB = 'E', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix D just before the application of the QZ algorithm. The remaining entries are meaningless. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N/2). B (input/output) DOUBLE PRECISION array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if JOB = 'T', the leading N/2-by-N/2 part of this array contains the matrix Bout; otherwise, it contains meaningless elements, except for the diagonal 1-by-1 and 2-by-2 blocks, which are correctly set. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). FG (input/output) DOUBLE PRECISION array, dimension (LDFG, N/2+1) On entry, the leading N/2-by-N/2 strictly lower triangular part of this array must contain the strictly lower triangular part of the skew-symmetric matrix G, and the N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the strictly upper triangular part of the skew-symmetric matrix F. The entries on the diagonal and the first superdiagonal of this array are not referenced, but are assumed to be zero. On exit, if JOB = 'T', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix Fout. If JOB = 'E', the leading N/2-by-N/2 strictly upper triangular part of the submatrix in the columns 2 to N/2+1 of this array contains the strictly upper triangular part of the skew-symmetric matrix F just before the application of the QZ algorithm. The remaining entries are meaningless. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, N/2). Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N) On entry, if COMPQ = 'U', then the leading N-by-N part of this array must contain a given matrix Q0, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q0 and the transformation matrix Q used to transform the matrices S and T. On exit, if COMPQ = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q. If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, N), if COMPQ = 'I' or COMPQ = 'U'. ALPHAR (output) DOUBLE PRECISION array, dimension (N/2) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bT. ALPHAI (output) DOUBLE PRECISION array, dimension (N/2) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bT. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair. BETA (output) DOUBLE PRECISION array, dimension (N/2) The scalars beta that define the eigenvalues of the pencil aS - bT. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bT, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed. Due to the skew-Hamiltonian/skew-Hamiltonian structure of the pencil, every eigenvalue occurs twice and thus it has only to be saved once in ALPHAR, ALPHAI and BETA.Workspace
IWORK INTEGER array, dimension (N/2+1) On exit, IWORK(1) contains the number of (pairs of) possibly inaccurate eigenvalues, q <= N/2, and the nonzero absolute values in IWORK(2), ..., IWORK(N/2+1) are indices of the possibly inaccurate eigenvalues, as well as of the corresponding 1-by-1 or 2-by-2 diagonal blocks in the arrays A and B on exit. The 2-by-2 blocks correspond to negative values in IWORK. One negative value is stored for each such eigenvalue pair. Its modulus indicates the starting index of a 2-by-2 block. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK; DWORK(2) and DWORK(3) contain the Frobenius norms of the matrices S and T on entry. These norms are used in the tests to decide that some eigenvalues are considered as unreliable. On exit, if INFO = -19, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX(3,N/2,2*N-6), if JOB = 'E' and COMPQ = 'N'; LDWORK >= MAX(3,N**2/4+N/2), if JOB = 'T' and COMPQ = 'N'; LDWORK >= MAX(1,3*N**2/4), if COMPQ<> 'N'. For good performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: QZ iteration failed in the LAPACK Library routine DHGEQZ. (QZ iteration did not converge or computation of the shifts failed.) = 2: warning: the pencil is numerically singular.Method
The algorithm uses Givens rotations and Householder reflections to annihilate elements in S and T such that S is in skew-Hamiltonian triangular form and T is in skew-Hamiltonian Hessenberg form: ( A1 D1 ) ( B1 F1 ) S = ( ), T = ( ), ( 0 A1' ) ( 0 B1' ) where A1 is upper triangular and B1 is upper Hessenberg. Subsequently, the QZ algorithm is applied to the pencil aA1 - bB1 to determine orthogonal matrices Q1 and Q2 such that Q2' A1 Q1 is upper triangular and Q2' B1 Q1 is upper quasi- triangular. See also page 40 in [1] for more details.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
For large values of N, the routine applies the transformations for reducing T on panels of columns. The user may specify in INFO the desired number of columns. If on entry INFO <= 0, then the routine estimates a suitable value of this number.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04GD.html 0000664 0000000 0000000 00000015715 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
To compute an RQ factorization with row pivoting of a real m-by-n matrix A: P*A = R*Q.Specification
SUBROUTINE MB04GD( M, N, A, LDA, JPVT, TAU, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, M, N C .. Array Arguments .. INTEGER JPVT( * ) DOUBLE PRECISION A( LDA, * ), DWORK( * ), TAU( * )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the m-by-n matrix A. On exit, if m <= n, the upper triangle of the subarray A(1:m,n-m+1:n) contains the m-by-m upper triangular matrix R; if m >= n, the elements on and above the (m-n)-th subdiagonal contain the m-by-n upper trapezoidal matrix R; the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see METHOD). LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). JPVT (input/output) INTEGER array, dimension (M) On entry, if JPVT(i) .ne. 0, the i-th row of A is permuted to the bottom of P*A (a trailing row); if JPVT(i) = 0, the i-th row of A is a free row. On exit, if JPVT(i) = k, then the i-th row of P*A was the k-th row of A. TAU (output) DOUBLE PRECISION array, dimension (min(M,N)) The scalar factors of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension (3*M)Error Indicator
INFO INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n). Each H(i) has the form H = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(n-k+i+1:n) = 0 and v(n-k+i) = 1; v(1:n-k+i-1) is stored on exit in A(m-k+i,1:n-k+i-1), and tau in TAU(i). The matrix P is represented in jpvt as follows: If jpvt(j) = i then the jth row of P is the ith canonical unit vector.References
[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.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
* MB04GD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 10, MMAX = 10 ) INTEGER LDA PARAMETER ( LDA = MMAX ) INTEGER LDTAU PARAMETER ( LDTAU = MIN(MMAX,NMAX) ) INTEGER LDWORK PARAMETER ( LDWORK = 3*MMAX ) * .. Local Scalars .. INTEGER I, INFO, J, M, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), TAU(LDTAU) INTEGER JPVT(MMAX) * .. External Subroutines .. EXTERNAL DLASET, MB04GD * .. Intrinsic Functions .. INTRINSIC MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99972 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99971 ) M ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,M ) READ ( NIN, FMT = * ) ( JPVT(I), I = 1,M ) * RQ with row pivoting. CALL MB04GD( M, N, A, LDA, JPVT, TAU, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) ( JPVT(I), I = 1,M ) WRITE ( NOUT, FMT = 99990 ) IF ( M.GE.N ) THEN IF ( N.GT.1 ) $ CALL DLASET( 'Lower', N-1, N-1, ZERO, ZERO, $ A(M-N+2,1), LDA ) ELSE CALL DLASET( 'Full', M, N-M-1, ZERO, ZERO, A, LDA ) CALL DLASET( 'Lower', M, M, ZERO, ZERO, A(1,N-M), $ LDA ) END IF DO 20 I = 1, M WRITE ( NOUT, FMT = 99989 ) ( A(I,J), J = 1,N ) 20 CONTINUE END IF END IF END IF * STOP * 99999 FORMAT (' MB04GD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04GD = ',I2) 99994 FORMAT (' Row permutations are ',/(20(I3,2X))) 99990 FORMAT (/' The matrix A is ') 99989 FORMAT (20(1X,F8.4)) 99972 FORMAT (/' N is out of range.',/' N = ',I5) 99971 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
MB04GD EXAMPLE PROGRAM DATA 6 5 1. 2. 6. 3. 5. -2. -1. -1. 0. -2. 5. 5. 1. 5. 1. -2. -1. -1. 0. -2. 4. 8. 4. 20. 4. -2. -1. -1. 0. -2. 0 0 0 0 0 0Program Results
MB04GD EXAMPLE PROGRAM RESULTS Row permutations are 2 4 6 3 1 5 The matrix A is 0.0000 -1.0517 -1.8646 -1.9712 1.2374 0.0000 -1.0517 -1.8646 -1.9712 1.2374 0.0000 -1.0517 -1.8646 -1.9712 1.2374 0.0000 0.0000 4.6768 0.0466 -7.4246 0.0000 0.0000 0.0000 6.7059 -5.4801 0.0000 0.0000 0.0000 0.0000 -22.6274
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04HD.html 0000664 0000000 0000000 00000026433 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
To compute the transformed matrices A and B, using orthogonal matrices Q1 and Q2 for a real N-by-N regular pencil ( A11 0 ) ( 0 B12 ) aA - bB = a ( ) - b ( ), (1) ( 0 A22 ) ( B21 0 ) where A11, A22 and B12 are upper triangular, B21 is upper quasi-triangular and the generalized matrix product -1 -1 A11 B12 A22 B21 is in periodic Schur form, such that the matrix Q2' A Q1 is upper triangular, Q2' B Q1 is upper quasi-triangular and the transformed pencil a(Q2' A Q1) - b(Q2' B Q1) is in generalized Schur form. The notation M' denotes the transpose of the matrix M.Specification
SUBROUTINE MB04HD( COMPQ1, COMPQ2, N, A, LDA, B, LDB, Q1, LDQ1, $ Q2, LDQ2, IWORK, LIWORK, DWORK, LDWORK, BWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER COMPQ1, COMPQ2 INTEGER INFO, LDA, LDB, LDQ1, LDQ2, LDWORK, LIWORK, N C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), $ Q1( LDQ1, * ), Q2( LDQ2, * )Arguments
Mode Parameters
COMPQ1 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q1, as follows: = 'N': Q1 is not computed; = 'I': the array Q1 is initialized internally to the unit matrix, and the orthogonal matrix Q1 is returned; = 'U': the array Q1 contains an orthogonal matrix Q01 on entry, and the matrix Q01*Q1 is returned, where Q1 is the product of the orthogonal transformations that are applied on the right to the pencil aA - bB in (1). COMPQ2 CHARACTER*1 Specifies whether to compute the orthogonal transformation matrix Q2, as follows: = 'N': Q2 is not computed; = 'I': the array Q2 is initialized internally to the unit matrix, and the orthogonal matrix Q2 is returned; = 'U': the array Q2 contains an orthogonal matrix Q02 on entry, and the matrix Q02*Q2 is returned, where Q2 is the product of the orthogonal transformations that are applied on the left to the pencil aA - bB in (1).Input/Output Parameters
N (input) INTEGER Order of the pencil aA - bB, N >= 0, even. A (input/output) DOUBLE PRECISION array, dimension (LDA, N) On entry, the leading N-by-N block diagonal part of this array must contain the matrix A in (1). The off-diagonal blocks need not be set to zero. On exit, the leading N-by-N part of this array contains the transformed upper triangular matrix. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N). B (input/output) DOUBLE PRECISION array, dimension (LDB, N) On entry, the leading N-by-N block anti-diagonal part of this array must contain the matrix B in (1). The diagonal blocks need not be set to zero. On exit, the leading N-by-N part of this array contains the transformed upper quasi-triangular matrix. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N). Q1 (input/output) DOUBLE PRECISION array, dimension (LDQ1, N) On entry, if COMPQ1 = 'U', then the leading N-by-N part of this array must contain a given matrix Q01, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q01 and the transformation matrix Q1 used to transform the matrices A and B. On exit, if COMPQ1 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q1. If COMPQ1 = 'N' this array is not referenced. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= 1, if COMPQ1 = 'N'; LDQ1 >= MAX(1, N), if COMPQ1 = 'I' or COMPQ1 = 'U'. Q2 (input/output) DOUBLE PRECISION array, dimension (LDQ2, N) On entry, if COMPQ2 = 'U', then the leading N-by-N part of this array must contain a given matrix Q02, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q02 and the transformation matrix Q2 used to transform the matrices A and B. On exit, if COMPQ2 = 'I', then the leading N-by-N part of this array contains the orthogonal transformation matrix Q2. If COMPQ2 = 'N' this array is not referenced. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= 1, if COMPQ2 = 'N'; LDQ2 >= MAX(1, N), if COMPQ2 = 'I' or COMPQ2 = 'U'.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER The dimension of the array IWORK. LIWORK >= MAX( N/2+1, 32 ). DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. On exit, if INFO = -16, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 2*N*N + MAX( N/2 + 168, 272 ). For good performance LDWORK should be generally larger. If LDWORK = -1 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 is issued by XERBLA. BWORK LOGICAL array, dimension (N/2)Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the periodic QZ algorithm failed to reorder the eigenvalues (the problem is very ill-conditioned) in the SLICOT Library routine MB03KD; = 2: the standard QZ algorithm failed in the LAPACK routines DGGES or DHGEQZ, called by the SLICOT routines MB03DD or MB03FD; = 3: the eigenvalue reordering failed in the LAPACK routine DTGEX2, called by the SLICOT routine MB03FD; = 4: the standard QZ algorithm failed to reorder the eigenvalues in the LAPACK routine DTGSEN, called by the SLICOT routine MB03DD.Method
First, the periodic QZ algorithm (see also [2] and [3]) is applied -1 -1 to the formal matrix product A11 B12 A22 B21 to reorder the eigenvalues, i.e., orthogonal matrices V1, V2, V3 and V4 are computed such that V2' A11 V1, V2' B12 V3, V4' A22 V3 and V4' B21 V1 keep the triangular form, but they can be partitioned into 2-by-2 block forms and the last diagonal blocks correspond to all nonpositive real eigenvalues of the formal product, and the first diagonal blocks correspond to the remaining eigenvalues. Second, Q1 = diag(V1, V3), Q2 = diag(V2, V4) and ( AA11 AA12 0 0 ) ( ) ( 0 AA22 0 0 ) A := Q2' A Q1 =: ( ), ( 0 0 AA33 AA34 ) ( ) ( 0 0 0 AA44 ) ( 0 0 BB13 BB14 ) ( ) ( 0 0 0 BB24 ) B := Q2' B Q1 =: ( ), ( BB31 BB32 0 0 ) ( ) ( 0 BB42 0 0 ) -1 -1 are set, such that AA22 BB24 AA44 BB42 has only nonpositive real eigenvalues. Third, the permutation matrix ( I 0 0 0 ) ( ) ( 0 0 I 0 ) P = ( ), ( 0 I 0 0 ) ( ) ( 0 0 0 I ) where I denotes the identity matrix of appropriate size, is used to transform aA - bB to block upper triangular form ( AA11 0 | AA12 0 ) ( | ) ( 0 AA33 | 0 AA34 ) ( AA1 * ) A := P' A P = (-----------+-----------) = ( ), ( 0 0 | AA22 0 ) ( 0 AA2 ) ( | ) ( 0 0 | 0 AA44 ) ( 0 BB13 | 0 BB14 ) ( | ) ( BB31 0 | BB32 0 ) ( BB1 * ) B := P' B P = (-----------+-----------) = ( ). ( 0 0 | 0 BB24 ) ( 0 BB2 ) ( | ) ( 0 0 | BB42 0 ) Then, further orthogonal transformations that are provided by MB03FD and MB03DD are used to triangularize the subpencil aAA1 - bBB1. Finally, the subpencil aAA2 - bBB2 is triangularized by applying a special permutation matrix. See also page 31 in [1] for more details.References
[1] Benner, P., Byers, R., Losse, P., Mehrmann, V. and Xu, H. Numerical Solution of Real Skew-Hamiltonian/Hamiltonian Eigenproblems. Tech. Rep., Technical University Chemnitz, Germany, Nov. 2007. [2] Bojanczyk, A., Golub, G. H. and Van Dooren, P. The periodic Schur decomposition: algorithms and applications. In F.T. Luk (editor), Advanced Signal Processing Algorithms, Architectures, and Implementations III, Proc. SPIE Conference, vol. 1770, pp. 31-42, 1992. [3] Hench, J. J. and Laub, A. J. Numerical Solution of the discrete-time periodic Riccati equation. IEEE Trans. Automat. Control, 39, 1197-1210, 1994.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) real floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a QR factorization of an n-by-m matrix A (A = Q * R), having a p-by-min(p,m) zero triangle in the lower left-hand side corner, as shown below, for n = 8, m = 7, and p = 2: [ x x x x x x x ] [ x x x x x x x ] [ x x x x x x x ] [ x x x x x x x ] A = [ x x x x x x x ], [ x x x x x x x ] [ 0 x x x x x x ] [ 0 0 x x x x x ] and optionally apply the transformations to an n-by-l matrix B (from the left). The problem structure is exploited. This computation is useful, for instance, in combined measurement and time update of one iteration of the time-invariant Kalman filter (square root information filter).Specification
SUBROUTINE MB04ID( N, M, P, L, A, LDA, B, LDB, TAU, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDA, LDB, LDWORK, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), TAU(*)Arguments
Input/Output Parameters
N (input) INTEGER The number of rows of the matrix A. N >= 0. M (input) INTEGER The number of columns of the matrix A. M >= 0. P (input) INTEGER The order of the zero triagle. P >= 0. L (input) INTEGER The number of columns of the matrix B. L >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,M) On entry, the leading N-by-M part of this array must contain the matrix A. The elements corresponding to the zero P-by-MIN(P,M) lower trapezoidal/triangular part (if P > 0) are not referenced. On exit, the elements on and above the diagonal of this array contain the MIN(N,M)-by-M upper trapezoidal matrix R (R is upper triangular, if N >= M) of the QR factorization, and the relevant elements below the diagonal contain the trailing components (the vectors v, see Method) of the elementary reflectors used in the factorization. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,L) On entry, the leading N-by-L part of this array must contain the matrix B. On exit, the leading N-by-L part of this array contains the updated matrix B. If L = 0, this array is not referenced. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N) if L > 0; LDB >= 1 if L = 0. TAU (output) DOUBLE PRECISION array, dimension MIN(N,M) The scalar factors of the elementary reflectors used.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK The length of the array DWORK. LDWORK >= MAX(1,M-1,M-P,L). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine uses min(N,M) Householder transformations exploiting the zero pattern of the matrix. A Householder matrix has the form ( 1 ), H = I - tau *u *u', u = ( v ) i i i i i ( i) where v is an (N-P+I-2)-vector. The components of v are stored i i in the i-th column of A, beginning from the location i+1, and tau is stored in TAU(i). iNumerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04IY.html 0000664 0000000 0000000 00000012121 14560147231 0020353 0 ustar 00root root 0000000 0000000
Purpose
To overwrite the real n-by-m matrix C with Q' * C, Q * C, C * Q', or C * Q, according to the following table SIDE = 'L' SIDE = 'R' TRANS = 'N': Q * C C * Q TRANS = 'T': Q'* C C * Q' where Q is a real orthogonal matrix defined as the product of k elementary reflectors Q = H(1) H(2) . . . H(k) as returned by SLICOT Library routine MB04ID. Q is of order n if SIDE = 'L' and of order m if SIDE = 'R'.Specification
SUBROUTINE MB04IY( SIDE, TRANS, N, M, K, P, A, LDA, TAU, C, LDC, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, K, LDA, LDC, LDWORK, M, N, P CHARACTER SIDE, TRANS C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * ), TAU( * )Arguments
Mode Parameters
SIDE CHARACTER*1 Specify if Q or Q' is applied from the left or right, as follows: = 'L': apply Q or Q' from the left; = 'R': apply Q or Q' from the right. TRANS CHARACTER*1 Specify if Q or Q' is to be applied, as follows: = 'N': apply Q (No transpose); = 'T': apply Q' (Transpose).Input/Output Parameters
N (input) INTEGER The number of rows of the matrix C. N >= 0. M (input) INTEGER The number of columns of the matrix C. M >= 0. K (input) INTEGER The number of elementary reflectors whose product defines the matrix Q. N >= K >= 0, if SIDE = 'L'; M >= K >= 0, if SIDE = 'R'. P (input) INTEGER The order of the zero triagle (or the number of rows of the zero trapezoid) in the matrix triangularized by SLICOT Library routine MB04ID. P >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,K) On input, the elements in the rows i+1:min(n,n-p-1+i) of the i-th column, and TAU(i), represent the orthogonal reflector H(i), so that matrix Q is the product of elementary reflectors: Q = H(1) H(2) . . . H(k). A is modified by the routine but restored on exit. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N), if SIDE = 'L'; LDA >= max(1,M), if SIDE = 'R'. TAU (input) DOUBLE PRECISION array, dimension (K) The scalar factors of the elementary reflectors. C (input/output) DOUBLE PRECISION array, dimension (LDC,M) On entry, the leading N-by-M part of this array must contain the matrix C. On exit, the leading N-by-M part of this array contains the updated matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,M), if SIDE = 'L'; LDWORK >= MAX(1,N), if SIDE = 'R'. For optimum performance LDWORK >= M*NB if SIDE = 'L', or LDWORK >= N*NB if SIDE = 'R', where NB is the optimal block size.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
If SIDE = 'L', each elementary reflector H(i) modifies n-p elements of each column of C, for i = 1:p+1, and n-i+1 elements, for i = p+2:k. If SIDE = 'R', each elementary reflector H(i) modifies m-p elements of each row of C, for i = 1:p+1, and m-i+1 elements, for i = p+2:k.Numerical Aspects
The implemented method is numerically stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a QR factorization of an n-by-m matrix A (A = Q * R), having a p-by-min(p,m) zero triangle in the lower left-hand side corner, as shown below, for n = 8, m = 7, and p = 2: [ x x x x x x x ] [ x x x x x x x ] [ x x x x x x x ] [ x x x x x x x ] A = [ x x x x x x x ], [ x x x x x x x ] [ 0 x x x x x x ] [ 0 0 x x x x x ] and optionally apply the transformations to an n-by-l matrix B (from the left). The problem structure is exploited. This computation is useful, for instance, in combined measurement and time update of one iteration of the time-invariant Kalman filter (square root information filter).Specification
SUBROUTINE MB04IZ( N, M, P, L, A, LDA, B, LDB, TAU, ZWORK, LZWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDA, LDB, LZWORK, M, N, P C .. Array Arguments .. COMPLEX*16 A(LDA,*), B(LDB,*), TAU(*), ZWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The number of rows of the matrix A. N >= 0. M (input) INTEGER The number of columns of the matrix A. M >= 0. P (input) INTEGER The order of the zero triagle. P >= 0. L (input) INTEGER The number of columns of the matrix B. L >= 0. A (input/output) COMPLEX*16 array, dimension (LDA,M) On entry, the leading N-by-M part of this array must contain the matrix A. The elements corresponding to the zero P-by-MIN(P,M) lower trapezoidal/triangular part (if P > 0) are not referenced. On exit, the elements on and above the diagonal of this array contain the MIN(N,M)-by-M upper trapezoidal matrix R (R is upper triangular, if N >= M) of the QR factorization, and the relevant elements below the diagonal contain the trailing components (the vectors v, see Method) of the elementary reflectors used in the factorization. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) COMPLEX*16 array, dimension (LDB,L) On entry, the leading N-by-L part of this array must contain the matrix B. On exit, the leading N-by-L part of this array contains the updated matrix B. If L = 0, this array is not referenced. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N) if L > 0; LDB >= 1 if L = 0. TAU (output) COMPLEX*16 array, dimension MIN(N,M) The scalar factors of the elementary reflectors used.Workspace
ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. LZWORK The length of the array ZWORK. LZWORK >= MAX(1,M-1,M-P,L). For optimum performance LZWORK should be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine uses min(N,M) Householder transformations exploiting the zero pattern of the matrix. A Householder matrix has the form ( 1 ), H = I - tau *u *u', u = ( v ) i i i i i ( i) where v is an (N-P+I-2)-vector. The components of v are stored i i in the i-th column of A, beginning from the location i+1, and tau is stored in TAU(i). iNumerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04JD.html 0000664 0000000 0000000 00000011555 14560147231 0020341 0 ustar 00root root 0000000 0000000
Purpose
To compute an LQ factorization of an n-by-m matrix A (A = L * Q), having a min(n,p)-by-p zero triangle in the upper right-hand side corner, as shown below, for n = 8, m = 7, and p = 2: [ x x x x x 0 0 ] [ x x x x x x 0 ] [ x x x x x x x ] [ x x x x x x x ] A = [ x x x x x x x ], [ x x x x x x x ] [ x x x x x x x ] [ x x x x x x x ] and optionally apply the transformations to an l-by-m matrix B (from the right). The problem structure is exploited. This computation is useful, for instance, in combined measurement and time update of one iteration of the time-invariant Kalman filter (square root covariance filter).Specification
SUBROUTINE MB04JD( N, M, P, L, A, LDA, B, LDB, TAU, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDA, LDB, LDWORK, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), TAU(*)Arguments
Input/Output Parameters
N (input) INTEGER The number of rows of the matrix A. N >= 0. M (input) INTEGER The number of columns of the matrix A. M >= 0. P (input) INTEGER The order of the zero triagle. P >= 0. L (input) INTEGER The number of rows of the matrix B. L >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,M) On entry, the leading N-by-M part of this array must contain the matrix A. The elements corresponding to the zero MIN(N,P)-by-P upper trapezoidal/triangular part (if P > 0) are not referenced. On exit, the elements on and below the diagonal of this array contain the N-by-MIN(N,M) lower trapezoidal matrix L (L is lower triangular, if N <= M) of the LQ factorization, and the relevant elements above the diagonal contain the trailing components (the vectors v, see Method) of the elementary reflectors used in the factorization. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the matrix B. On exit, the leading L-by-M part of this array contains the updated matrix B. If L = 0, this array is not referenced. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L). TAU (output) DOUBLE PRECISION array, dimension MIN(N,M) The scalar factors of the elementary reflectors used.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK The length of the array DWORK. LDWORK >= MAX(1,N-1,N-P,L). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine uses min(N,M) Householder transformations exploiting the zero pattern of the matrix. A Householder matrix has the form ( 1 ), H = I - tau *u *u', u = ( v ) i i i i i ( i) where v is an (M-P+I-2)-vector. The components of v are stored i i in the i-th row of A, beginning from the location i+1, and tau i is stored in TAU(i).Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04KD.html 0000664 0000000 0000000 00000012314 14560147231 0020334 0 ustar 00root root 0000000 0000000
Purpose
To calculate a QR factorization of the first block column and apply the orthogonal transformations (from the left) also to the second block column of a structured matrix, as follows _ [ R 0 ] [ R C ] Q' * [ ] = [ ] [ A B ] [ 0 D ] _ where R and R are upper triangular. The matrix A can be full or upper trapezoidal/triangular. The problem structure is exploited. This computation is useful, for instance, in combined measurement and time update of one iteration of the Kalman filter (square root information filter).Specification
SUBROUTINE MB04KD( UPLO, N, M, P, R, LDR, A, LDA, B, LDB, C, LDC, $ TAU, DWORK ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER LDA, LDB, LDC, LDR, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ R(LDR,*), TAU(*)Arguments
Mode Parameters
UPLO CHARACTER*1 Indicates if the matrix A is or not triangular as follows: = 'U': Matrix A is upper trapezoidal/triangular; = 'F': Matrix A is full.Input/Output Parameters
N (input) INTEGER _ The order of the matrices R and R. N >= 0. M (input) INTEGER The number of columns of the matrices B, C and D. M >= 0. P (input) INTEGER The number of rows of the matrices A, B and D. P >= 0. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix R. On exit, the leading N-by-N upper triangular part of this _ array contains the upper triangular matrix R. The strict lower triangular part of this array is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if UPLO = 'F', the leading P-by-N part of this array must contain the matrix A. If UPLO = 'U', the leading MIN(P,N)-by-N part of this array must contain the upper trapezoidal (upper triangular if P >= N) matrix A, and the elements below the diagonal are not referenced. On exit, the leading P-by-N part (upper trapezoidal or triangular, if UPLO = 'U') of this array contains the trailing components (the vectors v, see Method) of the elementary reflectors used in the factorization. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,P). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading P-by-M part of this array must contain the matrix B. On exit, the leading P-by-M part of this array contains the computed matrix D. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,P). C (output) DOUBLE PRECISION array, dimension (LDC,M) The leading N-by-M part of this array contains the computed matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). TAU (output) DOUBLE PRECISION array, dimension (N) The scalar factors of the elementary reflectors used.Workspace
DWORK DOUBLE PRECISION array, dimension (N)Method
The routine uses N Householder transformations exploiting the zero pattern of the block matrix. A Householder matrix has the form ( 1 ), H = I - tau *u *u', u = ( v ) i i i i i ( i) where v is a P-vector, if UPLO = 'F', or an min(i,P)-vector, if i UPLO = 'U'. The components of v are stored in the i-th column i of A, and tau is stored in TAU(i). iNumerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04LD.html 0000664 0000000 0000000 00000012267 14560147231 0020344 0 ustar 00root root 0000000 0000000
Purpose
To calculate an LQ factorization of the first block row and apply the orthogonal transformations (from the right) also to the second block row of a structured matrix, as follows _ [ L A ] [ L 0 ] [ ]*Q = [ ] [ 0 B ] [ C D ] _ where L and L are lower triangular. The matrix A can be full or lower trapezoidal/triangular. The problem structure is exploited. This computation is useful, for instance, in combined measurement and time update of one iteration of the Kalman filter (square root covariance filter).Specification
SUBROUTINE MB04LD( UPLO, N, M, P, L, LDL, A, LDA, B, LDB, C, LDC, $ TAU, DWORK ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER LDA, LDB, LDC, LDL, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ L(LDL,*), TAU(*)Arguments
Mode Parameters
UPLO CHARACTER*1 Indicates if the matrix A is or not triangular as follows: = 'L': Matrix A is lower trapezoidal/triangular; = 'F': Matrix A is full.Input/Output Parameters
N (input) INTEGER _ The order of the matrices L and L. N >= 0. M (input) INTEGER The number of columns of the matrices A, B and D. M >= 0. P (input) INTEGER The number of rows of the matrices B, C and D. P >= 0. L (input/output) DOUBLE PRECISION array, dimension (LDL,N) On entry, the leading N-by-N lower triangular part of this array must contain the lower triangular matrix L. On exit, the leading N-by-N lower triangular part of this _ array contains the lower triangular matrix L. The strict upper triangular part of this array is not referenced. LDL INTEGER The leading dimension of array L. LDL >= MAX(1,N). A (input/output) DOUBLE PRECISION array, dimension (LDA,M) On entry, if UPLO = 'F', the leading N-by-M part of this array must contain the matrix A. If UPLO = 'L', the leading N-by-MIN(N,M) part of this array must contain the lower trapezoidal (lower triangular if N <= M) matrix A, and the elements above the diagonal are not referenced. On exit, the leading N-by-M part (lower trapezoidal or triangular, if UPLO = 'L') of this array contains the trailing components (the vectors v, see Method) of the elementary reflectors used in the factorization. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading P-by-M part of this array must contain the matrix B. On exit, the leading P-by-M part of this array contains the computed matrix D. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,P). C (output) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array contains the computed matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). TAU (output) DOUBLE PRECISION array, dimension (N) The scalar factors of the elementary reflectors used.Workspace
DWORK DOUBLE PRECISION array, dimension (N)Method
The routine uses N Householder transformations exploiting the zero pattern of the block matrix. A Householder matrix has the form ( 1 ), H = I - tau *u *u', u = ( v ) i i i i i ( i) where v is an M-vector, if UPLO = 'F', or an min(i,M)-vector, if i UPLO = 'L'. The components of v are stored in the i-th row of A, i and tau is stored in TAU(i). iNumerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04MD.html 0000664 0000000 0000000 00000013657 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To reduce the 1-norm of a general real matrix A by balancing. This involves diagonal similarity transformations applied iteratively to A to make the rows and columns as close in norm as possible. This routine can be used instead LAPACK Library routine DGEBAL, when no reduction of the 1-norm of the matrix is possible with DGEBAL, as for upper triangular matrices. LAPACK Library routine DGEBAK, with parameters ILO = 1, IHI = N, and JOB = 'S', should be used to apply the backward transformation.Specification
SUBROUTINE MB04MD( N, MAXRED, A, LDA, SCALE, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, N DOUBLE PRECISION MAXRED C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), SCALE( * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. MAXRED (input/output) DOUBLE PRECISION On entry, the maximum allowed reduction in the 1-norm of A (in an iteration) if zero rows or columns are encountered. If MAXRED > 0.0, MAXRED must be larger than one (to enable the norm reduction). If MAXRED <= 0.0, then the value 10.0 for MAXRED is used. On exit, if the 1-norm of the given matrix A is non-zero, the ratio between the 1-norm of the given matrix and the 1-norm of the balanced matrix. Usually, this ratio will be larger than one, but it can sometimes be one, or even less than one (for instance, for some companion matrices). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the input matrix A. On exit, the leading N-by-N part of this array contains the balanced matrix. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). SCALE (output) DOUBLE PRECISION array, dimension (N) The scaling factors applied to A. If D(j) is the scaling factor applied to row and column j, then SCALE(j) = D(j), for j = 1,...,N.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
Balancing consists of applying a diagonal similarity transformation inv(D) * A * D to make the 1-norms of each row of A and its corresponding column nearly equal. Information about the diagonal matrix D is returned in the vector SCALE.References
[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.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* MB04MD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA PARAMETER ( LDA = NMAX ) * .. Local Scalars .. INTEGER I, INFO, J, N DOUBLE PRECISION MAXRED * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), SCALE(NMAX) * .. External Subroutines .. EXTERNAL MB04MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, MAXRED IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) * Balance matrix A. CALL MB04MD( N, MAXRED, A, LDA, SCALE, 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 = 99994 ) ( SCALE(I), I = 1,N ) END IF END IF STOP * 99999 FORMAT (' MB04MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04MD = ',I2) 99997 FORMAT (' The balanced matrix is ') 99996 FORMAT (20(1X,F10.4)) 99994 FORMAT (/' SCALE is ',/20(1X,F10.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB04MD EXAMPLE PROGRAM DATA 4 0.0 1.0 0.0 0.0 0.0 300.0 400.0 500.0 600.0 1.0 2.0 0.0 0.0 1.0 1.0 1.0 1.0Program Results
MB04MD EXAMPLE PROGRAM RESULTS The balanced matrix is 1.0000 0.0000 0.0000 0.0000 30.0000 400.0000 50.0000 60.0000 1.0000 20.0000 0.0000 0.0000 1.0000 10.0000 1.0000 1.0000 SCALE is 1.0000 10.0000 1.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04ND.html 0000664 0000000 0000000 00000013346 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To calculate an RQ factorization of the first block row and apply the orthogonal transformations (from the right) also to the second block row of a structured matrix, as follows _ [ A R ] [ 0 R ] [ ] * Q' = [ _ _ ] [ C B ] [ C B ] _ where R and R are upper triangular. The matrix A can be full or upper trapezoidal/triangular. The problem structure is exploited.Specification
SUBROUTINE MB04ND( UPLO, N, M, P, R, LDR, A, LDA, B, LDB, C, LDC, $ TAU, DWORK ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER LDA, LDB, LDC, LDR, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ R(LDR,*), TAU(*)Arguments
Mode Parameters
UPLO CHARACTER*1 Indicates if the matrix A is or not triangular as follows: = 'U': Matrix A is upper trapezoidal/triangular; = 'F': Matrix A is full.Input/Output Parameters
N (input) INTEGER _ The order of the matrices R and R. N >= 0. M (input) INTEGER The number of rows of the matrices B and C. M >= 0. P (input) INTEGER The number of columns of the matrices A and C. P >= 0. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix R. On exit, the leading N-by-N upper triangular part of this _ array contains the upper triangular matrix R. The strict lower triangular part of this array is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). A (input/output) DOUBLE PRECISION array, dimension (LDA,P) On entry, if UPLO = 'F', the leading N-by-P part of this array must contain the matrix A. For UPLO = 'U', if N <= P, the upper triangle of the subarray A(1:N,P-N+1:P) must contain the N-by-N upper triangular matrix A, and if N >= P, the elements on and above the (N-P)-th subdiagonal must contain the N-by-P upper trapezoidal matrix A. On exit, if UPLO = 'F', the leading N-by-P part of this array contains the trailing components (the vectors v, see METHOD) of the elementary reflectors used in the factorization. If UPLO = 'U', the upper triangle of the subarray A(1:N,P-N+1:P) (if N <= P), or the elements on and above the (N-P)-th subdiagonal (if N >= P), contain the trailing components (the vectors v, see METHOD) of the elementary reflectors used in the factorization. The remaining elements are not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading M-by-N part of this array must contain the matrix B. On exit, the leading M-by-N part of this array contains _ the computed matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M). C (input/output) DOUBLE PRECISION array, dimension (LDC,P) On entry, the leading M-by-P part of this array must contain the matrix C. On exit, the leading M-by-P part of this array contains _ the computed matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M). TAU (output) DOUBLE PRECISION array, dimension (N) The scalar factors of the elementary reflectors used.Workspace
DWORK DOUBLE PRECISION array, dimension (MAX(N-1,M))Method
The routine uses N Householder transformations exploiting the zero pattern of the block matrix. A Householder matrix has the form ( 1 ) H = I - tau *u *u', u = ( v ), i i i i i ( i) where v is a P-vector, if UPLO = 'F', or a min(N-i+1,P)-vector, i if UPLO = 'U'. The components of v are stored in the i-th row i of A, and tau is stored in TAU(i), i = N,N-1,...,1. i In-line code for applying Householder transformations is used whenever possible (see MB04NY routine).Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04NY.html 0000664 0000000 0000000 00000006776 14560147231 0020403 0 ustar 00root root 0000000 0000000
Purpose
To apply a real elementary reflector H to a real m-by-(n+1) matrix C = [ A B ], from the right, where A has one column. H is represented in the form ( 1 ) H = I - tau * u *u', u = ( ), ( v ) where tau is a real scalar and v is a real n-vector. If tau = 0, then H is taken to be the unit matrix. In-line code is used if H has order < 11.Specification
SUBROUTINE MB04NY( M, N, V, INCV, TAU, A, LDA, B, LDB, DWORK ) C .. Scalar Arguments .. INTEGER INCV, LDA, LDB, M, N DOUBLE PRECISION TAU C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), V( * )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrices A and B. M >= 0. N (input) INTEGER The number of columns of the matrix B. N >= 0. V (input) DOUBLE PRECISION array, dimension (1+(N-1)*ABS( INCV )) The vector v in the representation of H. INCV (input) INTEGER The increment between the elements of v. INCV <> 0. TAU (input) DOUBLE PRECISION The scalar factor of the elementary reflector H. A (input/output) DOUBLE PRECISION array, dimension (LDA,1) On entry, the leading M-by-1 part of this array must contain the matrix A. On exit, the leading M-by-1 part of this array contains the updated matrix A (the first column of C * H). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading M-by-N part of this array must contain the matrix B. On exit, the leading M-by-N part of this array contains the updated matrix B (the last n columns of C * H). LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M).Workspace
DWORK DOUBLE PRECISION array, dimension (M) DWORK is not referenced if H has order less than 11.Method
The routine applies the elementary reflector H, taking the special structure of C into account.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To calculate a QR factorization of the first block column and apply the orthogonal transformations (from the left) also to the second block column of a structured matrix, as follows _ _ [ R B ] [ R B ] Q' * [ ] = [ _ ] [ A C ] [ 0 C ] _ where R and R are upper triangular. The matrix A can be full or upper trapezoidal/triangular. The problem structure is exploited.Specification
SUBROUTINE MB04OD( UPLO, N, M, P, R, LDR, A, LDA, B, LDB, C, LDC, $ TAU, DWORK ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER LDA, LDB, LDC, LDR, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ R(LDR,*), TAU(*)Arguments
Mode Parameters
UPLO CHARACTER*1 Indicates if the matrix A is or not triangular as follows: = 'U': Matrix A is upper trapezoidal/triangular; = 'F': Matrix A is full.Input/Output Parameters
N (input) INTEGER _ The order of the matrices R and R. N >= 0. M (input) INTEGER The number of columns of the matrices B and C. M >= 0. P (input) INTEGER The number of rows of the matrices A and C. P >= 0. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix R. On exit, the leading N-by-N upper triangular part of this _ array contains the upper triangular matrix R. The strict lower triangular part of this array is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if UPLO = 'F', the leading P-by-N part of this array must contain the matrix A. If UPLO = 'U', the leading MIN(P,N)-by-N part of this array must contain the upper trapezoidal (upper triangular if P >= N) matrix A, and the elements below the diagonal are not referenced. On exit, the leading P-by-N part (upper trapezoidal or triangular, if UPLO = 'U') of this array contains the trailing components (the vectors v, see Method) of the elementary reflectors used in the factorization. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,P). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the matrix B. On exit, the leading N-by-M part of this array contains _ the computed matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,M) On entry, the leading P-by-M part of this array must contain the matrix C. On exit, the leading P-by-M part of this array contains _ the computed matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). TAU (output) DOUBLE PRECISION array, dimension (N) The scalar factors of the elementary reflectors used.Workspace
DWORK DOUBLE PRECISION array, dimension (MAX(N-1,M))Method
The routine uses N Householder transformations exploiting the zero pattern of the block matrix. A Householder matrix has the form ( 1 ) H = I - tau *u *u', u = ( v ), i i i i i ( i) where v is a P-vector, if UPLO = 'F', or a min(i,P)-vector, if i UPLO = 'U'. The components of v are stored in the i-th column i of A, and tau is stored in TAU(i). i In-line code for applying Householder transformations is used whenever possible (see MB04OY routine).Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
* MB04OD EXAMPLE PROGRAM TEXT. * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER (ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX, PMAX PARAMETER ( MMAX = 20, NMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDR PARAMETER ( LDA = PMAX, LDB = NMAX, LDC = PMAX, $ LDR = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX-1,MMAX ) ) * .. Local Scalars .. CHARACTER*1 UPLO INTEGER I, J, M, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,MMAX), $ DWORK(LDWORK), R(LDR,NMAX), TAU(NMAX) * .. External Subroutines .. EXTERNAL MB04OD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, UPLO IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99991 ) P ELSE READ ( NIN, FMT = * ) ( ( R(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,M ), I = 1,P ) * Compute and apply QR factorization. CALL MB04OD( UPLO, N, M, P, R, LDR, A, LDA, B, LDB, C, $ LDC, TAU, DWORK ) * WRITE ( NOUT, FMT = 99997 ) DO 40 I = 1, N DO 20 J = 1, I-1 R(I,J) = ZERO 20 CONTINUE WRITE ( NOUT, FMT = 99996 ) ( R(I,J), J = 1,N ) 40 CONTINUE IF ( M.GT.0 ) THEN WRITE ( NOUT, FMT = 99995 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,M ) 60 CONTINUE IF ( P.GT.0 ) THEN WRITE ( NOUT, FMT = 99994 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,M ) 80 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' MB04OD EXAMPLE PROGRAM RESULTS',/1X) 99997 FORMAT (' The updated matrix R is ') 99996 FORMAT (20(1X,F10.4)) 99995 FORMAT (' The updated matrix B is ') 99994 FORMAT (' The updated matrix C is ') 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
MB04OD EXAMPLE PROGRAM DATA 3 2 2 F 3. 2. 1. 0. 2. 1. 0. 0. 1. 2. 3. 1. 4. 6. 5. 3. 2. 1. 3. 3. 2. 1. 3. 3. 2.Program Results
MB04OD EXAMPLE PROGRAM RESULTS The updated matrix R is -5.3852 -6.6850 -4.6424 0.0000 -2.8828 -2.0694 0.0000 0.0000 -1.7793 The updated matrix B is -4.2710 -3.7139 -0.1555 -2.1411 -1.6021 0.9398 The updated matrix C is 0.5850 1.0141 -2.7974 -3.1162
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04OW.html 0000664 0000000 0000000 00000013143 14560147231 0020364 0 ustar 00root root 0000000 0000000
Purpose
To perform the QR factorization ( U ) = Q*( R ), where U = ( U1 U2 ), R = ( R1 R2 ), ( x' ) ( 0 ) ( 0 T ) ( 0 R3 ) where U and R are (m+n)-by-(m+n) upper triangular matrices, x is an m+n element vector, U1 is m-by-m, T is n-by-n, stored separately, and Q is an (m+n+1)-by-(m+n+1) orthogonal matrix. The matrix ( U1 U2 ) must be supplied in the m-by-(m+n) upper trapezoidal part of the array A and this is overwritten by the corresponding part ( R1 R2 ) of R. The remaining upper triangular part of R, R3, is overwritten on the array T. The transformations performed are also applied to the (m+n+1)-by-p matrix ( B' C' d )' (' denotes transposition), where B, C, and d' are m-by-p, n-by-p, and 1-by-p matrices, respectively.Specification
SUBROUTINE MB04OW( M, N, P, A, LDA, T, LDT, X, INCX, B, LDB, $ C, LDC, D, INCD ) C .. Scalar Arguments .. INTEGER INCD, INCX, LDA, LDB, LDC, LDT, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(*), T(LDT,*), $ X(*)Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix ( U1 U2 ). M >= 0. N (input) INTEGER The order of the matrix T. N >= 0. P (input) INTEGER The number of columns of the matrices B and C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M-by-(M+N) upper trapezoidal part of this array must contain the upper trapezoidal matrix ( U1 U2 ). On exit, the leading M-by-(M+N) upper trapezoidal part of this array contains the upper trapezoidal matrix ( R1 R2 ). The strict lower triangle of A is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). T (input/output) DOUBLE PRECISION array, dimension (LDT,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix T. On exit, the leading N-by-N upper triangular part of this array contains the upper triangular matrix R3. The strict lower triangle of T is not referenced. LDT INTEGER The leading dimension of the array T. LDT >= max(1,N). X (input/output) DOUBLE PRECISION array, dimension (1+(M+N-1)*INCX), if M+N > 0, or dimension (0), if M+N = 0. On entry, the incremented array X must contain the vector x. On exit, the content of X is changed. INCX (input) INTEGER Specifies the increment for the elements of X. INCX > 0. B (input/output) DOUBLE PRECISION array, dimension (LDB,P) On entry, the leading M-by-P part of this array must contain the matrix B. On exit, the leading M-by-P part of this array contains the transformed matrix B. If M = 0 or P = 0, this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= max(1,M), if P > 0; LDB >= 1, if P = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,P) On entry, the leading N-by-P part of this array must contain the matrix C. On exit, the leading N-by-P part of this array contains the transformed matrix C. If N = 0 or P = 0, this array is not referenced. LDC INTEGER The leading dimension of the array C. LDC >= max(1,N), if P > 0; LDC >= 1, if P = 0. D (input/output) DOUBLE PRECISION array, dimension (1+(P-1)*INCD), if P > 0, or dimension (0), if P = 0. On entry, the incremented array D must contain the vector d. On exit, this incremented array contains the transformed vector d. If P = 0, this array is not referenced. INCD (input) INTEGER Specifies the increment for the elements of D. INCD > 0.Method
Let q = m+n. The matrix Q is formed as a sequence of plane rotations in planes (1, q+1), (2, q+1), ..., (q, q+1), the rotation in the (j, q+1)th plane, Q(j), being chosen to annihilate the jth element of x.Numerical Aspects
The algorithm requires 0((M+N)*(M+N+P)) operations and is backward stable.Further Comments
For P = 0, this routine produces the same result as SLICOT Library routine MB04OX, but matrix T may not be stored in the array A.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To perform the QR factorization (U ) = Q*(R), (x') (0) where U and R are n-by-n upper triangular matrices, x is an n element vector and Q is an (n+1)-by-(n+1) orthogonal matrix. U must be supplied in the n-by-n upper triangular part of the array A and this is overwritten by R.Specification
SUBROUTINE MB04OX( N, A, LDA, X, INCX ) C .. Scalar Arguments .. INTEGER INCX, LDA, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), X(*)Arguments
Input/Output Parameters
N (input) INTEGER The number of elements of X and the order of the square matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix U. On exit, the leading N-by-N upper triangular part of this array contains the upper triangular matrix R. The strict lower triangle of A is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). X (input/output) DOUBLE PRECISION array, dimension (1+(N-1)*INCX) On entry, the incremented array X must contain the vector x. On exit, the content of X is changed. INCX (input) INTEGER. Specifies the increment for the elements of X. INCX > 0.Method
The matrix Q is formed as a sequence of plane rotations in planes (1, n+1), (2, n+1), ..., (n, n+1), the rotation in the (j, n+1)th plane, Q(j), being chosen to annihilate the jth element of x.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To apply a real elementary reflector H to a real (m+1)-by-n matrix C = [ A ], from the left, where A has one row. H is [ B ] represented in the form ( 1 ) H = I - tau * u *u', u = ( ), ( v ) where tau is a real scalar and v is a real m-vector. If tau = 0, then H is taken to be the unit matrix. In-line code is used if H has order < 11.Specification
SUBROUTINE MB04OY( M, N, V, TAU, A, LDA, B, LDB, DWORK ) C .. Scalar Arguments .. INTEGER LDA, LDB, M, N DOUBLE PRECISION TAU C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), V( * )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix B. M >= 0. N (input) INTEGER The number of columns of the matrices A and B. N >= 0. V (input) DOUBLE PRECISION array, dimension (M) The vector v in the representation of H. TAU (input) DOUBLE PRECISION The scalar factor of the elementary reflector H. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading 1-by-N part of this array must contain the matrix A. On exit, the leading 1-by-N part of this array contains the updated matrix A (the first row of H * C). LDA INTEGER The leading dimension of array A. LDA >= 1. B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading M-by-N part of this array must contain the matrix B. On exit, the leading M-by-N part of this array contains the updated matrix B (the last m rows of H * C). LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M).Workspace
DWORK DOUBLE PRECISION array, dimension (N) DWORK is not referenced if H has order less than 11.Method
The routine applies the elementary reflector H, taking the special structure of C into account.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce a Hamiltonian like matrix [ A G ] T T H = [ T ] , G = G , Q = Q, [ Q -A ] or a skew-Hamiltonian like matrix [ A G ] T T W = [ T ] , G = -G , Q = -Q, [ Q A ] so that elements below the (k+1)-th subdiagonal in the first nb columns of the (k+n)-by-n matrix A, and offdiagonal elements in the first nb columns and rows of the n-by-n matrix Q are zero. The reduction is performed by an orthogonal symplectic transformation UU'*H*UU and matrices U, XA, XG, XQ, and YA are returned so that [ Aout + U*XA'+ YA*U' Gout + U*XG'+ XG*U' ] UU'*H*UU = [ ]. [ Qout + U*XQ'+ XQ*U' -Aout'- XA*U'- U*YA' ] Similarly, [ Aout + U*XA'+ YA*U' Gout + U*XG'- XG*U' ] UU'*W*UU = [ ]. [ Qout + U*XQ'- XQ*U' Aout'+ XA*U'+ U*YA' ] This is an auxiliary routine called by MB04PB.Specification
SUBROUTINE MB04PA( LHAM, N, K, NB, A, LDA, QG, LDQG, XA, LDXA, $ XG, LDXG, XQ, LDXQ, YA, LDYA, CS, TAU, DWORK ) C .. Scalar Arguments .. LOGICAL LHAM INTEGER K, LDA, LDQG, LDXA, LDXG, LDXQ, LDYA, N, NB C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), CS(*), DWORK(*), QG(LDQG,*), TAU(*), $ XA(LDXA,*), XG(LDXG,*), XQ(LDXQ,*), YA(LDYA,*)Arguments
Mode Parameters
LHAM LOGICAL Specifies the type of matrix to be reduced: = .FALSE. : skew-Hamiltonian like W; = .TRUE. : Hamiltonian like H.Input/Output Parameters
N (input) INTEGER The number of columns of the matrix A. N >= 0. K (input) INTEGER The offset of the reduction. Elements below the (K+1)-th subdiagonal in the first NB columns of A are reduced to zero. K >= 0. NB (input) INTEGER The number of columns/rows to be reduced. N > NB >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading (K+N)-by-N part of this array must contain the matrix A. On exit, the leading (K+N)-by-N part of this array contains the matrix Aout and in the zero part information about the elementary reflectors used to compute the reduction. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,K+N). QG (input/output) DOUBLE PRECISION array, dimension (LDQG,N+1) On entry, the leading N+K-by-N+1 part of this array must contain in the bottom left part the lower triangular part of the N-by-N matrix Q and in the remainder the upper trapezoidal part of the last N columns of the N+K-by-N+K matrix G. On exit, the leading N+K-by-N+1 part of this array contains parts of the matrices Q and G in the same fashion as on entry only that the zero parts of Q contain information about the elementary reflectors used to compute the reduction. Note that if LHAM = .FALSE. then the (K-1)-th and K-th subdiagonals are not referenced. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N+K). XA (output) DOUBLE PRECISION array, dimension (LDXA,2*NB) On exit, the leading N-by-(2*NB) part of this array contains the matrix XA. LDXA INTEGER The leading dimension of the array XA. LDXA >= MAX(1,N). XG (output) DOUBLE PRECISION array, dimension (LDXG,2*NB) On exit, the leading (K+N)-by-(2*NB) part of this array contains the matrix XG. LDXG INTEGER The leading dimension of the array XG. LDXG >= MAX(1,K+N). XQ (output) DOUBLE PRECISION array, dimension (LDXQ,2*NB) On exit, the leading N-by-(2*NB) part of this array contains the matrix XQ. LDXQ INTEGER The leading dimension of the array XQ. LDXQ >= MAX(1,N). YA (output) DOUBLE PRECISION array, dimension (LDYA,2*NB) On exit, the leading (K+N)-by-(2*NB) part of this array contains the matrix YA. LDYA INTEGER The leading dimension of the array YA. LDYA >= MAX(1,K+N). CS (output) DOUBLE PRECISION array, dimension (2*NB) On exit, the first 2*NB elements of this array contain the cosines and sines of the symplectic Givens rotations used to compute the reduction. TAU (output) DOUBLE PRECISION array, dimension (NB) On exit, the first NB elements of this array contain the scalar factors of some of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension (3*NB)Method
For details regarding the representation of the orthogonal symplectic matrix UU within the arrays A, QG, CS, TAU see the description of MB04PU. The contents of A and QG on exit are illustrated by the following example with n = 5, k = 2 and nb = 2: ( a r r a a ) ( g g r r g g ) ( a r r a a ) ( g g r r g g ) ( a r r a a ) ( q g r r g g ) A = ( r r r r r ), QG = ( t r r r r r ), ( u2 r r r r ) ( u1 t r r r r ) ( u2 u2 r a a ) ( u1 u1 r q g g ) ( u2 u2 r a a ) ( u1 u1 r q q g ) where a, g and q denote elements of the original matrices, r denotes a modified element, t denotes a scalar factor of an applied elementary reflector and ui denote elements of the matrix U.References
[1] C. F. VAN LOAN: A symplectic method for approximating all the eigenvalues of a Hamiltonian matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984. [2] D. KRESSNER: Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce a Hamiltonian matrix, [ A G ] H = [ T ] , [ Q -A ] where A is an N-by-N matrix and G,Q are N-by-N symmetric matrices, to Paige/Van Loan (PVL) form. That is, an orthogonal symplectic U is computed so that T [ Aout Gout ] U H U = [ T ] , [ Qout -Aout ] where Aout is upper Hessenberg and Qout is diagonal. Blocked version.Specification
SUBROUTINE MB04PB( N, ILO, A, LDA, QG, LDQG, CS, TAU, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER ILO, INFO, LDA, LDQG, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), CS(*), DWORK(*), QG(LDQG,*), TAU(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. ILO (input) INTEGER It is assumed that A is already upper triangular and Q is zero in rows and columns 1:ILO-1. ILO is normally set by a previous call to MB04DD; otherwise it should be set to 1. 1 <= ILO <= N, if N > 0; ILO = 1, if N = 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 Aout and, in the zero part of Aout, information about the elementary reflectors used to compute the PVL factorization. LDA INTEGER The leading dimension of the array A. LDA >= 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 the lower triangular part of the matrix Q and the upper triangular part of the matrix G. On exit, the leading N-by-N+1 part of this array contains the diagonal of the matrix Qout, the upper triangular part of the matrix Gout and, in the zero parts of Qout, information about the elementary reflectors used to compute the PVL factorization. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N). CS (output) DOUBLE PRECISION array, dimension (2N-2) On exit, the first 2N-2 elements of this array contain the cosines and sines of the symplectic Givens rotations used to compute the PVL factorization. TAU (output) DOUBLE PRECISION array, dimension (N-1) On exit, the first N-1 elements of this array contain the scalar factors of some of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, 8*N*NB + 3*NB, where NB is the optimal block size determined by the function UE01MD. On exit, if INFO = -10, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N-1). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix U is represented as a product of symplectic reflectors and Givens rotations U = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(n-1),H(n-1) ) G(n-1) diag( F(n-1),F(n-1) ). Each H(i) has the form H(i) = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in QG(i+2:n,i), and tau in QG(i+1,i). Each F(i) has the form F(i) = I - nu * w * w' where nu is a real scalar, and w is a real vector with w(1:i) = 0 and w(i+1) = 1; w(i+2:n) is stored on exit in A(i+2:n,i), and nu in TAU(i). Each G(i) is a Givens rotation acting on rows i+1 and n+i+1, where the cosine is stored in CS(2*i-1) and the sine in CS(2*i).Numerical Aspects
The algorithm requires O(N**3) floating point operations and is strongly backward stable.References
[1] C. F. VAN LOAN: A symplectic method for approximating all the eigenvalues of a Hamiltonian matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984. [2] D. KRESSNER: Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
* MB04PB/MB04WP EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO, ONE, TWO PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, TWO = 2.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, NBMAX PARAMETER ( NMAX = 7, NBMAX = 3 ) INTEGER LDA, LDQG, LDRES, LDU1, LDU2, LDWORK PARAMETER ( LDA = NMAX, LDQG = NMAX, LDRES = NMAX, $ LDU1 = NMAX, LDU2 = NMAX, $ LDWORK = 8*NBMAX*NMAX + 3*NBMAX ) * .. Local Scalars .. INTEGER I, INFO, J, N * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), CS(2*NMAX), DWORK(LDWORK), $ QG(LDQG, NMAX+1), RES(LDRES,3*NMAX+1), TAU(NMAX), $ U1(LDU1,NMAX), U2(LDU2, NMAX) * .. External Functions .. DOUBLE PRECISION MA02ID, MA02JD EXTERNAL MA02ID, MA02JD * .. External Subroutines .. EXTERNAL DGEMM, DLACPY, DLASET, DSCAL, DSYMM, DSYR, $ DSYR2K, DTRMM, MB04PB, MB04WP * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) 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 = * ) ( ( QG(I,J), J = 1,N+1 ), I = 1,N ) CALL DLACPY( 'All', N, N+1, QG, LDQG, RES(1,2*N+1), LDRES ) CALL MB04PB( N, 1, A, LDA, QG, LDQG, CS, TAU, DWORK, LDWORK, $ INFO ) INFO = 0 IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE CALL DLACPY( 'Lower', N, N, A, LDA, U1, LDU1 ) CALL DLACPY( 'Lower', N, N, QG, LDQG, U2, LDU2 ) CALL MB04WP( N, 1, U1, LDU1, U2, LDU2, CS, TAU, DWORK, $ LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE IF ( N.GT.2 ) $ CALL DLASET( 'Lower', N-2, N-2, ZERO, ZERO, A(3,1), $ LDA ) IF ( N.GT.1 ) $ CALL DLASET( 'Lower', N-1, N-1, ZERO, ZERO, QG(2,1), $ LDQG ) WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE (NOUT, FMT = 99993) $ ( U1(I,J), J = 1,N ), ( U2(I,J), J = 1,N ) 10 CONTINUE DO 20 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -U2(I,J), J = 1,N ), ( U1(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99991 ) MA02JD( .FALSE., .FALSE., N, $ U1, LDU1, U2, LDU2, RES, LDRES ) WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, N WRITE (NOUT, FMT = 99993) ( A(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, N WRITE (NOUT, FMT = 99993) ( QG(I,J), J = 1,N+1 ) 40 CONTINUE C CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ U1, LDU1, A, LDA, ZERO, RES, LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, -ONE, $ RES, LDRES, U1, LDU1, ONE, RES(1,N+1), $ LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, ONE, $ U2, LDU2, A, LDA, ZERO, RES, LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, ONE, $ RES, LDRES, U2, LDU2, ONE, RES(1,N+1), $ LDRES ) CALL DSYMM ( 'Right', 'Upper', N, N, ONE, QG(1,2), LDQG, $ U1, LDU1, ZERO, RES, LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, -ONE, $ RES, LDRES, U2, LDU2, ONE, RES(1,N+1), $ LDRES ) CALL DLACPY( 'All', N, N, U2, LDU2, RES, LDRES ) DO 50 I = 1, N CALL DSCAL( N, QG(I,I), RES(1,I), 1 ) 50 CONTINUE CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, -ONE, $ RES, LDRES, U1, LDU1, ONE, RES(1,N+1), $ LDRES ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ U2, LDU2, A, LDA, ZERO, RES, LDRES ) CALL DSYR2K( 'Lower', 'No Transpose', N, N, ONE, RES, $ LDRES, U1, LDU1, ONE, RES(1,2*N+1), LDRES ) CALL DSCAL( N, ONE/TWO, QG(1,2), LDQG+1 ) CALL DLACPY( 'Full', N, N, U2, LDU2, RES, LDRES ) CALL DTRMM( 'Right', 'Upper' , 'No Transpose', $ 'Not unit', N, N, ONE, QG(1,2), LDQG, $ RES, LDRES ) CALL DSYR2K( 'Lower', 'No Transpose', N, N, ONE, RES, $ LDRES, U2, LDU2, ONE, RES(1,2*N+1), LDRES ) DO 60 I = 1, N CALL DSYR( 'Lower', N, -QG(I,I), U1(1,I), 1, $ RES(1,2*N+1), LDRES ) 60 CONTINUE CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ U1, LDU1, A, LDA, ZERO, RES, LDRES ) CALL DSYR2K( 'Upper', 'No Transpose', N, N, ONE, RES, $ LDRES, U2, LDU2, ONE, RES(1,2*N+2), LDRES ) CALL DLACPY( 'Full', N, N, U1, LDU1, RES, LDRES ) CALL DTRMM( 'Right', 'Upper' , 'No Transpose', $ 'Not unit', N, N, ONE, QG(1,2), LDQG, $ RES, LDRES ) CALL DSYR2K( 'Upper', 'No Transpose', N, N, -ONE, RES, $ LDRES, U1, LDU1, ONE, RES(1,2*N+2), LDRES ) DO 70 I = 1, N CALL DSYR( 'Upper', N, QG(I,I), U2(1,I), 1, $ RES(1,2*N+2), LDRES ) 70 CONTINUE C WRITE ( NOUT, FMT = 99990 ) MA02ID( 'Hamiltonian', $ 'Frobenius', N, RES(1,N+1), LDRES, RES(1,2*N+1), $ LDRES, DWORK ) END IF END IF END IF * 99999 FORMAT (' TMB04PB EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04PB = ',I2) 99997 FORMAT (' INFO on exit from MB04WP = ',I2) 99996 FORMAT (' The symplectic orthogonal factor U is ') 99995 FORMAT (/' The reduced matrix A is ') 99994 FORMAT (/' The reduced matrix QG is ') 99993 FORMAT (20(1X,F9.4)) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' Orthogonality of U: || U''*U - I ||_F = ',G7.2) 99990 FORMAT (/' Residual: || H - U*R*U'' ||_F = ',G7.2) ENDProgram Data
MB04PB EXAMPLE PROGRAM DATA 5 0.9501 0.7621 0.6154 0.4057 0.0579 0.2311 0.4565 0.7919 0.9355 0.3529 0.6068 0.0185 0.9218 0.9169 0.8132 0.4860 0.8214 0.7382 0.4103 0.0099 0.8913 0.4447 0.1763 0.8936 0.1389 0.3869 0.4055 0.2140 1.0224 1.1103 0.7016 1.3801 0.7567 1.4936 1.2913 0.9515 1.1755 0.7993 1.7598 1.6433 1.0503 0.8839 1.1010 1.2019 1.1956 0.9346 0.6824 0.7590 1.1364 0.8780 0.9029 1.6565 1.1022 0.7408 0.3793Program Results
TMB04PB EXAMPLE PROGRAM RESULTS The symplectic orthogonal factor U is 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.0927 0.2098 0.5594 -0.0226 0.0000 0.5538 0.3184 0.2519 -0.4031 0.0000 -0.2435 0.4745 -0.6362 -0.2542 0.0000 0.3207 -0.2455 0.0595 -0.2819 0.0000 -0.1950 -0.1770 -0.1519 -0.2857 0.0000 0.4823 0.4122 -0.2060 0.6173 0.0000 -0.3576 -0.0480 0.2302 0.4512 0.0000 0.3523 -0.6047 -0.3110 0.1635 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.5538 -0.3184 -0.2519 0.4031 0.0000 -0.0927 0.2098 0.5594 -0.0226 0.0000 -0.3207 0.2455 -0.0595 0.2819 0.0000 -0.2435 0.4745 -0.6362 -0.2542 0.0000 -0.4823 -0.4122 0.2060 -0.6173 0.0000 -0.1950 -0.1770 -0.1519 -0.2857 0.0000 -0.3523 0.6047 0.3110 -0.1635 0.0000 -0.3576 -0.0480 0.2302 0.4512 Orthogonality of U: || U'*U - I ||_F = .77E-15 The reduced matrix A is 0.9501 -1.5494 0.5268 0.3187 -0.6890 -2.4922 2.0907 -1.3598 0.5682 0.5618 0.0000 -1.7723 0.3960 -0.2624 -0.3709 0.0000 0.0000 -0.2648 0.2136 -0.3226 0.0000 0.0000 0.0000 -0.2308 0.2319 The reduced matrix QG is 0.3869 0.4055 0.0992 0.5237 -0.4110 -0.4861 0.0000 -3.7784 -4.1609 0.3614 0.3606 -0.0696 0.0000 0.0000 1.2192 -0.0848 0.2007 0.3735 0.0000 0.0000 0.0000 -0.8646 0.1538 -0.1970 0.0000 0.0000 0.0000 0.0000 -0.4527 0.0743 Residual: || H - U*R*U' ||_F = .33E-14
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04PU.html 0000664 0000000 0000000 00000035303 14560147231 0020365 0 ustar 00root root 0000000 0000000
Purpose
To reduce a Hamiltonian matrix, [ A G ] H = [ T ] , [ Q -A ] where A is an N-by-N matrix and G,Q are N-by-N symmetric matrices, to Paige/Van Loan (PVL) form. That is, an orthogonal symplectic U is computed so that T [ Aout Gout ] U H U = [ T ] , [ Qout -Aout ] where Aout is upper Hessenberg and Qout is diagonal. Unblocked version.Specification
SUBROUTINE MB04PU( N, ILO, A, LDA, QG, LDQG, CS, TAU, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER ILO, INFO, LDA, LDQG, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), CS(*), DWORK(*), QG(LDQG,*), TAU(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. ILO (input) INTEGER It is assumed that A is already upper triangular and Q is zero in rows and columns 1:ILO-1. ILO is normally set by a previous call to MB04DD; otherwise it should be set to 1. 1 <= ILO <= N, if N > 0; ILO = 1, if N = 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 Aout and, in the zero part of Aout, information about the elementary reflectors used to compute the PVL factorization. LDA INTEGER The leading dimension of the array A. LDA >= 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 the lower triangular part of the matrix Q and the upper triangular part of the matrix G. On exit, the leading N-by-N+1 part of this array contains the diagonal of the matrix Qout, the upper triangular part of the matrix Gout and, in the zero parts of Qout, information about the elementary reflectors used to compute the PVL factorization. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N). CS (output) DOUBLE PRECISION array, dimension (2N-2) On exit, the first 2N-2 elements of this array contain the cosines and sines of the symplectic Givens rotations used to compute the PVL factorization. TAU (output) DOUBLE PRECISION array, dimension (N-1) On exit, the first N-1 elements of this array contain the scalar factors of some of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -10, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N-1).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix U is represented as a product of symplectic reflectors and Givens rotations U = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(n-1),H(n-1) ) G(n-1) diag( F(n-1),F(n-1) ). Each H(i) has the form H(i) = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in QG(i+2:n,i), and tau in QG(i+1,i). Each F(i) has the form F(i) = I - nu * w * w' where nu is a real scalar, and w is a real vector with w(1:i) = 0 and w(i+1) = 1; w(i+2:n) is stored on exit in A(i+2:n,i), and nu in TAU(i). Each G(i) is a Givens rotation acting on rows i+1 and n+i+1, where the cosine is stored in CS(2*i-1) and the sine in CS(2*i).Numerical Aspects
The algorithm requires 40/3 N**3 + O(N) floating point operations and is strongly backward stable.References
[1] C. F. VAN LOAN: A symplectic method for approximating all the eigenvalues of a Hamiltonian matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984.Further Comments
NoneExample
Program Text
* MB04PU/MB04WP EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO, ONE, TWO PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, TWO = 2.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 100 ) INTEGER LDA, LDQG, LDRES, LDU1, LDU2, LDWORK PARAMETER ( LDA = NMAX, LDQG = NMAX, LDRES = NMAX, $ LDU1 = NMAX, LDU2 = NMAX, LDWORK = 2*NMAX ) * .. Local Scalars .. INTEGER I, INFO, J, N * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), CS(2*NMAX), DWORK(LDWORK), $ QG(LDQG, NMAX+1), RES(LDRES,3*NMAX+1), TAU(NMAX), $ U1(LDU1,NMAX), U2(LDU2, NMAX) * .. External Functions .. DOUBLE PRECISION MA02ID, MA02JD EXTERNAL MA02ID, MA02JD * .. External Subroutines .. EXTERNAL DGEMM, DLACPY, DLASET, DSCAL, DSYMM, DSYR, $ DSYR2K, DTRMM, MB04PU, MB04WP * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) 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 = * ) ( ( QG(I,J), J = 1,N+1 ), I = 1,N ) CALL DLACPY( 'All', N, N+1, QG, LDQG, RES(1,2*N+1), LDRES ) CALL MB04PU( N, 1, A, LDA, QG, LDQG, CS, TAU, DWORK, LDWORK, $ INFO ) INFO = 0 IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE CALL DLACPY( 'Lower', N, N, A, LDA, U1, LDU1 ) CALL DLACPY( 'Lower', N, N, QG, LDQG, U2, LDU2 ) CALL MB04WP( N, 1, U1, LDU1, U2, LDU2, CS, TAU, DWORK, $ LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE IF ( N.GT.2 ) $ CALL DLASET( 'Lower', N-2, N-2, ZERO, ZERO, A(3,1), $ LDA ) IF ( N.GT.1 ) $ CALL DLASET( 'Lower', N-1, N-1, ZERO, ZERO, QG(2,1), $ LDQG ) WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE (NOUT, FMT = 99993) $ ( U1(I,J), J = 1,N ), ( U2(I,J), J = 1,N ) 10 CONTINUE DO 20 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -U2(I,J), J = 1,N ), ( U1(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99991 ) MA02JD( .FALSE., .FALSE., N, $ U1, LDU1, U2, LDU2, RES, LDRES ) WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, N WRITE (NOUT, FMT = 99993) ( A(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, N WRITE (NOUT, FMT = 99993) ( QG(I,J), J = 1,N+1 ) 40 CONTINUE C CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ U1, LDU1, A, LDA, ZERO, RES, LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, -ONE, $ RES, LDRES, U1, LDU1, ONE, RES(1,N+1), $ LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, ONE, $ U2, LDU2, A, LDA, ZERO, RES, LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, ONE, $ RES, LDRES, U2, LDU2, ONE, RES(1,N+1), $ LDRES ) CALL DSYMM ( 'Right', 'Upper', N, N, ONE, QG(1,2), LDQG, $ U1, LDU1, ZERO, RES, LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, -ONE, $ RES, LDRES, U2, LDU2, ONE, RES(1,N+1), $ LDRES ) CALL DLACPY( 'All', N, N, U2, LDU2, RES, LDRES ) DO 50 I = 1, N CALL DSCAL( N, QG(I,I), RES(1,I), 1 ) 50 CONTINUE CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, -ONE, $ RES, LDRES, U1, LDU1, ONE, RES(1,N+1), $ LDRES ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ U2, LDU2, A, LDA, ZERO, RES, LDRES ) CALL DSYR2K( 'Lower', 'No Transpose', N, N, ONE, RES, $ LDRES, U1, LDU1, ONE, RES(1,2*N+1), LDRES ) CALL DSCAL( N, ONE/TWO, QG(1,2), LDQG+1 ) CALL DLACPY( 'Full', N, N, U2, LDU2, RES, LDRES ) CALL DTRMM( 'Right', 'Upper' , 'No Transpose', $ 'Not unit', N, N, ONE, QG(1,2), LDQG, $ RES, LDRES ) CALL DSYR2K( 'Lower', 'No Transpose', N, N, ONE, RES, $ LDRES, U2, LDU2, ONE, RES(1,2*N+1), LDRES ) DO 60 I = 1, N CALL DSYR( 'Lower', N, -QG(I,I), U1(1,I), 1, $ RES(1,2*N+1), LDRES ) 60 CONTINUE CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, ONE, $ U1, LDU1, A, LDA, ZERO, RES, LDRES ) CALL DSYR2K( 'Upper', 'No Transpose', N, N, ONE, RES, $ LDRES, U2, LDU2, ONE, RES(1,2*N+2), LDRES ) CALL DLACPY( 'Full', N, N, U1, LDU1, RES, LDRES ) CALL DTRMM( 'Right', 'Upper' , 'No Transpose', $ 'Not unit', N, N, ONE, QG(1,2), LDQG, $ RES, LDRES ) CALL DSYR2K( 'Upper', 'No Transpose', N, N, -ONE, RES, $ LDRES, U1, LDU1, ONE, RES(1,2*N+2), LDRES ) DO 70 I = 1, N CALL DSYR( 'Upper', N, QG(I,I), U2(1,I), 1, $ RES(1,2*N+2), LDRES ) 70 CONTINUE C WRITE ( NOUT, FMT = 99990 ) MA02ID( 'Hamiltonian', $ 'Frobenius', N, RES(1,N+1), LDRES, RES(1,2*N+1), $ LDRES, DWORK ) END IF END IF END IF * 99999 FORMAT (' TMB04PU EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04PU = ',I2) 99997 FORMAT (' INFO on exit from MB04WP = ',I2) 99996 FORMAT (' The symplectic orthogonal factor U is ') 99995 FORMAT (/' The reduced matrix A is ') 99994 FORMAT (/' The reduced matrix QG is ') 99993 FORMAT (20(1X,F9.4)) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' Orthogonality of U: || U''*U - I ||_F = ',G7.2) 99990 FORMAT (/' Residual: || H - U*R*U'' ||_F = ',G7.2) ENDProgram Data
MB04PU EXAMPLE PROGRAM DATA 5 0.9501 0.7621 0.6154 0.4057 0.0579 0.2311 0.4565 0.7919 0.9355 0.3529 0.6068 0.0185 0.9218 0.9169 0.8132 0.4860 0.8214 0.7382 0.4103 0.0099 0.8913 0.4447 0.1763 0.8936 0.1389 0.4055 0.3869 1.3801 0.7993 1.2019 0.8780 0.2140 1.4936 0.7567 1.7598 1.1956 0.9029 1.0224 1.2913 1.0503 1.6433 0.9346 1.6565 1.1103 0.9515 0.8839 0.7590 0.6824 1.1022 0.7016 1.1755 1.1010 1.1364 0.3793 0.7408Program Results
TMB04PU EXAMPLE PROGRAM RESULTS The symplectic orthogonal factor U is 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1119 0.7763 -0.2005 -0.0001 0.0000 0.1036 -0.2783 -0.2583 0.4356 0.0000 -0.2937 0.2320 0.4014 0.5541 0.0000 0.4949 0.1187 -0.0294 -0.3632 0.0000 -0.2352 -0.2243 -0.7056 -0.0500 0.0000 0.5374 0.3102 -0.0893 0.0318 0.0000 -0.4314 -0.0354 0.2658 -0.6061 0.0000 0.3396 -0.3230 0.3931 0.0207 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1036 0.2783 0.2583 -0.4356 0.0000 -0.1119 0.7763 -0.2005 -0.0001 0.0000 -0.4949 -0.1187 0.0294 0.3632 0.0000 -0.2937 0.2320 0.4014 0.5541 0.0000 -0.5374 -0.3102 0.0893 -0.0318 0.0000 -0.2352 -0.2243 -0.7056 -0.0500 0.0000 -0.3396 0.3230 -0.3931 -0.0207 0.0000 -0.4314 -0.0354 0.2658 -0.6061 Orthogonality of U: || U'*U - I ||_F = .16E-14 The reduced matrix A is 0.9501 -1.8690 0.8413 -0.0344 -0.0817 -2.0660 2.7118 -1.6646 0.7606 -0.0285 0.0000 -2.4884 0.4115 -0.4021 0.3964 0.0000 0.0000 -0.5222 0.1767 -0.3081 0.0000 0.0000 0.0000 0.1915 -0.3426 The reduced matrix QG is 0.4055 0.3869 -0.4295 0.9242 -0.7990 -0.0268 0.0000 -3.0834 -2.5926 0.0804 0.1386 -0.1630 0.0000 0.0000 1.3375 0.9618 -0.0263 0.1829 0.0000 0.0000 0.0000 -0.3556 0.6662 0.2123 0.0000 0.0000 0.0000 0.0000 0.1337 -0.8622 Residual: || H - U*R*U' ||_F = .60E-14
Purpose
To apply a real elementary reflector H to a real m-by-n matrix C, from either the left or the right. H is represented in the form ( 1 ) H = I - tau * u *u', u = ( ), ( v ) where tau is a real scalar and v is a real vector. If tau = 0, then H is taken to be the unit matrix. In-line code is used if H has order < 11.Specification
SUBROUTINE MB04PY( SIDE, M, N, V, TAU, C, LDC, DWORK ) C .. Scalar Arguments .. CHARACTER SIDE INTEGER LDC, M, N DOUBLE PRECISION TAU C .. Array Arguments .. DOUBLE PRECISION C( LDC, * ), DWORK( * ), V( * )Arguments
Mode Parameters
SIDE CHARACTER*1 Indicates whether the elementary reflector should be applied from the left or from the right, as follows: = 'L': Compute H * C; = 'R': Compute C * H.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix C. M >= 0. N (input) INTEGER The number of columns of the matrix C. N >= 0. V (input) DOUBLE PRECISION array, dimension (M-1), if SIDE = 'L', or (N-1), if SIDE = 'R'. The vector v in the representation of H. TAU (input) DOUBLE PRECISION The scalar factor of the elementary reflector H. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the matrix C. On exit, the leading M-by-N part of this array contains the matrix H * C, if SIDE = 'L', or C * H, if SIDE = 'R'. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M).Workspace
DWORK DOUBLE PRECISION array, dimension (N), if SIDE = 'L', or (M), if SIDE = 'R'. DWORK is not referenced if H has order less than 11.Method
The routine applies the elementary reflector H, taking its special structure into account. The multiplications by the first component of u (which is 1) are avoided, to increase the efficiency.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To overwrite general real m-by-n matrices C and D, or their transposes, with [ op(C) ] Q * [ ] if TRANQ = 'N', or [ op(D) ] T [ op(C) ] Q * [ ] if TRANQ = 'T', [ op(D) ] where Q is defined as the product of symplectic reflectors and Givens rotations, Q = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(k),H(k) ) G(k) diag( F(k),F(k) ). Blocked version.Specification
SUBROUTINE MB04QB( TRANC, TRAND, TRANQ, STOREV, STOREW, M, N, K, $ V, LDV, W, LDW, C, LDC, D, LDD, CS, TAU, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER STOREV, STOREW, TRANC, TRAND, TRANQ INTEGER INFO, K, LDC, LDD, LDV, LDW, LDWORK, M, N C .. Array Arguments .. DOUBLE PRECISION C(LDC,*), CS(*), D(LDD,*), DWORK(*), TAU(*), $ V(LDV,*), W(LDW,*)Arguments
Mode Parameters
TRANC CHARACTER*1 Specifies the form of op( C ) as follows: = 'N': op( C ) = C; = 'T': op( C ) = C'; = 'C': op( C ) = C'. TRAND CHARACTER*1 Specifies the form of op( D ) as follows: = 'N': op( D ) = D; = 'T': op( D ) = D'; = 'C': op( D ) = D'. TRANQ CHARACTER*1 = 'N': apply Q; = 'T': apply Q'. STOREV CHARACTER*1 Specifies how the vectors which define the concatenated Householder reflectors contained in V are stored: = 'C': columnwise; = 'R': rowwise. STOREW CHARACTER*1 Specifies how the vectors which define the concatenated Householder reflectors contained in W are stored: = 'C': columnwise; = 'R': rowwise.Input/Output Parameters
M (input) INTEGER The number of rows of the matrices op(C) and op(D). M >= 0. N (input) INTEGER The number of columns of the matrices op(C) and op(D). N >= 0. K (input) INTEGER The number of elementary reflectors whose product defines the matrix Q. M >= K >= 0. V (input) DOUBLE PRECISION array, dimension (LDV,K) if STOREV = 'C', (LDV,M) if STOREV = 'R' On entry with STOREV = 'C', the leading M-by-K part of this array must contain in its columns the vectors which define the elementary reflectors F(i). On entry with STOREV = 'R', the leading K-by-M part of this array must contain in its rows the vectors which define the elementary reflectors F(i). LDV INTEGER The leading dimension of the array V. LDV >= MAX(1,M), if STOREV = 'C'; LDV >= MAX(1,K), if STOREV = 'R'. W (input) DOUBLE PRECISION array, dimension (LDW,K) if STOREW = 'C', (LDW,M) if STOREW = 'R' On entry with STOREW = 'C', the leading M-by-K part of this array must contain in its columns the vectors which define the elementary reflectors H(i). On entry with STOREW = 'R', the leading K-by-M part of this array must contain in its rows the vectors which define the elementary reflectors H(i). LDW INTEGER The leading dimension of the array W. LDW >= MAX(1,M), if STOREW = 'C'; LDW >= MAX(1,K), if STOREW = 'R'. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) if TRANC = 'N', (LDC,M) if TRANC = 'T' or TRANC = 'C' On entry with TRANC = 'N', the leading M-by-N part of this array must contain the matrix C. On entry with TRANC = 'C' or TRANC = 'T', the leading N-by-M part of this array must contain the transpose of the matrix C. On exit with TRANC = 'N', the leading M-by-N part of this array contains the updated matrix C. On exit with TRANC = 'C' or TRANC = 'T', the leading N-by-M part of this array contains the transpose of the updated matrix C. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M), if TRANC = 'N'; LDC >= MAX(1,N), if TRANC = 'T' or TRANC = 'C'. D (input/output) DOUBLE PRECISION array, dimension (LDD,N) if TRAND = 'N', (LDD,M) if TRAND = 'T' or TRAND = 'C' On entry with TRAND = 'N', the leading M-by-N part of this array must contain the matrix D. On entry with TRAND = 'C' or TRAND = 'T', the leading N-by-M part of this array must contain the transpose of the matrix D. On exit with TRAND = 'N', the leading M-by-N part of this array contains the updated matrix D. On exit with TRAND = 'C' or TRAND = 'T', the leading N-by-M part of this array contains the transpose of the updated matrix D. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,M), if TRAND = 'N'; LDD >= MAX(1,N), if TRAND = 'T' or TRAND = 'C'. CS (input) DOUBLE PRECISION array, dimension (2*K) On entry, the first 2*K elements of this array must contain the cosines and sines of the symplectic Givens rotations G(i). TAU (input) DOUBLE PRECISION array, dimension (K) On entry, the first K elements of this array must contain the scalar factors of the elementary reflectors F(i).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -20, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Kressner, D. Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To apply the orthogonal symplectic block reflector [ I+V*T*V' V*R*S*V' ] Q = [ ] [ -V*R*S*V' I+V*T*V' ] or its transpose to a real 2m-by-n matrix [ op(A); op(B) ] from the left. The k-by-k upper triangular blocks of the matrices [ S1 ] [ T11 T12 T13 ] R = [ R1 R2 R3 ], S = [ S2 ], T = [ T21 T22 T23 ], [ S3 ] [ T31 T32 T33 ] with R2 unit and S1, R3, T21, T31, T32 strictly upper triangular, are stored rowwise in the arrays RS and T, respectively.Specification
SUBROUTINE MB04QC( STRAB, TRANA, TRANB, TRANQ, DIRECT, STOREV, $ STOREW, M, N, K, V, LDV, W, LDW, RS, LDRS, T, $ LDT, A, LDA, B, LDB, DWORK ) C .. Scalar Arguments .. CHARACTER DIRECT, STOREV, STOREW, STRAB, TRANA, TRANB, $ TRANQ INTEGER K, LDA, LDB, LDRS, LDT, LDV, LDW, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), RS(LDRS,*), $ T(LDT,*), V(LDV,*), W(LDW,*)Arguments
Mode Parameters
STRAB CHARACTER*1 Specifies the structure of the first blocks of A and B: = 'Z': the leading K-by-N submatrices of op(A) and op(B) are (implicitly) assumed to be zero; = 'N'; no structure to mention. TRANA CHARACTER*1 Specifies the form of op( A ) as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'. TRANB CHARACTER*1 Specifies the form of op( B ) as follows: = 'N': op( B ) = B; = 'T': op( B ) = B'; = 'C': op( B ) = B'. DIRECT CHARACTER*1 This is a dummy argument, which is reserved for future extensions of this subroutine. Not referenced. TRANQ CHARACTER*1 = 'N': apply Q; = 'T': apply Q'. STOREV CHARACTER*1 Specifies how the vectors which define the concatenated Householder reflectors contained in V are stored: = 'C': columnwise; = 'R': rowwise. STOREW CHARACTER*1 Specifies how the vectors which define the concatenated Householder reflectors contained in W are stored: = 'C': columnwise; = 'R': rowwise.Input/Output Parameters
M (input) INTEGER The number of rows of the matrices op(A) and op(B). M >= 0. N (input) INTEGER The number of columns of the matrices op(A) and op(B). N >= 0. K (input) INTEGER The order of the triangular matrices defining R, S and T. M >= K >= 0. V (input) DOUBLE PRECISION array, dimension (LDV,K) if STOREV = 'C', (LDV,M) if STOREV = 'R' On entry with STOREV = 'C', the leading M-by-K part of this array must contain in its columns the vectors which define the elementary reflector used to form parts of Q. On entry with STOREV = 'R', the leading K-by-M part of this array must contain in its rows the vectors which define the elementary reflector used to form parts of Q. LDV INTEGER The leading dimension of the array V. LDV >= MAX(1,M), if STOREV = 'C'; LDV >= MAX(1,K), if STOREV = 'R'. W (input) DOUBLE PRECISION array, dimension (LDW,K) if STOREW = 'C', (LDW,M) if STOREW = 'R' On entry with STOREW = 'C', the leading M-by-K part of this array must contain in its columns the vectors which define the elementary reflector used to form parts of Q. On entry with STOREW = 'R', the leading K-by-M part of this array must contain in its rows the vectors which define the elementary reflector used to form parts of Q. LDW INTEGER The leading dimension of the array W. LDW >= MAX(1,M), if STOREW = 'C'; LDW >= MAX(1,K), if STOREW = 'R'. RS (input) DOUBLE PRECISION array, dimension (K,6*K) On entry, the leading K-by-6*K part of this array must contain the upper triangular matrices defining the factors R and S of the symplectic block reflector Q. The (strictly) lower portions of this array are not referenced. LDRS INTEGER The leading dimension of the array RS. LDRS >= MAX(1,K). T (input) DOUBLE PRECISION array, dimension (K,9*K) On entry, the leading K-by-9*K part of this array must contain the upper triangular matrices defining the factor T of the symplectic block reflector Q. The (strictly) lower portions of this array are not referenced. LDT INTEGER The leading dimension of the array T. LDT >= MAX(1,K). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) if TRANA = 'N', (LDA,M) if TRANA = 'C' or TRANA = 'T' On entry with TRANA = 'N', the leading M-by-N part of this array must contain the matrix A. On entry with TRANA = 'T' or TRANA = 'C', the leading N-by-M part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,M), if TRANA = 'N'; LDA >= MAX(1,N), if TRANA = 'C' or TRANA = 'T'. B (input/output) DOUBLE PRECISION array, dimension (LDB,N) if TRANB = 'N', (LDB,M) if TRANB = 'C' or TRANB = 'T' On entry with TRANB = 'N', the leading M-by-N part of this array must contain the matrix B. On entry with TRANB = 'T' or TRANB = 'C', the leading N-by-M part of this array must contain the matrix B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,M), if TRANB = 'N'; LDB >= MAX(1,N), if TRANB = 'C' or TRANB = 'T'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK), where LDWORK >= 8*N*K, if STRAB = 'Z', LDWORK >= 9*N*K, if STRAB = 'N'.References
[1] Kressner, D. Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Numerical Aspects
The algorithm requires 16*( M - K )*N + ( 26*K - 4 )*K*N floating point operations if STRAB = 'Z' and additional ( 12*K + 2 )*K*N floating point operations if STRAB = 'N'.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To form the triangular block factors R, S and T of a symplectic block reflector SH, which is defined as a product of 2k concatenated Householder reflectors and k Givens rotations, SH = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(k),H(k) ) G(k) diag( F(k),F(k) ). The upper triangular blocks of the matrices [ S1 ] [ T11 T12 T13 ] R = [ R1 R2 R3 ], S = [ S2 ], T = [ T21 T22 T23 ], [ S3 ] [ T31 T32 T33 ] with R2 unit and S1, R3, T21, T31, T32 strictly upper triangular, are stored rowwise in the arrays RS and T, respectively.Specification
SUBROUTINE MB04QF( DIRECT, STOREV, STOREW, N, K, V, LDV, W, LDW, $ CS, TAU, RS, LDRS, T, LDT, DWORK ) C .. Scalar Arguments .. CHARACTER DIRECT, STOREV, STOREW INTEGER K, LDRS, LDT, LDV, LDW, N C .. Array Arguments .. DOUBLE PRECISION CS(*), DWORK(*), RS(LDRS,*), T(LDT,*), $ TAU(*), V(LDV,*), W(LDW,*)Arguments
Mode Parameters
DIRECT CHARACTER*1 This is a dummy argument, which is reserved for future extensions of this subroutine. Not referenced. STOREV CHARACTER*1 Specifies how the vectors which define the concatenated Householder F(i) reflectors are stored: = 'C': columnwise; = 'R': rowwise. STOREW CHARACTER*1 Specifies how the vectors which define the concatenated Householder H(i) reflectors are stored: = 'C': columnwise; = 'R': rowwise.Input/Output Parameters
N (input) INTEGER The order of the Householder reflectors F(i) and H(i). N >= 0. K (input) INTEGER The number of Givens rotations. K >= 1. V (input) DOUBLE PRECISION array, dimension (LDV,K) if STOREV = 'C', (LDV,N) if STOREV = 'R' On entry with STOREV = 'C', the leading N-by-K part of this array must contain in its i-th column the vector which defines the elementary reflector F(i). On entry with STOREV = 'R', the leading K-by-N part of this array must contain in its i-th row the vector which defines the elementary reflector F(i). LDV INTEGER The leading dimension of the array V. LDV >= MAX(1,N), if STOREV = 'C'; LDV >= K, if STOREV = 'R'. W (input) DOUBLE PRECISION array, dimension (LDW,K) if STOREW = 'C', (LDW,N) if STOREW = 'R' On entry with STOREW = 'C', the leading N-by-K part of this array must contain in its i-th column the vector which defines the elementary reflector H(i). On entry with STOREV = 'R', the leading K-by-N part of this array must contain in its i-th row the vector which defines the elementary reflector H(i). LDW INTEGER The leading dimension of the array W. LDW >= MAX(1,N), if STOREW = 'C'; LDW >= K, if STOREW = 'R'. CS (input) DOUBLE PRECISION array, dimension (2*K) On entry, the first 2*K elements of this array must contain the cosines and sines of the symplectic Givens rotations G(i). TAU (input) DOUBLE PRECISION array, dimension (K) On entry, the first K elements of this array must contain the scalar factors of the elementary reflectors F(i). RS (output) DOUBLE PRECISION array, dimension (K,6*K) On exit, the leading K-by-6*K part of this array contains the upper triangular matrices defining the factors R and S of the symplectic block reflector SH. The (strictly) lower portions of this array are not used. LDRS INTEGER The leading dimension of the array RS. LDRS >= K. T (output) DOUBLE PRECISION array, dimension (K,9*K) On exit, the leading K-by-9*K part of this array contains the upper triangular matrices defining the factor T of the symplectic block reflector SH. The (strictly) lower portions of this array are not used. LDT INTEGER The leading dimension of the array T. LDT >= K.Workspace
DWORK DOUBLE PRECISION array, dimension (3*K)References
[1] Kressner, D. Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Numerical Aspects
The algorithm requires ( 4*K - 2 )*K*N + 19/3*K*K*K + 1/2*K*K + 43/6*K - 4 floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
Overwrites general real m-by-n/n-by-m matrices C and D with [ op(C) ] U * [ ] if TRANU = 'N', or [ op(D) ] T [ op(C) ] U * [ ] if TRANU = 'T', [ op(D) ] where U is defined as the product of symplectic reflectors and Givens rotations, U = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(k),H(k) ) G(k) diag( F(k),F(k) ), with k = m-1, as returned by the SLICOT Library routines MB04PU or MB04RU.Specification
SUBROUTINE MB04QS( TRANC, TRAND, TRANU, M, N, ILO, V, LDV, W, LDW, $ C, LDC, D, LDD, CS, TAU, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANC, TRAND, TRANU INTEGER ILO, INFO, LDC, LDD, LDV, LDW, LDWORK, M, N C .. Array Arguments .. DOUBLE PRECISION C(LDC,*), CS(*), D(LDD,*), DWORK(*), TAU(*), $ V(LDV,*), W(LDW,*)Arguments
Mode Parameters
TRANC CHARACTER*1 Specifies the form of op( C ) as follows: = 'N': op( C ) = C; = 'T': op( C ) = C'; = 'C': op( C ) = C'. TRAND CHARACTER*1 Specifies the form of op( D ) as follows: = 'N': op( D ) = D; = 'T': op( D ) = D'; = 'C': op( D ) = D'. TRANU CHARACTER*1 Specifies whether U or U' is applied as follows: = 'N': apply U; = 'T': apply U'.Input/Output Parameters
M (input) INTEGER The number of rows of the matrices op(C) and op(D). M >= 0. N (input) INTEGER The number of columns of the matrices op(C) and op(D). N >= 0. ILO (input) INTEGER ILO must have the same value as in the previous call of MB04PU or MB04RU. U is equal to the unit matrix except in the submatrix U([ilo+1:m m+ilo+1:2*m], [ilo+1:m m+ilo+1:2*m]). 1 <= ILO <= M+1. V (input) DOUBLE PRECISION array, dimension (LDV,M) On entry, the leading M-by-M part of this array must contain in its columns the vectors which define the elementary reflectors H(i). LDV INTEGER The leading dimension of the array V. LDV >= MAX(1,M). W (input) DOUBLE PRECISION array, dimension (LDW,M) On entry, the leading M-by-M part of this array must contain in its columns the vectors which define the elementary reflectors F(i). LDW INTEGER The leading dimension of the array W. LDW >= MAX(1,M). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) if TRANC = 'N', (LDC,M) if TRANC = 'T' or TRANC = 'C'. On entry with TRANC = 'N', the leading M-by-N part of this array must contain the matrix C. On entry with TRANC = 'T' or TRANC = 'C', the leading N-by-M part of this array must contain the transpose of the matrix C. On exit with TRANC = 'N', the leading M-by-N part of this array contains the updated matrix C. On exit with TRANC = 'T' or TRANC = 'C', the leading N-by-M part of this array contains the transpose of the updated matrix C. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M), if TRANC = 'N'; LDC >= MAX(1,N), if TRANC = 'T' or TRANC = 'C'. D (input/output) DOUBLE PRECISION array, dimension (LDD,N) if TRAND = 'N', (LDD,M) if TRAND = 'T' or TRAND = 'C'. On entry with TRAND = 'N', the leading M-by-N part of this array must contain the matrix D. On entry with TRAND = 'T' or TRAND = 'C', the leading N-by-M part of this array must contain the transpose of the matrix D. On exit with TRAND = 'N', the leading M-by-N part of this array contains the updated matrix D. On exit with TRAND = 'T' or TRAND = 'C', the leading N-by-M part of this array contains the transpose of the updated matrix D. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,M), if TRAND = 'N'; LDD >= MAX(1,N), if TRAND = 'T' or TRAND = 'C'. CS (input) DOUBLE PRECISION array, dimension (2*N-2) On entry, the first 2*N-2 elements of this array must contain the cosines and sines of the symplectic Givens rotations G(i), as returned by MB04PU or MB04RU. TAU (input) DOUBLE PRECISION array, dimension (N-1) On entry, the first N-1 elements of this array must contain the scalar factors of the elementary reflectors F(i), as returned by MB04PU or MB04RU.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -18, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To overwrite general real m-by-n matrices C and D, or their transposes, with [ op(C) ] Q * [ ] if TRANQ = 'N', or [ op(D) ] T [ op(C) ] Q * [ ] if TRANQ = 'T', [ op(D) ] where Q is defined as the product of symplectic reflectors and Givens rotations, Q = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(k),H(k) ) G(k) diag( F(k),F(k) ). Unblocked version.Specification
SUBROUTINE MB04QU( TRANC, TRAND, TRANQ, STOREV, STOREW, M, N, K, $ V, LDV, W, LDW, C, LDC, D, LDD, CS, TAU, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER STOREV, STOREW, TRANC, TRAND, TRANQ INTEGER INFO, K, LDC, LDD, LDV, LDW, LDWORK, M, N C .. Array Arguments .. DOUBLE PRECISION CS(*), DWORK(*), C(LDC,*), D(LDD,*), V(LDV,*), $ W(LDW,*), TAU(*)Arguments
Mode Parameters
TRANC CHARACTER*1 Specifies the form of op( C ) as follows: = 'N': op( C ) = C; = 'T': op( C ) = C'; = 'C': op( C ) = C'. STOREV CHARACTER*1 Specifies how the vectors which define the concatenated Householder reflectors contained in V are stored: = 'C': columnwise; = 'R': rowwise. STOREW CHARACTER*1 Specifies how the vectors which define the concatenated Householder reflectors contained in W are stored: = 'C': columnwise; = 'R': rowwise. TRAND CHARACTER*1 Specifies the form of op( D ) as follows: = 'N': op( D ) = D; = 'T': op( D ) = D'; = 'C': op( D ) = D'. TRANQ CHARACTER*1 = 'N': apply Q; = 'T': apply Q'.Input/Output Parameters
M (input) INTEGER The number of rows of the matrices op(C) and op(D). M >= 0. N (input) INTEGER The number of columns of the matrices op(C) and op(D). N >= 0. K (input) INTEGER The number of elementary reflectors whose product defines the matrix Q. M >= K >= 0. V (input) DOUBLE PRECISION array, dimension (LDV,K) if STOREV = 'C', (LDV,M) if STOREV = 'R' On entry with STOREV = 'C', the leading M-by-K part of this array must contain in its columns the vectors which define the elementary reflectors F(i). On entry with STOREV = 'R', the leading K-by-M part of this array must contain in its rows the vectors which define the elementary reflectors F(i). LDV INTEGER The leading dimension of the array V. LDV >= MAX(1,M), if STOREV = 'C'; LDV >= MAX(1,K), if STOREV = 'R'. W (input) DOUBLE PRECISION array, dimension (LDW,K) if STOREW = 'C', (LDW,M) if STOREW = 'R' On entry with STOREW = 'C', the leading M-by-K part of this array must contain in its columns the vectors which define the elementary reflectors H(i). On entry with STOREW = 'R', the leading K-by-M part of this array must contain in its rows the vectors which define the elementary reflectors H(i). LDW INTEGER The leading dimension of the array W. LDW >= MAX(1,M), if STOREW = 'C'; LDW >= MAX(1,K), if STOREW = 'R'. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) if TRANC = 'N', (LDC,M) if TRANC = 'T' or TRANC = 'C' On entry with TRANC = 'N', the leading M-by-N part of this array must contain the matrix C. On entry with TRANC = 'C' or TRANC = 'T', the leading N-by-M part of this array must contain the transpose of the matrix C. On exit with TRANC = 'N', the leading M-by-N part of this array contains the updated matrix C. On exit with TRANC = 'C' or TRANC = 'T', the leading N-by-M part of this array contains the transpose of the updated matrix C. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M), if TRANC = 'N'; LDC >= MAX(1,N), if TRANC = 'T' or TRANC = 'C'. D (input/output) DOUBLE PRECISION array, dimension (LDD,N) if TRAND = 'N', (LDD,M) if TRAND = 'T' or TRAND = 'C' On entry with TRAND = 'N', the leading M-by-N part of this array must contain the matrix D. On entry with TRAND = 'C' or TRAND = 'T', the leading N-by-M part of this array must contain the transpose of the matrix D. On exit with TRAND = 'N', the leading M-by-N part of this array contains the updated matrix D. On exit with TRAND = 'C' or TRAND = 'T', the leading N-by-M part of this array contains the transpose of the updated matrix D. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,M), if TRAND = 'N'; LDD >= MAX(1,N), if TRAND = 'T' or TRAND = 'C'. CS (input) DOUBLE PRECISION array, dimension (2*K) On entry, the first 2*K elements of this array must contain the cosines and sines of the symplectic Givens rotations G(i). TAU (input) DOUBLE PRECISION array, dimension (K) On entry, the first K elements of this array must contain the scalar factors of the elementary reflectors F(i).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -20, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce a skew-Hamiltonian matrix, [ A G ] W = [ T ] , [ Q A ] where A is an N-by-N matrix and G, Q are N-by-N skew-symmetric matrices, to Paige/Van Loan (PVL) form. That is, an orthogonal symplectic matrix U is computed so that T [ Aout Gout ] U W U = [ T ] , [ 0 Aout ] where Aout is in upper Hessenberg form. Blocked version.Specification
SUBROUTINE MB04RB( N, ILO, A, LDA, QG, LDQG, CS, TAU, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER ILO, INFO, LDA, LDQG, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), CS(*), DWORK(*), QG(LDQG,*), TAU(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. ILO (input) INTEGER It is assumed that A is already upper triangular and Q is zero in rows and columns 1:ILO-1. ILO is normally set by a previous call to the SLICOT Library routine MB04DS; otherwise it should be set to 1. 1 <= ILO <= N+1, if N > 0; ILO = 1, if N = 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 Aout and, in the zero part of Aout, information about the elementary reflectors used to compute the PVL factorization. LDA INTEGER The leading dimension of the array A. LDA >= 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 superdiagonal of this array are not referenced. On exit, the leading N-by-N+1 part of this array contains in its first N-1 columns information about the elementary reflectors used to compute the PVL factorization and in its last N columns the strictly upper triangular part of the matrix Gout. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N). CS (output) DOUBLE PRECISION array, dimension (2N-2) On exit, the first 2N-2 elements of this array contain the cosines and sines of the symplectic Givens rotations used to compute the PVL factorization. TAU (output) DOUBLE PRECISION array, dimension (N-1) On exit, the first N-1 elements of this array contain the scalar factors of some of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, 8*N*NB + 3*NB, where NB is the optimal block size. On exit, if INFO = -10, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N-1). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
An algorithm similar to the block algorithm for the symplectic URV factorization described in [2] is used. The matrix U is represented as a product of symplectic reflectors and Givens rotations U = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(n-1),H(n-1) ) G(n-1) diag( F(n-1),F(n-1) ). Each H(i) has the form H(i) = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in QG(i+2:n,i), and tau in QG(i+1,i). Each F(i) has the form F(i) = I - nu * w * w' where nu is a real scalar, and w is a real vector with w(1:i) = 0 and w(i+1) = 1; w(i+2:n) is stored on exit in A(i+2:n,i), and nu in TAU(i). Each G(i) is a Givens rotation acting on rows i+1 and n+i+1, where the cosine is stored in CS(2*i-1) and the sine in CS(2*i).Numerical Aspects
The algorithm requires O(N**3) floating point operations and is strongly backward stable.References
[1] Van Loan, C.F. A symplectic method for approximating all the eigenvalues of a Hamiltonian matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984. [2] Kressner, D. Block algorithms for orthogonal symplectic factorizations. BIT, 43(4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce a real matrix pair (A,B) in generalized real Schur form to a block-diagonal form using well-conditioned non-orthogonal equivalence transformations. The condition numbers of the left and right transformations used for the reduction are roughly bounded by PMAX, where PMAX is a given value. The transformations are optionally postmultiplied in the given matrices X and Y. The generalized Schur form is optionally ordered, so that clustered eigenvalues are grouped in the same pair of blocks.Specification
SUBROUTINE MB04RD( JOBX, JOBY, SORT, N, PMAX, A, LDA, B, LDB, X, $ LDX, Y, LDY, NBLCKS, BLSIZE, ALPHAR, ALPHAI, $ BETA, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBX, JOBY, SORT INTEGER INFO, LDA, LDB, LDWORK, LDX, LDY, N, NBLCKS DOUBLE PRECISION PMAX, TOL C .. Array Arguments .. INTEGER BLSIZE(*), IWORK(*) DOUBLE PRECISION A(LDA,*), ALPHAI(*), ALPHAR(*), B(LDB,*), $ BETA(*), DWORK(*), X(LDX,*), Y(LDY,*)Arguments
Mode Parameters
JOBX CHARACTER*1 Specifies whether or not the left transformations are accumulated, as follows: = 'N': The left transformations are not accumulated; = 'U': The left transformations are accumulated in X (the given matrix X is updated). JOBY CHARACTER*1 Specifies whether or not the right transformations are accumulated, as follows: = 'N': The right transformations are not accumulated; = 'U': The right transformations are accumulated in Y (the given matrix Y is updated). SORT CHARACTER*1 Specifies whether or not the diagonal blocks of the generalized real Schur form are reordered, as follows: = 'N': The diagonal blocks are not reordered; = 'S': The diagonal blocks are reordered before each step of reduction, so that clustered eigenvalues appear in the same pair of blocks. = 'C': The diagonal blocks are not reordered, but the "closest-neighbour" strategy is used instead of the standard "closest to the mean" strategy (see METHOD); = 'B': The diagonal blocks are reordered before each step of reduction, and the "closest-neighbour" strategy is used (see METHOD).Input/Output Parameters
N (input) INTEGER The order of the matrices A, B, X and Y. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the absolute value of the elements of the individual transformations used for reduction (see METHOD and FURTHER COMMENTS). PMAX >= 1.0D0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N upper quasi-triangular part of this array must contain the upper quasi-triangular matrix A in the generalized real Schur form, as returned by the LAPACK Library routine DGGES. The lower triangular part below the Schur matrix is used as workspace. On exit, the leading N-by-N upper quasi-triangular part of this array contains the computed block-diagonal matrix, in real Schur canonical form, corresponding to the given matrix A. The remaining part is set to zero. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix B in the generalized real Schur form, as returned by the LAPACK Library routine DGGES. The diagonal elements of B are non-negative. The strictly lower triangular part is used as workspace. The matrix B is assumed nonzero. On exit, the leading N-by-N upper triangular part of this array contains the computed upper triangular block- diagonal matrix, corresponding to the given matrix B. The remaining part is set to zero. The diagonal elements of B are non-negative. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). X (input/output) DOUBLE PRECISION array, dimension (LDX,*) On entry, if JOBX = 'U', the leading N-by-N part of this array must contain a given matrix X, for instance the left transformation matrix VSL returned by the LAPACK Library routine DGGES. On exit, if JOBX = 'U', the leading N-by-N part of this array contains the product of the given matrix X and the left transformation matrix that reduced (A,B) to block- diagonal form. The local transformation matrix is itself a product of non-orthogonal equivalence transformations having elements with magnitude less than or equal to PMAX. If JOBX = 'N', this array is not referenced. LDX INTEGER The leading dimension of the array X. LDX >= 1, if JOBX = 'N'; LDX >= MAX(1,N), if JOBX = 'U'. Y (input/output) DOUBLE PRECISION array, dimension (LDY,*) On entry, if JOBY = 'U', the leading N-by-N part of this array must contain a given matrix Y, for instance the right transformation matrix VSR returned by the LAPACK Library routine DGGES. On exit, if JOBY = 'U', the leading N-by-N part of this array contains the product of the given matrix Y and the right transformation matrix that reduced (A,B) to block- diagonal form. The local transformation matrix is itself a product of non-orthogonal equivalence transformations having elements with magnitude less than or equal to PMAX. If JOBY = 'N', this array is not referenced. LDY INTEGER The leading dimension of the array Y. LDY >= 1, if JOBY = 'N'; LDY >= MAX(1,N), if JOBY = 'U'. NBLCKS (output) INTEGER The number of diagonal blocks of the matrices A and B. BLSIZE (output) INTEGER array, dimension (N) The first NBLCKS elements of this array contain the orders of the resulting diagonal blocks of the matrices A and B. ALPHAR (output) DOUBLE PRECISION array, dimension (N) ALPHAI (output) DOUBLE PRECISION array, dimension (N) BETA (output) DOUBLE PRECISION array, dimension (N) On exit, if INFO = 0, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j = 1, ..., N, will be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i, and BETA(j), j = 1, ..., N, are the diagonals of the complex Schur form (S,T) that would result if the 2-by-2 diagonal blocks of the real Schur form of (A,B) were further reduced to triangular form using 2-by-2 complex unitary transformations. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative. All BETA(j) are non-negative real numbers. The quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. Thus, the user should avoid naively computing the ratio. If A and B are obtained from general matrices using DGGES, ALPHA will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).Tolerances
TOL DOUBLE PRECISION If SORT = 'S' or 'B', the tolerance to be used in the ordering of the diagonal blocks of the upper triangular matrix pair. If the user sets TOL > 0, then the given value of TOL is used as an absolute tolerance: a pair of blocks i and a temporarily fixed pair of blocks 1 (the first pair of blocks of the current trailing pair of submatrices to be reduced) are considered to belong to the same cluster if their eigenvalues satisfy the following "distance" condition | lambda_1 - lambda_i | <= TOL. If the user sets TOL < 0, then the given value of TOL is used as a relative tolerance: a pair of blocks i and a temporarily fixed pair of blocks 1 are considered to belong to the same cluster if their eigenvalues satisfy, for finite lambda_j, j = 1, ..., N, | lambda_1 - lambda_i | <= | TOL | * max | lambda_j |. If the user sets TOL = 0, then an implicitly computed, default tolerance, defined by TOL = SQRT( SQRT( EPS ) ) is used instead, as a relative tolerance, where EPS is the machine precision (see LAPACK Library routine DLAMCH). The approximate symmetric chordal metric is used as "distance" of two complex, possibly infinite numbers, x and y. This metric is given by the formula d(x,y) = min( |x-y|, |1/x-1/y| ), taking into account the special cases of infinite or NaN values. If SORT = 'N' or 'C', this parameter is not referenced.Workspace
IWORK INTEGER array, dimension (N+6) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. On exit, if INFO = -21, DWORK(1) returns the minimum value of LDWORK. When LDWORK = 0 is set on entry, the routine will return this value for INFO, and also set DWORK(1), but no error message related to LDWORK is issued by XERBLA. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 1, if N <= 1; LDWORK >= 4*N + 16, if N > 1. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the matrix pencil defined by A and B is singular.Method
Consider first that SORT = 'N'. Let ( A A ) ( B B ) ( 11 12 ) ( 11 12 ) A = ( ), B = ( ), ( 0 A ) ( 0 B ) ( 22 ) ( 22 ) be the given matrix pair in generalized real Schur form, where initially A and B are the first pair of diagonal blocks of 11 11 dimension 1-by-1 or 2-by-2. An attempt is made to compute the transformation matrices X and Y of the form ( I V ) ( I W ) X = ( ), Y = ( ) (1) ( 0 I ) ( 0 I ) (partitioned as A and B ), so that (' denotes the transpose) ( A 0 ) ( B 0 ) ( 11 ) ( 11 ) X' A Y = ( ), X' B Y = ( ), ( 0 A ) ( 0 B ) ( 22 ) ( 22 ) and the elements of V and W do not exceed the value PMAX in magnitude. An adaptation of the standard method for solving generalized Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2], is used to obtain V and W. When this attempt fails, a 1-by-1 (or 2-by-2) pair of diagonal blocks of (A , B ), whose eigenvalue(s) is 22 22 (are) the closest to the mean of those of (A , B ) is selected, 11 11 and moved by orthogonal equivalence transformations in the leading position of (A , B ); the moved diagonal blocks in A and B are 22 22 then added to the blocks A and B , respectively, increasing 11 11 their order by 1 (or 2). Another attempt is made to compute suitable transformation matrices X and Y with the new definitions of the blocks A , A , B , and B . After successful 11 22 11 22 transformation matrices X and Y have been obtained, they postmultiply the current transformation matrices (if JOBX = 'U' and/or JOBY = 'U') and the whole procedure is repeated for the new blocks A and B . 22 22 When SORT = 'S', the diagonal blocks of the generalized real Schur form are reordered before each step of the reduction, so that each cluster of generalized eigenvalues, defined as specified in the definition of TOL, appears in adjacent blocks. The blocks for each cluster are merged together, and the procedure described above is applied to the larger blocks. Using the option SORT = 'S' will usually provide better efficiency than the standard option (SORT = 'N'), proposed in [2], because there could be no or few unsuccessful attempts to compute individual transformation matrices X and Y of the form (1). However, the resulting dimensions of the blocks are usually larger; this could make subsequent calculations less efficient. When SORT = 'C' or 'B', the procedure is similar to that for SORT = 'N' or 'S', respectively, but the blocks of A and B 22 22 whose eigenvalue(s) is (are) the closest to those of (A , B ) 11 11 (not to their mean) are selected and moved to the leading position of A and B . This is called the "closest-neighbour" strategy. 22 22References
[1] Kagstrom, B. and Westin, L. Generalized Schur Methods with Condition Estimators for Solving the Generalized Sylvester Equation. IEEE Trans. Auto. Contr., 34, pp. 745-751, 1989. [2] Bavely, C. and Stewart, G.W. An Algorithm for Computing Reducing Subspaces by Block Diagonalization. SIAM J. Numer. Anal., 16, pp. 359-367, 1979. [3] Demmel, J. The Condition Number of Equivalence Transformations that Block Diagonalize Matrix Pencils. SIAM J. Numer. Anal., 20, pp. 599-610, 1983.Numerical Aspects
3 4 The algorithm usually requires 0(N ) operations, but 0(N ) are possible in the worst case, when the matrix pencil cannot be diagonalized by well-conditioned transformations.Further Comments
The individual non-orthogonal transformation matrices used in the reduction of A and B to a block-diagonal form have condition numbers of the order PMAX. This does not guarantee that their product is well-conditioned enough. The routine can be easily modified to provide estimates for the condition numbers of the clusters of generalized eigenvalues.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04RS.html 0000664 0000000 0000000 00000015733 14560147231 0020372 0 ustar 00root root 0000000 0000000
Purpose
To solve the generalized real Sylvester equation A * R - L * B = scale * C, (1) D * R - L * E = scale * F, using Level 1 and 2 BLAS, where R and L are unknown real M-by-N matrices, and (A, D), (B, E) and (C, F) are given matrix pairs of size M-by-M, N-by-N and M-by-N, respectively. (A,D) and (B,E) must be in generalized Schur canonical form, i.e., A, B are upper quasi-triangular and D, E are upper triangular. The solution (R, L) overwrites (C, F). 0 <= SCALE <= 1 is an output scaling factor chosen to avoid overflow. This routine is intended to be called only by SLICOT Library routine MB04RT. For efficiency purposes, the computations are aborted when the absolute value of an element of R or L is greater than a given value PMAX.Specification
SUBROUTINE MB04RS( M, N, PMAX, A, LDA, B, LDB, C, LDC, D, LDD, E, $ LDE, F, LDF, SCALE, IWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDF, M, N DOUBLE PRECISION PMAX, SCALE C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), E( LDE, * ), F( LDF, * )Arguments
Input/Output Parameters
M (input) INTEGER The order of the matrices A and D, and the row dimension of C, F, R and L. M >= 0. N (input) INTEGER The order of the matrices B and E, and the column dimension of C, F, R and L. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the absolute value of the elements of the solution (R, L). PMAX >= 1.0D0. A (input) DOUBLE PRECISION array, dimension (LDA, M) On entry, the leading M-by-M upper quasi-triangular part of this array must contain the matrix A in the generalized real Schur form, as returned by LAPACK routine DGGES. LDA INTEGER The leading dimension of the array A. LDA >= max(1, M). B (input) DOUBLE PRECISION array, dimension (LDB, N) On entry, the leading N-by-N upper quasi-triangular part of this array must contain the matrix B in the generalized real Schur form. LDB INTEGER The leading dimension of the array B. LDB >= max(1, N). C (input/output) DOUBLE PRECISION array, dimension (LDC, N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the first matrix equation in (1). On exit, if INFO = 0, the leading M-by-N part of this array contains the solution R. LDC INTEGER The leading dimension of the array C. LDC >= max(1, M). D (input) DOUBLE PRECISION array, dimension (LDD, M) On entry, the leading M-by-M upper triangular part of this array must contain the matrix D in the generalized real Schur form. The diagonal elements are non-negative. LDD INTEGER The leading dimension of the array D. LDD >= max(1, M). E (input) DOUBLE PRECISION array, dimension (LDE, N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix E in the generalized real Schur form. The diagonal elements are non-negative. LDE INTEGER The leading dimension of the array E. LDE >= max(1, N). F (input/output) DOUBLE PRECISION array, dimension (LDF, N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the second matrix equation in (1). On exit, if INFO = 0, the leading M-by-N part of this array contains the solution L. LDF INTEGER The leading dimension of the array F. LDF >= max(1, M). SCALE (output) DOUBLE PRECISION On exit, 0 <= SCALE <= 1. If 0 < SCALE < 1, the solutions R and L (C and F on entry) will hold the solutions to a slightly perturbed system but the input matrices A, B, D and E have not been changed. If SCALE = 0, R and L will hold the solutions to the homogeneous system with C = 0 and F = 0. Normally, SCALE = 1.Workspace
IWORK INTEGER array, dimension (M+N+2)Error Indicator
INFO INTEGER = 0: successful exit; = 1: an element of R or L had the absolute value greater than the given value PMAX. = 2: the matrix pairs (A, D) and (B, E) have common or very close eigenvalues. The matrix Z in section METHOD is (almost) singular.Method
The routine uses an adaptation of the method for solving generalized Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2]. In matrix notation, solving equation (1) corresponds to solve Zx = scale * b, where Z is defined as Z = [ kron(In, A) -kron(B', Im) ] (2) [ kron(In, D) -kron(E', Im) ], Ik is the identity matrix of size k and X' is the transpose of X. kron(X, Y) is the Kronecker product between the matrices X and Y. The routine solves a number of systems (2) with n and m at most 2.References
[1] Kagstrom, B. and Westin, L. Generalized Schur Methods with Condition Estimators for Solving the Generalized Sylvester Equation. IEEE Trans. Auto. Contr., 34, pp. 745-751, 1989. [2] Kagstrom, B. and Westin, L. GSYLV - Fortran Routines for the Generalized Schur Method with Dif Estimators for Solving the Generalized Sylvester Equation. Report UMINF-132.86, Institute of Information Processing, Univ. of Umea, Sweden, July 1987.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve the generalized real Sylvester equation A * R - L * B = scale * C, (1) D * R - L * E = scale * F, using Level 3 BLAS, where R and L are unknown M-by-N matrices, and (A, D), (B, E) and (C, F) are given real matrix pairs of size M-by-M, N-by-N and M-by-N, respectively. (A,D) and (B,E) must be in generalized Schur canonical form, i.e., A, B are upper quasi- triangular and D, E are upper triangular. The solution (R, L) overwrites (C, F). 0 <= SCALE <= 1 is an output scaling factor chosen to avoid overflow. This routine is intended to be called only by SLICOT Library routine MB04RD. For efficiency purposes, the computations are aborted when the absolute value of an element of R or L is greater than a given value PMAX.Specification
SUBROUTINE MB04RT( M, N, PMAX, A, LDA, B, LDB, C, LDC, D, LDD, E, $ LDE, F, LDF, SCALE, IWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDF, M, N DOUBLE PRECISION PMAX, SCALE C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), E( LDE, * ), F( LDF, * )Arguments
Input/Output Parameters
M (input) INTEGER The order of the matrices A and D, and the row dimension of C, F, R and L. M >= 0. N (input) INTEGER The order of the matrices B and E, and the column dimension of C, F, R and L. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the absolute value of the elements of the solution (R, L). PMAX >= 1.0D0. A (input) DOUBLE PRECISION array, dimension (LDA, M) On entry, the leading M-by-M upper quasi-triangular part of this array must contain the matrix A in the generalized real Schur form, as returned by LAPACK routine DGGES. LDA INTEGER The leading dimension of the array A. LDA >= max(1, M). B (input) DOUBLE PRECISION array, dimension (LDB, N) On entry, the leading N-by-N upper quasi-triangular part of this array must contain the matrix B in the generalized real Schur form. LDB INTEGER The leading dimension of the array B. LDB >= max(1, N). C (input/output) DOUBLE PRECISION array, dimension (LDC, N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the first matrix equation in (1). On exit, if INFO = 0, the leading M-by-N part of this array contains the solution R. LDC INTEGER The leading dimension of the array C. LDC >= max(1, M). D (input) DOUBLE PRECISION array, dimension (LDD, M) On entry, the leading M-by-M upper triangular part of this array must contain the matrix D in the generalized real Schur form. The diagonal elements are non-negative. LDD INTEGER The leading dimension of the array D. LDD >= max(1, M). E (input) DOUBLE PRECISION array, dimension (LDE, N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix E in the generalized real Schur form. The diagonal elements are non-negative. LDE INTEGER The leading dimension of the array E. LDE >= max(1, N). F (input/output) DOUBLE PRECISION array, dimension (LDF, N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the second matrix equation in (1). On exit, if INFO = 0, the leading M-by-N part of this array contains the solution L. LDF INTEGER The leading dimension of the array F. LDF >= max(1, M). SCALE (output) DOUBLE PRECISION On exit, 0 <= SCALE <= 1. If 0 < SCALE < 1, the solutions R and L (C and F on entry) will hold the solutions to a slightly perturbed system but the input matrices A, B, D and E have not been changed. If SCALE = 0, R and L will hold the solutions to the homogeneous system with C = 0 and F = 0. Normally, SCALE = 1.Workspace
IWORK INTEGER array, dimension (M+N+6)Error Indicator
INFO INTEGER = 0: successful exit; = 1: an element of R or L had the absolute value greater than the given value PMAX. = 2: the matrix pairs (A, D) and (B, E) have common or very close eigenvalues. The matrix Z in section METHOD is (almost) singular.Method
The routine uses an adaptation of the method for solving generalized Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2]. In matrix notation, solving equation (1) corresponds to solve Zx = scale * b, where Z is defined as Z = [ kron(In, A) -kron(B', Im) ] (2) [ kron(In, D) -kron(E', Im) ], Ik is the identity matrix of size k and X' is the transpose of X. kron(X, Y) is the Kronecker product between the matrices X and Y.References
[1] Kagstrom, B. and Westin, L. Generalized Schur Methods with Condition Estimators for Solving the Generalized Sylvester Equation. IEEE Trans. Auto. Contr., 34, pp. 745-751, 1989. [2] Kagstrom, B. and Westin, L. GSYLV - Fortran Routines for the Generalized Schur Method with Dif Estimators for Solving the Generalized Sylvester Equation. Report UMINF-132.86, Institute of Information Processing, Univ. of Umea, Sweden, July 1987. [3] Kagstrom, B. A Perturbation Analysis of the Generalized Sylvester Equation (AR - LB, DR - LE ) = (C, F). SIAM J. Matrix Anal. Appl., 15(4), pp. 1045-1060, 1994. [4] Kagstrom, B. and Poromaa, P. LAPACK-Style Algorithms and Software for Solving the Generalized Sylvester Equation and Estimating the Separation between Regular Matrix Pairs. ACM Trans. on Math. Software, 22(1), pp. 78103, 1996.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04RU.html 0000664 0000000 0000000 00000013502 14560147231 0020364 0 ustar 00root root 0000000 0000000
Purpose
To reduce a skew-Hamiltonian matrix, [ A G ] W = [ T ] , [ Q A ] where A is an N-by-N matrix and G, Q are N-by-N skew-symmetric matrices, to Paige/Van Loan (PVL) form. That is, an orthogonal symplectic matrix U is computed so that T [ Aout Gout ] U W U = [ T ] , [ 0 Aout ] where Aout is in upper Hessenberg form. Unblocked version.Specification
SUBROUTINE MB04RU( N, ILO, A, LDA, QG, LDQG, CS, TAU, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER ILO, INFO, LDA, LDQG, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), CS(*), DWORK(*), QG(LDQG,*), TAU(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. ILO (input) INTEGER It is assumed that A is already upper triangular and Q is zero in rows and columns 1:ILO-1. ILO is normally set by a previous call to the SLICOT Library routine MB04DS; otherwise it should be set to 1. 1 <= ILO <= N+1, if N > 0; ILO = 1, if N = 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 Aout and, in the zero part of Aout, information about the elementary reflectors used to compute the PVL factorization. LDA INTEGER The leading dimension of the array A. LDA >= 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 superdiagonal of this array are not referenced. On exit, the leading N-by-N+1 part of this array contains in its first N-1 columns information about the elementary reflectors used to compute the PVL factorization and in its last N columns the strictly upper triangular part of the matrix Gout. LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N). CS (output) DOUBLE PRECISION array, dimension (2N-2) On exit, the first 2N-2 elements of this array contain the cosines and sines of the symplectic Givens rotations used to compute the PVL factorization. TAU (output) DOUBLE PRECISION array, dimension (N-1) On exit, the first N-1 elements of this array contain the scalar factors of some of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -10, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N-1).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix U is represented as a product of symplectic reflectors and Givens rotations U = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(n-1),H(n-1) ) G(n-1) diag( F(n-1),F(n-1) ). Each H(i) has the form H(i) = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in QG(i+2:n,i), and tau in QG(i+1,i). Each F(i) has the form F(i) = I - nu * w * w' where nu is a real scalar, and w is a real vector with w(1:i) = 0 and w(i+1) = 1; w(i+2:n) is stored on exit in A(i+2:n,i), and nu in TAU(i). Each G(i) is a Givens rotation acting on rows i+1 and n+i+1, where the cosine is stored in CS(2*i-1) and the sine in CS(2*i).Numerical Aspects
The algorithm requires 40/3 N**3 + O(N) floating point operations and is strongly backward stable.References
[1] Van Loan, C.F. A symplectic method for approximating all the eigenvalues of a Hamiltonian matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve the generalized complex Sylvester equation A * R - L * B = scale * C, (1) D * R - L * E = scale * F, using Level 1 and 2 BLAS, where R and L are unknown M-by-N matrices, and (A, D), (B, E) and (C, F) are given matrix pairs of size M-by-M, N-by-N and M-by-N, respectively. A, B, D and E are complex upper triangular (i.e., (A,D) and (B,E) are in generalized Schur form). The solution (R, L) overwrites (C, F). 0 <= SCALE <= 1 is an output scaling factor chosen to avoid overflow. This routine is intended to be called only by SLICOT Library routine MB04RW. For efficiency purposes, the computations are aborted when the absolute value of an element of R or L is greater than a given value PMAX.Specification
SUBROUTINE MB04RV( M, N, PMAX, A, LDA, B, LDB, C, LDC, D, LDD, E, $ LDE, F, LDF, SCALE, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDF, M, N DOUBLE PRECISION PMAX, SCALE C .. Array Arguments .. COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), E( LDE, * ), F( LDF, * )Arguments
Input/Output Parameters
M (input) INTEGER The order of the matrices A and D, and the row dimension of C, F, R and L. M >= 0. N (input) INTEGER The order of the matrices B and E, and the column dimension of C, F, R and L. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the "absolute value" of the elements of the solution (R, L). (See FURTHER COMMENTS.) PMAX >= 1.0D0. A (input) COMPLEX*16 array, dimension (LDA, M) On entry, the leading M-by-M upper triangular part of this array must contain the matrix A in the generalized complex Schur form, as returned by LAPACK routine ZGGES. LDA INTEGER The leading dimension of the array A. LDA >= max(1, M). B (input) COMPLEX*16 array, dimension (LDB, N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix B in the generalized complex Schur form. LDB INTEGER The leading dimension of the array B. LDB >= max(1, N). C (input/output) COMPLEX*16 array, dimension (LDC, N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the first matrix equation in (1). On exit, if INFO = 0, the leading M-by-N part of this array contains the solution R. LDC INTEGER The leading dimension of the array C. LDC >= max(1, M). D (input) COMPLEX*16 array, dimension (LDD, M) On entry, the leading M-by-M upper triangular part of this array must contain the matrix D in the generalized complex Schur form. The diagonal elements are non-negative real. LDD INTEGER The leading dimension of the array D. LDD >= max(1, M). E (input) COMPLEX*16 array, dimension (LDE, N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix E in the generalized complex Schur form. The diagonal elements are non-negative real. LDE INTEGER The leading dimension of the array E. LDE >= max(1, N). F (input/output) COMPLEX*16 array, dimension (LDF, N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the second matrix equation in (1). On exit, if INFO = 0, the leading M-by-N part of this array contains the solution L. LDF INTEGER The leading dimension of the array F. LDF >= max(1, M). SCALE (output) DOUBLE PRECISION On exit, 0 <= SCALE <= 1. If 0 < SCALE < 1, the solutions R and L (C and F on entry) will hold the solutions to a slightly perturbed system but the input matrices A, B, D and E have not been changed. If SCALE = 0, R and L will hold the solutions to the homogeneous system with C = 0 and F = 0. Normally, SCALE = 1.Error Indicator
INFO INTEGER = 0: successful exit; = 1: an element of R or L had the absolute value greater than the given value PMAX. = 2: the matrix pairs (A, D) and (B, E) have common or very close eigenvalues. The matrix Z in section METHOD is (almost) singular.Method
The routine uses an adaptation of the method for solving generalized Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2]. In matrix notation, solving equation (1) corresponds to solve Zx = scale * b, where Z is defined as Z = [ kron(In, A) -kron(B', Im) ] (2) [ kron(In, D) -kron(E', Im) ], Ik is the identity matrix of size k and X' is the transpose of X. kron(X, Y) is the Kronecker product between the matrices X and Y.References
[1] Kagstrom, B. and Westin, L. Generalized Schur Methods with Condition Estimators for Solving the Generalized Sylvester Equation. IEEE Trans. Auto. Contr., 34, pp. 745-751, 1989. [2] Kagstrom, B. and Westin, L. GSYLV - Fortran Routines for the Generalized Schur Method with Dif Estimators for Solving the Generalized Sylvester Equation. Report UMINF-132.86, Institute of Information Processing, Univ. of Umea, Sweden, July 1987.Further Comments
For efficiency reasons, the "absolute value" of a complex number x is computed as |real(x)| + |imag(x)|.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve the generalized complex Sylvester equation A * R - L * B = scale * C, (1) D * R - L * E = scale * F, using Level 3 BLAS, where R and L are unknown M-by-N matrices, and (A, D), (B, E) and (C, F) are given matrix pairs of size M-by-M, N-by-N and M-by-N, respectively. A, B, D and E are complex upper triangular (i.e., (A,D) and (B,E) are in generalized Schur form). The solution (R, L) overwrites (C, F). 0 <= SCALE <= 1 is an output scaling factor chosen to avoid overflow. This routine is intended to be called only by SLICOT Library routine MB04RZ. For efficiency purposes, the computations are aborted when the absolute value of an element of R or L is greater than a given value PMAX.Specification
SUBROUTINE MB04RW( M, N, PMAX, A, LDA, B, LDB, C, LDC, D, LDD, E, $ LDE, F, LDF, SCALE, IWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDF, M, N DOUBLE PRECISION PMAX, SCALE C .. Array Arguments .. INTEGER IWORK( * ) COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), E( LDE, * ), F( LDF, * )Arguments
Input/Output Parameters
M (input) INTEGER The order of the matrices A and D, and the row dimension of C, F, R and L. M >= 0. N (input) INTEGER The order of the matrices B and E, and the column dimension of C, F, R and L. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the "absolute value" of the elements of the solution (R, L). (See FURTHER COMMENTS.) PMAX >= 1.0D0. A (input) COMPLEX*16 array, dimension (LDA, M) On entry, the leading M-by-M upper triangular part of this array must contain the matrix A in the generalized complex Schur form, as returned by LAPACK routine ZGGES. LDA INTEGER The leading dimension of the array A. LDA >= max(1, M). B (input) COMPLEX*16 array, dimension (LDB, N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix B in the generalized complex Schur form. LDB INTEGER The leading dimension of the array B. LDB >= max(1, N). C (input/output) COMPLEX*16 array, dimension (LDC, N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the first matrix equation in (1). On exit, if INFO = 0, the leading M-by-N part of this array contains the solution R. LDC INTEGER The leading dimension of the array C. LDC >= max(1, M). D (input) COMPLEX*16 array, dimension (LDD, M) On entry, the leading M-by-M upper triangular part of this array must contain the matrix D in the generalized complex Schur form. The diagonal elements are non-negative real. LDD INTEGER The leading dimension of the array D. LDD >= max(1, M). E (input) COMPLEX*16 array, dimension (LDE, N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix E in the generalized complex Schur form. The diagonal elements are non-negative real. LDE INTEGER The leading dimension of the array E. LDE >= max(1, N). F (input/output) COMPLEX*16 array, dimension (LDF, N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the second matrix equation in (1). On exit, if INFO = 0, the leading M-by-N part of this array contains the solution L. LDF INTEGER The leading dimension of the array F. LDF >= max(1, M). SCALE (output) DOUBLE PRECISION On exit, 0 <= SCALE <= 1. If 0 < SCALE < 1, the solutions R and L (C and F on entry) will hold the solutions to a slightly perturbed system but the input matrices A, B, D and E have not been changed. If SCALE = 0, R and L will hold the solutions to the homogeneous system with C = 0 and F = 0. Normally, SCALE = 1.Workspace
IWORK INTEGER array, dimension (M+N+2)Error Indicator
INFO INTEGER = 0: successful exit; = 1: an element of R or L had the absolute value greater than the given value PMAX. = 2: the matrix pairs (A, D) and (B, E) have common or very close eigenvalues. The matrix Z in section METHOD is (almost) singular.Method
The routine uses an adaptation of the method for solving generalized Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2]. In matrix notation, solving equation (1) corresponds to solve Zx = scale * b, where Z is defined as Z = [ kron(In, A) -kron(B', Im) ] (2) [ kron(In, D) -kron(E', Im) ], Ik is the identity matrix of size k and X' is the transpose of X. kron(X, Y) is the Kronecker product between the matrices X and Y.References
[1] Kagstrom, B. and Westin, L. Generalized Schur Methods with Condition Estimators for Solving the Generalized Sylvester Equation. IEEE Trans. Auto. Contr., 34, pp. 745-751, 1989. [2] Kagstrom, B. and Westin, L. GSYLV - Fortran Routines for the Generalized Schur Method with Dif Estimators for Solving the Generalized Sylvester Equation. Report UMINF-132.86, Institute of Information Processing, Univ. of Umea, Sweden, July 1987. [3] Kagstrom, B. A Perturbation Analysis of the Generalized Sylvester Equation (AR - LB, DR - LE ) = (C, F). SIAM J. Matrix Anal. Appl., 15(4), pp. 1045-1060, 1994. [4] Kagstrom, B. and Poromaa, P. LAPACK-Style Algorithms and Software for Solving the Generalized Sylvester Equation and Estimating the Separation between Regular Matrix Pairs. ACM Trans. on Math. Software, 22(1), pp. 78103, 1996.Further Comments
For efficiency reasons, the "absolute value" of a complex number x is computed as |real(x)| + |imag(x)|.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04RZ.html 0000664 0000000 0000000 00000035604 14560147231 0020400 0 ustar 00root root 0000000 0000000
Purpose
To reduce a complex matrix pair (A,B) in generalized complex Schur form to a block-diagonal form using well-conditioned non-unitary equivalence transformations. The condition numbers of the left and right transformations used for the reduction are roughly bounded by PMAX, where PMAX is a given value. The transformations are optionally postmultiplied in the given matrices X and Y. The generalized Schur form is optionally ordered, so that clustered eigenvalues are grouped in the same pair of blocks.Specification
SUBROUTINE MB04RZ( JOBX, JOBY, SORT, N, PMAX, A, LDA, B, LDB, X, $ LDX, Y, LDY, NBLCKS, BLSIZE, ALPHA, BETA, $ TOL, IWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBX, JOBY, SORT INTEGER INFO, LDA, LDB, LDX, LDY, N, NBLCKS DOUBLE PRECISION PMAX, TOL C .. Array Arguments .. INTEGER BLSIZE(*), IWORK(*) COMPLEX*16 A(LDA,*), ALPHA(*), B(LDB,*), BETA(*), X(LDX,*), $ Y(LDY,*)Arguments
Mode Parameters
JOBX CHARACTER*1 Specifies whether or not the left transformations are accumulated, as follows: = 'N': The left transformations are not accumulated; = 'U': The left transformations are accumulated in X (the given matrix X is updated). JOBY CHARACTER*1 Specifies whether or not the right transformations are accumulated, as follows: = 'N': The right transformations are not accumulated; = 'U': The right transformations are accumulated in Y (the given matrix Y is updated). SORT CHARACTER*1 Specifies whether or not the diagonal elements of the generalized Schur form are reordered, as follows: = 'N': The diagonal elements are not reordered; = 'S': The diagonal elements are reordered before each step of reduction, so that clustered eigenvalues appear in the same pair of blocks. = 'C': The diagonal elements are not reordered, but the "closest-neighbour" strategy is used instead of the standard "closest to the mean" strategy (see METHOD); = 'B': The diagonal elements are reordered before each step of reduction, and the "closest-neighbour" strategy is used (see METHOD).Input/Output Parameters
N (input) INTEGER The order of the matrices A, B, X and Y. N >= 0. PMAX (input) DOUBLE PRECISION An upper bound for the "absolute value" of the elements of the individual transformations used for reduction (see METHOD and FURTHER COMMENTS). PMAX >= 1.0D0. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix A in the generalized complex Schur form, as returned by the LAPACK Library routine ZGGES. The strictly lower triangular part is used as workspace. On exit, the leading N-by-N upper triangular part of this array contains the computed block-diagonal matrix, corresponding to the given matrix A. The remaining part is set to 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 upper triangular part of this array must contain the upper triangular matrix B in the generalized complex Schur form, as returned by the LAPACK Library routine ZGGES. The diagonal elements of B are real non-negative, hence the imaginary parts of these elements are zero. The strictly lower triangular part is used as workspace. The matrix B is assumed nonzero. On exit, the leading N-by-N upper triangular part of this array contains the computed upper triangular block- diagonal matrix, corresponding to the given matrix B. The remaining part is set to zero. The diagonal elements of B are real non-negative. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). X (input/output) COMPLEX*16 array, dimension (LDX,*) On entry, if JOBX = 'U', the leading N-by-N part of this array must contain a given matrix X, for instance the left transformation matrix VSL returned by the LAPACK Library routine ZGGES. On exit, if JOBX = 'U', the leading N-by-N part of this array contains the product of the given matrix X and the left transformation matrix that reduced (A,B) to block- diagonal form. The local transformation matrix is itself a product of non-unitary equivalence transformations having elements with magnitude less than or equal to PMAX. If JOBX = 'N', this array is not referenced. LDX INTEGER The leading dimension of the array X. LDX >= 1, if JOBX = 'N'; LDX >= MAX(1,N), if JOBX = 'U'. Y (input/output) COMPLEX*16 array, dimension (LDY,*) On entry, if JOBY = 'U', the leading N-by-N part of this array must contain a given matrix Y, for instance the right transformation matrix VSR returned by the LAPACK Library routine ZGGES. On exit, if JOBY = 'U', the leading N-by-N part of this array contains the product of the given matrix Y and the right transformation matrix that reduced (A,B) to block- diagonal form. The local transformation matrix is itself a product of non-unitary equivalence transformations having elements with magnitude less than or equal to PMAX. If JOBY = 'N', this array is not referenced. LDY INTEGER The leading dimension of the array Y. LDY >= 1, if JOBY = 'N'; LDY >= MAX(1,N), if JOBY = 'U'. NBLCKS (output) INTEGER The number of diagonal blocks of the matrices A and B. BLSIZE (output) INTEGER array, dimension (N) The first NBLCKS elements of this array contain the orders of the resulting diagonal blocks of the matrices A and B. ALPHA (output) COMPLEX*16 array, dimension (N) BETA (output) COMPLEX*16 array, dimension (N) If INFO = 0, then ALPHA(j)/BETA(j), j = 1, ..., N, are the generalized eigenvalues of the matrix pair (A, B) (the diagonals of the complex Schur form). All BETA(j) are non-negative real numbers. The quotients ALPHA(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. Thus, the user should avoid naively computing the ratio. If A and B are obtained from general matrices using ZGGES, ALPHA will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).Tolerances
TOL DOUBLE PRECISION If SORT = 'S' or 'B', the tolerance to be used in the ordering of the diagonal elements of the upper triangular matrix pair. If the user sets TOL > 0, then the given value of TOL is used as an absolute tolerance: an eigenvalue i and a temporarily fixed eigenvalue 1 (represented by the first element of the current trailing pair of submatrices to be reduced) are considered to belong to the same cluster if they satisfy the following "distance" condition | lambda_1 - lambda_i | <= TOL. If the user sets TOL < 0, then the given value of TOL is used as a relative tolerance: an eigenvalue i and a temporarily fixed eigenvalue 1 are considered to belong to the same cluster if they satisfy, for finite lambda_j, j = 1, ..., N, | lambda_1 - lambda_i | <= | TOL | * max | lambda_j |. If the user sets TOL = 0, then an implicitly computed, default tolerance, defined by TOL = SQRT( SQRT( EPS ) ) is used instead, as a relative tolerance, where EPS is the machine precision (see LAPACK Library routine DLAMCH). The approximate symmetric chordal metric is used as "distance" of two complex, possibly infinite numbers, x and y. This metric is given by the formula d(x,y) = min( |x-y|, |1/x-1/y| ), taking into account the special cases of infinite or NaN values. If SORT = 'N' or 'C', this parameter is not referenced.Workspace
IWORK INTEGER array, dimension (N+2)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the matrix pencil defined by A and B is singular.Method
Consider first that SORT = 'N'. Let ( A A ) ( B B ) ( 11 12 ) ( 11 12 ) A = ( ), B = ( ), ( 0 A ) ( 0 B ) ( 22 ) ( 22 ) be the given matrix pair in generalized Schur form, where initially A and B are the first diagonal elements. 11 11 An attempt is made to compute the transformation matrices X and Y of the form ( I V ) ( I W ) X = ( ), Y = ( ) (1) ( 0 I ) ( 0 I ) (partitioned as A and B ), so that (' denotes conjugate-transpose) ( A 0 ) ( B 0 ) ( 11 ) ( 11 ) X' A Y = ( ), X' B Y = ( ), ( 0 A ) ( 0 B ) ( 22 ) ( 22 ) and the elements of V and W do not exceed the value PMAX in magnitude. An adaptation of the standard method for solving generalized Sylvester equations [1], which controls the magnitude of the individual elements of the computed solution [2], is used to obtain V and W. When this attempt fails, an eigenvalue of (A , B ) closest to the mean of those of (A , B ) is selected, 22 22 11 11 and moved by unitary equivalence transformations in the leading position of (A , B ); the moved diagonal elements in A and B are 22 22 then added to the blocks A and B , respectively, increasing 11 11 their order by 1. Another attempt is made to compute suitable transformation matrices X and Y with the new definitions of the blocks A , A , B , and B . After successful transformation 11 22 11 22 matrices X and Y have been obtained, they postmultiply the current transformation matrices (if JOBX = 'U' and/or JOBY = 'U') and the whole procedure is repeated for the new blocks A and B . 22 22 When SORT = 'S', the diagonal elements of the generalized Schur form are reordered before each step of the reduction, so that each cluster of generalized eigenvalues, defined as specified in the definition of TOL, appears in adjacent elements. The elements for each cluster are merged together, and the procedure described above is applied to the larger blocks. Using the option SORT = 'S' will usually provide better efficiency than the standard option (SORT = 'N'), proposed in [2], because there could be no or few unsuccessful attempts to compute individual transformation matrices X and Y of the form (1). However, the resulting dimensions of the blocks are usually larger; this could make subsequent calculations less efficient. When SORT = 'C' or 'B', the procedure is similar to that for SORT = 'N' or 'S', respectively, but the blocks of A and B 22 22 whose eigenvalue(s) is (are) the closest to those of (A , B ) 11 11 (not to their mean) are selected and moved to the leading position of A and B . This is called the "closest-neighbour" strategy. 22 22References
[1] Kagstrom, B. and Westin, L. Generalized Schur Methods with Condition Estimators for Solving the Generalized Sylvester Equation. IEEE Trans. Auto. Contr., 34, pp. 745-751, 1989. [2] Bavely, C. and Stewart, G.W. An Algorithm for Computing Reducing Subspaces by Block Diagonalization. SIAM J. Numer. Anal., 16, pp. 359-367, 1979. [3] Demmel, J. The Condition Number of Equivalence Transformations that Block Diagonalize Matrix Pencils. SIAM J. Numer. Anal., 20, pp. 599-610, 1983.Numerical Aspects
3 4 The algorithm usually requires 0(N ) operations, but 0(N ) are possible in the worst case, when the matrix pencil cannot be diagonalized by well-conditioned transformations.Further Comments
The individual non-unitary transformation matrices used in the reduction of A and B to a block-diagonal form have condition numbers of the order PMAX. This does not guarantee that their product is well-conditioned enough. The routine can be easily modified to provide estimates for the condition numbers of the clusters of generalized eigenvalues. For efficiency reasons, the "absolute value" (or "magnitude") of the complex elements x of the transformation matrices is computed as |real(x)| + |imag(x)|.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04SU.html 0000664 0000000 0000000 00000012715 14560147231 0020372 0 ustar 00root root 0000000 0000000
Purpose
To compute a symplectic QR decomposition of a real 2M-by-N matrix [A; B], [ A ] [ R11 R12 ] [ ] = Q * R = Q [ ], [ B ] [ R21 R22 ] where Q is a symplectic orthogonal matrix, R11 is upper triangular and R21 is strictly upper triangular. If [A; B] is symplectic then, theoretically, R21 = 0 and R22 = inv(R11)^T. Unblocked version.Specification
SUBROUTINE MB04SU( M, N, A, LDA, B, LDB, CS, TAU, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDWORK, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), CS(*), DWORK(*), TAU(*)Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of A and B. M >= 0. N (input) INTEGER The number of columns of A and B. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M-by-N part of this array must contain the matrix A. On exit, the leading M-by-N part of this array contains the matrix [ R11 R12 ] and, in the zero parts of R, information about the elementary reflectors used to compute the symplectic QR decomposition. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,M). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading M-by-N part of this array must contain the matrix B. On exit, the leading M-by-N part of this array contains the matrix [ R21 R22 ] and, in the zero parts of B, information about the elementary reflectors used to compute the symplectic QR decomposition. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,M). CS (output) DOUBLE PRECISION array, dimension (2 * min(M,N)) On exit, the first 2*min(M,N) elements of this array contain the cosines and sines of the symplectic Givens rotations used to compute the symplectic QR decomposition. TAU (output) DOUBLE PRECISION array, dimension (min(M,N)) On exit, the first min(M,N) elements of this array contain the scalar factors of some of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -10, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix Q is represented as a product of symplectic reflectors and Givens rotations Q = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(k),H(k) ) G(k) diag( F(k),F(k) ), where k = min(m,n). Each H(i) has the form H(i) = I - tau * w * w' where tau is a real scalar, and w is a real vector with w(1:i-1) = 0 and w(i) = 1; w(i+1:m) is stored on exit in B(i+1:m,i), and tau in B(i,i). Each F(i) has the form F(i) = I - nu * v * v' where nu is a real scalar, and v is a real vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and nu in TAU(i). Each G(i) is a Givens rotation acting on rows i of A and B, where the cosine is stored in CS(2*i-1) and the sine in CS(2*i).References
[1] Bunse-Gerstner, A. Matrix factorizations for symplectic QR-like methods. Linear Algebra Appl., 83, pp. 49-77, 1986. [2] Byers, R. Hamiltonian and Symplectic Algorithms for the Algebraic Riccati Equation. Ph.D. Dissertation, Center for Applied Mathematics, Cornell University, Ithaca, NY, 1983.Numerical Aspects
The algorithm requires 8*M*N*N - 8/3*N*N*N + 2*M*N + 6*N*N + 8/3*N, if M >= N, 8*M*M*N - 8/3*M*M*M + 14*M*N - 6*M*M + 8/3*N, if M <= N, floating point operations and is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a symplectic URV (SURV) decomposition of a real 2N-by-2N matrix H, [ op(A) G ] [ op(R11) R12 ] H = [ ] = U R V' = U * [ ] * V' , [ Q op(B) ] [ 0 op(R22) ] where A, B, G, Q, R12 are real N-by-N matrices, op(R11) is a real N-by-N upper triangular matrix, op(R22) is a real N-by-N lower Hessenberg matrix and U, V are 2N-by-2N orthogonal symplectic matrices. Blocked version.Specification
SUBROUTINE MB04TB( TRANA, TRANB, N, ILO, A, LDA, B, LDB, G, LDG, $ Q, LDQ, CSL, CSR, TAUL, TAUR, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER TRANA, TRANB INTEGER ILO, INFO, LDA, LDB, LDG, LDQ, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), CSL(*), CSR(*), DWORK(*), $ G(LDG,*), Q(LDQ,*), TAUL(*), TAUR(*)Arguments
Mode Parameters
TRANA CHARACTER*1 Specifies the form of op( A ) as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'. TRANB CHARACTER*1 Specifies the form of op( B ) as follows: = 'N': op( B ) = B; = 'T': op( B ) = B'; = 'C': op( B ) = B'.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. ILO (input) INTEGER It is assumed that op(A) is already upper triangular, op(B) is lower triangular and Q is zero in rows and columns 1:ILO-1. ILO is normally set by a previous call to MB04DD; otherwise it should be set to 1. 1 <= ILO <= N+1, if N > 0; ILO = 1, if N = 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 triangular matrix R11, and in the zero part information about the elementary reflectors used to compute the SURV decomposition. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION 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 Hessenberg matrix R22, and in the zero part information about the elementary reflectors used to compute the SURV decomposition. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). G (input/output) DOUBLE PRECISION array, dimension (LDG,N) On entry, the leading N-by-N part of this array must contain the matrix G. On exit, the leading N-by-N part of this array contains the matrix R12. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, the leading N-by-N part of this array must contain the matrix Q. On exit, the leading N-by-N part of this array contains information about the elementary reflectors used to compute the SURV decomposition. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). CSL (output) DOUBLE PRECISION array, dimension (2N) On exit, the first 2N elements of this array contain the cosines and sines of the symplectic Givens rotations applied from the left-hand side used to compute the SURV decomposition. CSR (output) DOUBLE PRECISION array, dimension (2N-2) On exit, the first 2N-2 elements of this array contain the cosines and sines of the symplectic Givens rotations applied from the right-hand side used to compute the SURV decomposition. TAUL (output) DOUBLE PRECISION array, dimension (N) On exit, the first N elements of this array contain the scalar factors of some of the elementary reflectors applied form the left-hand side. TAUR (output) DOUBLE PRECISION array, dimension (N-1) On exit, the first N-1 elements of this array contain the scalar factors of some of the elementary reflectors applied form the right-hand side.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, (16*N + 5)*NB, where NB is the optimal block size determined by the function UE01MD. On exit, if INFO = -16, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrices U and V are represented as products of symplectic reflectors and Givens rotations U = diag( HU(1),HU(1) ) GU(1) diag( FU(1),FU(1) ) diag( HU(2),HU(2) ) GU(2) diag( FU(2),FU(2) ) .... diag( HU(n),HU(n) ) GU(n) diag( FU(n),FU(n) ), V = diag( HV(1),HV(1) ) GV(1) diag( FV(1),FV(1) ) diag( HV(2),HV(2) ) GV(2) diag( FV(2),FV(2) ) .... diag( HV(n-1),HV(n-1) ) GV(n-1) diag( FV(n-1),FV(n-1) ). Each HU(i) has the form HU(i) = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in Q(i+1:n,i), and tau in Q(i,i). Each FU(i) has the form FU(i) = I - nu * w * w' where nu is a real scalar, and w is a real vector with w(1:i-1) = 0 and w(i) = 1; w(i+1:n) is stored on exit in A(i+1:n,i), if op(A) = 'N', and in A(i,i+1:n), otherwise. The scalar nu is stored in TAUL(i). Each GU(i) is a Givens rotation acting on rows i and n+i, where the cosine is stored in CSL(2*i-1) and the sine in CSL(2*i). Each HV(i) has the form HV(i) = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in Q(i,i+2:n), and tau in Q(i,i+1). Each FV(i) has the form FV(i) = I - nu * w * w' where nu is a real scalar, and w is a real vector with w(1:i) = 0 and w(i+1) = 1; w(i+2:n) is stored on exit in B(i,i+2:n), if op(B) = 'N', and in B(i+2:n,i), otherwise. The scalar nu is stored in TAUR(i). Each GV(i) is a Givens rotation acting on columns i+1 and n+i+1, where the cosine is stored in CSR(2*i-1) and the sine in CSR(2*i).Numerical Aspects
The algorithm requires 80/3*N**3 + ( 64*NB + 77 )*N**2 + ( -16*NB + 48 )*NB*N + O(N) floating point operations, where NB is the used block size, and is numerically backward stable.References
[1] Benner, P., Mehrmann, V., and Xu, H. A numerically stable, structure preserving method for computing the eigenvalues of real Hamiltonian or symplectic pencils. Numer. Math., Vol 78 (3), pp. 329-358, 1998. [2] Kressner, D. Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
* MB04TB/MB04WR EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NBMAX, NMAX PARAMETER ( NBMAX = 64, NMAX = 421 ) INTEGER LDA, LDB, LDG, LDQ, LDRES, LDU1, LDU2, LDV1, $ LDV2, LDWORK PARAMETER ( LDA = NMAX, LDB = NMAX, LDG = NMAX, LDQ = NMAX, $ LDRES = NMAX, LDU1 = NMAX, LDU2 = NMAX, $ LDV1 = NMAX, LDV2 = NMAX, $ LDWORK = NBMAX*( 16*NMAX + 1 ) ) * .. Local Scalars .. CHARACTER*1 TRANA, TRANB, TRANV1 INTEGER I, INFO, J, N DOUBLE PRECISION TEMP * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), B(LDB, NMAX), CSL(2*NMAX), $ CSR(2*NMAX), DWORK(LDWORK), G(LDG, NMAX), $ Q(LDQ, NMAX), RES(LDRES,5*NMAX), TAUL(NMAX), $ TAUR(NMAX), U1(LDU1, NMAX), U2(LDU2, NMAX), $ V1(LDV1, NMAX), V2(LDV2, NMAX) * .. External Functions .. * .. External Functions .. LOGICAL LSAME DOUBLE PRECISION DLANGE, DLAPY2, MA02JD EXTERNAL DLANGE, DLAPY2, LSAME, MA02JD * .. External Subroutines .. EXTERNAL DGEMM, DLACPY, DLASET, MB04TB, MB04WR * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, TRANA, TRANB IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'All', N, N, A, LDA, RES, LDRES ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'All', N, N, B, LDB, RES(1,N+1), LDRES ) READ ( NIN, FMT = * ) ( ( G(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'All', N, N, G, LDG, RES(1,2*N+1), LDRES ) READ ( NIN, FMT = * ) ( ( Q(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'All', N, N, Q, LDQ, RES(1,3*N+1), LDRES ) CALL MB04TB( TRANA, TRANB, N, 1, A, LDA, B, LDB, G, LDG, Q, $ LDQ, CSL, CSR, TAUL, TAUR, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE CALL DLACPY( 'All', N, N, A, LDA, U1, LDU1 ) CALL DLACPY( 'All', N, N, Q, LDQ, U2, LDU2 ) CALL MB04WR( 'U', TRANA, N, 1, U1, LDU1, U2, LDU2, CSL, $ TAUL, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE CALL DLACPY( 'All', N, N, Q, LDQ, V2, LDV2 ) CALL DLACPY( 'All', N, N, B, LDB, V1, LDV1 ) CALL MB04WR( 'V', TRANB, N, 1, V1, LDV1, V2, LDV2, $ CSR, TAUR, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) IF ( LSAME( TRANA, 'N' ) ) THEN DO 10 I = 1, N WRITE (NOUT, FMT = 99993) $ ( U1(I,J), J = 1,N ), ( U2(I,J), J = 1,N ) 10 CONTINUE DO 20 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -U2(I,J), J = 1,N ), ( U1(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99991 ) MA02JD( .FALSE., $ .FALSE., N, U1, LDU1, U2, LDU2, $ RES(1,4*N+1), LDRES ) ELSE DO 30 I = 1, N WRITE (NOUT, FMT = 99993) $ ( U1(J,I), J = 1,N ), ( U2(I,J), J = 1,N ) 30 CONTINUE DO 40 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -U2(I,J), J = 1,N ), ( U1(J,I), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) MA02JD( .TRUE., $ .FALSE., N, U1, LDU1, U2, LDU2, $ RES(1,4*N+1), LDRES ) END IF WRITE ( NOUT, FMT = 99995 ) CALL DLASET( 'All', N, N, ZERO, ZERO, Q, LDQ ) IF ( LSAME( TRANA, 'N' ) ) THEN CALL DLASET( 'Lower', N-1, N-1, ZERO, ZERO, $ A(2,1), LDA ) DO 50 I = 1, N WRITE (NOUT, FMT = 99993) $ ( A(I,J), J = 1,N ), ( G(I,J), J = 1,N ) 50 CONTINUE ELSE CALL DLASET( 'Upper', N-1, N-1, ZERO, ZERO, $ A(1,2), LDA ) DO 60 I = 1, N WRITE (NOUT, FMT = 99993) $ ( A(J,I), J = 1,N ), ( G(I,J), J = 1,N ) 60 CONTINUE END IF IF ( LSAME( TRANB, 'N' ) ) THEN IF ( N.GT.1 ) THEN CALL DLASET( 'Upper', N-2, N-2, ZERO, ZERO, $ B(1,3), LDB ) END IF DO 70 I = 1, N WRITE (NOUT, FMT = 99993) $ ( Q(I,J), J = 1,N ), ( B(I,J), J = 1,N ) 70 CONTINUE ELSE IF ( N.GT.1 ) THEN C CALL DLASET( 'Lower', N-2, N-2, ZERO, ZERO, C $ B(3,1), LDB ) END IF DO 80 I = 1, N WRITE (NOUT, FMT = 99993) $ ( Q(I,J), J = 1,N ), ( B(J,I), J = 1,N ) 80 CONTINUE END IF C IF ( LSAME( TRANB, 'N' ) ) THEN TRANV1 = 'T' ELSE TRANV1 = 'N' END IF CALL DGEMM( TRANA, TRANV1, N, N, N, ONE, RES, LDRES, $ V1, LDV1, ZERO, RES(1,4*N+1), LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, $ -ONE, RES(1,2*N+1), LDRES, V2, LDV2, ONE, $ RES(1,4*N+1), LDRES ) CALL DGEMM( TRANA, TRANA, N, N, N, -ONE, U1, LDU1, $ A, LDA, ONE, RES(1,4*N+1), LDRES ) TEMP = DLANGE( 'Frobenius', N, N, RES(1,4*N+1), $ LDRES, DWORK ) CALL DGEMM( TRANA, 'Transpose', N, N, N, ONE, RES, $ LDRES, V2, LDV2, ZERO, RES(1,4*N+1), $ LDRES ) CALL DGEMM( 'No Transpose', TRANV1, N, N, N, ONE, $ RES(1,2*N+1), LDRES, V1, LDV1, ONE, $ RES(1,4*N+1), LDRES ) CALL DGEMM( TRANA, 'No Transpose', N, N, N, -ONE, $ U1, LDU1, G, LDG, ONE, RES(1,4*N+1), $ LDRES ) CALL DGEMM( 'No Transpose', TRANB, N, N, N, -ONE, $ U2, LDU2, B, LDB, ONE, RES(1,4*N+1), $ LDRES ) TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, $ RES(1,4*N+1), LDRES, DWORK ) ) CALL DGEMM( 'No Transpose', TRANV1, N, N, N, ONE, $ RES(1,3*N+1), LDRES, V1, LDV1, ZERO, $ RES(1,4*N+1), LDRES ) CALL DGEMM( TRANB, 'Transpose', N, N, N, -ONE, $ RES(1,N+1), LDRES, V2, LDV2, ONE, $ RES(1,4*N+1), LDRES ) CALL DGEMM( 'No Transpose', TRANA, N, N, N, ONE, $ U2, LDU2, A, LDA, ONE, RES(1,4*N+1), $ LDRES ) TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, $ RES(1,4*N+1), LDRES, DWORK ) ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, ONE, $ RES(1,3*N+1), LDRES, V2, LDV2, ZERO, $ RES(1,4*N+1), LDRES ) CALL DGEMM( TRANB, TRANV1, N, N, N, ONE, RES(1,N+1), $ LDRES, V1, LDV1, ONE, RES(1,4*N+1), $ LDRES ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, $ ONE, U2, LDU2, G, LDG, ONE, RES(1,4*N+1), $ LDRES ) CALL DGEMM( TRANA, TRANB, N, N, N, -ONE, U1, LDU1, $ B, LDB, ONE, RES(1,4*N+1), LDRES ) TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, $ RES(1,4*N+1), LDRES, DWORK ) ) WRITE ( NOUT, FMT = 99990 ) TEMP C WRITE ( NOUT, FMT = 99994 ) IF ( LSAME( TRANB, 'N' ) ) THEN DO 90 I = 1, N WRITE (NOUT, FMT = 99993) $ ( V1(J,I), J = 1,N ), ( V2(J,I), J = 1,N ) 90 CONTINUE DO 100 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -V2(J,I), J = 1,N ), ( V1(J,I), J = 1,N ) 100 CONTINUE WRITE ( NOUT, FMT = 99989 ) MA02JD( .TRUE., $ .TRUE., N, V1, LDV1, V2, LDV2, $ RES(1,4*N+1), LDRES ) ELSE DO 110 I = 1, N WRITE (NOUT, FMT = 99993) $ ( V1(I,J), J = 1,N ), ( V2(J,I), J = 1,N ) 110 CONTINUE DO 120 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -V2(J,I), J = 1,N ), ( V1(I,J), J = 1,N ) 120 CONTINUE WRITE ( NOUT, FMT = 99989 ) MA02JD( .FALSE., $ .TRUE., N, V1, LDV1, V2, LDV2, $ RES(1,4*N+1), LDRES ) END IF END IF END IF END IF END IF * STOP * 99999 FORMAT (' MB04TB EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04TB = ',I2) 99997 FORMAT (' INFO on exit from MB04WR = ',I2) 99996 FORMAT (' The orthogonal symplectic factor U is ') 99995 FORMAT (/' The factor R is ') 99994 FORMAT (/' The orthogonal symplectic factor V is ') 99993 FORMAT (20(1X,F9.4)) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' Orthogonality of U: || U^T U - I ||_F = ',G7.2) 99990 FORMAT (/' Residual: || H*V - U*R ||_F = ',G7.2) 99989 FORMAT (/' Orthogonality of V: || V^T V - I ||_F = ',G7.2) ENDProgram Data
MB04TB EXAMPLE PROGRAM DATA 5 N N 0.4643 0.3655 0.6853 0.5090 0.3718 0.3688 0.6460 0.4227 0.6798 0.5135 0.7458 0.5043 0.9419 0.9717 0.9990 0.7140 0.4941 0.7802 0.5272 0.1220 0.7418 0.0339 0.7441 0.0436 0.6564 -0.4643 -0.3688 -0.7458 -0.7140 -0.7418 -0.3655 -0.6460 -0.5043 -0.4941 -0.0339 -0.6853 -0.4227 -0.9419 -0.7802 -0.7441 -0.5090 -0.6798 -0.9717 -0.5272 -0.0436 -0.3718 -0.5135 -0.9990 -0.1220 -0.6564 0.7933 1.5765 1.0711 1.0794 0.8481 1.5765 0.1167 1.5685 0.8756 0.5037 1.0711 1.5685 0.9902 0.3858 0.2109 1.0794 0.8756 0.3858 1.8834 1.4338 0.8481 0.5037 0.2109 1.4338 0.1439 1.0786 1.5264 1.1721 1.5343 0.4756 1.5264 0.8644 0.6872 1.1379 0.6499 1.1721 0.6872 1.5194 1.1197 1.0158 1.5343 1.1379 1.1197 0.6612 0.2004 0.4756 0.6499 1.0158 0.2004 1.2188Program Results
MB04TB EXAMPLE PROGRAM RESULTS The orthogonal symplectic factor U is -0.1513 0.0756 -0.0027 0.1694 -0.2999 0.3515 -0.4843 0.6545 -0.1995 -0.1627 -0.1202 0.2320 0.1662 -0.2835 -0.0508 0.4975 0.3319 -0.2686 -0.4186 -0.4649 -0.2431 0.2724 0.3439 0.3954 0.0236 0.3820 -0.2863 -0.4324 0.3706 0.1984 -0.2327 -0.1509 -0.3710 -0.1240 -0.0393 0.5000 0.3659 0.1429 0.0493 0.6015 -0.2418 -0.2928 -0.0836 -0.5549 0.4824 0.1550 -0.4441 -0.0396 0.2376 -0.1702 -0.3515 0.4843 -0.6545 0.1995 0.1627 -0.1513 0.0756 -0.0027 0.1694 -0.2999 -0.4975 -0.3319 0.2686 0.4186 0.4649 -0.1202 0.2320 0.1662 -0.2835 -0.0508 -0.3820 0.2863 0.4324 -0.3706 -0.1984 -0.2431 0.2724 0.3439 0.3954 0.0236 -0.5000 -0.3659 -0.1429 -0.0493 -0.6015 -0.2327 -0.1509 -0.3710 -0.1240 -0.0393 -0.1550 0.4441 0.0396 -0.2376 0.1702 -0.2418 -0.2928 -0.0836 -0.5549 0.4824 Orthogonality of U: || U^T U - I ||_F = .17E-14 The factor R is -3.0684 4.6724 -0.2613 -0.1996 0.0208 -0.1071 -0.1355 -0.1400 0.4652 -0.5032 0.0000 -1.8037 -0.0301 -0.1137 0.1771 0.0277 0.3929 0.5424 0.5220 -0.4843 0.0000 0.0000 -0.7617 -0.1874 0.2557 0.1244 -0.0012 0.4091 0.5123 -0.3522 0.0000 0.0000 0.0000 -0.6931 -0.4293 -0.3718 0.1542 -0.3635 0.0336 -0.9832 0.0000 0.0000 0.0000 0.0000 0.6469 0.2074 0.0266 0.2028 0.1995 0.2517 0.0000 0.0000 0.0000 0.0000 0.0000 2.6325 -4.7377 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.2702 0.9347 -1.1210 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.3219 -0.5394 0.1748 -0.4788 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1431 -0.1021 0.4974 -0.3565 -0.6402 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1622 -0.2368 0.6126 -0.7369 0.6915 Residual: || H*V - U*R ||_F = .76E-14 The orthogonal symplectic factor V is 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.4740 0.6013 -0.2299 -0.4282 0.0000 0.0061 -0.1732 0.3134 0.2220 0.0000 -0.5553 -0.2623 0.6622 -0.3042 0.0000 -0.0382 0.2453 -0.1662 0.0509 0.0000 -0.5563 0.0322 -0.1431 0.4461 0.0000 -0.0665 -0.4132 -0.3100 -0.4457 0.0000 -0.3872 -0.4022 -0.4194 0.3541 0.0000 -0.0406 0.3820 0.3006 0.3861 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.0061 0.1732 -0.3134 -0.2220 0.0000 -0.4740 0.6013 -0.2299 -0.4282 0.0000 0.0382 -0.2453 0.1662 -0.0509 0.0000 -0.5553 -0.2623 0.6622 -0.3042 0.0000 0.0665 0.4132 0.3100 0.4457 0.0000 -0.5563 0.0322 -0.1431 0.4461 0.0000 0.0406 -0.3820 -0.3006 -0.3861 0.0000 -0.3872 -0.4022 -0.4194 0.3541 Orthogonality of V: || V^T V - I ||_F = .17E-14
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04TS.html 0000664 0000000 0000000 00000056430 14560147231 0020373 0 ustar 00root root 0000000 0000000
Purpose
To compute a symplectic URV (SURV) decomposition of a real 2N-by-2N matrix H: [ op(A) G ] T [ op(R11) R12 ] T H = [ ] = U R V = U * [ ] * V , [ Q op(B) ] [ 0 op(R22) ] where A, B, G, Q, R12 are real N-by-N matrices, op(R11) is a real N-by-N upper triangular matrix, op(R22) is a real N-by-N lower Hessenberg matrix and U, V are 2N-by-2N orthogonal symplectic matrices. Unblocked version.Specification
SUBROUTINE MB04TS( TRANA, TRANB, N, ILO, A, LDA, B, LDB, G, LDG, $ Q, LDQ, CSL, CSR, TAUL, TAUR, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER TRANA, TRANB INTEGER ILO, INFO, LDA, LDB, LDG, LDQ, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), CSL(*), CSR(*), DWORK(*), $ G(LDG,*), Q(LDQ,*), TAUL(*), TAUR(*)Arguments
Mode Parameters
TRANA CHARACTER*1 Specifies the form of op( A ) as follows: = 'N': op( A ) = A; = 'T': op( A ) = A'; = 'C': op( A ) = A'. TRANB CHARACTER*1 Specifies the form of op( B ) as follows: = 'N': op( B ) = B; = 'T': op( B ) = B'; = 'C': op( B ) = B'.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. ILO (input) INTEGER It is assumed that op(A) is already upper triangular, op(B) is lower triangular and Q is zero in rows and columns 1:ILO-1. ILO is normally set by a previous call to MB04DD; otherwise it should be set to 1. 1 <= ILO <= N, if N > 0; ILO=1, if N=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 triangular matrix R11, and in the zero part information about the elementary reflectors used to compute the SURV decomposition. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION 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 Hessenberg matrix R22, and in the zero part information about the elementary reflectors used to compute the SURV decomposition. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). G (input/output) DOUBLE PRECISION array, dimension (LDG,N) On entry, the leading N-by-N part of this array must contain the matrix G. On exit, the leading N-by-N part of this array contains the matrix R12. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, the leading N-by-N part of this array must contain the matrix Q. On exit, the leading N-by-N part of this array contains information about the elementary reflectors used to compute the SURV decomposition. LDQ INTEGER The leading dimension of the array Q. LDG >= MAX(1,N). CSL (output) DOUBLE PRECISION array, dimension (2N) On exit, the first 2N elements of this array contain the cosines and sines of the symplectic Givens rotations applied from the left-hand side used to compute the SURV decomposition. CSR (output) DOUBLE PRECISION array, dimension (2N-2) On exit, the first 2N-2 elements of this array contain the cosines and sines of the symplectic Givens rotations applied from the right-hand side used to compute the SURV decomposition. TAUL (output) DOUBLE PRECISION array, dimension (N) On exit, the first N elements of this array contain the scalar factors of some of the elementary reflectors applied from the left-hand side. TAUR (output) DOUBLE PRECISION array, dimension (N-1) On exit, the first N-1 elements of this array contain the scalar factors of some of the elementary reflectors applied from the right-hand side.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -16, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrices U and V are represented as products of symplectic reflectors and Givens rotations U = diag( HU(1),HU(1) ) GU(1) diag( FU(1),FU(1) ) diag( HU(2),HU(2) ) GU(2) diag( FU(2),FU(2) ) .... diag( HU(n),HU(n) ) GU(n) diag( FU(n),FU(n) ), V = diag( HV(1),HV(1) ) GV(1) diag( FV(1),FV(1) ) diag( HV(2),HV(2) ) GV(2) diag( FV(2),FV(2) ) .... diag( HV(n-1),HV(n-1) ) GV(n-1) diag( FV(n-1),FV(n-1) ). Each HU(i) has the form HU(i) = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in Q(i+1:n,i), and tau in Q(i,i). Each FU(i) has the form FU(i) = I - nu * w * w' where nu is a real scalar, and w is a real vector with w(1:i-1) = 0 and w(i) = 1; w(i+1:n) is stored on exit in A(i+1:n,i), if op(A) = 'N', and in A(i,i+1:n), otherwise. The scalar nu is stored in TAUL(i). Each GU(i) is a Givens rotation acting on rows i and n+i, where the cosine is stored in CSL(2*i-1) and the sine in CSL(2*i). Each HV(i) has the form HV(i) = I - tau * v * v' where tau is a real scalar, and v is a real vector with v(1:i) = 0 and v(i+1) = 1; v(i+2:n) is stored on exit in Q(i,i+2:n), and tau in Q(i,i+1). Each FV(i) has the form FV(i) = I - nu * w * w' where nu is a real scalar, and w is a real vector with w(1:i) = 0 and w(i+1) = 1; w(i+2:n) is stored on exit in B(i,i+2:n), if op(B) = 'N', and in B(i+2:n,i), otherwise. The scalar nu is stored in TAUR(i). Each GV(i) is a Givens rotation acting on columns i+1 and n+i+1, where the cosine is stored in CSR(2*i-1) and the sine in CSR(2*i).Numerical Aspects
The algorithm requires 80/3 N**3 + 20 N**2 + O(N) floating point operations and is numerically backward stable.References
[1] Benner, P., Mehrmann, V., and Xu, H. A numerically stable, structure preserving method for computing the eigenvalues of real Hamiltonian or symplectic pencils. Numer. Math., Vol 78 (3), pp. 329-358, 1998.Further Comments
NoneExample
Program Text
* MB04TS/MB04WR 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, LDG, LDQ, LDRES, LDU1, LDU2, LDV1, $ LDV2, LDWORK PARAMETER ( LDA = NMAX, LDB = NMAX, LDG = NMAX, LDQ = NMAX, $ LDRES = NMAX, LDU1 = NMAX, LDU2 = NMAX, $ LDV1 = NMAX, LDV2 = NMAX, LDWORK = NMAX ) * .. Local Scalars .. CHARACTER*1 TRANA, TRANB, TRANV1 INTEGER I, INFO, J, N DOUBLE PRECISION TEMP * .. Local Arrays .. DOUBLE PRECISION A(LDA, NMAX), B(LDB, NMAX), CSL(2*NMAX), $ CSR(2*NMAX), DWORK(LDWORK), G(LDG,NMAX), $ Q(LDQ,NMAX), RES(LDRES,5*NMAX), TAUL(NMAX), $ TAUR(NMAX), U1(LDU1,NMAX), U2(LDU2, NMAX), $ V1(LDV1, NMAX), V2(LDV2,NMAX) * .. External Functions .. LOGICAL LSAME DOUBLE PRECISION DLANGE, DLAPY2, MA02JD EXTERNAL DLANGE, DLAPY2, LSAME, MA02JD * .. External Subroutines .. EXTERNAL DGEMM, DLACPY, DLASET, MB04TS, MB04WR * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, TRANA, TRANB IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'All', N, N, A, LDA, RES, LDRES ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'All', N, N, B, LDB, RES(1,N+1), LDRES ) READ ( NIN, FMT = * ) ( ( G(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'All', N, N, G, LDG, RES(1,2*N+1), LDRES ) READ ( NIN, FMT = * ) ( ( Q(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'All', N, N, Q, LDQ, RES(1,3*N+1), LDRES ) CALL MB04TS( TRANA, TRANB, N, 1, A, LDA, B, LDB, G, LDG, Q, $ LDQ, CSL, CSR, TAUL, TAUR, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE CALL DLACPY( 'All', N, N, A, LDA, U1, LDU1 ) CALL DLACPY( 'All', N, N, Q, LDQ, U2, LDU2 ) CALL MB04WR( 'U', TRANA, N, 1, U1, LDU1, U2, LDU2, CSL, $ TAUL, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE CALL DLACPY( 'All', N, N, Q, LDQ, V2, LDV2 ) CALL DLACPY( 'All', N, N, B, LDB, V1, LDV1 ) CALL MB04WR( 'V', TRANB, N, 1, V1, LDV1, V2, LDV2, $ CSR, TAUR, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) IF ( LSAME( TRANA, 'N' ) ) THEN DO 10 I = 1, N WRITE (NOUT, FMT = 99993) $ ( U1(I,J), J = 1,N ), ( U2(I,J), J = 1,N ) 10 CONTINUE DO 20 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -U2(I,J), J = 1,N ), ( U1(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99991 ) MA02JD( .FALSE., $ .FALSE., N, U1, LDU1, U2, LDU2, $ RES(1,4*N+1), LDRES ) ELSE DO 30 I = 1, N WRITE (NOUT, FMT = 99993) $ ( U1(J,I), J = 1,N ), ( U2(I,J), J = 1,N ) 30 CONTINUE DO 40 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -U2(I,J), J = 1,N ), ( U1(J,I), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) MA02JD( .TRUE., $ .FALSE., N, U1, LDU1, U2, LDU2, $ RES(1,4*N+1), LDRES ) END IF WRITE ( NOUT, FMT = 99995 ) CALL DLASET( 'All', N, N, ZERO, ZERO, Q, LDQ ) IF ( LSAME( TRANA, 'N' ) ) THEN CALL DLASET( 'Lower', N-1, N-1, ZERO, ZERO, $ A(2,1), LDA ) DO 50 I = 1, N WRITE (NOUT, FMT = 99993) $ ( A(I,J), J = 1,N ), ( G(I,J), J = 1,N ) 50 CONTINUE ELSE CALL DLASET( 'Upper', N-1, N-1, ZERO, ZERO, $ A(1,2), LDA ) DO 60 I = 1, N WRITE (NOUT, FMT = 99993) $ ( A(J,I), J = 1,N ), ( G(I,J), J = 1,N ) 60 CONTINUE END IF IF ( LSAME( TRANB, 'N' ) ) THEN IF ( N.GT.1 ) THEN CALL DLASET( 'Upper', N-2, N-2, ZERO, ZERO, $ B(1,3), LDB ) END IF DO 70 I = 1, N WRITE (NOUT, FMT = 99993) $ ( Q(I,J), J = 1,N ), ( B(I,J), J = 1,N ) 70 CONTINUE ELSE IF ( N.GT.1 ) THEN CALL DLASET( 'Lower', N-2, N-2, ZERO, ZERO, $ B(3,1), LDB ) END IF DO 80 I = 1, N WRITE (NOUT, FMT = 99993) $ ( Q(I,J), J = 1,N ), ( B(J,I), J = 1,N ) 80 CONTINUE END IF C IF ( LSAME( TRANB, 'N' ) ) THEN TRANV1 = 'T' ELSE TRANV1 = 'N' END IF CALL DGEMM( TRANA, TRANV1, N, N, N, ONE, RES, LDRES, $ V1, LDV1, ZERO, RES(1,4*N+1), LDRES ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, $ -ONE, RES(1,2*N+1), LDRES, V2, LDV2, ONE, $ RES(1,4*N+1), LDRES ) CALL DGEMM( TRANA, TRANA, N, N, N, -ONE, U1, LDU1, $ A, LDA, ONE, RES(1,4*N+1), LDRES ) TEMP = DLANGE( 'Frobenius', N, N, RES(1,4*N+1), $ LDRES, DWORK ) CALL DGEMM( TRANA, 'Transpose', N, N, N, ONE, RES, $ LDRES, V2, LDV2, ZERO, RES(1,4*N+1), $ LDRES ) CALL DGEMM( 'No Transpose', TRANV1, N, N, N, ONE, $ RES(1,2*N+1), LDRES, V1, LDV1, ONE, $ RES(1,4*N+1), LDRES ) CALL DGEMM( TRANA, 'No Transpose', N, N, N, -ONE, $ U1, LDU1, G, LDG, ONE, RES(1,4*N+1), $ LDRES ) CALL DGEMM( 'No Transpose', TRANB, N, N, N, -ONE, $ U2, LDU2, B, LDB, ONE, RES(1,4*N+1), $ LDRES ) TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, $ RES(1,4*N+1), LDRES, DWORK ) ) CALL DGEMM( 'No Transpose', TRANV1, N, N, N, ONE, $ RES(1,3*N+1), LDRES, V1, LDV1, ZERO, $ RES(1,4*N+1), LDRES ) CALL DGEMM( TRANB, 'Transpose', N, N, N, -ONE, $ RES(1,N+1), LDRES, V2, LDV2, ONE, $ RES(1,4*N+1), LDRES ) CALL DGEMM( 'No Transpose', TRANA, N, N, N, ONE, $ U2, LDU2, A, LDA, ONE, RES(1,4*N+1), $ LDRES ) TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, $ RES(1,4*N+1), LDRES, DWORK ) ) CALL DGEMM( 'No Transpose', 'Transpose', N, N, N, ONE, $ RES(1,3*N+1), LDRES, V2, LDV2, ZERO, $ RES(1,4*N+1), LDRES ) CALL DGEMM( TRANB, TRANV1, N, N, N, ONE, RES(1,N+1), $ LDRES, V1, LDV1, ONE, RES(1,4*N+1), $ LDRES ) CALL DGEMM( 'No Transpose', 'No Transpose', N, N, N, $ ONE, U2, LDU2, G, LDG, ONE, RES(1,4*N+1), $ LDRES ) CALL DGEMM( TRANA, TRANB, N, N, N, -ONE, U1, LDU1, $ B, LDB, ONE, RES(1,4*N+1), LDRES ) TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, $ RES(1,4*N+1), LDRES, DWORK ) ) WRITE ( NOUT, FMT = 99990 ) TEMP C WRITE ( NOUT, FMT = 99994 ) IF ( LSAME( TRANB, 'N' ) ) THEN DO 90 I = 1, N WRITE (NOUT, FMT = 99993) $ ( V1(J,I), J = 1,N ), ( V2(J,I), J = 1,N ) 90 CONTINUE DO 100 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -V2(J,I), J = 1,N ), ( V1(J,I), J = 1,N ) 100 CONTINUE WRITE ( NOUT, FMT = 99989 ) MA02JD( .TRUE., $ .TRUE., N, V1, LDV1, V2, LDV2, $ RES(1,4*N+1), LDRES ) ELSE DO 110 I = 1, N WRITE (NOUT, FMT = 99993) $ ( V1(I,J), J = 1,N ), ( V2(J,I), J = 1,N ) 110 CONTINUE DO 120 I = 1, N WRITE (NOUT, FMT = 99993) $ ( -V2(J,I), J = 1,N ), ( V1(I,J), J = 1,N ) 120 CONTINUE WRITE ( NOUT, FMT = 99989 ) MA02JD( .FALSE., $ .TRUE., N, V1, LDV1, V2, LDV2, $ RES(1,4*N+1), LDRES ) END IF END IF END IF END IF END IF * STOP * 99999 FORMAT (' MB04TS EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04TS = ',I2) 99997 FORMAT (' INFO on exit from MB04WR = ',I2) 99996 FORMAT (' The orthogonal symplectic factor U is ') 99995 FORMAT (/' The factor R is ') 99994 FORMAT (/' The orthogonal symplectic factor V is ') 99993 FORMAT (20(1X,F9.4)) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' Orthogonality of U: || U^T U - I ||_F = ',G7.2) 99990 FORMAT (/' Residual: || H*V - U*R ||_F = ',G7.2) 99989 FORMAT (/' Orthogonality of V: || V^T V - I ||_F = ',G7.2) ENDProgram Data
MB04TB EXAMPLE PROGRAM DATA 5 N N 0.4643 0.3655 0.6853 0.5090 0.3718 0.3688 0.6460 0.4227 0.6798 0.5135 0.7458 0.5043 0.9419 0.9717 0.9990 0.7140 0.4941 0.7802 0.5272 0.1220 0.7418 0.0339 0.7441 0.0436 0.6564 -0.4643 -0.3688 -0.7458 -0.7140 -0.7418 -0.3655 -0.6460 -0.5043 -0.4941 -0.0339 -0.6853 -0.4227 -0.9419 -0.7802 -0.7441 -0.5090 -0.6798 -0.9717 -0.5272 -0.0436 -0.3718 -0.5135 -0.9990 -0.1220 -0.6564 0.7933 1.5765 1.0711 1.0794 0.8481 1.5765 0.1167 1.5685 0.8756 0.5037 1.0711 1.5685 0.9902 0.3858 0.2109 1.0794 0.8756 0.3858 1.8834 1.4338 0.8481 0.5037 0.2109 1.4338 0.1439 1.0786 1.5264 1.1721 1.5343 0.4756 1.5264 0.8644 0.6872 1.1379 0.6499 1.1721 0.6872 1.5194 1.1197 1.0158 1.5343 1.1379 1.1197 0.6612 0.2004 0.4756 0.6499 1.0158 0.2004 1.2188Program Results
MB04TS EXAMPLE PROGRAM RESULTS The orthogonal symplectic factor U is -0.1513 0.0756 -0.0027 0.1694 -0.2999 0.3515 -0.4843 0.6545 -0.1995 -0.1627 -0.1202 0.2320 0.1662 -0.2835 -0.0508 0.4975 0.3319 -0.2686 -0.4186 -0.4649 -0.2431 0.2724 0.3439 0.3954 0.0236 0.3820 -0.2863 -0.4324 0.3706 0.1984 -0.2327 -0.1509 -0.3710 -0.1240 -0.0393 0.5000 0.3659 0.1429 0.0493 0.6015 -0.2418 -0.2928 -0.0836 -0.5549 0.4824 0.1550 -0.4441 -0.0396 0.2376 -0.1702 -0.3515 0.4843 -0.6545 0.1995 0.1627 -0.1513 0.0756 -0.0027 0.1694 -0.2999 -0.4975 -0.3319 0.2686 0.4186 0.4649 -0.1202 0.2320 0.1662 -0.2835 -0.0508 -0.3820 0.2863 0.4324 -0.3706 -0.1984 -0.2431 0.2724 0.3439 0.3954 0.0236 -0.5000 -0.3659 -0.1429 -0.0493 -0.6015 -0.2327 -0.1509 -0.3710 -0.1240 -0.0393 -0.1550 0.4441 0.0396 -0.2376 0.1702 -0.2418 -0.2928 -0.0836 -0.5549 0.4824 Orthogonality of U: || U^T U - I ||_F = .24E-14 The factor R is -3.0684 4.6724 -0.2613 -0.1996 0.0208 -0.1071 -0.1355 -0.1400 0.4652 -0.5032 0.0000 -1.8037 -0.0301 -0.1137 0.1771 0.0277 0.3929 0.5424 0.5220 -0.4843 0.0000 0.0000 -0.7617 -0.1874 0.2557 0.1244 -0.0012 0.4091 0.5123 -0.3522 0.0000 0.0000 0.0000 -0.6931 -0.4293 -0.3718 0.1542 -0.3635 0.0336 -0.9832 0.0000 0.0000 0.0000 0.0000 0.6469 0.2074 0.0266 0.2028 0.1995 0.2517 0.0000 0.0000 0.0000 0.0000 0.0000 2.6325 -4.7377 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.2702 0.9347 -1.1210 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.3219 -0.5394 0.1748 -0.4788 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1431 -0.1021 0.4974 -0.3565 -0.6402 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1622 -0.2368 0.6126 -0.7369 0.6915 Residual: || H*V - U*R ||_F = .87E-14 The orthogonal symplectic factor V is 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.4740 0.6013 -0.2299 -0.4282 0.0000 0.0061 -0.1732 0.3134 0.2220 0.0000 -0.5553 -0.2623 0.6622 -0.3042 0.0000 -0.0382 0.2453 -0.1662 0.0509 0.0000 -0.5563 0.0322 -0.1431 0.4461 0.0000 -0.0665 -0.4132 -0.3100 -0.4457 0.0000 -0.3872 -0.4022 -0.4194 0.3541 0.0000 -0.0406 0.3820 0.3006 0.3861 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.0061 0.1732 -0.3134 -0.2220 0.0000 -0.4740 0.6013 -0.2299 -0.4282 0.0000 0.0382 -0.2453 0.1662 -0.0509 0.0000 -0.5553 -0.2623 0.6622 -0.3042 0.0000 0.0665 0.4132 0.3100 0.4457 0.0000 -0.5563 0.0322 -0.1431 0.4461 0.0000 0.0406 -0.3820 -0.3006 -0.3861 0.0000 -0.3872 -0.4022 -0.4194 0.3541 Orthogonality of V: || V^T V - I ||_F = .14E-14
Purpose
To perform the Givens transformation, defined by C (cos) and S (sin), and interchange the vectors involved, i.e. |X(i)| | 0 1 | | C S | |X(i)| | | := | | x | | x | |, i = 1,...N. |Y(i)| | 1 0 | |-S C | |Y(i)| REMARK. This routine is a modification of DROT from BLAS. This routine is called only by the SLICOT routines MB04TX and MB04VX.Numerical Aspects
The algorithm is backward stable.Specification
SUBROUTINE MB04TU( N, X, INCX, Y, INCY, C, S ) C .. Scalar Arguments .. INTEGER INCX, INCY, N DOUBLE PRECISION C, S C .. Array Arguments .. DOUBLE PRECISION X(*), Y(*)Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute orthogonal transformations Q and Z such that the transformed pencil Q'(sE-A)Z has the E matrix in column echelon form, where E and A are M-by-N matrices.Specification
SUBROUTINE MB04UD( JOBQ, JOBZ, M, N, A, LDA, E, LDE, Q, LDQ, $ Z, LDZ, RANKE, ISTAIR, TOL, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBQ, JOBZ INTEGER INFO, LDA, LDE, LDQ, LDZ, M, N, RANKE DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER ISTAIR(*) DOUBLE PRECISION A(LDA,*), DWORK(*), E(LDE,*), Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
JOBQ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Q the unitary row permutations, as follows: = 'N': Do not form Q; = 'I': Q is initialized to the unit matrix and the unitary row permutation matrix Q is returned; = 'U': The given matrix Q is updated by the unitary row permutations used in the reduction. JOBZ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Z the unitary column transformations, as follows: = 'N': Do not form Z; = 'I': Z is initialized to the unit matrix and the unitary transformation matrix Z is returned; = 'U': The given matrix Z is updated by the unitary transformations used in the reduction.Input/Output Parameters
M (input) INTEGER The number of rows in the matrices A, E and the order of the matrix Q. M >= 0. N (input) INTEGER The number of columns in the matrices A, E and the order of the matrix Z. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M-by-N part of this array must contain the A matrix of the pencil sE-A. On exit, the leading M-by-N part of this array contains the unitary transformed matrix Q' * A * Z. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading M-by-N part of this array must contain the E matrix of the pencil sE-A, to be reduced to column echelon form. On exit, the leading M-by-N part of this array contains the unitary transformed matrix Q' * E * Z, which is in column echelon form. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,M). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,*) On entry, if JOBQ = 'U', then the leading M-by-M part of this array must contain a given matrix Q (e.g. from a previous call to another SLICOT routine), and on exit, the leading M-by-M part of this array contains the product of the input matrix Q and the row permutation matrix used to transform the rows of matrix E. On exit, if JOBQ = 'I', then the leading M-by-M part of this array contains the matrix of accumulated unitary row transformations performed. If JOBQ = 'N', the array Q is not referenced and can be supplied as a dummy array (i.e. set parameter LDQ = 1 and declare this array to be Q(1,1) in the calling program). LDQ INTEGER The leading dimension of array Q. If JOBQ = 'U' or JOBQ = 'I', LDQ >= MAX(1,M); if JOBQ = 'N', LDQ >= 1. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,*) On entry, if JOBZ = 'U', then the leading N-by-N part of this array must contain a given matrix Z (e.g. from a previous call to another SLICOT routine), and on exit, the leading N-by-N part of this array contains the product of the input matrix Z and the column transformation matrix used to transform the columns of matrix E. On exit, if JOBZ = 'I', then the leading N-by-N part of this array contains the matrix of accumulated unitary column transformations performed. If JOBZ = 'N', the array Z is not referenced and can be supplied as a dummy array (i.e. set parameter LDZ = 1 and declare this array to be Z(1,1) in the calling program). LDZ INTEGER The leading dimension of array Z. If JOBZ = 'U' or JOBZ = 'I', LDZ >= MAX(1,N); if JOBZ = 'N', LDZ >= 1. RANKE (output) INTEGER The computed rank of the unitary transformed matrix E. ISTAIR (output) INTEGER array, dimension (M) This array contains information on the column echelon form of the unitary transformed matrix E. Specifically, ISTAIR(i) = +j if the first non-zero element E(i,j) is a corner point and -j otherwise, for i = 1,2,...,M.Tolerances
TOL DOUBLE PRECISION A tolerance below which matrix elements are considered to be zero. If the user sets TOL to be less than (or equal to) zero then the tolerance is taken as EPS * MAX(ABS(E(I,J))), where EPS is the machine precision (see LAPACK Library routine DLAMCH), I = 1,2,...,M and J = 1,2,...,N.Workspace
DWORK DOUBLE PRECISION array, dimension (MAX(M,N))Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given an M-by-N matrix pencil sE-A with E not necessarily regular, the routine computes a unitary transformed pencil Q'(sE-A)Z such that the matrix Q' * E * Z is in column echelon form (trapezoidal form). Further details can be found in [1]. [An M-by-N matrix E with rank(E) = r is said to be in column echelon form if the following conditions are satisfied: (a) the first (N - r) columns contain only zero elements; and (b) if E(i(k),k) is the last nonzero element in column k for k = N-r+1,...,N, i.e. E(i(k),k) <> 0 and E(j,k) = 0 for j > i(k), then 1 <= i(N-r+1) < i(N-r+2) < ... < i(N) <= M.]References
[1] Beelen, Th. and Van Dooren, P. An improved algorithm for the computation of Kronecker's canonical form of a singular pencil. Linear Algebra and Applications, 105, pp. 9-65, 1988.Numerical Aspects
It is shown in [1] that the algorithm is numerically backward stable. The operations count is proportional to (MAX(M,N))**3.Further Comments
NoneExample
Program Text
* MB04UD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER LDA, LDE, LDQ, LDZ PARAMETER ( LDA = MMAX, LDE = MMAX, LDQ = MMAX, $ LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX,MMAX ) ) * PARAMETER ( LDWORK = NMAX+MMAX ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N, RANKE CHARACTER*1 JOBQ, JOBZ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), E(LDE,NMAX), $ Q(LDQ,MMAX), Z(LDZ,NMAX) INTEGER ISTAIR(MMAX) * .. External Subroutines .. EXTERNAL MB04UD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, TOL IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,M ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,M ) JOBQ = 'N' JOBZ = 'N' * Reduce E to column echelon form and compute Q'*A*Z. CALL MB04UD( JOBQ, JOBZ, M, N, A, LDA, E, LDE, Q, LDQ, Z, LDZ, $ RANKE, ISTAIR, TOL, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99991 ) DO 10 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99997 ) DO 100 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( E(I,J), J = 1,N ) 100 CONTINUE WRITE ( NOUT, FMT = 99995 ) RANKE WRITE ( NOUT, FMT = 99994 ) ( ISTAIR(I), I = 1,M ) END IF END IF STOP * 99999 FORMAT (' MB04UD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04UD = ',I2) 99997 FORMAT (' The transformed matrix E is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The computed rank of E = ',I2) 99994 FORMAT (/' ISTAIR is ',/20(1X,I5)) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (' The transformed matrix A is ') ENDProgram Data
MB04UD EXAMPLE PROGRAM DATA 4 4 0.0 2.0 0.0 2.0 -2.0 0.0 -2.0 0.0 2.0 2.0 0.0 -2.0 0.0 2.0 -2.0 0.0 2.0 1.0 0.0 1.0 -1.0 0.0 -1.0 0.0 1.0 1.0 0.0 -1.0 0.0 1.0 -1.0 0.0 1.0Program Results
MB04UD EXAMPLE PROGRAM RESULTS The transformed matrix A is 0.5164 1.0328 1.1547 -2.3094 0.0000 -2.5820 0.0000 -1.1547 0.0000 0.0000 -3.4641 0.0000 0.0000 0.0000 0.0000 -3.4641 The transformed matrix E is 0.2582 0.5164 0.5774 -1.1547 0.0000 -1.2910 0.0000 -0.5774 0.0000 0.0000 -1.7321 0.0000 0.0000 0.0000 0.0000 -1.7321 The computed rank of E = 4 ISTAIR is 1 2 3 4
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04VD.html 0000664 0000000 0000000 00000046315 14560147231 0020357 0 ustar 00root root 0000000 0000000
Purpose
To compute orthogonal transformations Q and Z such that the transformed pencil Q'(sE-A)Z is in upper block triangular form, where E is an M-by-N matrix in column echelon form (see SLICOT Library routine MB04UD) and A is an M-by-N matrix. If MODE = 'B', then the matrices A and E are transformed into the following generalized Schur form by unitary transformations Q1 and Z1 : | sE(eps,inf)-A(eps,inf) | X | Q1'(sE-A)Z1 = |------------------------|------------|. (1) | O | sE(r)-A(r) | The pencil sE(eps,inf)-A(eps,inf) is in staircase form, and it contains all Kronecker column indices and infinite elementary divisors of the pencil sE-A. The pencil sE(r)-A(r) contains all Kronecker row indices and elementary divisors of sE-A. Note: X is a pencil. If MODE = 'T', then the submatrices having full row and column rank in the pencil sE(eps,inf)-A(eps,inf) in (1) are triangularized by applying unitary transformations Q2 and Z2 to Q1'*(sE-A)*Z1. If MODE = 'S', then the pencil sE(eps,inf)-A(eps,inf) in (1) is separated into sE(eps)-A(eps) and sE(inf)-A(inf) by applying unitary transformations Q3 and Z3 to Q2'*Q1'*(sE-A)*Z1*Z2. This gives | sE(eps)-A(eps) | X | X | |----------------|----------------|------------| | O | sE(inf)-A(inf) | X | Q'(sE-A)Z =|=================================|============| (2) | | | | O | sE(r)-A(r) | where Q = Q1*Q2*Q3 and Z = Z1*Z2*Z3. Note: the pencil sE(r)-A(r) is not reduced further.Specification
SUBROUTINE MB04VD( MODE, JOBQ, JOBZ, M, N, RANKE, A, LDA, E, LDE, $ Q, LDQ, Z, LDZ, ISTAIR, NBLCKS, NBLCKI, IMUK, $ INUK, IMUK0, MNEI, TOL, IWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBQ, JOBZ, MODE INTEGER INFO, LDA, LDE, LDQ, LDZ, M, N, NBLCKI, NBLCKS, $ RANKE DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IMUK(*), IMUK0(*), INUK(*), ISTAIR(*), IWORK(*), $ MNEI(*) DOUBLE PRECISION A(LDA,*), E(LDE,*), Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
MODE CHARACTER*1 Specifies the desired structure of the transformed pencil Q'(sE-A)Z to be computed as follows: = 'B': Basic reduction given by (1); = 'T': Further reduction of (1) to triangular form; = 'S': Further separation of sE(eps,inf)-A(eps,inf) in (1) into the two pencils in (2). JOBQ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Q the orthogonal row transformations, as follows: = 'N': Do not form Q; = 'I': Q is initialized to the unit matrix and the orthogonal transformation matrix Q is returned; = 'U': The given matrix Q is updated by the orthogonal row transformations used in the reduction. JOBZ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Z the orthogonal column transformations, as follows: = 'N': Do not form Z; = 'I': Z is initialized to the unit matrix and the orthogonal transformation matrix Z is returned; = 'U': The given matrix Z is updated by the orthogonal transformations used in the reduction.Input/Output Parameters
M (input) INTEGER The number of rows in the matrices A, E and the order of the matrix Q. M >= 0. N (input) INTEGER The number of columns in the matrices A, E and the order of the matrix Z. N >= 0. RANKE (input) INTEGER The rank of the matrix E in column echelon form. RANKE >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M-by-N part of this array must contain the matrix to be row compressed. On exit, the leading M-by-N part of this array contains the matrix that has been row compressed while keeping matrix E in column echelon form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading M-by-N part of this array must contain the matrix in column echelon form to be transformed equivalent to matrix A. On exit, the leading M-by-N part of this array contains the matrix that has been transformed equivalent to matrix A. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,M). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,*) On entry, if JOBQ = 'U', then the leading M-by-M part of this array must contain a given matrix Q (e.g. from a previous call to another SLICOT routine), and on exit, the leading M-by-M part of this array contains the product of the input matrix Q and the row transformation matrix used to transform the rows of matrices A and E. On exit, if JOBQ = 'I', then the leading M-by-M part of this array contains the matrix of accumulated orthogonal row transformations performed. If JOBQ = 'N', the array Q is not referenced and can be supplied as a dummy array (i.e. set parameter LDQ = 1 and declare this array to be Q(1,1) in the calling program). LDQ INTEGER The leading dimension of array Q. If JOBQ = 'U' or JOBQ = 'I', LDQ >= MAX(1,M); if JOBQ = 'N', LDQ >= 1. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,*) On entry, if JOBZ = 'U', then the leading N-by-N part of this array must contain a given matrix Z (e.g. from a previous call to another SLICOT routine), and on exit, the leading N-by-N part of this array contains the product of the input matrix Z and the column transformation matrix used to transform the columns of matrices A and E. On exit, if JOBZ = 'I', then the leading N-by-N part of this array contains the matrix of accumulated orthogonal column transformations performed. If JOBZ = 'N', the array Z is not referenced and can be supplied as a dummy array (i.e. set parameter LDZ = 1 and declare this array to be Z(1,1) in the calling program). LDZ INTEGER The leading dimension of array Z. If JOBZ = 'U' or JOBZ = 'I', LDZ >= MAX(1,N); if JOBZ = 'N', LDZ >= 1. ISTAIR (input/output) INTEGER array, dimension (M) On entry, this array must contain information on the column echelon form of the unitary transformed matrix E. Specifically, ISTAIR(i) must be set to +j if the first non-zero element E(i,j) is a corner point and -j otherwise, for i = 1,2,...,M. On exit, this array contains no useful information. NBLCKS (output) INTEGER The number of submatrices having full row rank greater than or equal to 0 detected in matrix A in the pencil sE(x)-A(x), where x = eps,inf if MODE = 'B' or 'T', or x = eps if MODE = 'S'. NBLCKI (output) INTEGER If MODE = 'S', the number of diagonal submatrices in the pencil sE(inf)-A(inf). If MODE = 'B' or 'T' then NBLCKI = 0. IMUK (output) INTEGER array, dimension (MAX(N,M+1)) The leading NBLCKS elements of this array contain the column dimensions mu(1),...,mu(NBLCKS) of the submatrices having full column rank in the pencil sE(x)-A(x), where x = eps,inf if MODE = 'B' or 'T', or x = eps if MODE = 'S'. INUK (output) INTEGER array, dimension (MAX(N,M+1)) The leading NBLCKS elements of this array contain the row dimensions nu(1),...,nu(NBLCKS) of the submatrices having full row rank in the pencil sE(x)-A(x), where x = eps,inf if MODE = 'B' or 'T', or x = eps if MODE = 'S'. IMUK0 (output) INTEGER array, dimension (limuk0), where limuk0 = N if MODE = 'S' and 1, otherwise. If MODE = 'S', then the leading NBLCKI elements of this array contain the dimensions mu0(1),...,mu0(NBLCKI) of the square diagonal submatrices in the pencil sE(inf)-A(inf). Otherwise, IMUK0 is not referenced and can be supplied as a dummy array. MNEI (output) INTEGER array, dimension (3) If MODE = 'B' or 'T' then MNEI(1) contains the row dimension of sE(eps,inf)-A(eps,inf); MNEI(2) contains the column dimension of sE(eps,inf)-A(eps,inf); MNEI(3) = 0. If MODE = 'S', then MNEI(1) contains the row dimension of sE(eps)-A(eps); MNEI(2) contains the column dimension of sE(eps)-A(eps); MNEI(3) contains the order of the regular pencil sE(inf)-A(inf).Tolerances
TOL DOUBLE PRECISION A tolerance below which matrix elements are considered to be zero. If the user sets TOL to be less than (or equal to) zero then the tolerance is taken as EPS * MAX( ABS(A(I,J)), ABS(E(I,J)) ), where EPS is the machine precision (see LAPACK Library routine DLAMCH), I = 1,2,...,M and J = 1,2,...,N.Workspace
IWORK INTEGER array, dimension (N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value. > 0: if incorrect rank decisions were revealed during the triangularization phase. This failure is not likely to occur. The possible values are: = 1: if incorrect dimensions of a full column rank submatrix; = 2: if incorrect dimensions of a full row rank submatrix.Method
Let sE - A be an arbitrary pencil. Prior to calling the routine, this pencil must be transformed into a pencil with E in column echelon form. This may be accomplished by calling the SLICOT Library routine MB04UD. Depending on the value of MODE, submatrices of A and E are then reduced to one of the forms described above. Further details can be found in [1].References
[1] Beelen, Th. and Van Dooren, P. An improved algorithm for the computation of Kronecker's canonical form of a singular pencil. Linear Algebra and Applications, 105, pp. 9-65, 1988.Numerical Aspects
It is shown in [1] that the algorithm is numerically backward stable. The operations count is proportional to (MAX(M,N))**3.Further Comments
The difference mu(k)-nu(k), for k = 1,2,...,NBLCKS, is the number of elementary Kronecker blocks of size k x (k+1). If MODE = 'B' or 'T' on entry, then the difference nu(k)-mu(k+1), for k = 1,2,...,NBLCKS, is the number of infinite elementary divisors of degree k (with mu(NBLCKS+1) = 0). If MODE = 'S' on entry, then the difference mu0(k)-mu0(k+1), for k = 1,2,...,NBLCKI, is the number of infinite elementary divisors of degree k (with mu0(NBLCKI+1) = 0). In the pencil sE(r)-A(r), the pencils sE(f)-A(f) and sE(eta)-A(eta) can be separated by pertransposing the pencil sE(r)-A(r) and calling the routine with MODE set to 'B'. The result has got to be pertransposed again. (For more details see [1]).Example
Program Text
* MB04VD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER LDA, LDE, LDQ, LDZ PARAMETER ( LDA = MMAX, LDE = MMAX, LDQ = MMAX, $ LDZ = NMAX ) INTEGER LINUK PARAMETER ( LINUK = MAX( NMAX,MMAX+1 ) ) * PARAMETER ( LINUK = NMAX+MMAX+1 ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX,MMAX ) ) * PARAMETER ( LDWORK = NMAX+MMAX ) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N, NBLCKI, NBLCKS, RANKE CHARACTER*1 JOBQ, JOBZ, MODE * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), E(LDE,NMAX), $ Q(LDQ,MMAX), Z(LDZ,NMAX) INTEGER IMUK(LINUK), IMUK0(NMAX), INUK(LINUK), $ ISTAIR(MMAX), IWORK(LIWORK), MNEI(3) C .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB04UD, MB04VD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, TOL, MODE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99984 ) M ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99983 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,M ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,M ) JOBQ = 'I' JOBZ = 'I' * Reduce E to column echelon form and compute Q'*A*Z. CALL MB04UD( JOBQ, JOBZ, M, N, A, LDA, E, LDE, Q, LDQ, Z, LDZ, $ RANKE, ISTAIR, TOL, DWORK, INFO ) JOBQ = 'U' JOBZ = 'U' * IF ( INFO.EQ.0 ) THEN * Compute a unitary transformed pencil Q'*(s*E-A)*Z. CALL MB04VD( MODE, JOBQ, JOBZ, M, N, RANKE, A, LDA, E, LDE, $ Q, LDQ, Z, LDZ, ISTAIR, NBLCKS, NBLCKI, IMUK, $ INUK, IMUK0, MNEI, TOL, IWORK, INFO ) * IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99996 ) WRITE ( NOUT, FMT = 99995 ) DO 140 I = 1, M WRITE ( NOUT, FMT = 99994 ) ( Q(I,J), J = 1,M ) 140 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 160 I = 1, M WRITE ( NOUT, FMT = 99994 ) ( E(I,J), J = 1,N ) 160 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 180 I = 1, M WRITE ( NOUT, FMT = 99994 ) ( A(I,J), J = 1,N ) 180 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 200 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( Z(I,J), J = 1,N ) 200 CONTINUE WRITE ( NOUT, FMT = 99990 ) NBLCKS IF ( .NOT. LSAME( MODE, 'S' ) ) THEN WRITE ( NOUT, FMT = 99989 ) ( IMUK(I), I = 1,NBLCKS ) WRITE ( NOUT, FMT = 99988 ) ( INUK(I), I = 1,NBLCKS ) ELSE WRITE ( NOUT, FMT = 99987 ) ( IMUK(I), I = 1,NBLCKS ) WRITE ( NOUT, FMT = 99986 ) ( INUK(I), I = 1,NBLCKS ) WRITE ( NOUT, FMT = 99982 ) ( IMUK0(I), I = 1,NBLCKI ) WRITE ( NOUT, FMT = 99985 ) ( MNEI(I), I = 1,3 ) END IF ELSE WRITE ( NOUT, FMT = 99998 ) INFO END IF ELSE WRITE ( NOUT, FMT = 99997 ) INFO END IF END IF STOP * 99999 FORMAT (' MB04VD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04VD = ',I2) 99997 FORMAT (' INFO on exit from MB04UD = ',I2) 99996 FORMAT (' The unitary transformed pencil is Q''*(s*E-A)*Z, where', $ /) 99995 FORMAT (' Matrix Q',/) 99994 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' Matrix E',/) 99992 FORMAT (/' Matrix A',/) 99991 FORMAT (/' Matrix Z',/) 99990 FORMAT (/' The number of submatrices having full row rank detect', $ 'ed in matrix A = ',I3) 99989 FORMAT (/' The column dimensions of the submatrices having full ', $ 'column rank in the pencil',/' sE(eps,inf) - A(eps,inf) a', $ 're',/20(1X,I5)) 99988 FORMAT (/' The row dimensions of the submatrices having full row', $ ' rank in the pencil',/' sE(eps,inf) - A(eps,inf) are', $ /20(1X,I5)) 99987 FORMAT (/' The column dimensions of the submatrices having full ', $ 'column rank in the pencil',/' sE(eps) - A(eps) are', $ /20(1X,I5)) 99986 FORMAT (/' The row dimensions of the submatrices having full row', $ ' rank in the pencil',/' sE(eps) - A(eps) are',/20(1X,I5)) 99985 FORMAT (/' MNEI is ',/20(1X,I5)) 99984 FORMAT (/' M is out of range.',/' M = ',I5) 99983 FORMAT (/' N is out of range.',/' N = ',I5) 99982 FORMAT (/' The orders of the diagonal submatrices in the pencil ', $ 'sE(inf) - A(inf) are',/20(1X,I5)) ENDProgram Data
MB04VD EXAMPLE PROGRAM DATA 2 4 0.0 S 1.0 0.0 -1.0 0.0 1.0 1.0 0.0 -1.0 0.0 -1.0 0.0 0.0 0.0 -1.0 0.0 0.0Program Results
MB04VD EXAMPLE PROGRAM RESULTS The unitary transformed pencil is Q'*(s*E-A)*Z, where Matrix Q 0.7071 -0.7071 0.7071 0.7071 Matrix E 0.0000 0.0000 -1.1547 0.8165 0.0000 0.0000 0.0000 0.0000 Matrix A 0.0000 1.7321 0.5774 -0.4082 0.0000 0.0000 0.0000 -1.2247 Matrix Z 0.5774 0.8165 0.0000 0.0000 0.0000 0.0000 0.8165 -0.5774 0.5774 -0.4082 -0.4082 -0.5774 0.5774 -0.4082 0.4082 0.5774 The number of submatrices having full row rank detected in matrix A = 2 The column dimensions of the submatrices having full column rank in the pencil sE(eps) - A(eps) are 2 1 The row dimensions of the submatrices having full row rank in the pencil sE(eps) - A(eps) are 1 0 The orders of the diagonal submatrices in the pencil sE(inf) - A(inf) are 1 MNEI is 1 3 1
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04WD.html 0000664 0000000 0000000 00000014371 14560147231 0020355 0 ustar 00root root 0000000 0000000
Purpose
To generate a matrix Q with orthogonal columns (spanning an isotropic subspace), which is defined as the first n columns of a product of symplectic reflectors and Givens rotations, Q = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(k),H(k) ) G(k) diag( F(k),F(k) ). The matrix Q is returned in terms of its first 2*M rows [ op( Q1 ) op( Q2 ) ] Q = [ ]. [ -op( Q2 ) op( Q1 ) ] Blocked version of the SLICOT Library routine MB04WU.Specification
SUBROUTINE MB04WD( TRANQ1, TRANQ2, M, N, K, Q1, LDQ1, Q2, LDQ2, $ CS, TAU, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANQ1, TRANQ2 INTEGER INFO, K, LDQ1, LDQ2, LDWORK, M, N C .. Array Arguments .. DOUBLE PRECISION CS(*), DWORK(*), Q1(LDQ1,*), Q2(LDQ2,*), TAU(*)Arguments
Mode Parameters
TRANQ1 CHARACTER*1 Specifies the form of op( Q1 ) as follows: = 'N': op( Q1 ) = Q1; = 'T': op( Q1 ) = Q1'; = 'C': op( Q1 ) = Q1'. TRANQ2 CHARACTER*1 Specifies the form of op( Q2 ) as follows: = 'N': op( Q2 ) = Q2; = 'T': op( Q2 ) = Q2'; = 'C': op( Q2 ) = Q2'.Input/Output Parameters
M (input) INTEGER The number of rows of the matrices Q1 and Q2. M >= 0. N (input) INTEGER The number of columns of the matrices Q1 and Q2. M >= N >= 0. K (input) INTEGER The number of symplectic Givens rotations whose product partly defines the matrix Q. N >= K >= 0. Q1 (input/output) DOUBLE PRECISION array, dimension (LDQ1,N) if TRANQ1 = 'N', (LDQ1,M) if TRANQ1 = 'T' or TRANQ1 = 'C' On entry with TRANQ1 = 'N', the leading M-by-K part of this array must contain in its i-th column the vector which defines the elementary reflector F(i). On entry with TRANQ1 = 'T' or TRANQ1 = 'C', the leading K-by-M part of this array must contain in its i-th row the vector which defines the elementary reflector F(i). On exit with TRANQ1 = 'N', the leading M-by-N part of this array contains the matrix Q1. On exit with TRANQ1 = 'T' or TRANQ1 = 'C', the leading N-by-M part of this array contains the matrix Q1'. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= MAX(1,M), if TRANQ1 = 'N'; LDQ1 >= MAX(1,N), if TRANQ1 = 'T' or TRANQ1 = 'C'. Q2 (input/output) DOUBLE PRECISION array, dimension (LDQ2,N) if TRANQ2 = 'N', (LDQ2,M) if TRANQ2 = 'T' or TRANQ2 = 'C' On entry with TRANQ2 = 'N', the leading M-by-K part of this array must contain in its i-th column the vector which defines the elementary reflector H(i) and, on the diagonal, the scalar factor of H(i). On entry with TRANQ2 = 'T' or TRANQ2 = 'C', the leading K-by-M part of this array must contain in its i-th row the vector which defines the elementary reflector H(i) and, on the diagonal, the scalar factor of H(i). On exit with TRANQ2 = 'N', the leading M-by-N part of this array contains the matrix Q2. On exit with TRANQ2 = 'T' or TRANQ2 = 'C', the leading N-by-M part of this array contains the matrix Q2'. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= MAX(1,M), if TRANQ2 = 'N'; LDQ2 >= MAX(1,N), if TRANQ2 = 'T' or TRANQ2 = 'C'. CS (input) DOUBLE PRECISION array, dimension (2*K) On entry, the first 2*K elements of this array must contain the cosines and sines of the symplectic Givens rotations G(i). TAU (input) DOUBLE PRECISION array, dimension (K) On entry, the first K elements of this array must contain the scalar factors of the elementary reflectors F(i).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, MAX(M+N,8*N*NB + 15*NB*NB), where NB is the optimal block size determined by the function UE01MD. On exit, if INFO = -13, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,M+N). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Kressner, D. Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To generate an orthogonal symplectic matrix U, which is defined as a product of symplectic reflectors and Givens rotations U = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(n-1),H(n-1) ) G(n-1) diag( F(n-1),F(n-1) ). as returned by MB04PU. The matrix U is returned in terms of its first N rows [ U1 U2 ] U = [ ]. [ -U2 U1 ]Specification
SUBROUTINE MB04WP( N, ILO, U1, LDU1, U2, LDU2, CS, TAU, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER ILO, INFO, LDU1, LDU2, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION CS(*), DWORK(*), U1(LDU1,*), U2(LDU2,*), TAU(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrices U1 and U2. N >= 0. ILO (input) INTEGER ILO must have the same value as in the previous call of MB04PU. U is equal to the unit matrix except in the submatrix U([ilo+1:n n+ilo+1:2*n], [ilo+1:n n+ilo+1:2*n]). 1 <= ILO <= N, if N > 0; ILO = 1, if N = 0. U1 (input/output) DOUBLE PRECISION array, dimension (LDU1,N) On entry, the leading N-by-N part of this array must contain in its i-th column the vector which defines the elementary reflector F(i). On exit, the leading N-by-N part of this array contains the matrix U1. LDU1 INTEGER The leading dimension of the array U1. LDU1 >= MAX(1,N). U2 (input/output) DOUBLE PRECISION array, dimension (LDU2,N) On entry, the leading N-by-N part of this array must contain in its i-th column the vector which defines the elementary reflector H(i) and, on the subdiagonal, the scalar factor of H(i). On exit, the leading N-by-N part of this array contains the matrix U2. LDU2 INTEGER The leading dimension of the array U2. LDU2 >= MAX(1,N). CS (input) DOUBLE PRECISION array, dimension (2N-2) On entry, the first 2N-2 elements of this array must contain the cosines and sines of the symplectic Givens rotations G(i). TAU (input) DOUBLE PRECISION array, dimension (N-1) On entry, the first N-1 elements of this array must contain the scalar factors of the elementary reflectors F(i).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -10, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,2*(N-ILO)). For optimum performance LDWORK should be larger. (See SLICOT Library routine MB04WD). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Numerical Aspects
The algorithm requires O(N**3) floating point operations and is strongly backward stable.References
[1] C. F. VAN LOAN: A symplectic method for approximating all the eigenvalues of a Hamiltonian matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984. [2] D. KRESSNER: Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To generate orthogonal symplectic matrices U or V, defined as products of symplectic reflectors and Givens rotations U = diag( HU(1),HU(1) ) GU(1) diag( FU(1),FU(1) ) diag( HU(2),HU(2) ) GU(2) diag( FU(2),FU(2) ) .... diag( HU(n),HU(n) ) GU(n) diag( FU(n),FU(n) ), V = diag( HV(1),HV(1) ) GV(1) diag( FV(1),FV(1) ) diag( HV(2),HV(2) ) GV(2) diag( FV(2),FV(2) ) .... diag( HV(n-1),HV(n-1) ) GV(n-1) diag( FV(n-1),FV(n-1) ), as returned by the SLICOT Library routines MB04TS or MB04TB. The matrices U and V are returned in terms of their first N/2 rows: [ U1 U2 ] [ V1 V2 ] U = [ ], V = [ ]. [ -U2 U1 ] [ -V2 V1 ]Specification
SUBROUTINE MB04WR( JOB, TRANS, N, ILO, Q1, LDQ1, Q2, LDQ2, CS, $ TAU, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOB, TRANS INTEGER ILO, INFO, LDQ1, LDQ2, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION CS(*), DWORK(*), Q1(LDQ1,*), Q2(LDQ2,*), TAU(*)Arguments
Input/Output Parameters
JOB CHARACTER*1 Specifies whether the matrix U or the matrix V is required: = 'U': generate U; = 'V': generate V. TRANS CHARACTER*1 If JOB = 'U' then TRANS must have the same value as the argument TRANA in the previous call of MB04TS or MB04TB. If JOB = 'V' then TRANS must have the same value as the argument TRANB in the previous call of MB04TS or MB04TB. N (input) INTEGER The order of the matrices Q1 and Q2. N >= 0. ILO (input) INTEGER ILO must have the same value as in the previous call of MB04TS or MB04TB. U and V are equal to the unit matrix except in the submatrices U([ilo:n n+ilo:2*n], [ilo:n n+ilo:2*n]) and V([ilo+1:n n+ilo+1:2*n], [ilo+1:n n+ilo+1:2*n]), respectively. 1 <= ILO <= N, if N > 0; ILO = 1, if N = 0. Q1 (input/output) DOUBLE PRECISION array, dimension (LDQ1,N) On entry, if JOB = 'U' and TRANS = 'N' then the leading N-by-N part of this array must contain in its i-th column the vector which defines the elementary reflector FU(i). If JOB = 'U' and TRANS = 'T' or TRANS = 'C' then the leading N-by-N part of this array must contain in its i-th row the vector which defines the elementary reflector FU(i). If JOB = 'V' and TRANS = 'N' then the leading N-by-N part of this array must contain in its i-th row the vector which defines the elementary reflector FV(i). If JOB = 'V' and TRANS = 'T' or TRANS = 'C' then the leading N-by-N part of this array must contain in its i-th column the vector which defines the elementary reflector FV(i). On exit, if JOB = 'U' and TRANS = 'N' then the leading N-by-N part of this array contains the matrix U1. If JOB = 'U' and TRANS = 'T' or TRANS = 'C' then the leading N-by-N part of this array contains the matrix U1**T. If JOB = 'V' and TRANS = 'N' then the leading N-by-N part of this array contains the matrix V1**T. If JOB = 'V' and TRANS = 'T' or TRANS = 'C' then the leading N-by-N part of this array contains the matrix V1. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= MAX(1,N). Q2 (input/output) DOUBLE PRECISION array, dimension (LDQ2,N) On entry, if JOB = 'U' then the leading N-by-N part of this array must contain in its i-th column the vector which defines the elementary reflector HU(i). If JOB = 'V' then the leading N-by-N part of this array must contain in its i-th row the vector which defines the elementary reflector HV(i). On exit, if JOB = 'U' then the leading N-by-N part of this array contains the matrix U2. If JOB = 'V' then the leading N-by-N part of this array contains the matrix V2**T. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= MAX(1,N). CS (input) DOUBLE PRECISION array, dimension (2N) On entry, if JOB = 'U' then the first 2N elements of this array must contain the cosines and sines of the symplectic Givens rotations GU(i). If JOB = 'V' then the first 2N-2 elements of this array must contain the cosines and sines of the symplectic Givens rotations GV(i). TAU (input) DOUBLE PRECISION array, dimension (N) On entry, if JOB = 'U' then the first N elements of this array must contain the scalar factors of the elementary reflectors FU(i). If JOB = 'V' then the first N-1 elements of this array must contain the scalar factors of the elementary reflectors FV(i).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -12, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,2*(N-ILO+1)). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Benner, P., Mehrmann, V., and Xu, H. A numerically stable, structure preserving method for computing the eigenvalues of real Hamiltonian or symplectic pencils. Numer. Math., Vol 78 (3), pp. 329-358, 1998. [2] Kressner, D. Block algorithms for orthogonal symplectic factorizations. BIT, 43 (4), pp. 775-790, 2003.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To generate a matrix Q with orthogonal columns (spanning an isotropic subspace), which is defined as the first n columns of a product of symplectic reflectors and Givens rotations, Q = diag( H(1),H(1) ) G(1) diag( F(1),F(1) ) diag( H(2),H(2) ) G(2) diag( F(2),F(2) ) .... diag( H(k),H(k) ) G(k) diag( F(k),F(k) ). The matrix Q is returned in terms of its first 2*M rows [ op( Q1 ) op( Q2 ) ] Q = [ ]. [ -op( Q2 ) op( Q1 ) ]Specification
SUBROUTINE MB04WU( TRANQ1, TRANQ2, M, N, K, Q1, LDQ1, Q2, LDQ2, $ CS, TAU, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANQ1, TRANQ2 INTEGER INFO, K, LDQ1, LDQ2, LDWORK, M, N C .. Array Arguments .. DOUBLE PRECISION CS(*), DWORK(*), Q1(LDQ1,*), Q2(LDQ2,*), TAU(*)Arguments
Mode Parameters
TRANQ1 CHARACTER*1 Specifies the form of op( Q1 ) as follows: = 'N': op( Q1 ) = Q1; = 'T': op( Q1 ) = Q1'; = 'C': op( Q1 ) = Q1'. TRANQ2 CHARACTER*1 Specifies the form of op( Q2 ) as follows: = 'N': op( Q2 ) = Q2; = 'T': op( Q2 ) = Q2'; = 'C': op( Q2 ) = Q2'.Input/Output Parameters
M (input) INTEGER The number of rows of the matrices Q1 and Q2. M >= 0. N (input) INTEGER The number of columns of the matrices Q1 and Q2. M >= N >= 0. K (input) INTEGER The number of symplectic Givens rotations whose product partly defines the matrix Q. N >= K >= 0. Q1 (input/output) DOUBLE PRECISION array, dimension (LDQ1,N) if TRANQ1 = 'N', (LDQ1,M) if TRANQ1 = 'T' or TRANQ1 = 'C' On entry with TRANQ1 = 'N', the leading M-by-K part of this array must contain in its i-th column the vector which defines the elementary reflector F(i). On entry with TRANQ1 = 'T' or TRANQ1 = 'C', the leading K-by-M part of this array must contain in its i-th row the vector which defines the elementary reflector F(i). On exit with TRANQ1 = 'N', the leading M-by-N part of this array contains the matrix Q1. On exit with TRANQ1 = 'T' or TRANQ1 = 'C', the leading N-by-M part of this array contains the matrix Q1'. LDQ1 INTEGER The leading dimension of the array Q1. LDQ1 >= MAX(1,M), if TRANQ1 = 'N'; LDQ1 >= MAX(1,N), if TRANQ1 = 'T' or TRANQ1 = 'C'. Q2 (input/output) DOUBLE PRECISION array, dimension (LDQ2,N) if TRANQ2 = 'N', (LDQ2,M) if TRANQ2 = 'T' or TRANQ2 = 'C' On entry with TRANQ2 = 'N', the leading M-by-K part of this array must contain in its i-th column the vector which defines the elementary reflector H(i) and, on the diagonal, the scalar factor of H(i). On entry with TRANQ2 = 'T' or TRANQ2 = 'C', the leading K-by-M part of this array must contain in its i-th row the vector which defines the elementary reflector H(i) and, on the diagonal, the scalar factor of H(i). On exit with TRANQ2 = 'N', the leading M-by-N part of this array contains the matrix Q2. On exit with TRANQ2 = 'T' or TRANQ2 = 'C', the leading N-by-M part of this array contains the matrix Q2'. LDQ2 INTEGER The leading dimension of the array Q2. LDQ2 >= MAX(1,M), if TRANQ2 = 'N'; LDQ2 >= MAX(1,N), if TRANQ2 = 'T' or TRANQ2 = 'C'. CS (input) DOUBLE PRECISION array, dimension (2*K) On entry, the first 2*K elements of this array must contain the cosines and sines of the symplectic Givens rotations G(i). TAU (input) DOUBLE PRECISION array, dimension (K) On entry, the first K elements of this array must contain the scalar factors of the elementary reflectors F(i).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -13, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,M+N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[1] Bunse-Gerstner, A. Matrix factorizations for symplectic QR-like methods. Linear Algebra Appl., 83, pp. 49-77, 1986.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a basis for the left and/or right singular subspace of an M-by-N matrix A corresponding to its smallest singular values.Specification
SUBROUTINE MB04XD( JOBU, JOBV, M, N, RANK, THETA, A, LDA, U, LDU, $ V, LDV, Q, INUL, TOL, RELTOL, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER JOBU, JOBV INTEGER INFO, IWARN, LDA, LDU, LDV, LDWORK, M, N, RANK DOUBLE PRECISION RELTOL, THETA, TOL C .. Array Arguments .. LOGICAL INUL(*) DOUBLE PRECISION A(LDA,*), DWORK(*), Q(*), U(LDU,*), V(LDV,*)Arguments
Mode Parameters
JOBU CHARACTER*1 Specifies whether to compute the left singular subspace as follows: = 'N': Do not compute the left singular subspace; = 'A': Return the (M - RANK) base vectors of the desired left singular subspace in U; = 'S': Return the first (min(M,N) - RANK) base vectors of the desired left singular subspace in U. JOBV CHARACTER*1 Specifies whether to compute the right singular subspace as follows: = 'N': Do not compute the right singular subspace; = 'A': Return the (N - RANK) base vectors of the desired right singular subspace in V; = 'S': Return the first (min(M,N) - RANK) base vectors of the desired right singular subspace in V.Input/Output Parameters
M (input) INTEGER The number of rows in matrix A. M >= 0. N (input) INTEGER The number of columns in matrix A. N >= 0. RANK (input/output) INTEGER On entry, if RANK < 0, then the rank of matrix A is computed by the routine as the number of singular values greater than THETA. Otherwise, RANK must specify the rank of matrix A. RANK <= min(M,N). On exit, if RANK < 0 on entry, then RANK contains the computed rank of matrix A. That is, the number of singular values of A greater than THETA. Otherwise, the user-supplied value of RANK may be changed by the routine on exit if the RANK-th and the (RANK+1)-th singular values of A are considered to be equal. See also the description of parameter TOL below. THETA (input/output) DOUBLE PRECISION On entry, if RANK < 0, then THETA must specify an upper bound on the smallest singular values of A corresponding to the singular subspace to be computed. THETA >= 0.0. Otherwise, THETA must specify an initial estimate (t say) for computing an upper bound on the (min(M,N) - RANK) smallest singular values of A. If THETA < 0.0, then t is computed by the routine. On exit, if RANK >= 0 on entry, then THETA contains the computed upper bound such that precisely RANK singular values of A are greater than THETA + TOL. Otherwise, THETA is unchanged. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix A from which the basis of a desired singular subspace is to be computed. NOTE that this array is destroyed. LDA INTEGER The leading dimension of array A. LDA >= max(1,M). U (output) DOUBLE PRECISION array, dimension (LDU,*) If JOBU = 'A', then the leading M-by-M part of this array contains the (M - RANK) M-dimensional base vectors of the desired left singular subspace of A corresponding to its singular values less than or equal to THETA. These vectors are stored in the i-th column(s) of U for which INUL(i) = .TRUE., where i = 1,2,...,M. If JOBU = 'S', then the leading M-by-min(M,N) part of this array contains the first (min(M,N) - RANK) M-dimensional base vectors of the desired left singular subspace of A corresponding to its singular values less than or equal to THETA. These vectors are stored in the i-th column(s) of U for which INUL(i) = .TRUE., where i = 1,2,..., min(M,N). Otherwise, U is not referenced (since JOBU = 'N') and can be supplied as a dummy array (i.e. set parameter LDU = 1 and declare this array to be U(1,1) in the calling program). LDU INTEGER The leading dimension of array U. LDU >= max(1,M) if JOBU = 'A' or JOBU = 'S', LDU >= 1 if JOBU = 'N'. V (output) DOUBLE PRECISION array, dimension (LDV,*) If JOBV = 'A', then the leading N-by-N part of this array contains the (N - RANK) N-dimensional base vectors of the desired right singular subspace of A corresponding to its singular values less than or equal to THETA. These vectors are stored in the i-th column(s) of V for which INUL(i) = .TRUE., where i = 1,2,...,N. If JOBV = 'S', then the leading N-by-min(M,N) part of this array contains the first (min(M,N) - RANK) N-dimensional base vectors of the desired right singular subspace of A corresponding to its singular values less than or equal to THETA. These vectors are stored in the i-th column(s) of V for which INUL(i) = .TRUE., where i = 1,2,...,MIN( M,N). Otherwise, V is not referenced (since JOBV = 'N') and can be supplied as a dummy array (i.e. set parameter LDV = 1 and declare this array to be V(1,1) in the calling program). LDV INTEGER The leading dimension of array V. LDV >= max(1,N) if JOBV = 'A' or JOBV = 'S', LDV >= 1 if JOBV = 'N'. Q (output) DOUBLE PRECISION array, dimension (2*min(M,N)-1) This array contains the partially diagonalized bidiagonal matrix J computed from A, at the moment that the desired singular subspace has been found. Specifically, the leading p = min(M,N) entries of Q contain the diagonal elements q(1),q(2),...,q(p) and the entries Q(p+1), Q(p+2),...,Q(2*p-1) contain the superdiagonal elements e(1),e(2),...,e(p-1) of J. INUL (output) LOGICAL array, dimension (max(M,N)) If JOBU <> 'N' or JOBV <> 'N', then the indices of the elements of this array with value .TRUE. indicate the columns in U and/or V containing the base vectors of the desired left and/or right singular subspace of A. They also equal the indices of the diagonal elements of the bidiagonal submatrices in the array Q, which correspond to the computed singular subspaces.Tolerances
TOL DOUBLE PRECISION This parameter defines the multiplicity of singular values by considering all singular values within an interval of length TOL as coinciding. TOL is used in checking how many singular values are less than or equal to THETA. Also in computing an appropriate upper bound THETA by a bisection method, TOL is used as a stopping criterion defining the minimum (absolute) subinterval width. TOL is also taken as an absolute tolerance for negligible elements in the QR/QL iterations. If the user sets TOL to be less than or equal to 0, then the tolerance is taken as specified in SLICOT Library routine MB04YD document. RELTOL DOUBLE PRECISION This parameter specifies the minimum relative width of an interval. When an interval is narrower than TOL, or than RELTOL times the larger (in magnitude) endpoint, then it is considered to be sufficiently small and bisection has converged. If the user sets RELTOL to be less than BASE * EPS, where BASE is machine radix and EPS is machine precision (see LAPACK Library routine DLAMCH), then the tolerance is taken as BASE * EPS.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK = max(1, LDW + max(2*P + max(M,N), LDY)), where P = min(M,N); LDW = max(2*N, N*(N+1)/2), if JOBU <> 'N' and M large enough than N; LDW = 0, otherwise; LDY = 8*P - 5, if JOBU <> 'N' or JOBV <> 'N'; LDY = 6*P - 3, if JOBU = 'N' and JOBV = 'N'. For optimum performance LDWORK should 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.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: if the rank of matrix A (as specified by the user) has been lowered because a singular value of multiplicity greater than 1 was found.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the maximum number of QR/QL iteration steps (30*MIN(M,N)) has been exceeded.Method
The method used is the Partial Singular Value Decomposition (PSVD) approach proposed by Van Huffel, Vandewalle and Haegemans, which is an efficient technique (see [1]) for computing the singular subspace of a matrix corresponding to its smallest singular values. It differs from the classical SVD algorithm [3] at three points, which results in high efficiency. Firstly, the Householder transformations of the bidiagonalization need only to be applied on the base vectors of the desired singular subspaces; secondly, the bidiagonal matrix need only be partially diagonalized; and thirdly, the convergence rate of the iterative diagonalization can be improved by an appropriate choice between QL and QR iterations. (Note, however, that LAPACK Library routine DGESVD, for computing SVD, also uses either QL and QR iterations.) Depending on the gap, the desired numerical accuracy and the dimension of the desired singular subspace, the PSVD can be up to three times faster than the classical SVD algorithm. The PSVD algorithm [1-2] for an M-by-N matrix A proceeds as follows: Step 1: Bidiagonalization phase ----------------------- (a) If M is large enough than N, transform A into upper triangular form R. (b) Transform A (or R) into bidiagonal form: |q(1) e(1) 0 ... 0 | (0) | 0 q(2) e(2) . | J = | . . | | . e(N-1)| | 0 ... q(N) | if M >= N, or |q(1) 0 0 ... 0 0 | (0) |e(1) q(2) 0 . . | J = | . . . | | . q(M-1) . | | 0 ... e(M-1) q(M)| if M < N, using Householder transformations. In the second case, transform the matrix to the upper bidiagonal form by applying Givens rotations. (c) If U is requested, initialize U with the identity matrix. If V is requested, initialize V with the identity matrix. Step 2: Partial diagonalization phase ----------------------------- If the upper bound THETA is not given, then compute THETA such that precisely (min(M,N) - RANK) singular values of the bidiagonal matrix are less than or equal to THETA, using a bisection method [4]. Diagonalize the given bidiagonal matrix J partially, using either QR iterations (if the upper left diagonal element of the considered bidiagonal submatrix is larger than the lower right diagonal element) or QL iterations, such that J is split into unreduced bidiagonal submatrices whose singular values are either all larger than THETA or all less than or equal to THETA. Accumulate the Givens rotations in U and/or V (if desired). Step 3: Back transformation phase ------------------------- (a) Apply the Householder transformations of Step 1(b) onto the columns of U and/or V associated with the bidiagonal submatrices with all singular values less than or equal to THETA (if U and/or V is desired). (b) If M is large enough than N, and U is desired, then apply the Householder transformations of Step 1(a) onto each computed column of U in Step 3(a).References
[1] Van Huffel, S., Vandewalle, J. and Haegemans, A. An efficient and reliable algorithm for computing the singular subspace of a matrix associated with its smallest singular values. J. Comput. and Appl. Math., 19, pp. 313-330, 1987. [2] Van Huffel, S. Analysis of the total least squares problem and its use in parameter estimation. Doctoral dissertation, Dept. of Electr. Eng., Katholieke Universiteit Leuven, Belgium, June 1987. [3] Chan, T.F. An improved algorithm for computing the singular value decomposition. ACM TOMS, 8, pp. 72-83, 1982. [4] Van Huffel, S. and Vandewalle, J. The partial total least squares algorithm. J. Comput. and Appl. Math., 21, pp. 333-341, 1988.Numerical Aspects
Using the PSVD a large reduction in computation time can be gained in total least squares applications (cf [2 - 4]), in the computation of the null space of a matrix and in solving (non)homogeneous linear equations.Further Comments
NoneExample
Program Text
* MB04XD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER LDA, LDU, LDV PARAMETER ( LDA = MMAX, LDU = MMAX, LDV = NMAX ) INTEGER MAXMN, MNMIN PARAMETER ( MAXMN = MAX( MMAX, NMAX ), $ MNMIN = MIN( MMAX, NMAX ) ) INTEGER LENGQ PARAMETER ( LENGQ = 2*MNMIN-1 ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 2*NMAX, NMAX*( NMAX+1 )/2 ) $ + MAX( 2*MNMIN + MAXMN, 8*MNMIN - 5 ) ) * .. Local Scalars .. DOUBLE PRECISION RELTOL, THETA, THETA1, TOL INTEGER I, INFO, IWARN, J, K, LOOP, M, MINMN, N, NCOLU, $ NCOLV, RANK, RANK1 CHARACTER*1 JOBU, JOBV LOGICAL LJOBUA, LJOBUS, LJOBVA, LJOBVS, WANTU, WANTV * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), Q(LENGQ), $ U(LDU,MMAX), V(LDV,NMAX) LOGICAL INUL(MAXMN) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB04XD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, RANK, THETA, TOL, RELTOL, JOBU, JOBV IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99983 ) M ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99982 ) N ELSE IF ( RANK.GT.MNMIN ) THEN WRITE ( NOUT, FMT = 99981 ) RANK ELSE IF ( RANK.LT.0 .AND. THETA.LT.ZERO ) THEN WRITE ( NOUT, FMT = 99980 ) THETA ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,M ) RANK1 = RANK THETA1 = THETA * Compute a basis for the left and right singular subspace of A. CALL MB04XD( JOBU, JOBV, M, N, RANK, THETA, A, LDA, U, LDU, V, $ LDV, Q, INUL, TOL, RELTOL, DWORK, LDWORK, IWARN, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) IWARN WRITE ( NOUT, FMT = 99996 ) RANK ELSE IF ( RANK1.LT.0 ) WRITE ( NOUT, FMT = 99996 ) RANK END IF IF ( THETA1.LT.ZERO ) WRITE ( NOUT, FMT = 99995 ) THETA LJOBUA = LSAME( JOBU, 'A' ) LJOBUS = LSAME( JOBU, 'S' ) LJOBVA = LSAME( JOBV, 'A' ) LJOBVS = LSAME( JOBV, 'S' ) WANTU = LJOBUA.OR.LJOBUS WANTV = LJOBVA.OR.LJOBVS WRITE ( NOUT, FMT = 99994 ) MINMN = MIN( M, N ) LOOP = MINMN - 1 DO 20 I = 1, LOOP K = I + MINMN WRITE ( NOUT, FMT = 99993 ) I, I, Q(I), I, I + 1, Q(K) 20 CONTINUE WRITE ( NOUT, FMT = 99992 ) MINMN, MINMN, Q(MINMN) IF ( WANTU ) THEN NCOLU = M IF ( LJOBUS ) NCOLU = MINMN WRITE ( NOUT, FMT = 99986 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99985 ) ( U(I,J), J = 1,NCOLU ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) NCOLU WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, NCOLU WRITE ( NOUT, FMT = 99989 ) I, INUL(I) 60 CONTINUE END IF IF ( WANTV ) THEN NCOLV = N IF ( LJOBVS ) NCOLV = MINMN WRITE ( NOUT, FMT = 99984 ) DO 80 I = 1, N WRITE ( NOUT, FMT = 99985 ) ( V(I,J), J = 1,NCOLV ) 80 CONTINUE WRITE ( NOUT, FMT = 99988 ) NCOLV WRITE ( NOUT, FMT = 99987 ) DO 100 J = 1, NCOLV WRITE ( NOUT, FMT = 99989 ) J, INUL(J) 100 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' MB04XD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04XD = ',I2) 99997 FORMAT (' IWARN on exit from MB04XD = ',I2,/) 99996 FORMAT (' The computed rank of matrix A = ',I3,/) 99995 FORMAT (' The computed value of THETA = ',F7.4,/) 99994 FORMAT (' The elements of the partially diagonalized bidiagonal ', $ 'matrix are',/) 99993 FORMAT (2(' (',I1,',',I1,') = ',F7.4,2X)) 99992 FORMAT (' (',I1,',',I1,') = ',F7.4,/) 99991 FORMAT (/' Left singular subspace corresponds to the i-th column', $ '(s) of U for which ',/' INUL(i) = .TRUE., i = 1,...,',I1, $ /) 99990 FORMAT (' i INUL(i)',/) 99989 FORMAT (I3,L8) 99988 FORMAT (/' Right singular subspace corresponds to the j-th colum', $ 'n(s) of V for which ',/' INUL(j) = .TRUE., j = 1,...,',I1, $ /) 99987 FORMAT (' j INUL(j)',/) 99986 FORMAT (' Matrix U',/) 99985 FORMAT (20(1X,F8.4)) 99984 FORMAT (/' Matrix V',/) 99983 FORMAT (/' M is out of range.',/' M = ',I5) 99982 FORMAT (/' N is out of range.',/' N = ',I5) 99981 FORMAT (/' RANK is out of range.',/' RANK = ',I5) 99980 FORMAT (/' THETA must be at least zero.',/' THETA = ',F8.4) ENDProgram Data
MB04XD EXAMPLE PROGRAM DATA 6 4 -1 0.001 0.0 0.0 A A 0.80010 0.39985 0.60005 0.89999 0.29996 0.69990 0.39997 0.82997 0.49994 0.60003 0.20012 0.79011 0.90013 0.20016 0.79995 0.85002 0.39998 0.80006 0.49985 0.99016 0.20002 0.90007 0.70009 1.02994Program Results
MB04XD EXAMPLE PROGRAM RESULTS The computed rank of matrix A = 3 The elements of the partially diagonalized bidiagonal matrix are (1,1) = 3.2280 (1,2) = -0.0287 (2,2) = 0.8714 (2,3) = 0.0168 (3,3) = 0.3698 (3,4) = 0.0000 (4,4) = 0.0001 Matrix U 0.8933 0.4328 -0.1209 0.2499 -0.5812 0.4913 -0.4493 0.8555 -0.2572 0.1617 -0.4608 -0.7379 -0.0079 0.2841 0.9588 -0.5352 0.1892 0.0525 0.0000 0.0000 0.0003 -0.1741 0.3389 -0.3397 0.0000 0.0000 0.0000 0.6482 0.5428 0.1284 0.0000 0.0000 0.0000 -0.4176 -0.0674 0.2819 Left singular subspace corresponds to the i-th column(s) of U for which INUL(i) = .TRUE., i = 1,...,6 i INUL(i) 1 F 2 F 3 F 4 T 5 T 6 T Matrix V -0.3967 -0.7096 0.4612 -0.3555 0.9150 -0.2557 0.2414 -0.5687 -0.0728 0.6526 0.5215 -0.2128 0.0000 0.0720 0.6761 0.7106 Right singular subspace corresponds to the j-th column(s) of V for which INUL(j) = .TRUE., j = 1,...,4 j INUL(j) 1 F 2 F 3 F 4 T
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04XY.html 0000664 0000000 0000000 00000012377 14560147231 0020407 0 ustar 00root root 0000000 0000000
Purpose
To apply the Householder transformations Pj stored in factored form into the columns of the array X, to the desired columns of the matrix U by premultiplication, and/or the Householder transformations Qj stored in factored form into the rows of the array X, to the desired columns of the matrix V by premultiplication. The Householder transformations Pj and Qj are stored as produced by LAPACK Library routine DGEBRD.Specification
SUBROUTINE MB04XY( JOBU, JOBV, M, N, X, LDX, TAUP, TAUQ, U, $ LDU, V, LDV, INUL, INFO ) C .. Scalar Arguments .. CHARACTER JOBU, JOBV INTEGER INFO, LDU, LDV, LDX, M, N C .. Array Arguments .. LOGICAL INUL(*) DOUBLE PRECISION TAUP(*), TAUQ(*), U(LDU,*), V(LDV,*), $ X(LDX,*)Arguments
Mode Parameters
JOBU CHARACTER*1 Specifies whether to transform the columns in U as follows: = 'N': Do not transform the columns in U; = 'A': Transform the columns in U (U has M columns); = 'S': Transform the columns in U (U has min(M,N) columns). JOBV CHARACTER*1 Specifies whether to transform the columns in V as follows: = 'N': Do not transform the columns in V; = 'A': Transform the columns in V (V has N columns); = 'S': Transform the columns in V (V has min(M,N) columns).Input/Output Parameters
M (input) INTEGER The number of rows of the matrix X. M >= 0. N (input) INTEGER The number of columns of the matrix X. N >= 0. X (input) DOUBLE PRECISION array, dimension (LDX,N) The leading M-by-N part contains in the columns of its lower triangle the Householder transformations Pj, and in the rows of its upper triangle the Householder transformations Qj in factored form. X is modified by the routine but restored on exit. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,M). TAUP (input) DOUBLE PRECISION array, dimension (MIN(M,N)) The scalar factors of the Householder transformations Pj. TAUQ (input) DOUBLE PRECISION array, dimension (MIN(M,N)) The scalar factors of the Householder transformations Qj. U (input/output) DOUBLE PRECISION array, dimension (LDU,*) On entry, U contains the M-by-M (if JOBU = 'A') or M-by-min(M,N) (if JOBU = 'S') matrix U. On exit, the Householder transformations Pj have been applied to each column i of U corresponding to a parameter INUL(i) = .TRUE. NOTE that U is not referenced if JOBU = 'N'. LDU INTEGER The leading dimension of the array U. LDU >= MAX(1,M), if JOBU = 'A' or JOBU = 'S'; LDU >= 1, if JOBU = 'N'. V (input/output) DOUBLE PRECISION array, dimension (LDV,*) On entry, V contains the N-by-N (if JOBV = 'A') or N-by-min(M,N) (if JOBV = 'S') matrix V. On exit, the Householder transformations Qj have been applied to each column i of V corresponding to a parameter INUL(i) = .TRUE. NOTE that V is not referenced if JOBV = 'N'. LDV INTEGER The leading dimension of the array V. LDV >= MAX(1,M), if JOBV = 'A' or JOBV = 'S'; LDV >= 1, if JOBV = 'N'. INUL (input) LOGICAL array, dimension (MAX(M,N)) INUL(i) = .TRUE. if the i-th column of U and/or V is to be transformed, and INUL(i) = .FALSE., otherwise. (1 <= i <= MAX(M,N)).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The Householder transformations Pj or Qj are applied to the columns of U or V indexed by I for which INUL(I) = .TRUE..Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To partially diagonalize the bidiagonal matrix |q(1) e(1) 0 ... 0 | | 0 q(2) e(2) . | J = | . . | (1) | . e(MIN(M,N)-1)| | 0 ... ... q(MIN(M,N)) | using QR or QL iterations in such a way that J is split into unreduced bidiagonal submatrices whose singular values are either all larger than a given bound or are all smaller than (or equal to) this bound. The left- and right-hand Givens rotations performed on J (corresponding to each QR or QL iteration step) may be optionally accumulated in the arrays U and V.Specification
SUBROUTINE MB04YD( JOBU, JOBV, M, N, RANK, THETA, Q, E, U, LDU, V, $ LDV, INUL, TOL, RELTOL, DWORK, LDWORK, IWARN, $ INFO ) C .. Scalar Arguments .. CHARACTER JOBU, JOBV INTEGER INFO, IWARN, LDU, LDV, LDWORK, M, N, RANK DOUBLE PRECISION RELTOL, THETA, TOL C .. Array Arguments .. LOGICAL INUL(*) DOUBLE PRECISION DWORK(*), E(*), Q(*), U(LDU,*), V(LDV,*)Arguments
Mode Parameters
JOBU CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix U the left-hand Givens rotations, as follows: = 'N': Do not form U; = 'I': U is initialized to the M-by-MIN(M,N) submatrix of the unit matrix and the left-hand Givens rotations are accumulated in U; = 'U': The given matrix U is updated by the left-hand Givens rotations used in the calculation. JOBV CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix V the right-hand Givens rotations, as follows: = 'N': Do not form V; = 'I': V is initialized to the N-by-MIN(M,N) submatrix of the unit matrix and the right-hand Givens rotations are accumulated in V; = 'U': The given matrix V is updated by the right-hand Givens rotations used in the calculation.Input/Output Parameters
M (input) INTEGER The number of rows in matrix U. M >= 0. N (input) INTEGER The number of rows in matrix V. N >= 0. RANK (input/output) INTEGER On entry, if RANK < 0, then the rank of matrix J is computed by the routine as the number of singular values larger than THETA. Otherwise, RANK must specify the rank of matrix J. RANK <= MIN(M,N). On exit, if RANK < 0 on entry, then RANK contains the computed rank of J. That is, the number of singular values of J larger than THETA. Otherwise, the user-supplied value of RANK may be changed by the routine on exit if the RANK-th and the (RANK+1)-th singular values of J are considered to be equal. See also the parameter TOL. THETA (input/output) DOUBLE PRECISION On entry, if RANK < 0, then THETA must specify an upper bound on the smallest singular values of J. THETA >= 0.0. Otherwise, THETA must specify an initial estimate (t say) for computing an upper bound such that precisely RANK singular values are greater than this bound. If THETA < 0.0, then t is computed by the routine. On exit, if RANK >= 0 on entry, then THETA contains the computed upper bound such that precisely RANK singular values of J are greater than THETA + TOL. Otherwise, THETA is unchanged. Q (input/output) DOUBLE PRECISION array, dimension (MIN(M,N)) On entry, this array must contain the diagonal elements q(1),q(2),...,q(MIN(M,N)) of the bidiagonal matrix J. That is, Q(i) = J(i,i) for i = 1,2,...,MIN(M,N). On exit, this array contains the leading diagonal of the transformed bidiagonal matrix J. E (input/output) DOUBLE PRECISION array, dimension (MIN(M,N)-1) On entry, this array must contain the superdiagonal elements e(1),e(2),...,e(MIN(M,N)-1) of the bidiagonal matrix J. That is, E(k) = J(k,k+1) for k = 1,2,..., MIN(M,N)-1. On exit, this array contains the superdiagonal of the transformed bidiagonal matrix J. U (input/output) DOUBLE PRECISION array, dimension (LDU,*) On entry, if JOBU = 'U', the leading M-by-MIN(M,N) part of this array must contain a left transformation matrix applied to the original matrix of the problem, and on exit, the leading M-by-MIN(M,N) part of this array contains the product of the input matrix U and the left-hand Givens rotations. On exit, if JOBU = 'I', then the leading M-by-MIN(M,N) part of this array contains the matrix of accumulated left-hand Givens rotations used. If JOBU = 'N', the array U is not referenced and can be supplied as a dummy array (i.e. set parameter LDU = 1 and declare this array to be U(1,1) in the calling program). LDU INTEGER The leading dimension of array U. If JOBU = 'U' or JOBU = 'I', LDU >= MAX(1,M); if JOBU = 'N', LDU >= 1. V (input/output) DOUBLE PRECISION array, dimension (LDV,*) On entry, if JOBV = 'U', the leading N-by-MIN(M,N) part of this array must contain a right transformation matrix applied to the original matrix of the problem, and on exit, the leading N-by-MIN(M,N) part of this array contains the product of the input matrix V and the right-hand Givens rotations. On exit, if JOBV = 'I', then the leading N-by-MIN(M,N) part of this array contains the matrix of accumulated right-hand Givens rotations used. If JOBV = 'N', the array V is not referenced and can be supplied as a dummy array (i.e. set parameter LDV = 1 and declare this array to be V(1,1) in the calling program). LDV INTEGER The leading dimension of array V. If JOBV = 'U' or JOBV = 'I', LDV >= MAX(1,N); if JOBV = 'N', LDV >= 1. INUL (input/output) LOGICAL array, dimension (MIN(M,N)) On entry, the leading MIN(M,N) elements of this array must be set to .FALSE. unless the i-th columns of U (if JOBU = 'U') and V (if JOBV = 'U') already contain a computed base vector of the desired singular subspace of the original matrix, in which case INUL(i) must be set to .TRUE. for 1 <= i <= MIN(M,N). On exit, the indices of the elements of this array with value .TRUE. indicate the indices of the diagonal entries of J which belong to those bidiagonal submatrices whose singular values are all less than or equal to THETA.Tolerances
TOL DOUBLE PRECISION This parameter defines the multiplicity of singular values by considering all singular values within an interval of length TOL as coinciding. TOL is used in checking how many singular values are less than or equal to THETA. Also in computing an appropriate upper bound THETA by a bisection method, TOL is used as a stopping criterion defining the minimum (absolute) subinterval width. TOL is also taken as an absolute tolerance for negligible elements in the QR/QL iterations. If the user sets TOL to be less than or equal to 0, then the tolerance is taken as EPS * MAX(ABS(Q(i)), ABS(E(k))), where EPS is the machine precision (see LAPACK Library routine DLAMCH), i = 1,2,...,MIN(M,N) and k = 1,2,...,MIN(M,N)-1. RELTOL DOUBLE PRECISION This parameter specifies the minimum relative width of an interval. When an interval is narrower than TOL, or than RELTOL times the larger (in magnitude) endpoint, then it is considered to be sufficiently small and bisection has converged. If the user sets RELTOL to be less than BASE * EPS, where BASE is machine radix and EPS is machine precision (see LAPACK Library routine DLAMCH), then the tolerance is taken as BASE * EPS.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,6*MIN(M,N)-5), if JOBU = 'I' or 'U', or JOBV = 'I' or 'U'; LDWORK >= MAX(1,4*MIN(M,N)-3), if JOBU = 'N' and JOBV = 'N'.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: if the rank of the bidiagonal matrix J (as specified by the user) has been lowered because a singular value of multiplicity larger than 1 was found.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; this includes values like RANK > MIN(M,N), or THETA < 0.0 and RANK < 0; = 1: if the maximum number of QR/QL iteration steps (30*MIN(M,N)) has been exceeded.Method
If the upper bound THETA is not specified by the user, then it is computed by the routine (using a bisection method) such that precisely (MIN(M,N) - RANK) singular values of J are less than or equal to THETA + TOL. The method used by the routine (see [1]) then proceeds as follows. The unreduced bidiagonal submatrices of J(j), where J(j) is the transformed bidiagonal matrix after the j-th iteration step, are classified into the following three classes: - C1 contains the bidiagonal submatrices with all singular values > THETA, - C2 contains the bidiagonal submatrices with all singular values <= THETA and - C3 contains the bidiagonal submatrices with singular values > THETA and also singular values <= THETA. If C3 is empty, then the partial diagonalization is complete, and RANK is the sum of the dimensions of the bidiagonal submatrices of C1. Otherwise, QR or QL iterations are performed on each bidiagonal submatrix of C3, until this bidiagonal submatrix has been split into two bidiagonal submatrices. These two submatrices are then classified and the iterations are restarted. If the upper left diagonal element of the bidiagonal submatrix is larger than its lower right diagonal element, then QR iterations are performed, else QL iterations are used. The shift is taken as the smallest diagonal element of the bidiagonal submatrix (in magnitude) unless its value exceeds THETA, in which case it is taken as zero.References
[1] Van Huffel, S., Vandewalle, J. and Haegemans, A. An efficient and reliable algorithm for computing the singular subspace of a matrix associated with its smallest singular values. J. Comput. and Appl. Math., 19, pp. 313-330, 1987.Numerical Aspects
The algorithm is backward stable. To avoid overflow, matrix J is scaled so that its largest element is no greater than overflow**(1/2) * underflow**(1/4) in absolute value (and not much smaller than that, for maximal accuracy).Further Comments
NoneExample
Program Text
* MB04YD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER MNMIN PARAMETER ( MNMIN = MIN( MMAX, NMAX ) ) INTEGER LDU, LDV PARAMETER ( LDU = MMAX, LDV = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 6*MNMIN - 5 ) * .. Local Scalars .. DOUBLE PRECISION RELTOL, THETA, TOL INTEGER I, INFO, IWARN, J, M, MINMN, N, RANK, RANK1 CHARACTER*1 JOBU, JOBV LOGICAL LJOBUU, LJOBVU * .. Local Arrays .. DOUBLE PRECISION DWORK(LDWORK), E(MNMIN-1), Q(MNMIN), $ U(LDU,MNMIN), V(LDV,MNMIN) LOGICAL INUL(MNMIN) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB04YD * .. Intrinsic Functions .. INTRINSIC MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, THETA, RANK, TOL, RELTOL, JOBU, JOBV MINMN = MIN( M, N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99988 ) M ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99987 ) N ELSE IF ( RANK.GT.MINMN ) THEN WRITE ( NOUT, FMT = 99986 ) RANK ELSE IF ( RANK.LT.0 .AND. THETA.LT.ZERO ) THEN WRITE ( NOUT, FMT = 99985 ) THETA ELSE READ ( NIN, FMT = * ) ( Q(I), I = 1,MINMN ) READ ( NIN, FMT = * ) ( E(I), I = 1,MINMN-1 ) RANK1 = RANK LJOBUU = LSAME( JOBU, 'U' ) LJOBVU = LSAME( JOBV, 'U' ) IF ( LJOBUU ) READ ( NIN, FMT = * ) $ ( ( U(I,J), J = 1,MINMN ), I = 1,M ) IF ( LJOBVU ) READ ( NIN, FMT = * ) $ ( ( V(I,J), J = 1,MINMN ), I = 1,N ) * Initialise the array INUL. DO 20 I = 1, MINMN INUL(I) = .FALSE. 20 CONTINUE IF ( LJOBUU.OR.LJOBVU ) READ ( NIN, FMT = * ) $ ( INUL(I), I = 1,MINMN ) * Compute the number of singular values of J > THETA. CALL MB04YD( JOBU, JOBV, M, N, RANK, THETA, Q, E, U, LDU, V, $ LDV, INUL, TOL, RELTOL, DWORK, LDWORK, IWARN, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) THEN WRITE ( NOUT, FMT = 99993 ) IWARN WRITE ( NOUT, FMT = 99984 ) RANK END IF WRITE ( NOUT, FMT = 99997 ) DO 160 I = 1, MINMN - 1 WRITE ( NOUT, FMT = 99996 ) I, I, Q(I), I, (I+1), E(I) 160 CONTINUE WRITE ( NOUT, FMT = 99995 ) MINMN, MINMN, Q(MINMN) IF ( RANK1.LT.0 ) WRITE ( NOUT, FMT = 99994 ) RANK, THETA IF ( .NOT.LSAME( JOBV, 'N' ) ) THEN WRITE ( NOUT, FMT = 99992 ) DO 180 I = 1, N WRITE ( NOUT, FMT = 99991 ) ( V(I,J), J = 1,MINMN ) 180 CONTINUE END IF IF ( ( .NOT.LSAME( JOBU, 'N' ) ) .AND. $ ( .NOT.LSAME( JOBV, 'N' ) ) ) $ WRITE ( NOUT, FMT = 99990 ) IF ( .NOT.LSAME( JOBU, 'N' ) ) THEN WRITE ( NOUT, FMT = 99989 ) DO 200 I = 1, M WRITE ( NOUT, FMT = 99991 ) ( U(I,J), J = 1,MINMN ) 200 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' MB04YD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB04YD = ',I2) 99997 FORMAT (' The transformed bidiagonal matrix J is',/) 99996 FORMAT (2(' (',I1,',',I1,') = ',F7.4,2X)) 99995 FORMAT (' (',I1,',',I1,') = ',F7.4) 99994 FORMAT (/' J has ',I2,' singular values >',F7.4,/) 99993 FORMAT (' IWARN on exit from MB04YD = ',I2,/) 99992 FORMAT (' The product of the right-hand Givens rotation matrices', $ ' equals ') 99991 FORMAT (20(1X,F8.4)) 99990 FORMAT (' ') 99989 FORMAT (' The product of the left-hand Givens rotation matrices ', $ 'equals ') 99988 FORMAT (/' M is out of range.',/' M = ',I5) 99987 FORMAT (/' N is out of range.',/' N = ',I5) 99986 FORMAT (/' RANK is out of range.',/' RANK = ',I5) 99985 FORMAT (/' THETA must be at least zero.',/' THETA = ',F8.4) 99984 FORMAT (/' The computed rank of matrix J = ',I3,/) ENDProgram Data
MB04YD EXAMPLE PROGRAM DATA 5 5 2.0 -1 0.0 0.0 N N 1.0 2.0 3.0 4.0 5.0 2.0 3.0 4.0 5.0Program Results
MB04YD EXAMPLE PROGRAM RESULTS The transformed bidiagonal matrix J is (1,1) = 0.4045 (1,2) = 0.0000 (2,2) = 1.9839 (2,3) = 0.0000 (3,3) = 3.4815 (3,4) = 0.0128 (4,4) = 5.3723 (4,5) = 0.0273 (5,5) = 7.9948 J has 3 singular values > 2.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB04YW.html 0000664 0000000 0000000 00000016404 14560147231 0020401 0 ustar 00root root 0000000 0000000
Purpose
To perform either one QR or QL iteration step onto the unreduced bidiagonal submatrix Jk: |D(l) E(l) 0 ... 0 | | 0 D(l+1) E(l+1) . | Jk = | . . | | . . | | . E(k-1)| | 0 ... ... D(k) | with k <= p and l >= 1, p = MIN(M,N), of the bidiagonal matrix J: |D(1) E(1) 0 ... 0 | | 0 D(2) E(2) . | J = | . . |. | . . | | . E(p-1)| | 0 ... ... D(p) | Hereby, Jk is transformed to S' Jk T with S and T products of Givens rotations. These Givens rotations S (respectively, T) are postmultiplied into U (respectively, V), if UPDATU (respectively, UPDATV) is .TRUE..Specification
SUBROUTINE MB04YW( QRIT, UPDATU, UPDATV, M, N, L, K, SHIFT, D, E, $ U, LDU, V, LDV, DWORK ) C .. Scalar Arguments .. LOGICAL QRIT, UPDATU, UPDATV INTEGER K, L, LDU, LDV, M, N DOUBLE PRECISION SHIFT C .. Array Arguments .. DOUBLE PRECISION D( * ), DWORK( * ), E( * ), U( LDU, * ), $ V( LDV, * )Arguments
Mode Parameters
QRIT LOGICAL Indicates whether a QR or QL iteration step is to be taken (from larger end diagonal element towards smaller), as follows: = .TRUE. : QR iteration step (chase bulge from top to bottom); = .FALSE.: QL iteration step (chase bulge from bottom to top). UPDATU LOGICAL Indicates whether the user wishes to accumulate in a matrix U the left-hand Givens rotations S, as follows: = .FALSE.: Do not form U; = .TRUE. : The given matrix U is updated (postmultiplied) by the left-hand Givens rotations S. UPDATV LOGICAL Indicates whether the user wishes to accumulate in a matrix V the right-hand Givens rotations S, as follows: = .FALSE.: Do not form V; = .TRUE. : The given matrix V is updated (postmultiplied) by the right-hand Givens rotations T.Input/Output Parameters
M (input) INTEGER The number of rows of the matrix U. M >= 0. N (input) INTEGER The number of rows of the matrix V. N >= 0. L (input) INTEGER The index of the first diagonal entry of the considered unreduced bidiagonal submatrix Jk of J. K (input) INTEGER The index of the last diagonal entry of the considered unreduced bidiagonal submatrix Jk of J. SHIFT (input) DOUBLE PRECISION Value of the shift used in the QR or QL iteration step. D (input/output) DOUBLE PRECISION array, dimension (p) where p = MIN(M,N) On entry, D must contain the diagonal entries of the bidiagonal matrix J. On exit, D contains the diagonal entries of the transformed bidiagonal matrix S' J T. E (input/output) DOUBLE PRECISION array, dimension (p-1) On entry, E must contain the superdiagonal entries of J. On exit, E contains the superdiagonal entries of the transformed matrix S' J T. U (input/output) DOUBLE PRECISION array, dimension (LDU,p) On entry, if UPDATU = .TRUE., U must contain the M-by-p left transformation matrix. On exit, if UPDATU = .TRUE., the Givens rotations S on the left have been postmultiplied into U, i.e., U * S is returned. U is not referenced if UPDATU = .FALSE.. LDU INTEGER The leading dimension of the array U. LDU >= max(1,M) if UPDATU = .TRUE.; LDU >= 1 if UPDATU = .FALSE.. V (input/output) DOUBLE PRECISION array, dimension (LDV,p) On entry, if UPDATV = .TRUE., V must contain the N-by-p right transformation matrix. On exit, if UPDATV = .TRUE., the Givens rotations T on the right have been postmultiplied into V, i.e., V * T is returned. V is not referenced if UPDATV = .FALSE.. LDV INTEGER The leading dimension of the array V. LDV >= max(1,N) if UPDATV = .TRUE.; LDV >= 1 if UPDATV = .FALSE..Workspace
DWORK DOUBLE PRECISION array, dimension (MAX(1,LDWORK)) LDWORK >= 4*MIN(M,N)-4, if UPDATU = UPDATV = .TRUE.; LDWORK >= 2*MIN(M,N)-2, if UPDATU = .TRUE. and UPDATV = .FALSE. or UPDATV = .TRUE. and UPDATU = .FALSE.; LDWORK >= 1, if UPDATU = UPDATV = .FALSE..Method
QR iterations diagonalize the bidiagonal matrix by zeroing the super-diagonal elements of Jk from bottom to top. QL iterations diagonalize the bidiagonal matrix by zeroing the super-diagonal elements of Jk from top to bottom. The routine overwrites Jk with the bidiagonal matrix S' Jk T, where S and T are products of Givens rotations. T is essentially the orthogonal matrix that would be obtained by applying one implicit symmetric shift QR (QL) step onto the matrix Jk'Jk. This step factors the matrix (Jk'Jk - shift*I) into a product of an orthogonal matrix T and a upper (lower) triangular matrix. See [1,Sec.8.2-8.3] and [2] for more details.References
[1] Golub, G.H. and Van Loan, C.F. Matrix Computations. The Johns Hopkins University Press, Baltimore, Maryland, 1983. [2] Bowdler, H., Martin, R.S. and Wilkinson, J.H. The QR and QL algorithms for symmetric matrices. Numer. Math., 11, pp. 293-306, 1968. [3] Demmel, J. and Kahan, W. Computing small singular values of bidiagonal matrices with guaranteed high relative accuracy. SIAM J. Sci. Statist. Comput., 11, pp. 873-912, 1990.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To transform a Hamiltonian matrix ( A G ) H = ( T ) (1) ( Q -A ) into a square-reduced Hamiltonian matrix ( A' G' ) H' = ( T ) (2) ( Q' -A' ) T by an orthogonal symplectic similarity transformation H' = U H U, where ( U1 U2 ) U = ( ). (3) ( -U2 U1 ) T The square-reduced Hamiltonian matrix satisfies Q'A' - A' Q' = 0, and 2 T 2 ( A'' G'' ) H' := (U H U) = ( T ). ( 0 A'' ) In addition, A'' is upper Hessenberg and G'' is skew symmetric. The square roots of the eigenvalues of A'' = A'*A' + G'*Q' are the eigenvalues of H.Specification
SUBROUTINE MB04ZD( COMPU, N, A, LDA, QG, LDQG, U, LDU, DWORK, INFO $ ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDQG, LDU, N CHARACTER COMPU C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), QG(LDQG,*), U(LDU,*)Arguments
Mode Parameters
COMPU CHARACTER*1 Indicates whether the orthogonal symplectic similarity transformation matrix U in (3) is returned or accumulated into an orthogonal symplectic matrix, or if the transformation matrix is not required, as follows: = 'N': U is not required; = 'I' or 'F': on entry, U need not be set; on exit, U contains the orthogonal symplectic matrix U from (3); = 'V' or 'A': the orthogonal symplectic similarity transformations are accumulated into U; on input, U must contain an orthogonal symplectic matrix S; on exit, U contains S*U with U from (3). See the description of U below for details.Input/Output Parameters
N (input) INTEGER The order of the matrices A, G, and Q. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On input, the leading N-by-N part of this array must contain the upper left block A of the Hamiltonian matrix H in (1). On output, the leading N-by-N part of this array contains the upper left block A' of the square-reduced Hamiltonian matrix H' in (2). LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). QG (input/output) DOUBLE PRECISION array, dimension (LDQG,N+1) On input, the leading N-by-N lower triangular part of this array must contain the lower triangle of the lower left symmetric block Q of the Hamiltonian matrix H in (1), and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array must contain the upper triangle of the upper right symmetric block G of H in (1). So, if i >= j, then Q(i,j) = Q(j,i) is stored in QG(i,j) and G(i,j) = G(j,i) is stored in QG(j,i+1). On output, the leading N-by-N lower triangular part of this array contains the lower triangle of the lower left symmetric block Q', and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array contains the upper triangle of the upper right symmetric block G' of the square-reduced Hamiltonian matrix H' in (2). LDQG INTEGER The leading dimension of the array QG. LDQG >= MAX(1,N). U (input/output) DOUBLE PRECISION array, dimension (LDU,2*N) If COMPU = 'N', then this array is not referenced. If COMPU = 'I' or 'F', then the input contents of this array are not specified. On output, the leading N-by-(2*N) part of this array contains the first N rows of the orthogonal symplectic matrix U in (3). If COMPU = 'V' or 'A', then, on input, the leading N-by-(2*N) part of this array must contain the first N rows of an orthogonal symplectic matrix S. On output, the leading N-by-(2*N) part of this array contains the first N rows of the product S*U where U is the orthogonal symplectic matrix from (3). The storage scheme implied by (3) is used for orthogonal symplectic matrices, i.e., only the first N rows are stored, as they contain all relevant information. LDU INTEGER The leading dimension of the array U. LDU >= MAX(1,N), if COMPU <> 'N'; LDU >= 1, if COMPU = 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, then the i-th argument had an illegal value.Method
The Hamiltonian matrix H is transformed into a square-reduced Hamiltonian matrix H' using the implicit version of Van Loan's method as proposed in [1,2,3].References
[1] Van Loan, C. F. A Symplectic Method for Approximating All the Eigenvalues of a Hamiltonian Matrix. Linear Algebra and its Applications, 61, pp. 233-251, 1984. [2] Byers, R. Hamiltonian and Symplectic Algorithms for the Algebraic Riccati Equation. Ph. D. Thesis, Cornell University, Ithaca, NY, January 1983. [3] Benner, P., Byers, R., and Barth, E. Fortran 77 Subroutines for Computing the Eigenvalues of Hamiltonian Matrices. I: The Square-Reduced Method. ACM Trans. Math. Software, 26, 1, pp. 49-77, 2000.Numerical Aspects
This algorithm requires approximately 20*N**3 flops for transforming H into square-reduced form. If the transformations are required, this adds another 8*N**3 flops. The method is strongly backward stable in the sense that if H' and U are the computed square-reduced Hamiltonian and computed orthogonal symplectic similarity transformation, then there is an orthogonal symplectic matrix T and a Hamiltonian matrix M such that H T = T M || T - U || <= c1 * eps || H' - M || <= c2 * eps * || H || where c1, c2 are modest constants depending on the dimension N and eps is the machine precision. Eigenvalues computed by explicitly forming the upper Hessenberg matrix A'' = A'A' + G'Q', with A', G', and Q' as in (2), and applying the Hessenberg QR iteration to A'' are exactly eigenvalues of a perturbed Hamiltonian matrix H + E, where || E || <= c3 * sqrt(eps) * || H ||, and c3 is a modest constant depending on the dimension N and eps is the machine precision. Moreover, if the norm of H and an eigenvalue lambda are of roughly the same magnitude, the computed eigenvalue is essentially as accurate as the computed eigenvalue from traditional methods. See [1] or [2].Further Comments
NoneExample
Program Text
* MB04ZD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDQG, LDU PARAMETER ( LDA = NMAX, LDQG = NMAX, LDU = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = ( NMAX+NMAX )*( NMAX+NMAX+1 ) ) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) * .. Local Scalars .. INTEGER I, INFO, IJ, J, JI, N, POS, WPOS CHARACTER*1 COMPU * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), QG(LDQG,NMAX+1), $ U(LDU,NMAX) * .. External Subroutines .. EXTERNAL DCOPY, DGEMM, DSYMV, MB04ZD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, COMPU IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99998 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( QG(J,I+1), I = J,N ), J = 1,N ) READ ( NIN, FMT = * ) ( ( QG(I,J), I = J,N ), J = 1,N ) * Square-reduce by symplectic orthogonal similarity. CALL MB04ZD( COMPU, N, A, LDA, QG, LDQG, U, LDU, DWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE * Show the square-reduced Hamiltonian. WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( A(I,J), J = 1,N ), $ ( QG(J,I+1), J = 1,I-1 ), ( QG(I,J+1), J = I,N ) 10 CONTINUE DO 20 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( QG(I,J), J = 1,I-1 ), $ ( QG(J,I), J = I,N ), ( -A(J,I), J = 1,N ) 20 CONTINUE * Show the square of H. WRITE ( NOUT, FMT = 99995 ) WPOS = ( NMAX+NMAX )*( NMAX+NMAX ) * T * Compute N11 = A*A + G*Q and set N22 = N11 . CALL DGEMM( 'N', 'N', N, N, N, ONE, A, LDA, A, LDA, ZERO, $ DWORK, N+N ) DO 30 I = 1, N CALL DCOPY( N-I+1, QG(I,I), 1, DWORK(WPOS+I), 1 ) CALL DCOPY( I-1, QG(I,1), LDQG, DWORK(WPOS+1), 1 ) CALL DSYMV( 'U', N, ONE, QG(1,2), LDQG, DWORK(WPOS+1), 1, $ ONE, DWORK((I-1)*(N+N)+1), 1 ) POS = N*( N+N ) + N + I CALL DCOPY( N, DWORK((I-1)*(N+N)+1), 1, DWORK(POS), N+N ) 30 CONTINUE DO 40 I = 1, N CALL DSYMV( 'U', N, -ONE, QG(1,2), LDQG, A(I,1), LDA, $ ZERO, DWORK((N+I-1)*(N+N)+1), 1 ) CALL DSYMV( 'L', N, ONE, QG, LDQG, A(1,I), 1, ZERO, $ DWORK((I-1)*(N+N)+N+1), 1 ) 40 CONTINUE DO 60 J = 1, N DO 50 I = J, N IJ = ( N+J-1 )*( N+N ) + I JI = ( N+I-1 )*( N+N ) + J DWORK(IJ) = DWORK(IJ) - DWORK(JI) DWORK(JI) = -DWORK(IJ) IJ = N + I + ( J-1 )*( N+N ) JI = N + J + ( I-1 )*( N+N ) DWORK(IJ) = DWORK(IJ) - DWORK(JI) DWORK(JI) = -DWORK(IJ) 50 CONTINUE 60 CONTINUE DO 70 I = 1, N+N WRITE ( NOUT, FMT = 99994 ) $ ( DWORK(I+(J-1)*(N+N) ), J = 1,N+N ) 70 CONTINUE ENDIF END IF STOP * 99999 FORMAT (' MB04ZD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' N is out of range.',/' N = ',I5) 99997 FORMAT (' INFO on exit from MB04ZD = ',I2) 99996 FORMAT (/' The square-reduced Hamiltonian is ') 99995 FORMAT (/' The square of the square-reduced Hamiltonian is ') 99994 FORMAT (1X,8(F10.4)) ENDProgram Data
MB04ZD EXAMPLE PROGRAM DATA 3 N 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 1.0 1.0 1.0 2.0 2.0 3.0 7.0 6.0 5.0 8.0 4.0 9.0Program Results
MB04ZD EXAMPLE PROGRAM RESULTS The square-reduced Hamiltonian is 1.0000 3.3485 0.3436 1.0000 1.9126 -0.1072 6.7566 11.0750 -0.3014 1.9126 8.4479 -1.0790 2.3478 1.6899 -2.3868 -0.1072 -1.0790 -2.9871 7.0000 8.6275 -0.6352 -1.0000 -6.7566 -2.3478 8.6275 16.2238 -0.1403 -3.3485 -11.0750 -1.6899 -0.6352 -0.1403 1.2371 -0.3436 0.3014 2.3868 The square of the square-reduced Hamiltonian is 48.0000 80.6858 -2.5217 0.0000 1.8590 -10.5824 167.8362 298.4815 -4.0310 -1.8590 0.0000 -33.1160 0.0000 4.5325 2.5185 10.5824 33.1160 0.0000 0.0000 0.0000 0.0000 48.0000 167.8362 0.0000 0.0000 0.0000 0.0000 80.6858 298.4815 4.5325 0.0000 0.0000 0.0000 -2.5217 -4.0310 2.5185
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB05MD.html 0000664 0000000 0000000 00000025366 14560147231 0020352 0 ustar 00root root 0000000 0000000
Purpose
To compute exp(A*delta) where A is a real N-by-N non-defective matrix with real or complex eigenvalues and delta is a scalar value. The routine also returns the eigenvalues and eigenvectors of A as well as (if all eigenvalues are real) the matrix product exp(Lambda*delta) times the inverse of the eigenvector matrix of A, where Lambda is the diagonal matrix of eigenvalues. Optionally, the routine computes a balancing transformation to improve the conditioning of the eigenvalues and eigenvectors.Specification
SUBROUTINE MB05MD( BALANC, N, DELTA, A, LDA, V, LDV, Y, LDY, VALR, $ VALI, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER BALANC INTEGER INFO, LDA, LDV, LDWORK, LDY, N DOUBLE PRECISION DELTA C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), DWORK(*), V(LDV,*), VALI(*), VALR(*), $ Y(LDY,*)Arguments
Mode Parameters
BALANC CHARACTER*1 Indicates how the input matrix should be diagonally scaled to improve the conditioning of its eigenvalues as follows: = 'N': Do not diagonally scale; = 'S': Diagonally scale the matrix, i.e. replace A by D*A*D**(-1), where D is a diagonal matrix chosen to make the rows and columns of A more equal in norm. Do not permute.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. DELTA (input) DOUBLE PRECISION The scalar value delta of the problem. 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 of the problem. On exit, the leading N-by-N part of this array contains the solution matrix exp(A*delta). LDA INTEGER The leading dimension of array A. LDA >= max(1,N). V (output) DOUBLE PRECISION array, dimension (LDV,N) The leading N-by-N part of this array contains the eigenvector matrix for A. If the k-th eigenvalue is real the k-th column of the eigenvector matrix holds the eigenvector corresponding to the k-th eigenvalue. Otherwise, the k-th and (k+1)-th eigenvalues form a complex conjugate pair and the k-th and (k+1)-th columns of the eigenvector matrix hold the real and imaginary parts of the eigenvectors corresponding to these eigenvalues as follows. If p and q denote the k-th and (k+1)-th columns of the eigenvector matrix, respectively, then the eigenvector corresponding to the complex eigenvalue with positive (negative) imaginary value is given by 2 p + q*j (p - q*j), where j = -1. LDV INTEGER The leading dimension of array V. LDV >= max(1,N). Y (output) DOUBLE PRECISION array, dimension (LDY,N) The leading N-by-N part of this array contains an intermediate result for computing the matrix exponential. Specifically, exp(A*delta) is obtained as the product V*Y, where V is the matrix stored in the leading N-by-N part of the array V. If all eigenvalues of A are real, then the leading N-by-N part of this array contains the matrix product exp(Lambda*delta) times the inverse of the (right) eigenvector matrix of A, where Lambda is the diagonal matrix of eigenvalues. LDY INTEGER The leading dimension of array Y. LDY >= max(1,N). VALR (output) DOUBLE PRECISION array, dimension (N) VALI (output) DOUBLE PRECISION array, dimension (N) These arrays contain the real and imaginary parts, respectively, of the eigenvalues of the matrix A. The eigenvalues are unordered except that complex conjugate pairs of values appear consecutively with the eigenvalue having positive imaginary part first.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and if N > 0, DWORK(2) returns the reciprocal condition number of the triangular matrix used to obtain the inverse of the eigenvector matrix. LDWORK INTEGER The length of the array DWORK. LDWORK >= max(1,4*N). For good performance, LDWORK must generally be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = i: if INFO = i, the QR algorithm failed to compute all the eigenvalues; no eigenvectors have been computed; elements i+1:N of VALR and VALI contain eigenvalues which have converged; = N+1: if the inverse of the eigenvector matrix could not be formed due to an attempt to divide by zero, i.e., the eigenvector matrix is singular; = N+2: if the matrix A is defective, possibly due to rounding errors.Method
This routine is an implementation of "Method 15" of the set of methods described in reference [1], which uses an eigenvalue/ eigenvector decomposition technique. A modification of LAPACK Library routine DGEEV is used for obtaining the right eigenvector matrix. A condition estimate is then employed to determine if the matrix A is near defective and hence the exponential solution is inaccurate. In this case the routine returns with the Error Indicator (INFO) set to N+2, and SLICOT Library routines MB05ND or MB05OD are the preferred alternative routines to be used.References
[1] Moler, C.B. and Van Loan, C.F. Nineteen dubious ways to compute the exponential of a matrix. SIAM Review, 20, pp. 801-836, 1978. [2] 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.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* MB05MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDV, LDY PARAMETER ( LDA = NMAX, LDV = NMAX, LDY = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 4*NMAX ) * .. Local Scalars .. DOUBLE PRECISION DELTA INTEGER I, INFO, J, N CHARACTER*1 BALANC * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), V(LDV,NMAX), $ VALI(NMAX), VALR(NMAX), Y(LDY,NMAX) INTEGER IWORK(NMAX) * .. External Subroutines .. EXTERNAL MB05MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) BALANC = 'N' READ ( NIN, FMT = * ) N, DELTA IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) * Find the exponential of the real non-defective matrix A*DELTA. CALL MB05MD( BALANC, N, DELTA, A, LDA, V, LDV, Y, LDY, VALR, $ VALI, IWORK, 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 ) ( VALR(I), VALI(I), I = 1,N ) WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( V(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( Y(I,J), J = 1,N ) 60 CONTINUE END IF END IF STOP * 99999 FORMAT (' MB05MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB05MD = ',I2) 99997 FORMAT (' The solution matrix exp(A*DELTA) is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The eigenvalues of A are ',/20(2F5.1,'*j ')) 99994 FORMAT (/' The eigenvector matrix for A is ') 99993 FORMAT (/' The inverse eigenvector matrix for A (premultiplied by' $ ,' exp(Lambda*DELTA)) is ') 99992 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB05MD EXAMPLE PROGRAM DATA 4 1.0 0.5 0.0 2.3 -2.6 0.0 0.5 -1.4 -0.7 2.3 -1.4 0.5 0.0 -2.6 -0.7 0.0 0.5Program Results
MB05MD EXAMPLE PROGRAM RESULTS The solution matrix exp(A*DELTA) is 26.8551 -3.2824 18.7409 -19.4430 -3.2824 4.3474 -5.1848 0.2700 18.7409 -5.1848 15.6012 -11.7228 -19.4430 0.2700 -11.7228 15.6012 The eigenvalues of A are -3.0 0.0*j 4.0 0.0*j -1.0 0.0*j 2.0 0.0*j The eigenvector matrix for A is -0.7000 0.7000 0.1000 -0.1000 0.1000 -0.1000 0.7000 -0.7000 0.5000 0.5000 0.5000 0.5000 -0.5000 -0.5000 0.5000 0.5000 The inverse eigenvector matrix for A (premultiplied by exp(Lambda*DELTA)) is -0.0349 0.0050 0.0249 -0.0249 38.2187 -5.4598 27.2991 -27.2991 0.0368 0.2575 0.1839 0.1839 -0.7389 -5.1723 3.6945 3.6945
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB05MY.html 0000664 0000000 0000000 00000014024 14560147231 0020364 0 ustar 00root root 0000000 0000000
Purpose
To compute, for an N-by-N real nonsymmetric matrix A, the orthogonal matrix Q reducing it to real Schur form T, the eigenvalues, and the right eigenvectors of T. The right eigenvector r(j) of T satisfies T * r(j) = lambda(j) * r(j) where lambda(j) is its eigenvalue. The matrix of right eigenvectors R is upper triangular, by construction.Specification
SUBROUTINE MB05MY( BALANC, N, A, LDA, WR, WI, R, LDR, Q, LDQ, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER BALANC INTEGER INFO, LDA, LDQ, LDR, LDWORK, N C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), DWORK( * ), Q( LDQ, * ), $ R( LDR, * ), WI( * ), WR( * )Arguments
Mode Parameters
BALANC CHARACTER*1 Indicates how the input matrix should be diagonally scaled to improve the conditioning of its eigenvalues as follows: = 'N': Do not diagonally scale; = 'S': Diagonally scale the matrix, i.e. replace A by D*A*D**(-1), where D is a diagonal matrix chosen to make the rows and columns of A more equal in norm. Do not permute.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the given matrix A. On exit, the leading N-by-N upper quasi-triangular part of this array contains the real Schur canonical form of A. LDA INTEGER The leading dimension of array A. LDA >= max(1,N). WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) WR and WI contain the real and imaginary parts, respectively, of the computed eigenvalues. Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having the positive imaginary part first. R (output) DOUBLE PRECISION array, dimension (LDR,N) The leading N-by-N upper triangular part of this array contains the matrix of right eigenvectors R, in the same order as their eigenvalues. The real and imaginary parts of a complex eigenvector corresponding to an eigenvalue with positive imaginary part are stored in consecutive columns. (The corresponding conjugate eigenvector is not stored.) The eigenvectors are not backward transformed for balancing (when BALANC = 'S'). LDR INTEGER The leading dimension of array R. LDR >= max(1,N). Q (output) DOUBLE PRECISION array, dimension (LDQ,N) The leading N-by-N part of this array contains the orthogonal matrix Q which has reduced A to real Schur form. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. If BALANC = 'S' and LDWORK > 0, DWORK(2),...,DWORK(N+1) return the scaling factors used for balancing. LDWORK INTEGER The length of the array DWORK. LDWORK >= max(1,4*N). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors have been computed; elements i+1:N of WR and WI contain eigenvalues which have converged.Method
This routine uses the QR algorithm to obtain the real Schur form T of matrix A. Then, the right eigenvectors of T are computed, but they are not backtransformed into the eigenvectors of A. MB05MY is a modification of the LAPACK driver routine DGEEV.References
[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.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute (a) F(delta) = exp(A*delta) and (b) H(delta) = Int[F(s) ds] from s = 0 to s = delta, where A is a real N-by-N matrix and delta is a scalar value.Specification
SUBROUTINE MB05ND( N, DELTA, A, LDA, EX, LDEX, EXINT, LDEXIN, $ TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDEX, LDEXIN, LDWORK, N DOUBLE PRECISION DELTA, TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), DWORK(*), EX(LDEX,*), EXINT(LDEXIN,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. DELTA (input) DOUBLE PRECISION The scalar value delta of the problem. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the matrix A of the problem. (Array A need not be set if DELTA = 0.) LDA INTEGER The leading dimension of array A. LDA >= max(1,N). EX (output) DOUBLE PRECISION array, dimension (LDEX,N) The leading N-by-N part of this array contains an approximation to F(delta). LDEX INTEGER The leading dimension of array EX. LDEX >= MAX(1,N). EXINT (output) DOUBLE PRECISION array, dimension (LDEXIN,N) The leading N-by-N part of this array contains an approximation to H(delta). LDEXIN INTEGER The leading dimension of array EXINT. LDEXIN >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining the order of the Pade approximation to H(t), where t is a scale factor determined by the routine. A reasonable value for TOL may be SQRT(EPS), where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N*(N+1)). For optimum performance LDWORK should be larger (2*N*N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, the (i,i) element of the denominator of the Pade approximation is zero, so the denominator is exactly singular; = N+1: if DELTA = (delta * frobenius norm of matrix A) is probably too large to permit meaningful computation. That is, DELTA > SQRT(BIG), where BIG is a representable number near the overflow threshold of the machine (see LAPACK Library Routine DLAMCH).Method
This routine uses a Pade approximation to H(t) for some small value of t (where 0 < t <= delta) and then calculates F(t) from H(t). Finally, the results are re-scaled to give F(delta) and H(delta). For a detailed description of the implementation of this algorithm see [1].References
[1] Benson, C.J. The numerical evaluation of the matrix exponential and its integral. Report 82/03, Control Systems Research Group, School of Electronic Engineering and Computer Science, Kingston Polytechnic, January 1982. [2] Ward, R.C. Numerical computation of the matrix exponential with accuracy estimate. SIAM J. Numer. Anal., 14, pp. 600-610, 1977. [3] Moler, C.B. and Van Loan, C.F. Nineteen Dubious Ways to Compute the Exponential of a Matrix. SIAM Rev., 20, pp. 801-836, 1978.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* MB05ND EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDEX, LDEXIN, LDWORK PARAMETER ( LDA = NMAX, LDEX = NMAX, LDEXIN = NMAX, $ LDWORK = NMAX*( NMAX+1 ) ) * .. Local Scalars .. DOUBLE PRECISION DELTA, TOL INTEGER I, INFO, J, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), EX(LDEX,NMAX), $ EXINT(LDEXIN,NMAX) INTEGER IWORK(NMAX) * .. External Subroutines .. EXTERNAL MB05ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, DELTA, TOL 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 ) * Find the matrix exponential of A*DELTA and its integral. CALL MB05ND( N, DELTA, A, LDA, EX, LDEX, EXINT, LDEXIN, TOL, $ IWORK, 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 ) ( EX(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( EXINT(I,J), J = 1,N ) 40 CONTINUE END IF END IF STOP * 99999 FORMAT (' MB05ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB05ND = ',I2) 99997 FORMAT (' The solution matrix exp(A*DELTA) is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' and its integral is ') 99994 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
MB05ND EXAMPLE PROGRAM DATA 5 0.1 0.0001 5.0 4.0 3.0 2.0 1.0 1.0 6.0 0.0 4.0 3.0 2.0 0.0 7.0 6.0 5.0 1.0 3.0 1.0 8.0 7.0 2.0 5.0 7.0 1.0 9.0Program Results
MB05ND EXAMPLE PROGRAM RESULTS The solution matrix exp(A*DELTA) is 1.8391 0.9476 0.7920 0.8216 0.7811 0.3359 2.2262 0.4013 1.0078 1.0957 0.6335 0.6776 2.6933 1.6155 1.8502 0.4804 1.1561 0.9110 2.7461 2.0854 0.7105 1.4244 1.8835 1.0966 3.4134 and its integral is 0.1347 0.0352 0.0284 0.0272 0.0231 0.0114 0.1477 0.0104 0.0369 0.0368 0.0218 0.0178 0.1624 0.0580 0.0619 0.0152 0.0385 0.0267 0.1660 0.0732 0.0240 0.0503 0.0679 0.0317 0.1863
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB05OD.html 0000664 0000000 0000000 00000017635 14560147231 0020354 0 ustar 00root root 0000000 0000000
Purpose
To compute exp(A*delta) where A is a real N-by-N matrix and delta is a scalar value. The routine also returns the minimal number of accurate digits in the 1-norm of exp(A*delta) and the number of accurate digits in the 1-norm of exp(A*delta) at 95% confidence level.Specification
SUBROUTINE MB05OD( BALANC, N, NDIAG, DELTA, A, LDA, MDIG, IDIG, $ IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER BALANC INTEGER IDIG, INFO, IWARN, LDA, LDWORK, MDIG, N, $ NDIAG DOUBLE PRECISION DELTA C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), DWORK(*)Arguments
Mode Parameters
BALANC CHARACTER*1 Specifies whether or not a balancing transformation (done by SLICOT Library routine MB04MD) is required, as follows: = 'N', do not use balancing; = 'S', use balancing (scaling).Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. NDIAG (input) INTEGER The specified order of the diagonal Pade approximant. In the absence of further information NDIAG should be set to 9. NDIAG should not exceed 15. NDIAG >= 1. DELTA (input) DOUBLE PRECISION The scalar value delta of the problem. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On input, the leading N-by-N part of this array must contain the matrix A of the problem. (This is not needed if DELTA = 0.) On exit, if INFO = 0, the leading N-by-N part of this array contains the solution matrix exp(A*delta). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). MDIG (output) INTEGER The minimal number of accurate digits in the 1-norm of exp(A*delta). IDIG (output) INTEGER The number of accurate digits in the 1-norm of exp(A*delta) at 95% confidence level.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= N*(2*N+NDIAG+1)+NDIAG, if N > 1. LDWORK >= 1, if N <= 1.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: if MDIG = 0 and IDIG > 0, warning for possible inaccuracy (the exponential has been computed); = 2: if MDIG = 0 and IDIG = 0, warning for severe inaccuracy (the exponential has been computed); = 3: if balancing has been requested, but it failed to reduce the matrix norm and was not actually used.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the norm of matrix A*delta (after a possible balancing) is too large to obtain an accurate result; = 2: if the coefficient matrix (the denominator of the Pade approximant) is exactly singular; try a different value of NDIAG; = 3: if the solution exponential would overflow, possibly due to a too large value DELTA; the calculations stopped prematurely. This error is not likely to appear.Method
The exponential of the matrix A is evaluated from a diagonal Pade approximant. This routine is a modification of the subroutine PADE, described in reference [1]. The routine implements an algorithm which exploits the identity (exp[(2**-m)*A]) ** (2**m) = exp(A), where m is an integer determined by the algorithm, to improve the accuracy for matrices with large norms.References
[1] Ward, R.C. Numerical computation of the matrix exponential with accuracy estimate. SIAM J. Numer. Anal., 14, pp. 600-610, 1977.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* MB05OD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA PARAMETER ( LDA = NMAX ) INTEGER NDIAG PARAMETER ( NDIAG = 9 ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( 2*NMAX+NDIAG+1 )+NDIAG ) * .. Local Scalars .. DOUBLE PRECISION DELTA INTEGER I, IDIG, INFO, IWARN, J, MDIG, N CHARACTER*1 BALANC * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK) INTEGER IWORK(NMAX) * .. External Subroutines .. EXTERNAL MB05OD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, DELTA, BALANC 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 ) * Find the exponential of the real defective matrix A*DELTA. CALL MB05OD( BALANC, N, NDIAG, DELTA, A, LDA, MDIG, IDIG, $ IWORK, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) $ WRITE ( NOUT, FMT = 99993 ) IWARN 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 ) MDIG, IDIG END IF END IF STOP * 99999 FORMAT (' MB05OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB05OD = ',I2) 99997 FORMAT (' The solution matrix E = exp(A*DELTA) is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' Minimal number of accurate digits in the norm of E =', $ I4,/' Number of accurate digits in the norm of E',/' ', $ ' at 95 per cent confidence interval =',I4) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (' IWARN on exit from MB05OD = ',I2) ENDProgram Data
MB05OD EXAMPLE PROGRAM DATA 3 1.0 S 2.0 1.0 1.0 0.0 3.0 2.0 1.0 0.0 4.0Program Results
MB05OD EXAMPLE PROGRAM RESULTS The solution matrix E = exp(A*DELTA) is 22.5984 17.2073 53.8144 24.4047 27.6033 83.2241 29.4097 12.2024 81.4177 Minimal number of accurate digits in the norm of E = 12 Number of accurate digits in the norm of E at 95 per cent confidence interval = 15
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB05OY.html 0000664 0000000 0000000 00000006741 14560147231 0020375 0 ustar 00root root 0000000 0000000
Purpose
To restore a matrix after it has been transformed by applying balancing transformations (permutations and scalings), as determined by LAPACK Library routine DGEBAL.Specification
SUBROUTINE MB05OY( JOB, N, LOW, IGH, A, LDA, SCALE, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER IGH, INFO, LDA, LOW, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), SCALE(*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the type of backward transformation required, as follows: = 'N', do nothing, return immediately; = 'P', do backward transformation for permutation only; = 'S', do backward transformation for scaling only; = 'B', do backward transformations for both permutation and scaling. JOB must be the same as the argument JOB supplied to DGEBAL.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. LOW (input) INTEGER IGH (input) INTEGER The integers LOW and IGH determined by DGEBAL. 1 <= LOW <= IGH <= N, if N > 0; LOW=1 and IGH=0, if N=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 to be back-transformed. On exit, the leading N-by-N part of this array contains the transformed matrix. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). SCALE (input) DOUBLE PRECISION array, dimension (N) Details of the permutation and scaling factors, as returned by DGEBAL.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Let P be a permutation matrix, and D a diagonal matrix of scaling factors, both of order N. The routine computes -1 A <-- P D A D P'. where the permutation and scaling factors are encoded in the array SCALE.References
None.Numerical Aspects
2 The algorithm requires O(N ) operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To move the eigenvalues with strictly negative real parts of an N-by-N complex skew-Hamiltonian/Hamiltonian pencil aS - bH in structured Schur form to the leading principal subpencil, while keeping the triangular form. On entry, we have ( A D ) ( B F ) S = ( ), H = ( ), ( 0 A' ) ( 0 -B' ) where A and B are upper triangular. S and H are transformed by a unitary matrix Q such that ( Aout Dout ) Sout = J Q' J' S Q = ( ), and ( 0 Aout' ) (1) ( Bout Fout ) ( 0 I ) Hout = J Q' J' H Q = ( ), with J = ( ), ( 0 -Bout' ) ( -I 0 ) where Aout and Bout remain in upper triangular form. The notation M' denotes the conjugate transpose of the matrix M. Optionally, if COMPQ = 'I' or COMPQ = 'U', the unitary matrix Q that fulfills (1) is computed.Specification
SUBROUTINE MB3JZP( COMPQ, N, A, LDA, D, LDD, B, LDB, F, LDF, Q, $ LDQ, NEIG, TOL, DWORK, ZWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ INTEGER INFO, LDA, LDB, LDD, LDF, LDQ, N, NEIG DOUBLE PRECISION TOL C .. Array Arguments .. COMPLEX*16 A( LDA, * ), B( LDB, * ), D( LDD, * ), $ F( LDF, * ), Q( LDQ, * ), ZWORK( * ) DOUBLE PRECISION DWORK( * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether or not the unitary transformations should be accumulated in the array Q, as follows: = 'N': Q is not computed; = 'I': the array Q is initialized internally to the unit matrix, and the unitary matrix Q is returned; = 'U': the array Q contains a unitary matrix Q0 on entry, and the matrix Q0*Q is returned, where Q is the product of the unitary transformations that are applied to the pencil aS - bH to reorder the eigenvalues.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) COMPLEX*16 array, dimension (LDA, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular matrix A. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Aout. The strictly lower triangular part of this array is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N/2). D (input/output) COMPLEX*16 array, dimension (LDD, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the skew-Hermitian matrix D. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Dout. The strictly lower triangular part of this array is not referenced. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1, N/2). B (input/output) COMPLEX*16 array, dimension (LDB, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular matrix B. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Bout. The strictly lower triangular part of this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N/2). F (input/output) COMPLEX*16 array, dimension (LDF, N/2) On entry, the leading N/2-by-N/2 part of this array must contain the upper triangular part of the Hermitian matrix F. On exit, the leading N/2-by-N/2 part of this array contains the transformed matrix Fout. The strictly lower triangular part of this array is not referenced. LDF INTEGER The leading dimension of the array F. LDF >= MAX(1, N/2). Q (input/output) COMPLEX*16 array, dimension (LDQ, N) On entry, if COMPQ = 'U', then the leading N-by-N part of this array must contain a given matrix Q0, and on exit, the leading N-by-N part of this array contains the product of the input matrix Q0 and the transformation matrix Q used to transform the matrices S and H. On exit, if COMPQ = 'I', then the leading N-by-N part of this array contains the unitary transformation matrix Q. If COMPQ = 'N' this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, N), if COMPQ = 'I' or COMPQ = 'U'. NEIG (output) INTEGER The number of eigenvalues in aS - bH with strictly negative real part.Tolerances
TOL DOUBLE PRECISION The tolerance used to decide the sign of the eigenvalues. If the user sets TOL > 0, then the given value of TOL is used. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by MIN(N,10)*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). A larger value might be needed for pencils with multiple eigenvalues.Workspace
DWORK DOUBLE PRECISION array, dimension (N/2) ZWORK COMPLEX*16 array, dimension (N/2)Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The algorithm reorders the eigenvalues like the following scheme: Step 1: Reorder the eigenvalues in the subpencil aA - bB. I. Reorder the eigenvalues with negative real parts to the top. II. Reorder the eigenvalues with positive real parts to the bottom. Step 2: Reorder the remaining eigenvalues with negative real parts. I. Exchange the eigenvalues between the last diagonal block in aA - bB and the last diagonal block in aS - bH. II. Move the eigenvalues in the N/2-th place to the (MM+1)-th place, where MM denotes the current number of eigenvalues with negative real parts in aA - bB. The algorithm uses a sequence of unitary transformations as described on page 43 in [1]. To achieve those transformations the elementary SLICOT Library subroutines MB03DZ and MB03HZ are called for the corresponding matrix structures.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) complex floating point operations.Further Comments
For large values of N, the routine applies the transformations on panels of columns. The user may specify in INFO the desired number of columns. If on entry INFO <= 0, then the routine estimates a suitable value of this number.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the eigenvalues of a complex N-by-N skew-Hamiltonian/ Hamiltonian pencil aS - bH, with ( A D ) ( B F ) S = ( ) and H = ( ). (1) ( E A' ) ( G -B' ) The structured Schur form of the embedded real skew-Hamiltonian/ skew-Hamiltonian pencil aB_S - bB_T, defined as ( Re(A) -Im(A) | Re(D) -Im(D) ) ( | ) ( Im(A) Re(A) | Im(D) Re(D) ) ( | ) B_S = (-----------------+-----------------) , and ( | ) ( Re(E) -Im(E) | Re(A') Im(A') ) ( | ) ( Im(E) Re(E) | -Im(A') Re(A') ) (2) ( -Im(B) -Re(B) | -Im(F) -Re(F) ) ( | ) ( Re(B) -Im(B) | Re(F) -Im(F) ) ( | ) B_T = (-----------------+-----------------) , T = i*H, ( | ) ( -Im(G) -Re(G) | -Im(B') Re(B') ) ( | ) ( Re(G) -Im(G) | -Re(B') -Im(B') ) is determined and used to compute the eigenvalues. The notation M' denotes the conjugate transpose of the matrix M. Optionally, if COMPQ = 'C', an orthonormal basis of the right deflating subspace of the pencil aS - bH, corresponding to the eigenvalues with strictly negative real part, is computed. Namely, after transforming aB_S - bB_H by unitary matrices, we have ( BA BD ) ( BB BF ) B_Sout = ( ) and B_Hout = ( ), (3) ( 0 BA' ) ( 0 -BB' ) and the eigenvalues with strictly negative real part of the complex pencil aB_Sout - bB_Hout are moved to the top. The embedding doubles the multiplicities of the eigenvalues of the pencil aS - bH.Specification
SUBROUTINE MB3LZP( COMPQ, ORTH, N, A, LDA, DE, LDDE, B, LDB, FG, $ LDFG, NEIG, Q, LDQ, ALPHAR, ALPHAI, BETA, $ IWORK, DWORK, LDWORK, ZWORK, LZWORK, BWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, ORTH INTEGER INFO, LDA, LDB, LDDE, LDFG, LDQ, LDWORK, $ LZWORK, N, NEIG C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION ALPHAI( * ), ALPHAR( * ), BETA( * ), DWORK( * ) COMPLEX*16 A( LDA, * ), B( LDB, * ), DE( LDDE, * ), $ FG( LDFG, * ), Q( LDQ, * ), ZWORK( * )Arguments
Mode Parameters
COMPQ CHARACTER*1 Specifies whether to compute the deflating subspace corresponding to the eigenvalues of aS - bH with strictly negative real part. = 'N': do not compute the deflating subspace; compute the eigenvalues only; = 'C': compute the deflating subspace and store it in the leading subarray of Q. ORTH CHARACTER*1 If COMPQ = 'C', specifies the technique for computing an orthonormal basis of the deflating subspace, as follows: = 'P': QR factorization with column pivoting; = 'S': singular value decomposition. If COMPQ = 'N', the ORTH value is not used.Input/Output Parameters
N (input) INTEGER The order of the pencil aS - bH. N >= 0, even. A (input/output) COMPLEX*16 array, dimension (LDA, N) On entry, the leading N/2-by-N/2 part of this array must contain the matrix A. On exit, if COMPQ = 'C', the leading N-by-N part of this array contains the upper triangular matrix BA in (3) (see also METHOD). The strictly lower triangular part is not zeroed; it is preserved in the leading N/2-by-N/2 part. If COMPQ = 'N', this array is unchanged on exit. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1, N). DE (input/output) COMPLEX*16 array, dimension (LDDE, N) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the skew-Hermitian matrix E, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the skew-Hermitian matrix D. On exit, if COMPQ = 'C', the leading N-by-N part of this array contains the skew-Hermitian matrix BD in (3) (see also METHOD). The strictly lower triangular part of the input matrix is preserved. If COMPQ = 'N', this array is unchanged on exit. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N). B (input/output) COMPLEX*16 array, dimension (LDB, N) On entry, the leading N/2-by-N/2 part of this array must contain the matrix B. On exit, if COMPQ = 'C', the leading N-by-N part of this array contains the upper triangular matrix BB in (3) (see also METHOD). The strictly lower triangular part is not zeroed; the elements below the first subdiagonal of the input matrix are preserved. If COMPQ = 'N', this array is unchanged on exit. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1, N). FG (input/output) COMPLEX*16 array, dimension (LDFG, N) On entry, the leading N/2-by-N/2 lower triangular part of this array must contain the lower triangular part of the Hermitian matrix G, and the N/2-by-N/2 upper triangular part of the submatrix in the columns 2 to N/2+1 of this array must contain the upper triangular part of the Hermitian matrix F. On exit, if COMPQ = 'C', the leading N-by-N part of this array contains the Hermitian matrix BF in (3) (see also METHOD). The strictly lower triangular part of the input matrix is preserved. The diagonal elements might have tiny imaginary parts. If COMPQ = 'N', this array is unchanged on exit. LDFG INTEGER The leading dimension of the array FG. LDFG >= MAX(1, N). NEIG (output) INTEGER If COMPQ = 'C', the number of eigenvalues in aS - bH with strictly negative real part. Q (output) COMPLEX*16 array, dimension (LDQ, 2*N) On exit, if COMPQ = 'C', the leading N-by-NEIG part of this array contains an orthonormal basis of the right deflating subspace corresponding to the eigenvalues of the pencil aS - bH with strictly negative real part. The remaining entries are meaningless. If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1, 2*N), if COMPQ = 'C'. ALPHAR (output) DOUBLE PRECISION array, dimension (N) The real parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. ALPHAI (output) DOUBLE PRECISION array, dimension (N) The imaginary parts of each scalar alpha defining an eigenvalue of the pencil aS - bH. If ALPHAI(j) is zero, then the j-th eigenvalue is real. BETA (output) DOUBLE PRECISION array, dimension (N) The scalars beta that define the eigenvalues of the pencil aS - bH. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the j-th eigenvalue of the pencil aS - bH, in the form lambda = alpha/beta. Since lambda may overflow, the ratios should not, in general, be computed.Workspace
IWORK INTEGER array, dimension (N+1) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. On exit, if INFO = -20, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX( 4*N*N + 2*N + MAX(3,N) ), if COMPQ = 'N'; LDWORK >= MAX( 1, 11*N*N + 2*N ), if COMPQ = 'C'. For good performance LDWORK should be generally 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. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal LZWORK. On exit, if INFO = -22, ZWORK(1) returns the minimum value of LZWORK. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= 1, if COMPQ = 'N'; LZWORK >= 8*N + 4, if COMPQ = 'C'. For good performance LZWORK should be generally larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA. BWORK LOGICAL array, dimension (LBWORK) LBWORK >= 0, if COMPQ = 'N'; LBWORK >= N - 1, if COMPQ = 'C'.Error Indicator
INFO INTEGER = 0: succesful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: QZ iteration failed in the SLICOT Library routine MB04FP (QZ iteration did not converge or computation of the shifts failed); = 2: QZ iteration failed in the LAPACK routine ZHGEQZ when trying to triangularize the 2-by-2 blocks; = 3: the singular value decomposition failed in the LAPACK routine ZGESVD (for ORTH = 'S'); = 4: warning: the pencil is numerically singular.Method
First, T = i*H is set. Then, the embeddings, B_S and B_T, of the matrices S and T, are determined and, subsequently, the SLICOT Library routine MB04FP is applied to compute the structured Schur form, i.e., the factorizations ~ ( S11 S12 ) B_S = J Q' J' B_S Q = ( ) and ( 0 S11' ) ~ ( T11 T12 ) ( 0 I ) B_T = J Q' J' B_T Q = ( ), with J = ( ), ( 0 T11' ) ( -I 0 ) where Q is real orthogonal, S11 is upper triangular, and T11 is upper quasi-triangular. Second, the SLICOT Library routine MB3JZP is applied, to compute a ~ unitary matrix Q, such that ~ ~ ~ ~ ~ ( S11 S12 ) J Q' J' B_S Q = ( ~ ) =: B_Sout, ( 0 S11' ) ~ ~ ~ ( H11 H12 ) J Q' J'(-i*B_T) Q = ( ) =: B_Hout, ( 0 -H11' ) ~ ~ ~ with S11, H11 upper triangular, and such that Spec_-(B_S, -i*B_T) is contained in the spectrum of the 2*NEIG-by-2*NEIG leading ~ principal subpencil aS11 - bH11. Finally, the right deflating subspace is computed. See also page 22 in [1] for more details.References
[1] Benner, P., Byers, R., Mehrmann, V. and Xu, H. Numerical Computation of Deflating Subspaces of Embedded Hamiltonian Pencils. Tech. Rep. SFB393/99-15, Technical University Chemnitz, Germany, June 1999.Numerical Aspects
3 The algorithm is numerically backward stable and needs O(N ) complex floating point operations.Further Comments
This routine does not perform any scaling of the matrices. Scaling might sometimes be useful, and it should be done externally. For large values of N, the routine applies the transformations on panels of columns. The user may specify in INFO the desired number of columns. If on entry INFO <= 0, then the routine estimates a suitable value of this number.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB3OYZ.html 0000664 0000000 0000000 00000016544 14560147231 0020447 0 ustar 00root root 0000000 0000000
Purpose
To compute a rank-revealing QR factorization of a complex general M-by-N matrix A, which may be rank-deficient, and estimate its effective rank using incremental condition estimation. The routine uses a truncated QR factorization with column pivoting [ R11 R12 ] A * P = Q * R, where R = [ ], [ 0 R22 ] with R11 defined as the largest leading upper triangular submatrix whose estimated condition number is less than 1/RCOND. The order of R11, RANK, is the effective rank of A. Condition estimation is performed during the QR factorization process. Matrix R22 is full (but of small norm), or empty. MB3OYZ does not perform any scaling of the matrix A.Specification
SUBROUTINE MB3OYZ( M, N, A, LDA, RCOND, SVLMAX, RANK, SVAL, JPVT, $ TAU, DWORK, ZWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, M, N, RANK DOUBLE PRECISION RCOND, SVLMAX C .. Array Arguments .. INTEGER JPVT( * ) COMPLEX*16 A( LDA, * ), TAU( * ), ZWORK( * ) DOUBLE PRECISION DWORK( * ), SVAL( 3 )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) COMPLEX*16 array, dimension ( LDA, N ) On entry, the leading M-by-N part of this array must contain the given matrix A. On exit, the leading RANK-by-RANK upper triangular part of A contains the triangular factor R11, and the elements below the diagonal in the first RANK columns, with the array TAU, represent the unitary matrix Q as a product of RANK elementary reflectors. The remaining N-RANK columns contain the result of the QR factorization process used. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). RCOND (input) DOUBLE PRECISION RCOND is used to determine the effective rank of A, which is defined as the order of the largest leading triangular submatrix R11 in the QR factorization with pivoting of A, whose estimated condition number is less than 1/RCOND. 0 <= RCOND <= 1. NOTE that when SVLMAX > 0, the estimated rank could be less than that defined above (see SVLMAX). SVLMAX (input) DOUBLE PRECISION If A is a submatrix of another matrix B, and the rank decision should be related to that matrix, then SVLMAX should be an estimate of the largest singular value of B (for instance, the Frobenius norm of B). If this is not the case, the input value SVLMAX = 0 should work. SVLMAX >= 0. RANK (output) INTEGER The effective (estimated) rank of A, i.e., the order of the submatrix R11. SVAL (output) DOUBLE PRECISION array, dimension ( 3 ) The estimates of some of the singular values of the triangular factor R: SVAL(1): largest singular value of R(1:RANK,1:RANK); SVAL(2): smallest singular value of R(1:RANK,1:RANK); SVAL(3): smallest singular value of R(1:RANK+1,1:RANK+1), if RANK < MIN( M, N ), or of R(1:RANK,1:RANK), otherwise. If the triangular factorization is a rank-revealing one (which will be the case if the leading columns were well- conditioned), then SVAL(1) will also be an estimate for the largest singular value of A, and SVAL(2) and SVAL(3) will be estimates for the RANK-th and (RANK+1)-st singular values of A, respectively. By examining these values, one can confirm that the rank is well defined with respect to the chosen value of RCOND. The ratio SVAL(1)/SVAL(2) is an estimate of the condition number of R(1:RANK,1:RANK). JPVT (output) INTEGER array, dimension ( N ) If JPVT(i) = k, then the i-th column of A*P was the k-th column of A. TAU (output) COMPLEX*16 array, dimension ( MIN( M, N ) ) The leading RANK elements of TAU contain the scalar factors of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension ( 2*N ) ZWORK COMPLEX*16 array, dimension ( 3*N-1 )Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes a truncated QR factorization with column pivoting of A, A * P = Q * R, with R defined above, and, during this process, finds the largest leading submatrix whose estimated condition number is less than 1/RCOND, taking the possible positive value of SVLMAX into account. This is performed using the LAPACK incremental condition estimation scheme and a slightly modified rank decision test. The factorization process stops when RANK has been determined. The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = rank <= min(m,n). Each H(i) has the form H = I - tau * v * v' where tau is a complex scalar, and v is a complex vector with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i). The matrix P is represented in jpvt as follows: If jpvt(j) = i then the jth column of P is the ith canonical unit vector.References
[1] Bischof, C.H. and P. Tang. Generalizing Incremental Condition Estimation. LAPACK Working Notes 32, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-132, May 1991. [2] Bischof, C.H. and P. Tang. Robust Incremental Condition Estimation. LAPACK Working Notes 33, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-133, May 1991.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a rank-revealing RQ factorization of a complex general M-by-N matrix A, which may be rank-deficient, and estimate its effective rank using incremental condition estimation. The routine uses a truncated RQ factorization with row pivoting: [ R11 R12 ] P * A = R * Q, where R = [ ], [ 0 R22 ] with R22 defined as the largest trailing upper triangular submatrix whose estimated condition number is less than 1/RCOND. The order of R22, RANK, is the effective rank of A. Condition estimation is performed during the RQ factorization process. Matrix R11 is full (but of small norm), or empty. MB3PYZ does not perform any scaling of the matrix A.Specification
SUBROUTINE MB3PYZ( M, N, A, LDA, RCOND, SVLMAX, RANK, SVAL, JPVT, $ TAU, DWORK, ZWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, M, N, RANK DOUBLE PRECISION RCOND, SVLMAX C .. Array Arguments .. INTEGER JPVT( * ) COMPLEX*16 A( LDA, * ), TAU( * ), ZWORK( * ) DOUBLE PRECISION DWORK( * ), SVAL( 3 )Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. A (input/output) COMPLEX*16 array, dimension ( LDA, N ) On entry, the leading M-by-N part of this array must contain the given matrix A. On exit, the upper triangle of the subarray A(M-RANK+1:M,N-RANK+1:N) contains the RANK-by-RANK upper triangular matrix R22; the remaining elements in the last RANK rows, with the array TAU, represent the unitary matrix Q as a product of RANK elementary reflectors (see METHOD). The first M-RANK rows contain the result of the RQ factorization process used. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). RCOND (input) DOUBLE PRECISION RCOND is used to determine the effective rank of A, which is defined as the order of the largest trailing triangular submatrix R22 in the RQ factorization with pivoting of A, whose estimated condition number is less than 1/RCOND. 0 <= RCOND <= 1. NOTE that when SVLMAX > 0, the estimated rank could be less than that defined above (see SVLMAX). SVLMAX (input) DOUBLE PRECISION If A is a submatrix of another matrix B, and the rank decision should be related to that matrix, then SVLMAX should be an estimate of the largest singular value of B (for instance, the Frobenius norm of B). If this is not the case, the input value SVLMAX = 0 should work. SVLMAX >= 0. RANK (output) INTEGER The effective (estimated) rank of A, i.e., the order of the submatrix R22. SVAL (output) DOUBLE PRECISION array, dimension ( 3 ) The estimates of some of the singular values of the triangular factor R: SVAL(1): largest singular value of R(M-RANK+1:M,N-RANK+1:N); SVAL(2): smallest singular value of R(M-RANK+1:M,N-RANK+1:N); SVAL(3): smallest singular value of R(M-RANK:M,N-RANK:N), if RANK < MIN( M, N ), or of R(M-RANK+1:M,N-RANK+1:N), otherwise. If the triangular factorization is a rank-revealing one (which will be the case if the trailing rows were well- conditioned), then SVAL(1) will also be an estimate for the largest singular value of A, and SVAL(2) and SVAL(3) will be estimates for the RANK-th and (RANK+1)-st singular values of A, respectively. By examining these values, one can confirm that the rank is well defined with respect to the chosen value of RCOND. The ratio SVAL(1)/SVAL(2) is an estimate of the condition number of R(M-RANK+1:M,N-RANK+1:N). JPVT (output) INTEGER array, dimension ( M ) If JPVT(i) = k, then the i-th row of P*A was the k-th row of A. TAU (output) COMPLEX*16 array, dimension ( MIN( M, N ) ) The trailing RANK elements of TAU contain the scalar factors of the elementary reflectors.Workspace
DWORK DOUBLE PRECISION array, dimension ( 2*M ) ZWORK COMPLEX*16 array, dimension ( 3*M-1 )Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes a truncated RQ factorization with row pivoting of A, P * A = R * Q, with R defined above, and, during this process, finds the largest trailing submatrix whose estimated condition number is less than 1/RCOND, taking the possible positive value of SVLMAX into account. This is performed using an adaptation of the LAPACK incremental condition estimation scheme and a slightly modified rank decision test. The factorization process stops when RANK has been determined. The matrix Q is represented as a product of elementary reflectors Q = H(k-rank+1)' H(k-rank+2)' . . . H(k)', where k = min(m,n). Each H(i) has the form H = I - tau * v * v' where tau is a complex scalar, and v is a complex vector with v(n-k+i+1:n) = 0 and v(n-k+i) = 1; conjg(v(1:n-k+i-1)) is stored on exit in A(m-k+i,1:n-k+i-1), and tau in TAU(i). The matrix P is represented in jpvt as follows: If jpvt(j) = i then the jth row of P is the ith canonical unit vector.References
[1] Bischof, C.H. and P. Tang. Generalizing Incremental Condition Estimation. LAPACK Working Notes 32, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-132, May 1991. [2] Bischof, C.H. and P. Tang. Robust Incremental Condition Estimation. LAPACK Working Notes 33, Mathematics and Computer Science Division, Argonne National Laboratory, UT, CS-91-133, May 1991.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To apply from the left the inverse of a balancing transformation, computed by the SLICOT Library routine MB4DPZ, to the complex matrix [ V1 ] [ ], [ sgn*V2 ] where sgn is either +1 or -1.Specification
SUBROUTINE MB4DBZ( JOB, SGN, N, ILO, LSCALE, RSCALE, M, V1, LDV1, $ V2, LDV2, INFO ) C .. Scalar Arguments .. CHARACTER JOB, SGN INTEGER ILO, INFO, LDV1, LDV2, M, N C .. Array Arguments .. DOUBLE PRECISION LSCALE(*), RSCALE(*) COMPLEX*16 V1(LDV1,*), V2(LDV2,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the type of inverse transformation required: = 'N': do nothing, return immediately; = 'P': do inverse transformation for permutation only; = 'S': do inverse transformation for scaling only; = 'B': do inverse transformations for both permutation and scaling. JOB must be the same as the argument JOB supplied to MB4DPZ. SGN CHARACTER*1 Specifies the sign to use for V2: = 'P': sgn = +1; = 'N': sgn = -1.Input/Output Parameters
N (input) INTEGER The number of rows of the matrices V1 and V2. N >= 0. ILO (input) INTEGER The integer ILO determined by MB4DPZ. 1 <= ILO <= N+1. LSCALE (input) DOUBLE PRECISION array, dimension (N) Details of the permutation and scaling factors applied from the left, as returned by MB4DPZ. RSCALE (input) DOUBLE PRECISION array, dimension (N) Details of the permutation and scaling factors applied from the right, as returned by MB4DPZ. M (input) INTEGER The number of columns of the matrices V1 and V2. M >= 0. V1 (input/output) COMPLEX*16 array, dimension (LDV1,M) On entry, the leading N-by-M part of this array must contain the matrix V1. On exit, the leading N-by-M part of this array is overwritten by the updated matrix V1 of the transformed matrix. LDV1 INTEGER The leading dimension of the array V1. LDV1 >= max(1,N). V2 (input/output) COMPLEX*16 array, dimension (LDV2,M) On entry, the leading N-by-M part of this array must contain the matrix V2. On exit, the leading N-by-M part of this array is overwritten by the updated matrix V2 of the transformed matrix. LDV2 INTEGER The leading dimension of the array V2. LDV2 >= max(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.References
[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. [2] Benner, P. Symplectic balancing of Hamiltonian matrices. SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
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.Specification
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,*)Arguments
Mode Parameters
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.Input/Output Parameters
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.Workspace
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).Warning Indicator
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.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
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.References
[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.Numerical Aspects
No rounding errors appear if JOB = 'P'.Further Comments
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).Example
Program Text
* 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) ENDProgram Data
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)Program Results
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
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MB4DPZ.html 0000664 0000000 0000000 00000043475 14560147231 0020427 0 ustar 00root root 0000000 0000000
Purpose
To balance the 2*N-by-2*N complex skew-Hamiltonian/Hamiltonian pencil aS - bH, with ( A D ) ( C V ) S = ( ) and H = ( ), A, C N-by-N, (1) ( E A' ) ( W -C' ) where D and E are skew-Hermitian, V and W are Hermitian matrices, and ' denotes conjugate transpose. This involves, first, permuting aS - bH by a symplectic equivalence transformation to isolate eigenvalues in the first 1:ILO-1 elements on the diagonal of A and C; and second, applying a diagonal equivalence transformation to make the pairs of rows and columns ILO:N and N+ILO:2*N as close in 1-norm as possible. Both steps are optional. Balancing may reduce the 1-norms of the matrices S and H.Specification
SUBROUTINE MB4DPZ( JOB, N, THRESH, A, LDA, DE, LDDE, C, LDC, VW, $ LDVW, ILO, LSCALE, RSCALE, DWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER ILO, INFO, IWARN, LDA, LDC, LDDE, LDVW, N DOUBLE PRECISION THRESH C .. Array Arguments .. DOUBLE PRECISION DWORK(*), LSCALE(*), RSCALE(*) COMPLEX*16 A(LDA,*), C(LDC,*), DE(LDDE,*), VW(LDVW,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the operations to be performed on S and H: = '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.Input/Output Parameters
N (input) INTEGER The order of matrices A, D, E, C, V, and W. 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 S(s,s) and H(s,s), with s = [ILO:N,N+ILO:2*N]. 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(H(s,s),1)/norm(S(s,s),1), norm(S(s,s),1)/norm(H(s,s),1) ) (1) has the smallest value, for the threshold values used, where S(s,s) and H(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(H(s,s),1)*norm(S(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(ILO:N); RSCALE(ILO:N)] 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 matrix A of the balanced skew-Hamiltonian matrix S. 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 >= MAX(1,N). DE (input/output) COMPLEX*16 array, dimension (LDDE, N+1) On entry, the leading N-by-N lower triangular part of this array must contain the lower triangular part of the skew-Hermitian matrix E, and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array must contain the upper triangular part of the skew-Hermitian matrix D. The real parts of the entries on the diagonal and the first superdiagonal of this array should be zero. On exit, the leading N-by-N lower triangular part of this array contains the lower triangular part of the balanced matrix E, and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array contains the upper triangular part of the balanced matrix D. In particular, the lower triangular part of the first ILO-1 columns of DE is zero. LDDE INTEGER The leading dimension of the array DE. LDDE >= MAX(1, N). C (input/output) COMPLEX*16 array, dimension (LDC, N) On entry, the leading N-by-N part of this array must contain the matrix C. On exit, the leading N-by-N part of this array contains the matrix C of the balanced Hamiltonian matrix H. In particular, the strictly lower triangular part of the first ILO-1 columns of C is zero. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1, N). VW (input/output) COMPLEX*16 array, dimension (LDVW, N+1) On entry, the leading N-by-N lower triangular part of this array must contain the lower triangular part of the Hermitian matrix W, and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array must contain the upper triangular part of the Hermitian matrix V. The imaginary parts of the entries on the diagonal and the first superdiagonal of this array should be zero. On exit, the leading N-by-N lower triangular part of this array contains the lower triangular part of the balanced matrix W, and the N-by-N upper triangular part of the submatrix in the columns 2 to N+1 of this array contains the upper triangular part of the balanced matrix V. In particular, the lower triangular part of the first ILO-1 columns of VW is zero. LDVW INTEGER The leading dimension of the array VW. LDVW >= MAX(1, N). ILO (output) INTEGER ILO-1 is the number of deflated eigenvalues in the balanced skew-Hamiltonian/Hamiltonian matrix pencil. ILO is set to 1 if JOB = 'N' or JOB = 'S'. LSCALE (output) DOUBLE PRECISION array, dimension (N) Details of the permutations of S and H and scaling applied to A, D, C, and V from the left. For j = 1,...,ILO-1 let P(j) = LSCALE(j). If P(j) <= 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) > 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 LSCALE contains the factor of the scaling applied to row j of the matrices A, D, C, and V. RSCALE (output) DOUBLE PRECISION array, dimension (N) Details of the permutations of S and H and scaling applied to A, E, C, and W from the right. For j = 1,...,ILO-1 let P(j) = RSCALE(j). If P(j) <= 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) > 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 RSCALE contains the factor of the scaling applied to column j of the matrices A, E, C, and W.Workspace
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 S(s,s) and H(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 = N).Warning Indicator
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.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
Balancing consists of applying a (symplectic) equivalence transformation to isolate eigenvalues and/or to make the 1-norms of each pair of rows and columns indexed by s of S and H 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 0 ) ( A D ) ( Dr 0 ) ( Dl 0 ) ( C V ) ( Dr 0 ) ( ) ( ) ( ), ( ) ( ) ( ). ( 0 Dr ) ( E A' ) ( 0 Dl ) ( 0 Dr ) ( W -C' ) ( 0 Dl ) 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.References
[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. [2] Benner, P. Symplectic balancing of Hamiltonian matrices. SIAM J. Sci. Comput., 22 (5), pp. 1885-1904, 2001.Numerical Aspects
The transformations used preserve the skew-Hamiltonian/Hamiltonian structure and do not introduce significant rounding errors. No rounding errors appear if JOB = 'P'. If T is the global transformation matrix applied to the right, then J'*T*J is the global transformation matrix applied to the left, where J = [ 0 I; -I 0 ], with blocks of order N.Further Comments
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).Example
Program Text
* MB4DPZ EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 10 ) INTEGER LDA, LDC, LDDE, LDVW PARAMETER ( LDA = NMAX, LDC = NMAX, LDDE = NMAX, $ LDVW = NMAX ) * .. Local Scalars .. CHARACTER*1 JOB INTEGER I, ILO, INFO, IWARN, J, N DOUBLE PRECISION THRESH * .. Local Arrays .. COMPLEX*16 A(LDA, NMAX ), C( LDC, NMAX ), DE(LDDE, NMAX), $ VW(LDVW, NMAX) DOUBLE PRECISION DWORK(8*NMAX), LSCALE(NMAX), RSCALE(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MB4DPZ * .. 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 = * ) ( ( DE(I,J), J = 1,N+1 ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( VW(I,J), J = 1,N+1 ), I = 1,N ) CALL MB4DPZ( JOB, N, THRESH, A, LDA, DE, LDDE, C, LDC, VW, $ LDVW, ILO, 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 = 99993 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99993 ) ( DE(I,J), J = 1,N+1 ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99993 ) ( C(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99993 ) ( VW(I,J), J = 1,N+1 ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) ILO WRITE ( NOUT, FMT = 99991 ) WRITE ( NOUT, FMT = 99984 ) ( LSCALE(I), I = 1,N ) WRITE ( NOUT, FMT = 99990 ) WRITE ( NOUT, FMT = 99984 ) ( 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 = 99984 ) ( DWORK(I), I = 1,2 ) WRITE ( NOUT, FMT = 99988 ) WRITE ( NOUT, FMT = 99984 ) ( DWORK(I), I = 3,4 ) WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99984 ) ( DWORK(5) ) ELSE WRITE ( NOUT, FMT = 99986 ) IWARN END IF END IF END IF END IF * 99999 FORMAT (' MB4DPZ EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MB4DPZ = ',I2) 99997 FORMAT (' The balanced matrix A is ') 99996 FORMAT (/' The balanced matrix DE is ') 99995 FORMAT (' The balanced matrix C is ') 99994 FORMAT (/' The balanced matrix VW is ') 99993 FORMAT (20( 1X, G11.4, SP, F9.3, S, 'i ') ) 99992 FORMAT (/' ILO = ',I4) 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 MB4DPZ = ',I2) 99985 FORMAT (/' N is out of range.',/' N = ',I5) 99984 FORMAT (20(1X,G11.4)) ENDProgram Data
MB4DPZ EXAMPLE PROGRAM DATA 2 B -3 (1,0.5) 0 0 (1,0.5) 0 0 0 0 0 0 (1,0.5) 0 0 (-2,-1) 1 -1.e-12 0 (-1,0.5) -1 0Program Results
MB4DPZ EXAMPLE PROGRAM RESULTS The balanced matrix A is 1.000 -0.500i 0.000 0.000i 0.000 0.000i 1.000 +0.500i The balanced matrix DE is 0.000 0.000i 0.000 +0.000i 0.000 +0.000i 0.000 +0.000i 0.000 +0.000i 0.000 +0.000i The balanced matrix C is 2.000 -1.000i 1.000 -0.500i 0.000 0.000i 1.000 +0.500i The balanced matrix VW is 0.000 0.000i 1.000 +0.000i 0.000 0.000i 0.000 0.000i 1.000 +0.000i -0.1000E-11 +0.000i ILO = 2 The permutations and left scaling factors are 4.000 1.000 The permutations and right scaling factors are 4.000 1.000 The initial 1-norms of the (sub)matrices are 1.118 2.118 The final 1-norms of the (sub)matrices are 1.118 2.118 The threshold value finally used is -3.000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01MD.html 0000664 0000000 0000000 00000013370 14560147231 0020337 0 ustar 00root root 0000000 0000000
Purpose
To calculate, for a given real polynomial P(x) and a real scalar alpha, the leading K coefficients of the shifted polynomial K-1 P(x) = q(1) + q(2) * (x-alpha) + ... + q(K) * (x-alpha) + ... using Horner's algorithm.Specification
SUBROUTINE MC01MD( DP, ALPHA, K, P, Q, INFO ) C .. Scalar Arguments .. INTEGER DP, INFO, K DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION P(*), Q(*)Arguments
Input/Output Parameters
DP (input) INTEGER The degree of the polynomial P(x). DP >= 0. ALPHA (input) DOUBLE PRECISION The scalar value alpha of the problem. K (input) INTEGER The number of coefficients of the shifted polynomial to be computed. 1 <= K <= DP+1. P (input) DOUBLE PRECISION array, dimension (DP+1) This array must contain the coefficients of P(x) in increasing powers of x. Q (output) DOUBLE PRECISION array, dimension (DP+1) The leading K elements of this array contain the first K coefficients of the shifted polynomial in increasing powers of (x - alpha), and the next (DP-K+1) elements are used as internal workspace.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given the real polynomial 2 DP P(x) = p(1) + p(2) * x + p(3) * x + ... + p(DP+1) * x , the routine computes the leading K coefficients of the shifted polynomial K-1 P(x) = q(1) + q(2) * (x - alpha) + ... + q(K) * (x - alpha) as follows. Applying Horner's algorithm (see [1]) to P(x), i.e. dividing P(x) by (x-alpha), yields P(x) = q(1) + (x-alpha) * D(x), where q(1) is the value of the constant term of the shifted polynomial and D(x) is the quotient polynomial of degree (DP-1) given by 2 DP-1 D(x) = d(2) + d(3) * x + d(4) * x + ... + d(DP+1) * x . Applying Horner's algorithm to D(x) and subsequent quotient polynomials yields q(2) and q(3), q(4), ..., q(K) respectively. It follows immediately that q(1) = P(alpha), and in general (i-1) q(i) = P (alpha) / (i - 1)! for i = 1, 2, ..., K.References
[1] STOER, J. and BULIRSCH, R. Introduction to Numerical Analysis. Springer-Verlag. 1980.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* MC01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DPMAX PARAMETER ( DPMAX = 20 ) * .. Local Scalars .. DOUBLE PRECISION ALPHA INTEGER DP, I, INFO, K * .. Local Arrays .. DOUBLE PRECISION P(DPMAX+1), Q(DPMAX+1) * .. External Subroutines .. EXTERNAL MC01MD * .. Executable Statements .. WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) DP, ALPHA, K IF ( DP.LE.-1 .OR. DP.GT.DPMAX ) THEN WRITE ( NOUT, FMT = 99995 ) DP ELSE READ ( NIN, FMT = * ) ( P(I), I = 1,DP+1 ) * Compute the leading K coefficients of the shifted polynomial. CALL MC01MD( DP, ALPHA, K, P, Q, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) ALPHA DO 20 I = 1, K WRITE ( NOUT, FMT = 99996 ) I - 1, Q(I) 20 CONTINUE END IF END IF * STOP * 99999 FORMAT (' MC01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01MD = ',I2) 99997 FORMAT (' ALPHA = ',F8.4,//' The coefficients of the shifted pol', $ 'ynomial are ',//' power of (x-ALPHA) coefficient ') 99996 FORMAT (5X,I5,15X,F9.4) 99995 FORMAT (/' DP is out of range.',/' DP = ',I5) ENDProgram Data
MC01MD EXAMPLE PROGRAM DATA 5 2.0 6 6.0 5.0 4.0 3.0 2.0 1.0Program Results
MC01MD EXAMPLE PROGRAM RESULTS ALPHA = 2.0000 The coefficients of the shifted polynomial are power of (x-ALPHA) coefficient 0 120.0000 1 201.0000 2 150.0000 3 59.0000 4 12.0000 5 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01ND.html 0000664 0000000 0000000 00000010661 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
To compute the value of the real polynomial P(x) at a given complex point x = x0 using Horner's algorithm.Specification
SUBROUTINE MC01ND( DP, XR, XI, P, VR, VI, INFO ) C .. Scalar Arguments .. INTEGER DP, INFO DOUBLE PRECISION VI, VR, XI, XR C .. Array Arguments .. DOUBLE PRECISION P(*)Arguments
Input/Output Parameters
DP (input) INTEGER The degree of the polynomial P(x). DP >= 0. XR (input) DOUBLE PRECISION XI (input) DOUBLE PRECISION The real and imaginary parts, respectively, of x0. P (input) DOUBLE PRECISION array, dimension (DP+1) This array must contain the coefficients of the polynomial P(x) in increasing powers of x. VR (output) DOUBLE PRECISION VI (output) DOUBLE PRECISION The real and imaginary parts, respectively, of P(x0).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given the real polynomial 2 DP P(x) = p(1) + p(2) * x + p(3) * x + ... + p(DP+1) * x , the routine computes the value of P(x0) using the recursion q(DP+1) = p(DP+1), q(i) = x0*q(i+1) + p(i) for i = DP, DP-1, ..., 1, which is known as Horner's algorithm (see [1]). Then q(1) = P(x0).References
[1] STOER, J and BULIRSCH, R. Introduction to Numerical Analysis. Springer-Verlag. 1980.Numerical Aspects
The algorithm requires DP operations for real arguments and 4*DP for complex arguments.Further Comments
NoneExample
Program Text
* MC01ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DPMAX PARAMETER ( DPMAX = 20 ) * .. Local Scalars .. DOUBLE PRECISION VI, VR, XI, XR INTEGER DP, I, INFO * .. Local Arrays .. DOUBLE PRECISION P(DPMAX+1) * .. External Subroutines .. EXTERNAL MC01ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) DP, XR, XI IF ( DP.LE.-1 .OR. DP.GT.DPMAX ) THEN WRITE ( NOUT, FMT = 99995 ) DP ELSE READ ( NIN, FMT = * ) ( P(I), I = 1,DP+1 ) * Evaluate the polynomial at the given (complex) point. CALL MC01ND( DP, XR, XI, P, VR, VI, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) XR, XI, VR WRITE ( NOUT, FMT = 99996 ) XR, XI, VI END IF END IF * STOP * 99999 FORMAT (' MC01ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01ND = ',I2) 99997 FORMAT (' Real part of P(',F6.2,SP,F6.2,'*j ) = ',SS,F8.4) 99996 FORMAT (/' Imaginary part of P(',F6.2,SP,F6.2,'*j ) = ',SS,F8.4) 99995 FORMAT (/' DP is out of range.',/' DP = ',I5) ENDProgram Data
MC01ND EXAMPLE PROGRAM DATA 4 -1.56 0.29 5.0 3.0 -1.0 2.0 1.0Program Results
MC01ND EXAMPLE PROGRAM RESULTS Real part of P( -1.56 +0.29*j ) = -4.1337 Imaginary part of P( -1.56 +0.29*j ) = 1.7088
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01OD.html 0000664 0000000 0000000 00000011236 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
To compute the coefficients of a complex polynomial P(x) from its zeros.Specification
SUBROUTINE MC01OD( K, REZ, IMZ, REP, IMP, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, K C .. Array Arguments .. DOUBLE PRECISION DWORK(*), IMP(*), IMZ(*), REP(*), REZ(*)Arguments
Input/Output Parameters
K (input) INTEGER The number of zeros (and hence the degree) of P(x). K >= 0. REZ (input) DOUBLE PRECISION array, dimension (K) IMZ (input) DOUBLE PRECISION array, dimension (K) The real and imaginary parts of the i-th zero of P(x) must be stored in REZ(i) and IMZ(i), respectively, where i = 1, 2, ..., K. The zeros may be supplied in any order. REP (output) DOUBLE PRECISION array, dimension (K+1) IMP (output) DOUBLE PRECISION array, dimension (K+1) These arrays contain the real and imaginary parts, respectively, of the coefficients of P(x) in increasing powers of x. If K = 0, then REP(1) is set to one and IMP(1) is set to zero.Workspace
DWORK DOUBLE PRECISION array, dimension (2*K+2) If K = 0, this array is not referenced.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes the coefficients of the complex K-th degree polynomial P(x) as P(x) = (x - r(1)) * (x - r(2)) * ... * (x - r(K)) where r(i) = (REZ(i),IMZ(i)), using real arithmetic.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* MC01OD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX PARAMETER ( KMAX = 10 ) * .. Local Scalars .. INTEGER I, INFO, K * .. Local Arrays .. DOUBLE PRECISION DWORK(2*KMAX+2), IMP(KMAX+1), IMZ(KMAX), $ REP(KMAX+1), REZ(KMAX) * .. External Subroutines .. EXTERNAL MC01OD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) K IF ( K.LT.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99995 ) K ELSE READ ( NIN, FMT = * ) ( REZ(I), IMZ(I), I = 1,K ) * Compute the coefficients of P(x) from the given zeros. CALL MC01OD( K, REZ, IMZ, REP, IMP, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) WRITE ( NOUT, FMT = 99996 ) $ ( I, REP(I+1), IMP(I+1), I = 0,K ) END IF END IF STOP * 99999 FORMAT (' MC01OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01OD = ',I2) 99997 FORMAT (' The coefficients of the polynomial P(x) are ',//' powe', $ 'r of x real part imag part ') 99996 FORMAT (2X,I5,8X,F9.4,5X,F9.4) 99995 FORMAT (/' K is out of range.',/' K = ',I5) ENDProgram Data
MC01OD EXAMPLE PROGRAM DATA 5 1.1 0.9 0.6 -0.7 -2.0 0.3 -0.8 2.5 -0.3 -0.4Program Results
MC01OD EXAMPLE PROGRAM RESULTS The coefficients of the polynomial P(x) are power of x real part imag part 0 2.7494 -2.1300 1 -1.7590 -5.4205 2 0.0290 2.8290 3 -1.6500 -1.7300 4 1.4000 -2.6000 5 1.0000 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01PD.html 0000664 0000000 0000000 00000011207 14560147231 0020337 0 ustar 00root root 0000000 0000000
Purpose
To compute the coefficients of a real polynomial P(x) from its zeros.Specification
SUBROUTINE MC01PD( K, REZ, IMZ, P, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, K C .. Array Arguments .. DOUBLE PRECISION DWORK(*), IMZ(*), P(*), REZ(*)Arguments
Input/Output Parameters
K (input) INTEGER The number of zeros (and hence the degree) of P(x). K >= 0. REZ (input) DOUBLE PRECISION array, dimension (K) IMZ (input) DOUBLE PRECISION array, dimension (K) The real and imaginary parts of the i-th zero of P(x) must be stored in REZ(i) and IMZ(i), respectively, where i = 1, 2, ..., K. The zeros may be supplied in any order, except that complex conjugate zeros must appear consecutively. P (output) DOUBLE PRECISION array, dimension (K+1) This array contains the coefficients of P(x) in increasing powers of x. If K = 0, then P(1) is set to one.Workspace
DWORK DOUBLE PRECISION array, dimension (K+1) If K = 0, this array is not referenced.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, (REZ(i),IMZ(i)) is a complex zero but (REZ(i-1),IMZ(i-1)) is not its conjugate.Method
The routine computes the coefficients of the real K-th degree polynomial P(x) as P(x) = (x - r(1)) * (x - r(2)) * ... * (x - r(K)) where r(i) = (REZ(i),IMZ(i)). Note that REZ(i) = REZ(j) and IMZ(i) = -IMZ(j) if r(i) and r(j) form a complex conjugate pair (where i <> j), and that IMZ(i) = 0 if r(i) is real.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* MC01PD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER KMAX PARAMETER ( KMAX = 10 ) * .. Local Scalars .. INTEGER I, INFO, K * .. Local Arrays .. DOUBLE PRECISION DWORK(KMAX+1), IMZ(KMAX), P(KMAX+1), REZ(KMAX) * .. External Subroutines .. EXTERNAL MC01PD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) K IF ( K.LT.0 .OR. K.GT.KMAX ) THEN WRITE ( NOUT, FMT = 99995 ) K ELSE READ ( NIN, FMT = * ) ( REZ(I), IMZ(I), I = 1,K ) * Compute the coefficients of P(x) from the given zeros. CALL MC01PD( K, REZ, IMZ, P, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) WRITE ( NOUT, FMT = 99996 ) ( I, P(I+1), I = 0,K ) END IF END IF STOP * 99999 FORMAT (' MC01PD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01PD = ',I2) 99997 FORMAT (' The coefficients of the polynomial P(x) are ',//' powe', $ 'r of x coefficient ') 99996 FORMAT (2X,I5,9X,F9.4) 99995 FORMAT (' K is out of range.',/' K = ',I5) ENDProgram Data
MC01PD EXAMPLE PROGRAM DATA 5 0.0 1.0 0.0 -1.0 2.0 0.0 1.0 3.0 1.0 -3.0Program Results
MC01PD EXAMPLE PROGRAM RESULTS The coefficients of the polynomial P(x) are power of x coefficient 0 -20.0000 1 14.0000 2 -24.0000 3 15.0000 4 -4.0000 5 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01PY.html 0000664 0000000 0000000 00000005762 14560147231 0020375 0 ustar 00root root 0000000 0000000
Purpose
To compute the coefficients of a real polynomial P(x) from its zeros. The coefficients are stored in decreasing order of the powers of x.Specification
SUBROUTINE MC01PY( K, REZ, IMZ, P, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, K C .. Array Arguments .. DOUBLE PRECISION DWORK(*), IMZ(*), P(*), REZ(*)Arguments
Input/Output Parameters
K (input) INTEGER The number of zeros (and hence the degree) of P(x). K >= 0. REZ (input) DOUBLE PRECISION array, dimension (K) IMZ (input) DOUBLE PRECISION array, dimension (K) The real and imaginary parts of the i-th zero of P(x) must be stored in REZ(i) and IMZ(i), respectively, where i = 1, 2, ..., K. The zeros may be supplied in any order, except that complex conjugate zeros must appear consecutively. P (output) DOUBLE PRECISION array, dimension (K+1) This array contains the coefficients of P(x) in decreasing powers of x.Workspace
DWORK DOUBLE PRECISION array, dimension (K) If K = 0, this array is not referenced.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, (REZ(i),IMZ(i)) is a complex zero but (REZ(i-1),IMZ(i-1)) is not its conjugate.Method
The routine computes the coefficients of the real K-th degree polynomial P(x) as P(x) = (x - r(1)) * (x - r(2)) * ... * (x - r(K)) where r(i) = (REZ(i),IMZ(i)). Note that REZ(i) = REZ(j) and IMZ(i) = -IMZ(j) if r(i) and r(j) form a complex conjugate pair (where i <> j), and that IMZ(i) = 0 if r(i) is real.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute, for two given real polynomials A(x) and B(x), the quotient polynomial Q(x) and the remainder polynomial R(x) of A(x) divided by B(x). The polynomials Q(x) and R(x) satisfy the relationship A(x) = B(x) * Q(x) + R(x), where the degree of R(x) is less than the degree of B(x).Specification
SUBROUTINE MC01QD( DA, DB, A, B, RQ, IWARN, INFO ) C .. Scalar Arguments .. INTEGER DA, DB, INFO, IWARN C .. Array Arguments .. DOUBLE PRECISION A(*), B(*), RQ(*)Arguments
Input/Output Parameters
DA (input) INTEGER The degree of the numerator polynomial A(x). DA >= -1. DB (input/output) INTEGER On entry, the degree of the denominator polynomial B(x). DB >= 0. On exit, if B(DB+1) = 0.0 on entry, then DB contains the index of the highest power of x for which B(DB+1) <> 0.0. A (input) DOUBLE PRECISION array, dimension (DA+1) This array must contain the coefficients of the numerator polynomial A(x) in increasing powers of x unless DA = -1 on entry, in which case A(x) is taken to be the zero polynomial. B (input) DOUBLE PRECISION array, dimension (DB+1) This array must contain the coefficients of the denominator polynomial B(x) in increasing powers of x. RQ (output) DOUBLE PRECISION array, dimension (DA+1) If DA < DB on exit, then this array contains the coefficients of the remainder polynomial R(x) in increasing powers of x; Q(x) is the zero polynomial. Otherwise, the leading DB elements of this array contain the coefficients of R(x) in increasing powers of x, and the next (DA-DB+1) elements contain the coefficients of Q(x) in increasing powers of x.Warning Indicator
IWARN INTEGER = 0: no warning; = k: if the degree of the denominator polynomial B(x) has been reduced to (DB - k) because B(DB+1-j) = 0.0 on entry for j = 0, 1, ..., k-1 and B(DB+1-k) <> 0.0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if on entry, DB >= 0 and B(i) = 0.0, where i = 1, 2, ..., DB+1.Method
Given real polynomials DA A(x) = a(1) + a(2) * x + ... + a(DA+1) * x and DB B(x) = b(1) + b(2) * x + ... + b(DB+1) * x where b(DB+1) is non-zero, the routine computes the coeffcients of the quotient polynomial DA-DB Q(x) = q(1) + q(2) * x + ... + q(DA-DB+1) * x and the remainder polynomial DB-1 R(x) = r(1) + r(2) * x + ... + r(DB) * x such that A(x) = B(x) * Q(x) + R(x). The algorithm used is synthetic division of polynomials (see [1]), which involves the following steps: (a) compute q(k+1) = a(DB+k+1) / b(DB+1) and (b) set a(j) = a(j) - q(k+1) * b(j-k) for j = k+1, ..., DB+k. Steps (a) and (b) are performed for k = DA-DB, DA-DB-1, ..., 0 and the algorithm terminates with r(i) = a(i) for i = 1, 2, ..., DB.References
[1] Knuth, D.E. The Art of Computer Programming, (Vol. 2, Seminumerical Algorithms). Addison-Wesley, Reading, Massachusetts (2nd Edition), 1981.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* MC01QD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DAMAX, DBMAX PARAMETER ( DAMAX = 10, DBMAX = 10 ) * .. Local Scalars .. INTEGER DA, DB, DBB, DQ, DR, I, IMAX, INFO, IWARN * .. Local Arrays .. DOUBLE PRECISION A(DAMAX+1), B(DBMAX+1), RQ(DAMAX+1) * .. External Subroutines .. EXTERNAL MC01QD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) DA IF ( DA.LE.-2 .OR. DA.GT.DAMAX ) THEN WRITE ( NOUT, FMT = 99991 ) DA ELSE READ ( NIN, FMT = * ) ( A(I), I = 1,DA+1 ) READ ( NIN, FMT = * ) DB DBB = DB IF ( DB.LE.-1 .OR. DB.GT.DBMAX ) THEN WRITE ( NOUT, FMT = 99990 ) DB ELSE READ ( NIN, FMT = * ) ( B(I), I = 1,DB+1 ) * Compute Q(x) and R(x) from the given A(x) and B(x). CALL MC01QD( DA, DB, A, B, RQ, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) IWARN WRITE ( NOUT, FMT = 99996 ) DBB, DB END IF WRITE ( NOUT, FMT = 99995 ) DQ = DA - DB DR = DB - 1 IMAX = DQ IF ( DR.GT.IMAX ) IMAX = DR DO 20 I = 0, IMAX IF ( I.LE.DQ .AND. I.LE.DR ) THEN WRITE ( NOUT, FMT = 99994 ) I, RQ(DB+I+1), RQ(I+1) ELSE IF ( I.LE.DQ ) THEN WRITE ( NOUT, FMT = 99993 ) I, RQ(DB+I+1) ELSE WRITE ( NOUT, FMT = 99992 ) I, RQ(I+1) END IF 20 CONTINUE END IF END IF END IF * STOP * 99999 FORMAT (' MC01QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01QD = ',I2) 99997 FORMAT (' IWARN on exit from MC01QD = ',I2,/) 99996 FORMAT (' The degree of the denominator polynomial B(x) has been', $ ' reduced from ',I2,' to ',I2,/) 99995 FORMAT (' The coefficients of the polynomials Q(x) and R(x) are ', $ //' Q(x) R(x) ',/' power of', $ ' x coefficient coefficient ') 99994 FORMAT (2X,I5,9X,F9.4,7X,F9.4) 99993 FORMAT (2X,I5,9X,F9.4) 99992 FORMAT (2X,I5,25X,F9.4) 99991 FORMAT (/' DA is out of range.',/' DA = ',I5) 99990 FORMAT (/' DB is out of range.',/' DB = ',I5) ENDProgram Data
MC01QD EXAMPLE PROGRAM DATA 4 2.0 2.0 -1.0 2.0 1.0 2 1.0 -1.0 1.0Program Results
MC01QD EXAMPLE PROGRAM RESULTS The coefficients of the polynomials Q(x) and R(x) are Q(x) R(x) power of x coefficient coefficient 0 1.0000 1.0000 1 3.0000 0.0000 2 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01RD.html 0000664 0000000 0000000 00000016740 14560147231 0020350 0 ustar 00root root 0000000 0000000
Purpose
To compute the coefficients of the polynomial P(x) = P1(x) * P2(x) + alpha * P3(x), where P1(x), P2(x) and P3(x) are given real polynomials and alpha is a real scalar. Each of the polynomials P1(x), P2(x) and P3(x) may be the zero polynomial.Specification
SUBROUTINE MC01RD( DP1, DP2, DP3, ALPHA, P1, P2, P3, INFO ) C .. Scalar Arguments .. INTEGER DP1, DP2, DP3, INFO DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION P1(*), P2(*), P3(*)Arguments
Input/Output Parameters
DP1 (input) INTEGER The degree of the polynomial P1(x). DP1 >= -1. DP2 (input) INTEGER The degree of the polynomial P2(x). DP2 >= -1. DP3 (input/output) INTEGER On entry, the degree of the polynomial P3(x). DP3 >= -1. On exit, the degree of the polynomial P(x). ALPHA (input) DOUBLE PRECISION The scalar value alpha of the problem. P1 (input) DOUBLE PRECISION array, dimension (lenp1) where lenp1 = DP1 + 1 if DP1 >= 0 and 1 otherwise. If DP1 >= 0, then this array must contain the coefficients of P1(x) in increasing powers of x. If DP1 = -1, then P1(x) is taken to be the zero polynomial, P1 is not referenced and can be supplied as a dummy array. P2 (input) DOUBLE PRECISION array, dimension (lenp2) where lenp2 = DP2 + 1 if DP2 >= 0 and 1 otherwise. If DP2 >= 0, then this array must contain the coefficients of P2(x) in increasing powers of x. If DP2 = -1, then P2(x) is taken to be the zero polynomial, P2 is not referenced and can be supplied as a dummy array. P3 (input/output) DOUBLE PRECISION array, dimension (lenp3) where lenp3 = MAX(DP1+DP2,DP3,0) + 1. On entry, if DP3 >= 0, then this array must contain the coefficients of P3(x) in increasing powers of x. On entry, if DP3 = -1, then P3(x) is taken to be the zero polynomial. On exit, the leading (DP3+1) elements of this array contain the coefficients of P(x) in increasing powers of x unless DP3 = -1 on exit, in which case the coefficients of P(x) (the zero polynomial) are not stored in the array. This is the case, for instance, when ALPHA = 0.0 and P1(x) or P2(x) is the zero polynomial.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given real polynomials DP1 i DP2 i P1(x) = SUM a(i+1) * x , P2(x) = SUM b(i+1) * x and i=0 i=0 DP3 i P3(x) = SUM c(i+1) * x , i=0 the routine computes the coefficents of P(x) = P1(x) * P2(x) + DP3 i alpha * P3(x) = SUM d(i+1) * x as follows. i=0 Let e(i) = c(i) for 1 <= i <= DP3+1 and e(i) = 0 for i > DP3+1. Then if DP1 >= DP2, i d(i) = SUM a(k) * b(i-k+1) + f(i), for i = 1, ..., DP2+1, k=1 i d(i) = SUM a(k) * b(i-k+1) + f(i), for i = DP2+2, ..., DP1+1 k=i-DP2 and DP1+1 d(i) = SUM a(k) * b(i-k+1) + f(i) for i = DP1+2,...,DP1+DP2+1, k=i-DP2 where f(i) = alpha * e(i). Similar formulas hold for the case DP1 < DP2.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* MC01RD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DP1MAX, DP2MAX, DP3MAX PARAMETER ( DP1MAX = 10, DP2MAX = 10, DP3MAX = 10 ) INTEGER LENP3 PARAMETER ( LENP3 = MAX(DP1MAX+DP2MAX,DP3MAX)+1 ) * .. Local Scalars .. DOUBLE PRECISION ALPHA INTEGER DP1, DP2, DP3, I, INFO * .. Local Arrays .. DOUBLE PRECISION P1(DP1MAX+1), P2(DP2MAX+1), P3(LENP3) * $ P3(DP1MAX+DP2MAX+DP3MAX+1) * .. External Subroutines .. EXTERNAL MC01RD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) DP1 IF ( DP1.LE.-2 .OR. DP1.GT.DP1MAX ) THEN WRITE ( NOUT, FMT = 99994 ) DP1 ELSE READ ( NIN, FMT = * ) ( P1(I), I = 1,DP1+1 ) READ ( NIN, FMT = * ) DP2 IF ( DP2.LE.-2 .OR. DP2.GT.DP2MAX ) THEN WRITE ( NOUT, FMT = 99993 ) DP2 ELSE READ ( NIN, FMT = * ) ( P2(I), I = 1,DP2+1 ) READ ( NIN, FMT = * ) DP3 IF ( DP3.LE.-2 .OR. DP3.GT.DP3MAX ) THEN WRITE ( NOUT, FMT = 99992 ) DP3 ELSE READ ( NIN, FMT = * ) ( P3(I), I = 1,DP3+1 ) END IF READ ( NIN, FMT = * ) ALPHA * Compute the coefficients of the polynomial P(x). CALL MC01RD( DP1, DP2, DP3, ALPHA, P1, P2, P3, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DP3 IF ( DP3.GE.0 ) THEN WRITE ( NOUT, FMT = 99996 ) DO 20 I = 0, DP3 WRITE ( NOUT, FMT = 99995 ) I, P3(I+1) 20 CONTINUE END IF END IF END IF END IF * STOP * 99999 FORMAT (' MC01RD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01RD = ',I2) 99997 FORMAT (' Degree of the resulting polynomial P(x) = ',I2) 99996 FORMAT (/' The coefficients of P(x) are ',//' power of x coe', $ 'fficient ') 99995 FORMAT (2X,I5,9X,F9.4) 99994 FORMAT (/' DP1 is out of range.',/' DP1 = ',I5) 99993 FORMAT (/' DP2 is out of range.',/' DP2 = ',I5) 99992 FORMAT (/' DP3 is out of range.',/' DP3 = ',I5) ENDProgram Data
MC01RD EXAMPLE PROGRAM DATA 1 1.00 2.50 2 1.00 0.10 -0.40 1 1.15 1.50 -2.20Program Results
MC01RD EXAMPLE PROGRAM RESULTS Degree of the resulting polynomial P(x) = 3 The coefficients of P(x) are power of x coefficient 0 -1.5300 1 -0.7000 2 -0.1500 3 -1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01SD.html 0000664 0000000 0000000 00000015721 14560147231 0020347 0 ustar 00root root 0000000 0000000
Purpose
To scale the coefficients of the real polynomial P(x) such that the coefficients of the scaled polynomial Q(x) = sP(tx) have minimal variation, where s and t are real scalars.Specification
SUBROUTINE MC01SD( DP, P, S, T, MANT, E, IWORK, INFO ) C .. Scalar Arguments .. INTEGER DP, INFO, S, T C .. Array Arguments .. INTEGER E(*), IWORK(*) DOUBLE PRECISION MANT(*), P(*)Arguments
Input/Output Parameters
DP (input) INTEGER The degree of the polynomial P(x). DP >= 0. P (input/output) DOUBLE PRECISION array, dimension (DP+1) On entry, this array must contain the coefficients of P(x) in increasing powers of x. On exit, this array contains the coefficients of the scaled polynomial Q(x) in increasing powers of x. S (output) INTEGER The exponent of the floating-point representation of the scaling factor s = BASE**S, where BASE is the base of the machine representation of floating-point numbers (see LAPACK Library Routine DLAMCH). T (output) INTEGER The exponent of the floating-point representation of the scaling factor t = BASE**T. MANT (output) DOUBLE PRECISION array, dimension (DP+1) This array contains the mantissas of the standard floating-point representation of the coefficients of the scaled polynomial Q(x) in increasing powers of x. E (output) INTEGER array, dimension (DP+1) This array contains the exponents of the standard floating-point representation of the coefficients of the scaled polynomial Q(x) in increasing powers of x.Workspace
IWORK INTEGER array, dimension (DP+1)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if on entry, P(x) is the zero polynomial.Method
Define the variation of the coefficients of the real polynomial 2 DP P(x) = p(0) + p(1) * x + p(2) * x + ... + p(DP) x whose non-zero coefficients can be represented as e(i) p(i) = m(i) * BASE (where 1 <= ABS(m(i)) < BASE) by V = max(e(i)) - min(e(i)), where max and min are taken over the indices i for which p(i) is non-zero. DP i i For the scaled polynomial P(cx) = SUM p(i) * c * x with i=0 j c = (BASE) , the variation V(j) is given by V(j) = max(e(i) + j * i) - min(e(i) + j * i). Using the fact that V(j) is a convex function of j, the routine determines scaling factors s = (BASE)**S and t = (BASE)**T such that the coefficients of the scaled polynomial Q(x) = sP(tx) satisfy the following conditions: (a) 1 <= q(0) < BASE and (b) the variation of the coefficients of Q(x) is minimal. Further details can be found in [1].References
[1] Dunaway, D.K. Calculation of Zeros of a Real Polynomial through Factorization using Euclid's Algorithm. SIAM J. Numer. Anal., 11, pp. 1087-1104, 1974.Numerical Aspects
Since the scaling is performed on the exponents of the floating- point representation of the coefficients of P(x), no rounding errors occur during the computation of the coefficients of Q(x).Further Comments
The scaling factors s and t are BASE dependent.Example
Program Text
* MC01SD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DPMAX PARAMETER ( DPMAX = 10 ) * .. Local Scalars .. INTEGER BETA, DP, I, INFO, S, T * .. Local Arrays .. DOUBLE PRECISION MANT(DPMAX+1), P(DPMAX+1) INTEGER E(DPMAX+1), IWORK(DPMAX+1) C .. External Functions .. DOUBLE PRECISION DLAMCH EXTERNAL DLAMCH * .. External Subroutines .. EXTERNAL MC01SD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) DP IF ( DP.LE.-1 .OR. DP.GT.DPMAX ) THEN WRITE ( NOUT, FMT = 99994 ) DP ELSE READ ( NIN, FMT = * ) ( P(I), I = 1,DP+1 ) * Compute the coefficients of the scaled polynomial Q(x). CALL MC01SD( DP, P, S, T, MANT, E, IWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE BETA = DLAMCH( 'Base' ) WRITE ( NOUT, FMT = 99995 ) BETA, S, T WRITE ( NOUT,FMT = 99997 ) DO 20 I = 0, DP WRITE ( NOUT, FMT = 99996 ) I, P(I+1) 20 CONTINUE END IF END IF * STOP * 99999 FORMAT (' MC01SD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01SD = ',I2) 99997 FORMAT (/' The coefficients of the scaled polynomial Q(x) = s*P(', $ 'tx) are ',//' power of x coefficient ') 99996 FORMAT (2X,I5,9X,F9.4) 99995 FORMAT (' The base of the machine (BETA) = ',I2,//' The scaling ', $ 'factors are s = BETA**(',I3,') and t = BETA**(',I3,')') 99994 FORMAT (/' DP is out of range.',/' DP =',I5) ENDProgram Data
MC01SD EXAMPLE PROGRAM DATA 5 10.0 -40.5 159.5 0.0 2560.0 -10236.5Program Results
MC01SD EXAMPLE PROGRAM RESULTS The base of the machine (BETA) = 2 The scaling factors are s = BETA**( -3) and t = BETA**( -2) The coefficients of the scaled polynomial Q(x) = s*P(tx) are power of x coefficient 0 1.2500 1 -1.2656 2 1.2461 3 0.0000 4 1.2500 5 -1.2496
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01TD.html 0000664 0000000 0000000 00000020121 14560147231 0020336 0 ustar 00root root 0000000 0000000
Purpose
To determine whether or not a given polynomial P(x) with real coefficients is stable, either in the continuous-time or discrete- time case. A polynomial is said to be stable in the continuous-time case if all its zeros lie in the left half-plane, and stable in the discrete-time case if all its zeros lie inside the unit circle.Specification
SUBROUTINE MC01TD( DICO, DP, P, STABLE, NZ, DWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO LOGICAL STABLE INTEGER DP, INFO, IWARN, NZ C .. Array Arguments .. DOUBLE PRECISION DWORK(*), P(*)Arguments
Mode Parameters
DICO CHARACTER*1 Indicates whether the stability test to be applied to P(x) is in the continuous-time or discrete-time case as follows: = 'C': Continuous-time case; = 'D': Discrete-time case.Input/Output Parameters
DP (input/output) INTEGER On entry, the degree of the polynomial P(x). DP >= 0. On exit, if P(DP+1) = 0.0 on entry, then DP contains the index of the highest power of x for which P(DP+1) <> 0.0. P (input) DOUBLE PRECISION array, dimension (DP+1) This array must contain the coefficients of P(x) in increasing powers of x. STABLE (output) LOGICAL Contains the value .TRUE. if P(x) is stable and the value .FALSE. otherwise (see also NUMERICAL ASPECTS). NZ (output) INTEGER If INFO = 0, contains the number of unstable zeros - that is, the number of zeros of P(x) in the right half-plane if DICO = 'C' or the number of zeros of P(x) outside the unit circle if DICO = 'D' (see also NUMERICAL ASPECTS).Workspace
DWORK DOUBLE PRECISION array, dimension (2*DP+2) The leading (DP+1) elements of DWORK contain the Routh coefficients, if DICO = 'C', or the constant terms of the Schur-Cohn transforms, if DICO = 'D'.Warning Indicator
IWARN INTEGER = 0: no warning; = k: if the degree of the polynomial P(x) has been reduced to (DB - k) because P(DB+1-j) = 0.0 on entry for j = 0, 1,..., k-1 and P(DB+1-k) <> 0.0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if on entry, P(x) is the zero polynomial; = 2: if the polynomial P(x) is most probably unstable, although it may be stable with one or more zeros very close to either the imaginary axis if DICO = 'C' or the unit circle if DICO = 'D'. The number of unstable zeros (NZ) is not determined.Method
The stability of the real polynomial 2 DP P(x) = p(0) + p(1) * x + p(2) * x + ... + p(DP) x is determined as follows. In the continuous-time case (DICO = 'C') the Routh algorithm (see [1]) is used. The routine computes the Routh coefficients and if they are non-zero then the number of sign changes in the sequence of the coefficients is equal to the number of zeros with positive imaginary part. In the discrete-time case (DICO = 'D') the Schur-Cohn algorithm (see [2] and [3]) is applied to the reciprocal polynomial 2 DP Q(x) = p(DP) + p(DP-1) * x + p(DP-2) * x + ... + p(0) x . The routine computes the constant terms of the Schur transforms and if all of them are non-zero then the number of zeros of P(x) with modulus greater than unity is obtained from the sequence of constant terms.References
[1] Gantmacher, F.R. Applications of the Theory of Matrices. Interscience Publishers, New York, 1959. [2] Kucera, V. Discrete Linear Control. The Algorithmic Approach. John Wiley & Sons, Chichester, 1979. [3] Henrici, P. Applied and Computational Complex Analysis (Vol. 1). John Wiley & Sons, New York, 1974.Numerical Aspects
The algorithm used by the routine is numerically stable. Note that if some of the Routh coefficients (DICO = 'C') or some of the constant terms of the Schur-Cohn transforms (DICO = 'D') are small relative to EPS (the machine precision), then the number of unstable zeros (and hence the value of STABLE) may be incorrect.Further Comments
NoneExample
Program Text
* MC01TD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DPMAX PARAMETER ( DPMAX = 10 ) * .. Local Scalars .. INTEGER DP, DPP, I, INFO, IWARN, NZ LOGICAL STABLE CHARACTER*1 DICO * .. Local Arrays .. DOUBLE PRECISION DWORK(2*DPMAX+2), P(DPMAX+1) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MC01TD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = * ) READ ( NIN, FMT = * ) DP, DICO IF ( DP.LE.-1 .OR. DP.GT.DPMAX ) THEN WRITE ( NOUT, FMT = 99993 ) DP ELSE DPP = DP READ ( NIN, FMT = * ) ( P(I), I = 1,DP+1 ) * Determine whether or not the given polynomial P(x) is stable. CALL MC01TD( DICO, DP, P, STABLE, NZ, DWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( IWARN.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) IWARN WRITE ( NOUT, FMT = 99996 ) DPP, DP END IF IF ( STABLE ) THEN WRITE ( NOUT, FMT = 99995 ) ELSE WRITE ( NOUT, FMT = 99994 ) IF ( LSAME( DICO, 'D' ) ) THEN WRITE ( NOUT, FMT = 99992 ) NZ ELSE WRITE ( NOUT, FMT = 99991 ) NZ END IF END IF END IF END IF STOP * 99999 FORMAT (' MC01TD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01TD = ',I2) 99997 FORMAT (' IWARN on exit from MC01TD = ',I2,/) 99996 FORMAT (' The degree of the polynomial P(x) has been reduced fro', $ 'm ',I2,' to ',I2,/) 99995 FORMAT (' The polynomial P(x) is stable ') 99994 FORMAT (' The polynomial P(x) is unstable ') 99993 FORMAT (/' DP is out of range. ',/' DP = ',I5) 99992 FORMAT (/' The number of zeros of P(x) outside the unit ', $ 'circle = ',I2) 99991 FORMAT (/' The number of zeros of P(x) in the right ', $ 'half-plane = ',I2) ENDProgram Data
MC01TD EXAMPLE PROGRAM DATA 4 C 2.0 0.0 1.0 -1.0 1.0Program Results
MC01TD EXAMPLE PROGRAM RESULTS The polynomial P(x) is unstable The number of zeros of P(x) in the right half-plane = 2
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01VD.html 0000664 0000000 0000000 00000011345 14560147231 0020350 0 ustar 00root root 0000000 0000000
Purpose
To compute the roots of a quadratic equation with real coefficients.Specification
SUBROUTINE MC01VD( A, B, C, Z1RE, Z1IM, Z2RE, Z2IM, INFO ) C .. Scalar Arguments .. INTEGER INFO DOUBLE PRECISION A, B, C, Z1IM, Z1RE, Z2IM, Z2REArguments
Input/Output Parameters
A (input) DOUBLE PRECISION The value of the coefficient of the quadratic term. B (input) DOUBLE PRECISION The value of the coefficient of the linear term. C (input) DOUBLE PRECISION The value of the coefficient of the constant term. Z1RE (output) DOUBLE PRECISION Z1IM (output) DOUBLE PRECISION The real and imaginary parts, respectively, of the largest root in magnitude. Z2RE (output) DOUBLE PRECISION Z2IM (output) DOUBLE PRECISION The real and imaginary parts, respectively, of the smallest root in magnitude.Error Indicator
INFO INTEGER = 0: successful exit; = 1: if on entry, either A = B = 0.0 or A = 0.0 and the root -C/B overflows; in this case Z1RE, Z1IM, Z2RE and Z2IM are unassigned; = 2: if on entry, A = 0.0; in this case Z1RE contains BIG and Z1IM contains zero, where BIG is a representable number near the overflow threshold of the machine (see LAPACK Library Routine DLAMCH); = 3: if on entry, either C = 0.0 and the root -B/A overflows or A, B and C are non-zero and the largest real root in magnitude cannot be computed without overflow; in this case Z1RE contains BIG and Z1IM contains zero; = 4: if the roots cannot be computed without overflow; in this case Z1RE, Z1IM, Z2RE and Z2IM are unassigned.Method
The routine computes the roots (r1 and r2) of the real quadratic equation 2 a * x + b * x + c = 0 as - b - SIGN(b) * SQRT(b * b - 4 * a * c) c r1 = --------------------------------------- and r2 = ------ 2 * a a * r1 unless a = 0, in which case -c r1 = --. b Precautions are taken to avoid overflow and underflow wherever possible.Numerical Aspects
The algorithm is numerically stable.Further Comments
NoneExample
Program Text
* MC01VD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) * .. Local Scalars .. DOUBLE PRECISION A, B, C, Z1IM, Z1RE, Z2IM, Z2RE INTEGER INFO * .. External Subroutines .. EXTERNAL MC01VD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) A, B, C * Solve the quadratic equation A*x**2 + B*x + C = 0. CALL MC01VD( A, B, C, Z1RE, Z1IM, Z2RE, Z2IM, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) WRITE ( NOUT, FMT = 99996 ) Z1RE, Z1IM, Z2RE, Z2IM END IF * STOP * 99999 FORMAT (' MC01VD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01VD = ',I2) 99997 FORMAT (' The roots of the quadratic equation are ') 99996 FORMAT (/' x = ',F8.4,2X,SP,F8.4,'*j',SS,/' x = ',F8.4,2X,SP,F8.4, $ '*j') ENDProgram Data
MC01VD EXAMPLE PROGRAM DATA 0.5 -1.0 2.0Program Results
MC01VD EXAMPLE PROGRAM RESULTS The roots of the quadratic equation are x = 1.0000 +1.7321*j x = 1.0000 -1.7321*j
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01WD.html 0000664 0000000 0000000 00000013234 14560147231 0020350 0 ustar 00root root 0000000 0000000
Purpose
To compute, for a given real polynomial P(x) and a quadratic polynomial B(x), the quotient polynomial Q(x) and the linear remainder polynomial R(x) such that P(x) = B(x) * Q(x) + R(x), 2 where B(x) = u1 + u2 * x + x , R(x) = q(1) + q(2) * (u2 + x) and u1, u2, q(1) and q(2) are real scalars.Specification
SUBROUTINE MC01WD( DP, P, U1, U2, Q, INFO ) C .. Scalar Arguments .. INTEGER DP, INFO DOUBLE PRECISION U1, U2 C .. Array Arguments .. DOUBLE PRECISION P(*), Q(*)Arguments
Input/Output Parameters
DP (input) INTEGER The degree of the polynomial P(x). DP >= 0. P (input) DOUBLE PRECISION array, dimension (DP+1) This array must contain the coefficients of P(x) in increasing powers of x. U1 (input) DOUBLE PRECISION The value of the constant term of the quadratic polynomial B(x). U2 (input) DOUBLE PRECISION The value of the coefficient of x of the quadratic polynomial B(x). Q (output) DOUBLE PRECISION array, dimension (DP+1) If DP >= 1 on entry, then elements Q(1) and Q(2) contain the coefficients q(1) and q(2), respectively, of the remainder polynomial R(x), and the next (DP-1) elements of this array contain the coefficients of the quotient polynomial Q(x) in increasing powers of x. If DP = 0 on entry, then element Q(1) contains the coefficient q(1) of the remainder polynomial R(x) = q(1); Q(x) is the zero polynomial.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given the real polynomials DP i 2 P(x) = SUM p(i+1) * x and B(x) = u1 + u2 * x + x i=0 the routine uses the recurrence relationships q(DP+1) = p(DP+1), q(DP) = p(DP) - u2 * q(DP+1) and q(i) = p(i) - u2 * q(i+1) - u1 * q(i+2) for i = DP-1, ..., 1 to determine the coefficients of the quotient polynomial DP-2 i Q(x) = SUM q(i+3) * x i=0 and the remainder polynomial R(x) = q(1) + q(2) * (u2 + x).Numerical Aspects
None.Further Comments
NoneExample
Program Text
* MC01WD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DPMAX PARAMETER ( DPMAX = 10 ) * .. Local Scalars .. DOUBLE PRECISION U1, U2 INTEGER DP, I, INFO * .. Local Arrays .. DOUBLE PRECISION P(DPMAX+1), Q(DPMAX+1) * .. External Subroutines .. EXTERNAL MC01WD * .. Executable Statements .. * WRITE ( NOUT,FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) DP IF ( DP.LE.-1 .OR. DP.GT.DPMAX ) THEN WRITE ( NOUT, FMT = 99994 ) DP ELSE READ ( NIN, FMT = * ) ( P(I), I = 1,DP+1 ) READ ( NIN, FMT = * ) U1, U2 * Compute Q(x) and R(x) from P(x) = (x**2+U2*x+U1) * Q(x) + R(x). CALL MC01WD( DP, P, U1, U2, Q, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 20 I = 0, DP - 2 WRITE ( NOUT, FMT = 99996 ) I, Q(I+3) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) Q(1) + Q(2)*U2, Q(2) END IF END IF * STOP * 99999 FORMAT (' MC01WD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01WD = ',I2) 99997 FORMAT (' The coefficients of the quotient polynomial Q(x) are ', $ //' power of x coefficient ') 99996 FORMAT (2X,I5,9X,F9.4) 99995 FORMAT (/' The coefficients of the remainder polynomial R(x) are ' $ ,//' power of x coefficient ',/' 0 ',F9.4, $ /' 1 ',F9.4) 99994 FORMAT (/' DP is out of range.',/' DP = ',I5) ENDProgram Data
MC01WD EXAMPLE PROGRAM DATA 6 0.62 1.10 1.64 1.88 2.12 1.70 1.00 0.60 0.80Program Results
MC01WD EXAMPLE PROGRAM RESULTS The coefficients of the quotient polynomial Q(x) are power of x coefficient 0 0.6000 1 0.7000 2 0.8000 3 0.9000 4 1.0000 The coefficients of the remainder polynomial R(x) are power of x coefficient 0 0.2600 1 0.2000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC01XD.html 0000664 0000000 0000000 00000014111 14560147231 0020344 0 ustar 00root root 0000000 0000000
Purpose
To compute the roots of the polynomial P(t) = ALPHA + BETA*t + GAMMA*t^2 + DELTA*t^3 .Specification
SUBROUTINE MC01XD( ALPHA, BETA, GAMMA, DELTA, EVR, EVI, EVQ, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDWORK DOUBLE PRECISION ALPHA, BETA, DELTA, GAMMA C .. Array Arguments .. DOUBLE PRECISION DWORK(*), EVI(3), EVQ(3), EVR(3)Arguments
Input/Output Parameters
ALPHA (input) DOUBLE PRECISION BETA (input) DOUBLE PRECISION GAMMA (input) DOUBLE PRECISION DELTA (input) DOUBLE PRECISION The coefficients of the polynomial P. EVR (output) DOUBLE PRECISION array, DIMENSION at least 3 EVI (output) DOUBLE PRECISION array, DIMENSION at least 3 EVQ (output) DOUBLE PRECISION array, DIMENSION at least 3 On output, the kth root of P will be equal to (EVR(K) + i*EVI(K))/EVQ(K) if EVQ(K) .NE. ZERO. Note that the quotient may over- or underflow. If P has a degree d less than 3, then 3-d computed roots will be infinite. EVQ(K) >= 0.Workspace
DWORK DOUBLE PRECISION array, DIMENSION (LDWORK) On exit, if LDWORK = -1 on input, then DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 42. If LDWORK = -1, an optimal 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 is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = j, 1 <= j <= 6, an error occurred during the call to one of the LAPACK Library routines DGGEV or DGEEV (1 <= j <= 3). If INFO < 3, the values returned in EVR(K), EVI(K), and EVQ(K) should be correct for K = INFO+1,...,3.Method
A matrix pencil is built, whose eigenvalues are the roots of the given polynomial, and they are computed using the QZ algorithm. However, when the ratio between the largest and smallest (in magnitude) polynomial coefficients is relatively big, and either ALPHA or DELTA has the largest magnitude, then a standard eigenproblem is solved using the QR algorithm, and EVQ(I) are set to 1, for I = 1,2,3.Numerical Aspects
The algorithm is numerically stable.Further Comments
NoneExample
Program Text
* MC01XD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NEV PARAMETER ( NEV = 3 ) INTEGER LDWORK PARAMETER ( LDWORK = 42 ) DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) * .. Local Scalars .. INTEGER I, INFO, J DOUBLE PRECISION ALPHA, BETA, DELTA, GAMMA * .. Local Arrays .. DOUBLE PRECISION DWORK(LDWORK), EVI(NEV), EVQ(NEV), EVR(NEV), $ RT(2) * .. External Subroutines .. EXTERNAL MC01XD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) ALPHA, BETA, GAMMA, DELTA * Compute the roots of the polynomial. CALL MC01XD( ALPHA, BETA, GAMMA, DELTA, EVR, EVI, EVQ, $ DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99995 ) WRITE ( NOUT, FMT = 99996 ) ( EVR(J), J = 1, 3 ) * WRITE ( NOUT, FMT = 99994 ) WRITE ( NOUT, FMT = 99996 ) ( EVI(J), J = 1, 3 ) * WRITE ( NOUT, FMT = 99993 ) WRITE ( NOUT, FMT = 99996 ) ( EVQ(J), J = 1, 3 ) * WRITE ( NOUT, FMT = 99992 ) DO 20 I = 1, 3 IF ( EVQ(I).NE.ZERO ) THEN RT(1) = EVR(I)/EVQ(I) RT(2) = EVI(I)/EVQ(I) WRITE ( NOUT, FMT = 99996 ) ( RT(J), J = 1, 2 ) END IF 20 CONTINUE * END IF STOP * 99999 FORMAT (' MC01XD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC01XD = ',I2) 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (' Real part of the numerators of the roots') 99994 FORMAT (' Imaginary part of the numerators of the roots') 99993 FORMAT (' Denominators of the roots') 99992 FORMAT (' Roots of the polynomial',/1X) ENDProgram Data
MC01XD EXAMPLE PROGRAM DATA -3098110792.0746 4649783048.0746 -2327508384.0000 388574551.8120Program Results
MC01XD EXAMPLE PROGRAM RESULTS Real part of the numerators of the roots 1.0185 1.1048 0.5911 Imaginary part of the numerators of the roots 0.0000 0.0455 -0.0244 Denominators of the roots 0.5110 0.5528 0.2958 Roots of the polynomial 1.9931 0.0000 1.9984 0.0823 1.9984 -0.0823
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC03MD.html 0000664 0000000 0000000 00000027562 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To compute the coefficients of the real polynomial matrix P(x) = P1(x) * P2(x) + alpha * P3(x), where P1(x), P2(x) and P3(x) are given real polynomial matrices and alpha is a real scalar. Each of the polynomial matrices P1(x), P2(x) and P3(x) may be the zero matrix.Specification
SUBROUTINE MC03MD( RP1, CP1, CP2, DP1, DP2, DP3, ALPHA, P1, $ LDP11, LDP12, P2, LDP21, LDP22, P3, LDP31, $ LDP32, DWORK, INFO ) C .. Scalar Arguments .. INTEGER CP1, CP2, DP1, DP2, DP3, INFO, LDP11, LDP12, $ LDP21, LDP22, LDP31, LDP32, RP1 DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION DWORK(*), P1(LDP11,LDP12,*), P2(LDP21,LDP22,*), $ P3(LDP31,LDP32,*)Arguments
Input/Output Parameters
RP1 (input) INTEGER The number of rows of the matrices P1(x) and P3(x). RP1 >= 0. CP1 (input) INTEGER The number of columns of matrix P1(x) and the number of rows of matrix P2(x). CP1 >= 0. CP2 (input) INTEGER The number of columns of the matrices P2(x) and P3(x). CP2 >= 0. DP1 (input) INTEGER The degree of the polynomial matrix P1(x). DP1 >= -1. DP2 (input) INTEGER The degree of the polynomial matrix P2(x). DP2 >= -1. DP3 (input/output) INTEGER On entry, the degree of the polynomial matrix P3(x). DP3 >= -1. On exit, the degree of the polynomial matrix P(x). ALPHA (input) DOUBLE PRECISION The scalar value alpha of the problem. P1 (input) DOUBLE PRECISION array, dimension (LDP11,LDP12,*) If DP1 >= 0, then the leading RP1-by-CP1-by-(DP1+1) part of this array must contain the coefficients of the polynomial matrix P1(x). Specifically, P1(i,j,k) must contain the coefficient of x**(k-1) of the polynomial which is the (i,j)-th element of P1(x), where i = 1,2,..., RP1, j = 1,2,...,CP1 and k = 1,2,...,DP1+1. If DP1 = -1, then P1(x) is taken to be the zero polynomial matrix, P1 is not referenced and can be supplied as a dummy array (i.e. set the parameters LDP11 = LDP12 = 1 and declare this array to be P1(1,1,1) in the calling program). LDP11 INTEGER The leading dimension of array P1. LDP11 >= MAX(1,RP1) if DP1 >= 0, LDP11 >= 1 if DP1 = -1. LDP12 INTEGER The second dimension of array P1. LDP12 >= MAX(1,CP1) if DP1 >= 0, LDP12 >= 1 if DP1 = -1. P2 (input) DOUBLE PRECISION array, dimension (LDP21,LDP22,*) If DP2 >= 0, then the leading CP1-by-CP2-by-(DP2+1) part of this array must contain the coefficients of the polynomial matrix P2(x). Specifically, P2(i,j,k) must contain the coefficient of x**(k-1) of the polynomial which is the (i,j)-th element of P2(x), where i = 1,2,..., CP1, j = 1,2,...,CP2 and k = 1,2,...,DP2+1. If DP2 = -1, then P2(x) is taken to be the zero polynomial matrix, P2 is not referenced and can be supplied as a dummy array (i.e. set the parameters LDP21 = LDP22 = 1 and declare this array to be P2(1,1,1) in the calling program). LDP21 INTEGER The leading dimension of array P2. LDP21 >= MAX(1,CP1) if DP2 >= 0, LDP21 >= 1 if DP2 = -1. LDP22 INTEGER The second dimension of array P2. LDP22 >= MAX(1,CP2) if DP2 >= 0, LDP22 >= 1 if DP2 = -1. P3 (input/output) DOUBLE PRECISION array, dimension (LDP31,LDP32,n), where n = MAX(DP1+DP2,DP3,0)+1. On entry, if DP3 >= 0, then the leading RP1-by-CP2-by-(DP3+1) part of this array must contain the coefficients of the polynomial matrix P3(x). Specifically, P3(i,j,k) must contain the coefficient of x**(k-1) of the polynomial which is the (i,j)-th element of P3(x), where i = 1,2,...,RP1, j = 1,2,...,CP2 and k = 1,2,...,DP3+1. If DP3 = -1, then P3(x) is taken to be the zero polynomial matrix. On exit, if DP3 >= 0 on exit (ALPHA <> 0.0 and DP3 <> -1, on entry, or DP1 <> -1 and DP2 <> -1), then the leading RP1-by-CP2-by-(DP3+1) part of this array contains the coefficients of P(x). Specifically, P3(i,j,k) contains the coefficient of x**(k-1) of the polynomial which is the (i,j)-th element of P(x), where i = 1,2,...,RP1, j = 1,2, ...,CP2 and k = 1,2,...,DP3+1. If DP3 = -1 on exit, then the coefficients of P(x) (the zero polynomial matrix) are not stored in the array. LDP31 INTEGER The leading dimension of array P3. LDP31 >= MAX(1,RP1). LDP32 INTEGER The second dimension of array P3. LDP32 >= MAX(1,CP2).Workspace
DWORK DOUBLE PRECISION array, dimension (CP1)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given real polynomial matrices DP1 i P1(x) = SUM (A(i+1) * x ), i=0 DP2 i P2(x) = SUM (B(i+1) * x ), i=0 DP3 i P3(x) = SUM (C(i+1) * x ) i=0 and a real scalar alpha, the routine computes the coefficients d ,d ,..., of the polynomial matrix 1 2 P(x) = P1(x) * P2(x) + alpha * P3(x) from the formula s d = SUM (A(k+1) * B(i-k+1)) + alpha * C(i+1), i+1 k=r where i = 0,1,...,DP1+DP2 and r and s depend on the value of i (e.g. if i <= DP1 and i <= DP2, then r = 0 and s = i).Numerical Aspects
None.Further Comments
Other elementary operations involving polynomial matrices can easily be obtained by calling the appropriate BLAS routine(s).Example
Program Text
* MC03MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER CP1MAX, CP2MAX, DP1MAX, DP2MAX, DP3MAX, RP1MAX PARAMETER ( CP1MAX = 10, CP2MAX = 10, DP1MAX = 10, $ DP2MAX = 10, DP3MAX = 20, RP1MAX = 10 ) INTEGER LDP11, LDP12, LDP21, LDP22, LDP31, LDP32 PARAMETER ( LDP11 = RP1MAX, LDP12 = CP1MAX, $ LDP21 = CP1MAX, LDP22 = CP2MAX, $ LDP31 = RP1MAX, LDP32 = CP2MAX ) * .. Local Scalars .. DOUBLE PRECISION ALPHA INTEGER CP1, CP2, DP1, DP2, DP3, I, INFO, J, K, RP1 * .. Local Arrays .. DOUBLE PRECISION DWORK(CP1MAX), $ P1(LDP11,LDP12,DP1MAX+1), $ P2(LDP21,LDP22,DP2MAX+1), $ P3(LDP31,LDP32,DP3MAX+1) * .. External Subroutines .. EXTERNAL MC03MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) RP1, CP1, CP2 IF ( RP1.LT.0 .OR. RP1.GT.RP1MAX ) THEN WRITE ( NOUT, FMT = 99995 ) RP1 ELSE IF ( CP1.LT.0 .OR. CP1.GT.CP1MAX ) THEN WRITE ( NOUT, FMT = 99994 ) CP1 ELSE IF ( CP2.LT.0 .OR. CP2.GT.CP2MAX ) THEN WRITE ( NOUT, FMT = 99993 ) CP2 ELSE READ ( NIN, FMT = * ) DP1 IF ( DP1.LE.-2 .OR. DP1.GT.DP1MAX ) THEN WRITE ( NOUT, FMT = 99992 ) DP1 ELSE DO 40 K = 1, DP1 + 1 DO 20 J = 1, CP1 READ ( NIN, FMT = * ) ( P1(I,J,K), I = 1,RP1 ) 20 CONTINUE 40 CONTINUE READ ( NIN, FMT = * ) DP2 IF ( DP2.LE.-2 .OR. DP2.GT.DP2MAX ) THEN WRITE ( NOUT, FMT = 99991 ) DP2 ELSE DO 80 K = 1, DP2 + 1 DO 60 J = 1, CP2 READ ( NIN, FMT = * ) ( P2(I,J,K), I = 1,CP1 ) 60 CONTINUE 80 CONTINUE READ ( NIN, FMT = * ) DP3 IF ( DP3.LE.-2 .OR. DP3.GT.DP3MAX ) THEN WRITE ( NOUT, FMT = 99990 ) DP3 ELSE DO 120 K = 1, DP3 + 1 DO 100 J = 1, CP2 READ ( NIN, FMT = * ) ( P3(I,J,K), I = 1,RP1 ) 100 CONTINUE 120 CONTINUE READ ( NIN, FMT = * ) ALPHA * Compute the coefficients of the polynomial matrix P(x) CALL MC03MD( RP1, CP1, CP2, DP1, DP2, DP3, ALPHA, P1, $ LDP11, LDP12, P2, LDP21, LDP22, P3, $ LDP31, LDP32, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DP3, $ ( I-1, I = 1,DP3+1 ) DO 160 I = 1, RP1 DO 140 J = 1, CP2 WRITE ( NOUT, FMT = 99996 ) I, J, $ ( P3(I,J,K), K = 1,DP3+1 ) 140 CONTINUE 160 CONTINUE END IF END IF END IF END IF END IF * STOP * 99999 FORMAT (' MC03MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC03MD = ',I2) 99997 FORMAT (' The polynomial matrix P(x) (of degree ',I2,') is ', $ //' power of x ',20I8) 99996 FORMAT (/' element (',I2,',',I2,') is ',20(1X,F7.2)) 99995 FORMAT (/' RP1 is out of range.',/' RP1 = ',I5) 99994 FORMAT (/' CP1 is out of range.',/' CP1 = ',I5) 99993 FORMAT (/' CP2 is out of range.',/' CP2 = ',I5) 99992 FORMAT (/' DP1 is out of range.',/' DP1 = ',I5) 99991 FORMAT (/' DP2 is out of range.',/' DP2 = ',I5) 99990 FORMAT (/' DP3 is out of range.',/' DP3 = ',I5) ENDProgram Data
MC03MD EXAMPLE PROGRAM DATA 3 2 2 2 1.0 0.0 3.0 2.0 -1.0 2.0 -2.0 4.0 9.0 3.0 7.0 -2.0 6.0 2.0 -3.0 1.0 2.0 4.0 1 6.0 1.0 1.0 7.0 -9.0 -6.0 7.0 8.0 1 1.0 1.0 0.0 0.0 1.0 1.0 -1.0 1.0 1.0 -1.0 -1.0 1.0 1.0Program Results
MC03MD EXAMPLE PROGRAM RESULTS The polynomial matrix P(x) (of degree 3) is power of x 0 1 2 3 element ( 1, 1) is 9.00 -31.00 37.00 -60.00 element ( 1, 2) is 15.00 41.00 23.00 50.00 element ( 2, 1) is 0.00 38.00 -64.00 -30.00 element ( 2, 2) is -6.00 44.00 100.00 30.00 element ( 3, 1) is 20.00 14.00 -83.00 3.00 element ( 3, 2) is 18.00 33.00 72.00 11.00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC03ND.html 0000664 0000000 0000000 00000035461 14560147231 0020347 0 ustar 00root root 0000000 0000000
Purpose
To compute the coefficients of a minimal polynomial basis DK K(s) = K(0) + K(1) * s + ... + K(DK) * s for the right nullspace of the MP-by-NP polynomial matrix of degree DP, given by DP P(s) = P(0) + P(1) * s + ... + P(DP) * s , which corresponds to solving the polynomial matrix equation P(s) * K(s) = 0.Specification
SUBROUTINE MC03ND( MP, NP, DP, P, LDP1, LDP2, DK, GAM, NULLSP, $ LDNULL, KER, LDKER1, LDKER2, TOL, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER DK, DP, INFO, LDKER1, LDKER2, LDNULL, LDP1, $ LDP2, LDWORK, MP, NP DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER GAM(*), IWORK(*) DOUBLE PRECISION DWORK(*), KER(LDKER1,LDKER2,*), $ NULLSP(LDNULL,*), P(LDP1,LDP2,*)Arguments
Input/Output Parameters
MP (input) INTEGER The number of rows of the polynomial matrix P(s). MP >= 0. NP (input) INTEGER The number of columns of the polynomial matrix P(s). NP >= 0. DP (input) INTEGER The degree of the polynomial matrix P(s). DP >= 1. P (input) DOUBLE PRECISION array, dimension (LDP1,LDP2,DP+1) The leading MP-by-NP-by-(DP+1) part of this array must contain the coefficients of the polynomial matrix P(s). Specifically, P(i,j,k) must contain the (i,j)-th element of P(k-1), which is the cofficient of s**(k-1) of P(s), where i = 1,2,...,MP, j = 1,2,...,NP and k = 1,2,...,DP+1. LDP1 INTEGER The leading dimension of array P. LDP1 >= MAX(1,MP). LDP2 INTEGER The second dimension of array P. LDP2 >= MAX(1,NP). DK (output) INTEGER The degree of the minimal polynomial basis K(s) for the right nullspace of P(s) unless DK = -1, in which case there is no right nullspace. GAM (output) INTEGER array, dimension (DP*MP+1) The leading (DK+1) elements of this array contain information about the ordering of the right nullspace vectors stored in array NULLSP. NULLSP (output) DOUBLE PRECISION array, dimension (LDNULL,(DP*MP+1)*NP) The leading NP-by-SUM(i*GAM(i)) part of this array contains the right nullspace vectors of P(s) in condensed form (as defined in METHOD), where i = 1,2,...,DK+1. LDNULL INTEGER The leading dimension of array NULLSP. LDNULL >= MAX(1,NP). KER (output) DOUBLE PRECISION array, dimension (LDKER1,LDKER2,DP*MP+1) The leading NP-by-nk-by-(DK+1) part of this array contains the coefficients of the minimal polynomial basis K(s), where nk = SUM(GAM(i)) and i = 1,2,...,DK+1. Specifically, KER(i,j,m) contains the (i,j)-th element of K(m-1), which is the coefficient of s**(m-1) of K(s), where i = 1,2,..., NP, j = 1,2,...,nk and m = 1,2,...,DK+1. LDKER1 INTEGER The leading dimension of array KER. LDKER1 >= MAX(1,NP). LDKER2 INTEGER The second dimension of array KER. LDKER2 >= MAX(1,NP).Tolerances
TOL DOUBLE PRECISION A tolerance below which matrix elements are considered to be zero. If the user sets TOL to be less than 10 * EPS * MAX( ||A|| , ||E|| ), then the tolerance is F F taken as 10 * EPS * MAX( ||A|| , ||E|| ), where EPS is the F F machine precision (see LAPACK Library Routine DLAMCH) and A and E are matrices (as defined in METHOD).Workspace
IWORK INTEGER array, dimension (m+2*MAX(n,m+1)+n), where m = DP*MP and n = (DP-1)*MP + NP. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK The length of the array DWORK. LDWORK >= m*n*n + 2*m*n + 2*n*n.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value. > 0: if incorrect rank decisions were taken during the computations. This failure is not likely to occur. The possible values are: k, 1 <= k <= DK+1, the k-th diagonal submatrix had not a full row rank; DK+2, if incorrect dimensions of a full column rank submatrix; DK+3, if incorrect dimensions of a full row rank submatrix.Method
The computation of the right nullspace of the MP-by-NP polynomial matrix P(s) of degree DP given by DP-1 DP P(s) = P(0) + P(1) * s + ... + P(DP-1) * s + P(DP) * s is performed via the pencil s*E - A, associated with P(s), where | I | | 0 -P(DP) | | . | | I . . | A = | . | and E = | . . . |. (1) | . | | . 0 . | | I | | I 0 -P(2) | | P(0) | | I -P(1) | The pencil s*E - A is transformed by unitary matrices Q and Z such that | sE(eps)-A(eps) | X | X | |----------------|----------------|------------| | 0 | sE(inf)-A(inf) | X | Q'(s*E-A)Z = |=================================|============|. | | | | 0 | sE(r)-A(r) | Since s*E(inf)-A(inf) and s*E(r)-A(r) have full column rank, the minimal polynomial basis for the right nullspace of Q'(s*E-A)Z (and consequently the basis for the right nullspace of s*E - A) is completely determined by s*E(eps)-A(eps). Let Veps(s) be a minimal polynomial basis for the right nullspace of s*E(eps)-A(eps). Then | Veps(s) | V(s) = Z * |---------| | 0 | is a minimal polynomial basis for the right nullspace of s*E - A. From the structure of s*E - A it can be shown that if V(s) is partitioned as | Vo(s) | (DP-1)*MP V(s) = |------ | | Ve(s) | NP then the columns of Ve(s) form a minimal polynomial basis for the right nullspace of P(s). The vectors of Ve(s) are computed and stored in array NULLSP in the following condensed form: || || | || | | || | | || U1,0 || U2,0 | U2,1 || U3,0 | U3,1 | U3,2 || U4,0 | ... |, || || | || | | || | | where Ui,j is an NP-by-GAM(i) matrix which contains the i-th block of columns of K(j), the j-th coefficient of the polynomial matrix representation for the right nullspace DK K(s) = K(0) + K(1) * s + . . . + K(DK) * s . The coefficients K(0), K(1), ..., K(DK) are NP-by-nk matrices given by K(0) = | U1,0 | U2,0 | U3,0 | . . . | U(DK+1,0) | K(1) = | 0 | U2,1 | U3,1 | . . . | U(DK+1,1) | K(2) = | 0 | 0 | U3,2 | . . . | U(DK+1,2) | . . . . . . . . . . K(DK) = | 0 | 0 | 0 | . . . | 0 | U(DK+1,DK)|. Note that the degree of K(s) satisfies the inequality DK <= DP * MIN(MP,NP) and that the dimension of K(s) satisfies the inequality (NP-MP) <= nk <= NP.References
[1] Beelen, Th.G.J. New Algorithms for Computing the Kronecker structure of a Pencil with Applications to Systems and Control Theory. Ph.D.Thesis, Eindhoven University of Technology, 1987. [2] Van Den Hurk, G.J.H.H. New Algorithms for Solving Polynomial Matrix Problems. Master's Thesis, Eindhoven University of Technology, 1987.Numerical Aspects
The algorithm used by the routine involves the construction of a special block echelon form with pivots considered to be non-zero when they are larger than TOL. These pivots are then inverted in order to construct the columns of the kernel of the polynomial matrix. If TOL is chosen to be too small then these inversions may be sensitive whereas increasing TOL will make the inversions more robust but will affect the block echelon form (and hence the column degrees of the polynomial kernel). Furthermore, if the elements of the computed polynomial kernel are large relative to the polynomial matrix, then the user should consider trying several values of TOL.Further Comments
It also possible to compute a minimal polynomial basis for the right nullspace of a pencil, since a pencil is a polynomial matrix of degree 1. Thus for the pencil (s*E - A), the required input is P(1) = E and P(0) = -A. The routine can also be used to compute a minimal polynomial basis for the left nullspace of a polynomial matrix by simply transposing P(s).Example
Program Text
* MC03ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DPMAX, MPMAX, NPMAX * PARAMETER ( DPMAX = 5, MPMAX = 5, NPMAX = 5 ) PARAMETER ( DPMAX = 2, MPMAX = 5, NPMAX = 4 ) INTEGER LDP1, LDP2, LDNULL, LDKER1, LDKER2 PARAMETER ( LDP1 = MPMAX, LDP2 = NPMAX, LDNULL = NPMAX, $ LDKER1 = NPMAX, LDKER2 = NPMAX ) INTEGER M, N PARAMETER ( M = DPMAX*MPMAX, N = ( DPMAX-1 )*MPMAX+NPMAX ) INTEGER LIWORK, LDWORK * PARAMETER ( LIWORK = 3*( N+M )+2, PARAMETER ( LIWORK = M+2*MAX( N,M+1 )+N, $ LDWORK = M*N**2+2*M*N+2*N**2 ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER DK, DP, I, INFO, J, K, M1, MP, NK, NP * .. Local Arrays .. DOUBLE PRECISION DWORK(LDWORK), KER(LDKER1,LDKER2,M+1), $ NULLSP(LDNULL,(M+1)*NPMAX), P(LDP1,LDP2,DPMAX+1) INTEGER GAM(M+1), IWORK(LIWORK) * .. External Subroutines .. EXTERNAL MC03ND * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) MP, NP, DP, TOL IF ( MP.LT.0 .OR. MP.GT.MPMAX ) THEN WRITE ( NOUT, FMT = 99990 ) MP ELSE IF ( NP.LT.0 .OR. NP.GT.NPMAX ) THEN WRITE ( NOUT, FMT = 99991 ) NP ELSE IF ( DP.LE.0 .OR. DP.GT.DPMAX ) THEN WRITE ( NOUT, FMT = 99992 ) DP ELSE DO 40 K = 1, DP + 1 DO 20 I = 1, MP READ ( NIN, FMT = * ) ( P(I,J,K), J = 1,NP ) 20 CONTINUE 40 CONTINUE * Compute a minimal polynomial basis K(s) of the given P(s). CALL MC03ND( MP, NP, DP, P, LDP1, LDP2, DK, GAM, NULLSP, $ LDNULL, KER, LDKER1, LDKER2, TOL, IWORK, DWORK, $ LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( DK.LT.0 ) THEN WRITE ( NOUT, FMT = 99997 ) ELSE NK = 0 M1 = 0 DO 60 I = 1, DK + 1 NK = NK + GAM(I) M1 = M1 + GAM(I)*I 60 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 80 I = 1, NP WRITE ( NOUT, FMT = 99995 ) ( NULLSP(I,J), J = 1,M1 ) 80 CONTINUE WRITE ( NOUT, FMT = 99994 ) DK, ( I-1, I = 1,DK+1 ) DO 120 I = 1, NP DO 100 J = 1, NK WRITE ( NOUT, FMT = 99993 ) $ I, J, ( KER(I,J,K), K = 1,DK+1 ) 100 CONTINUE 120 CONTINUE END IF END IF STOP * 99999 FORMAT (' MC03ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MC03ND = ',I2) 99997 FORMAT (' The polynomial matrix P(s) has no right nullspace') 99996 FORMAT (' The right nullspace vectors of P(s) are ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' The minimal polynomial basis K(s) (of degree ',I2,') ', $ 'for the right nullspace is ',//' power of s ', $ 20I8) 99993 FORMAT (/' element (',I2,',',I2,') is ',20(1X,F7.2)) 99992 FORMAT (/' DP is out of range.',/' DP = ',I5) 99991 FORMAT (/' NP is out of range.',/' NP = ',I5) 99990 FORMAT (/' MP is out of range.',/' MP = ',I5) ENDProgram Data
MC03ND EXAMPLE PROGRAM DATA 5 4 2 0.0 2.0 2.0 0.0 3.0 0.0 4.0 0.0 6.0 8.0 8.0 0.0 12.0 0.0 0.0 0.0 0.0 2.0 2.0 0.0 3.0 1.0 0.0 1.0 0.0 0.0 0.0 2.0 0.0 4.0 0.0 4.0 0.0 2.0 2.0 0.0 3.0 3.0 2.0 1.0 3.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0Program Results
MC03ND EXAMPLE PROGRAM RESULTS The right nullspace vectors of P(s) are 0.0000 0.0000 0.0000 -0.8321 0.0000 0.1538 0.0000 -1.0000 0.0000 0.5547 0.0000 0.2308 The minimal polynomial basis K(s) (of degree 1) for the right nullspace is power of s 0 1 element ( 1, 1) is 0.00 0.00 element ( 1, 2) is 0.00 0.00 element ( 2, 1) is -0.83 0.00 element ( 2, 2) is 0.00 0.15 element ( 3, 1) is 0.00 0.00 element ( 3, 2) is -1.00 0.00 element ( 4, 1) is 0.55 0.00 element ( 4, 2) is 0.00 0.23
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MC03NX.html 0000664 0000000 0000000 00000006753 14560147231 0020375 0 ustar 00root root 0000000 0000000
Purpose
Given an MP-by-NP polynomial matrix of degree dp dp-1 dp P(s) = P(0) + ... + P(dp-1) * s + P(dp) * s (1) the routine composes the related pencil s*E-A where | I | | O -P(dp) | | . | | I . . | A = | . | and E = | . . . |. (2) | . | | . O . | | I | | I O -P(2) | | P(0) | | I -P(1) | ================================================================== REMARK: This routine is intended to be called only from the SLICOT routine MC03ND. ==================================================================Specification
SUBROUTINE MC03NX( MP, NP, DP, P, LDP1, LDP2, A, LDA, E, LDE ) C .. Scalar Arguments .. INTEGER DP, LDA, LDE, LDP1, LDP2, MP, NP C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), E(LDE,*), P(LDP1,LDP2,*)Arguments
Input/Output Parameters
MP (input) INTEGER The number of rows of the polynomial matrix P(s). MP >= 0. NP (input) INTEGER The number of columns of the polynomial matrix P(s). NP >= 0. DP (input) INTEGER The degree of the polynomial matrix P(s). DP >= 1. P (input) DOUBLE PRECISION array, dimension (LDP1,LDP2,DP+1) The leading MP-by-NP-by-(DP+1) part of this array must contain the coefficients of the polynomial matrix P(s) in (1) in increasing powers of s. LDP1 INTEGER The leading dimension of array P. LDP1 >= MAX(1,MP). LDP2 INTEGER The second dimension of array P. LDP2 >= MAX(1,NP). A (output) DOUBLE PRECISION array, dimension (LDA,(DP-1)*MP+NP) The leading DP*MP-by-((DP-1)*MP+NP) part of this array contains the matrix A as described in (2). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,DP*MP). E (output) DOUBLE PRECISION array, dimension (LDE,(DP-1)*MP+NP) The leading DP*MP-by-((DP-1)*MP+NP) part of this array contains the matrix E as described in (2). LDE INTEGER The leading dimension of array E. LDE >= MAX(1,DP*MP).Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To minimize the sum of the squares of m nonlinear functions, e, in n variables, x, by a modification of the Levenberg-Marquardt algorithm, using either a Cholesky-based or a conjugate gradients solver. The user must provide a subroutine FCN which calculates the functions and the Jacobian J (possibly by finite differences), and another subroutine JPJ, which computes either J'*J + par*I (if ALG = 'D'), or (J'*J + par*I)*x (if ALG = 'I'), where par is the Levenberg factor, exploiting the possible structure of the Jacobian matrix. Template implementations of these routines are included in the SLICOT Library.Specification
SUBROUTINE MD03AD( XINIT, ALG, STOR, UPLO, FCN, JPJ, M, N, ITMAX, $ NPRINT, IPAR, LIPAR, DPAR1, LDPAR1, DPAR2, $ LDPAR2, X, NFEV, NJEV, TOL, CGTOL, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER ALG, STOR, UPLO, XINIT INTEGER INFO, ITMAX, IWARN, LDPAR1, LDPAR2, LDWORK, $ LIPAR, M, N, NFEV, NJEV, NPRINT DOUBLE PRECISION CGTOL, TOL C .. Array Arguments .. DOUBLE PRECISION DPAR1(LDPAR1,*), DPAR2(LDPAR2,*), DWORK(*), X(*) INTEGER IPAR(*)Arguments
Mode Parameters
XINIT CHARACTER*1 Specifies how the variables x are initialized, as follows: = 'R' : the array X is initialized to random values; the entries DWORK(1:4) are used to initialize the random number generator: the first three values are converted to integers between 0 and 4095, and the last one is converted to an odd integer between 1 and 4095; = 'G' : the given entries of X are used as initial values of variables. ALG CHARACTER*1 Specifies the algorithm used for solving the linear systems involving a Jacobian matrix J, as follows: = 'D' : a direct algorithm, which computes the Cholesky factor of the matrix J'*J + par*I is used; = 'I' : an iterative Conjugate Gradients algorithm, which only needs the matrix J, is used. In both cases, matrix J is stored in a compressed form. STOR CHARACTER*1 If ALG = 'D', specifies the storage scheme for the symmetric matrix J'*J, as follows: = 'F' : full storage is used; = 'P' : packed storage is used. The option STOR = 'F' usually ensures a faster execution. This parameter is not relevant if ALG = 'I'. UPLO CHARACTER*1 If ALG = 'D', specifies which part of the matrix J'*J is stored, as follows: = 'U' : the upper triagular part is stored; = 'L' : the lower triagular part is stored. The option UPLO = 'U' usually ensures a faster execution. This parameter is not relevant if ALG = 'I'.Function Parameters
FCN EXTERNAL Subroutine which evaluates the functions and the Jacobian. FCN must be declared in an external statement in the user calling program, and must have the following interface: SUBROUTINE FCN( IFLAG, M, N, IPAR, LIPAR, DPAR1, LDPAR1, $ DPAR2, LDPAR2, X, NFEVL, E, J, LDJ, JTE, $ DWORK, LDWORK, INFO ) where IFLAG (input/output) INTEGER On entry, this parameter must contain a value defining the computations to be performed: = 0 : Optionally, print the current iterate X, function values E, and Jacobian matrix J, or other results defined in terms of these values. See the argument NPRINT of MD03AD. Do not alter E and J. = 1 : Calculate the functions at X and return this vector in E. Do not alter J. = 2 : Calculate the Jacobian at X and return this matrix in J. Also return J'*e in JTE and NFEVL (see below). Do not alter E. = 3 : Do not compute neither the functions nor the Jacobian, but return in LDJ and IPAR/DPAR1,DPAR2 (some of) the integer/real parameters needed. On exit, the value of this parameter should not be changed by FCN unless the user wants to terminate execution of MD03AD, in which case IFLAG must be set to a negative integer. M (input) INTEGER The number of functions. M >= 0. N (input) INTEGER The number of variables. M >= N >= 0. IPAR (input/output) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the Jacobian matrix or needed for problem solving. IPAR is an input parameter, except for IFLAG = 3 on entry, when it is also an output parameter. On exit, if IFLAG = 3, IPAR(1) contains the length of the array J, for storing the Jacobian matrix, and the entries IPAR(2:5) contain the workspace required by FCN for IFLAG = 1, FCN for IFLAG = 2, JPJ for ALG = 'D', and JPJ for ALG = 'I', respectively. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 5. DPAR1 (input/output) DOUBLE PRECISION array, dimension (LDPAR1,*) or (LDPAR1) A first set of real parameters needed for describing or solving the problem. DPAR1 can also be used as an additional array for intermediate results when computing the functions or the Jacobian. For control problems, DPAR1 could store the input trajectory of a system. LDPAR1 (input) INTEGER The leading dimension or the length of the array DPAR1, as convenient. LDPAR1 >= 0. (LDPAR1 >= 1, if leading dimension.) DPAR2 (input/output) DOUBLE PRECISION array, dimension (LDPAR2,*) or (LDPAR2) A second set of real parameters needed for describing or solving the problem. DPAR2 can also be used as an additional array for intermediate results when computing the functions or the Jacobian. For control problems, DPAR2 could store the output trajectory of a system. LDPAR2 (input) INTEGER The leading dimension or the length of the array DPAR2, as convenient. LDPAR2 >= 0. (LDPAR2 >= 1, if leading dimension.) X (input) DOUBLE PRECISION array, dimension (N) This array must contain the value of the variables x where the functions or the Jacobian must be evaluated. NFEVL (input/output) INTEGER The number of function evaluations needed to compute the Jacobian by a finite difference approximation. NFEVL is an input parameter if IFLAG = 0, or an output parameter if IFLAG = 2. If the Jacobian is computed analytically, NFEVL should be set to a non-positive value. E (input/output) DOUBLE PRECISION array, dimension (M) This array contains the value of the (error) functions e evaluated at X. E is an input parameter if IFLAG = 0 or 2, or an output parameter if IFLAG = 1. J (input/output) DOUBLE PRECISION array, dimension (LDJ,NC), where NC is the number of columns needed. This array contains a possibly compressed representation of the Jacobian matrix evaluated at X. If full Jacobian is stored, then NC = N. J is an input parameter if IFLAG = 0, or an output parameter if IFLAG = 2. LDJ (input/output) INTEGER The leading dimension of array J. LDJ >= 1. LDJ is essentially used inside the routines FCN and JPJ. LDJ is an input parameter, except for IFLAG = 3 on entry, when it is an output parameter. It is assumed in MD03AD that LDJ is not larger than needed. JTE (output) DOUBLE PRECISION array, dimension (N) If IFLAG = 2, the matrix-vector product J'*e. DWORK DOUBLE PRECISION array, dimension (LDWORK) The workspace array for subroutine FCN. On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK (input) INTEGER The size of the array DWORK (as large as needed in the subroutine FCN). LDWORK >= 1. INFO INTEGER Error indicator, set to a negative value if an input (scalar) argument is erroneous, and to positive values for other possible errors in the subroutine FCN. The LAPACK Library routine XERBLA should be used in conjunction with negative INFO. INFO must be zero if the subroutine finished successfully. Parameters marked with "(input)" must not be changed. JPJ EXTERNAL Subroutine which computes J'*J + par*I, if ALG = 'D', and J'*J*x + par*x, if ALG = 'I', where J is the Jacobian as described above. JPJ must have the following interface: SUBROUTINE JPJ( STOR, UPLO, N, IPAR, LIPAR, DPAR, LDPAR, $ J, LDJ, JTJ, LDJTJ, DWORK, LDWORK, INFO ) if ALG = 'D', and SUBROUTINE JPJ( N, IPAR, LIPAR, DPAR, LDPAR, J, LDJ, X, $ INCX, DWORK, LDWORK, INFO ) if ALG = 'I', where STOR (input) CHARACTER*1 Specifies the storage scheme for the symmetric matrix J'*J, as follows: = 'F' : full storage is used; = 'P' : packed storage is used. UPLO (input) CHARACTER*1 Specifies which part of the matrix J'*J is stored, as follows: = 'U' : the upper triagular part is stored; = 'L' : the lower triagular part is stored. N (input) INTEGER The number of columns of the matrix J. N >= 0. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the Jacobian matrix. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 0. DPAR (input) DOUBLE PRECISION array, dimension (LDPAR) DPAR(1) must contain an initial estimate of the Levenberg-Marquardt parameter, par. DPAR(1) >= 0. LDPAR (input) INTEGER The length of the array DPAR. LDPAR >= 1. J (input) DOUBLE PRECISION array, dimension (LDJ, NC), where NC is the number of columns. The leading NR-by-NC part of this array must contain the (compressed) representation of the Jacobian matrix J, where NR is the number of rows of J (function of IPAR entries). LDJ (input) INTEGER The leading dimension of array J. LDJ >= MAX(1,NR). JTJ (output) DOUBLE PRECISION array, dimension (LDJTJ,N), if STOR = 'F', dimension (N*(N+1)/2), if STOR = 'P'. The leading N-by-N (if STOR = 'F'), or N*(N+1)/2 (if STOR = 'P') part of this array contains the upper or lower triangle of the matrix J'*J+par*I, depending on UPLO = 'U', or UPLO = 'L', respectively, stored either as a two-dimensional, or one-dimensional array, depending on STOR. LDJTJ (input) INTEGER The leading dimension of the array JTJ. LDJTJ >= MAX(1,N), if STOR = 'F'. LDJTJ >= 1, if STOR = 'P'. DWORK DOUBLE PRECISION array, dimension (LDWORK) The workspace array for subroutine JPJ. LDWORK (input) INTEGER The size of the array DWORK (as large as needed in the subroutine JPJ). INFO INTEGER Error indicator, set to a negative value if an input (scalar) argument is erroneous, and to positive values for other possible errors in the subroutine JPJ. The LAPACK Library routine XERBLA should be used in conjunction with negative INFO values. INFO must be zero if the subroutine finished successfully. If ALG = 'I', the parameters in common with those for ALG = 'D', have the same meaning, and the additional parameters are: X (input/output) DOUBLE PRECISION array, dimension (1+(N-1)*INCX) On entry, this incremented array must contain the vector x. On exit, this incremented array contains the value of the matrix-vector product (J'*J + par)*x. INCX (input) INTEGER The increment for the elements of X. INCX > 0. Parameters marked with "(input)" must not be changed.Input/Output Parameters
M (input) INTEGER The number of functions. M >= 0. N (input) INTEGER The number of variables. M >= N >= 0. ITMAX (input) INTEGER The maximum number of iterations. ITMAX >= 0. NPRINT (input) INTEGER This parameter enables controlled printing of iterates if it is positive. In this case, FCN is called with IFLAG = 0 at the beginning of the first iteration and every NPRINT iterations thereafter and immediately prior to return, with X, E, and J available for printing. If NPRINT is not positive, no special calls of FCN with IFLAG = 0 are made. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters needed, for instance, for describing the structure of the Jacobian matrix, which are handed over to the routines FCN and JPJ. The first five entries of this array are modified internally by a call to FCN (with IFLAG = 3), but are restored on exit. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 5. DPAR1 (input/output) DOUBLE PRECISION array, dimension (LDPAR1,*) or (LDPAR1) A first set of real parameters needed for describing or solving the problem. This argument is not used by MD03AD routine, but it is passed to the routine FCN. LDPAR1 (input) INTEGER The leading dimension or the length of the array DPAR1, as convenient. LDPAR1 >= 0. (LDPAR1 >= 1, if leading dimension.) DPAR2 (input/output) DOUBLE PRECISION array, dimension (LDPAR2,*) or (LDPAR2) A second set of real parameters needed for describing or solving the problem. This argument is not used by MD03AD routine, but it is passed to the routine FCN. LDPAR2 (input) INTEGER The leading dimension or the length of the array DPAR2, as convenient. LDPAR2 >= 0. (LDPAR2 >= 1, if leading dimension.) X (input/output) DOUBLE PRECISION array, dimension (N) On entry, if XINIT = 'G', this array must contain the vector of initial variables x to be optimized. If XINIT = 'R', this array need not be set before entry, and random values will be used to initialize x. On exit, if INFO = 0, this array contains the vector of values that (approximately) minimize the sum of squares of error functions. The values returned in IWARN and DWORK(1:5) give details on the iterative process. NFEV (output) INTEGER The number of calls to FCN with IFLAG = 1. If FCN is properly implemented, this includes the function evaluations needed for finite difference approximation of the Jacobian. NJEV (output) INTEGER The number of calls to FCN with IFLAG = 2.Tolerances
TOL DOUBLE PRECISION If TOL >= 0, the tolerance which measures the relative error desired in the sum of squares. Termination occurs when the actual relative reduction in the sum of squares is at most TOL. If the user sets TOL < 0, then SQRT(EPS) is used instead TOL, where EPS is the machine precision (see LAPACK Library routine DLAMCH). CGTOL DOUBLE PRECISION If ALG = 'I' and CGTOL > 0, the tolerance which measures the relative residual of the solutions computed by the conjugate gradients (CG) algorithm. Termination of a CG process occurs when the relative residual is at most CGTOL. If the user sets CGTOL <= 0, then SQRT(EPS) is used instead CGTOL.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, DWORK(2) returns the residual error norm (the sum of squares), DWORK(3) returns the number of iterations performed, DWORK(4) returns the total number of conjugate gradients iterations performed (zero, if ALG = 'D'), and DWORK(5) returns the final Levenberg factor. LDWORK INTEGER The length of the array DWORK. LDWORK >= max( 5, M + 2*N + size(J) + max( DW( FCN|IFLAG = 1 ) + N, DW( FCN|IFLAG = 2 ), DW( sol ) ) ), where size(J) is the size of the Jacobian (provided by FCN in IPAR(1), for IFLAG = 3), DW( f ) is the workspace needed by the routine f, where f is FCN or JPJ (provided by FCN in IPAR(2:5), for IFLAG = 3), and DW( sol ) is the workspace needed for solving linear systems, DW( sol ) = N*N + DW( JPJ ), if ALG = 'D', STOR = 'F'; DW( sol ) = N*(N+1)/2 + DW( JPJ ), if ALG = 'D', STOR = 'P'; DW( sol ) = 3*N + DW( JPJ ), if ALG = 'I'.Warning Indicator
IWARN INTEGER < 0: the user set IFLAG = IWARN in the subroutine FCN; = 0: no warning; = 1: if the iterative process did not converge in ITMAX iterations with tolerance TOL; = 2: if ALG = 'I', and in one or more iterations of the Levenberg-Marquardt algorithm, the conjugate gradient algorithm did not finish after 3*N iterations, with the accuracy required in the call; = 3: the cosine of the angle between e and any column of the Jacobian is at most FACTOR*EPS in absolute value, where FACTOR = 100 is defined in a PARAMETER statement; = 4: TOL is too small: no further reduction in the sum of squares is possible. In all these cases, DWORK(1:5) are set as described above.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: user-defined routine FCN returned with INFO <> 0 for IFLAG = 1; = 2: user-defined routine FCN returned with INFO <> 0 for IFLAG = 2; = 3: SLICOT Library routine MB02XD, if ALG = 'D', or SLICOT Library routine MB02WD, if ALG = 'I' (or user-defined routine JPJ), returned with INFO <> 0.Method
If XINIT = 'R', the initial value for X is set to a vector of pseudo-random values uniformly distributed in [-1,1]. The Levenberg-Marquardt algorithm (described in [1]) is used for optimizing the parameters. This algorithm needs the Jacobian matrix J, which is provided by the subroutine FCN. The algorithm tries to update x by the formula x = x - p, using the solution of the system of linear equations (J'*J + PAR*I)*p = J'*e, where I is the identity matrix, and e the error function vector. The Levenberg factor PAR is decreased after each successfull step and increased in the other case. If ALG = 'D', a direct method, which evaluates the matrix product J'*J + par*I and then factors it using Cholesky algorithm, implemented in the SLICOT Libray routine MB02XD, is used for solving the linear system above. If ALG = 'I', the Conjugate Gradients method, described in [2], and implemented in the SLICOT Libray routine MB02WD, is used for solving the linear system above. The main advantage of this method is that in most cases the solution of the system can be computed in less time than the time needed to compute the matrix J'*J This is, however, problem dependent.References
[1] Kelley, C.T. Iterative Methods for Optimization. Society for Industrial and Applied Mathematics (SIAM), Philadelphia (Pa.), 1999. [2] Golub, G.H. and van Loan, C.F. Matrix Computations. Third Edition. M. D. Johns Hopkins University Press, Baltimore, pp. 520-528, 1996. [3] More, J.J. The Levenberg-Marquardt algorithm: implementation and theory. In Watson, G.A. (Ed.), Numerical Analysis, Lecture Notes in Mathematics, vol. 630, Springer-Verlag, Berlin, Heidelberg and New York, pp. 105-116, 1978.Numerical Aspects
The Levenberg-Marquardt algorithm described in [3] is scaling invariant and globally convergent to (maybe local) minima. According to [1], the convergence rate near a local minimum is quadratic, if the Jacobian is computed analytically, and linear, if the Jacobian is computed numerically. Whether or not the direct algorithm is faster than the iterative Conjugate Gradients algorithm for solving the linear systems involved depends on several factors, including the conditioning of the Jacobian matrix, and the ratio between its dimensions.Further Comments
NoneExample
Program Text
* MD03AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER LDWORK PARAMETER ( LDWORK = MMAX + 2*NMAX + MMAX*NMAX + $ MAX( NMAX*NMAX, 3*NMAX + MMAX ) ) * .. The lengths of DPAR1, DPAR2, IPAR are set to 1, 1, and 5 .. INTEGER LDPAR1, LDPAR2, LIPAR PARAMETER ( LDPAR1 = 1, LDPAR2 = 1, LIPAR = 5 ) * .. Local Scalars .. CHARACTER*1 ALG, STOR, UPLO, XINIT INTEGER I, INFO, ITMAX, IWARN, M, N, NFEV, NJEV, NPRINT DOUBLE PRECISION CGTOL, TOL * .. Array Arguments .. INTEGER IPAR(LIPAR) DOUBLE PRECISION DPAR1(LDPAR1), DPAR2(LDPAR2), DWORK(LDWORK), $ X(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MD03AD, MD03AF, NF01BV, NF01BX * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, ITMAX, NPRINT, TOL, CGTOL, XINIT, $ ALG, STOR, UPLO IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE IF ( LSAME( XINIT, 'G' ) ) $ READ ( NIN, FMT = * ) ( X(I), I = 1,N ) * Solve a standard nonlinear least squares problem. IPAR(1) = M IF ( LSAME( ALG, 'D' ) ) THEN CALL MD03AD( XINIT, ALG, STOR, UPLO, MD03AF, NF01BV, M, $ N, ITMAX, NPRINT, IPAR, LIPAR, DPAR1, $ LDPAR1, DPAR2, LDPAR2, X, NFEV, NJEV, TOL, $ CGTOL, DWORK, LDWORK, IWARN, INFO ) ELSE CALL MD03AD( XINIT, ALG, STOR, UPLO, MD03AF, NF01BX, M, $ N, ITMAX, NPRINT, IPAR, LIPAR, DPAR1, $ LDPAR1, DPAR2, LDPAR2, X, NFEV, NJEV, TOL, $ CGTOL, DWORK, LDWORK, IWARN, INFO ) END IF * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( IWARN.NE.0 ) WRITE ( NOUT, FMT = 99991 ) IWARN WRITE ( NOUT, FMT = 99997 ) DWORK(2) WRITE ( NOUT, FMT = 99996 ) NFEV, NJEV WRITE ( NOUT, FMT = 99994 ) WRITE ( NOUT, FMT = 99995 ) ( X(I), I = 1, N ) END IF END IF END IF STOP * 99999 FORMAT (' MD03AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MD03AD = ',I2) 99997 FORMAT (/' Final 2-norm of the residuals = ',D15.7) 99996 FORMAT (/' The number of function and Jacobian evaluations = ', $ 2I7) 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' Final approximate solution is ' ) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (' IWARN on exit from MD03AD = ',I2) END C SUBROUTINE MD03AF( IFLAG, M, N, IPAR, LIPAR, DPAR1, LDPAR1, DPAR2, $ LDPAR2, X, NFEVL, E, J, LDJ, JTE, DWORK, $ LDWORK, INFO ) C C This is the FCN routine for solving a standard nonlinear least C squares problem using SLICOT Library routine MD03AD. See the C argument FCN in the routine MD03AD for the description of C parameters. C C The example programmed in this routine is adapted from that C accompanying the MINPACK routine LMDER. C C ****************************************************************** C C .. Parameters .. C .. NOUT is the unit number for printing intermediate results .. INTEGER NOUT PARAMETER ( NOUT = 6 ) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) C .. Scalar Arguments .. INTEGER IFLAG, INFO, LDJ, LDPAR1, LDPAR2, LDWORK, LIPAR, $ M, N, NFEVL C .. Array Arguments .. INTEGER IPAR(*) DOUBLE PRECISION DPAR1(*), DPAR2(*), DWORK(*), E(*), J(LDJ,*), $ JTE(*), X(*) C .. Local Scalars .. INTEGER I DOUBLE PRECISION ERR, TMP1, TMP2, TMP3, TMP4 C .. External Functions .. DOUBLE PRECISION DNRM2 EXTERNAL DNRM2 C .. External Subroutines .. EXTERNAL DGEMV C .. DATA Statements .. DOUBLE PRECISION Y(15) DATA Y(1), Y(2), Y(3), Y(4), Y(5), Y(6), Y(7), Y(8), $ Y(9), Y(10), Y(11), Y(12), Y(13), Y(14), Y(15) $ / 1.4D-1, 1.8D-1, 2.2D-1, 2.5D-1, 2.9D-1, $ 3.2D-1, 3.5D-1, 3.9D-1, 3.7D-1, 5.8D-1, $ 7.3D-1, 9.6D-1, 1.34D0, 2.1D0, 4.39D0 / C C .. Executable Statements .. C INFO = 0 IF ( IFLAG.EQ.1 ) THEN C C Compute the error function values, e. C DO 10 I = 1, 15 TMP1 = I TMP2 = 16 - I IF ( I.GT.8 ) THEN TMP3 = TMP2 ELSE TMP3 = TMP1 END IF E(I) = Y(I) - ( X(1) + TMP1/( X(2)*TMP2 + X(3)*TMP3 ) ) 10 CONTINUE C ELSE IF ( IFLAG.EQ.2 ) THEN C C Compute the Jacobian. C DO 30 I = 1, 15 TMP1 = I TMP2 = 16 - I IF ( I.GT.8 ) THEN TMP3 = TMP2 ELSE TMP3 = TMP1 END IF TMP4 = ( X(2)*TMP2 + X(3)*TMP3 )**2 J(I,1) = -ONE J(I,2) = TMP1*TMP2/TMP4 J(I,3) = TMP1*TMP3/TMP4 30 CONTINUE C C Compute the product J'*e (the error e was computed in array E). C CALL DGEMV( 'Transpose', M, N, ONE, J, LDJ, E, 1, ZERO, JTE, $ 1 ) C NFEVL = 0 C ELSE IF ( IFLAG.EQ.3 ) THEN C C Set the parameter LDJ, the length of the array J, and the sizes C of the workspace for MD03AF (IFLAG = 1 or 2), NF01BV and C NF01BX. C LDJ = M IPAR(1) = M*N IPAR(2) = 0 IPAR(3) = 0 IPAR(4) = M ELSE IF ( IFLAG.EQ.0 ) THEN C C Special call for printing intermediate results. C ERR = DNRM2( M, E, 1 ) WRITE( NOUT, '('' Norm of current error = '', D15.6)') ERR C END IF C DWORK(1) = ZERO RETURN C C *** Last line of MD03AF *** ENDProgram Data
MD03AD EXAMPLE PROGRAM DATA 15 3 100 0 -1. -1. G D F U 1.0 1.0 1.0Program Results
MD03AD EXAMPLE PROGRAM RESULTS Final 2-norm of the residuals = 0.9063596D-01 The number of function and Jacobian evaluations = 13 12 Final approximate solution is 0.0824 1.1330 2.3437
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MD03BD.html 0000664 0000000 0000000 00000123415 14560147231 0020331 0 ustar 00root root 0000000 0000000
Purpose
To minimize the sum of the squares of m nonlinear functions, e, in n variables, x, by a modification of the Levenberg-Marquardt algorithm. The user must provide a subroutine FCN which calculates the functions and the Jacobian (possibly by finite differences). In addition, specialized subroutines QRFACT, for QR factorization with pivoting of the Jacobian, and LMPARM, for the computation of Levenberg-Marquardt parameter, exploiting the possible structure of the Jacobian matrix, should be provided. Template implementations of these routines are included in SLICOT Library.Specification
SUBROUTINE MD03BD( XINIT, SCALE, COND, FCN, QRFACT, LMPARM, M, N, $ ITMAX, FACTOR, NPRINT, IPAR, LIPAR, DPAR1, $ LDPAR1, DPAR2, LDPAR2, X, DIAG, NFEV, NJEV, $ FTOL, XTOL, GTOL, TOL, IWORK, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER COND, SCALE, XINIT INTEGER INFO, ITMAX, IWARN, LDPAR1, LDPAR2, LDWORK, $ LIPAR, M, N, NFEV, NJEV, NPRINT DOUBLE PRECISION FACTOR, FTOL, GTOL, TOL, XTOL C .. Array Arguments .. INTEGER IPAR(*), IWORK(*) DOUBLE PRECISION DIAG(*), DPAR1(*), DPAR2(*), DWORK(*), X(*)Arguments
Mode Parameters
XINIT CHARACTER*1 Specifies how the variables x are initialized, as follows: = 'R' : the array X is initialized to random values; the entries DWORK(1:4) are used to initialize the random number generator: the first three values are converted to integers between 0 and 4095, and the last one is converted to an odd integer between 1 and 4095; = 'G' : the given entries of X are used as initial values of variables. SCALE CHARACTER*1 Specifies how the variables will be scaled, as follows: = 'I' : use internal scaling; = 'S' : use specified scaling factors, given in DIAG. COND CHARACTER*1 Specifies whether the condition of the linear systems involved should be estimated, as follows: = 'E' : use incremental condition estimation to find the numerical rank; = 'N' : do not use condition estimation, but check the diagonal entries of matrices for zero values.Function Parameters
FCN EXTERNAL Subroutine which evaluates the functions and the Jacobian. FCN must be declared in an external statement in the user calling program, and must have the following interface: SUBROUTINE FCN( IFLAG, M, N, IPAR, LIPAR, DPAR1, LDPAR1, $ DPAR2, LDPAR2, X, NFEVL, E, J, LDJ, DWORK, $ LDWORK, INFO ) where IFLAG (input/output) INTEGER On entry, this parameter must contain a value defining the computations to be performed: = 0 : Optionally, print the current iterate X, function values E, and Jacobian matrix J, or other results defined in terms of these values. See the argument NPRINT of MD03BD. Do not alter E and J. = 1 : Calculate the functions at X and return this vector in E. Do not alter J. = 2 : Calculate the Jacobian at X and return this matrix in J. Also return NFEVL (see below). Do not alter E. = 3 : Do not compute neither the functions nor the Jacobian, but return in LDJ and IPAR/DPAR1,DPAR2 (some of) the integer/real parameters needed. On exit, the value of this parameter should not be changed by FCN unless the user wants to terminate execution of MD03BD, in which case IFLAG must be set to a negative integer. M (input) INTEGER The number of functions. M >= 0. N (input) INTEGER The number of variables. M >= N >= 0. IPAR (input/output) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the Jacobian matrix or needed for problem solving. IPAR is an input parameter, except for IFLAG = 3 on entry, when it is also an output parameter. On exit, if IFLAG = 3, IPAR(1) contains the length of the array J, for storing the Jacobian matrix, and the entries IPAR(2:5) contain the workspace required by FCN for IFLAG = 1, FCN for IFLAG = 2, QRFACT, and LMPARM, respectively. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 5. DPAR1 (input/output) DOUBLE PRECISION array, dimension (LDPAR1,*) or (LDPAR1) A first set of real parameters needed for describing or solving the problem. DPAR1 can also be used as an additional array for intermediate results when computing the functions or the Jacobian. For control problems, DPAR1 could store the input trajectory of a system. LDPAR1 (input) INTEGER The leading dimension or the length of the array DPAR1, as convenient. LDPAR1 >= 0. (LDPAR1 >= 1, if leading dimension.) DPAR2 (input/output) DOUBLE PRECISION array, dimension (LDPAR2,*) or (LDPAR2) A second set of real parameters needed for describing or solving the problem. DPAR2 can also be used as an additional array for intermediate results when computing the functions or the Jacobian. For control problems, DPAR2 could store the output trajectory of a system. LDPAR2 (input) INTEGER The leading dimension or the length of the array DPAR2, as convenient. LDPAR2 >= 0. (LDPAR2 >= 1, if leading dimension.) X (input) DOUBLE PRECISION array, dimension (N) This array must contain the value of the variables x where the functions or the Jacobian must be evaluated. NFEVL (input/output) INTEGER The number of function evaluations needed to compute the Jacobian by a finite difference approximation. NFEVL is an input parameter if IFLAG = 0, or an output parameter if IFLAG = 2. If the Jacobian is computed analytically, NFEVL should be set to a non-positive value. E (input/output) DOUBLE PRECISION array, dimension (M) This array contains the value of the (error) functions e evaluated at X. E is an input parameter if IFLAG = 0 or 2, or an output parameter if IFLAG = 1. J (input/output) DOUBLE PRECISION array, dimension (LDJ,NC), where NC is the number of columns needed. This array contains a possibly compressed representation of the Jacobian matrix evaluated at X. If full Jacobian is stored, then NC = N. J is an input parameter if IFLAG = 0, or an output parameter if IFLAG = 2. LDJ (input/output) INTEGER The leading dimension of array J. LDJ >= 1. LDJ is essentially used inside the routines FCN, QRFACT and LMPARM. LDJ is an input parameter, except for IFLAG = 3 on entry, when it is an output parameter. It is assumed in MD03BD that LDJ is not larger than needed. DWORK DOUBLE PRECISION array, dimension (LDWORK) The workspace array for subroutine FCN. On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK (input) INTEGER The size of the array DWORK (as large as needed in the subroutine FCN). LDWORK >= 1. INFO INTEGER Error indicator, set to a negative value if an input (scalar) argument is erroneous, and to positive values for other possible errors in the subroutine FCN. The LAPACK Library routine XERBLA should be used in conjunction with negative INFO. INFO must be zero if the subroutine finished successfully. Parameters marked with "(input)" must not be changed. QRFACT EXTERNAL Subroutine which computes the QR factorization with (block) column pivoting of the Jacobian matrix, J*P = Q*R. QRFACT must be declared in an external statement in the calling program, and must have the following interface: SUBROUTINE QRFACT( N, IPAR, LIPAR, FNORM, J, LDJ, E, $ JNORMS, GNORM, IPVT, DWORK, LDWORK, $ INFO ) where N (input) INTEGER The number of columns of the Jacobian matrix J. N >= 0. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the Jacobian matrix. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 0. FNORM (input) DOUBLE PRECISION The Euclidean norm of the vector e. FNORM >= 0. J (input/output) DOUBLE PRECISION array, dimension (LDJ, NC), where NC is the number of columns. On entry, the leading NR-by-NC part of this array must contain the (compressed) representation of the Jacobian matrix J, where NR is the number of rows of J (function of IPAR entries). On exit, the leading N-by-NC part of this array contains a (compressed) representation of the upper triangular factor R of the Jacobian matrix. For efficiency of the later calculations, the matrix R is delivered with the leading dimension MAX(1,N), possibly much smaller than the value of LDJ on entry. LDJ (input/output) INTEGER The leading dimension of array J. On entry, LDJ >= MAX(1,NR). On exit, LDJ >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (NR) On entry, this array contains the error vector e. On exit, this array contains the updated vector Z*Q'*e, where Z is a block row permutation matrix (possibly identity) used in the QR factorization of J. (See, for example, the SLICOT Library routine NF01BS, Section METHOD.) JNORMS (output) DOUBLE PRECISION array, dimension (N) This array contains the Euclidean norms of the columns of the Jacobian matrix (in the original order). GNORM (output) DOUBLE PRECISION If FNORM > 0, the 1-norm of the scaled vector J'*e/FNORM, with each element i further divided by JNORMS(i) (if JNORMS(i) is nonzero). If FNORM = 0, the returned value of GNORM is 0. IPVT (output) INTEGER array, dimension (N) This array defines the permutation matrix P such that J*P = Q*R. Column j of P is column IPVT(j) of the identity matrix. DWORK DOUBLE PRECISION array, dimension (LDWORK) The workspace array for subroutine QRFACT. On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK (input) INTEGER The size of the array DWORK (as large as needed in the subroutine QRFACT). LDWORK >= 1. INFO INTEGER Error indicator, set to a negative value if an input (scalar) argument is erroneous, and to positive values for other possible errors in the subroutine QRFACT. The LAPACK Library routine XERBLA should be used in conjunction with negative INFO. INFO must be zero if the subroutine finished successfully. Parameters marked with "(input)" must not be changed. LMPARM EXTERNAL Subroutine which determines a value for the Levenberg- Marquardt parameter PAR such that if x solves the system J*x = b , sqrt(PAR)*D*x = 0 , in the least squares sense, where J is an m-by-n matrix, D is an n-by-n nonsingular diagonal matrix, and b is an m-vector, and if DELTA is a positive number, DXNORM is the Euclidean norm of D*x, then either PAR is zero and ( DXNORM - DELTA ) .LE. 0.1*DELTA , or PAR is positive and ABS( DXNORM - DELTA ) .LE. 0.1*DELTA . It is assumed that a block QR factorization, with column pivoting, of J is available, that is, J*P = Q*R, where P is a permutation matrix, Q has orthogonal columns, and R is an upper triangular matrix (possibly stored in a compressed form), with diagonal elements of nonincreasing magnitude for each block. On output, LMPARM also provides a (compressed) representation of an upper triangular matrix S, such that P'*(J'*J + PAR*D*D)*P = S'*S . LMPARM must be declared in an external statement in the calling program, and must have the following interface: SUBROUTINE LMPARM( COND, N, IPAR, LIPAR, R, LDR, IPVT, $ DIAG, QTB, DELTA, PAR, RANKS, X, RX, $ TOL, DWORK, LDWORK, INFO ) where COND CHARACTER*1 Specifies whether the condition of the linear systems involved should be estimated, as follows: = 'E' : use incremental condition estimation to find the numerical rank; = 'N' : do not use condition estimation, but check the diagonal entries for zero values; = 'U' : use the ranks already stored in RANKS (for R). N (input) INTEGER The order of the matrix R. N >= 0. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the Jacobian matrix. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 0. R (input/output) DOUBLE PRECISION array, dimension (LDR, NC), where NC is the number of columns. On entry, the leading N-by-NC part of this array must contain the (compressed) representation (Rc) of the upper triangular matrix R. On exit, the full upper triangular part of R (in representation Rc), is unaltered, and the remaining part contains (part of) the (compressed) representation of the transpose of the upper triangular matrix S. LDR (input) INTEGER The leading dimension of array R. LDR >= MAX(1,N). IPVT (input) INTEGER array, dimension (N) This array must define the permutation matrix P such that J*P = Q*R. Column j of P is column IPVT(j) of the identity matrix. DIAG (input) DOUBLE PRECISION array, dimension (N) This array must contain the diagonal elements of the matrix D. DIAG(I) <> 0, I = 1,...,N. QTB (input) DOUBLE PRECISION array, dimension (N) This array must contain the first n elements of the vector Q'*b. DELTA (input) DOUBLE PRECISION An upper bound on the Euclidean norm of D*x. DELTA > 0. PAR (input/output) DOUBLE PRECISION On entry, PAR must contain an initial estimate of the Levenberg-Marquardt parameter. PAR >= 0. On exit, it contains the final estimate of this parameter. RANKS (input or output) INTEGER array, dimension (r), where r is the number of diagonal blocks R_k in R, corresponding to the block column structure of J. On entry, if COND = 'U' and N > 0, this array must contain the numerical ranks of the submatrices R_k, k = 1:r. The number r is defined in terms of the entries of IPAR. On exit, if N > 0, this array contains the numerical ranks of the submatrices S_k, k = 1:r. X (output) DOUBLE PRECISION array, dimension (N) This array contains the least squares solution of the system J*x = b, sqrt(PAR)*D*x = 0. RX (output) DOUBLE PRECISION array, dimension (N) This array contains the matrix-vector product -R*P'*x. TOL (input) DOUBLE PRECISION If COND = 'E', the tolerance to be used for finding the ranks of the submatrices R_k and S_k. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not relevant if COND = 'U' or 'N'. DWORK DOUBLE PRECISION array, dimension (LDWORK) The workspace array for subroutine LMPARM. On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK (input) INTEGER The size of the array DWORK (as large as needed in the subroutine LMPARM). LDWORK >= 1. INFO INTEGER Error indicator, set to a negative value if an input (scalar) argument is erroneous, and to positive values for other possible errors in the subroutine LMPARM. The LAPACK Library routine XERBLA should be used in conjunction with negative INFO. INFO must be zero if the subroutine finished successfully. Parameters marked with "(input)" must not be changed.Input/Output Parameters
M (input) INTEGER The number of functions. M >= 0. N (input) INTEGER The number of variables. M >= N >= 0. ITMAX (input) INTEGER The maximum number of iterations. ITMAX >= 0. FACTOR (input) DOUBLE PRECISION The value used in determining the initial step bound. This bound is set to the product of FACTOR and the Euclidean norm of DIAG*X if nonzero, or else to FACTOR itself. In most cases FACTOR should lie in the interval (.1,100). A generally recommended value is 100. FACTOR > 0. NPRINT (input) INTEGER This parameter enables controlled printing of iterates if it is positive. In this case, FCN is called with IFLAG = 0 at the beginning of the first iteration and every NPRINT iterations thereafter and immediately prior to return, with X, E, and J available for printing. Note that when called immediately prior to return, J normally contains the result returned by QRFACT and LMPARM (the compressed R and S factors). If NPRINT is not positive, no special calls of FCN with IFLAG = 0 are made. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters needed, for instance, for describing the structure of the Jacobian matrix, which are handed over to the routines FCN, QRFACT and LMPARM. The first five entries of this array are modified internally by a call to FCN (with IFLAG = 3), but are restored on exit. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 5. DPAR1 (input/output) DOUBLE PRECISION array, dimension (LDPAR1,*) or (LDPAR1) A first set of real parameters needed for describing or solving the problem. This argument is not used by MD03BD routine, but it is passed to the routine FCN. LDPAR1 (input) INTEGER The leading dimension or the length of the array DPAR1, as convenient. LDPAR1 >= 0. (LDPAR1 >= 1, if leading dimension.) DPAR2 (input/output) DOUBLE PRECISION array, dimension (LDPAR2,*) or (LDPAR2) A second set of real parameters needed for describing or solving the problem. This argument is not used by MD03BD routine, but it is passed to the routine FCN. LDPAR2 (input) INTEGER The leading dimension or the length of the array DPAR2, as convenient. LDPAR2 >= 0. (LDPAR2 >= 1, if leading dimension.) X (input/output) DOUBLE PRECISION array, dimension (N) On entry, if XINIT = 'G', this array must contain the vector of initial variables x to be optimized. If XINIT = 'R', this array need not be set before entry, and random values will be used to initialize x. On exit, if INFO = 0, this array contains the vector of values that (approximately) minimize the sum of squares of error functions. The values returned in IWARN and DWORK(1:4) give details on the iterative process. DIAG (input/output) DOUBLE PRECISION array, dimension (N) On entry, if SCALE = 'S', this array must contain some positive entries that serve as multiplicative scale factors for the variables x. DIAG(I) > 0, I = 1,...,N. If SCALE = 'I', DIAG is internally set. On exit, this array contains the scale factors used (or finally used, if SCALE = 'I'). NFEV (output) INTEGER The number of calls to FCN with IFLAG = 1. If FCN is properly implemented, this includes the function evaluations needed for finite difference approximation of the Jacobian. NJEV (output) INTEGER The number of calls to FCN with IFLAG = 2.Tolerances
FTOL DOUBLE PRECISION If FTOL >= 0, the tolerance which measures the relative error desired in the sum of squares. Termination occurs when both the actual and predicted relative reductions in the sum of squares are at most FTOL. If the user sets FTOL < 0, then SQRT(EPS) is used instead FTOL, where EPS is the machine precision (see LAPACK Library routine DLAMCH). XTOL DOUBLE PRECISION If XTOL >= 0, the tolerance which measures the relative error desired in the approximate solution. Termination occurs when the relative error between two consecutive iterates is at most XTOL. If the user sets XTOL < 0, then SQRT(EPS) is used instead XTOL. GTOL DOUBLE PRECISION If GTOL >= 0, the tolerance which measures the orthogonality desired between the function vector e and the columns of the Jacobian J. Termination occurs when the cosine of the angle between e and any column of the Jacobian J is at most GTOL in absolute value. If the user sets GTOL < 0, then EPS is used instead GTOL. TOL DOUBLE PRECISION If COND = 'E', the tolerance to be used for finding the ranks of the matrices of linear systems to be solved. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS, is used instead. This parameter is not relevant if COND = 'N'.Workspace
IWORK INTEGER array, dimension (N+r), where r is the number of diagonal blocks R_k in R (see description of LMPARM). On output, if INFO = 0, the first N entries of this array define a permutation matrix P such that J*P = Q*R, where J is the final calculated Jacobian, Q is an orthogonal matrix (not stored), and R is upper triangular with diagonal elements of nonincreasing magnitude (possibly for each block column of J). Column j of P is column IWORK(j) of the identity matrix. If INFO = 0, the entries N+1:N+r of this array contain the ranks of the final submatrices S_k (see description of LMPARM). DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, DWORK(2) returns the residual error norm (the sum of squares), DWORK(3) returns the number of iterations performed, and DWORK(4) returns the final Levenberg factor. If INFO = 0, N > 0, and IWARN >= 0, the elements DWORK(5) to DWORK(4+M) contain the final matrix-vector product Z*Q'*e, and the elements DWORK(5+M) to DWORK(4+M+N*NC) contain the (compressed) representation of final upper triangular matrices R and S (if IWARN <> 4). LDWORK INTEGER The length of the array DWORK. LDWORK >= max( 4, M + max( size(J) + max( DW( FCN|IFLAG = 1 ), DW( FCN|IFLAG = 2 ), DW( QRFACT ) + N ), N*NC + N + max( M + DW( FCN|IFLAG = 1 ), N + DW( LMPARM ) ) ) ), where size(J) is the size of the Jacobian (provided by FCN in IPAR(1), for IFLAG = 3), and DW( f ) is the workspace needed by the routine f, where f is FCN, QRFACT, or LMPARM (provided by FCN in IPAR(2:5), for IFLAG = 3).Warning Indicator
IWARN INTEGER < 0: the user set IFLAG = IWARN in the subroutine FCN; = 1: both actual and predicted relative reductions in the sum of squares are at most FTOL; = 2: relative error between two consecutive iterates is at most XTOL; = 3: conditions for IWARN = 1 and IWARN = 2 both hold; = 4: the cosine of the angle between e and any column of the Jacobian is at most GTOL in absolute value; = 5: the number of iterations has reached ITMAX without satisfying any convergence condition; = 6: FTOL is too small: no further reduction in the sum of squares is possible; = 7: XTOL is too small: no further improvement in the approximate solution x is possible; = 8: GTOL is too small: e is orthogonal to the columns of the Jacobian to machine precision. In all these cases, DWORK(1:4) are set as described above.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: user-defined routine FCN returned with INFO <> 0 for IFLAG = 1; = 2: user-defined routine FCN returned with INFO <> 0 for IFLAG = 2; = 3: user-defined routine QRFACT returned with INFO <> 0; = 4: user-defined routine LMPARM returned with INFO <> 0.Method
If XINIT = 'R', the initial value for x is set to a vector of pseudo-random values uniformly distributed in (-1,1). The Levenberg-Marquardt algorithm (described in [1,3]) is used for optimizing the variables x. This algorithm needs the Jacobian matrix J, which is provided by the subroutine FCN. A trust region method is used. The algorithm tries to update x by the formula x = x - p, using an approximate solution of the system of linear equations (J'*J + PAR*D*D)*p = J'*e, with e the error function vector, and D a diagonal nonsingular matrix, where either PAR = 0 and ( norm( D*x ) - DELTA ) <= 0.1*DELTA , or PAR > 0 and ABS( norm( D*x ) - DELTA ) <= 0.1*DELTA . DELTA is the radius of the trust region. If the Gauss-Newton direction is not acceptable, then an iterative algorithm obtains improved lower and upper bounds for the Levenberg-Marquardt parameter PAR. Only a few iterations are generally needed for convergence of the algorithm. The trust region radius DELTA and the Levenberg factor PAR are updated based on the ratio between the actual and predicted reduction in the sum of squares.References
[1] More, J.J., Garbow, B.S, and Hillstrom, K.E. User's Guide for MINPACK-1. Applied Math. Division, Argonne National Laboratory, Argonne, Illinois, Report ANL-80-74, 1980. [2] Golub, G.H. and van Loan, C.F. Matrix Computations. Third Edition. M. D. Johns Hopkins University Press, Baltimore, pp. 520-528, 1996. [3] More, J.J. The Levenberg-Marquardt algorithm: implementation and theory. In Watson, G.A. (Ed.), Numerical Analysis, Lecture Notes in Mathematics, vol. 630, Springer-Verlag, Berlin, Heidelberg and New York, pp. 105-116, 1978.Numerical Aspects
The Levenberg-Marquardt algorithm described in [3] is scaling invariant and globally convergent to (maybe local) minima. The convergence rate near a local minimum is quadratic, if the Jacobian is computed analytically, and linear, if the Jacobian is computed numerically.Further Comments
This routine is a more general version of the subroutines LMDER and LMDER1 from the MINPACK package [1], which enables to exploit the structure of the problem, and optionally use condition estimation. Unstructured problems could be solved as well. Template SLICOT Library implementations for FCN, QRFACT and LMPARM routines are: MD03BF, MD03BA, and MD03BB, respectively, for standard problems; NF01BF, NF01BS, and NF01BP, respectively, for optimizing the parameters of Wiener systems (structured problems).Example
Program Text
* MD03BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER LDWORK PARAMETER ( LDWORK = MMAX + $ MAX( MMAX*NMAX + 5*NMAX + 1, $ NMAX*NMAX + NMAX + $ MAX( MMAX, 5*NMAX ) ) ) * .. Local Scalars .. CHARACTER*1 COND, SCALE, XINIT INTEGER I, INFO, ITMAX, IWARN, LDPAR1, LDPAR2, LIPAR, M, $ N, NFEV, NJEV, NPRINT DOUBLE PRECISION FACTOR, FTOL, GTOL, TOL, XTOL * .. Array Arguments .. INTEGER IPAR(5), IWORK(NMAX+1) DOUBLE PRECISION DIAG(NMAX), DPAR1(1), DPAR2(1), DWORK(LDWORK), $ X(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL MD03BA, MD03BB, MD03BD, MD03BF * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, ITMAX, LIPAR, LDPAR1, LDPAR2, FACTOR, $ NPRINT, FTOL, XTOL, GTOL, TOL, XINIT, SCALE, $ COND IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE IF( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE IF ( LSAME( SCALE, 'S' ) ) $ READ ( NIN, FMT = * ) ( DIAG(I), I = 1,N ) IF ( LSAME( XINIT, 'G' ) ) $ READ ( NIN, FMT = * ) ( X(I), I = 1,N ) * Solve a standard nonlinear least squares problem. IPAR(1) = M CALL MD03BD( XINIT, SCALE, COND, MD03BF, MD03BA, MD03BB, $ M, N, ITMAX, FACTOR, NPRINT, IPAR, LIPAR, $ DPAR1, LDPAR1, DPAR2, LDPAR2, X, DIAG, NFEV, $ NJEV, FTOL, XTOL, GTOL, TOL, IWORK, DWORK, $ LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( IWARN.NE.0) WRITE ( NOUT, FMT = 99991 ) IWARN WRITE ( NOUT, FMT = 99997 ) DWORK(2) WRITE ( NOUT, FMT = 99996 ) NFEV, NJEV WRITE ( NOUT, FMT = 99994 ) WRITE ( NOUT, FMT = 99995 ) ( X(I), I = 1, N ) END IF END IF END IF STOP * 99999 FORMAT (' MD03BD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from MD03BD = ',I2) 99997 FORMAT (/' Final 2-norm of the residuals = ',D15.7) 99996 FORMAT (/' The number of function and Jacobian evaluations = ', $ 2I7) 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' Final approximate solution is ' ) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (' IWARN on exit from MD03BD = ',I2) END C SUBROUTINE MD03BF( IFLAG, M, N, IPAR, LIPAR, DPAR1, LDPAR1, DPAR2, $ LDPAR2, X, NFEVL, E, J, LDJ, DWORK, LDWORK, $ INFO ) C C This is the FCN routine for solving a standard nonlinear least C squares problem using SLICOT Library routine MD03BD. See the C argument FCN in the routine MD03BD for the description of C parameters. C C The example programmed in this routine is adapted from that C accompanying the MINPACK routine LMDER. C C ****************************************************************** C C .. Parameters .. C .. NOUT is the unit number for printing intermediate results .. INTEGER NOUT PARAMETER ( NOUT = 6 ) DOUBLE PRECISION ONE PARAMETER ( ONE = 1.0D0 ) C .. Scalar Arguments .. INTEGER IFLAG, INFO, LDJ, LDPAR1, LDPAR2, LDWORK, LIPAR, $ M, N, NFEVL C .. Array Arguments .. INTEGER IPAR(*) DOUBLE PRECISION DPAR1(*), DPAR2(*), DWORK(*), E(*), J(LDJ,*), $ X(*) C .. Local Scalars .. INTEGER I DOUBLE PRECISION ERR, TMP1, TMP2, TMP3, TMP4 C .. External Functions .. DOUBLE PRECISION DNRM2 EXTERNAL DNRM2 C .. External Subroutines .. EXTERNAL MD03BA, MD03BB C .. DATA Statements .. DOUBLE PRECISION Y(15) DATA Y(1), Y(2), Y(3), Y(4), Y(5), Y(6), Y(7), Y(8), $ Y(9), Y(10), Y(11), Y(12), Y(13), Y(14), Y(15) $ / 1.4D-1, 1.8D-1, 2.2D-1, 2.5D-1, 2.9D-1, $ 3.2D-1, 3.5D-1, 3.9D-1, 3.7D-1, 5.8D-1, $ 7.3D-1, 9.6D-1, 1.34D0, 2.1D0, 4.39D0 / C C .. Executable Statements .. C INFO = 0 IF ( IFLAG.EQ.1 ) THEN C C Compute the error function values. C DO 10 I = 1, 15 TMP1 = I TMP2 = 16 - I IF ( I.GT.8 ) THEN TMP3 = TMP2 ELSE TMP3 = TMP1 END IF E(I) = Y(I) - ( X(1) + TMP1/( X(2)*TMP2 + X(3)*TMP3 ) ) 10 CONTINUE C ELSE IF ( IFLAG.EQ.2 ) THEN C C Compute the Jacobian. C DO 30 I = 1, 15 TMP1 = I TMP2 = 16 - I IF ( I.GT.8 ) THEN TMP3 = TMP2 ELSE TMP3 = TMP1 END IF TMP4 = ( X(2)*TMP2 + X(3)*TMP3 )**2 J(I,1) = -ONE J(I,2) = TMP1*TMP2/TMP4 J(I,3) = TMP1*TMP3/TMP4 30 CONTINUE C NFEVL = 0 C ELSE IF ( IFLAG.EQ.3 ) THEN C C Set the parameter LDJ, the length of the array J, and the sizes C of the workspace for MD03BF (IFLAG = 1 or 2), MD03BA and MD03BB. C LDJ = M IPAR(1) = M*N IPAR(2) = 0 IPAR(3) = 0 IPAR(4) = 4*N + 1 IPAR(5) = 4*N ELSE IF ( IFLAG.EQ.0 ) THEN C C Special call for printing intermediate results. C ERR = DNRM2( M, E, 1 ) WRITE( NOUT, '('' Norm of current error = '', D15.6)') ERR C END IF C RETURN C C *** Last line of MD03BF *** END C SUBROUTINE MD03BA( N, IPAR, LIPAR, FNORM, J, LDJ, E, JNORMS, $ GNORM, IPVT, DWORK, LDWORK, INFO ) C C This is the QRFACT routine for solving a standard nonlinear least C squares problem using SLICOT Library routine MD03BD. See the C argument QRFACT in the routine MD03BD for the description of C parameters. C C For efficiency, the arguments are not checked. This is done in C the routine MD03BX (except for LIPAR). C C ****************************************************************** C C .. Scalar Arguments .. INTEGER INFO, LDJ, LDWORK, LIPAR, N DOUBLE PRECISION FNORM, GNORM C .. Array Arguments .. INTEGER IPAR(*), IPVT(*) DOUBLE PRECISION DWORK(*), E(*), J(LDJ,*), JNORMS(*) C .. External Subroutines .. EXTERNAL MD03BX C .. C .. Executable Statements .. C CALL MD03BX( IPAR(1), N, FNORM, J, LDJ, E, JNORMS, GNORM, IPVT, $ DWORK, LDWORK, INFO ) RETURN C C *** Last line of MD03BA *** END C SUBROUTINE MD03BB( COND, N, IPAR, LIPAR, R, LDR, IPVT, DIAG, QTB, $ DELTA, PAR, RANKS, X, RX, TOL, DWORK, LDWORK, $ INFO ) C C This is the LMPARM routine for solving a standard nonlinear least C squares problem using SLICOT Library routine MD03BD. See the C argument LMPARM in the routine MD03BD for the description of C parameters. C C For efficiency, the arguments are not checked. This is done in C the routine MD03BY (except for LIPAR). C C ****************************************************************** C C .. Scalar Arguments .. CHARACTER COND INTEGER INFO, LDR, LDWORK, LIPAR, N DOUBLE PRECISION DELTA, PAR, TOL C .. Array Arguments .. INTEGER IPAR(*), IPVT(*), RANKS(*) DOUBLE PRECISION DIAG(*), DWORK(*), QTB(*), R(LDR,*), RX(*), X(*) C .. External Subroutines .. EXTERNAL MD03BY C .. C .. Executable Statements .. C CALL MD03BY( COND, N, R, LDR, IPVT, DIAG, QTB, DELTA, PAR, $ RANKS(1), X, RX, TOL, DWORK, LDWORK, INFO ) RETURN C C *** Last line of MD03BB *** ENDProgram Data
MD03BD EXAMPLE PROGRAM DATA 15 3 100 5 0 0 1.D2 0 -1. -1. -1. -1. G I E 1.0 1.0 1.0Program Results
MD03BD EXAMPLE PROGRAM RESULTS IWARN on exit from MD03BD = 1 Final 2-norm of the residuals = 0.9063596D-01 The number of function and Jacobian evaluations = 6 5 Final approximate solution is 0.0824 1.1330 2.3437
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/MD03BX.html 0000664 0000000 0000000 00000010717 14560147231 0020355 0 ustar 00root root 0000000 0000000
Purpose
To compute the QR factorization with column pivoting of an m-by-n matrix J (m >= n), that is, J*P = Q*R, where Q is a matrix with orthogonal columns, P a permutation matrix, and R an upper trapezoidal matrix with diagonal elements of nonincreasing magnitude, and to apply the transformation Q' on the error vector e (in-situ). The 1-norm of the scaled gradient is also returned. The matrix J could be the Jacobian of a nonlinear least squares problem.Specification
SUBROUTINE MD03BX( M, N, FNORM, J, LDJ, E, JNORMS, GNORM, IPVT, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDJ, LDWORK, M, N DOUBLE PRECISION FNORM, GNORM C .. Array Arguments .. INTEGER IPVT(*) DOUBLE PRECISION DWORK(*), E(*), J(*), JNORMS(*)Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the Jacobian matrix J. M >= 0. N (input) INTEGER The number of columns of the Jacobian matrix J. M >= N >= 0. FNORM (input) DOUBLE PRECISION The Euclidean norm of the vector e. FNORM >= 0. J (input/output) DOUBLE PRECISION array, dimension (LDJ, N) On entry, the leading M-by-N part of this array must contain the Jacobian matrix J. On exit, the leading N-by-N upper triangular part of this array contains the upper triangular factor R of the Jacobian matrix. Note that for efficiency of the later calculations, the matrix R is delivered with the leading dimension MAX(1,N), possibly much smaller than the value of LDJ on entry. LDJ (input/output) INTEGER The leading dimension of array J. On entry, LDJ >= MAX(1,M). On exit, LDJ >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (M) On entry, this array must contain the error vector e. On exit, this array contains the updated vector Q'*e. JNORMS (output) DOUBLE PRECISION array, dimension (N) This array contains the Euclidean norms of the columns of the Jacobian matrix, considered in the initial order. GNORM (output) DOUBLE PRECISION If FNORM > 0, the 1-norm of the scaled vector J'*Q'*e/FNORM, with each element i further divided by JNORMS(i) (if JNORMS(i) is nonzero). If FNORM = 0, the returned value of GNORM is 0. IPVT (output) INTEGER array, dimension (N) This array defines the permutation matrix P such that J*P = Q*R. Column j of P is column IPVT(j) of the identity matrix.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if N = 0 or M = 1; LDWORK >= 4*N+1, if N > 1. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The algorithm uses QR factorization with column pivoting of the matrix J, J*P = Q*R, and applies the orthogonal matrix Q' to the vector e.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To determine a value for the parameter PAR such that if x solves the system A*x = b , sqrt(PAR)*D*x = 0 , in the least squares sense, where A is an m-by-n matrix, D is an n-by-n nonsingular diagonal matrix, and b is an m-vector, and if DELTA is a positive number, DXNORM is the Euclidean norm of D*x, then either PAR is zero and ( DXNORM - DELTA ) .LE. 0.1*DELTA , or PAR is positive and ABS( DXNORM - DELTA ) .LE. 0.1*DELTA . It is assumed that a QR factorization, with column pivoting, of A is available, that is, A*P = Q*R, where P is a permutation matrix, Q has orthogonal columns, and R is an upper triangular matrix with diagonal elements of nonincreasing magnitude. The routine needs the full upper triangle of R, the permutation matrix P, and the first n components of Q'*b (' denotes the transpose). On output, MD03BY also provides an upper triangular matrix S such that P'*(A'*A + PAR*D*D)*P = S'*S . Matrix S is used in the solution process.Specification
SUBROUTINE MD03BY( COND, N, R, LDR, IPVT, DIAG, QTB, DELTA, PAR, $ RANK, X, RX, TOL, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COND INTEGER INFO, LDR, LDWORK, N, RANK DOUBLE PRECISION DELTA, PAR, TOL C .. Array Arguments .. INTEGER IPVT(*) DOUBLE PRECISION DIAG(*), DWORK(*), QTB(*), R(LDR,*), RX(*), X(*)Arguments
Mode Parameters
COND CHARACTER*1 Specifies whether the condition of the matrices R and S should be estimated, as follows: = 'E' : use incremental condition estimation for R and S; = 'N' : do not use condition estimation, but check the diagonal entries of R and S for zero values; = 'U' : use the rank already stored in RANK (for R).Input/Output Parameters
N (input) INTEGER The order of the matrix R. N >= 0. R (input/output) DOUBLE PRECISION array, dimension (LDR, N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix R. On exit, the full upper triangle is unaltered, and the strict lower triangle contains the strict upper triangle (transposed) of the upper triangular matrix S. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). IPVT (input) INTEGER array, dimension (N) This array must define the permutation matrix P such that A*P = Q*R. Column j of P is column IPVT(j) of the identity matrix. DIAG (input) DOUBLE PRECISION array, dimension (N) This array must contain the diagonal elements of the matrix D. DIAG(I) <> 0, I = 1,...,N. QTB (input) DOUBLE PRECISION array, dimension (N) This array must contain the first n elements of the vector Q'*b. DELTA (input) DOUBLE PRECISION An upper bound on the Euclidean norm of D*x. DELTA > 0. PAR (input/output) DOUBLE PRECISION On entry, PAR must contain an initial estimate of the Levenberg-Marquardt parameter. PAR >= 0. On exit, it contains the final estimate of this parameter. RANK (input or output) INTEGER On entry, if COND = 'U', this parameter must contain the (numerical) rank of the matrix R. On exit, this parameter contains the numerical rank of the matrix S. X (output) DOUBLE PRECISION array, dimension (N) This array contains the least squares solution of the system A*x = b, sqrt(PAR)*D*x = 0. RX (output) DOUBLE PRECISION array, dimension (N) This array contains the matrix-vector product -R*P'*x.Tolerances
TOL DOUBLE PRECISION If COND = 'E', the tolerance to be used for finding the rank of the matrices R and S. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not relevant if COND = 'U' or 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, the first N elements of this array contain the diagonal elements of the upper triangular matrix S. LDWORK INTEGER The length of the array DWORK. LDWORK >= 4*N, if COND = 'E'; LDWORK >= 2*N, if COND <> 'E'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The algorithm computes the Gauss-Newton direction. A least squares solution is found if the Jacobian is rank deficient. If the Gauss- Newton direction is not acceptable, then an iterative algorithm obtains improved lower and upper bounds for the parameter PAR. Only a few iterations are generally needed for convergence of the algorithm. If, however, the limit of ITMAX = 10 iterations is reached, then the output PAR will contain the best value obtained so far. If the Gauss-Newton step is acceptable, it is stored in x, and PAR is set to zero, hence S = R.References
[1] More, J.J., Garbow, B.S, and Hillstrom, K.E. User's Guide for MINPACK-1. Applied Math. Division, Argonne National Laboratory, Argonne, Illinois, Report ANL-80-74, 1980.Numerical Aspects
2 The algorithm requires 0(N ) operations and is backward stable.Further Comments
This routine is a LAPACK-based modification of LMPAR from the MINPACK package [1], and with optional condition estimation. The option COND = 'U' is useful when dealing with several right-hand side vectors, but RANK should be reset. If COND = 'E', but the matrix S is guaranteed to be nonsingular and well conditioned relative to TOL, i.e., rank(R) = N, and min(DIAG) > 0, then its condition is not estimated.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To calculate the output y of the Wiener system x(t+1) = A*x(t) + B*u(t) z(t) = C*x(t) + D*u(t), y(t) = f(z(t),wb(1:L)), where t = 1, 2, ..., NSMP, and f is a nonlinear function, evaluated by the SLICOT Library routine NF01AY. The parameter vector X is partitioned as X = ( wb(1), ..., wb(L), theta ), where wb(i), i = 1:L, correspond to the nonlinear part, theta corresponds to the linear part, and the notation is fully described below.Specification
SUBROUTINE NF01AD( NSMP, M, L, IPAR, LIPAR, X, LX, U, LDU, Y, LDY, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDU, LDWORK, LDY, LX, LIPAR, M, NSMP C .. Array Arguments .. INTEGER IPAR(*) DOUBLE PRECISION DWORK(*), U(LDU,*), X(*), Y(LDY,*)Arguments
Input/Output Parameters
NSMP (input) INTEGER The number of training samples. NSMP >= 0. M (input) INTEGER The length of each input sample. M >= 0. L (input) INTEGER The length of each output sample. L >= 0. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters needed. IPAR(1) must contain the order of the linear part, referred to as N below. N >= 0. IPAR(2) must contain the number of neurons for the nonlinear part, referred to as NN below. NN >= 0. LIPAR (input) INTEGER The length of IPAR. LIPAR >= 2. X (input) DOUBLE PRECISION array, dimension (LX) The parameter vector, partitioned as X = (wb(1), ..., wb(L), theta), where the vectors wb(i), of length NN*(L+2)+1, are parameters for the static nonlinearity, which is simulated by the SLICOT Library routine NF01AY. See the documentation of NF01AY for further details. The vector theta, of length N*(M + L + 1) + L*M, represents the matrices A, B, C, D and x(1), and it can be retrieved from these matrices by SLICOT Library routine TB01VD and retranslated by TB01VY. LX (input) INTEGER The length of the array X. LX >= ( NN*(L+2)+1 )*L + N*(M + L + 1) + L*M. U (input) DOUBLE PRECISION array, dimension (LDU, M) The leading NSMP-by-M part of this array must contain the set of input samples, U = ( U(1,1),...,U(1,M); ...; U(NSMP,1),...,U(NSMP,M) ). LDU INTEGER The leading dimension of the array U. LDU >= MAX(1,NSMP). Y (output) DOUBLE PRECISION array, dimension (LDY, L) The leading NSMP-by-L part of this array contains the simulated output. LDY INTEGER The leading dimension of the array Y. LDY >= MAX(1,NSMP).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= NSMP*L + MAX( 2*NN, (N + L)*(N + M) + 2*N + MAX( N*(N + L), N + M + L ) ) if M > 0; LDWORK >= NSMP*L + MAX( 2*NN, (N + L)*N + 2*N + MAX( N*(N + L), L ) ), if M = 0. A larger value of LDWORK could improve the efficiency.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
BLAS routines are used for the matrix-vector multiplications and the routine NF01AY is called for the calculation of the nonlinear function.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To calculate the output of a set of neural networks with the structure - tanh(w1'*z+b1) - / : \ z --- : --- sum(ws(i)*...)+ b(n+1) --- y, \ : / - tanh(wn'*z+bn) - given the input z and the parameter vectors wi, ws, and b, where z, w1, ..., wn are vectors of length NZ, ws is a vector of length n, b(1), ..., b(n+1) are scalars, and n is called the number of neurons in the hidden layer, or just number of neurons. Such a network is used for each L output variables.Specification
SUBROUTINE NF01AY( NSMP, NZ, L, IPAR, LIPAR, WB, LWB, Z, LDZ, $ Y, LDY, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDWORK, LDY, LDZ, LIPAR, LWB, NSMP, NZ C .. Array Arguments .. DOUBLE PRECISION DWORK(*), WB(*), Y(LDY,*), Z(LDZ,*) INTEGER IPAR(*)Arguments
Input/Output Parameters
NSMP (input) INTEGER The number of training samples. NSMP >= 0. NZ (input) INTEGER The length of each input sample. NZ >= 0. L (input) INTEGER The length of each output sample. L >= 0. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters needed. IPAR(1) must contain the number of neurons, n, per output variable, denoted NN in the sequel. NN >= 0. LIPAR (input) INTEGER The length of the vector IPAR. LIPAR >= 1. WB (input) DOUBLE PRECISION array, dimension (LWB) The leading (NN*(NZ+2)+1)*L part of this array must contain the weights and biases of the network. This vector is partitioned into L vectors of length NN*(NZ+2)+1, WB = [ wb(1), ..., wb(L) ]. Each wb(k), k = 1, ..., L, corresponds to one output variable, and has the structure wb(k) = [ w1(1), ..., w1(NZ), ..., wn(1), ..., wn(NZ), ws(1), ..., ws(n), b(1), ..., b(n+1) ], where wi(j) are the weights of the hidden layer, ws(i) are the weights of the linear output layer, and b(i) are the biases, as in the scheme above. LWB (input) INTEGER The length of the array WB. LWB >= ( NN*(NZ + 2) + 1 )*L. Z (input) DOUBLE PRECISION array, dimension (LDZ, NZ) The leading NSMP-by-NZ part of this array must contain the set of input samples, Z = ( Z(1,1),...,Z(1,NZ); ...; Z(NSMP,1),...,Z(NSMP,NZ) ). LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,NSMP). Y (output) DOUBLE PRECISION array, dimension (LDY, L) The leading NSMP-by-L part of this array contains the set of output samples, Y = ( Y(1,1),...,Y(1,L); ...; Y(NSMP,1),...,Y(NSMP,L) ). LDY INTEGER The leading dimension of the array Y. LDY >= MAX(1,NSMP).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*NN. For better performance, LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
BLAS routines are used to compute the matrix-vector products.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To calculate the Jacobian dy/dX of the Wiener system x(t+1) = A*x(t) + B*u(t) z(t) = C*x(t) + D*u(t), y(t,i) = sum( ws(k, i)*f(w(k, i)*z(t) + b(k,i)) ) + b(k+1,i), where t = 1, 2, ..., NSMP, i = 1, 2, ..., L, k = 1, 2, ..., NN. NN is arbitrary eligible and has to be provided in IPAR(2), and X = ( wb(1), ..., wb(L), theta ) is described below. Denoting y(j) = y(1:NSMP,j), the Jacobian J has the block form dy(1)/dwb(1) 0 ..... 0 dy(1)/dtheta 0 dy(2)/dwb(2) ..... 0 dy(2)/dtheta ..... ..... ..... ..... ..... 0 ..... 0 dy(L)/dwb(L) dy(L)/dtheta but it will be returned without the zero blocks, in the form dy(1)/dwb(1) dy(1)/dtheta ... dy(L)/dwb(L) dy(L)/dtheta. dy(i)/dwb(i) depends on f and is calculated by the routine NF01BY; dy(i)/dtheta is computed by a forward-difference approximation.Specification
SUBROUTINE NF01BD( CJTE, NSMP, M, L, IPAR, LIPAR, X, LX, U, LDU, $ E, J, LDJ, JTE, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER CJTE INTEGER INFO, L, LDJ, LDU, LDWORK, LX, LIPAR, M, NSMP C .. Array Arguments .. INTEGER IPAR(*) DOUBLE PRECISION DWORK(*), E(*), J(LDJ, *), JTE(*), U(LDU,*), $ X(*)Arguments
Mode Parameters
CJTE CHARACTER*1 Specifies whether the matrix-vector product J'*e should be computed or not, as follows: = 'C' : compute J'*e; = 'N' : do not compute J'*e.Input/Output Parameters
NSMP (input) INTEGER The number of training samples. NSMP >= 0. M (input) INTEGER The length of each input sample. M >= 0. L (input) INTEGER The length of each output sample. L >= 0. IPAR (input/output) INTEGER array, dimension (LIPAR) On entry, the first entries of this array must contain the integer parameters needed; specifically, IPAR(1) must contain the order of the linear part, N; actually, N = abs(IPAR(1)), since setting IPAR(1) < 0 has a special meaning (see below); IPAR(2) must contain the number of neurons for the nonlinear part, NN, NN >= 0. On exit, if IPAR(1) < 0 on entry, then no computations are performed, except the needed tests on input parameters, but the following values are returned: IPAR(1) contains the length of the array J, LJ; LDJ contains the leading dimension of array J. Otherwise, IPAR(1) and LDJ are unchanged on exit. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 2. X (input) DOUBLE PRECISION array, dimension (LX) The leading LPAR entries of this array must contain the set of system parameters, where LPAR = (NN*(L + 2) + 1)*L + N*(M + L + 1) + L*M. X has the form (wb(1), ..., wb(L), theta), where the vectors wb(i) have the structure (w(1,1), ..., w(1,L), ..., w(NN,1), ..., w(NN,L), ws(1), ..., ws(NN), b(1), ..., b(NN+1) ), and the vector theta represents the matrices A, B, C, D and x(1), and it can be retrieved from these matrices by SLICOT Library routine TB01VD and retranslated by TB01VY. LX (input) INTEGER The length of X. LX >= (NN*(L + 2) + 1)*L + N*(M + L + 1) + L*M. U (input) DOUBLE PRECISION array, dimension (LDU, M) The leading NSMP-by-M part of this array must contain the set of input samples, U = ( U(1,1),...,U(1,M); ...; U(NSMP,1),...,U(NSMP,M) ). LDU INTEGER The leading dimension of array U. LDU >= MAX(1,NSMP). E (input) DOUBLE PRECISION array, dimension (NSMP*L) If CJTE = 'C', this array must contain a vector e, which will be premultiplied with J', e = vec( Y - y ), where Y is set of output samples, and vec denotes the concatenation of the columns of a matrix. If CJTE = 'N', this array is not referenced. J (output) DOUBLE PRECISION array, dimension (LDJ, *) The leading NSMP*L-by-NCOLJ part of this array contains the Jacobian of the error function stored in a compressed form, as described above, where NCOLJ = NN*(L + 2) + 1 + N*(M + L + 1) + L*M. LDJ INTEGER The leading dimension of array J. LDJ >= MAX(1,NSMP*L). Note that LDJ is an input parameter, except for IPAR(1) < 0 on entry, when it is an output parameter. JTE (output) DOUBLE PRECISION array, dimension (LPAR) If CJTE = 'C', this array contains the matrix-vector product J'*e. If CJTE = 'N', this array is not referenced.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*NSMP*L + MAX( 2*NN, (N + L)*(N + M) + 2*N + MAX( N*(N + L), N + M + L ) ) if M > 0; LDWORK >= 2*NSMP*L + MAX( 2*NN, (N + L)*N + 2*N + MAX( N*(N + L), L ) ), if M = 0. A larger value of LDWORK could improve the efficiency.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
BLAS routines are used for the matrix-vector multiplications, and the SLICOT Library routine TB01VY is called for the conversion of the output normal form parameters to an LTI-system; the routine NF01AD is then used for the simulation of the system with given parameters, and the routine NF01BY is called for the (analytically performed) calculation of the parts referring to the parameters of the static nonlinearity.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To determine a value for the Levenberg-Marquardt parameter PAR such that if x solves the system J*x = b , sqrt(PAR)*D*x = 0 , in the least squares sense, where J is an m-by-n matrix, D is an n-by-n nonsingular diagonal matrix, and b is an m-vector, and if DELTA is a positive number, DXNORM is the Euclidean norm of D*x, then either PAR is zero and ( DXNORM - DELTA ) .LE. 0.1*DELTA , or PAR is positive and ABS( DXNORM - DELTA ) .LE. 0.1*DELTA . The matrix J is the current Jacobian matrix of a nonlinear least squares problem, provided in a compressed form by SLICOT Library routine NF01BD. It is assumed that a block QR factorization, with column pivoting, of J is available, that is, J*P = Q*R, where P is a permutation matrix, Q has orthogonal columns, and R is an upper triangular matrix with diagonal elements of nonincreasing magnitude for each block, as returned by SLICOT Library routine NF01BS. The routine NF01BP needs the upper triangle of R in compressed form, the permutation matrix P, and the first n components of Q'*b (' denotes the transpose). On output, NF01BP also provides a compressed representation of an upper triangular matrix S, such that P'*(J'*J + PAR*D*D)*P = S'*S . Matrix S is used in the solution process. The matrix R has the following structure / R_1 0 .. 0 | L_1 \ | 0 R_2 .. 0 | L_2 | | : : .. : | : | , | 0 0 .. R_l | L_l | \ 0 0 .. 0 | R_l+1 / where the submatrices R_k, k = 1:l, have the same order BSN, and R_k, k = 1:l+1, are square and upper triangular. This matrix is stored in the compressed form / R_1 | L_1 \ | R_2 | L_2 | Rc = | : | : | , | R_l | L_l | \ X | R_l+1 / where the submatrix X is irrelevant. The matrix S has the same structure as R, and its diagonal blocks are denoted by S_k, k = 1:l+1. If l <= 1, then the full upper triangle of the matrix R is stored.Specification
SUBROUTINE NF01BP( COND, N, IPAR, LIPAR, R, LDR, IPVT, DIAG, QTB, $ DELTA, PAR, RANKS, X, RX, TOL, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER COND INTEGER INFO, LDR, LDWORK, LIPAR, N DOUBLE PRECISION DELTA, PAR, TOL C .. Array Arguments .. INTEGER IPAR(*), IPVT(*), RANKS(*) DOUBLE PRECISION DIAG(*), DWORK(*), QTB(*), R(LDR,*), RX(*), X(*)Arguments
Mode Parameters
COND CHARACTER*1 Specifies whether the condition of the diagonal blocks R_k and S_k of the matrices R and S should be estimated, as follows: = 'E' : use incremental condition estimation for each diagonal block of R_k and S_k to find its numerical rank; = 'N' : do not use condition estimation, but check the diagonal entries of R_k and S_k for zero values; = 'U' : use the ranks already stored in RANKS (for R).Input/Output Parameters
N (input) INTEGER The order of the matrix R. N = BN*BSN + ST >= 0. (See parameter description below.) IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix R, as follows: IPAR(1) must contain ST, the number of columns of the submatrices L_k and the order of R_l+1. ST >= 0. IPAR(2) must contain BN, the number of blocks, l, in the block diagonal part of R. BN >= 0. IPAR(3) must contain BSM, the number of rows of the blocks R_k, k = 1:l. BSM >= 0. IPAR(4) must contain BSN, the number of columns of the blocks R_k, k = 1:l. BSN >= 0. BSM is not used by this routine, but assumed equal to BSN. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 4. R (input/output) DOUBLE PRECISION array, dimension (LDR, NC) where NC = N if BN <= 1, and NC = BSN+ST, if BN > 1. On entry, the leading N-by-NC part of this array must contain the (compressed) representation (Rc) of the upper triangular matrix R. If BN > 1, the submatrix X in Rc is not referenced. The zero strict lower triangles of R_k, k = 1:l+1, need not be set. If BN <= 1 or BSN = 0, then the full upper triangle of R must be stored. On exit, the full upper triangles of R_k, k = 1:l+1, and L_k, k = 1:l, are unaltered, and the strict lower triangles of R_k, k = 1:l+1, contain the corresponding strict upper triangles (transposed) of the upper triangular matrix S. If BN <= 1 or BSN = 0, then the transpose of the strict upper triangle of S is stored in the strict lower triangle of R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). IPVT (input) INTEGER array, dimension (N) This array must define the permutation matrix P such that J*P = Q*R. Column j of P is column IPVT(j) of the identity matrix. DIAG (input) DOUBLE PRECISION array, dimension (N) This array must contain the diagonal elements of the matrix D. DIAG(I) <> 0, I = 1,...,N. QTB (input) DOUBLE PRECISION array, dimension (N) This array must contain the first n elements of the vector Q'*b. DELTA (input) DOUBLE PRECISION An upper bound on the Euclidean norm of D*x. DELTA > 0. PAR (input/output) DOUBLE PRECISION On entry, PAR must contain an initial estimate of the Levenberg-Marquardt parameter. PAR >= 0. On exit, it contains the final estimate of this parameter. RANKS (input or output) INTEGER array, dimension (r), where r = BN + 1, if ST > 0, BSN > 0, and BN > 1; r = BN, if ST = 0 and BSN > 0; r = 1, if ST > 0 and ( BSN = 0 or BN <= 1 ); r = 0, if ST = 0 and BSN = 0. On entry, if COND = 'U' and N > 0, this array must contain the numerical ranks of the submatrices R_k, k = 1:l(+1). On exit, if N > 0, this array contains the numerical ranks of the submatrices S_k, k = 1:l(+1). X (output) DOUBLE PRECISION array, dimension (N) This array contains the least squares solution of the system J*x = b, sqrt(PAR)*D*x = 0. RX (output) DOUBLE PRECISION array, dimension (N) This array contains the matrix-vector product -R*P'*x.Tolerances
TOL DOUBLE PRECISION If COND = 'E', the tolerance to be used for finding the ranks of the submatrices R_k and S_k. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not relevant if COND = 'U' or 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, the first N elements of this array contain the diagonal elements of the upper triangular matrix S. If BN > 1 and BSN > 0, the elements N+1 : N+ST*(N-ST) contain the submatrix (S(1:N-ST,N-ST+1:N))' of the matrix S. LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*N, if BN <= 1 or BSN = 0 and COND <> 'E'; LDWORK >= 4*N, if BN <= 1 or BSN = 0 and COND = 'E'; LDWORK >= ST*(N-ST) + 2*N, if BN > 1 and BSN > 0 and COND <> 'E'; LDWORK >= ST*(N-ST) + 2*N + 2*MAX(BSN,ST), if BN > 1 and BSN > 0 and COND = 'E'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The algorithm computes the Gauss-Newton direction. An approximate basic least squares solution is found if the Jacobian is rank deficient. The computations exploit the special structure and storage scheme of the matrix R. If one or more of the submatrices R_k or S_k, k = 1:l+1, is singular, then the computed result is not the basic least squares solution for the whole problem, but a concatenation of (least squares) solutions of the individual subproblems involving R_k or S_k, k = 1:l+1 (with adapted right hand sides). If the Gauss-Newton direction is not acceptable, then an iterative algorithm obtains improved lower and upper bounds for the Levenberg-Marquardt parameter PAR. Only a few iterations are generally needed for convergence of the algorithm. If, however, the limit of ITMAX = 10 iterations is reached, then the output PAR will contain the best value obtained so far. If the Gauss-Newton step is acceptable, it is stored in x, and PAR is set to zero, hence S = R.References
[1] More, J.J., Garbow, B.S, and Hillstrom, K.E. User's Guide for MINPACK-1. Applied Math. Division, Argonne National Laboratory, Argonne, Illinois, Report ANL-80-74, 1980.Numerical Aspects
The algorithm requires 0(N*(BSN+ST)) operations and is backward stable, if R is nonsingular.Further Comments
This routine is a structure-exploiting, LAPACK-based modification of LMPAR from the MINPACK package [1], and with optional condition estimation. The option COND = 'U' is useful when dealing with several right-hand side vectors, but RANKS array should be reset. If COND = 'E', but the matrix S is guaranteed to be nonsingular and well conditioned relative to TOL, i.e., rank(R) = N, and min(DIAG) > 0, then its condition is not estimated.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To determine a vector x which solves the system of linear equations J*x = b , D*x = 0 , in the least squares sense, where J is an m-by-n matrix, D is an n-by-n diagonal matrix, and b is an m-vector. The matrix J is the current Jacobian of a nonlinear least squares problem, provided in a compressed form by SLICOT Library routine NF01BD. It is assumed that a block QR factorization, with column pivoting, of J is available, that is, J*P = Q*R, where P is a permutation matrix, Q has orthogonal columns, and R is an upper triangular matrix with diagonal elements of nonincreasing magnitude for each block, as returned by SLICOT Library routine NF01BS. The routine NF01BQ needs the upper triangle of R in compressed form, the permutation matrix P, and the first n components of Q'*b (' denotes the transpose). The system J*x = b, D*x = 0, is then equivalent to R*z = Q'*b , P'*D*P*z = 0 , (1) where x = P*z. If this system does not have full rank, then an approximate least squares solution is obtained (see METHOD). On output, NF01BQ also provides an upper triangular matrix S such that P'*(J'*J + D*D)*P = S'*S . The system (1) is equivalent to S*z = c , where c contains the first n components of the vector obtained by applying to [ (Q'*b)' 0 ]' the transformations which triangularized [ R' P'*D*P ]', getting S. The matrix R has the following structure / R_1 0 .. 0 | L_1 \ | 0 R_2 .. 0 | L_2 | | : : .. : | : | , | 0 0 .. R_l | L_l | \ 0 0 .. 0 | R_l+1 / where the submatrices R_k, k = 1:l, have the same order BSN, and R_k, k = 1:l+1, are square and upper triangular. This matrix is stored in the compressed form / R_1 | L_1 \ | R_2 | L_2 | Rc = | : | : | , | R_l | L_l | \ X | R_l+1 / where the submatrix X is irrelevant. The matrix S has the same structure as R, and its diagonal blocks are denoted by S_k, k = 1:l+1. If l <= 1, then the full upper triangle of the matrix R is stored.Specification
SUBROUTINE NF01BQ( COND, N, IPAR, LIPAR, R, LDR, IPVT, DIAG, QTB, $ RANKS, X, TOL, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COND INTEGER INFO, LDR, LDWORK, LIPAR, N DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IPAR(*), IPVT(*), RANKS(*) DOUBLE PRECISION DIAG(*), DWORK(*), QTB(*), R(LDR,*), X(*)Arguments
Mode Parameters
COND CHARACTER*1 Specifies whether the condition of the matrices S_k should be estimated, as follows: = 'E' : use incremental condition estimation and store the numerical rank of S_k in the array entry RANKS(k), for k = 1:l+1; = 'N' : do not use condition estimation, but check the diagonal entries of S_k for zero values; = 'U' : use the ranks already stored in RANKS(1:l+1).Input/Output Parameters
N (input) INTEGER The order of the matrix R. N = BN*BSN + ST >= 0. (See parameter description below.) IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix R, as follows: IPAR(1) must contain ST, the number of columns of the submatrices L_k and the order of R_l+1. ST >= 0. IPAR(2) must contain BN, the number of blocks, l, in the block diagonal part of R. BN >= 0. IPAR(3) must contain BSM, the number of rows of the blocks R_k, k = 1:l. BSM >= 0. IPAR(4) must contain BSN, the number of columns of the blocks R_k, k = 1:l. BSN >= 0. BSM is not used by this routine, but assumed equal to BSN. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 4. R (input/output) DOUBLE PRECISION array, dimension (LDR, NC) where NC = N if BN <= 1, and NC = BSN+ST, if BN > 1. On entry, the leading N-by-NC part of this array must contain the (compressed) representation (Rc) of the upper triangular matrix R. If BN > 1, the submatrix X in Rc is not referenced. The zero strict lower triangles of R_k, k = 1:l+1, need not be set. If BN <= 1 or BSN = 0, then the full upper triangle of R must be stored. On exit, the full upper triangles of R_k, k = 1:l+1, and L_k, k = 1:l, are unaltered, and the strict lower triangles of R_k, k = 1:l+1, contain the corresponding strict upper triangles (transposed) of the upper triangular matrix S. If BN <= 1 or BSN = 0, then the transpose of the strict upper triangle of S is stored in the strict lower triangle of R. LDR INTEGER The leading dimension of the array R. LDR >= MAX(1,N). IPVT (input) INTEGER array, dimension (N) This array must define the permutation matrix P such that J*P = Q*R. Column j of P is column IPVT(j) of the identity matrix. DIAG (input) DOUBLE PRECISION array, dimension (N) This array must contain the diagonal elements of the matrix D. QTB (input) DOUBLE PRECISION array, dimension (N) This array must contain the first n elements of the vector Q'*b. RANKS (input or output) INTEGER array, dimension (r), where r = BN + 1, if ST > 0, BSN > 0, and BN > 1; r = BN, if ST = 0 and BSN > 0; r = 1, if ST > 0 and ( BSN = 0 or BN <= 1 ); r = 0, if ST = 0 and BSN = 0. On entry, if COND = 'U' and N > 0, this array must contain the numerical ranks of the submatrices S_k, k = 1:l(+1). On exit, if COND = 'E' or 'N' and N > 0, this array contains the numerical ranks of the submatrices S_k, k = 1:l(+1), estimated according to the value of COND. X (output) DOUBLE PRECISION array, dimension (N) This array contains the least squares solution of the system J*x = b, D*x = 0.Tolerances
TOL DOUBLE PRECISION If COND = 'E', the tolerance to be used for finding the ranks of the submatrices S_k. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not relevant if COND = 'U' or 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, the first N elements of this array contain the diagonal elements of the upper triangular matrix S, and the next N elements contain the solution z. If BN > 1 and BSN > 0, the elements 2*N+1 : 2*N+ST*(N-ST) contain the submatrix (S(1:N-ST,N-ST+1:N))' of the matrix S. LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*N, if BN <= 1 or BSN = 0 and COND <> 'E'; LDWORK >= 4*N, if BN <= 1 or BSN = 0 and COND = 'E'; LDWORK >= ST*(N-ST) + 2*N, if BN > 1 and BSN > 0 and COND <> 'E'; LDWORK >= ST*(N-ST) + 2*N + 2*MAX(BSN,ST), if BN > 1 and BSN > 0 and COND = 'E'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Standard plane rotations are used to annihilate the elements of the diagonal matrix D, updating the upper triangular matrix R and the first n elements of the vector Q'*b. A basic least squares solution is computed. The computations exploit the special structure and storage scheme of the matrix R. If one or more of the submatrices S_k, k = 1:l+1, is singular, then the computed result is not the basic least squares solution for the whole problem, but a concatenation of (least squares) solutions of the individual subproblems involving R_k, k = 1:l+1 (with adapted right hand sides).References
[1] More, J.J., Garbow, B.S, and Hillstrom, K.E. User's Guide for MINPACK-1. Applied Math. Division, Argonne National Laboratory, Argonne, Illinois, Report ANL-80-74, 1980.Numerical Aspects
The algorithm requires 0(N*(BSN+ST)) operations and is backward stable, if R is nonsingular.Further Comments
This routine is a structure-exploiting, LAPACK-based modification of QRSOLV from the MINPACK package [1], and with optional condition estimation. The option COND = 'U' is useful when dealing with several right-hand side vectors.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve one of the systems of linear equations R*x = b , or R'*x = b , in the least squares sense, where R is an n-by-n block upper triangular matrix, with the structure / R_1 0 .. 0 | L_1 \ | 0 R_2 .. 0 | L_2 | | : : .. : | : | , | 0 0 .. R_l | L_l | \ 0 0 .. 0 | R_l+1 / with the upper triangular submatrices R_k, k = 1:l+1, square, and the first l of the same order, BSN. The diagonal elements of each block R_k have nonincreasing magnitude. The matrix R is stored in the compressed form, as returned by SLICOT Library routine NF01BS, / R_1 | L_1 \ | R_2 | L_2 | Rc = | : | : | , | R_l | L_l | \ X | R_l+1 / where the submatrix X is irrelevant. If the matrix R does not have full rank, then a least squares solution is obtained. If l <= 1, then R is an upper triangular matrix and its full upper triangle is stored. Optionally, the transpose of the matrix R can be stored in the strict lower triangles of the submatrices R_k, k = 1:l+1, and in the arrays SDIAG and S, as described at the parameter UPLO below.Specification
SUBROUTINE NF01BR( COND, UPLO, TRANS, N, IPAR, LIPAR, R, LDR, $ SDIAG, S, LDS, B, RANKS, TOL, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER COND, TRANS, UPLO INTEGER INFO, LDR, LDS, LDWORK, LIPAR, N DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IPAR(*), RANKS(*) DOUBLE PRECISION B(*), DWORK(*), R(LDR,*), S(LDS,*), SDIAG(*)Arguments
Mode Parameters
COND CHARACTER*1 Specifies whether the condition of submatrices R_k should be estimated, as follows: = 'E' : use incremental condition estimation and store the numerical rank of R_k in the array entry RANKS(k), for k = 1:l+1; = 'N' : do not use condition estimation, but check the diagonal entries of R_k for zero values; = 'U' : use the ranks already stored in RANKS(1:l+1). UPLO CHARACTER*1 Specifies the storage scheme for the matrix R, as follows: = 'U' : the upper triangular part is stored as in Rc; = 'L' : the lower triangular part is stored, namely, - the transpose of the strict upper triangle of R_k is stored in the strict lower triangle of R_k, for k = 1:l+1; - the diagonal elements of R_k, k = 1:l+1, are stored in the array SDIAG; - the transpose of the last block column in R (without R_l+1) is stored in the array S. TRANS CHARACTER*1 Specifies the form of the system of equations, as follows: = 'N': R*x = b (No transpose); = 'T': R'*x = b (Transpose); = 'C': R'*x = b (Transpose).Input/Output Parameters
N (input) INTEGER The order of the matrix R. N = BN*BSN + ST >= 0. (See parameter description below.) IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix R, as follows: IPAR(1) must contain ST, the number of columns of the submatrices L_k and the order of R_l+1. ST >= 0. IPAR(2) must contain BN, the number of blocks, l, in the block diagonal part of R. BN >= 0. IPAR(3) must contain BSM, the number of rows of the blocks R_k, k = 1:l. BSM >= 0. IPAR(4) must contain BSN, the number of columns of the blocks R_k, k = 1:l. BSN >= 0. BSM is not used by this routine, but assumed equal to BSN. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 4. R (input) DOUBLE PRECISION array, dimension (LDR, NC) where NC = N if BN <= 1, and NC = BSN+ST, if BN > 1. If UPLO = 'U', the leading N-by-NC part of this array must contain the (compressed) representation (Rc) of the upper triangular matrix R. The submatrix X in Rc and the strict lower triangular parts of the diagonal blocks R_k, k = 1:l+1, are not referenced. If BN <= 1 or BSN = 0, then the full upper triangle of R must be stored. If UPLO = 'L', BN > 1 and BSN > 0, the leading (N-ST)-by-BSN part of this array must contain the transposes of the strict upper triangles of R_k, k = 1:l, stored in the strict lower triangles of R_k, and the strict lower triangle of R_l+1 must contain the transpose of the strict upper triangle of R_l+1. The submatrix X in Rc is not referenced. The diagonal elements of R_k, and, if COND = 'E', the upper triangular parts of R_k, k = 1:l+1, are modified internally, but are restored on exit. If UPLO = 'L' and BN <= 1 or BSN = 0, the leading N-by-N strict lower triangular part of this array must contain the transpose of the strict upper triangular part of R. The diagonal elements and, if COND = 'E', the upper triangular elements are modified internally, but are restored on exit. LDR INTEGER The leading dimension of the array R. LDR >= MAX(1,N). SDIAG (input) DOUBLE PRECISION array, dimension (N) If UPLO = 'L', this array must contain the diagonal entries of R_k, k = 1:l+1. This array is modified internally, but is restored on exit. This parameter is not referenced if UPLO = 'U'. S (input) DOUBLE PRECISION array, dimension (LDS,N-ST) If UPLO = 'L', BN > 1, and BSN > 0, the leading ST-by-(N-ST) part of this array must contain the transpose of the rectangular part of the last block column in R, that is [ L_1' L_2' ... L_l' ] . If COND = 'E', S is modified internally, but is restored on exit. This parameter is not referenced if UPLO = 'U', or BN <= 1, or BSN = 0. LDS INTEGER The leading dimension of the array S. LDS >= 1, if UPLO = 'U', or BN <= 1, or BSN = 0; LDS >= MAX(1,ST), if UPLO = 'L', BN > 1, and BSN > 0. B (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the right hand side vector b. On exit, this array contains the (least squares) solution of the system R*x = b or R'*x = b. RANKS (input or output) INTEGER array, dimension (r), where r = BN + 1, if ST > 0, BSN > 0, and BN > 1; r = BN, if ST = 0 and BSN > 0; r = 1, if ST > 0 and ( BSN = 0 or BN <= 1 ); r = 0, if ST = 0 and BSN = 0. On entry, if COND = 'U' and N > 0, this array must contain the numerical ranks of the submatrices R_k, k = 1:l(+1). On exit, if COND = 'E' or 'N' and N > 0, this array contains the numerical ranks of the submatrices R_k, k = 1:l(+1), estimated according to the value of COND.Tolerances
TOL DOUBLE PRECISION If COND = 'E', the tolerance to be used for finding the ranks of the submatrices R_k. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not relevant if COND = 'U' or 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. Denote Full = ( BN <= 1 or BSN = 0 ); Comp = ( BN > 1 and BSN > 0 ). LDWORK >= 2*N, if Full and COND = 'E'; LDWORK >= 2*MAX(BSN,ST), if Comp and COND = 'E'; LDWORK >= 0, in the remaining cases.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Block back or forward substitution is used (depending on TRANS and UPLO), exploiting the special structure and storage scheme of the matrix R. If a submatrix R_k, k = 1:l+1, is singular, a local basic least squares solution is computed. Therefore, the returned result is not the basic least squares solution for the whole problem, but a concatenation of (least squares) solutions of the individual subproblems involving R_k, k = 1:l+1 (with adapted right hand sides).Numerical Aspects
2 2 The algorithm requires 0(BN*BSN + ST + N*ST) operations and is backward stable, if R is nonsingular.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the QR factorization of the Jacobian matrix J, as received in compressed form from SLICOT Library routine NF01BD, / dy(1)/dwb(1) | dy(1)/ dtheta \ Jc = | : | : | , \ dy(L)/dwb(L) | dy(L)/ dtheta / and to apply the transformation Q on the error vector e (in-situ). The factorization is J*P = Q*R, where Q is a matrix with orthogonal columns, P a permutation matrix, and R an upper trapezoidal matrix with diagonal elements of nonincreasing magnitude for each block column (see below). The 1-norm of the scaled gradient is also returned. Actually, the Jacobian J has the block form dy(1)/dwb(1) 0 ..... 0 dy(1)/dtheta 0 dy(2)/dwb(2) ..... 0 dy(2)/dtheta ..... ..... ..... ..... ..... 0 ..... 0 dy(L)/dwb(L) dy(L)/dtheta but the zero blocks are omitted. The diagonal blocks have the same size and correspond to the nonlinear part. The last block column corresponds to the linear part. It is assumed that the Jacobian matrix has at least as many rows as columns. The linear or nonlinear parts can be empty. If L <= 1, the Jacobian is represented as a full matrix.Specification
SUBROUTINE NF01BS( N, IPAR, LIPAR, FNORM, J, LDJ, E, JNORMS, $ GNORM, IPVT, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDJ, LDWORK, LIPAR, N DOUBLE PRECISION FNORM, GNORM C .. Array Arguments .. INTEGER IPAR(*), IPVT(*) DOUBLE PRECISION DWORK(*), E(*), J(*), JNORMS(*)Arguments
Input/Output Parameters
N (input) INTEGER The number of columns of the Jacobian matrix J. N = BN*BSN + ST >= 0. (See parameter description below.) IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix J, as follows: IPAR(1) must contain ST, the number of parameters corresponding to the linear part. ST >= 0. IPAR(2) must contain BN, the number of blocks, BN = L, for the parameters corresponding to the nonlinear part. BN >= 0. IPAR(3) must contain BSM, the number of rows of the blocks J_k = dy(k)/dwb(k), k = 1:BN, if BN > 0, or the number of rows of the matrix J, if BN <= 1. BN*BSM >= N, if BN > 0; BSM >= N, if BN = 0. IPAR(4) must contain BSN, the number of columns of the blocks J_k, k = 1:BN. BSN >= 0. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 4. FNORM (input) DOUBLE PRECISION The Euclidean norm of the vector e. FNORM >= 0. J (input/output) DOUBLE PRECISION array, dimension (LDJ, NC) where NC = N if BN <= 1, and NC = BSN+ST, if BN > 1. On entry, the leading NR-by-NC part of this array must contain the (compressed) representation (Jc) of the Jacobian matrix J, where NR = BSM if BN <= 1, and NR = BN*BSM, if BN > 1. On exit, the leading N-by-NC part of this array contains a (compressed) representation of the upper triangular factor R of the Jacobian matrix. The matrix R has the same structure as the Jacobian matrix J, but with an additional diagonal block. Note that for efficiency of the later calculations, the matrix R is delivered with the leading dimension MAX(1,N), possibly much smaller than the value of LDJ on entry. LDJ (input/output) INTEGER The leading dimension of array J. On entry, LDJ >= MAX(1,NR). On exit, LDJ >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (NR) On entry, this array contains the vector e, e = vec( Y - y ), where Y is set of output samples, and vec denotes the concatenation of the columns of a matrix. On exit, this array contains the updated vector Z*Q'*e, where Z is the block row permutation matrix used in the QR factorization of J (see METHOD). JNORMS (output) DOUBLE PRECISION array, dimension (N) This array contains the Euclidean norms of the columns of the Jacobian matrix, considered in the initial order. GNORM (output) DOUBLE PRECISION If FNORM > 0, the 1-norm of the scaled vector J'*e/FNORM, with each element i further divided by JNORMS(i) (if JNORMS(i) is nonzero). If FNORM = 0, the returned value of GNORM is 0. IPVT (output) INTEGER array, dimension (N) This array defines the permutation matrix P such that J*P = Q*R. Column j of P is column IPVT(j) of the identity matrix.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if N = 0 or BN <= 1 and BSM = N = 1; otherwise, LDWORK >= 4*N+1, if BN <= 1 or BSN = 0; LDWORK >= JWORK, if BN > 1 and BSN > 0, where JWORK is given by the following procedure: JWORK = BSN + MAX(3*BSN+1,ST); JWORK = MAX(JWORK,4*ST+1), if BSM > BSN; JWORK = MAX(JWORK,(BSM-BSN)*(BN-1)), if BSN < BSM < 2*BSN. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
A QR factorization with column pivoting of the matrix J is computed, J*P = Q*R. If l = L > 1, the R factor of the QR factorization has the same structure as the Jacobian, but with an additional diagonal block. Denote / J_1 0 .. 0 | L_1 \ | 0 J_2 .. 0 | L_2 | J = | : : .. : | : | . | : : .. : | : | \ 0 0 .. J_l | L_l / The algorithm consists in two phases. In the first phase, the algorithm uses QR factorizations with column pivoting for each block J_k, k = 1:l, and applies the orthogonal matrix Q'_k to the corresponding part of the last block column and of e. After all block rows have been processed, the block rows are interchanged so that the zeroed submatrices in the first l block columns are moved to the bottom part. The same block row permutation Z is also applied to the vector e. At the end of the first phase, the structure of the processed matrix J is / R_1 0 .. 0 | L^1_1 \ | 0 R_2 .. 0 | L^1_2 | | : : .. : | : | . | : : .. : | : | | 0 0 .. R_l | L^1_l | | 0 0 .. 0 | L^2_1 | | : : .. : | : | \ 0 0 .. 0 | L^2_l / In the second phase, the submatrix L^2_1:l is triangularized using an additional QR factorization with pivoting. (The columns of L^1_1:l are also permuted accordingly.) Therefore, the column pivoting is restricted to each such local block column. If l <= 1, the matrix J is triangularized in one phase, by one QR factorization with pivoting. In this case, the column pivoting is global.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrix J'*J + c*I, for the Jacobian J as received from SLICOT Library routine NF01BD: / dy(1)/dwb(1) | dy(1)/dtheta \ Jc = | : | : | . \ dy(L)/dwb(L) | dy(L)/dtheta / This is a compressed representation of the actual structure / J_1 0 .. 0 | L_1 \ | 0 J_2 .. 0 | L_2 | J = | : : .. : | : | . | : : .. : | : | \ 0 0 .. J_L | L_L /Specification
SUBROUTINE NF01BU( STOR, UPLO, N, IPAR, LIPAR, DPAR, LDPAR, J, $ LDJ, JTJ, LDJTJ, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER STOR, UPLO INTEGER INFO, LDJ, LDJTJ, LDPAR, LDWORK, LIPAR, N C .. Array Arguments .. DOUBLE PRECISION DPAR(*), DWORK(*), J(LDJ,*), JTJ(*) INTEGER IPAR(*)Arguments
Mode Parameters
STOR CHARACTER*1 Specifies the storage scheme for the symmetric matrix J'*J + c*I, as follows: = 'F' : full storage is used; = 'P' : packed storage is used. UPLO CHARACTER*1 Specifies which part of the matrix J'*J + c*I is stored, as follows: = 'U' : the upper triagular part is stored; = 'L' : the lower triagular part is stored.Input/Output Parameters
N (input) INTEGER The order of the matrix J'*J + c*I. N = BN*BSN + ST >= 0. (See parameter description below.) IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix J, as follows: IPAR(1) must contain ST, the number of parameters corresponding to the linear part. ST >= 0. IPAR(2) must contain BN, the number of blocks, BN = L, for the parameters corresponding to the nonlinear part. BN >= 0. IPAR(3) must contain BSM, the number of rows of the blocks J_k = dy(k)/dwb(k), k = 1:BN, if BN > 0, or the number of rows of the matrix J, if BN <= 1. IPAR(4) must contain BSN, the number of columns of the blocks J_k, k = 1:BN. BSN >= 0. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 4. DPAR (input) DOUBLE PRECISION array, dimension (LDPAR) The real parameters needed for solving the problem. The entry DPAR(1) must contain the real scalar c. LDPAR (input) INTEGER The length of the array DPAR. LDPAR >= 1. J (input) DOUBLE PRECISION array, dimension (LDJ, NC) where NC = N if BN <= 1, and NC = BSN+ST, if BN > 1. The leading NR-by-NC part of this array must contain the (compressed) representation (Jc) of the Jacobian matrix J, where NR = BSM if BN <= 1, and NR = BN*BSM, if BN > 1. LDJ (input) INTEGER The leading dimension of array J. LDJ >= MAX(1,NR). JTJ (output) DOUBLE PRECISION array, dimension (LDJTJ,N), if STOR = 'F', dimension (N*(N+1)/2), if STOR = 'P'. The leading N-by-N (if STOR = 'F'), or N*(N+1)/2 (if STOR = 'P') part of this array contains the upper or lower triangle of the matrix J'*J + c*I, depending on UPLO = 'U', or UPLO = 'L', respectively, stored either as a two-dimensional, or one-dimensional array, depending on STOR. LDJTJ INTEGER The leading dimension of the array JTJ. LDJTJ >= MAX(1,N), if STOR = 'F'. LDJTJ >= 1, if STOR = 'P'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) Currently, this array is not used. LDWORK INTEGER The length of the array DWORK. LDWORK >= 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix product is computed columnn-wise, exploiting the symmetry. BLAS 3 routines DGEMM and DSYRK are used if STOR = 'F', and BLAS 2 routine DGEMV is used if STOR = 'P'.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrix J'*J + c*I, for the Jacobian J as received from SLICOT Library routine NF01BY, for one output variable. NOTE: this routine must have the same arguments as SLICOT Library routine NF01BU.Specification
SUBROUTINE NF01BV( STOR, UPLO, N, IPAR, LIPAR, DPAR, LDPAR, J, $ LDJ, JTJ, LDJTJ, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER STOR, UPLO INTEGER INFO, LDJ, LDJTJ, LDPAR, LDWORK, LIPAR, N C .. Array Arguments .. INTEGER IPAR(*) DOUBLE PRECISION DPAR(*), DWORK(*), J(LDJ,*), JTJ(*)Arguments
Mode Parameters
STOR CHARACTER*1 Specifies the storage scheme for the symmetric matrix J'*J + c*I, as follows: = 'F' : full storage is used; = 'P' : packed storage is used. UPLO CHARACTER*1 Specifies which part of the matrix J'*J + c*I is stored, as follows: = 'U' : the upper triagular part is stored; = 'L' : the lower triagular part is stored.Input/Output Parameters
N (input) INTEGER The number of columns of the Jacobian matrix J. N >= 0. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix J, as follows: IPAR(1) must contain the number of rows M of the Jacobian matrix J. M >= 0. IPAR is provided for compatibility with SLICOT Library routine MD03AD. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 1. DPAR (input) DOUBLE PRECISION array, dimension (LDPAR) The real parameters needed for solving the problem. The entry DPAR(1) must contain the real scalar c. LDPAR (input) INTEGER The length of the array DPAR. LDPAR >= 1. J (input) DOUBLE PRECISION array, dimension (LDJ,N) The leading M-by-N part of this array must contain the Jacobian matrix J. LDJ INTEGER The leading dimension of the array J. LDJ >= MAX(1,M). JTJ (output) DOUBLE PRECISION array, dimension (LDJTJ,N), if STOR = 'F', dimension (N*(N+1)/2), if STOR = 'P'. The leading N-by-N (if STOR = 'F'), or N*(N+1)/2 (if STOR = 'P') part of this array contains the upper or lower triangle of the matrix J'*J + c*I, depending on UPLO = 'U', or UPLO = 'L', respectively, stored either as a two-dimensional, or one-dimensional array, depending on STOR. LDJTJ INTEGER The leading dimension of the array JTJ. LDJTJ >= MAX(1,N), if STOR = 'F'. LDJTJ >= 1, if STOR = 'P'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) Currently, this array is not used. LDWORK INTEGER The length of the array DWORK. LDWORK >= 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix product is computed columnn-wise, exploiting the symmetry. BLAS 3 routine DSYRK is used if STOR = 'F', and BLAS 2 routine DGEMV is used if STOR = 'P'.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrix-vector product x <-- (J'*J + c*I)*x, for the Jacobian J as received from SLICOT Library routine NF01BD: / dy(1)/dwb(1) | dy(1)/dtheta \ Jc = | : | : | . \ dy(L)/dwb(L) | dy(L)/dtheta / This is a compressed representation of the actual structure / J_1 0 .. 0 | L_1 \ | 0 J_2 .. 0 | L_2 | J = | : : .. : | : | . | : : .. : | : | \ 0 0 .. J_L | L_L /Specification
SUBROUTINE NF01BW( N, IPAR, LIPAR, DPAR, LDPAR, J, LDJ, X, INCX, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INCX, INFO, LDJ, LDPAR, LDWORK, LIPAR, N C .. Array Arguments .. DOUBLE PRECISION DPAR(*), DWORK(*), J(LDJ,*), X(*) INTEGER IPAR(*)Arguments
Input/Output Parameters
N (input) INTEGER The dimension of the vector x. N = BN*BSN + ST >= 0. (See parameter description below.) IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix J, as follows: IPAR(1) must contain ST, the number of parameters corresponding to the linear part. ST >= 0. IPAR(2) must contain BN, the number of blocks, BN = L, for the parameters corresponding to the nonlinear part. BN >= 0. IPAR(3) must contain BSM, the number of rows of the blocks J_k = dy(k)/dwb(k), k = 1:BN, if BN > 0, or the number of rows of the matrix J, if BN <= 1. IPAR(4) must contain BSN, the number of columns of the blocks J_k, k = 1:BN. BSN >= 0. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 4. DPAR (input) DOUBLE PRECISION array, dimension (LDPAR) The real parameters needed for solving the problem. The entry DPAR(1) must contain the real scalar c. LDPAR (input) INTEGER The length of the array DPAR. LDPAR >= 1. J (input) DOUBLE PRECISION array, dimension (LDJ, NC) where NC = N if BN <= 1, and NC = BSN+ST, if BN > 1. The leading NR-by-NC part of this array must contain the (compressed) representation (Jc) of the Jacobian matrix J, where NR = BSM if BN <= 1, and NR = BN*BSM, if BN > 1. LDJ (input) INTEGER The leading dimension of array J. LDJ >= MAX(1,NR). X (input/output) DOUBLE PRECISION array, dimension (1+(N-1)*INCX) On entry, this incremented array must contain the vector x. On exit, this incremented array contains the value of the matrix-vector product (J'*J + c*I)*x. INCX (input) INTEGER The increment for the elements of X. INCX >= 1.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= NR.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The associativity of matrix multiplications is used; the result is obtained as: x_out = J'*( J*x ) + c*x.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute (J'*J + c*I)*x, where J is an m-by-n real matrix, c is a real scalar, I is the n-by-n identity matrix, and x is a real n-vector. NOTE: this routine must have the same arguments as SLICOT Library routine NF01BW.Specification
SUBROUTINE NF01BX( N, IPAR, LIPAR, DPAR, LDPAR, J, LDJ, X, INCX, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INCX, INFO, LDJ, LDPAR, LDWORK, LIPAR, N C .. Array Arguments .. INTEGER IPAR(*) DOUBLE PRECISION DPAR(*), DWORK(*), J(LDJ,*), X(*)Arguments
Input/Output Parameters
N (input) INTEGER The number of columns of the Jacobian matrix J. N >= 0. IPAR (input) INTEGER array, dimension (LIPAR) The integer parameters describing the structure of the matrix J, as follows: IPAR(1) must contain the number of rows M of the Jacobian matrix J. M >= 0. IPAR is provided for compatibility with SLICOT Library routine MD03AD. LIPAR (input) INTEGER The length of the array IPAR. LIPAR >= 1. DPAR (input) DOUBLE PRECISION array, dimension (LDPAR) The real parameters needed for solving the problem. The entry DPAR(1) must contain the real scalar c. LDPAR (input) INTEGER The length of the array DPAR. LDPAR >= 1. J (input) DOUBLE PRECISION array, dimension (LDJ,N) The leading M-by-N part of this array must contain the Jacobian matrix J. LDJ INTEGER The leading dimension of the array J. LDJ >= MAX(1,M). X (input/output) DOUBLE PRECISION array, dimension (1+(N-1)*abs(INCX)) On entry, this incremented array must contain the vector x. On exit, this incremented array contains the value of the matrix-vector product (J'*J + c*I)*x. INCX (input) INTEGER The increment for the elements of X. INCX <> 0.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= M.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The associativity of matrix multiplications is used; the result is obtained as: x_out = J'*( J*x ) + c*x.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the Jacobian of the error function for a neural network of the structure - tanh(w1*z+b1) - / : \ z --- : --- sum(ws(i)*...)+ b(n+1) --- y, \ : / - tanh(wn*z+bn) - for the single-output case. The Jacobian has the form d e(1) / d WB(1) ... d e(1) / d WB(NWB) J = : : , d e(NSMP) / d WB(1) ... d e(NSMP) / d WB(NWB) where e(z) is the error function, WB is the set of weights and biases of the network (for the considered output), and NWB is the number of elements of this set, NWB = IPAR(1)*(NZ+2)+1 (see below). In the multi-output case, this routine should be called for each output. NOTE: this routine must have the same arguments as SLICOT Library routine NF01BD.Specification
SUBROUTINE NF01BY( CJTE, NSMP, NZ, L, IPAR, LIPAR, WB, LWB, Z, $ LDZ, E, J, LDJ, JTE, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER CJTE INTEGER INFO, L, LDJ, LDWORK, LDZ, LIPAR, LWB, NSMP, NZ C .. Array Arguments .. DOUBLE PRECISION DWORK(*), E(*), J(LDJ,*), JTE(*), WB(*), $ Z(LDZ,*) INTEGER IPAR(*)Arguments
Mode Parameters
CJTE CHARACTER*1 Specifies whether the matrix-vector product J'*e should be computed or not, as follows: = 'C' : compute J'*e; = 'N' : do not compute J'*e.Input/Output Parameters
NSMP (input) INTEGER The number of training samples. NSMP >= 0. NZ (input) INTEGER The length of each input sample. NZ >= 0. L (input) INTEGER The length of each output sample. Currently, L must be 1. IPAR (input/output) INTEGER array, dimension (LIPAR) The integer parameters needed. On entry, the first element of this array must contain a value related to the number of neurons, n; specifically, n = abs(IPAR(1)), since setting IPAR(1) < 0 has a special meaning (see below). On exit, if IPAR(1) < 0 on entry, then no computations are performed, except the needed tests on input parameters, but the following values are returned: IPAR(1) contains the length of the array J, LJ; LDJ contains the leading dimension of array J. Otherwise, IPAR(1) and LDJ are unchanged on exit. LIPAR (input) INTEGER The length of the vector IPAR. LIPAR >= 1. WB (input) DOUBLE PRECISION array, dimension (LWB) The leading NWB = IPAR(1)*(NZ+2)+1 part of this array must contain the weights and biases of the network, WB = ( w(1,1), ..., w(1,NZ), ..., w(n,1), ..., w(n,NZ), ws(1), ..., ws(n), b(1), ..., b(n+1) ), where w(i,j) are the weights of the hidden layer, ws(i) are the weights of the linear output layer and b(i) are the biases. LWB (input) INTEGER The length of array WB. LWB >= NWB. Z (input) DOUBLE PRECISION array, dimension (LDZ, NZ) The leading NSMP-by-NZ part of this array must contain the set of input samples, Z = ( Z(1,1),...,Z(1,NZ); ...; Z(NSMP,1),...,Z(NSMP,NZ) ). LDZ INTEGER The leading dimension of array Z. LDZ >= MAX(1,NSMP). E (input) DOUBLE PRECISION array, dimension (NSMP) If CJTE = 'C', this array must contain the error vector e. If CJTE = 'N', this array is not referenced. J (output) DOUBLE PRECISION array, dimension (LDJ, NWB) The leading NSMP-by-NWB part of this array contains the Jacobian of the error function. LDJ INTEGER The leading dimension of array J. LDJ >= MAX(1,NSMP). Note that LDJ is an input parameter, except for IPAR(1) < 0 on entry, when it is an output parameter. JTE (output) DOUBLE PRECISION array, dimension (NWB) If CJTE = 'C', this array contains the matrix-vector product J'*e. If CJTE = 'N', this array is not referenced.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) This argument is included for combatibility with SLICOT Library routine NF01BD. LDWORK INTEGER Normally, the length of the array DWORK. LDWORK >= 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The Jacobian is computed analytically.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
Interface for using a common entry point, DSblock compatible for defining Differential Algebraic Equations using several packages. The equations follow the form: dx/dt = f(x(t), (t), p, t) y(t) = g(x(t), (t), p, t) The user must define only the subroutines ODEDER and ODEOUT and the Jacobians (JACFX, JACFU, JACFP) if used, and the interface adapts the structure to fit all the codesSpecification
SUBROUTINE ODESolver(ISOLVER, CODEDER_, CODEOUT_, CJACFX_, $ CJACFU_, CJACFP_, $ NX, NY, NU, TINI, TOUT, X, U, Y, $ IPAR, DPAR, RTOL, ATOL, $ IWORK, LIWORK, DWORK, LDWORK, $ IWARN, INFO) .. Scalar Arguments .. DOUBLE PRECISION RTOL, TINI, TOUT INTEGER ISOLVER, IWARN, INFO, NX, NY, NU, $ LDWORK, LIWORK CHARACTER*9 CODEDER_, CODEOUT_, CJACFX_, CJACFU_, CJACFP_ .. Array Arguments .. DOUBLE PRECISION ATOL(*), DWORK(LDWORK), DPAR(*), $ X(NX), Y(NY), U(NU) INTEGER IWORK(LIWORK), IPAR(*)Arguments
Mode Parameters
ISOLVER (input) INTEGER Indicates the nonlinear solver package to be used: = 1: LSODE, = 2: LSODA, = 3: LSODES, = 4: RADAU5, = 5: DASSL, = 6: DASPK, = 7: DGELDA.Input/Output Parameters
ODEDER (input) EXTERNAL Evaluates the right hand side f of the ODE. ODEOUT (input) EXTERNAL Evaluates the output signals function g. JACFX (input) EXTERNAL Evaluates the jacobian matrix with respect to X. JACFU (input) EXTERNAL Evaluates the jacobian matrix with respect to U. JACFP (input) EXTERNAL Evaluates the jacobian matrix with respect to P. NX (input) INTEGER Dimension of the state vector. NY (input) INTEGER Dimension of the output vector. NU (input) INTEGER Dimension of the input vector.
TINI (input) DOUBLE PRECISION Initial value of time. TOUT (input) DOUBLE PRECISION Final value of time. X (input/output) DOUBLE PRECISION array, dimension (NX) On entry, array containing the initial state variables. On exit, it has the last value of the state variables. U (input) DOUBLE PRECISION array, dimension (NU) Array containing the input initial values. Y (input/output) DOUBLE PRECISION array, dimension (NY) On entry, array containing the initial values of Y. On exit, it has the results of the system. IPAR (input/output) INTEGER array, dimension (230) INPUT: 1..15 General 16..25 ODEPACK 26..35 RADAU5 36..50 DASSL/PK 51..60 GELDA 61..100 Reserved OUTPUT: 101..110 General 111..125 ODEPACK 126..135 RADAU5 136..145 DASSL/PK 146..155 GELDA 156..200 Reserved Any Mode: 201.. User Available Common integer parameters for SOLVERS: IPAR(1), Tolerance mode 0 : both RTOL and ATOL are scalars 1 : RTOL is scalar and ATOL is vector 2 : both RTOL and ATOL are vectors IPAR(2), Compute Output Values, must be 1 IPAR(3), mf, Method flag 0 : No jacobian used (non-stiff method). 1 : User supplied full jacobian (stiff). 2 : User supplied banded jacobian (stiff). 3 : User supplied sparse jacobian (stiff). 10 : internally generated full jacobian (stiff). 11 : internally generated banded jacobian (stiff). 12 : internally generated sparse jacobian (stiff). IPAR(5), Maximum number of steps allowed during one call to the solver. IPAR(6), ml, lower half-bandwithds of the banded jacobian, excluding tne main diagonal. IPAR(7), mu, upper half-bandwithds of the banded jacobian, excluding tne main diagonal. IPAR(8), Flag to generate extra printing at method switches: 0 means no extra printing 1 for minimal printing 2 for full printing IPAR(101) = Number of steps taken for the problem. IPAR(102) = Number of f evaluations. IPAR(103) = Number of jacobian evaluations. Common parameters for ODEPACK, DASSL and DASPK solvers: IPAR(111) = The method order last used(successfully). IPAR(112) = The order to be attempted on the next step. Common parameters for ODEPACK solver: IPAR(16), Status Flag IPAR(17), Optional inputs IPAR(18), Maximum number of messages printed, default value is 10. IPAR(113) = Index of the component of largest in the weighted local error vector ( e(i)/ewt(i) ). IPAR(114) = Length of rwork actually required. IPAR(115) = Length of iwork actually required. - LSODE and LSODES IPAR(19), Maximum order to be allowed. 12 if meth = 1 5 if meth = 2 If exceds the default value, it will be reduced to the default value. - LSODES IPAR(118), Number of nonzero elements in the jacobian matrix, including the diagonal (miter = 1 or 2). IPAR(119), Number of groups of column indices, used in difference quotient jacobian aproximations if miter = 2. IPAR(120), Number of sparse LU decompositions. IPAR(121), Base address in rwork of the history array. IPAR(122), Base address of the structure descriptor array ian. IPAR(123), Base address of the structure descriptor array jan. IPAR(124), Number of nonzero elements in the strict lower triangle of the LU factorization. IPAR(125), Number of nonzero elements in the strict upper triangle of the LU factorization. - LSODA IPAR(22), Maximum order to be allowed for the nonstiff method, default value is 12. If exceds the default value, it will be reduced to the default value. IPAR(23), Maximum order to be allowed for the stiff method, default value is 5. If exceds the default value, it will be reduced to the default value. IPAR(116), Method indicator for the last successful step 1 adams (nonstiff) 2 bdf (stiff) IPAR(117), Current method indicator 1 adams (nonstiff) 2 bdf (stiff) Parameters for RADAU5 solver: IPAR(26) Transforms the Jacobian matrix to Hessenberg form. IPAR(27) Maximum number of Newton iterations. IPAR(28) Starting values for Newton's method if 0 then is taken the extrapolated collocation solution if not equal 0 zero values are used. IPAR(29) Dimension of the index 1 variables. IPAR(30) Dimension of the index 2 variables. IPAR(31) Dimension of the index 3 variables. IPAR(32) Switch for step size strategy 0,1 Mod. Predictive controller(Gustafsson) 2 Classical step size control IPAR(33) Value of M1. IPAR(34) Value of M2. IPAR(126), Number of accepted steps. IPAR(127), Number of rejected steps. IPAR(128), Number of LU-Decompositions of both matrices IPAR(129), Number of forward-backward substitutions, of both systems. Common parameters for DASSL and DASPK solvers: IPAR(36), this parameter enables the code to initialize itself. Must set to 0 to indicate the start of every new problem. 0: Yes. (On each new problem) 1: No. (Allows 500 new steps) IPAR(37), code solve the problem without invoking any special non negativity contraints: 0: Yes 1: To have constraint checking only in the initial condition calculation. 2: To enforce nonnegativity in X during the integration. 3: To enforce both options 1 and 2. IPAR(38), Solver try to compute the initial T, X and XPRIME: 0: The initial T, X and XPRIME are consistent. 1: Given X_d calculate X_a and X'_d 2: Given X' calculate X. ( X_d differential variables in X X_a algebrac variables in X ) IPAR(136), Total number of error test failures so far. IPAR(137), Total number of convergence test failures. -Parameters for DASPK IPAR(39), DASPK use: 0: direct methods (compatible with DASSL) 1: Krylov method 2: Krylov method + Jac IPAR(40), DASPK uses scalars MAXLm KMP, NRMAX and EPLI when uses Krylov method. 0: uses default values. 1: uses user values. IPAR(41), Proceed to the integration after the initial condition calculation is done. Used when INFOV(11)>0 0: Yes 1: No IPAR(42), Errors are controled localy on all the variables. 0: Yes 1: No IPAR(43), Use default values for initial condition heuristic controls. 0: Yes 1: No and provide MXNIT, MXNJ, MXNH, LSOFF, STPTOL, EPINIT. IPAR(138), number of convergence failures of the linear iteration IPAR(139), length of IWORK actually required. IPAR(140), length of RWORK actually required. IPAR(141), total number of nonlinear iterations. IPAR(142), total number of linear (Krylov) iterations IPAR(143), number of PSOL calls. DPAR (input/output) DOUBLE PRECISION array, dimension (202) INPUT: 1..15 General 16..25 ODEPACK 26..35 RADAU5 36..50 DASSL/PK 51..60 GELDA 61..100 Reserved OUTPUT: 101..110 General 111..125 ODEPACK 126..135 RADAU5 136..145 DASSL/PK 146..155 GELDA 156..200 Reserved Any Mode: 201.. User Available Common real parameters for SOLVERS: DPAR(1), Initial step size guess. Optional in: ODEPACK, DASSL, .. DPAR(2), Maximum absolute step size allowed. Common parameters for ODEPACK and DASSL: DPAR(111), Step size in t last used (successfully). DPAR(113), Current value of the independent variable which the solver has actually reached Common parameters for ODEPACK solvers: DPAR(16), Critical value of t which the solver is not overshoot. DPAR(17), Minimum absolute step size allowed. DPAR(112), Step size to be attempted on the next step. DPAR(18), Tolerance scale factor, greater than 1.0. - LSODA DPAR(115) Value of t at the time of the last method switch, if any. - LSODA DPAR(115) Value of t at the time of the last method switch, if any. - LSODES DPAR(19), The element threshhold for sparsity determination when moss = 1 or 2. Parameters for RADAU5 solver: DPAR(26), The rounding unit, default 1E-16. DPAR(27), The safety factor in step size prediction, default 0.9D0. DPAR(28), Decides whether the jacobian should be recomputed, default 0.001D0. DPAR(29), Stopping criterion for Newton's method, default MIN(0.03D0, RTOL(1)**0.5D0) DPAR(30), DPAR(31): This saves, together with a large DPAR(28), LU-decompositions and computing time for large systems. DPAR(32), DPAR(33), Parameters for step size selection. Parameters for DASSL and DASPK solvers: DPAR(36), Stopping point (Tstop)Tolerances
RTOL DOUBLE PREISION Relative Tolerance. ATOL DOUBLE PREISION Absolute Tolerance.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER Size of IWORK, depending on solver: - LSODE 20 for mf = 10, 20 + neq for mf = 21, 22, 24, or 25. if mf = 24, 25, input in iwork(1),iwork(2) the lower and upper half-bandwidths ml,mu. -LSODA 20+NX -LSODES 30 -DASSL 20+NEQ DWORK DOUBLE PREISION array, dimension (LDWORK) LDWORK INTEGER Size of DWORK, depending on solver: - LSODE 20+16*NX , IPAR(3) = 10, 22+ 9*NX+NX**2 , IPAR(3) = 21 or 22, 22+10*NX+(2*IPAR(4)+IPAR(9))*NX, IPAR(3) = 24 or 25. - LSODA 22+NX*max(16,NX+9) - LSODES 20+16*NX , mf=10 20+(2+1./lenrat)*nnz + (11+9./lenrat)*NX, mf=121,222 - DASSL >= 40 LRW .GE. 40+(MAXORD+4)*NEQ+NEQ**2, IPAR(3) = 1 or 10 >= 40+(MAXORD+4)*NEQ+(2*ML+MU+1)*NEQ, IPAR(3) = 2 >= 40+(MAXORD+4)*NEQ+(2*ML+MU+1)*NEQ +2*(NEQ/(ML+MU+1)+1), IPAR(3) = 11Warning Indicator
IWARN INTEGER = 0: no warning; = 1: LSODE/LSODA/LSODES/RADAU5 do not use the input vector as argument; = 2: Only the 1st element of RTOL is used; = 3: Method (IPAR(3)) not allowed with LSODE/LSODA/LSODES/RADAU5/DASSL/DASPK; = 4: Only the 1st element of ATOL is used; = 5: Option not allowed for IPAR(37); = 6: Option not allowed for IPAR(38).Error Indicator
INFO INTEGER = 0: Successful exit; < 0: If INFO = -i, the i-th argument had an illegal value; = 1: Wrong tolerance mode; = 2: Sparse storage (IPAR(4)=1) incompatible with LSODE/LSODA/RADAU5; = 3: Dense storage (IPAR(4)=0) incompatible with LSODES = 100+ERROR: ODEDER returned ERROR = 200+ERROR: RADAU5 returned -ERROR = 300+ERROR: DDASSL returned -ERROR = 400+ERROR: DDASPK returned -ERROR = 500+ERROR: DGELDA returned -ERROR
Since the package integrates 9 different solvers, it is possible to solve differential equations by means of Backward Differential Formulas, Runge-Kutta, using direct or iterative methods (including preconditioning) for the linear system associated, differential equations with time-varying coefficients or of order higher than one. The interface facilitates the user the work of changing the integrator and testing the results, thus leading a more robust and efficient integrated package.References
[1] A.C. Hindmarsh, Brief Description of ODEPACK: A Systematized Collection of ODE Solvers, http://www.netlib.org/odepack/doc [2] L.R. Petzold DASSL Library Documentation, http://www.netlib.org/ode/ [3] P.N. Brown, A.C. Hindmarsh, L.R. Petzold, DASPK Package 1995 Revision [4] R.S. Maier, Using DASPK on the TMC CM5. Experiences with Two Programming Models, Minesota Supercomputer Center, Technical Report. [5] E. Hairer, G. Wanner, Solving Ordinary Dirential Equations II. Stiánd Dirential- Algebraic Problems., Springer Seried in Computational Mathermatics 14, Springer-Verlag 1991, Second Edition 1996. [6] P. Kunkel, V. Mehrmann, W. Rath und J. Weickert, `GELDA: A Software Package for the Solution of General Linear Dirential Algebraic equations', SIAM Journal Scienti^Lc Computing, Vol. 18, 1997, pp. 115 - 138. [7] M. Otter, DSblock: A neutral description of dynamic systems. Version 3.3, http://www.netlib.org/odepack/doc [8] M. Otter, H. Elmqvist, The DSblock model interface for exchanging model components, Proceedings of EUROSIM 95, ed. F.Brenenecker, Vienna, Sep. 11-15, 1995 [9] M. Otter, The DSblock model interface, version 4.0, Incomplete Draft, http://dv.op.dlr.de/~otter7dsblock/dsblock4.0a.html [10] Ch. Lubich, U. Novak, U. Pohle, Ch. Engstler, MEXX - Numerical Software for the Integration of Constrained Mechanical Multibody Systems, http://www.netlib.org/odepack/doc [11] Working Group on Software (WGS), SLICOT Implementation and Documentation Standards (version 1.0), WGS-Report 90-1, Eindhoven University of Technology, May 1990. [12] P. Kunkel and V. Mehrmann, Canonical forms for linear differential- algebraic equations with variable coeÆcients., J. Comput. Appl. Math., 56:225{259, 1994. [13] Working Group on Software (WGS), SLICOT Implementation and Documentation Standards, WGS-Report 96-1, Eindhoven University of Technology, updated: Feb. 1998, ../../REPORTS/rep96-1.ps.Z. [14] A. Varga, Standarization of Interface for Nonlinear Systems Software in SLICOT, Deutsches Zentrum ur Luft un Raumfahrt, DLR. SLICOT-Working Note 1998-4, 1998, Available at ../../REPORTS/SLWN1998-4.ps.Z. [15] D. Kirk, Optimal Control Theory: An Introduction, Prentice-Hall. Englewood Cli, NJ, 1970. [16] F.L. Lewis and V.L. Syrmos, Optimal Control, Addison-Wesley. New York, 1995. [17] W.M.Lioen, J.J.B de Swart, Test Set for Initial Value Problem Solvers, Technical Report NM-R9615, CWI, Amsterdam, 1996. http://www.cwi.nl/cwi/projects/IVPTestset/. [18] V.Hernandez, I.Blanquer, E.Arias, and P.Ruiz, Definition and Implementation of a SLICOT Standard Interface and the associated MATLAB Gateway for the Solution of Nonlinear Control Systems by using ODE and DAE Packages}, Universidad Politecnica de Valencia, DSIC. SLICOT Working Note 2000-3: July 2000. Available at ../../REPORTS/SLWN2000-3.ps.Z. [19] J.J.B. de Swart, W.M. Lioen, W.A. van der Veen, SIDE, November 25, 1998. Available at http://www.cwi.nl/cwi/projects/PSIDE/. [20] Kim, H.Young, F.L.Lewis, D.M.Dawson, Intelligent optimal control of robotic manipulators using neural networks. [21] J.C.Fernandez, E.Arias, V.Hernandez, L.Penalver, High Performance Algorithm for Tracking Trajectories of Robot Manipulators, Preprints of the Proceedings of the 6th IFAC International Workshop on Algorithms and Architectures for Real-Time Control (AARTC-2000), pages 127-134.Numerical Aspects
The numerical aspects of the routine lie on the features of the different packages integrated. Several packages are more robust than others, and other packages simply cannot deal with problems that others do. For a detailed description of the numerical aspects of each method is recommended to check the references above.Further Comments
Several packages (LSODES, LSOIBT) deal only with sparse matrices. The interface checks the suitability of the methods to the parameters and show a warning message if problems could arise.Example
Program Text
* ODESOLVER EXAMPLE PROGRAM TEXT FOR LSODEX
PROBLEM
*
* .. Parameters ..
INTEGER
NIN, NOUT
PARAMETER
( NIN = 5, NOUT = 6 )
INTEGER LSODE_, LSODA_, LSODES_,
RADAU5_, DASSL_, DASPK_, DGELDA_
PARAMETER (LSODE_ = 1, LSODA_
= 2, LSODES_ = 3)
PARAMETER (RADAU5_ = 4, DASSL_ =
5, DASPK_ = 6)
PARAMETER (DGELDA_ = 7)
*
EXTERNAL IARGC_
INTEGER IARGC_
INTEGER NUMARGS
CHARACTER*80 NAME
CHARACTER*80 SOLVER
*
* .. Executable Statements ..
*
WRITE ( NOUT, FMT = 99999 )
*
NUMARGS = IARGC_()
*
CALL GETARG_(0, NAME)
IF (NUMARGS .NE. 1) THEN
WRITE (*,*) 'Syntax
Error: ',NAME(1:8),' <solver>'
WRITE (*,*) 'Solvers
: LSODE, LSODA, LSODES, RADAU5, DASSL, DASP
&K'
ELSE
*
CALL GETARG_(1, SOLVER)
*
WRITE (*,*) 'Problem:
LSODEX Solver: ',SOLVER(1:7)
*
IF (SOLVER(1:5) .EQ.
'LSODE') THEN
CALL TEST(LSODE_)
ELSEIF (SOLVER(1:5)
.EQ. 'LSODA') THEN
CALL TEST(LSODA_)
ELSEIF (SOLVER(1:6)
.EQ. 'LSODES') THEN
CALL TEST(LSODES_)
ELSEIF (SOLVER(1:6)
.EQ. 'RADAU5') THEN
CALL TEST(RADAU5_)
ELSEIF (SOLVER(1:5)
.EQ. 'DASSL') THEN
CALL TEST(DASSL_)
ELSEIF (SOLVER(1:5)
.EQ. 'DASPK') THEN
CALL TEST(DASPK_)
ELSE
WRITE (*,*)
'Error: Solver: ', SOLVER,' unknown'
ENDIF
ENDIF
*
99999 FORMAT (' ODESOLVER EXAMPLE PROGRAM RESULTS FOR LSODEX PROBLEM'
.
,/1X)
END
*
*
*
*
SUBROUTINE TEST( ISOLVER )
*
*
* PURPOSE
*
* Testing subroutine ODESolver
*
* ARGUMENTS
*
* Input/Output Parameters
*
* ISOLVER (input) INTEGER
*
Indicates the nonlinear solver package to be used:
*
= 1: LSODE,
*
= 2: LSODA,
*
= 3: LSODES,
*
= 4: RADAU5,
*
= 5: DASSL,
*
= 6: DASPK,
*
= 7: DGELDA.
*
* METHOD
*
* REFERENCES
*
* CONTRIBUTORS
*
* REVISIONS
*
* -
*
* KEYWORDS
*
*
* ******************************************************************
* .. Parameters ..
INTEGER LSODE_, LSODA_, LSODES_,
RADAU5_, DASSL_, DASPK_, DGELDA_
PARAMETER (LSODE_ = 1, LSODA_
= 2, LSODES_ = 3)
PARAMETER (RADAU5_ = 4, DASSL_ =
5, DASPK_ = 6)
PARAMETER (DGELDA_ = 7)
INTEGER
NIN, NOUT
PARAMETER
( NIN = 5, NOUT = 6 )
INTEGER
MD, ND, LPAR, LWORK
PARAMETER
( MD = 400, ND = 100, LPAR = 250,
$
LWORK = 650000 )
* .. Scalar Arguments ..
INTEGER ISOLVER
* .. Local Scalars ..
INTEGER
NEQN, NDISC, MLJAC, MUJAC, MLMAS, MUMAS
INTEGER
IWARN, INFO
DOUBLE PRECISION ATOL(MD), RTOL,
NORM
LOGICAL
NUMJAC, NUMMAS, CONSIS
* .. Local Arrays ..
CHARACTER FULLNM*40, PROBLM*8, TYPE*3
CHARACTER*9 ODEDER, ODEOUT, JACFX,
JACFU, JACFP
INTEGER
IND(MD), IPAR(LPAR), IWORK(LWORK)
DOUBLE PRECISION T(0:ND), RPAR(LPAR),
DWORK(LWORK)
DOUBLE PRECISION X(MD), XPRIME(MD),
U(MD), Y(MD)
* .. External Functions ..
DOUBLE PRECISION DNRM2
EXTERNAL
DNRM2
* .. External Subroutines ..
EXTERNAL
PLSODEX,ILSODEX,SLSODEX
EXTERNAL
DAXPY
* .. Executable Statements ..
*
DO 20 I=1,NEQN
U(I)=0D0
Y(I)=0D0
20 CONTINUE
DO 40 I=1,LPAR
IPAR(I)=0
RPAR(I)=0D0
40 CONTINUE
DO 60 I=1,LWORK
IWORK(I)=0
DWORK(I)=0D0
60 CONTINUE
IPAR(2)=1
* Get the problem dependent parameters.
RPAR(1)=1D-3
IPAR(1)=0
ATOL(1)=1D-6
ATOL(2)=1D-10
ATOL(3)=1D-6
RTOL=1D-4
CALL PLSODEX(FULLNM,PROBLM,TYPE,NEQN,NDISC,T,NUMJAC,MLJAC,
$
MUJAC,NUMMAS,MLMAS,MUMAS,IND)
CALL ILSODEX(NEQN,T(0),X,XPRIME,CONSIS)
CALL SLSODEX(NEQN,T(1),XPRIME)
IF ( TYPE.NE.'ODE' ) THEN
WRITE ( NOUT,
FMT = 99998 )
ELSE
WRITE ( NOUT,
FMT = 99997 ) FULLNM, PROBLM, TYPE, ISOLVER
IF ( NUMJAC )
THEN
IPAR(3)=0
ELSE
IPAR(3)=1
END IF
IPAR(6)=MLJAC
IPAR(7)=MUJAC
ODEDER=''
ODEOUT=''
JACFX=''
JACFU=''
JACFP=''
CALL ODESolver(
ISOLVER, ODEDER, ODEOUT, JACFX, JACFU, JACFP,
$
NEQN, NEQN, NEQN, T(0), T(1), X, U, Y,
$
IPAR, RPAR, RTOL, ATOL,
$
IWORK, LWORK, DWORK, LWORK, IWARN, INFO )
IF ( INFO.NE.0
) THEN
WRITE ( NOUT, FMT = 99996 ) INFO
ELSE
IF ( IWARN.NE.0 ) THEN
WRITE ( NOUT, FMT = 99995 ) IWARN
ENDIF
IF ( NEQN .LE. 10 ) THEN
WRITE ( NOUT, FMT = 99994 )
DO 80 I=1,NEQN
WRITE ( NOUT, FMT = 99993 ) X(I), XPRIME(I)
80
CONTINUE
END IF
NORM=DNRM2(NEQN,XPRIME,1)
IF ( NORM.EQ.0D0 ) THEN
NORM=1D0
END IF
CALL DAXPY(NEQN,-1D0,X,1,XPRIME,1)
NORM=DNRM2(NEQN,XPRIME,1)/NORM
WRITE ( NOUT, FMT = 99992 ) NORM
END IF
END IF
*
99998 FORMAT (' ERROR: This test is only intended for ODE problems')
99997 FORMAT (' ',A,' (',A,' , ',A,') with SOLVER ',I2)
99996 FORMAT (' INFO on exit from ODESolver = ',I3)
99995 FORMAT (' IWARN on exit from ODESolver = ',I3)
99994 FORMAT (' Solution: (calculated) (reference)')
99993 FORMAT (F,F)
99992 FORMAT (' Relative error comparing with the reference solution:'
$
,E,/1X)
* *** Last line of TEST ***
END
SUBROUTINE ODEDER_( NX, NU, T, X,
U, RPAR, IPAR, F, INFO )
*
*
* PURPOSE
*
* Interface routine between ODESolver and
the problem function FEVAL
*
* ARGUMENTS
*
* Input/Output Parameters
*
* NX
(input) INTEGER
*
Dimension of the state vector.
*
* NU
(input) INTEGER
*
Dimension of the input vector.
*
* T
(input) INTEGER
*
The time point where the function is evaluated.
*
* X
(input) DOUBLE PRECISION array, dimension (NX)
*
Array containing the state variables.
*
* U
(input) DOUBLE PRECISION array, dimension (NU)
*
Array containing the input values.
*
* RPAR (input/output)
DOUBLE PRECISION array
*
Array for communication between the driver and FEVAL.
*
* IPAR (input/output)
INTEGER array
*
Array for communication between the driver and FEVAL.
*
* F
(output) DOUBLE PRECISION array, dimension (NX)
*
The resulting function value f(T,X).
*
* Error Indicator
*
* INFO INTEGER
*
Return values of error from FEVAL or 100 in case
*
a bad problem was choosen.
*
* METHOD
*
* REFERENCES
*
* CONTRIBUTORS
*
* REVISIONS
*
* -
*
* KEYWORDS
*
*
* ******************************************************************
*
* .. Scalar Arguments ..
INTEGER
NX, NU, INFO
DOUBLE PRECISION T
* .. Array Arguments ..
INTEGER
IPAR(*)
DOUBLE PRECISION X(NX), U(NU), RPAR(*),
F(NX)
* .. External Subroutines ..
EXTERNAL
FLSODEX
* .. Executable Statements ..
CALL FLSODEX(NX,T,X,X,F,INFO,RPAR,IPAR)
* *** Last line of ODEDER_ ***
END
SUBROUTINE JACFX_( NX, DUMMY,
LDFX, T, X, DUMMY2, RPAR, IPAR, FX,
$
INFO )
*
*
* PURPOSE
*
* Interface routine between ODESolver and
the problem function JEVAL
*
* ARGUMENTS
*
* Input/Output Parameters
*
* NX
(input) INTEGER
*
Dimension of the state vector.
*
* DUMMY (input) INTEGER
*
* LDFX (input)
INTEGER
*
The leading dimension of the array FX.
*
* T
(input) INTEGER
*
The time point where the derivative is evaluated.
*
* X
(input) DOUBLE PRECISION array, dimension (NX)
*
Array containing the state variables.
*
* DUMMY2 (input) DOUBLE PRECISION
*
* RPAR (input/output)
DOUBLE PRECISION array
*
Array for communication between the driver and FEVAL.
*
* IPAR (input/output)
INTEGER array
*
Array for communication between the driver and FEVAL.
*
* FX
(output) DOUBLE PRECISION array, dimension (LDFX,NX)
*
The array with the resulting Jacobian matrix.
*
* Error Indicator
*
* INFO INTEGER
*
Return values of error from JEVAL or 100 in case
*
a bad problem was choosen.
*
* METHOD
*
* REFERENCES
*
* CONTRIBUTORS
*
* REVISIONS
*
* -
*
* KEYWORDS
*
*
* ******************************************************************
*
* .. Scalar Arguments ..
INTEGER
NX, DUMMY, LDFX, INFO
DOUBLE PRECISION T
* .. Array Arguments ..
INTEGER
IPAR(*)
DOUBLE PRECISION X(NX), DUMMY2(*),
RPAR(*), FX(NX)
* .. External Subroutines ..
EXTERNAL
JLSODEX
* .. Executable Statements ..
CALL JLSODEX(LDFX,NX,T,X,X,FX,INFO,RPAR,IPAR)
* *** Last line of JACFX_ ***
END
Program Data
No data requiredProgram Results
ODESOLVER EXAMPLE PROGRAM RESULTS Problem: LSODEX Solver: LSODE IWARN on exit from ODESolver = 1 Solution: (calculated) 8.287534436182735E-08 3.329129749822125E-13 1.118553835127275E-07
Return to index
SLICOT-SLICOT-Reference-a037f7e/doc/SB01BD.html 0000664 0000000 0000000 00000037574 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To determine the state feedback matrix F for a given system (A,B) such that the closed-loop state matrix A+B*F has specified eigenvalues.Specification
SUBROUTINE SB01BD( DICO, N, M, NP, ALPHA, A, LDA, B, LDB, WR, WI, $ NFP, NAP, NUP, F, LDF, Z, LDZ, TOL, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO INTEGER INFO, IWARN, LDA, LDB, LDF, LDWORK, LDZ, M, N, $ NAP, NFP, NP, NUP DOUBLE PRECISION ALPHA, TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), F(LDF,*), $ WI(*), WR(*), Z(LDZ,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system.Input/Output Parameters
N (input) INTEGER The dimension of the state vector, i.e. the order of the matrix A, and also the number of rows of the matrix B and the number of columns of the matrix F. N >= 0. M (input) INTEGER The dimension of input vector, i.e. the number of columns of the matrix B and the number of rows of the matrix F. M >= 0. NP (input) INTEGER The number of given eigenvalues. At most N eigenvalues can be assigned. 0 <= NP. ALPHA (input) DOUBLE PRECISION Specifies the maximum admissible value, either for real parts, if DICO = 'C', or for moduli, if DICO = 'D', of the eigenvalues of A which will not be modified by the eigenvalue assignment algorithm. ALPHA >= 0 if DICO = 'D'. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, the leading N-by-N part of this array contains the matrix Z'*(A+B*F)*Z in a real Schur form. The leading NFP-by-NFP diagonal block of A corresponds to the fixed (unmodified) eigenvalues having real parts less than ALPHA, if DICO = 'C', or moduli less than ALPHA, if DICO = 'D'. The trailing NUP-by-NUP diagonal block of A corresponds to the uncontrollable eigenvalues detected by the eigenvalue assignment algorithm. The elements under the first subdiagonal are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). WR,WI (input/output) DOUBLE PRECISION array, dimension (NP) On entry, these arrays must contain the real and imaginary parts, respectively, of the desired eigenvalues of the closed-loop system state-matrix A+B*F. The eigenvalues can be unordered, except that complex conjugate pairs must appear consecutively in these arrays. On exit, if INFO = 0, the leading NAP elements of these arrays contain the real and imaginary parts, respectively, of the assigned eigenvalues. The trailing NP-NAP elements contain the unassigned eigenvalues. NFP (output) INTEGER The number of eigenvalues of A having real parts less than ALPHA, if DICO = 'C', or moduli less than ALPHA, if DICO = 'D'. These eigenvalues are not modified by the eigenvalue assignment algorithm. NAP (output) INTEGER The number of assigned eigenvalues. If INFO = 0 on exit, then NAP = N-NFP-NUP. NUP (output) INTEGER The number of uncontrollable eigenvalues detected by the eigenvalue assignment algorithm (see METHOD). F (output) DOUBLE PRECISION array, dimension (LDF,N) The leading M-by-N part of this array contains the state feedback F, which assigns NAP closed-loop eigenvalues and keeps unaltered N-NAP open-loop eigenvalues. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M). Z (output) DOUBLE PRECISION array, dimension (LDZ,N) The leading N-by-N part of this array contains the orthogonal matrix Z which reduces the closed-loop system state matrix A + B*F to upper real Schur form. LDZ INTEGER The leading dimension of array Z. LDZ >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION The absolute tolerance level below which the elements of A or B are considered zero (used for controllability tests). If the user sets TOL <= 0, then the default tolerance TOL = N * EPS * max(NORM(A),NORM(B)) is used, where EPS is the machine precision (see LAPACK Library routine DLAMCH) and NORM(A) denotes the 1-norm of A.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LDWORK >= MAX( 1,5*M,5*N,2*N+4*M ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = K: K violations of the numerical stability condition NORM(F) <= 100*NORM(A)/NORM(B) occured during the assignment of eigenvalues.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to a real Schur form failed; = 2: a failure was detected during the ordering of the real Schur form of A, or in the iterative process for reordering the eigenvalues of Z'*(A + B*F)*Z along the diagonal. = 3: the number of eigenvalues to be assigned is less than the number of possibly assignable eigenvalues; NAP eigenvalues have been properly assigned, but some assignable eigenvalues remain unmodified. = 4: an attempt is made to place a complex conjugate pair on the location of a real eigenvalue. This situation can only appear when N-NFP is odd, NP > N-NFP-NUP is even, and for the last real eigenvalue to be modified there exists no available real eigenvalue to be assigned. However, NAP eigenvalues have been already properly assigned.Method
SB01BD is based on the factorization algorithm of [1]. Given the matrices A and B of dimensions N-by-N and N-by-M, respectively, this subroutine constructs an M-by-N matrix F such that A + BF has eigenvalues as follows. Let NFP eigenvalues of A have real parts less than ALPHA, if DICO = 'C', or moduli less then ALPHA, if DICO = 'D'. Then: 1) If the pair (A,B) is controllable, then A + B*F has NAP = MIN(NP,N-NFP) eigenvalues assigned from those specified by WR + j*WI and N-NAP unmodified eigenvalues; 2) If the pair (A,B) is uncontrollable, then the number of assigned eigenvalues NAP satifies generally the condition NAP <= MIN(NP,N-NFP). At the beginning of the algorithm, F = 0 and the matrix A is reduced to an ordered real Schur form by separating its spectrum in two parts. The leading NFP-by-NFP part of the Schur form of A corresponds to the eigenvalues which will not be modified. These eigenvalues have real parts less than ALPHA, if DICO = 'C', or moduli less than ALPHA, if DICO = 'D'. The performed orthogonal transformations are accumulated in Z. After this preliminary reduction, the algorithm proceeds recursively. Let F be the feedback matrix at the beginning of a typical step i. At each step of the algorithm one real eigenvalue or two complex conjugate eigenvalues are placed by a feedback Fi of rank 1 or rank 2, respectively. Since the feedback Fi affects only the last 1 or 2 columns of Z'*(A+B*F)*Z, the matrix Z'*(A+B*F+B*Fi)*Z therefore remains in real Schur form. The assigned eigenvalue(s) is (are) then moved to another diagonal position of the real Schur form using reordering techniques and a new block is transfered in the last diagonal position. The feedback matrix F is updated as F <-- F + Fi. The eigenvalue(s) to be assigned at each step is (are) chosen such that the norm of each Fi is minimized. If uncontrollable eigenvalues are encountered in the last diagonal position of the real Schur matrix Z'*(A+B*F)*Z, the algorithm deflates them at the bottom of the real Schur form and redefines accordingly the position of the "last" block. Note: Not all uncontrollable eigenvalues of the pair (A,B) are necessarily detected by the eigenvalue assignment algorithm. Undetected uncontrollable eigenvalues may exist if NFP > 0 and/or NP < N-NFP.References
[1] Varga A. A Schur method for pole assignment. IEEE Trans. Autom. Control, Vol. AC-26, pp. 517-519, 1981.Numerical Aspects
3 The algorithm requires no more than 14N floating point operations. Although no proof of numerical stability is known, the algorithm has always been observed to yield reliable numerical results.Further Comments
NoneExample
Program Text
* SB01BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDF, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDF = MMAX, $ LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 5*MMAX,5*NMAX,2*NMAX+4*MMAX ) ) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, ANORM, NRM, TOL INTEGER I, INFO, IWARN, J, M, N, NAP, NFP, NP, NUP CHARACTER*1 DICO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), AIN(LDA,NMAX), B(LDB,MMAX), $ DWORK(LDWORK), F(LDF,NMAX), WI(NMAX), WR(NMAX), $ Z(LDZ,NMAX), ZTA(LDZ,NMAX) C .. External Functions .. LOGICAL LSAME DOUBLE PRECISION DLAMCH, DLANGE EXTERNAL DLAMCH, DLANGE, LSAME * .. External Subroutines .. EXTERNAL DGEMM, DLACPY, MB03QX, SB01BD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, NP, ALPHA, TOL, DICO IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF( NP.LT.0 .OR. NP.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) NP ELSE DO 10 I = 1, NP READ ( NIN, FMT = * ) WR(I), WI(I) 10 CONTINUE * Perform "eigenvalue assignment" to compute F. CALL DLACPY( 'G', N, N, A, LDA, AIN, LDA ) CALL SB01BD( DICO, N, M, NP, ALPHA, A, LDA, B, LDB, $ WR, WI, NFP, NAP, NUP, F, LDF, Z, LDZ, $ TOL, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 .AND. INFO.LT.3 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE IF ( INFO .NE. 0 ) WRITE ( NOUT, FMT = 99997 ) INFO IF ( IWARN .NE. 0 ) WRITE ( NOUT, FMT = 99991 ) IWARN WRITE ( NOUT, FMT = 99990 ) NAP WRITE ( NOUT, FMT = 99989 ) NFP WRITE ( NOUT, FMT = 99988 ) NUP WRITE ( NOUT, FMT = 99996 ) DO 60 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( F(I,J), J = 1,N ) 60 CONTINUE CALL MB03QX( N, A, LDA, WR, WI, INFO ) WRITE ( NOUT, FMT = 99998 ) ( WR(I), WI(I), I = 1,N ) * Compute NORM (Z*Aout*Z'-(A+B*F)) / (eps*NORM(A)) ANORM = DLANGE( 'F', N, N, AIN, LDA, DWORK ) CALL DGEMM( 'N', 'N', N, N, M, ONE, B, LDB, F, LDF, $ ONE, AIN, LDA ) CALL DGEMM( 'N', 'N', N, N, N, ONE, Z, LDZ, A, LDA, $ ZERO, ZTA, LDZ ) CALL DGEMM( 'N', 'T', N, N, N, ONE, ZTA, LDZ, Z, LDZ, $ -ONE, AIN, LDA ) NRM = DLANGE( 'F', N, N, AIN, LDA, DWORK ) / $ ( DLAMCH( 'E' )*ANORM ) WRITE ( NOUT, FMT = 99987 ) NRM END IF END IF END IF END IF STOP * 99999 FORMAT (' SB01BD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/,' The eigenvalues of closed-loop matrix A+B*F',/ $ ( ' ( ',F8.4,',',F8.4,' )' ) ) 99997 FORMAT (' INFO on exit from SB01BD = ',I2) 99996 FORMAT (/,' The state feedback matrix F is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' NP is out of range.',/' NP = ',I5) 99991 FORMAT (/' IWARN on exit from SB01BD = ', I2) 99990 FORMAT ( ' Number of assigned eigenvalues: NAP = ', I2 ) 99989 FORMAT ( ' Number of fixed eigenvalues: NFP = ', I2) 99988 FORMAT ( ' Number of uncontrollable poles: NUP = ', I2) 99987 FORMAT (/,' NORM(A+B*F - Z*Aout*Z'') / (eps*NORM(A)) =',1PD12.5) ENDProgram Data
SB01BD EXAMPLE PROGRAM DATA 4 2 2 -.4 1.E-8 C -6.8000 0.0000 -207.0000 0.0000 1.0000 0.0000 0.0000 0.0000 43.2000 0.0000 0.0000 -4.2000 0.0000 0.0000 1.0000 0.0000 5.6400 0.0000 0.0000 0.0000 0.0000 1.1800 0.0000 0.0000 -0.5000 0.1500 -0.5000 -0.1500 -2.0000 0.0000 -0.4000 0.0000Program Results
SB01BD EXAMPLE PROGRAM RESULTS Number of assigned eigenvalues: NAP = 2 Number of fixed eigenvalues: NFP = 2 Number of uncontrollable poles: NUP = 0 The state feedback matrix F is -0.0876 -4.2138 0.0837 -18.1412 -0.0233 18.2483 -0.4259 -4.8120 The eigenvalues of closed-loop matrix A+B*F ( -3.3984, 94.5253 ) ( -3.3984,-94.5253 ) ( -0.5000, 0.1500 ) ( -0.5000, -0.1500 ) NORM(A+B*F - Z*Aout*Z') / (eps*NORM(A)) = 1.03505D+01
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB01BX.html 0000664 0000000 0000000 00000006510 14560147231 0020353 0 ustar 00root root 0000000 0000000
Purpose
To choose a real eigenvalue or a pair of complex conjugate eigenvalues at "minimal" distance to a given real or complex value.Specification
SUBROUTINE SB01BX( REIG, N, XR, XI, WR, WI, S, P ) C .. Scalar Arguments .. LOGICAL REIG INTEGER N DOUBLE PRECISION P, S, XI ,XR C .. Array Arguments .. DOUBLE PRECISION WI(*), WR(*)Arguments
Mode Parameters
REIG LOGICAL Specifies the type of eigenvalues as follows: = .TRUE., a real eigenvalue is to be selected; = .FALSE., a pair of complex eigenvalues is to be selected.Input/Output Parameters
N (input) INTEGER The number of eigenvalues contained in the arrays WR and WI. N >= 1. XR,XI (input) DOUBLE PRECISION If REIG = .TRUE., XR must contain the real value and XI is assumed zero and therefore not referenced. If REIG = .FALSE., XR must contain the real part and XI the imaginary part, respectively, of the complex value. WR,WI (input/output) DOUBLE PRECISION array, dimension (N) On entry, if REIG = .TRUE., WR must contain the real eigenvalues from which an eigenvalue at minimal distance to XR is to be selected. In this case, WI is considered zero and therefore not referenced. On entry, if REIG = .FALSE., WR and WI must contain the real and imaginary parts, respectively, of the eigenvalues from which a pair of complex conjugate eigenvalues at minimal "distance" to XR + jXI is to be selected. The eigenvalues of each pair of complex conjugate eigenvalues must appear consecutively. On exit, the elements of these arrays are reordered such that the selected eigenvalue(s) is (are) found in the last element(s) of these arrays. S,P (output) DOUBLE PRECISION If REIG = .TRUE., S (and also P) contains the value of the selected real eigenvalue. If REIG = .FALSE., S and P contain the sum and product, respectively, of the selected complex conjugate pair of eigenvalues.Further Comments
For efficiency reasons, |x| + |y| is used for a complex number x + jy, instead of its modulus.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve an N-by-N pole placement problem for the simple cases N = 1 or N = 2: given the N-by-N matrix A and N-by-M matrix B, construct an M-by-N matrix F such that A + B*F has prescribed eigenvalues. These eigenvalues are specified by their sum S and product P (if N = 2). The resulting F has minimum Frobenius norm.Specification
SUBROUTINE SB01BY( N, M, S, P, A, B, F, TOL, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, M, N DOUBLE PRECISION P, S, TOL C .. Array Arguments .. DOUBLE PRECISION A(N,*), B(N,*), DWORK(*), F(M,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A and also the number of rows of the matrix B and the number of columns of the matrix F. N is either 1, if a single real eigenvalue is prescribed or 2, if a complex conjugate pair or a set of two real eigenvalues are prescribed. M (input) INTEGER The number of columns of the matrix B and also the number of rows of the matrix F. M >= 1. S (input) DOUBLE PRECISION The sum of the prescribed eigenvalues if N = 2 or the value of prescribed eigenvalue if N = 1. P (input) DOUBLE PRECISION The product of the prescribed eigenvalues if N = 2. Not referenced if N = 1. A (input/output) DOUBLE PRECISION array, dimension (N,N) On entry, this array must contain the N-by-N state dynamics matrix whose eigenvalues have to be moved to prescribed locations. On exit, this array contains no useful information. B (input/output) DOUBLE PRECISION array, dimension (N,M) On entry, this array must contain the N-by-M input/state matrix B. On exit, this array contains no useful information. F (output) DOUBLE PRECISION array, dimension (M,N) The state feedback matrix F which assigns one pole or two poles of the closed-loop matrix A + B*F. If N = 2 and the pair (A,B) is not controllable (INFO = 1), then F(1,1) and F(1,2) contain the elements of an orthogonal rotation which can be used to remove the uncontrollable part of the pair (A,B).Tolerances
TOL DOUBLE PRECISION The absolute tolerance level below which the elements of A and B are considered zero (used for controllability test).Workspace
DWORK DOUBLE PRECISION array, dimension (M)Error Indicator
INFO INTEGER = 0: successful exit; = 1: if uncontrollability of the pair (A,B) is detected.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute for a controllable matrix pair ( A, B ) a matrix G such that the matrix A - B*G has the desired eigenstructure, specified by desired eigenvalues and free eigenvector elements. The pair ( A, B ) should be given in orthogonal canonical form as returned by the SLICOT Library routine AB01ND.Specification
SUBROUTINE SB01DD( N, M, INDCON, A, LDA, B, LDB, NBLK, WR, WI, $ Z, LDZ, Y, COUNT, G, LDG, TOL, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER COUNT, INDCON, INFO, LDA, LDB, LDG, LDWORK, $ LDZ, M, N DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ), NBLK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), $ G( LDG, * ), WI( * ), WR( * ), Y( * ), $ Z( LDZ, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A and the number of rows of the matrix B. N >= 0. M (input) INTEGER The number of columns of the matrix B. M >= 0. INDCON (input) INTEGER The controllability index of the pair ( A, B ). 0 <= INDCON <= N. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the N-by-N matrix A in orthogonal canonical form, as returned by SLICOT Library routine AB01ND. On exit, the leading N-by-N part of this array contains the real Schur form of the matrix A - B*G. The elements below the real Schur form of A are set to zero. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the N-by-M matrix B in orthogonal canonical form, as returned by SLICOT Library routine AB01ND. On exit, the leading N-by-M part of this array contains the transformed matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). NBLK (input) INTEGER array, dimension (N) The leading INDCON elements of this array must contain the orders of the diagonal blocks in the orthogonal canonical form of A, as returned by SLICOT Library routine AB01ND. The values of these elements must satisfy the following conditions: NBLK(1) >= NBLK(2) >= ... >= NBLK(INDCON), NBLK(1) + NBLK(2) + ... + NBLK(INDCON) = N. WR (input) DOUBLE PRECISION array, dimension (N) WI (input) DOUBLE PRECISION array, dimension (N) These arrays must contain the real and imaginary parts, respectively, of the desired poles of the closed-loop system, i.e., the eigenvalues of A - B*G. The poles can be unordered, except that complex conjugate pairs of poles must appear consecutively. The elements of WI for complex eigenvalues are modified internally, but restored on exit. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) On entry, the leading N-by-N part of this array must contain the orthogonal matrix Z generated by SLICOT Library routine AB01ND in the reduction of ( A, B ) to orthogonal canonical form. On exit, the leading N-by-N part of this array contains the orthogonal transformation matrix which reduces A - B*G to real Schur form. LDZ INTEGER The leading dimension of the array Z. LDZ >= max(1,N). Y (input) DOUBLE PRECISION array, dimension (M*N) Y contains elements which are used as free parameters in the eigenstructure design. The values of these parameters are often set by an external optimization procedure. COUNT (output) INTEGER The actual number of elements in Y used as free eigenvector and feedback matrix elements in the eigenstructure design. G (output) DOUBLE PRECISION array, dimension (LDG,N) The leading M-by-N part of this array contains the feedback matrix which assigns the desired eigenstructure of A - B*G. LDG INTEGER The leading dimension of the array G. LDG >= max(1,M).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determination when transforming (A, B). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(M*N,M*M+2*N+4*M+1). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the pair ( A, B ) is not controllable or the free parameters are not set appropriately.Method
The routine implements the method proposed in [1], [2].References
[1] Petkov, P.Hr., Konstantinov, M.M., Gu, D.W. and Postlethwaite, I. Optimal pole assignment design of linear multi-input systems. Report 96-11, Department of Engineering, Leicester University, 1996. [2] Petkov, P.Hr., Christov, N.D. and Konstantinov, M.M. A computational algorithm for pole assignment of linear multi input systems. IEEE Trans. Automatic Control, vol. AC-31, pp. 1044-1047, 1986.Numerical Aspects
The method implemented is backward stable.Further Comments
The eigenvalues of the real Schur form matrix As, returned in the array A, are very close to the desired eigenvalues WR+WI*i. However, the eigenvalues of the closed-loop matrix A - B*G, computed by the QR algorithm using the matrices A and B, given on entry, may be far from WR+WI*i, although the relative error norm( Z'*(A - B*G)*Z - As )/norm( As ) is close to machine accuracy. This may happen when the eigenvalue problem for the matrix A - B*G is ill-conditioned.Example
Program Text
* SB01DD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDG, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDG = MMAX, $ LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 3*NMAX, MMAX*NMAX, $ MMAX*MMAX + 2*NMAX + 4*MMAX + 1 ) $ ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER COUNT, I, INDCON, INFO1, INFO2, J, M, N, NCONT CHARACTER*1 JOBZ * .. Local Arrays .. INTEGER IWORK(MMAX), NBLK(NMAX) DOUBLE PRECISION A(LDA,NMAX), B(NMAX,MMAX), DWORK(LDWORK), $ G(LDG,NMAX), WI(NMAX), WR(NMAX), Y(MMAX*NMAX), $ Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL AB01ND, SB01DD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, TOL, JOBZ IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( WR(I), I = 1,N ) READ ( NIN, FMT = * ) ( WI(I), I = 1,N ) READ ( NIN, FMT = * ) ( Y(I), I = 1,M*N ) * First reduce the given system to canonical form. CALL AB01ND( JOBZ, N, M, A, LDA, B, LDB, NCONT, INDCON, $ NBLK, Z, LDZ, DWORK, TOL, IWORK, DWORK(N+1), $ LDWORK-N, INFO1 ) * IF ( INFO1.EQ.0 ) THEN * Find the state feedback matrix G. CALL SB01DD( N, M, INDCON, A, LDA, B, LDB, NBLK, WR, WI, $ Z, LDZ, Y, COUNT, G, LDG, TOL, IWORK, DWORK, $ LDWORK, INFO2 ) * IF ( INFO2.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO2 ELSE WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( G(I,J), J = 1,N ) 10 CONTINUE END IF ELSE WRITE ( NOUT, FMT = 99998 ) INFO1 END IF END IF END IF STOP * 99999 FORMAT (' SB01DD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB01ND =',I2) 99997 FORMAT (' INFO on exit from SB01DD =',I2) 99996 FORMAT (' The state feedback matrix G is') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
SB01DD EXAMPLE PROGRAM DATA 4 2 0.0 I -1.0 0.0 2.0 -3.0 1.0 -4.0 3.0 -1.0 0.0 2.0 4.0 -5.0 0.0 0.0 -1.0 -2.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 -1.0 -1.0 -1.0 -1.0 0.0 0.0 0.0 0.0 1.0 2.0 2.0 1.0 -1.0 -2.0 3.0 1.0Program Results
SB01DD EXAMPLE PROGRAM RESULTS The state feedback matrix G is -5.2339 3.1725 -15.7885 21.7043 -1.6022 0.8504 -5.1914 6.2339
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB01FY.html 0000664 0000000 0000000 00000007764 14560147231 0020374 0 ustar 00root root 0000000 0000000
Purpose
To compute the inner denominator of a right-coprime factorization of a system of order N, where N is either 1 or 2. Specifically, given the N-by-N unstable system state matrix A and the N-by-M system input matrix B, an M-by-N state-feedback matrix F and an M-by-M matrix V are constructed, such that the system (A + B*F, B*V, F, V) is inner.Specification
SUBROUTINE SB01FY( DISCR, N, M, A, LDA, B, LDB, F, LDF, V, LDV, $ INFO ) C .. Scalar Arguments .. LOGICAL DISCR INTEGER INFO, LDA, LDB, LDF, LDV, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), F(LDF,*), V(LDV,*)Arguments
Mode Parameters
DISCR LOGICAL Specifies the type of system as follows: = .FALSE.: continuous-time system; = .TRUE. : discrete-time system.Input/Output Parameters
N (input) INTEGER The order of the matrix A and also the number of rows of the matrix B and the number of columns of the matrix F. N is either 1 or 2. M (input) INTEGER The number of columns of the matrices B and V, and also the number of rows of the matrix F. M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A whose eigenvalues must have positive real parts if DISCR = .FALSE. or moduli greater than unity if DISCR = .TRUE.. LDA INTEGER The leading dimension of array A. LDA >= N. B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of array B. LDB >= N. F (output) DOUBLE PRECISION array, dimension (LDF,N) The leading M-by-N part of this array contains the state- feedback matrix F which assigns one eigenvalue (if N = 1) or two eigenvalues (if N = 2) of the matrix A + B*F in symmetric positions with respect to the imaginary axis (if DISCR = .FALSE.) or the unit circle (if DISCR = .TRUE.). LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M). V (output) DOUBLE PRECISION array, dimension (LDV,M) The leading M-by-M upper triangular part of this array contains the input/output matrix V of the resulting inner system in upper triangular form. If DISCR = .FALSE., the resulting V is an identity matrix. LDV INTEGER The leading dimension of array V. LDF >= MAX(1,M).Error Indicator
INFO INTEGER = 0: successful exit; = 1: if uncontrollability of the pair (A,B) is detected; = 2: if A is stable or at the stability limit; = 3: if N = 2 and A has a pair of real eigenvalues.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To determine the one-dimensional state feedback matrix G of the linear time-invariant single-input system dX/dt = A * X + B * U, where A is an NCONT-by-NCONT matrix and B is an NCONT element vector such that the closed-loop system dX/dt = (A - B * G) * X has desired poles. The system must be preliminarily reduced to orthogonal canonical form using the SLICOT Library routine AB01MD.Specification
SUBROUTINE SB01MD( NCONT, N, A, LDA, B, WR, WI, Z, LDZ, G, DWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDZ, N, NCONT C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(*), DWORK(*), G(*), WI(*), WR(*), $ Z(LDZ,*)Arguments
Input/Output Parameters
NCONT (input) INTEGER The order of the matrix A as produced by SLICOT Library routine AB01MD. NCONT >= 0. N (input) INTEGER The order of the matrix Z. N >= NCONT. A (input/output) DOUBLE PRECISION array, dimension (LDA,NCONT) On entry, the leading NCONT-by-NCONT part of this array must contain the canonical form of the state dynamics matrix A as produced by SLICOT Library routine AB01MD. On exit, the leading NCONT-by-NCONT part of this array contains the upper quasi-triangular form S of the closed- loop system matrix (A - B * G), that is triangular except for possible 2-by-2 diagonal blocks. (To reconstruct the closed-loop system matrix see FURTHER COMMENTS below.) LDA INTEGER The leading dimension of array A. LDA >= MAX(1,NCONT). B (input/output) DOUBLE PRECISION array, dimension (NCONT) On entry, this array must contain the canonical form of the input/state vector B as produced by SLICOT Library routine AB01MD. On exit, this array contains the transformed vector Z * B of the closed-loop system. WR (input) DOUBLE PRECISION array, dimension (NCONT) WI (input) DOUBLE PRECISION array, dimension (NCONT) These arrays must contain the real and imaginary parts, respectively, of the desired poles of the closed-loop system. The poles can be unordered, except that complex conjugate pairs of poles must appear consecutively. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) On entry, the leading N-by-N part of this array must contain the orthogonal transformation matrix as produced by SLICOT Library routine AB01MD, which reduces the system to canonical form. On exit, the leading NCONT-by-NCONT part of this array contains the orthogonal matrix Z which reduces the closed- loop system matrix (A - B * G) to upper quasi-triangular form. LDZ INTEGER The leading dimension of array Z. LDZ >= MAX(1,N). G (output) DOUBLE PRECISION array, dimension (NCONT) This array contains the one-dimensional state feedback matrix G of the original system.Workspace
DWORK DOUBLE PRECISION array, dimension (3*NCONT)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The method is based on the orthogonal reduction of the closed-loop system matrix (A - B * G) to upper quasi-triangular form S whose 1-by-1 and 2-by-2 diagonal blocks correspond to the desired poles. That is, S = Z'*(A - B * G)*Z, where Z is an orthogonal matrix.References
[1] Petkov, P. Hr. A Computational Algorithm for Pole Assignment of Linear Single Input Systems. Internal Report 81/2, Control Systems Research Group, School of Electronic Engineering and Computer Science, Kingston Polytechnic, 1981.Numerical Aspects
3 The algorithm requires 0(NCONT ) operations and is backward stable.Further Comments
If required, the closed-loop system matrix (A - B * G) can be formed from the matrix product Z * S * Z' (where S and Z are the matrices output in arrays A and Z respectively).Example
Program Text
* SB01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDZ PARAMETER ( LDA = NMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO1, INFO2, J, N, NCONT CHARACTER*1 JOBZ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(NMAX), DWORK(LDWORK), G(NMAX), $ WI(NMAX), WR(NMAX), Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL AB01MD, SB01MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, TOL, JOBZ IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( B(I), I = 1,N ) READ ( NIN, FMT = * ) ( WR(I), I = 1,N ) READ ( NIN, FMT = * ) ( WI(I), I = 1,N ) * First reduce the given system to canonical form. CALL AB01MD( JOBZ, N, A, LDA, B, NCONT, Z, LDZ, DWORK, TOL, $ DWORK(N+1), LDWORK-N, INFO1 ) * IF ( INFO1.EQ.0 ) THEN * Find the one-dimensional state feedback matrix G. CALL SB01MD( NCONT, N, A, LDA, B, WR, WI, Z, LDZ, G, DWORK, $ INFO2 ) * IF ( INFO2.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO2 ELSE WRITE ( NOUT, FMT = 99996 ) ( G(I), I = 1,NCONT ) END IF ELSE WRITE ( NOUT, FMT = 99998 ) INFO1 END IF END IF STOP * 99999 FORMAT (' SB01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB01MD =',I2) 99997 FORMAT (' INFO on exit from SB01MD =',I2) 99996 FORMAT (' The one-dimensional state feedback matrix G is', $ /20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
SB01MD EXAMPLE PROGRAM DATA 4 0.0 I -1.0 0.0 2.0 -3.0 1.0 -4.0 3.0 -1.0 0.0 2.0 4.0 -5.0 0.0 0.0 -1.0 -2.0 1.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 0.0 0.0 0.0 0.0Program Results
SB01MD EXAMPLE PROGRAM RESULTS The one-dimensional state feedback matrix G is 1.0000 29.0000 93.0000 -76.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB02MD.html 0000664 0000000 0000000 00000036662 14560147231 0020356 0 ustar 00root root 0000000 0000000
Purpose
To solve for X either the continuous-time algebraic Riccati equation -1 Q + A'*X + X*A - X*B*R B'*X = 0 (1) or the discrete-time algebraic Riccati equation -1 X = A'*X*A - A'*X*B*(R + B'*X*B) B'*X*A + Q (2) where A, B, Q and R are N-by-N, N-by-M, N-by-N and M-by-M matrices respectively, with Q symmetric and R symmetric nonsingular; X is an N-by-N symmetric matrix. -1 The matrix G = B*R B' must be provided on input, instead of B and R, that is, for instance, the continuous-time equation Q + A'*X + X*A - X*G*X = 0 (3) is solved, where G is an N-by-N symmetric matrix. SLICOT Library routine SB02MT should be used to compute G, given B and R. SB02MT also enables to solve Riccati equations corresponding to optimal problems with coupling terms. The routine also returns the computed values of the closed-loop spectrum of the optimal system, i.e., the stable eigenvalues lambda(1),...,lambda(N) of the corresponding Hamiltonian or symplectic matrix associated to the optimal problem.Specification
SUBROUTINE SB02MD( DICO, HINV, UPLO, SCAL, SORT, N, A, LDA, G, $ LDG, Q, LDQ, RCOND, WR, WI, S, LDS, U, LDU, $ IWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, HINV, SCAL, SORT, UPLO INTEGER INFO, LDA, LDG, LDQ, LDS, LDU, LDWORK, N DOUBLE PRECISION RCOND C .. Array Arguments .. LOGICAL BWORK(*) INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), DWORK(*), G(LDG,*), Q(LDQ,*), $ S(LDS,*), U(LDU,*), WR(*), WI(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of Riccati equation to be solved as follows: = 'C': Equation (3), continuous-time case; = 'D': Equation (2), discrete-time case. HINV CHARACTER*1 If DICO = 'D', specifies which symplectic matrix is to be constructed, as follows: = 'D': The matrix H in (5) (see METHOD) is constructed; = 'I': The inverse of the matrix H in (5) is constructed. HINV is not used if DICO = 'C'. UPLO CHARACTER*1 Specifies which triangle of the matrices G and Q is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored. SCAL CHARACTER*1 Specifies whether or not a scaling strategy should be used, as follows: = 'G': General scaling should be used; = 'N': No scaling should be used. SORT CHARACTER*1 Specifies which eigenvalues should be obtained in the top of the Schur form, as follows: = 'S': Stable eigenvalues come first; = 'U': Unstable eigenvalues come first.Input/Output Parameters
N (input) INTEGER The order of the matrices A, Q, G and X. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the coefficient matrix A of the equation. On exit, if DICO = 'D', and INFO = 0 or INFO > 1, the -1 leading N-by-N part of this array contains the matrix A . Otherwise, the array A is unchanged on exit. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). G (input) DOUBLE PRECISION array, dimension (LDG,N) The leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix G. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. LDG INTEGER The leading dimension of array G. LDG >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix Q. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not used. On exit, if INFO = 0, the leading N-by-N part of this array contains the solution matrix X of the problem. LDQ INTEGER The leading dimension of array N. LDQ >= MAX(1,N). RCOND (output) DOUBLE PRECISION An estimate of the reciprocal of the condition number (in the 1-norm) of the N-th order system of algebraic equations from which the solution matrix X is obtained. WR (output) DOUBLE PRECISION array, dimension (2*N) WI (output) DOUBLE PRECISION array, dimension (2*N) If INFO = 0 or INFO = 5, these arrays contain the real and imaginary parts, respectively, of the eigenvalues of the 2N-by-2N matrix S, ordered as specified by SORT (except for the case HINV = 'D', when the order is opposite to that specified by SORT). The leading N elements of these arrays contain the closed-loop spectrum of the system -1 matrix A - B*R *B'*X, if DICO = 'C', or of the matrix -1 A - B*(R + B'*X*B) B'*X*A, if DICO = 'D'. Specifically, lambda(k) = WR(k) + j*WI(k), for k = 1,2,...,N. S (output) DOUBLE PRECISION array, dimension (LDS,2*N) If INFO = 0 or INFO = 5, the leading 2N-by-2N part of this array contains the ordered real Schur form S of the Hamiltonian or symplectic matrix H. That is, (S S ) ( 11 12) S = ( ), (0 S ) ( 22) where S , S and S are N-by-N matrices. 11 12 22 LDS INTEGER The leading dimension of array S. LDS >= MAX(1,2*N). U (output) DOUBLE PRECISION array, dimension (LDU,2*N) If INFO = 0 or INFO = 5, the leading 2N-by-2N part of this array contains the transformation matrix U which reduces the Hamiltonian or symplectic matrix H to the ordered real Schur form S. That is, (U U ) ( 11 12) U = ( ), (U U ) ( 21 22) where U , U , U and U are N-by-N matrices. 11 12 21 22 LDU INTEGER The leading dimension of array U. LDU >= MAX(1,2*N).Workspace
IWORK INTEGER array, dimension (2*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK and DWORK(2) returns the scaling factor used (set to 1 if SCAL = 'N'), also set if INFO = 5; if DICO = 'D', DWORK(3) returns the reciprocal condition number of the given matrix A. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(2,6*N) if DICO = 'C'; LDWORK >= MAX(3,6*N) if DICO = 'D'. For optimum performance LDWORK should be larger. BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if matrix A is (numerically) singular in discrete- time case; = 2: if the Hamiltonian or symplectic matrix H cannot be reduced to real Schur form; = 3: if the real Schur form of the Hamiltonian or symplectic matrix H cannot be appropriately ordered; = 4: if the Hamiltonian or symplectic matrix H has less than N stable eigenvalues; = 5: if the N-th order system of linear algebraic equations, from which the solution matrix X would be obtained, is singular to working precision.Method
The method used is the Schur vector approach proposed by Laub. It is assumed that [A,B] is a stabilizable pair (where for (3) B is any matrix such that B*B' = G with rank(B) = rank(G)), and [E,A] is a detectable pair, where E is any matrix such that E*E' = Q with rank(E) = rank(Q). Under these assumptions, any of the algebraic Riccati equations (1)-(3) is known to have a unique non-negative definite solution. See [2]. Now consider the 2N-by-2N Hamiltonian or symplectic matrix ( A -G ) H = ( ), (4) (-Q -A'), for continuous-time equation, and -1 -1 ( A A *G ) H = ( -1 -1 ), (5) (Q*A A' + Q*A *G) -1 for discrete-time equation, respectively, where G = B*R *B'. The assumptions guarantee that H in (4) has no pure imaginary eigenvalues, and H in (5) has no eigenvalues on the unit circle. If Y is an N-by-N matrix then there exists an orthogonal matrix U such that U'*Y*U is an upper quasi-triangular matrix. Moreover, U can be chosen so that the 2-by-2 and 1-by-1 diagonal blocks (corresponding to the complex conjugate eigenvalues and real eigenvalues respectively) appear in any desired order. This is the ordered real Schur form. Thus, we can find an orthogonal similarity transformation U which puts (4) or (5) in ordered real Schur form U'*H*U = S = (S(1,1) S(1,2)) ( 0 S(2,2)) where S(i,j) is an N-by-N matrix and the eigenvalues of S(1,1) have negative real parts in case of (4), or moduli greater than one in case of (5). If U is conformably partitioned into four N-by-N blocks U = (U(1,1) U(1,2)) (U(2,1) U(2,2)) with respect to the assumptions we then have (a) U(1,1) is invertible and X = U(2,1)*inv(U(1,1)) solves (1), (2), or (3) with X = X' and non-negative definite; (b) the eigenvalues of S(1,1) (if DICO = 'C') or S(2,2) (if DICO = 'D') are equal to the eigenvalues of optimal system (the 'closed-loop' spectrum). [A,B] is stabilizable if there exists a matrix F such that (A-BF) is stable. [E,A] is detectable if [A',E'] is stabilizable.References
[1] Laub, A.J. A Schur Method for Solving Algebraic Riccati equations. IEEE Trans. Auto. Contr., AC-24, pp. 913-921, 1979. [2] Wonham, W.M. On a matrix Riccati equation of stochastic control. SIAM J. Contr., 6, pp. 681-697, 1968. [3] Sima, V. Algorithms for Linear-Quadratic Optimization. Pure and Applied Mathematics: A Series of Monographs and Textbooks, vol. 200, Marcel Dekker, Inc., New York, 1996.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
To obtain a stabilizing solution of the algebraic Riccati equation for DICO = 'D', set SORT = 'U', if HINV = 'D', or set SORT = 'S', if HINV = 'I'. The routine can also compute the anti-stabilizing solutions of the algebraic Riccati equations, by specifying SORT = 'U' if DICO = 'D' and HINV = 'I', or DICO = 'C', or SORT = 'S' if DICO = 'D' and HINV = 'D'. Usually, the combinations HINV = 'D' and SORT = 'U', or HINV = 'I' and SORT = 'U', will be faster then the other combinations [3].Example
Program Text
* SB02MD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDG, LDQ, LDS, LDU PARAMETER ( LDA = NMAX, LDG = NMAX, LDQ = NMAX, $ LDS = 2*NMAX, LDU = 2*NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 2*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 6*NMAX ) * .. Local Scalars .. DOUBLE PRECISION RCOND INTEGER I, INFO, J, N CHARACTER DICO, HINV, SCAL, SORT, UPLO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), G(LDG,NMAX), $ Q(LDQ,NMAX), S(LDS,2*NMAX), U(LDU,2*NMAX), $ WI(2*NMAX), WR(2*NMAX) INTEGER IWORK(LIWORK) LOGICAL BWORK(LIWORK) * .. External Subroutines .. EXTERNAL SB02MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, DICO, HINV, UPLO, SCAL, SORT IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) 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 ) * Find the solution matrix X. CALL SB02MD( DICO, HINV, UPLO, SCAL, SORT, N, A, LDA, G, LDG, $ Q, LDQ, RCOND, WR, WI, S, LDS, U, LDU, IWORK, $ DWORK, LDWORK, BWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) RCOND DO 20 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( Q(I,J), J = 1,N ) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' SB02MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB02MD = ',I2) 99997 FORMAT (' RCOND = ',F4.2,//' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
SB02MD EXAMPLE PROGRAM DATA 2 C D U N S 0.0 1.0 0.0 0.0 1.0 0.0 0.0 2.0 0.0 0.0 0.0 1.0Program Results
SB02MD EXAMPLE PROGRAM RESULTS RCOND = 0.31 The solution matrix X is 2.0000 1.0000 1.0000 2.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB02MT.html 0000664 0000000 0000000 00000030637 14560147231 0020372 0 ustar 00root root 0000000 0000000
Purpose
To compute the following matrices -1 G = B*R *B', - -1 A = A - B*R *L', - -1 Q = Q - L*R *L', where A, B, Q, R, L, and G are N-by-N, N-by-M, N-by-N, M-by-M, N-by-M, and N-by-N matrices, respectively, with Q, R and G symmetric matrices. When R is well-conditioned with respect to inversion, standard algorithms for solving linear-quadratic optimization problems will then also solve optimization problems with coupling weighting matrix L. Moreover, a gain in efficiency is possible using matrix G in the deflating subspace algorithms (see SLICOT Library routine SB02OD) or in the Newton's algorithms (see SLICOT Library routine SG02CD).Specification
SUBROUTINE SB02MT( JOBG, JOBL, FACT, UPLO, N, M, A, LDA, B, LDB, $ Q, LDQ, R, LDR, L, LDL, IPIV, OUFACT, G, LDG, $ IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER FACT, JOBG, JOBL, UPLO INTEGER INFO, LDA, LDB, LDG, LDL, LDQ, LDR, LDWORK, M, $ N, OUFACT C .. Array Arguments .. INTEGER IPIV(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), G(LDG,*), $ L(LDL,*), Q(LDQ,*), R(LDR,*)Arguments
Mode Parameters
JOBG CHARACTER*1 Specifies whether or not the matrix G is to be computed, as follows: = 'G': Compute G; = 'N': Do not compute G. JOBL CHARACTER*1 Specifies whether or not the matrix L is zero, as follows: = 'Z': L is zero; = 'N': L is nonzero. FACT CHARACTER*1 Specifies how the matrix R is given (factored or not), as follows: = 'N': Array R contains the matrix R; = 'C': Array R contains the Cholesky factor of R; = 'U': Array R contains the factors of the symmetric indefinite UdU' or LdL' factorization of R. UPLO CHARACTER*1 Specifies which triangle of the matrices R, Q (if JOBL = 'N'), and G (if JOBG = 'G') is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored.Input/Output Parameters
N (input) INTEGER The order of the matrices A, Q, and G, and the number of rows of the matrices B and L. N >= 0. M (input) INTEGER The order of the matrix R, and the number of columns of the matrices B and L. M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if JOBL = 'N', the leading N-by-N part of this array must contain the matrix A. On exit, if JOBL = 'N', and INFO = 0, the leading N-by-N - -1 part of this array contains the matrix A = A - B*R L'. If JOBL = 'Z', this array is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N) if JOBL = 'N'; LDA >= 1 if JOBL = 'Z'. B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the matrix B. On exit, if OUFACT = 1, and INFO = 0, the leading N-by-M -1 part of this array contains the matrix B*chol(R) . On exit, B is unchanged if OUFACT <> 1 (hence also when FACT = 'U'). LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, if JOBL = 'N', the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix Q. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. On exit, if JOBL = 'N' and INFO = 0, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the upper triangular part or lower triangular part, respectively, of - -1 the symmetric matrix Q = Q - L*R *L'. If JOBL = 'Z', this array is not referenced. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,N) if JOBL = 'N'; LDQ >= 1 if JOBL = 'Z'. R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry, if FACT = 'N', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric input weighting matrix R. On entry, if FACT = 'C', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the Cholesky factor of the positive definite input weighting matrix R (as produced by LAPACK routine DPOTRF). On entry, if FACT = 'U', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the factors of the UdU' or LdL' factorization, respectively, of the symmetric indefinite input weighting matrix R (as produced by LAPACK routine DSYTRF). If FACT = 'N', the strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') of this array is used as workspace (filled in by symmetry). On exit, if OUFACT = 1, and INFO = 0 (or INFO = M+1), the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the Cholesky factor of the given input weighting matrix. On exit, if OUFACT = 2, and INFO = 0 (or INFO = M+1), the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the factors of the UdU' or LdL' factorization, respectively, of the given input weighting matrix. On exit R is unchanged if FACT = 'C' or 'U'. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M). L (input/output) DOUBLE PRECISION array, dimension (LDL,M) On entry, if JOBL = 'N', the leading N-by-M part of this array must contain the matrix L. On exit, if JOBL = 'N', OUFACT = 1, and INFO = 0, the leading N-by-M part of this array contains the matrix -1 L*chol(R) . On exit, L is unchanged if OUFACT <> 1 (hence also when FACT = 'U'). L is not referenced if JOBL = 'Z'. LDL INTEGER The leading dimension of array L. LDL >= MAX(1,N) if JOBL = 'N'; LDL >= 1 if JOBL = 'Z'. IPIV (input/output) INTEGER array, dimension (M) On entry, if FACT = 'U', this array must contain details of the interchanges performed and the block structure of the d factor in the UdU' or LdL' factorization of matrix R (as produced by LAPACK routine DSYTRF). On exit, if OUFACT = 2, this array contains details of the interchanges performed and the block structure of the d factor in the UdU' or LdL' factorization of matrix R, as produced by LAPACK routine DSYTRF. This array is not referenced if FACT = 'C'. OUFACT (output) INTEGER Information about the factorization finally used. OUFACT = 0: no factorization of R has been used (M = 0); OUFACT = 1: Cholesky factorization of R has been used; OUFACT = 2: UdU' (if UPLO = 'U') or LdL' (if UPLO = 'L') factorization of R has been used. G (output) DOUBLE PRECISION array, dimension (LDG,N) If JOBG = 'G', and INFO = 0, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the upper triangular part (if UPLO = 'U') or lower triangular part -1 (if UPLO = 'L'), respectively, of the matrix G = B*R B'. If JOBG = 'N', this array is not referenced. LDG INTEGER The leading dimension of array G. LDG >= MAX(1,N) if JOBG = 'G'; LDG >= 1 if JOBG = 'N'.Workspace
IWORK INTEGER array, dimension (M) If FACT = 'C' or FACT = 'U', this array is not referenced. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or LDWORK = -1, DWORK(1) returns the optimal value of LDWORK; if FACT = 'N' and LDWORK is set as specified below, DWORK(2) contains the reciprocal condition number of the given matrix R. On exit, if LDWORK = -2 on input or INFO = -23, then DWORK(1) returns the minimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1 if FACT = 'C' or (FACT = 'U' and JOBG = 'N' and JOBL = 'Z'); LDWORK >= MAX(2,3*M) if FACT = 'N' and JOBG = 'N' and JOBL = 'Z'; LDWORK >= MAX(2,3*M,N*M) if FACT = 'N' and (JOBG = 'G' or JOBL = 'N'); LDWORK >= MAX(1,N*M) if FACT = 'U' and (JOBG = 'G' or JOBL = 'N'). For optimum performance LDWORK should be larger than 3*M, if FACT = 'N'. If LDWORK = -1, an optimal 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 is issued by XERBLA. If LDWORK = -2, a minimal workspace query is assumed; the routine only calculates the minimal size of the DWORK array, returns this value as the first entry of the DWORK array, and no error message is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = i: if the i-th element (1 <= i <= M) of the d factor is exactly zero; the UdU' (or LdL') factorization has been completed, but the block diagonal matrix d is exactly singular; = M+1: if the matrix R is numerically singular.Method
- - The matrices G, and/or A and Q are evaluated using the given or computed symmetric factorization of R.Numerical Aspects
The routine should not be used when R is ill-conditioned.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB02MU.html 0000664 0000000 0000000 00000015453 14560147231 0020372 0 ustar 00root root 0000000 0000000
Purpose
To construct the 2n-by-2n Hamiltonian or symplectic matrix S associated to the linear-quadratic optimization problem, used to solve the continuous- or discrete-time algebraic Riccati equation, respectively. For a continuous-time problem, S is defined by ( A -G ) S = ( ), (1) ( -Q -A') and for a discrete-time problem by -1 -1 ( A A *G ) S = ( -1 -1 ), (2) ( QA A' + Q*A *G ) or -T -T ( A + G*A *Q -G*A ) S = ( -T -T ), (3) ( -A *Q A ) where A, G, and Q are N-by-N matrices, with G and Q symmetric. Matrix A must be nonsingular in the discrete-time case.Specification
SUBROUTINE SB02MU( DICO, HINV, UPLO, N, A, LDA, G, LDG, Q, LDQ, S, $ LDS, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, HINV, UPLO INTEGER INFO, LDA, LDG, LDQ, LDS, LDWORK, N C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), DWORK(*), G(LDG,*), Q(LDQ,*), $ S(LDS,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system as follows: = 'C': Continuous-time system; = 'D': Discrete-time system. HINV CHARACTER*1 If DICO = 'D', specifies which of the matrices (2) or (3) is constructed, as follows: = 'D': The matrix S in (2) is constructed; = 'I': The (inverse) matrix S in (3) is constructed. HINV is not referenced if DICO = 'C'. UPLO CHARACTER*1 Specifies which triangle of the matrices G and Q is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored.Input/Output Parameters
N (input) INTEGER The order of the matrices A, G, and Q. N >= 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, if DICO = 'D', and INFO = 0, the leading N-by-N -1 part of this array contains the matrix A . Otherwise, the array A is unchanged on exit. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). G (input) DOUBLE PRECISION array, dimension (LDG,N) The leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix G. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. LDG INTEGER The leading dimension of array G. LDG >= MAX(1,N). Q (input) DOUBLE PRECISION array, dimension (LDQ,N) The leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix Q. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,N). S (output) DOUBLE PRECISION array, dimension (LDS,2*N) If INFO = 0, the leading 2N-by-2N part of this array contains the Hamiltonian or symplectic matrix of the problem. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,2*N).Workspace
IWORK INTEGER array, dimension (2*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK; if DICO = 'D', DWORK(2) returns the reciprocal condition number of the given matrix A. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1 if DICO = 'C'; LDWORK >= MAX(2,4*N) if DICO = 'D'. For optimum performance LDWORK should be larger, if DICO = 'D'. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = i: if the leading i-by-i (1 <= i <= N) upper triangular submatrix of A is singular in discrete-time case; = N+1: if matrix A is numerically singular in discrete- time case.Method
For a continuous-time problem, the 2n-by-2n Hamiltonian matrix (1) is constructed. For a discrete-time problem, the 2n-by-2n symplectic matrix (2) or (3) - the inverse of the matrix in (2) - is constructed.Numerical Aspects
The discrete-time case needs the inverse of the matrix A, hence the routine should not be used when A is ill-conditioned. 3 The algorithm requires 0(n ) floating point operations in the discrete-time case.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the following matrices -1 G = B*R *B', - -1 A = A +/- op(B*R *L'), - -1 Q = Q +/- L*R *L', where A, B, Q, R, L, and G are N-by-N, N-by-M, N-by-N, M-by-M, N-by-M, and N-by-N matrices, respectively, with Q, R and G symmetric matrices, and op(W) is one of op(W) = W or op(W) = W'. When R is well-conditioned with respect to inversion, standard algorithms for solving linear-quadratic optimization problems will then also solve optimization problems with coupling weighting matrix L. Moreover, a gain in efficiency is possible using matrix G in the deflating subspace algorithms (see SLICOT Library routine SB02OD) or in the Newton's algorithms (see SLICOT Library routine SG02CD).Specification
SUBROUTINE SB02MX( JOBG, JOBL, FACT, UPLO, TRANS, FLAG, DEF, N, M, $ A, LDA, B, LDB, Q, LDQ, R, LDR, L, LDL, IPIV, $ OUFACT, G, LDG, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DEF, FACT, FLAG, JOBG, JOBL, TRANS, UPLO INTEGER INFO, LDA, LDB, LDG, LDL, LDQ, LDR, LDWORK, M, $ N, OUFACT C .. Array Arguments .. INTEGER IPIV(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), G(LDG,*), $ L(LDL,*), Q(LDQ,*), R(LDR,*)Arguments
Mode Parameters
JOBG CHARACTER*1 Specifies whether or not the matrix G is to be computed, as follows: = 'G': Compute G; = 'N': Do not compute G. JOBL CHARACTER*1 Specifies whether or not the matrix L is zero, as follows: = 'Z': L is zero; = 'N': L is nonzero. FACT CHARACTER*1 Specifies how the matrix R is given (factored or not), as follows: = 'N': Array R contains the matrix R; = 'C': Array R contains the Cholesky factor of R; = 'U': Array R contains the factors of the symmetric indefinite UdU' or LdL' factorization of R. UPLO CHARACTER*1 Specifies which triangle of the matrices R, Q (if JOBL = 'N'), and G (if JOBG = 'G') is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored. TRANS CHARACTER*1 Specifies the form of op(W) to be used in the matrix multiplication, as follows: = 'N': op(W) = W; = 'T': op(W) = W'; = 'C': op(W) = W'. FLAG CHARACTER*1 Specifies which sign is used, as follows: = 'P': The plus sign is used; = 'M': The minus sign is used. DEF CHARACTER*1 If FACT = 'N', specifies whether or not it is assumed that matrix R is positive definite, as follows: = 'D': Matrix R is assumed positive definite; = 'I': Matrix R is assumed indefinite. Both values can be used to perform the computations, irrespective to the R definiteness, but using the adequate value will save some computational effort (see FURTHER COMMENTS).Input/Output Parameters
N (input) INTEGER The order of the matrices A, Q, and G, and the number of rows of the matrices B and L. N >= 0. M (input) INTEGER The order of the matrix R, and the number of columns of the matrices B and L. M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if JOBL = 'N', the leading N-by-N part of this array must contain the matrix A. On exit, if JOBL = 'N', and INFO = 0, the leading N-by-N - part of this array contains the matrix A. If JOBL = 'Z', this array is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N) if JOBL = 'N'; LDA >= 1 if JOBL = 'Z'. B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the matrix B. On exit, if OUFACT = 1, and INFO = 0, the leading N-by-M -1 part of this array contains the matrix B*chol(R) . On exit, B is unchanged if OUFACT <> 1 (hence also when FACT = 'U'). LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, if JOBL = 'N', the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix Q. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. On exit, if JOBL = 'N' and INFO = 0, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the upper triangular part or lower triangular part, respectively, of - -1 the symmetric matrix Q = Q +/- L*R *L'. If JOBL = 'Z', this array is not referenced. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,N) if JOBL = 'N'; LDQ >= 1 if JOBL = 'Z'. R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry, if FACT = 'N', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric input weighting matrix R. On entry, if FACT = 'C', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the Cholesky factor of the positive definite input weighting matrix R (as produced by LAPACK routine DPOTRF). On entry, if FACT = 'U', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the factors of the UdU' or LdL' factorization, respectively, of the symmetric indefinite input weighting matrix R (as produced by LAPACK routine DSYTRF). If FACT = 'N' and DEF = 'D', the strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') of this array is used as workspace (filled in by symmetry). If FACT = 'N' and DEF = 'I', the strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is unchanged. On exit, if OUFACT = 1, and INFO = 0 (or INFO = M+1), the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the Cholesky factor of the given input weighting matrix. On exit, if OUFACT = 2, and INFO = 0 (or INFO = M+1), the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the factors of the UdU' or LdL' factorization, respectively, of the given input weighting matrix. On exit R is unchanged if FACT = 'C' or 'U'. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M). L (input/output) DOUBLE PRECISION array, dimension (LDL,M) On entry, if JOBL = 'N', the leading N-by-M part of this array must contain the matrix L. On exit, if JOBL = 'N', OUFACT = 1, and INFO = 0, the leading N-by-M part of this array contains the matrix -1 L*chol(R) . On exit, L is unchanged if OUFACT <> 1 (hence also when FACT = 'U'). L is not referenced if JOBL = 'Z'. LDL INTEGER The leading dimension of array L. LDL >= MAX(1,N) if JOBL = 'N'; LDL >= 1 if JOBL = 'Z'. IPIV (input/output) INTEGER array, dimension (M) On entry, if FACT = 'U', this array must contain details of the interchanges performed and the block structure of the d factor in the UdU' or LdL' factorization of matrix R (as produced by LAPACK routine DSYTRF). On exit, if OUFACT = 2, this array contains details of the interchanges performed and the block structure of the d factor in the UdU' or LdL' factorization of matrix R, as produced by LAPACK routine DSYTRF. This array is not referenced if FACT = 'C'. OUFACT (output) INTEGER Information about the factorization finally used. OUFACT = 0: no factorization of R has been used (M = 0); OUFACT = 1: Cholesky factorization of R has been used; OUFACT = 2: UdU' (if UPLO = 'U') or LdL' (if UPLO = 'L') factorization of R has been used. G (output) DOUBLE PRECISION array, dimension (LDG,N) If JOBG = 'G', and INFO = 0, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the upper triangular part (if UPLO = 'U') or lower triangular part -1 (if UPLO = 'L'), respectively, of the matrix G = B*R B'. If JOBG = 'N', this array is not referenced. LDG INTEGER The leading dimension of array G. LDG >= MAX(1,N) if JOBG = 'G'; LDG >= 1 if JOBG = 'N'.Workspace
IWORK INTEGER array, dimension (M) If FACT = 'C' or FACT = 'U', this array is not referenced. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or LDWORK = -1, DWORK(1) returns the optimal value of LDWORK; if FACT = 'N' and LDWORK is set as specified below, DWORK(2) contains the reciprocal condition number of the given matrix R. DWORK(2) is set to zero if M = 0. On exit, if LDWORK = -2 on input or INFO = -26, then DWORK(1) returns the minimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1 if FACT = 'C' or (FACT = 'U' and JOBG = 'N' and JOBL = 'Z'); LDWORK >= MAX(2,3*M) if FACT = 'N' and JOBG = 'N' and JOBL = 'Z'; LDWORK >= MAX(2,3*M,N*M) if FACT = 'N' and (JOBG = 'G' or JOBL = 'N'); LDWORK >= MAX(1,N*M) if FACT = 'U' and (JOBG = 'G' or JOBL = 'N'). For optimum performance LDWORK should be larger than 3*M, if FACT = 'N'. If LDWORK = -1, an optimal 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 is issued by XERBLA. If LDWORK = -2, a minimal workspace query is assumed; the routine only calculates the minimal size of the DWORK array, returns this value as the first entry of the DWORK array, and no error message is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = i: if the i-th element (1 <= i <= M) of the d factor is exactly zero; the UdU' (or LdL') factorization has been completed, but the block diagonal matrix d is exactly singular; = M+1: if the matrix R is numerically singular.Method
- - The matrices G, and/or A and Q are evaluated using the given or computed symmetric factorization of R.Numerical Aspects
The routine should not be used when R is ill-conditioned.Further Comments
Using argument TRANS allows to avoid the transposition of matrix A needed to solve optimal filtering/estimation problems by the same routines solving optimal control problems. If DEF is set to 'D', but R is indefinite, the computational effort for factorization will be approximately double, since Cholesky factorization, tried first, will fail, and symmetric indefinite factorization will then be used. If DEF is set to 'I', but R is positive definite, the computational effort will be slightly higher than that when using Cholesky factorization. It is recommended to use DEF = 'D' also if the definiteness is not known, but M is (much) smaller than N.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB02ND.html 0000664 0000000 0000000 00000046512 14560147231 0020352 0 ustar 00root root 0000000 0000000
Purpose
To compute the optimal feedback matrix F for the problem of optimal control given by -1 F = (R + B'XB) (B'XA + L') (1) in the discrete-time case and -1 F = R (B'X + L') (2) in the continuous-time case, where A, B and L are N-by-N, N-by-M and N-by-M matrices respectively; R and X are M-by-M and N-by-N symmetric matrices respectively. Optionally, matrix R may be specified in a factored form, and L may be zero.Specification
SUBROUTINE SB02ND( DICO, FACT, UPLO, JOBL, N, M, P, A, LDA, B, $ LDB, R, LDR, IPIV, L, LDL, X, LDX, RNORM, F, $ LDF, OUFACT, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, JOBL, UPLO INTEGER INFO, LDA, LDB, LDF, LDL, LDR, LDWORK, LDX, M, $ N, P DOUBLE PRECISION RNORM C .. Array Arguments .. INTEGER IPIV(*), IWORK(*), OUFACT(2) DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), F(LDF,*), $ L(LDL,*), R(LDR,*), X(LDX,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the equation from which F is to be determined, as follows: = 'D': Equation (1), discrete-time case; = 'C': Equation (2), continuous-time case. FACT CHARACTER*1 Specifies how the matrix R is given (factored or not), as follows: = 'N': Array R contains the matrix R; = 'D': Array R contains a P-by-M matrix D, where R = D'D; = 'C': Array R contains the Cholesky factor of R; = 'U': Array R contains the symmetric indefinite UdU' or LdL' factorization of R. This option is not available for DICO = 'D'. UPLO CHARACTER*1 Specifies which triangle of the possibly factored matrix R (or R + B'XB, on exit) is or should be stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored. JOBL CHARACTER*1 Specifies whether or not the matrix L is zero, as follows: = 'Z': L is zero; = 'N': L is nonzero.Input/Output Parameters
N (input) INTEGER The order of the matrices A and X. N >= 0. No computations are performed if MIN(N,M) = 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of rows of the matrix D. P >= M for DICO = 'C'; P >= 0 for DICO = 'D'. This parameter must be specified only for FACT = 'D'. A (input) DOUBLE PRECISION array, dimension (LDA,N) If DICO = 'D', the leading N-by-N part of this array must contain the state matrix A of the system. If DICO = 'C', this array is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N) if DICO = 'D'; LDA >= 1 if DICO = 'C'. B (input/worksp.) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input matrix B of the system. If DICO = 'D' and FACT = 'D' or 'C', the contents of this array is destroyed. Specifically, if, on exit, OUFACT(2) = 1, this array contains chol(X)*B, and if OUFACT(2) = 2 and INFO < M+2, but INFO >= 0, its trailing part (in the first N rows) contains the submatrix of sqrt(V)*U'B corresponding to the non-negligible, positive eigenvalues of X, where V and U are the matrices with the eigenvalues and eigenvectors of X. Otherwise, B is unchanged on exit. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry, if FACT = 'N', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric input weighting matrix R. On entry, if FACT = 'D', the leading P-by-M part of this array must contain the direct transmission matrix D of the system. On entry, if FACT = 'C', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the Cholesky factor of the positive definite input weighting matrix R (as produced by LAPACK routine DPOTRF). On entry, if DICO = 'C' and FACT = 'U', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the factors of the UdU' or LdL' factorization, respectively, of the symmetric indefinite input weighting matrix R (as produced by LAPACK routine DSYTRF). The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') of this array is used as workspace (filled in by symmetry with the other strictly triangular part of R, of R+B'XB, or of the result, if DICO = 'C', DICO = 'D', or (DICO = 'D' and (FACT = 'D' or FACT = 'C') and UPLO = 'L'), respectively. On exit, if OUFACT(1) = 1, and INFO = 0 (or INFO = M+1), the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the Cholesky factor of the given input weighting matrix R (for DICO = 'C'), or that of the matrix R + B'XB (for DICO = 'D'). On exit, if OUFACT(1) = 2, and INFO = 0 (or INFO = M+1), the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the factors of the UdU' or LdL' factorization, respectively, of the given input weighting matrix (for DICO = 'C'), or that of the matrix R + B'XB (for DICO = 'D' and FACT = 'N'). On exit R is unchanged if FACT = 'U' or N = 0. LDR INTEGER. The leading dimension of the array R. LDR >= MAX(1,M) if FACT <> 'D'; LDR >= MAX(1,M,P) if FACT = 'D'. IPIV (input/output) INTEGER array, dimension (M) On entry, if FACT = 'U', this array must contain details of the interchanges performed and the block structure of the d factor in the UdU' or LdL' factorization of matrix R (as produced by LAPACK routine DSYTRF). On exit, if OUFACT(1) = 2, this array contains details of the interchanges performed and the block structure of the d factor in the UdU' or LdL' factorization of matrix R or R + B'XB, as produced by LAPACK routine DSYTRF. This array is not referenced if FACT = 'D', or FACT = 'C', or N = 0. L (input) DOUBLE PRECISION array, dimension (LDL,M) If JOBL = 'N', the leading N-by-M part of this array must contain the cross weighting matrix L. If JOBL = 'Z', this array is not referenced. LDL INTEGER The leading dimension of array L. LDL >= MAX(1,N) if JOBL = 'N'; LDL >= 1 if JOBL = 'Z'. X (input/output) DOUBLE PRECISION array, dimension (LDX,N) On entry, the leading N-by-N part of this array must contain the solution matrix X of the algebraic Riccati equation as produced by SLICOT Library routines SB02MD or SB02OD. Matrix X is assumed non-negative definite if DICO = 'D' and (FACT = 'D' or FACT = 'C'). The full matrix X must be given on input if LDWORK < N*M or if DICO = 'D' and (FACT = 'D' or FACT = 'C'). On exit, if DICO = 'D', FACT = 'D' or FACT = 'C', and OUFACT(2) = 1, the N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the Cholesky factor of the given matrix X, which is found to be positive definite. On exit, if DICO = 'D', FACT = 'D' or 'C', OUFACT(2) = 2, and INFO < M+2 (but INFO >= 0), the leading N-by-N part of this array contains the matrix of orthonormal eigenvectors of X. On exit X is unchanged if DICO = 'C' or FACT = 'N'. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N). RNORM (input) DOUBLE PRECISION If FACT = 'U', this parameter must contain the 1-norm of the original matrix R (before factoring it). Otherwise, this parameter is not used. F (output) DOUBLE PRECISION array, dimension (LDF,N) The leading M-by-N part of this array contains the optimal feedback matrix F. This array is not referenced if DICO = 'C' and FACT = 'D' and P < M. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M). OUFACT (output) INTEGER array, dimension (2) Information about the factorization finally used. OUFACT(1) = 1: Cholesky factorization of R (or R + B'XB) has been used; OUFACT(1) = 2: UdU' (if UPLO = 'U') or LdL' (if UPLO = 'L') factorization of R (or R + B'XB) has been used; OUFACT(2) = 1: Cholesky factorization of X has been used; OUFACT(2) = 2: Spectral factorization of X has been used. The value of OUFACT(2) is not set for DICO = 'C' or for DICO = 'D' and FACT = 'N'. This array is not set if N = 0 or M = 0.Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or LDWORK = -1, DWORK(1) returns the optimal value of LDWORK, and for LDWORK set as specified below, DWORK(2) contains the reciprocal condition number of the matrix R (for DICO = 'C') or of R + B'XB (for DICO = 'D'); DWORK(2) is set to 1 if N = 0. On exit, if LDWORK = -2 on input or INFO = -25, then DWORK(1) returns the minimal value of LDWORK. If on exit INFO = 0, and OUFACT(2) = 2, then DWORK(3),..., DWORK(N+2) contain the eigenvalues of X, in ascending order. LDWORK INTEGER Dimension of working array DWORK. LDWORK >= max(2,2*M) if FACT = 'U'; LDWORK >= max(2,3*M) if FACT <> 'U', DICO = 'C'; LDWORK >= max(2,3*M,N) if FACT = 'N', DICO = 'D'; LDWORK >= max(N+3*M+2,4*N+1) if FACT <> 'N', DICO = 'D'. For optimum performance LDWORK should be larger. If LDWORK = -1, an optimal 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 is issued by XERBLA. If LDWORK = -2, a minimal workspace query is assumed; the routine only calculates the minimal size of the DWORK array, returns this value as the first entry of the DWORK array, and no error message is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = i: if the i-th element of the d factor is exactly zero; the UdU' (or LdL') factorization has been completed, but the block diagonal matrix d is exactly singular; = M+1: if the matrix R (if DICO = 'C'), or R + B'XB (if DICO = 'D') is numerically singular (to working precision); = M+2: if one or more of the eigenvalues of X has not converged; = M+3: if the matrix X is indefinite and updating the triangular factorization failed. If INFO > M+1, call the routine again with an appropriate, unfactored matrix R.Method
The optimal feedback matrix F is obtained as the solution to the system of linear equations (R + B'XB) * F = B'XA + L' in the discrete-time case and R * F = B'X + L' in the continuous-time case, with R replaced by D'D if FACT = 'D'. If FACT = 'N', Cholesky factorization is tried first, but if the coefficient matrix is not positive definite, then UdU' (or LdL') factorization is used. If FACT <> 'N', the factored form of R is taken into account. The discrete-time case then involves updating of a triangular factorization of R (or D'D); Cholesky or symmetric spectral factorization of X is employed to avoid squaring of the condition number of the matrix. When D is given, its QR factorization is determined, and the triangular factor is used as described above.Numerical Aspects
The algorithm consists of numerically stable steps. 3 2 For DICO = 'C', it requires O(m + mn ) floating point operations 2 if FACT = 'N' and O(mn ) floating point operations, otherwise. For DICO = 'D', the operation counts are similar, but additional 3 O(n ) floating point operations may be needed in the worst case. These estimates assume that M <= N.Further Comments
NoneExample
Program Text
* SB02ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER NMAX2 PARAMETER ( NMAX2 = 2*NMAX ) INTEGER LDA, LDB, LDC, LDL, LDR, LDS, LDT, LDU, LDX, LDF PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, LDL = NMAX, $ LDR = MAX(MMAX,PMAX), LDS = NMAX2+MMAX, $ LDT = NMAX2+MMAX, LDU = NMAX2, LDX = NMAX, $ LDF = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( NMAX2,MMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX+3*MMAX+2, 14*NMAX+23, $ 16*NMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL, RCOND, RNORM INTEGER I, INFO1, INFO2, J, M, N, P CHARACTER*1 DICO, FACT, JOBB, JOBL, SORT, UPLO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALFAI(2*NMAX), ALFAR(2*NMAX), $ B(LDB,MMAX), BETA(2*NMAX), C(LDC,NMAX), $ DWORK(LDWORK), F(LDF,NMAX), L(LDL,MMAX), $ R(LDR,MMAX), S(LDS,NMAX2+MMAX), T(LDT,NMAX2), $ U(LDU,NMAX2), X(LDX,NMAX) INTEGER IPIV(LIWORK), IWORK(LIWORK), OUFACT(2) LOGICAL BWORK(NMAX2) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB02ND, SB02OD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, DICO, FACT, JOBL, UPLO 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 ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99991 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) IF ( LSAME( FACT, 'D' ) ) THEN READ ( NIN, FMT = * ) ( ( R(I,J), J = 1,M ), I = 1,P ) ELSE READ ( NIN, FMT = * ) ( ( R(I,J), J = 1,M ), I = 1,M ) END IF * Find the solution matrix X. JOBB = 'B' SORT = 'S' CALL SB02OD( DICO, JOBB, 'Both', UPLO, JOBL, SORT, N, M, $ P, A, LDA, B, LDB, C, LDC, R, LDR, L, LDL, $ RCOND, X, LDX, ALFAR, ALFAI, BETA, S, LDS, $ T, LDT, U, LDU, TOL, IWORK, DWORK, LDWORK, $ BWORK, INFO1 ) * IF ( INFO1.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO1 ELSE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( X(I,J), J = 1,N ) 20 CONTINUE * Compute the optimal feedback matrix F. CALL SB02ND( DICO, FACT, UPLO, JOBL, N, M, P, A, LDA, $ B, LDB, R, LDR, IPIV, L, LDL, X, LDX, $ RNORM, F, LDF, OUFACT, IWORK, DWORK, $ LDWORK, INFO2 ) * IF ( INFO2.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO2 ELSE WRITE ( NOUT, FMT = 99995 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99994 ) ( F(I,J), J = 1,N ) 40 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' SB02ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB02OD = ',I2) 99997 FORMAT (' INFO on exit from SB02ND = ',I2) 99996 FORMAT (' The solution matrix X is ') 99995 FORMAT (/' The optimal feedback matrix F is ') 99994 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
SB02ND EXAMPLE PROGRAM DATA 2 1 3 0.0 D N Z U 2.0 -1.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0Program Results
SB02ND EXAMPLE PROGRAM RESULTS The solution matrix X is 1.0000 0.0000 0.0000 1.0000 The optimal feedback matrix F is 2.0000 -1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB02OD.html 0000664 0000000 0000000 00000054403 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To solve for X either the continuous-time algebraic Riccati equation -1 Q + A'X + XA - (L+XB)R (L+XB)' = 0 (1) or the discrete-time algebraic Riccati equation -1 X = A'XA - (L+A'XB)(R + B'XB) (L+A'XB)' + Q (2) where A, B, Q, R, and L are N-by-N, N-by-M, N-by-N, M-by-M and N-by-M matrices, respectively, such that Q = C'C, R = D'D and L = C'D; X is an N-by-N symmetric matrix. The routine also returns the computed values of the closed-loop spectrum of the system, i.e., the stable eigenvalues lambda(1), ..., lambda(N) of the corresponding Hamiltonian or symplectic pencil, in the continuous-time case or discrete-time case, respectively. -1 Optionally, matrix G = BR B' may be given instead of B and R. Other options include the case with Q and/or R given in a factored form, Q = C'C, R = D'D, and with L a zero matrix. The routine uses the method of deflating subspaces, based on reordering the eigenvalues in a generalized Schur matrix pair. A standard eigenproblem is solved in the continuous-time case if G is given.Specification
SUBROUTINE SB02OD( DICO, JOBB, FACT, UPLO, JOBL, SORT, N, M, P, A, $ LDA, B, LDB, Q, LDQ, R, LDR, L, LDL, RCOND, X, $ LDX, ALFAR, ALFAI, BETA, S, LDS, T, LDT, U, $ LDU, TOL, IWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, JOBB, JOBL, SORT, UPLO INTEGER INFO, LDA, LDB, LDL, LDQ, LDR, LDS, LDT, LDU, $ LDWORK, LDX, M, N, P DOUBLE PRECISION RCOND, TOL C .. Array Arguments .. LOGICAL BWORK(*) INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), ALFAI(*), ALFAR(*), B(LDB,*), BETA(*), $ DWORK(*), L(LDL,*), Q(LDQ,*), R(LDR,*), $ S(LDS,*), T(LDT,*), U(LDU,*), X(LDX,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of Riccati equation to be solved as follows: = 'C': Equation (1), continuous-time case; = 'D': Equation (2), discrete-time case. JOBB CHARACTER*1 Specifies whether or not the matrix G is given, instead of the matrices B and R, as follows: = 'B': B and R are given; = 'G': G is given. FACT CHARACTER*1 Specifies whether or not the matrices Q and/or R (if JOBB = 'B') are factored, as follows: = 'N': Not factored, Q and R are given; = 'C': C is given, and Q = C'C; = 'D': D is given, and R = D'D; = 'B': Both factors C and D are given, Q = C'C, R = D'D. UPLO CHARACTER*1 If JOBB = 'G', or FACT = 'N', specifies which triangle of the matrices G and Q (if FACT = 'N'), or Q and R (if JOBB = 'B'), is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored. JOBL CHARACTER*1 Specifies whether or not the matrix L is zero, as follows: = 'Z': L is zero; = 'N': L is nonzero. JOBL is not used if JOBB = 'G' and JOBL = 'Z' is assumed. SLICOT Library routine SB02MT should be called just before SB02OD, for obtaining the results when JOBB = 'G' and JOBL = 'N'. SORT CHARACTER*1 Specifies which eigenvalues should be obtained in the top of the generalized Schur form, as follows: = 'S': Stable eigenvalues come first; = 'U': Unstable eigenvalues come first.Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e. the order of the matrices A, Q, and X, and the number of rows of the matrices B and L. N >= 0. M (input) INTEGER The number of system inputs. If JOBB = 'B', M is the order of the matrix R, and the number of columns of the matrix B. M >= 0. M is not used if JOBB = 'G'. P (input) INTEGER The number of system outputs. If FACT = 'C' or 'D' or 'B', P is the number of rows of the matrices C and/or D. P >= 0. Otherwise, P is not used. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,*) If JOBB = 'B', the leading N-by-M part of this array must contain the input matrix B of the system. If JOBB = 'G', the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the matrix -1 G = BR B'. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). Q (input) DOUBLE PRECISION array, dimension (LDQ,N) If FACT = 'N' or 'D', the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric state weighting matrix Q. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. If JOBB = 'B', the triangular part of this array defined by UPLO is modified internally, but is restored on exit. If FACT = 'C' or 'B', the leading P-by-N part of this array must contain the output matrix C of the system. If JOBB = 'B', this part is modified internally, but is restored on exit. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,N) if FACT = 'N' or 'D', LDQ >= MAX(1,P) if FACT = 'C' or 'B'. R (input) DOUBLE PRECISION array, dimension (LDR,M) If FACT = 'N' or 'C', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric input weighting matrix R. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. The triangular part of this array defined by UPLO is modified internally, but is restored on exit. If FACT = 'D' or 'B', the leading P-by-M part of this array must contain the direct transmission matrix D of the system. This part is modified internally, but is restored on exit. If JOBB = 'G', this array is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M) if JOBB = 'B' and FACT = 'N' or 'C'; LDR >= MAX(1,P) if JOBB = 'B' and FACT = 'D' or 'B'; LDR >= 1 if JOBB = 'G'. L (input) DOUBLE PRECISION array, dimension (LDL,M) If JOBL = 'N' (and JOBB = 'B'), the leading N-by-M part of this array must contain the cross weighting matrix L. This part is modified internally, but is restored on exit. If JOBL = 'Z' or JOBB = 'G', this array is not referenced. LDL INTEGER The leading dimension of array L. LDL >= MAX(1,N) if JOBL = 'N' and JOBB = 'B'; LDL >= 1 if JOBL = 'Z' or JOBB = 'G'. RCOND (output) DOUBLE PRECISION An estimate of the reciprocal of the condition number (in the 1-norm) of the N-th order system of algebraic equations from which the solution matrix X is obtained. X (output) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array contains the solution matrix X of the problem. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N). ALFAR (output) DOUBLE PRECISION array, dimension (2*N) ALFAI (output) DOUBLE PRECISION array, dimension (2*N) BETA (output) DOUBLE PRECISION array, dimension (2*N) The generalized eigenvalues of the 2N-by-2N matrix pair, ordered as specified by SORT (if INFO = 0). For instance, if SORT = 'S', the leading N elements of these arrays contain the closed-loop spectrum of the system matrix A - BF, where F is the optimal feedback matrix computed based on the solution matrix X. Specifically, lambda(k) = [ALFAR(k)+j*ALFAI(k)]/BETA(k) for k = 1,2,...,N. If DICO = 'C' and JOBB = 'G', the elements of BETA are set to 1. S (output) DOUBLE PRECISION array, dimension (LDS,*) The leading 2N-by-2N part of this array contains the ordered real Schur form S of the first matrix in the reduced matrix pencil associated to the optimal problem, or of the corresponding Hamiltonian matrix, if DICO = 'C' and JOBB = 'G'. That is, (S S ) ( 11 12) S = ( ), (0 S ) ( 22) where S , S and S are N-by-N matrices. 11 12 22 Array S must have 2*N+M columns if JOBB = 'B', and 2*N columns, otherwise. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,2*N+M) if JOBB = 'B', LDS >= MAX(1,2*N) if JOBB = 'G'. T (output) DOUBLE PRECISION array, dimension (LDT,2*N) If DICO = 'D' or JOBB = 'B', the leading 2N-by-2N part of this array contains the ordered upper triangular form T of the second matrix in the reduced matrix pencil associated to the optimal problem. That is, (T T ) ( 11 12) T = ( ), (0 T ) ( 22) where T , T and T are N-by-N matrices. 11 12 22 If DICO = 'C' and JOBB = 'G' this array is not referenced. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,2*N+M) if JOBB = 'B', LDT >= MAX(1,2*N) if JOBB = 'G' and DICO = 'D', LDT >= 1 if JOBB = 'G' and DICO = 'C'. U (output) DOUBLE PRECISION array, dimension (LDU,2*N) The leading 2N-by-2N part of this array contains the right transformation matrix U which reduces the 2N-by-2N matrix pencil to the ordered generalized real Schur form (S,T), or the Hamiltonian matrix to the ordered real Schur form S, if DICO = 'C' and JOBB = 'G'. That is, (U U ) ( 11 12) U = ( ), (U U ) ( 21 22) where U , U , U and U are N-by-N matrices. 11 12 21 22 LDU INTEGER The leading dimension of array U. LDU >= MAX(1,2*N).Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity of the original matrix pencil, specifically of the triangular factor obtained during the reduction process. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number of that matrix; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then a default tolerance, defined by TOLDEF = EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not referenced if JOBB = 'G'.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= MAX(1,M,2*N) if JOBB = 'B', LIWORK >= MAX(1,2*N) if JOBB = 'G'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. If JOBB = 'B' and N > 0, DWORK(2) returns the reciprocal of the condition number of the M-by-M lower triangular matrix obtained after compressing the matrix pencil of order 2N+M to obtain a pencil of order 2N. If INFO = 0 or INFO = 6, DWORK(3) returns the scaling factor used internally, which should multiply the submatrix Y2 to recover X from the first N columns of U (see METHOD). LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(3,6*N), if JOBB = 'G', DICO = 'C'; LDWORK >= MAX(7*(2*N+1)+16,16*N), if JOBB = 'G', DICO = 'D'; LDWORK >= MAX(7*(2*N+1)+16,16*N,2*N+M,3*M), if JOBB = 'B'. For optimum performance LDWORK should be larger. BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the computed extended matrix pencil is singular, possibly due to rounding errors; = 2: if the QZ (or QR) algorithm failed; = 3: if reordering of the (generalized) eigenvalues failed; = 4: if after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the (generalized) Schur form no longer satisfy the stability condition; this could also be caused due to scaling; = 5: if the computed dimension of the solution does not equal N; = 6: if a singular matrix was encountered during the computation of the solution matrix X.Method
The routine uses a variant of the method of deflating subspaces proposed by van Dooren [1]. See also [2], [3]. It is assumed that (A,B) is stabilizable and (C,A) is detectable. Under these assumptions the algebraic Riccati equation is known to have a unique non-negative definite solution. The first step in the method of deflating subspaces is to form the extended Hamiltonian matrices, dimension 2N + M given by discrete-time continuous-time |A 0 B| |I 0 0| |A 0 B| |I 0 0| |Q -I L| - z |0 -A' 0|, |Q A' L| - s |0 -I 0|. |L' 0 R| |0 -B' 0| |L' B' R| |0 0 0| Next, these pencils are compressed to a form (see [1]) lambda x A - B . f f This generalized eigenvalue problem is then solved using the QZ algorithm and the stable deflating subspace Ys is determined. If [Y1'|Y2']' is a basis for Ys, then the required solution is -1 X = Y2 x Y1 . A standard eigenvalue problem is solved using the QR algorithm in the continuous-time case when G is given (DICO = 'C', JOBB = 'G').References
[1] Van Dooren, P. A Generalized Eigenvalue Approach for Solving Riccati Equations. SIAM J. Sci. Stat. Comp., 2, pp. 121-135, 1981. [2] Mehrmann, V. The Autonomous Linear Quadratic Control Problem. Theory and Numerical Solution. Lect. Notes in Control and Information Sciences, vol. 163, Springer-Verlag, Berlin, 1991. [3] Sima, V. Algorithms for Linear-Quadratic Optimization. Pure and Applied Mathematics: A Series of Monographs and Textbooks, vol. 200, Marcel Dekker, Inc., New York, 1996.Numerical Aspects
This routine is particularly suited for systems where the matrix R is ill-conditioned. Internal scaling is used.Further Comments
To obtain a stabilizing solution of the algebraic Riccati equations set SORT = 'S'. The routine can also compute the anti-stabilizing solutions of the algebraic Riccati equations, by specifying SORT = 'U'.Example
Program Text
* SB02OD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER NMAX2M, NMAX2 PARAMETER ( NMAX2M = 2*NMAX+MMAX, NMAX2 = 2*NMAX ) INTEGER LDA, LDB, LDL, LDQ, LDR, LDS, LDT, LDU, LDX PARAMETER ( LDA = NMAX, LDB = NMAX, LDL = NMAX, $ LDQ = MAX(NMAX,PMAX), LDR = MAX(MMAX,PMAX), $ LDS = NMAX2M, LDT = NMAX2M, LDU = NMAX2, $ LDX = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX(MMAX,NMAX2) ) INTEGER LDWORK PARAMETER ( LDWORK = MAX(14*NMAX+23,16*NMAX) ) INTEGER LBWORK PARAMETER ( LBWORK = NMAX2 ) * .. Local Scalars .. DOUBLE PRECISION RCOND, TOL INTEGER I, INFO, J, M, N, P CHARACTER*1 DICO, FACT, JOBB, JOBL, SORT, UPLO LOGICAL LJOBB * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALFAI(NMAX2), ALFAR(NMAX2), $ B(LDB,MMAX), BETA(NMAX2), DWORK(LDWORK), $ L(LDL,MMAX), Q(LDQ,NMAX), R(LDR,MMAX), $ S(LDS,NMAX2M), T(LDT,NMAX2), U(LDU,NMAX2), $ X(LDX,NMAX) INTEGER IWORK(LIWORK) LOGICAL BWORK(LBWORK) C .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB02OD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, DICO, JOBB, FACT, UPLO, JOBL, $ SORT IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99994 ) M ELSE LJOBB = LSAME( JOBB, 'B' ) IF ( LJOBB ) THEN READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,N ) END IF IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99993 ) P ELSE IF ( LSAME( FACT, 'N' ) .OR. LSAME( FACT, 'D' ) ) THEN READ ( NIN, FMT = * ) $ ( ( Q(I,J), J = 1,N ), I = 1,N ) ELSE READ ( NIN, FMT = * ) $ ( ( Q(I,J), J = 1,N ), I = 1,P ) END IF IF ( LJOBB ) THEN IF ( LSAME( FACT, 'N' ) .OR. LSAME( FACT, 'C' ) ) THEN READ ( NIN, FMT = * ) $ ( ( R(I,J), J = 1,M ), I = 1,M ) ELSE READ ( NIN, FMT = * ) $ ( ( R(I,J), J = 1,M ), I = 1,P ) END IF IF ( LSAME( JOBL, 'N' ) ) $ READ ( NIN, FMT = * ) $ ( ( L(I,J), J = 1,M ), I = 1,N ) END IF * Find the solution matrix X. CALL SB02OD( DICO, JOBB, FACT, UPLO, JOBL, SORT, N, M, P, $ A, LDA, B, LDB, Q, LDQ, R, LDR, L, LDL, $ RCOND, X, LDX, ALFAR, ALFAI, BETA, S, LDS, $ T, LDT, U, LDU, TOL, IWORK, DWORK, LDWORK, $ BWORK, 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 ) ( X(I,J), J = 1,N ) 20 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SB02OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB02OD = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' M is out of range.',/' M = ',I5) 99993 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
SB02OD EXAMPLE PROGRAM DATA 2 1 3 0.0 C B B U Z S 0.0 1.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0Program Results
SB02OD EXAMPLE PROGRAM RESULTS The solution matrix X is 1.7321 1.0000 1.0000 1.7321
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB02OY.html 0000664 0000000 0000000 00000032600 14560147231 0020371 0 ustar 00root root 0000000 0000000
Purpose
To construct the extended matrix pairs for the computation of the solution of the algebraic matrix Riccati equations arising in the problems of optimal control, both discrete and continuous-time, and of spectral factorization, both discrete and continuous-time. These matrix pairs, of dimension 2N + M, are given by discrete-time continuous-time |A 0 B| |E 0 0| |A 0 B| |E 0 0| |Q -E' L| - z |0 -A' 0|, |Q A' L| - s |0 -E' 0|. (1) |L' 0 R| |0 -B' 0| |L' B' R| |0 0 0| After construction, these pencils are compressed to a form (see [1]) lambda x A - B , f f where A and B are 2N-by-2N matrices. f f -1 Optionally, matrix G = BR B' may be given instead of B and R; then, for L = 0, 2N-by-2N matrix pairs are directly constructed as discrete-time continuous-time |A 0 | |E G | |A -G | |E 0 | | | - z | |, | | - s | |. (2) |Q -E'| |0 -A'| |Q A'| |0 -E'| Similar pairs are obtained for non-zero L, if SLICOT Library routine SB02MT is called before SB02OY. Other options include the case with E identity matrix, L a zero matrix, or Q and/or R given in a factored form, Q = C'C, R = D'D. For spectral factorization problems, there are minor differences (e.g., B is replaced by C'). The second matrix in (2) is not constructed in the continuous-time case if E is specified as being an identity matrix.Specification
SUBROUTINE SB02OY( TYPE, DICO, JOBB, FACT, UPLO, JOBL, JOBE, N, M, $ P, A, LDA, B, LDB, Q, LDQ, R, LDR, L, LDL, E, $ LDE, AF, LDAF, BF, LDBF, TOL, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, JOBB, JOBE, JOBL, TYPE, UPLO INTEGER INFO, LDA, LDAF, LDB, LDBF, LDE, LDL, LDQ, LDR, $ LDWORK, M, N, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), AF(LDAF,*), B(LDB,*), BF(LDBF,*), $ DWORK(*), E(LDE,*), L(LDL,*), Q(LDQ,*), R(LDR,*)Arguments
Mode Parameters
TYPE CHARACTER*1 Specifies the type of problem to be addressed as follows: = 'O': Optimal control problem; = 'S': Spectral factorization problem. DICO CHARACTER*1 Specifies the type of linear system considered as follows: = 'C': Continuous-time system; = 'D': Discrete-time system. JOBB CHARACTER*1 Specifies whether or not the matrix G is given, instead of the matrices B and R, as follows: = 'B': B and R are given; = 'G': G is given. For JOBB = 'G', a 2N-by-2N matrix pair is directly obtained assuming L = 0 (see the description of JOBL). FACT CHARACTER*1 Specifies whether or not the matrices Q and/or R (if JOBB = 'B') are factored, as follows: = 'N': Not factored, Q and R are given; = 'C': C is given, and Q = C'C; = 'D': D is given, and R = D'D (if TYPE = 'O'), or R = D + D' (if TYPE = 'S'); = 'B': Both factors C and D are given, Q = C'C, R = D'D (or R = D + D'). UPLO CHARACTER*1 If JOBB = 'G', or FACT = 'N', specifies which triangle of the matrices G and Q (if FACT = 'N'), or Q and R (if JOBB = 'B'), is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored. JOBL CHARACTER*1 Specifies whether or not the matrix L is zero, as follows: = 'Z': L is zero; = 'N': L is nonzero. JOBL is not used if JOBB = 'G' and JOBL = 'Z' is assumed. Using SLICOT Library routine SB02MT to compute the corresponding A and Q in this case, before calling SB02OY, enables to obtain 2N-by-2N matrix pairs directly. JOBE CHARACTER*1 Specifies whether or not the matrix E is identity, as follows: = 'I': E is the identity matrix; = 'N': E is a general matrix.Input/Output Parameters
N (input) INTEGER The order of the matrices A, Q, and E, and the number of rows of the matrices B and L. N >= 0. M (input) INTEGER If JOBB = 'B', M is the order of the matrix R, and the number of columns of the matrix B. M >= 0. M is not used if JOBB = 'G'. P (input) INTEGER If FACT = 'C' or 'D' or 'B', or if TYPE = 'S', P is the number of rows of the matrix C and/or D, respectively. P >= 0, and if JOBB = 'B' and TYPE = 'S', then P = M. Otherwise, P is not used. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,*) If JOBB = 'B', the leading N-by-M part of this array must contain the input matrix B of the system. If JOBB = 'G', the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the matrix -1 G = BR B'. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). Q (input) DOUBLE PRECISION array, dimension (LDQ,N) If FACT = 'N' or 'D', the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric output weighting matrix Q. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. If FACT = 'C' or 'B', the leading P-by-N part of this array must contain the output matrix C of the system. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,N) if FACT = 'N' or 'D', LDQ >= MAX(1,P) if FACT = 'C' or 'B'. R (input) DOUBLE PRECISION array, dimension (LDR,M) If FACT = 'N' or 'C', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric input weighting matrix R. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. If FACT = 'D' or 'B', the leading P-by-M part of this array must contain the direct transmission matrix D of the system. If JOBB = 'G', this array is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M) if JOBB = 'B' and FACT = 'N' or 'C'; LDR >= MAX(1,P) if JOBB = 'B' and FACT = 'D' or 'B'; LDR >= 1 if JOBB = 'G'. L (input) DOUBLE PRECISION array, dimension (LDL,M) If JOBL = 'N' (and JOBB = 'B'), the leading N-by-M part of this array must contain the cross weighting matrix L. If JOBL = 'Z' or JOBB = 'G', this array is not referenced. LDL INTEGER The leading dimension of array L. LDL >= MAX(1,N) if JOBL = 'N'; LDL >= 1 if JOBL = 'Z' or JOBB = 'G'. E (input) DOUBLE PRECISION array, dimension (LDE,N) If JOBE = 'N', the leading N-by-N part of this array must contain the matrix E of the descriptor system. If JOBE = 'I', E is taken as identity and this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N) if JOBE = 'N'; LDE >= 1 if JOBE = 'I'. AF (output) DOUBLE PRECISION array, dimension (LDAF,*) The leading 2N-by-2N part of this array contains the matrix A in the matrix pencil. f Array AF must have 2*N+M columns if JOBB = 'B', and 2*N columns, otherwise. LDAF INTEGER The leading dimension of array AF. LDAF >= MAX(1,2*N+M) if JOBB = 'B', LDAF >= MAX(1,2*N) if JOBB = 'G'. BF (output) DOUBLE PRECISION array, dimension (LDBF,2*N) If DICO = 'D' or JOBB = 'B' or JOBE = 'N', the leading 2N-by-2N part of this array contains the matrix B in the f matrix pencil. The last M zero columns are never constructed. If DICO = 'C' and JOBB = 'G' and JOBE = 'I', this array is not referenced. LDBF INTEGER The leading dimension of array BF. LDBF >= MAX(1,2*N+M) if JOBB = 'B', LDBF >= MAX(1,2*N) if JOBB = 'G' and ( DICO = 'D' or JOBE = 'N' ), LDBF >= 1 if JOBB = 'G' and ( DICO = 'C' and JOBE = 'I' ).Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity of the original matrix pencil, specifically of the triangular factor obtained during the reduction process. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number of that matrix; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then a default tolerance, defined by TOLDEF = EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not referenced if JOBB = 'G'.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= M if JOBB = 'B', LIWORK >= 1 if JOBB = 'G'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. If JOBB = 'B', DWORK(2) returns the reciprocal of the condition number of the M-by-M lower triangular matrix obtained after compression. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1 if JOBB = 'G', LDWORK >= MAX(1,2*N + M,3*M) if JOBB = 'B'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the computed extended matrix pencil is singular, possibly due to rounding errors.Method
The extended matrix pairs are constructed, taking various options into account. If JOBB = 'B', the problem order is reduced from 2N+M to 2N (see [1]).References
[1] Van Dooren, P. A Generalized Eigenvalue Approach for Solving Riccati Equations. SIAM J. Sci. Stat. Comp., 2, pp. 121-135, 1981. [2] Mehrmann, V. The Autonomous Linear Quadratic Control Problem. Theory and Numerical Solution. Lect. Notes in Control and Information Sciences, vol. 163, Springer-Verlag, Berlin, 1991. [3] Sima, V. Algorithms for Linear-Quadratic Optimization. Pure and Applied Mathematics: A Series of Monographs and Textbooks, vol. 200, Marcel Dekker, Inc., New York, 1996.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve the real continuous-time matrix algebraic Riccati equation op(A)'*X + X*op(A) + Q - X*G*X = 0, where op(A) = A or A' = A**T and G, Q are symmetric (G = G**T, Q = Q**T). The matrices A, G and Q are N-by-N and the solution X is an N-by-N symmetric matrix. An error bound on the solution and a condition estimate are also optionally provided. It is assumed that the matrices A, G and Q are such that the corresponding Hamiltonian matrix has N eigenvalues with negative real parts.Specification
SUBROUTINE SB02PD( JOB, TRANA, UPLO, N, A, LDA, G, LDG, Q, LDQ, X, $ LDX, RCOND, FERR, WR, WI, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER JOB, TRANA, UPLO INTEGER INFO, LDA, LDG, LDQ, LDWORK, LDX, N DOUBLE PRECISION FERR, RCOND C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), DWORK( * ), G( LDG, * ), $ Q( LDQ, * ), WI( * ), WR( * ), X( LDX, * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'X': Compute the solution only; = 'A': Compute all: the solution, reciprocal condition number, and the error bound. TRANA CHARACTER*1 Specifies the option op(A): = '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 triangle of the matrices G and Q is stored, as follows: = 'U': Upper triangles of G and Q are stored; = 'L': Lower triangles of G and Q are stored.Input/Output Parameters
N (input) INTEGER The order of the matrices A, G, Q, and X. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the coefficient matrix A of the equation. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). 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. 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. LDQ INTEGER The leading dimension of the array Q. LDQ >= max(1,N). X (output) DOUBLE PRECISION array, dimension (LDX,N) If INFO = 0, INFO = 2, or INFO = 4, the leading N-by-N part of this array contains the symmetric solution matrix X of the algebraic Riccati equation. LDX INTEGER The leading dimension of the array X. LDX >= max(1,N). RCOND (output) DOUBLE PRECISION If JOB = 'A', the estimate of the reciprocal condition number of the Riccati equation. FERR (output) DOUBLE PRECISION If JOB = 'A', the 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. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) If JOB = 'A' and TRANA = 'N', WR and WI contain the real and imaginary parts, respectively, of the eigenvalues of the matrix A - G*X, i.e., the closed-loop system poles. If JOB = 'A' and TRANA = 'T' or 'C', WR and WI contain the real and imaginary parts, respectively, of the eigenvalues of the matrix A - X*G, i.e., the closed-loop system poles. If JOB = 'X', these arrays are not referenced.Workspace
IWORK INTEGER array, dimension (LIWORK), where LIWORK >= 2*N, if JOB = 'X'; LIWORK >= max(2*N,N*N), if JOB = 'A'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or INFO = 2, DWORK(1) contains the optimal value of LDWORK. If JOB = 'A', then DWORK(2:N*N+1) and DWORK(N*N+2:2*N*N+1) contain a real Schur form of the closed-loop system matrix, Ac = A - G*X (if TRANA = 'N') or Ac = A - X*G (if TRANA = 'T' or 'C'), and the orthogonal matrix which reduced Ac to real Schur form, respectively. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 4*N*N + 8*N + 1, if JOB = 'X'; LDWORK >= max( 4*N*N + 8*N + 1, 6*N*N ), if JOB = 'A'. For good performance, LDWORK should be larger, e.g., LDWORK >= 4*N*N + 6*N +( 2*N+1 )*NB, if JOB = 'X', where NB is the optimal blocksize. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the Hamiltonian matrix has eigenvalues on the imaginary axis, so the solution and error bounds could not be computed; = 2: the iteration for the matrix sign function failed to converge after 50 iterations, but an approximate solution and error bounds (if JOB = 'A') have been computed; = 3: the system of linear equations for the solution is singular to working precision, so the solution and error bounds could not be computed; = 4: the matrix A-G*X (or A-X*G) cannot be reduced to Schur canonical form and condition number estimate and forward error estimate have not been computed.Method
The Riccati equation is solved by the matrix sign function approach [1], [2], implementing a scaling which enhances the numerical stability [4].References
[1] Bai, Z., Demmel, J., Dongarra, J., Petitet, A., Robinson, H., and Stanley, K. The spectral decomposition of nonsymmetric matrices on distributed memory parallel computers. SIAM J. Sci. Comput., vol. 18, pp. 1446-1461, 1997. [2] Byers, R., He, C., and Mehrmann, V. The matrix sign function method and the computation of invariant subspaces. SIAM J. Matrix Anal. Appl., vol. 18, pp. 615-632, 1997. [3] Higham, N.J. Perturbation theory and backward error for AX-XB=C. BIT, vol. 33, pp. 124-136, 1993. [4] 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, Technical University Chemnitz, May 1998.Numerical Aspects
The solution accuracy can be controlled by the output parameter FERR.Further Comments
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 + W*op(Ac), Theta(W) = inv(Omega(op(W)'*X + X*op(W))), Pi(W) = inv(Omega(X*W*X)), and the matrix Ac (the closed-loop system matrix) is given by Ac = A - G*X, if TRANA = 'N', or Ac = A - X*G, if TRANA = 'T' or 'C'. The program estimates the quantities sep(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 [3].Example
Program Text
* SB02PD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDG, LDQ, LDX PARAMETER ( LDA = NMAX, LDG = NMAX, LDQ = NMAX, $ LDX = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 2*NMAX, NMAX*NMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 4*NMAX*NMAX + 8*NMAX, $ 6*NMAX*NMAX ) + 1 ) * .. Local Scalars .. DOUBLE PRECISION FERR, RCOND INTEGER I, INFO, J, N CHARACTER JOB, TRANA, UPLO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), G(LDG,NMAX), $ Q(LDQ,NMAX), WI(NMAX), WR(NMAX), $ X(LDX,NMAX) INTEGER IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB02PD * .. Intrinsic Functions .. INTRINSIC MAX * .. 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, TRANA, UPLO IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) 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 ) * Find the solution matrix X. CALL SB02PD( JOB, TRANA, UPLO, N, A, LDA, G, LDG, Q, LDQ, X, $ LDX, RCOND, FERR, WR, WI, IWORK, DWORK, LDWORK, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO END IF IF ( INFO.EQ.0 .OR. INFO.EQ.2 .OR. INFO.EQ.4 ) THEN WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( X(I,J), J = 1,N ) 20 CONTINUE IF ( LSAME( JOB, 'A' ) .AND. INFO.NE.4 ) THEN WRITE ( NOUT, FMT = 99994 ) RCOND WRITE ( NOUT, FMT = 99993 ) FERR END IF END IF END IF STOP * 99999 FORMAT (' SB02PD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB02PD = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' Estimated reciprocal condition number = ',F8.4) 99993 FORMAT (/' Estimated error bound = ',F20.16) ENDProgram Data
SB02PD EXAMPLE PROGRAM DATA 2 A N U 0.0 1.0 0.0 0.0 1.0 0.0 0.0 2.0 0.0 0.0 0.0 1.0Program Results
SB02PD EXAMPLE PROGRAM RESULTS The solution matrix X is 2.0000 1.0000 1.0000 2.0000 Estimated reciprocal condition number = 0.1333 Estimated error bound = 0.0000000000000063
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB02QD.html 0000664 0000000 0000000 00000044340 14560147231 0020352 0 ustar 00root root 0000000 0000000
Purpose
To estimate the conditioning and compute an error bound on the solution of the real continuous-time matrix algebraic Riccati equation op(A)'*X + X*op(A) + Q - X*G*X = 0, (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.Specification
SUBROUTINE SB02QD( JOB, FACT, TRANA, UPLO, LYAPUN, N, A, LDA, T, $ LDT, U, LDU, G, LDG, Q, LDQ, X, LDX, SEP, $ 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, SEP C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), DWORK( * ), G( LDG, * ), $ Q( LDQ, * ), T( LDT, * ), U( LDU, * ), $ X( LDX, * )Arguments
Mode Parameters
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 = A - G*X (if TRANA = 'N') or Ac = A - 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.Input/Output Parameters
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). SEP (output) DOUBLE PRECISION If JOB = 'C' or JOB = 'B', the estimated quantity sep(op(Ac),-op(Ac)'). If N = 0, or X = 0, or JOB = 'E', SEP is not referenced. RCOND (output) DOUBLE PRECISION If JOB = 'C' or JOB = 'B', an estimate of the reciprocal condition number of the continuous-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.Workspace
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' and JOB = 'E' or 'B'; LWA = 0, otherwise. If FACT = 'N', then LDWORK = MAX(1, 5*N, 2*N*N), if JOB = 'C'; LDWORK = MAX(1, LWA + 5*N, 4*N*N ), if JOB = 'E', 'B'. If FACT = 'F', then LDWORK = MAX(1, 2*N*N), if JOB = 'C'; LDWORK = MAX(1, 4*N*N ), 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.Error Indicator
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 the matrices T and -T' have common or very close eigenvalues; perturbed values were used to solve Lyapunov equations, but the matrix T, if given (for FACT = 'F'), is unchanged.Method
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 + W*op(Ac), Theta(W) = inv(Omega(op(W)'*X + X*op(W))), Pi(W) = inv(Omega(X*W*X)), and Ac = A - G*X (if TRANA = 'N') or Ac = A - X*G (if TRANA = 'T' or 'C'). Note that the Riccati equation (1) is equivalent to _ _ _ _ _ _ op(T)'*X + X*op(T) + Q + X*G*X = 0, (2) _ _ _ 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 sep(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].References
[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.Numerical Aspects
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.Further Comments
The option LYAPUN = 'R' may occasionally produce slightly worse or better estimates, and it is much faster than the option 'O'. When SEP 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.Example
Program Text
* SB02QD 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, SEP 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), 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, DLACPY, DSYMM, MA02ED, MB01RU, SB02MD, $ SB02QD * .. 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( UPLO, N, N, Q, LDQ, X, LDX ) N2 = 2*N IS = 2*N2 + 1 IU = IS + N2*N2 IW = IU + N2*N2 * Solve the continuous-time Riccati equation. CALL SB02MD( 'continuous', 'direct', UPLO, 'no scaling', $ 'stable', N, A, 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 DLACPY( 'Full', N, N, A, LDA, T, LDT ) IF ( LSAME( TRANA, 'N' ) ) THEN * Compute Ac = A-G*X. CALL DSYMM( 'Left', UPLO, N, N, -ONE, G, LDG, X, LDX, $ ONE, T, LDT ) ELSE * Compute Ac = A-X*G. CALL DSYMM( 'Right', UPLO, N, N, -ONE, G, LDG, X, LDX, $ ONE, T, LDT ) 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 SB02QD( JOB, FACT, TRANA, UPLO, LYAPUN, N, A, LDA, T, $ LDT, U, LDU, G, LDG, Q, LDQ, X, LDX, SEP, $ 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 ) SEP 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 (' SB02QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB02MD =',I2) 99997 FORMAT (' INFO on exit from SB02QD =',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) ENDProgram Data
SB02QD EXAMPLE PROGRAM DATA 2 B N N U O 0.0 1.0 0.0 0.0 1.0 0.0 0.0 2.0 0.0 0.0 0.0 1.0Program Results
SB02QD EXAMPLE PROGRAM RESULTS The solution matrix X is 2.0000 1.0000 1.0000 2.0000 Estimated separation = 0.4000 Estimated reciprocal condition number = 0.1333 Estimated error bound = 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB02RD.html 0000664 0000000 0000000 00000071755 14560147231 0020365 0 ustar 00root root 0000000 0000000
Purpose
To solve for X either the continuous-time algebraic Riccati equation -1 Q + op(A)'*X + X*op(A) - X*op(B)*R op(B)'*X = 0, (1) or the discrete-time algebraic Riccati equation -1 X = op(A)'*X*op(A) - op(A)'*X*op(B)*(R + op(B)'*X*op(B)) * op(B)'*X*op(A) + Q, (2) where op(M) = M or M' (M**T), A, op(B), Q, and R are N-by-N, N-by-M, N-by-N, and M-by-M matrices respectively, with Q symmetric and R symmetric nonsingular; X is an N-by-N symmetric matrix. -1 The matrix G = op(B)*R *op(B)' must be provided on input, instead of B and R, that is, the continuous-time equation Q + op(A)'*X + X*op(A) - X*G*X = 0, (3) or the discrete-time equation -1 Q + op(A)'*X*(I_n + G*X) *op(A) - X = 0, (4) are solved, where G is an N-by-N symmetric matrix. SLICOT Library routine SB02MT should be used to compute G, given B and R. SB02MT also enables to solve Riccati equations corresponding to optimal problems with coupling terms. The routine also returns the computed values of the closed-loop spectrum of the optimal system, i.e., the stable eigenvalues lambda(1),...,lambda(N) of the corresponding Hamiltonian or symplectic matrix associated to the optimal problem. It is assumed that the matrices A, G, and Q are such that the associated Hamiltonian or symplectic matrix has N stable eigenvalues, i.e., with negative real parts, in the continuous-time case, and with moduli less than one, in the discrete-time case. Optionally, estimates of the conditioning and error bound on the solution of the Riccati equation (3) or (4) are returned.Specification
SUBROUTINE SB02RD( JOB, DICO, HINV, TRANA, UPLO, SCAL, SORT, FACT, $ LYAPUN, N, A, LDA, T, LDT, V, LDV, G, LDG, Q, $ LDQ, X, LDX, SEP, RCOND, FERR, WR, WI, S, LDS, $ IWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, HINV, JOB, LYAPUN, SCAL, SORT, $ TRANA, UPLO INTEGER INFO, LDA, LDG, LDQ, LDS, LDT, LDV, LDWORK, LDX, $ N DOUBLE PRECISION FERR, RCOND, SEP C .. Array Arguments .. LOGICAL BWORK(*) INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), DWORK(*), G(LDG,*), Q(LDQ,*), $ S(LDS,*), T(LDT,*), V(LDV,*), WI(*), WR(*), $ X(LDX,*)Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'X': Compute the solution only; = 'C': Compute the reciprocal condition number only; = 'E': Compute the error bound only; = 'A': Compute all: the solution, reciprocal condition number, and the error bound. DICO CHARACTER*1 Specifies the type of Riccati equation to be solved or analyzed, as follows: = 'C': Equation (3), continuous-time case; = 'D': Equation (4), discrete-time case. HINV CHARACTER*1 If DICO = 'D' and JOB = 'X' or JOB = 'A', specifies which symplectic matrix is to be constructed, as follows: = 'D': The matrix H in (6) (see METHOD) is constructed; = 'I': The inverse of the matrix H in (6) is constructed. HINV is not used if DICO = 'C', or JOB = 'C' or 'E'. 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 triangle of the matrices G and Q is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored. SCAL CHARACTER*1 If JOB = 'X' or JOB = 'A', specifies whether or not a scaling strategy should be used, as follows: = 'G': General scaling should be used; = 'N': No scaling should be used. SCAL is not used if JOB = 'C' or 'E'. SORT CHARACTER*1 If JOB = 'X' or JOB = 'A', specifies which eigenvalues should be obtained in the top of the Schur form, as follows: = 'S': Stable eigenvalues come first; = 'U': Unstable eigenvalues come first. SORT is not used if JOB = 'C' or 'E'. FACT CHARACTER*1 If JOB <> 'X', specifies whether or not a real Schur factorization of the closed-loop system matrix Ac is supplied on entry, as follows: = 'F': On entry, T and V contain the factors from a real Schur factorization of the matrix Ac; = 'N': A Schur factorization of Ac will be computed and the factors will be stored in T and V. For a continuous-time system, the matrix Ac is given by Ac = A - G*X, if TRANA = 'N', or Ac = A - X*G, if TRANA = 'T' or 'C', and for a discrete-time system, the matrix Ac is given by Ac = inv(I_n + G*X)*A, if TRANA = 'N', or Ac = A*inv(I_n + X*G), if TRANA = 'T' or 'C'. FACT is not used if JOB = 'X'. LYAPUN CHARACTER*1 If JOB <> 'X', specifies whether or not the original or "reduced" Lyapunov equations should be solved for estimating reciprocal condition number and/or the error bound, as follows: = 'O': Solve the original Lyapunov equations, updating the right-hand sides and solutions with the matrix V, e.g., X <-- V'*X*V; = 'R': Solve reduced Lyapunov equations only, without updating the right-hand sides and solutions. This means that a real Schur form T of Ac appears in the equations, instead of Ac. LYAPUN is not used if JOB = 'X'.Input/Output Parameters
N (input) INTEGER The order of the matrices A, Q, G, and X. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) If JOB = 'X' or JOB = 'A' or FACT = 'N' or LYAPUN = 'O', the leading N-by-N part of this array must contain the coefficient matrix A of the equation. If JOB = 'C' or 'E' and FACT = 'F' and LYAPUN = 'R', A is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N), if JOB = 'X' or JOB = 'A' or FACT = 'N' or LYAPUN = 'O'. LDA >= 1, otherwise. T (input or output) DOUBLE PRECISION array, dimension (LDT,N) If JOB <> 'X' and 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 JOB <> 'X' and FACT = 'N', then T is an output argument and on exit, if INFO = 0 or INFO = 7, 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). If JOB = 'X', the array T is not referenced. LDT INTEGER The leading dimension of the array T. LDT >= 1, if JOB = 'X'; LDT >= MAX(1,N), if JOB <> 'X'. V (input or output) DOUBLE PRECISION array, dimension (LDV,N) If JOB <> 'X' and FACT = 'F', then V is an input argument and on entry, the leading N-by-N part of this array must contain the orthogonal matrix V from a real Schur factorization of Ac (see argument FACT). If JOB <> 'X' and FACT = 'N', then V is an output argument and on exit, if INFO = 0 or INFO = 7, the leading N-by-N part of this array contains the orthogonal N-by-N matrix from a real Schur factorization of Ac (see argument FACT). If JOB = 'X', the array V is not referenced. LDV INTEGER The leading dimension of the array V. LDV >= 1, if JOB = 'X'; LDV >= MAX(1,N), if JOB <> 'X'. G (input/output) DOUBLE PRECISION array, dimension (LDG,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix G. On exit, if JOB = 'X' and DICO = 'D', or JOB <> 'X' and LYAPUN = 'R', the leading N-by-N part of this array contains the symmetric matrix G fully stored. If JOB <> 'X' and LYAPUN = 'R', this array is modified internally, but restored on exit. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix Q. On exit, if JOB = 'X' and DICO = 'D', or JOB <> 'X' and LYAPUN = 'R', the leading N-by-N part of this array contains the symmetric matrix Q fully stored. If JOB <> 'X' and LYAPUN = 'R', this array is modified internally, but restored on exit. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). X (input or output) DOUBLE PRECISION array, dimension (LDX,N) If JOB = 'C' or JOB = 'E', then X is an input argument and on entry, the leading N-by-N part of this array must contain the symmetric solution matrix of the algebraic Riccati equation. If LYAPUN = 'R', this array is modified internally, but restored on exit; however, it could differ from the input matrix at the round-off error level. If JOB = 'X' or JOB = 'A', then X is an output argument and on exit, if INFO = 0 or INFO >= 6, the leading N-by-N part of this array contains the symmetric solution matrix X of the algebraic Riccati equation. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,N). SEP (output) DOUBLE PRECISION If JOB = 'C' or JOB = 'A', and INFO = 0 or INFO = 7, the estimated quantity sep(op(Ac),-op(Ac)'), if DICO = 'C', or sepd(op(Ac),op(Ac)'), if DICO = 'D'. (See METHOD.) If JOB = 'C' or JOB = 'A' and X = 0, or JOB = 'E', SEP is not referenced. If JOB = 'X', and INFO = 0, INFO = 5 or INFO = 7, SEP contains the scaling factor used, which should multiply the (2,1) submatrix of U to recover X from the first N columns of U (see METHOD). If SCAL = 'N', SEP is set to 1. RCOND (output) DOUBLE PRECISION If JOB = 'C' or JOB = 'A', and INFO = 0 or INFO = 7, an estimate of the reciprocal condition number of the algebraic Riccati equation. If N = 0 or X = 0, RCOND is set to 1 or 0, respectively. If JOB = 'X', or JOB = 'E', RCOND is not referenced. FERR (output) DOUBLE PRECISION If JOB = 'E' or JOB = 'A', and INFO = 0 or INFO = 7, 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 = 'X', or JOB = 'C', FERR is not referenced. WR (output) DOUBLE PRECISION array, dimension (2*N) WI (output) DOUBLE PRECISION array, dimension (2*N) If JOB = 'X' or JOB = 'A', and INFO = 0 or INFO >= 5, these arrays contain the real and imaginary parts, respectively, of the eigenvalues of the 2N-by-2N matrix S, ordered as specified by SORT (except for the case HINV = 'D', when the order is opposite to that specified by SORT). The leading N elements of these arrays contain the closed-loop spectrum of the system matrix Ac (see argument FACT). Specifically, lambda(k) = WR(k) + j*WI(k), for k = 1,2,...,N. If JOB = 'C' or JOB = 'E', these arrays are not referenced. S (output) DOUBLE PRECISION array, dimension (LDS,2*N) If JOB = 'X' or JOB = 'A', and INFO = 0 or INFO >= 5, the leading 2N-by-2N part of this array contains the ordered real Schur form S of the (scaled, if SCAL = 'G') Hamiltonian or symplectic matrix H. That is, ( S S ) ( 11 12 ) S = ( ), ( 0 S ) ( 22 ) where S , S and S are N-by-N matrices. 11 12 22 If JOB = 'C' or JOB = 'E', this array is not referenced. LDS INTEGER The leading dimension of the array S. LDS >= MAX(1,2*N), if JOB = 'X' or JOB = 'A'; LDS >= 1, if JOB = 'C' or JOB = 'E'.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= 2*N, if JOB = 'X'; LIWORK >= N*N, if JOB = 'C' or JOB = 'E'; LIWORK >= MAX(2*N,N*N), if JOB = 'A'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, or INFO = 7, DWORK(1) returns the optimal value of LDWORK. If INFO = 0, or INFO >= 5, and JOB = 'X', or JOB = 'A', then DWORK(2) returns an estimate RCONDU of the reciprocal of the condition number (in the 1-norm) of the N-th order system of algebraic equations from which the solution matrix X is obtained, and DWORK(3) returns the reciprocal pivot growth factor for the LU factorization of the coefficient matrix of that system (see SLICOT Library routine MB02PD); if DWORK(3) is much less than 1, then the computed X and RCONDU could be unreliable. If DICO = 'D', and JOB = 'X', or JOB = 'A', then DWORK(4) returns the reciprocal condition number RCONDA of the given matrix A, and DWORK(5) returns the reciprocal pivot growth factor for A or for its leading columns, if A is singular (see SLICOT Library routine MB02PD); if DWORK(5) is much less than 1, then the computed S and RCONDA could be unreliable. On exit, if INFO = 0, or INFO >= 4, and JOB = 'X', the elements DWORK(6:5+4*N*N) contain the 2*N-by-2*N transformation matrix U which reduced the Hamiltonian or symplectic matrix H to the ordered real Schur form S. LDWORK INTEGER The length of the array DWORK. LDWORK >= 5+MAX(1,4*N*N+8*N), if JOB = 'X' or JOB = 'A'; This may also be used for JOB = 'C' or JOB = 'E', but exact bounds are as follows: LDWORK >= 5 + MAX(1,LWS,LWE) + LWN, where LWS = 0, if FACT = 'F' or LYAPUN = 'R'; = 5*N, if FACT = 'N' and LYAPUN = 'O' and DICO = 'C' and JOB = 'C'; = 5*N+N*N, if FACT = 'N' and LYAPUN = 'O' and DICO = 'C' and JOB = 'E'; = 5*N+N*N, if FACT = 'N' and LYAPUN = 'O' and DICO = 'D'; LWE = 2*N*N, if DICO = 'C' and JOB = 'C'; = 4*N*N, if DICO = 'C' and JOB = 'E'; = MAX(3,2*N*N) + N*N, if DICO = 'D' and JOB = 'C'; = MAX(3,2*N*N) + 2*N*N, if DICO = 'D' and JOB = 'E'; LWN = 0, if LYAPUN = 'O' or JOB = 'C'; = 2*N, if LYAPUN = 'R' and DICO = 'C' and JOB = 'E'; = 3*N, if LYAPUN = 'R' and DICO = 'D' and JOB = 'E'. For optimum performance LDWORK should sometimes be larger. BWORK LOGICAL array, dimension (LBWORK) LBWORK >= 2*N, if JOB = 'X' or JOB = 'A'; LBWORK >= 1, if JOB = 'C' or JOB = 'E', and FACT = 'N' and LYAPUN = 'R'; LBWORK >= 0, otherwise.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if matrix A is (numerically) singular in discrete- time case; = 2: if the Hamiltonian or symplectic matrix H cannot be reduced to real Schur form; = 3: if the real Schur form of the Hamiltonian or symplectic matrix H cannot be appropriately ordered; = 4: if the Hamiltonian or symplectic matrix H has less than N stable eigenvalues; = 5: if the N-th order system of linear algebraic equations, from which the solution matrix X would be obtained, is singular to working precision; = 6: if the QR algorithm failed to complete the reduction of the matrix Ac to Schur canonical form, T; = 7: if T and -T' have some almost equal eigenvalues, if DICO = 'C', or T has almost reciprocal eigenvalues, if DICO = 'D'; perturbed values were used to solve Lyapunov equations, but the matrix T, if given (for FACT = 'F'), is unchanged. (This is a warning indicator.)Method
The method used is the Schur vector approach proposed by Laub [1], but with an optional scaling, which enhances the numerical stability [6]. It is assumed that [A,B] is a stabilizable pair (where for (3) or (4), B is any matrix such that B*B' = G with rank(B) = rank(G)), and [E,A] is a detectable pair, where E is any matrix such that E*E' = Q with rank(E) = rank(Q). Under these assumptions, any of the algebraic Riccati equations (1)-(4) is known to have a unique non-negative definite solution. See [2]. Now consider the 2N-by-2N Hamiltonian or symplectic matrix ( op(A) -G ) H = ( ), (5) ( -Q -op(A)' ), for continuous-time equation, and -1 -1 ( op(A) op(A) *G ) H = ( -1 -1 ), (6) ( Q*op(A) op(A)' + Q*op(A) *G ) for discrete-time equation, respectively, where -1 G = op(B)*R *op(B)'. The assumptions guarantee that H in (5) has no pure imaginary eigenvalues, and H in (6) has no eigenvalues on the unit circle. If Y is an N-by-N matrix then there exists an orthogonal matrix U such that U'*Y*U is an upper quasi-triangular matrix. Moreover, U can be chosen so that the 2-by-2 and 1-by-1 diagonal blocks (corresponding to the complex conjugate eigenvalues and real eigenvalues respectively) appear in any desired order. This is the ordered real Schur form. Thus, we can find an orthogonal similarity transformation U which puts (5) or (6) in ordered real Schur form U'*H*U = S = (S(1,1) S(1,2)) ( 0 S(2,2)) where S(i,j) is an N-by-N matrix and the eigenvalues of S(1,1) have negative real parts in case of (5), or moduli greater than one in case of (6). If U is conformably partitioned into four N-by-N blocks U = (U(1,1) U(1,2)) (U(2,1) U(2,2)) with respect to the assumptions we then have (a) U(1,1) is invertible and X = U(2,1)*inv(U(1,1)) solves (1), (2), (3), or (4) with X = X' and non-negative definite; (b) the eigenvalues of S(1,1) (if DICO = 'C') or S(2,2) (if DICO = 'D') are equal to the eigenvalues of optimal system (the 'closed-loop' spectrum). [A,B] is stabilizable if there exists a matrix F such that (A-BF) is stable. [E,A] is detectable if [A',E'] is stabilizable. The condition number of a 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 + W*op(Ac), Theta(W) = inv(Omega(op(W)'*X + X*op(W))), Pi(W) = inv(Omega(X*W*X)), in the continuous-time case, and 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))), in the discrete-time case, and Ac has been defined (see argument FACT). Details are given in the comments of SLICOT Library routines SB02QD and SB02SD. The routine estimates the quantities sep(op(Ac),-op(Ac)') = 1 / norm(inv(Omega)), 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 [5].References
[1] Laub, A.J. A Schur Method for Solving Algebraic Riccati equations. IEEE Trans. Auto. Contr., AC-24, pp. 913-921, 1979. [2] Wonham, W.M. On a matrix Riccati equation of stochastic control. SIAM J. Contr., 6, pp. 681-697, 1968. [3] Sima, V. Algorithms for Linear-Quadratic Optimization. Pure and Applied Mathematics: A Series of Monographs and Textbooks, vol. 200, Marcel Dekker, Inc., New York, 1996. [4] 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. [5] Higham, N.J. Perturbation theory and backward error for AX-XB=C. BIT, vol. 33, pp. 124-136, 1993. [6] 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.Numerical Aspects
3 The algorithm requires 0(N ) operations. The solution accuracy can be controlled by the output parameter FERR.Further Comments
To obtain a stabilizing solution of the algebraic Riccati equation for DICO = 'D', set SORT = 'U', if HINV = 'D', or set SORT = 'S', if HINV = 'I'. The routine can also compute the anti-stabilizing solutions of the algebraic Riccati equations, by specifying SORT = 'U' if DICO = 'D' and HINV = 'I', or DICO = 'C', or SORT = 'S' if DICO = 'D' and HINV = 'D'. Usually, the combinations HINV = 'D' and SORT = 'U', or HINV = 'I' and SORT = 'U', for stabilizing and anti-stabilizing solutions, respectively, will be faster then the other combinations [3]. The option LYAPUN = 'R' may produce slightly worse or better estimates, and it is faster than the option 'O'. This routine is a functionally extended and more accurate version of the SLICOT Library routine SB02MD. Transposed problems can be dealt with as well. Iterative refinement is used whenever useful to solve linear algebraic systems. Condition numbers and error bounds on the solutions are optionally provided.Example
Program Text
* SB02RD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDG, LDQ, LDS, LDT, LDV, LDX PARAMETER ( LDA = NMAX, LDG = NMAX, LDQ = NMAX, $ LDS = 2*NMAX, LDT = NMAX, LDV = NMAX, $ LDX = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 2*NMAX, NMAX*NMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 5 + 4*NMAX*NMAX + 8*NMAX ) * .. Local Scalars .. DOUBLE PRECISION FERR, RCOND, SEP INTEGER I, INFO, J, N CHARACTER DICO, FACT, HINV, JOB, LYAPUN, SCAL, SORT, TRANA, $ UPLO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), DWORK(LDWORK), G(LDG,NMAX), $ Q(LDQ,NMAX), S(LDS,2*NMAX), T(LDT,NMAX), $ V(LDV,NMAX), WI(2*NMAX), WR(2*NMAX), X(LDX,NMAX) INTEGER IWORK(LIWORK) LOGICAL BWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB02RD * .. Intrinsic Functions .. INTRINSIC MAX * .. 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, DICO, HINV, TRANA, UPLO, SCAL, SORT, $ FACT, LYAPUN IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE IF ( LSAME( JOB, 'X' ) .OR. LSAME( JOB, 'A' ) .OR. $ LSAME( FACT, 'N' ) .OR. LSAME( LYAPUN, 'O' ) ) $ READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( .NOT.LSAME( JOB, 'X' ) .AND. LSAME( FACT, 'F' ) ) THEN READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( V(I,J), J = 1,N ), I = 1,N ) END IF READ ( NIN, FMT = * ) ( ( Q(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( G(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( JOB, 'C' ) .OR. LSAME( JOB, 'E' ) ) $ READ ( NIN, FMT = * ) ( ( X(I,J), J = 1,N ), I = 1,N ) * Find the solution matrix X. CALL SB02RD( JOB, DICO, HINV, TRANA, UPLO, SCAL, SORT, FACT, $ LYAPUN, N, A, LDA, T, LDT, V, LDV, G, LDG, Q, LDQ, $ X, LDX, SEP, RCOND, FERR, WR, WI, S, LDS, IWORK, $ DWORK, LDWORK, BWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO END IF IF ( INFO.EQ.0 .OR. INFO.EQ.7 ) THEN IF ( LSAME( JOB, 'X' ) .OR. LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( X(I,J), J = 1,N ) 20 CONTINUE END IF IF ( LSAME( JOB, 'C' ) .OR. LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99994 ) SEP WRITE ( NOUT, FMT = 99993 ) RCOND END IF IF ( LSAME( JOB, 'E' ) .OR. LSAME( JOB, 'A' ) ) $ WRITE ( NOUT, FMT = 99992 ) FERR END IF END IF STOP * 99999 FORMAT (' SB02RD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB02RD = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' Estimated separation = ',F8.4) 99993 FORMAT (/' Estimated reciprocal condition number = ',F8.4) 99992 FORMAT (/' Estimated error bound = ',F8.4) ENDProgram Data
SB02RD EXAMPLE PROGRAM DATA 2 A C D N U N S N O 0.0 1.0 0.0 0.0 1.0 0.0 0.0 2.0 0.0 0.0 0.0 1.0Program Results
SB02RD EXAMPLE PROGRAM RESULTS The solution matrix X is 2.0000 1.0000 1.0000 2.0000 Estimated separation = 0.4000 Estimated reciprocal condition number = 0.1333 Estimated error bound = 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB02RU.html 0000664 0000000 0000000 00000017264 14560147231 0020401 0 ustar 00root root 0000000 0000000
Purpose
To construct the 2n-by-2n Hamiltonian or symplectic matrix S associated to the linear-quadratic optimization problem, used to solve the continuous- or discrete-time algebraic Riccati equation, respectively. For a continuous-time problem, S is defined by ( op(A) -G ) S = ( ), (1) ( -Q -op(A)' ) and for a discrete-time problem by -1 -1 ( op(A) op(A) *G ) S = ( -1 -1 ), (2) ( Q*op(A) op(A)' + Q*op(A) *G ) or -T -T ( op(A) + G*op(A) *Q -G*op(A) ) S = ( -T -T ), (3) ( -op(A) *Q op(A) ) where op(A) = A or A' (A**T), A, G, and Q are n-by-n matrices, with G and Q symmetric. Matrix A must be nonsingular in the discrete-time case.Specification
SUBROUTINE SB02RU( DICO, HINV, TRANA, UPLO, N, A, LDA, G, LDG, Q, $ LDQ, S, LDS, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, HINV, TRANA, UPLO INTEGER INFO, LDA, LDG, LDQ, LDS, LDWORK, N C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), DWORK(*), G(LDG,*), Q(LDQ,*), $ S(LDS,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system as follows: = 'C': Continuous-time system; = 'D': Discrete-time system. HINV CHARACTER*1 If DICO = 'D', specifies which of the matrices (2) or (3) is constructed, as follows: = 'D': The matrix S in (2) is constructed; = 'I': The (inverse) matrix S in (3) is constructed. HINV is not referenced if DICO = 'C'. 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 triangle of the matrices G and Q is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored.Input/Output Parameters
N (input) INTEGER The order of the matrices A, G, and Q. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). G (input/output) DOUBLE PRECISION array, dimension (LDG,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix G. On exit, if DICO = 'D', the leading N-by-N part of this array contains the symmetric matrix G fully stored. If DICO = 'C', this array is not modified on exit, and the strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. LDG INTEGER The leading dimension of the array G. LDG >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric matrix Q. On exit, if DICO = 'D', the leading N-by-N part of this array contains the symmetric matrix Q fully stored. If DICO = 'C', this array is not modified on exit, and the strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). S (output) DOUBLE PRECISION array, dimension (LDS,2*N) If INFO = 0, the leading 2N-by-2N part of this array contains the Hamiltonian or symplectic matrix of the problem. LDS INTEGER The leading dimension of the array S. LDS >= MAX(1,2*N).Workspace
IWORK INTEGER array, dimension (LIWORK), where LIWORK >= 0, if DICO = 'C'; LIWORK >= 2*N, if DICO = 'D'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if DICO = 'D', DWORK(1) returns the reciprocal condition number RCOND of the given matrix A, and DWORK(2) returns the reciprocal pivot growth factor norm(A)/norm(U) (see SLICOT Library routine MB02PD). If DWORK(2) is much less than 1, then the computed S and RCOND could be unreliable. If 0 < INFO <= N, then DWORK(2) contains the reciprocal pivot growth factor for the leading INFO columns of A. LDWORK INTEGER The length of the array DWORK. LDWORK >= 0, if DICO = 'C'; LDWORK >= MAX(2,6*N), if DICO = 'D'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = i: if the leading i-by-i (1 <= i <= N) upper triangular submatrix of A is singular in discrete-time case; = N+1: if matrix A is numerically singular in discrete- time case.Method
For a continuous-time problem, the 2n-by-2n Hamiltonian matrix (1) is constructed. For a discrete-time problem, the 2n-by-2n symplectic matrix (2) or (3) - the inverse of the matrix in (2) - is constructed.Numerical Aspects
The discrete-time case needs the inverse of the matrix A, hence the routine should not be used when A is ill-conditioned. 3 The algorithm requires 0(n ) floating point operations in the discrete-time case.Further Comments
This routine is a functionally extended and with improved accuracy version of the SLICOT Library routine SB02MU. Transposed problems can be dealt with as well. The LU factorization of op(A) (with no equilibration) and iterative refinement are used for solving the various linear algebraic systems involved.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
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.Specification
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, * )Arguments
Mode Parameters
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.Input/Output Parameters
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.Workspace
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.Error Indicator
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.Method
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].References
[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.Numerical Aspects
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.Further Comments
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.Example
Program Text
* 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) ENDProgram Data
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.0Program Results
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
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB03MD.html 0000664 0000000 0000000 00000040760 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To solve for X either the real continuous-time Lyapunov equation op(A)'*X + X*op(A) = scale*C (1) or the real discrete-time Lyapunov equation op(A)'*X*op(A) - X = scale*C (2) and/or estimate an associated condition number, called separation, where op(A) = A or A' (A**T) and C is symmetric (C = C'). (A' denotes the transpose of the matrix A.) A is N-by-N, the right hand side C and the solution X are N-by-N, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X.Specification
SUBROUTINE SB03MD( DICO, JOB, FACT, TRANA, N, A, LDA, U, LDU, C, $ LDC, SCALE, SEP, FERR, WR, WI, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, JOB, TRANA INTEGER INFO, LDA, LDC, LDU, LDWORK, N DOUBLE PRECISION FERR, SCALE, SEP C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * ), $ U( LDU, * ), WI( * ), WR( * )Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the equation from which X is to be determined as follows: = 'C': Equation (1), continuous-time case; = 'D': Equation (2), discrete-time case. JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'X': Compute the solution only; = 'S': Compute the separation only; = 'B': Compute both the solution and the separation. FACT CHARACTER*1 Specifies whether or not the real Schur factorization of the matrix A is supplied on entry, as follows: = 'F': On entry, A and U contain the factors from the real Schur factorization of the matrix A; = 'N': The Schur factorization of A will be computed and the factors will be stored in A and U. 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).Input/Output Parameters
N (input) INTEGER The order of the matrices A, X, and C. N >= 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. If FACT = 'F', then A contains an upper quasi-triangular matrix in Schur canonical form; the elements below the upper Hessenberg part of the array A are not referenced. 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 in Schur canonical form from the Schur factorization of A. The contents of array A is not modified if FACT = 'F'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). U (input or output) DOUBLE PRECISION array, dimension (LDU,N) If 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 of the real Schur factorization of A. If 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 the real Schur factorization of A. LDU INTEGER The leading dimension of array U. LDU >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry with JOB = 'X' or 'B', the leading N-by-N part of this array must contain the symmetric matrix C. On exit with JOB = 'X' or 'B', if INFO = 0 or INFO = N+1, the leading N-by-N part of C has been overwritten by the symmetric solution matrix X. If JOB = 'S', C is not referenced. LDC INTEGER The leading dimension of array C. LDC >= 1, if JOB = 'S'; LDC >= MAX(1,N), otherwise. SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing. SEP (output) DOUBLE PRECISION If JOB = 'S' or JOB = 'B', and INFO = 0 or INFO = N+1, SEP contains the estimated separation of the matrices op(A) and -op(A)', if DICO = 'C' or of op(A) and op(A)', if DICO = 'D'. If JOB = 'X', SEP is not referenced. FERR (output) DOUBLE PRECISION If JOB = 'B', and INFO = 0 or INFO = N+1, FERR contains an estimated forward error bound for the solution X. If XTRUE is the true solution, FERR bounds the relative error in the computed solution, measured in the Frobenius norm: norm(X - XTRUE)/norm(XTRUE). If JOB = 'X' or JOB = 'S', FERR is not referenced. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) If FACT = 'N', and INFO = 0 or INFO = N+1, WR and WI contain the real and imaginary parts, respectively, of the eigenvalues of A. If FACT = 'F', WR and WI are not referenced.Workspace
IWORK INTEGER array, dimension (N*N) This array is not referenced if JOB = 'X'. 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 length of the array DWORK. LDWORK >= 1, and If JOB = 'X' then If FACT = 'F', LDWORK >= N*N, for DICO = 'C'; LDWORK >= MAX(N*N, 2*N), for DICO = 'D'; If FACT = 'N', LDWORK >= MAX(N*N, 3*N). If JOB = 'S' or JOB = 'B' then If FACT = 'F', LDWORK >= 2*N*N, for DICO = 'C'; LDWORK >= 2*N*N + 2*N, for DICO = 'D'. If FACT = 'N', LDWORK >= MAX(2*N*N, 3*N), DICO = 'C'; LDWORK >= 2*N*N + 2*N, for DICO = 'D'. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues (see LAPACK Library routine DGEES); elements i+1:n of WR and WI contain eigenvalues which have converged, and A contains the partially converged Schur form; = N+1: if DICO = 'C', and the matrices A and -A' have common or very close eigenvalues, or if DICO = 'D', and matrix A has almost reciprocal eigenvalues (that is, lambda(i) = 1/lambda(j) for some i and j, where lambda(i) and lambda(j) are eigenvalues of A and i <> j); perturbed values were used to solve the equation (but the matrix A is unchanged).Method
The Schur factorization of a square matrix A is given by A = U*S*U' where U is orthogonal and S is block upper triangular with 1-by-1 and 2-by-2 blocks on its diagonal, these blocks corresponding to the eigenvalues of A, the 2-by-2 blocks being complex conjugate pairs. This factorization is obtained by numerically stable methods: first A is reduced to upper Hessenberg form (if FACT = 'N') by means of Householder transformations and then the QR Algorithm is applied to reduce the Hessenberg form to S, the transformation matrices being accumulated at each step to give U. If A has already been factorized prior to calling the routine however, then the factors U and S may be supplied and the initial factorization omitted. _ _ If we now put C = U'CU and X = UXU' equations (1) and (2) (see PURPOSE) become (for TRANS = 'N') _ _ _ S'X + XS = C, (3) and _ _ _ S'XS - X = C, (4) respectively. Partition S, C and X as _ _ _ _ (s s') (c c') (x x') ( 11 ) _ ( 11 ) _ ( 11 ) S = ( ), C = ( ), X = ( ) ( ) ( _ ) ( _ ) ( 0 S ) ( c C ) ( x X ) 1 1 1 _ _ where s , c and x are either scalars or 2-by-2 matrices and s, 11 11 11 _ _ c and x are either (N-1) element vectors or matrices with two columns. Equations (3) and (4) can then be re-written as _ _ _ s' x + x s = c (3.1) 11 11 11 11 11 _ _ _ _ S'x + xs = c - sx (3.2) 1 11 11 _ _ S'X + X S = C - (sx' + xs') (3.3) 1 1 1 1 1 and _ _ _ s' x s - x = c (4.1) 11 11 11 11 11 _ _ _ _ S'xs - x = c - sx s (4.2) 1 11 11 11 _ _ _ S'X S - X = C - sx s' - [s(S'x)' + (S'x)s'] (4.3) 1 1 1 1 1 11 1 1 _ respectively. If DICO = 'C' ['D'], then once x has been 11 found from equation (3.1) [(4.1)], equation (3.2) [(4.2)] can be _ solved by forward substitution for x and then equation (3.3) [(4.3)] is of the same form as (3) [(4)] but of the order (N-1) or (N-2) depending upon whether s is 1-by-1 or 2-by-2. 11 _ _ When s is 2-by-2 then x and c will be 1-by-2 matrices and s, 11 11 11 _ _ x and c are matrices with two columns. In this case, equation (3.1) [(4.1)] defines the three equations in the unknown elements _ of x and equation (3.2) [(4.2)] can then be solved by forward 11 _ substitution, a row of x being found at each step.References
[1] Barraud, A.Y. T A numerical algorithm to solve A XA - X = Q. IEEE Trans. Auto. Contr., AC-22, pp. 883-885, 1977. [2] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [3] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-325, 1982.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
If DICO = 'C', SEP is defined as the separation of op(A) and -op(A)': sep( op(A), -op(A)' ) = sigma_min( T ) and if DICO = 'D', SEP is defined as sep( op(A), op(A)' ) = sigma_min( T ) where sigma_min(T) is the smallest singular value of the N*N-by-N*N matrix T = kprod( I(N), op(A)' ) + kprod( op(A)', I(N) ) (DICO = 'C'), T = kprod( op(A)', op(A)' ) - I(N**2) (DICO = 'D'). I(x) is an x-by-x identity matrix, and kprod denotes the Kronecker product. The program estimates sigma_min(T) by the reciprocal of an estimate of the 1-norm of inverse(T). The true reciprocal 1-norm of inverse(T) cannot differ from sigma_min(T) by more than a factor of N. When SEP is small, small changes in A, C can cause large changes in the solution of the equation. An approximate bound on the maximum relative error in the computed solution is EPS * norm(A) / SEP (DICO = 'C'), EPS * norm(A)**2 / SEP (DICO = 'D'), where EPS is the machine precision.Example
Program Text
* SB03MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDC, LDU PARAMETER ( LDA = NMAX, LDC = NMAX, LDU = NMAX ) INTEGER LDWORK, LIWORK PARAMETER ( LDWORK = 2*NMAX*NMAX + 3*NMAX, $ LIWORK = NMAX*NMAX ) * .. Local Scalars .. INTEGER I, INFO, J, N CHARACTER*1 DICO, FACT, JOB, TRANA DOUBLE PRECISION FERR, SCALE, SEP * .. Local Arrays .. INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), C(LDC,NMAX), DWORK(LDWORK), $ U(LDU,NMAX), WI(NMAX), WR(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB03MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, DICO, FACT, JOB, TRANA IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( FACT, 'F' ) ) READ ( NIN, FMT = * ) $ ( ( U(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,N ) * Find the solution matrix X. CALL SB03MD( DICO, JOB, FACT, TRANA, N, A, LDA, U, LDU, C, LDC, $ SCALE, SEP, FERR, WR, WI, IWORK, 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 ) ( C(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99994 ) SCALE IF ( .NOT.LSAME( JOB, 'X' ) ) $ WRITE ( NOUT, FMT = 99993 ) SEP IF ( LSAME( JOB, 'B' ) ) $ WRITE ( NOUT, FMT = 99992 ) FERR END IF END IF STOP * 99999 FORMAT (' SB03MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB03MD = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' Scaling factor = ',F8.4) 99993 FORMAT (/' Estimated separation = ',F8.4) 99992 FORMAT (/' Estimated forward error bound = ',F8.4) ENDProgram Data
SB03MD EXAMPLE PROGRAM DATA 3 D N X N 3.0 1.0 1.0 1.0 3.0 0.0 0.0 0.0 3.0 25.0 24.0 15.0 24.0 32.0 8.0 15.0 8.0 40.0Program Results
SB03MD EXAMPLE PROGRAM RESULTS The solution matrix X is 2.0000 1.0000 1.0000 1.0000 3.0000 0.0000 1.0000 0.0000 4.0000 Scaling factor = 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB03MU.html 0000664 0000000 0000000 00000011263 14560147231 0020366 0 ustar 00root root 0000000 0000000
Purpose
To solve for the N1-by-N2 matrix X, 1 <= N1,N2 <= 2, in ISGN*op(TL)*X*op(TR) - X = SCALE*B, where TL is N1-by-N1, TR is N2-by-N2, B is N1-by-N2, and ISGN = 1 or -1. op(T) = T or T', where T' denotes the transpose of T.Specification
SUBROUTINE SB03MU( LTRANL, LTRANR, ISGN, N1, N2, TL, LDTL, TR, $ LDTR, B, LDB, SCALE, X, LDX, XNORM, INFO ) C .. Scalar Arguments .. LOGICAL LTRANL, LTRANR INTEGER INFO, ISGN, LDB, LDTL, LDTR, LDX, N1, N2 DOUBLE PRECISION SCALE, XNORM C .. Array Arguments .. DOUBLE PRECISION B( LDB, * ), TL( LDTL, * ), TR( LDTR, * ), $ X( LDX, * )Arguments
Mode Parameters
LTRANL LOGICAL Specifies the form of op(TL) to be used, as follows: = .FALSE.: op(TL) = TL, = .TRUE. : op(TL) = TL'. LTRANR LOGICAL Specifies the form of op(TR) to be used, as follows: = .FALSE.: op(TR) = TR, = .TRUE. : op(TR) = TR'. ISGN INTEGER Specifies the sign of the equation as described before. ISGN may only be 1 or -1.Input/Output Parameters
N1 (input) INTEGER The order of matrix TL. N1 may only be 0, 1 or 2. N2 (input) INTEGER The order of matrix TR. N2 may only be 0, 1 or 2. TL (input) DOUBLE PRECISION array, dimension (LDTL,2) The leading N1-by-N1 part of this array must contain the matrix TL. LDTL INTEGER The leading dimension of array TL. LDTL >= MAX(1,N1). TR (input) DOUBLE PRECISION array, dimension (LDTR,2) The leading N2-by-N2 part of this array must contain the matrix TR. LDTR INTEGER The leading dimension of array TR. LDTR >= MAX(1,N2). B (input) DOUBLE PRECISION array, dimension (LDB,2) The leading N1-by-N2 part of this array must contain the right-hand side of the equation. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N1). SCALE (output) DOUBLE PRECISION The scale factor. SCALE is chosen less than or equal to 1 to prevent the solution overflowing. X (output) DOUBLE PRECISION array, dimension (LDX,N2) The leading N1-by-N2 part of this array contains the solution of the equation. Note that X may be identified with B in the calling statement. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N1). XNORM (output) DOUBLE PRECISION The infinity-norm of the solution.Error Indicator
INFO INTEGER = 0: successful exit; = 1: if TL and TR have almost reciprocal eigenvalues, so TL or TR is perturbed to get a nonsingular equation. NOTE: In the interests of speed, this routine does not check the inputs for errors.Method
The equivalent linear algebraic system of equations is formed and solved using Gaussian elimination with complete pivoting.References
[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.Numerical Aspects
The algorithm is stable and reliable, since Gaussian elimination with complete pivoting is used.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for the 2-by-2 symmetric matrix X in op(T)'*X*op(T) - X = SCALE*B, where T is 2-by-2, B is symmetric 2-by-2, and op(T) = T or T', where T' denotes the transpose of T.Specification
SUBROUTINE SB03MV( LTRAN, LUPPER, T, LDT, B, LDB, SCALE, X, LDX, $ XNORM, INFO ) C .. Scalar Arguments .. LOGICAL LTRAN, LUPPER INTEGER INFO, LDB, LDT, LDX DOUBLE PRECISION SCALE, XNORM C .. Array Arguments .. DOUBLE PRECISION B( LDB, * ), T( LDT, * ), X( LDX, * )Arguments
Mode Parameters
LTRAN LOGICAL Specifies the form of op(T) to be used, as follows: = .FALSE.: op(T) = T, = .TRUE. : op(T) = T'. LUPPER LOGICAL Specifies which triangle of the matrix B is used, and which triangle of the matrix X is computed, as follows: = .TRUE. : The upper triangular part; = .FALSE.: The lower triangular part.Input/Output Parameters
T (input) DOUBLE PRECISION array, dimension (LDT,2) The leading 2-by-2 part of this array must contain the matrix T. LDT INTEGER The leading dimension of array T. LDT >= 2. B (input) DOUBLE PRECISION array, dimension (LDB,2) On entry with LUPPER = .TRUE., the leading 2-by-2 upper triangular part of this array must contain the upper triangular part of the symmetric matrix B and the strictly lower triangular part of B is not referenced. On entry with LUPPER = .FALSE., the leading 2-by-2 lower triangular part of this array must contain the lower triangular part of the symmetric matrix B and the strictly upper triangular part of B is not referenced. LDB INTEGER The leading dimension of array B. LDB >= 2. SCALE (output) DOUBLE PRECISION The scale factor. SCALE is chosen less than or equal to 1 to prevent the solution overflowing. X (output) DOUBLE PRECISION array, dimension (LDX,2) On exit with LUPPER = .TRUE., the leading 2-by-2 upper triangular part of this array contains the upper triangular part of the symmetric solution matrix X and the strictly lower triangular part of X is not referenced. On exit with LUPPER = .FALSE., the leading 2-by-2 lower triangular part of this array contains the lower triangular part of the symmetric solution matrix X and the strictly upper triangular part of X is not referenced. Note that X may be identified with B in the calling statement. LDX INTEGER The leading dimension of array X. LDX >= 2. XNORM (output) DOUBLE PRECISION The infinity-norm of the solution.Error Indicator
INFO INTEGER = 0: successful exit; = 1: if T has almost reciprocal eigenvalues, so T is perturbed to get a nonsingular equation. NOTE: In the interests of speed, this routine does not check the inputs for errors.Method
The equivalent linear algebraic system of equations is formed and solved using Gaussian elimination with complete pivoting.References
[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.Numerical Aspects
The algorithm is stable and reliable, since Gaussian elimination with complete pivoting is used.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for the 2-by-2 symmetric matrix X in op(T)'*X + X*op(T) = SCALE*B, where T is 2-by-2, B is symmetric 2-by-2, and op(T) = T or T', where T' denotes the transpose of T.Specification
SUBROUTINE SB03MW( LTRAN, LUPPER, T, LDT, B, LDB, SCALE, X, LDX, $ XNORM, INFO ) C .. Scalar Arguments .. LOGICAL LTRAN, LUPPER INTEGER INFO, LDB, LDT, LDX DOUBLE PRECISION SCALE, XNORM C .. Array Arguments .. DOUBLE PRECISION B( LDB, * ), T( LDT, * ), X( LDX, * )Arguments
Mode Parameters
LTRAN LOGICAL Specifies the form of op(T) to be used, as follows: = .FALSE.: op(T) = T, = .TRUE. : op(T) = T'. LUPPER LOGICAL Specifies which triangle of the matrix B is used, and which triangle of the matrix X is computed, as follows: = .TRUE. : The upper triangular part; = .FALSE.: The lower triangular part.Input/Output Parameters
T (input) DOUBLE PRECISION array, dimension (LDT,2) The leading 2-by-2 part of this array must contain the matrix T. LDT INTEGER The leading dimension of array T. LDT >= 2. B (input) DOUBLE PRECISION array, dimension (LDB,2) On entry with LUPPER = .TRUE., the leading 2-by-2 upper triangular part of this array must contain the upper triangular part of the symmetric matrix B and the strictly lower triangular part of B is not referenced. On entry with LUPPER = .FALSE., the leading 2-by-2 lower triangular part of this array must contain the lower triangular part of the symmetric matrix B and the strictly upper triangular part of B is not referenced. LDB INTEGER The leading dimension of array B. LDB >= 2. SCALE (output) DOUBLE PRECISION The scale factor. SCALE is chosen less than or equal to 1 to prevent the solution overflowing. X (output) DOUBLE PRECISION array, dimension (LDX,2) On exit with LUPPER = .TRUE., the leading 2-by-2 upper triangular part of this array contains the upper triangular part of the symmetric solution matrix X and the strictly lower triangular part of X is not referenced. On exit with LUPPER = .FALSE., the leading 2-by-2 lower triangular part of this array contains the lower triangular part of the symmetric solution matrix X and the strictly upper triangular part of X is not referenced. Note that X may be identified with B in the calling statement. LDX INTEGER The leading dimension of array X. LDX >= 2. XNORM (output) DOUBLE PRECISION The infinity-norm of the solution.Error Indicator
INFO INTEGER = 0: successful exit; = 1: if T and -T have too close eigenvalues, so T is perturbed to get a nonsingular equation. NOTE: In the interests of speed, this routine does not check the inputs for errors.Method
The equivalent linear algebraic system of equations is formed and solved using Gaussian elimination with complete pivoting.References
[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.Numerical Aspects
The algorithm is stable and reliable, since Gaussian elimination with complete pivoting is used.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve the real discrete Lyapunov matrix equation op(A)'*X*op(A) - X = scale*C where op(A) = A or A' (A**T), A is upper quasi-triangular and C is symmetric (C = C'). (A' denotes the transpose of the matrix A.) A is N-by-N, the right hand side C and the solution X are N-by-N, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. The solution matrix X is overwritten onto C. A must be in Schur canonical form (as returned by LAPACK routines DGEES or DHSEQR), that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign.Specification
SUBROUTINE SB03MX( TRANA, N, A, LDA, C, LDC, SCALE, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANA INTEGER INFO, LDA, LDC, N DOUBLE PRECISION SCALE C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * )Arguments
Mode Parameters
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).Input/Output Parameters
N (input) INTEGER The order of the matrices A, X, and C. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the upper quasi-triangular matrix A, in Schur canonical form. The part of A below the first sub-diagonal is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading N-by-N part of this array must contain the symmetric matrix C. On exit, if INFO >= 0, the leading N-by-N part of this array contains the symmetric solution matrix X. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing.Workspace
DWORK DOUBLE PRECISION array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if A has almost reciprocal eigenvalues; perturbed values were used to solve the equation (but the matrix A is unchanged).Method
A discrete-time version of the Bartels-Stewart algorithm is used. A set of equivalent linear algebraic systems of equations of order at most four are formed and solved using Gaussian elimination with complete pivoting.References
[1] Barraud, A.Y. T A numerical algorithm to solve A XA - X = Q. IEEE Trans. Auto. Contr., AC-22, pp. 883-885, 1977. [2] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve the real Lyapunov matrix equation op(A)'*X + X*op(A) = scale*C where op(A) = A or A' (A**T), A is upper quasi-triangular and C is symmetric (C = C'). (A' denotes the transpose of the matrix A.) A is N-by-N, the right hand side C and the solution X are N-by-N, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. The solution matrix X is overwritten onto C. A must be in Schur canonical form (as returned by LAPACK routines DGEES or DHSEQR), that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign.Specification
SUBROUTINE SB03MY( TRANA, N, A, LDA, C, LDC, SCALE, INFO ) C .. Scalar Arguments .. CHARACTER TRANA INTEGER INFO, LDA, LDC, N DOUBLE PRECISION SCALE C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), C( LDC, * )Arguments
Mode Parameters
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).Input/Output Parameters
N (input) INTEGER The order of the matrices A, X, and C. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the upper quasi-triangular matrix A, in Schur canonical form. The part of A below the first sub-diagonal is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading N-by-N part of this array must contain the symmetric matrix C. On exit, if INFO >= 0, the leading N-by-N part of this array contains the symmetric solution matrix X. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if A and -A have common or very close eigenvalues; perturbed values were used to solve the equation (but the matrix A is unchanged).Method
Bartels-Stewart algorithm is used. A set of equivalent linear algebraic systems of equations of order at most four are formed and solved using Gaussian elimination with complete pivoting.References
[1] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X = op(U)'*op(U) either the stable non-negative definite continuous-time Lyapunov equation 2 op(A)'*X + X*op(A) = -scale *op(B)'*op(B), (1) or the convergent non-negative definite discrete-time Lyapunov equation 2 op(A)'*X*op(A) - X = -scale *op(B)'*op(B), (2) where op(K) = K or K' (i.e., the transpose of the matrix K), A is an N-by-N matrix, op(B) is an M-by-N matrix, U is an upper triangular matrix containing the Cholesky factor of the solution matrix X, X = op(U)'*op(U), and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. If matrix B has full rank then the solution matrix X will be positive definite and hence the Cholesky factor U will be nonsingular, but if B is rank deficient, then X may be only positive semi-definite and U will be singular. In the case of equation (1) the matrix A must be stable (that is, all the eigenvalues of A must have negative real parts), and for equation (2) the matrix A must be convergent (that is, all the eigenvalues of A must lie inside the unit circle).Specification
SUBROUTINE SB03OD( DICO, FACT, TRANS, N, M, A, LDA, Q, LDQ, B, $ LDB, SCALE, WR, WI, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, TRANS INTEGER INFO, LDA, LDB, LDQ, LDWORK, M, N DOUBLE PRECISION SCALE C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), Q(LDQ,*), WI(*), $ WR(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of Lyapunov equation to be solved, as follows: = 'C': Equation (1), continuous-time case; = 'D': Equation (2), discrete-time case. FACT CHARACTER*1 Specifies whether or not the real Schur factorization of the matrix A is supplied on entry, as follows: = 'F': On entry, A and Q contain the factors from the real Schur factorization of the matrix A; = 'N': The Schur factorization of A will be computed and the factors will be stored in A and Q. TRANS CHARACTER*1 Specifies the form of op(K) to be used, as follows: = 'N': op(K) = K (No transpose); = 'T': op(K) = K**T (Transpose).Input/Output Parameters
N (input) INTEGER The order of the matrix A and the number of columns of the matrix op(B). N >= 0. M (input) INTEGER The number of rows of the matrix op(B). M >= 0. If M = 0, A is unchanged on exit, and Q, WR and WI are not set. 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. If FACT = 'F', then A contains an upper quasi-triangular matrix S in Schur canonical form; the elements below the upper Hessenberg part of the array A are then not referenced. On exit, the leading N-by-N upper Hessenberg part of this array contains the upper quasi-triangular matrix S in Schur canonical form from the Shur factorization of A. The contents of the array A is not modified if FACT = 'F'. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). Q (input or output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, if FACT = 'F', then the leading N-by-N part of this array must contain the orthogonal matrix Q of the Schur factorization of A. Otherwise, Q need not be set on entry. On exit, the leading N-by-N part of this array contains the orthogonal matrix Q of the Schur factorization of A. The contents of the array Q is not modified if FACT = 'F'. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) if TRANS = 'N', and dimension (LDB,max(M,N)), if TRANS = 'T'. On entry, if TRANS = 'N', the leading M-by-N part of this array must contain the coefficient matrix B of the equation. On entry, if TRANS = 'T', the leading N-by-M part of this array must contain the coefficient matrix B of the equation. On exit, the leading N-by-N part of this array contains the upper triangular Cholesky factor U of the solution matrix X of the problem, X = op(U)'*op(U). If M = 0 and N > 0, then U is set to zero. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N,M), if TRANS = 'N'; LDB >= MAX(1,N), if TRANS = 'T'. SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) If INFO >= 0 and INFO <= 3, WR and WI contain the real and imaginary parts, respectively, of the eigenvalues of A.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or INFO = 1, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -16, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. If M > 0, LDWORK >= MAX(1,4*N); If M = 0, LDWORK >= 1. For optimum performance LDWORK should sometimes 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the Lyapunov equation is (nearly) singular (warning indicator); if DICO = 'C' this means that while the matrix A (or the factor S) has computed eigenvalues with negative real parts, it is only just stable in the sense that small perturbations in A can make one or more of the eigenvalues have a non-negative real part; if DICO = 'D' this means that while the matrix A (or the factor S) has computed eigenvalues inside the unit circle, it is nevertheless only just convergent, in the sense that small perturbations in A can make one or more of the eigenvalues lie outside the unit circle; perturbed values were used to solve the equation; = 2: if FACT = 'N' and DICO = 'C', but the matrix A is not stable (that is, one or more of the eigenvalues of A has a non-negative real part), or DICO = 'D', but the matrix A is not convergent (that is, one or more of the eigenvalues of A lies outside the unit circle); however, A will still have been factored and the eigenvalues of A returned in WR and WI. = 3: if FACT = 'F' and DICO = 'C', but the Schur factor S supplied in the array A is not stable (that is, one or more of the eigenvalues of S has a non-negative real part), or DICO = 'D', but the Schur factor S supplied in the array A is not convergent (that is, one or more of the eigenvalues of S lies outside the unit circle); the eigenvalues of A are still returned in WR and WI; = 4: if FACT = 'F' and the Schur factor S supplied in the array A has two or more consecutive non-zero elements on the first subdiagonal, so that there is a block larger than 2-by-2 on the diagonal; = 5: if FACT = 'F' and the Schur factor S supplied in the array A has a 2-by-2 diagonal block with real eigenvalues instead of a complex conjugate pair; = 6: if FACT = 'N' and the LAPACK Library routine DGEES has failed to converge. This failure is not likely to occur. The matrix B will be unaltered but A will be destroyed.Method
The method used by the routine is based on the Bartels and Stewart method [1], except that it finds the upper triangular matrix U directly without first finding X and without the need to form the normal matrix op(B)'*op(B). The Schur factorization of a square matrix A is given by A = QSQ', where Q is orthogonal and S is an N-by-N block upper triangular matrix with 1-by-1 and 2-by-2 blocks on its diagonal (which correspond to the eigenvalues of A). If A has already been factored prior to calling the routine however, then the factors Q and S may be supplied and the initial factorization omitted. If TRANS = 'N' and 6*M > 7*N, the matrix B is factored as (QR factorization) _ _ B = P ( R ), ( 0 ) _ _ where P is an M-by-M orthogonal matrix and R is a square upper _ _ triangular matrix. Then, the matrix B = RQ is factored as _ B = PR. If TRANS = 'N' and 6*M <= 7*N, the matrix BQ is factored as BQ = P ( R ), M >= N, BQ = P ( R Z ), M < N. ( 0 ) If TRANS = 'T' and 6*M > 7*N, the matrix B is factored as (RQ factorization) _ _ B = ( 0 R ) P, _ _ where P is an M-by-M orthogonal matrix and R is a square upper _ _ triangular matrix. Then, the matrix B = Q' R is factored as _ B = RP. If TRANS = 'T' and 6*M <= 7*N, the matrix Q' B is factored as ( Z ) Q' B = ( 0 R ) P, M >= N, Q' B = ( ) P, M < N. ( R ) These factorizations are utilised to either transform the continuous-time Lyapunov equation to the canonical form 2 op(S)'*op(V)'*op(V) + op(V)'*op(V)*op(S) = -scale *op(F)'*op(F), or the discrete-time Lyapunov equation to the canonical form 2 op(S)'*op(V)'*op(V)*op(S) - op(V)'*op(V) = -scale *op(F)'*op(F), where V and F are upper triangular, and F = R, M >= N, F = ( R Z ), M < N, if TRANS = 'N'; ( 0 0 ) F = R, M >= N, F = ( 0 Z ), M < N, if TRANS = 'T'. ( 0 R ) The transformed equation is then solved for V, from which U is obtained via the QR factorization of V*Q', if TRANS = 'N', or via the RQ factorization of Q*V, if TRANS = 'T'.References
[1] Bartels, R.H. and Stewart, G.W. Solution of the matrix equation A'X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-325, 1982.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
The Lyapunov equation may be very ill-conditioned. In particular, if A is only just stable (or convergent) then the Lyapunov equation will be ill-conditioned. A symptom of ill-conditioning is "large" elements in U relative to those of A and B, or a "small" value for scale. A condition estimate can be computed using SLICOT Library routine SB03MD. SB03OD routine can be also used for solving "unstable" Lyapunov equations, i.e., when matrix A has all eigenvalues with positive real parts, if DICO = 'C', or with moduli greater than one, if DICO = 'D'. Specifically, one may solve for X = op(U)'*op(U) either the continuous-time Lyapunov equation 2 op(A)'*X + X*op(A) = scale *op(B)'*op(B), (3) or the discrete-time Lyapunov equation 2 op(A)'*X*op(A) - X = scale *op(B)'*op(B), (4) provided, for equation (3), the given matrix A is replaced by -A, or, for equation (4), the given matrices A and B are replaced by inv(A) and B*inv(A), if TRANS = 'N' (or inv(A)*B, if TRANS = 'T'), respectively. Although the inversion generally can rise numerical problems, in case of equation (4) it is expected that the matrix A is enough well-conditioned, having only eigenvalues with moduli greater than 1. However, if A is ill-conditioned, it could be preferable to use the more general SLICOT Lyapunov solver SB03MD.Example
Program Text
* SB03OD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDQ, LDX, LDWORK PARAMETER ( LDA = NMAX, LDB = MAX( MMAX,NMAX ), $ LDQ = NMAX, LDX = NMAX ) PARAMETER ( LDWORK = 4*NMAX+MIN(MMAX,NMAX) ) * .. Local Scalars .. DOUBLE PRECISION SCALE, TEMP INTEGER I, INFO, J, K, M, N CHARACTER*1 DICO, FACT, TRANS * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,LDB), DWORK(LDWORK), $ Q(LDQ,NMAX), WR(NMAX), WI(NMAX), X(LDX,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB03OD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, DICO, FACT, TRANS IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( FACT, 'F' ) ) READ ( NIN, FMT = * ) $ ( ( Q(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE IF ( LSAME( TRANS, 'N' ) ) THEN READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,M ) ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) END IF * Find the Cholesky factor U. CALL SB03OD( DICO, FACT, TRANS, N, M, A, LDA, Q, LDQ, B, $ LDB, SCALE, WR, WI, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 20 J = 1, N WRITE ( NOUT, FMT = 99996 ) ( B(I,J), I = 1,J ) 20 CONTINUE * Form the solution matrix X = op(U)'*op(U). IF ( LSAME( TRANS, 'N' ) ) THEN DO 80 I = 1, N DO 60 J = I, N TEMP = ZERO DO 40 K = 1, I TEMP = TEMP + B(K,I)*B(K,J) 40 CONTINUE X(I,J) = TEMP X(J,I) = TEMP 60 CONTINUE 80 CONTINUE ELSE DO 140 I = 1, N DO 120 J = I, N TEMP = ZERO DO 100 K = J, N TEMP = TEMP + B(I,K)*B(J,K) 100 CONTINUE X(I,J) = TEMP X(J,I) = TEMP 120 CONTINUE 140 CONTINUE END IF WRITE ( NOUT, FMT = 99995 ) DO 160 J = 1, N WRITE ( NOUT, FMT = 99996 ) ( X(I,J), I = 1,N ) 160 CONTINUE WRITE ( NOUT, FMT = 99992 ) SCALE END IF END IF END IF STOP * 99999 FORMAT (' SB03OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB03OD = ',I2) 99997 FORMAT (' The transpose of the Cholesky factor U is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The solution matrix X = op(U)''*op(U) is ') 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' Scaling factor = ',F8.4) ENDProgram Data
SB03OD EXAMPLE PROGRAM DATA 4 5 C N N -1.0 37.0 -12.0 -12.0 -1.0 -10.0 0.0 4.0 2.0 -4.0 7.0 -6.0 2.0 2.0 7.0 -9.0 1.0 2.5 1.0 3.5 0.0 1.0 0.0 1.0 -1.0 -2.5 -1.0 -1.5 1.0 2.5 4.0 -5.5 -1.0 -2.5 -4.0 3.5Program Results
SB03OD EXAMPLE PROGRAM RESULTS The transpose of the Cholesky factor U is 1.0000 3.0000 1.0000 2.0000 -1.0000 1.0000 -1.0000 1.0000 -2.0000 1.0000 The solution matrix X = op(U)'*op(U) is 1.0000 3.0000 2.0000 -1.0000 3.0000 10.0000 5.0000 -2.0000 2.0000 5.0000 6.0000 -5.0000 -1.0000 -2.0000 -5.0000 7.0000 Scaling factor = 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB03OR.html 0000664 0000000 0000000 00000011654 14560147231 0020371 0 ustar 00root root 0000000 0000000
Purpose
To compute the solution of the Sylvester equations op(S)'*X + X*op(A) = scale*C, if DISCR = .FALSE. or op(S)'*X*op(A) - X = scale*C, if DISCR = .TRUE. where op(K) = K or K' (i.e., the transpose of the matrix K), S is an N-by-N block upper triangular matrix with one-by-one and two-by-two blocks on the diagonal, A is an M-by-M matrix (M = 1 or M = 2), X and C are each N-by-M matrices, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. The solution X is overwritten on C. SB03OR is a service routine for the Lyapunov solver SB03OT.Specification
SUBROUTINE SB03OR( DISCR, LTRANS, N, M, S, LDS, A, LDA, C, LDC, $ SCALE, INFO ) C .. Scalar Arguments .. LOGICAL DISCR, LTRANS INTEGER INFO, LDA, LDS, LDC, M, N DOUBLE PRECISION SCALE C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), C( LDC, * ), S( LDS, * )Arguments
Mode Parameters
DISCR LOGICAL Specifies the equation to be solved: = .FALSE.: op(S)'*X + X*op(A) = scale*C; = .TRUE. : op(S)'*X*op(A) - X = scale*C. LTRANS LOGICAL Specifies the form of op(K) to be used, as follows: = .FALSE.: op(K) = K (No transpose); = .TRUE. : op(K) = K**T (Transpose).Input/Output Parameters
N (input) INTEGER The order of the matrix S and also the number of rows of matrices X and C. N >= 0. M (input) INTEGER The order of the matrix A and also the number of columns of matrices X and C. M = 1 or M = 2. S (input) DOUBLE PRECISION array, dimension (LDS,N) The leading N-by-N upper Hessenberg part of the array S must contain the block upper triangular matrix. The elements below the upper Hessenberg part of the array S are not referenced. The array S must not contain diagonal blocks larger than two-by-two and the two-by-two blocks must only correspond to complex conjugate pairs of eigenvalues, not to real eigenvalues. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,N). A (input) DOUBLE PRECISION array, dimension (LDS,M) The leading M-by-M part of this array must contain a given matrix, where M = 1 or M = 2. LDA INTEGER The leading dimension of array A. LDA >= M. C (input/output) DOUBLE PRECISION array, dimension (LDC,M) On entry, C must contain an N-by-M matrix, where M = 1 or M = 2. On exit, C contains the N-by-M matrix X, the solution of the Sylvester equation. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing.Error Indicator
INFO INTEGER = 0: successful exit; = 1: if DISCR = .FALSE., and S and -A have common eigenvalues, or if DISCR = .TRUE., and S and A have eigenvalues whose product is equal to unity; a solution has been computed using slightly perturbed values.Method
The LAPACK scheme for solving Sylvester equations is adapted.References
[1] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-325, 1982.Numerical Aspects
2 The algorithm requires 0(N M) operations and is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
H To solve for X = op(U) *op(U) either the stable non-negative definite continuous-time Lyapunov equation H 2 H op(S) *X + X*op(S) = -scale *op(R) *op(R), (1) or the convergent non-negative definite discrete-time Lyapunov equation H 2 H op(S) *X*op(S) - X = -scale *op(R) *op(R), (2) where op(K) = K or K**H (i.e., the conjugate transpose of the matrix K), S and R are complex N-by-N upper triangular matrices, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. The diagonal elements of the matrix R must be real non-negative. In the case of equation (1) the matrix S must be stable (that is, all the eigenvalues of S must have negative real parts), and for equation (2) the matrix S must be convergent (that is, all the eigenvalues of S must lie inside the unit circle).Specification
SUBROUTINE SB03OS( DISCR, LTRANS, N, S, LDS, R, LDR, SCALE, DWORK, $ ZWORK, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION SCALE INTEGER INFO, LDR, LDS, N LOGICAL DISCR, LTRANS C .. Array Arguments .. COMPLEX*16 R(LDR,*), S(LDS,*), ZWORK(*) DOUBLE PRECISION DWORK(*)Arguments
Mode Parameters
DISCR LOGICAL Specifies the type of Lyapunov equation to be solved as follows: = .TRUE. : Equation (2), discrete-time case; = .FALSE.: Equation (1), continuous-time case. LTRANS LOGICAL Specifies the form of op(K) to be used, as follows: = .FALSE.: op(K) = K (No transpose); = .TRUE. : op(K) = K**H (Conjugate transpose).Input/Output Parameters
N (input) INTEGER The order of the matrices S and R. N >= 0. S (input) COMPLEX*16 array of dimension (LDS,N) The leading N-by-N upper triangular part of this array must contain the upper triangular matrix. The elements below the upper triangular part of the array S are not referenced. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,N). R (input/output) COMPLEX*16 array of dimension (LDR,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix R, with real non-negative entries on its main diagonal. On exit, the leading N-by-N upper triangular part of this array contains the upper triangular matrix U, with real non-negative entries on its main diagonal. The strictly lower triangle of R is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing.Workspace
DWORK DOUBLE PRECISION array, dimension (N-1) ZWORK COMPLEX*16 array, dimension (2*N-2)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 3: if the matrix S is not stable (that is, one or more of the eigenvalues of S has a non-negative real part), if DISCR = .FALSE., or not convergent (that is, one or more of the eigenvalues of S lies outside the unit circle), if DISCR = .TRUE..Method
The method used by the routine is based on a variant of the Bartels and Stewart backward substitution method [1], that finds the Cholesky factor op(U) directly without first finding X and without the need to form the normal matrix op(R)'*op(R) [2]. The continuous-time Lyapunov equation in the canonical form H H H 2 H op(S) *op(U) *op(U) + op(U) *op(U)*op(S) = -scale *op(R) *op(R), or the discrete-time Lyapunov equation in the canonical form H H H 2 H op(S) *op(U) *op(U)*op(S) - op(U) *op(U) = -scale *op(R) *op(R), where U and R are upper triangular, is solved for U.References
[1] Bartels, R.H. and Stewart, G.W. Solution of the matrix equation A'X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-325, 1982.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
The Lyapunov equation may be very ill-conditioned. In particular if S is only just stable (or convergent) then the Lyapunov equation will be ill-conditioned. "Large" elements in U relative to those of S and R, or a "small" value for scale, is a symptom of ill-conditioning. A condition estimate can be computed using SLICOT Library routine SB03MD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X = op(U)'*op(U) either the stable non-negative definite continuous-time Lyapunov equation 2 op(S)'*X + X*op(S) = -scale *op(R)'*op(R) (1) or the convergent non-negative definite discrete-time Lyapunov equation 2 op(S)'*X*op(S) - X = -scale *op(R)'*op(R) (2) where op(K) = K or K' (i.e., the transpose of the matrix K), S is an N-by-N block upper triangular matrix with one-by-one or two-by-two blocks on the diagonal, R is an N-by-N upper triangular matrix, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. In the case of equation (1) the matrix S must be stable (that is, all the eigenvalues of S must have negative real parts), and for equation (2) the matrix S must be convergent (that is, all the eigenvalues of S must lie inside the unit circle).Specification
SUBROUTINE SB03OT( DISCR, LTRANS, N, S, LDS, R, LDR, SCALE, DWORK, $ INFO ) C .. Scalar Arguments .. LOGICAL DISCR, LTRANS INTEGER INFO, LDR, LDS, N DOUBLE PRECISION SCALE C .. Array Arguments .. DOUBLE PRECISION DWORK(*), R(LDR,*), S(LDS,*)Arguments
Mode Parameters
DISCR LOGICAL Specifies the type of Lyapunov equation to be solved as follows: = .TRUE. : Equation (2), discrete-time case; = .FALSE.: Equation (1), continuous-time case. LTRANS LOGICAL Specifies the form of op(K) to be used, as follows: = .FALSE.: op(K) = K (No transpose); = .TRUE. : op(K) = K**T (Transpose).Input/Output Parameters
N (input) INTEGER The order of the matrices S and R. N >= 0. S (input) DOUBLE PRECISION array of dimension (LDS,N) The leading N-by-N upper Hessenberg part of this array must contain the block upper triangular matrix. The elements below the upper Hessenberg part of the array S are not referenced. The 2-by-2 blocks must only correspond to complex conjugate pairs of eigenvalues (not to real eigenvalues). LDS INTEGER The leading dimension of array S. LDS >= MAX(1,N). R (input/output) DOUBLE PRECISION array of dimension (LDR,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix R. On exit, the leading N-by-N upper triangular part of this array contains the upper triangular matrix U. The strict lower triangle of R is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing.Workspace
DWORK DOUBLE PRECISION array, dimension (4*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the Lyapunov equation is (nearly) singular (warning indicator); if DISCR = .FALSE., this means that while the matrix S has computed eigenvalues with negative real parts, it is only just stable in the sense that small perturbations in S can make one or more of the eigenvalues have a non-negative real part; if DISCR = .TRUE., this means that while the matrix S has computed eigenvalues inside the unit circle, it is nevertheless only just convergent, in the sense that small perturbations in S can make one or more of the eigenvalues lie outside the unit circle; perturbed values were used to solve the equation (but the matrix S is unchanged); = 2: if the matrix S is not stable (that is, one or more of the eigenvalues of S has a non-negative real part), if DISCR = .FALSE., or not convergent (that is, one or more of the eigenvalues of S lies outside the unit circle), if DISCR = .TRUE.; = 3: if the matrix S has two or more consecutive non-zero elements on the first sub-diagonal, so that there is a block larger than 2-by-2 on the diagonal; = 4: if the matrix S has a 2-by-2 diagonal block with real eigenvalues instead of a complex conjugate pair.Method
The method used by the routine is based on a variant of the Bartels and Stewart backward substitution method [1], that finds the Cholesky factor op(U) directly without first finding X and without the need to form the normal matrix op(R)'*op(R) [2]. The continuous-time Lyapunov equation in the canonical form 2 op(S)'*op(U)'*op(U) + op(U)'*op(U)*op(S) = -scale *op(R)'*op(R), or the discrete-time Lyapunov equation in the canonical form 2 op(S)'*op(U)'*op(U)*op(S) - op(U)'*op(U) = -scale *op(R)'*op(R), where U and R are upper triangular, is solved for U.References
[1] Bartels, R.H. and Stewart, G.W. Solution of the matrix equation A'X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-325, 1982.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
The Lyapunov equation may be very ill-conditioned. In particular if S is only just stable (or convergent) then the Lyapunov equation will be ill-conditioned. "Large" elements in U relative to those of S and R, or a "small" value for scale, is a symptom of ill-conditioning. A condition estimate can be computed using SLICOT Library routine SB03MD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X = op(U)'*op(U) either the stable non-negative definite continuous-time Lyapunov equation 2 op(A)'*X + X*op(A) = -scale *op(B)'*op(B) (1) or the convergent non-negative definite discrete-time Lyapunov equation 2 op(A)'*X*op(A) - X = -scale *op(B)'*op(B) (2) where op(K) = K or K' (i.e., the transpose of the matrix K), A is an N-by-N matrix in real Schur form, op(B) is an M-by-N matrix, U is an upper triangular matrix containing the Cholesky factor of the solution matrix X, X = op(U)'*op(U), and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. If matrix B has full rank then the solution matrix X will be positive-definite and hence the Cholesky factor U will be nonsingular, but if B is rank deficient then X may only be positive semi-definite and U will be singular. In the case of equation (1) the matrix A must be stable (that is, all the eigenvalues of A must have negative real parts), and for equation (2) the matrix A must be convergent (that is, all the eigenvalues of A must lie inside the unit circle).Specification
SUBROUTINE SB03OU( DISCR, LTRANS, N, M, A, LDA, B, LDB, TAU, U, $ LDU, SCALE, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. LOGICAL DISCR, LTRANS INTEGER INFO, LDA, LDB, LDU, LDWORK, M, N DOUBLE PRECISION SCALE C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), TAU(*), U(LDU,*)Arguments
Mode Parameters
DISCR LOGICAL Specifies the type of Lyapunov equation to be solved as follows: = .TRUE. : Equation (2), discrete-time case; = .FALSE.: Equation (1), continuous-time case. LTRANS LOGICAL Specifies the form of op(K) to be used, as follows: = .FALSE.: op(K) = K (No transpose); = .TRUE. : op(K) = K**T (Transpose).Input/Output Parameters
N (input) INTEGER The order of the matrix A and the number of columns in matrix op(B). N >= 0. M (input) INTEGER The number of rows in matrix op(B). M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N upper Hessenberg part of this array must contain a real Schur form matrix S. The elements below the upper Hessenberg part of the array A are not referenced. The 2-by-2 blocks must only correspond to complex conjugate pairs of eigenvalues (not to real eigenvalues). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) if LTRANS = .FALSE., and dimension (LDB,M), if LTRANS = .TRUE.. On entry, if LTRANS = .FALSE., the leading M-by-N part of this array must contain the coefficient matrix B of the equation. On entry, if LTRANS = .TRUE., the leading N-by-M part of this array must contain the coefficient matrix B of the equation. On exit, if LTRANS = .FALSE., the leading MIN(M,N)-by-MIN(M,N) upper triangular part of this array contains the upper triangular matrix R (as defined in METHOD), and the M-by-MIN(M,N) strictly lower triangular part together with the elements of the array TAU are overwritten by details of the matrix P (also defined in METHOD). When M < N, columns (M+1),...,N of the array B are overwritten by the matrix Z (see METHOD). On exit, if LTRANS = .TRUE., the leading MIN(M,N)-by-MIN(M,N) upper triangular part of B(1:N,M-N+1), if M >= N, or of B(N-M+1:N,1:M), if M < N, contains the upper triangular matrix R (as defined in METHOD), and the remaining elements (below the diagonal of R) together with the elements of the array TAU are overwritten by details of the matrix P (also defined in METHOD). When M < N, rows 1,...,(N-M) of the array B are overwritten by the matrix Z (see METHOD). LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M), if LTRANS = .FALSE., LDB >= MAX(1,N), if LTRANS = .TRUE.. TAU (output) DOUBLE PRECISION array of dimension (MIN(N,M)) This array contains the scalar factors of the elementary reflectors defining the matrix P. U (output) DOUBLE PRECISION array of dimension (LDU,N) The leading N-by-N upper triangular part of this array contains the Cholesky factor of the solution matrix X of the problem, X = op(U)'*op(U). The array U may be identified with B in the calling statement, if B is properly dimensioned, and the intermediate results returned in B are not needed. LDU INTEGER The leading dimension of array U. LDU >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, or INFO = 1, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,4*N). For optimum performance LDWORK should sometimes 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the Lyapunov equation is (nearly) singular (warning indicator); if DISCR = .FALSE., this means that while the matrix A has computed eigenvalues with negative real parts, it is only just stable in the sense that small perturbations in A can make one or more of the eigenvalues have a non-negative real part; if DISCR = .TRUE., this means that while the matrix A has computed eigenvalues inside the unit circle, it is nevertheless only just convergent, in the sense that small perturbations in A can make one or more of the eigenvalues lie outside the unit circle; perturbed values were used to solve the equation (but the matrix A is unchanged); = 2: if matrix A is not stable (that is, one or more of the eigenvalues of A has a non-negative real part), if DISCR = .FALSE., or not convergent (that is, one or more of the eigenvalues of A lies outside the unit circle), if DISCR = .TRUE.; = 3: if matrix A has two or more consecutive non-zero elements on the first sub-diagonal, so that there is a block larger than 2-by-2 on the diagonal; = 4: if matrix A has a 2-by-2 diagonal block with real eigenvalues instead of a complex conjugate pair.Method
The method used by the routine is based on the Bartels and Stewart method [1], except that it finds the upper triangular matrix U directly without first finding X and without the need to form the normal matrix op(B)'*op(B) [2]. If LTRANS = .FALSE., the matrix B is factored as B = P ( R ), M >= N, B = P ( R Z ), M < N, ( 0 ) (QR factorization), where P is an M-by-M orthogonal matrix and R is a square upper triangular matrix. If LTRANS = .TRUE., the matrix B is factored as B = ( 0 R ) P, M >= N, B = ( Z ) P, M < N, ( R ) (RQ factorization), where P is an M-by-M orthogonal matrix and R is a square upper triangular matrix. These factorizations are used to solve the continuous-time Lyapunov equation in the canonical form 2 op(A)'*op(U)'*op(U) + op(U)'*op(U)*op(A) = -scale *op(F)'*op(F), or the discrete-time Lyapunov equation in the canonical form 2 op(A)'*op(U)'*op(U)*op(A) - op(U)'*op(U) = -scale *op(F)'*op(F), where U and F are N-by-N upper triangular matrices, and F = R, if M >= N, or F = ( R ), if LTRANS = .FALSE., or ( 0 ) F = ( 0 Z ), if LTRANS = .TRUE., if M < N. ( 0 R ) The canonical equation is solved for U.References
[1] Bartels, R.H. and Stewart, G.W. Solution of the matrix equation A'X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-325, 1982.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
The Lyapunov equation may be very ill-conditioned. In particular, if A is only just stable (or convergent) then the Lyapunov equation will be ill-conditioned. "Large" elements in U relative to those of A and B, or a "small" value for scale, are symptoms of ill-conditioning. A condition estimate can be computed using SLICOT Library routine SB03MD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct a complex plane rotation such that, for a complex number a and a real number b, ( conjg( c ) s )*( a ) = ( d ), ( -s c ) ( b ) ( 0 ) where d is always real and is overwritten on a, so that on return the imaginary part of a is zero. b is unaltered. This routine has A and C declared as REAL, because it is intended for use within a real Lyapunov solver and the REAL declarations mean that a standard Fortran DOUBLE PRECISION version may be readily constructed. However A and C could safely be declared COMPLEX in the calling program, although some systems may give a type mismatch warning.Specification
SUBROUTINE SB03OV( A, B, SMALL, C, S ) C .. Scalar Arguments .. DOUBLE PRECISION B, S, SMALL C .. Array Arguments .. DOUBLE PRECISION A(2), C(2)Arguments
Input/Output Parameters
A (input/output) DOUBLE PRECISION array, dimension (2) On entry, A(1) and A(2) must contain the real and imaginary part, respectively, of the complex number a. On exit, A(1) contains the real part of d, and A(2) is set to zero. B (input) DOUBLE PRECISION The real number b. SMALL (input) DOUBLE PRECISION A small real number. If the norm d of [ a; b ] is smaller than SMALL, then the rotation is taken as a unit matrix, and A(1) and A(2) are set to d and 0, respectively. C (output) DOUBLE PRECISION array, dimension (2) C(1) and C(2) contain the real and imaginary part, respectively, of the complex number c, the cosines of the plane rotation. S (output) DOUBLE PRECISION The real number s, the sines of the plane rotation.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for the Cholesky factor U of X, op(U)'*op(U) = X, where U is a two-by-two upper triangular matrix, either the continuous-time two-by-two Lyapunov equation 2 op(S)'*X + X*op(S) = -ISGN*scale *op(R)'*op(R), when DISCR = .FALSE., or the discrete-time two-by-two Lyapunov equation 2 op(S)'*X*op(S) - X = -ISGN*scale *op(R)'*op(R), when DISCR = .TRUE., where op(K) = K or K' (i.e., the transpose of the matrix K), S is a two-by-two matrix with complex conjugate eigenvalues, R is a two-by-two upper triangular matrix, ISGN = -1 or 1, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. The routine also computes two matrices, B and A, so that 2 B*U = U*S and A*U = scale *R, if LTRANS = .FALSE., or 2 U*B = S*U and U*A = scale *R, if LTRANS = .TRUE., which are used by the general Lyapunov solver. In the continuous-time case ISGN*S must be stable, so that its eigenvalues must have strictly negative real parts. In the discrete-time case S must be convergent if ISGN = 1, that is, its eigenvalues must have moduli less than unity, or S must be completely divergent if ISGN = -1, that is, its eigenvalues must have moduli greater than unity.Specification
SUBROUTINE SB03OY( DISCR, LTRANS, ISGN, S, LDS, R, LDR, A, LDA, $ SCALE, INFO ) C .. Scalar Arguments .. LOGICAL DISCR, LTRANS INTEGER INFO, ISGN, LDA, LDR, LDS DOUBLE PRECISION SCALE C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), R(LDR,*), S(LDS,*)Arguments
Mode Parameters
DISCR LOGICAL Specifies the equation to be solved: 2 = .FALSE.: op(S)'*X + X*op(S) = -ISGN*scale *op(R)'*op(R); 2 = .TRUE. : op(S)'*X*op(S) - X = -ISGN*scale *op(R)'*op(R). LTRANS LOGICAL Specifies the form of op(K) to be used, as follows: = .FALSE.: op(K) = K (No transpose); = .TRUE. : op(K) = K**T (Transpose). ISGN INTEGER Specifies the sign of the equation as described before. ISGN may only be 1 or -1.Input/Output Parameters
S (input/output) DOUBLE PRECISION array, dimension (LDS,2) On entry, S must contain a 2-by-2 matrix. On exit, S contains a 2-by-2 matrix B such that B*U = U*S, if LTRANS = .FALSE., or U*B = S*U, if LTRANS = .TRUE.. Notice that if U is nonsingular then B = U*S*inv( U ), if LTRANS = .FALSE. B = inv( U )*S*U, if LTRANS = .TRUE.. LDS INTEGER The leading dimension of array S. LDS >= 2. R (input/output) DOUBLE PRECISION array, dimension (LDR,2) On entry, R must contain a 2-by-2 upper triangular matrix. The element R( 2, 1 ) is not referenced. On exit, R contains U, the 2-by-2 upper triangular Cholesky factor of the solution X, X = op(U)'*op(U). LDR INTEGER The leading dimension of array R. LDR >= 2. A (output) DOUBLE PRECISION array, dimension (LDA,2) A contains a 2-by-2 upper triangular matrix A satisfying A*U/scale = scale*R, if LTRANS = .FALSE., or U*A/scale = scale*R, if LTRANS = .TRUE.. Notice that if U is nonsingular then A = scale*scale*R*inv( U ), if LTRANS = .FALSE. A = scale*scale*inv( U )*R, if LTRANS = .TRUE.. LDA INTEGER The leading dimension of array A. LDA >= 2. SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing.Error Indicator
INFO INTEGER = 0: successful exit; = 1: if the Lyapunov equation is (nearly) singular (warning indicator); if DISCR = .FALSE., this means that while the matrix S has computed eigenvalues with negative real parts, it is only just stable in the sense that small perturbations in S can make one or more of the eigenvalues have a non-negative real part; if DISCR = .TRUE., this means that while the matrix S has computed eigenvalues inside the unit circle, it is nevertheless only just convergent, in the sense that small perturbations in S can make one or more of the eigenvalues lie outside the unit circle; perturbed values were used to solve the equation (but the matrix S is unchanged); = 2: if DISCR = .FALSE., and ISGN*S is not stable or if DISCR = .TRUE., ISGN = 1 and S is not convergent or if DISCR = .TRUE., ISGN = -1 and S is not completely divergent; = 4: if S has real eigenvalues. NOTE: In the interests of speed, this routine does not check all inputs for errors.Method
The LAPACK scheme for solving 2-by-2 Sylvester equations is adapted for 2-by-2 Lyapunov equations, but directly computing the Cholesky factor of the solution.References
[1] Hammarling S. J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-325, 1982.Numerical Aspects
The algorithm is backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
H To solve for X = op(U) *op(U) either the stable non-negative definite continuous-time Lyapunov equation H 2 H op(A) *X + X*op(A) = -scale *op(B) *op(B), (1) or the convergent non-negative definite discrete-time Lyapunov equation H 2 H op(A) *X*op(A) - X = -scale *op(B) *op(B), (2) where op(K) = K or K**H (i.e., the conjugate transpose of the matrix K), A is an N-by-N matrix, op(B) is an M-by-N matrix, U is an upper triangular matrix containing the Cholesky factor of the solution matrix X, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. If matrix B has full rank, then the solution matrix X will be positive definite and hence the Cholesky factor U will be nonsingular, but if B is rank deficient, then X may be only positive semi-definite and U will be singular. In the case of equation (1) the matrix A must be stable (that is, all the eigenvalues of A must have negative real parts), and for equation (2) the matrix A must be convergent (that is, all the eigenvalues of A must lie inside the unit circle).Specification
SUBROUTINE SB03OZ( DICO, FACT, TRANS, N, M, A, LDA, Q, LDQ, B, $ LDB, SCALE, W, DWORK, ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, TRANS INTEGER INFO, LDA, LDB, LDQ, LZWORK, M, N DOUBLE PRECISION SCALE C .. Array Arguments .. COMPLEX*16 A(LDA,*), B(LDB,*), Q(LDQ,*), W(*), ZWORK(*) DOUBLE PRECISION DWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of Lyapunov equation to be solved, as follows: = 'C': Equation (1), continuous-time case; = 'D': Equation (2), discrete-time case. FACT CHARACTER*1 Specifies whether or not the Schur factorization of the matrix A is supplied on entry, as follows: = 'F': On entry, A and Q contain the factors from the Schur factorization of the matrix A; = 'N': The Schur factorization of A will be computed and the factors will be stored in A and Q. TRANS CHARACTER*1 Specifies the form of op(K) to be used, as follows: = 'N': op(K) = K (No transpose); = 'C': op(K) = K**H (Conjugate transpose).Input/Output Parameters
N (input) INTEGER The order of the matrix A and the number of columns of the matrix op(B). N >= 0. M (input) INTEGER The number of rows of the matrix op(B). M >= 0. If M = 0, A is unchanged on exit, and Q and W are not set. 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. If FACT = 'F', then A contains an upper triangular matrix S in Schur form; the elements below the diagonal of the array A are then not referenced. On exit, the leading N-by-N upper triangular part of this array contains the upper triangle of the matrix S. The contents of the array A is not modified if FACT = 'F'. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). Q (input or output) COMPLEX*16 array, dimension (LDQ,N) On entry, if FACT = 'F', then the leading N-by-N part of this array must contain the unitary matrix Q of the Schur factorization of A. Otherwise, Q need not be set on entry. On exit, the leading N-by-N part of this array contains the unitary matrix Q of the Schur factorization of A. The contents of the array Q is not modified if FACT = 'F'. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). B (input/output) COMPLEX*16 array, dimension (LDB,N) if TRANS = 'N', and dimension (LDB,max(M,N)), if TRANS = 'C'. On entry, if TRANS = 'N', the leading M-by-N part of this array must contain the coefficient matrix B of the equation. On entry, if TRANS = 'C', the leading N-by-M part of this array must contain the coefficient matrix B of the equation. On exit, the leading N-by-N part of this array contains the upper triangular Cholesky factor U of the solution matrix X of the problem, X = op(U)**H * op(U). If M = 0 and N > 0, then U is set to zero. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N,M), if TRANS = 'N'; LDB >= MAX(1,N), if TRANS = 'C'. SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing. W (output) COMPLEX*16 array, dimension (N) If INFO >= 0 and INFO <= 3, W contains the eigenvalues of the matrix A.Workspace
DWORK DOUBLE PRECISION array, dimension (N) ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0 or INFO = 1, ZWORK(1) returns the optimal value of LZWORK. On exit, if INFO = -16, ZWORK(1) returns the minimum value of LZWORK. LZWORK INTEGER The length of the array ZWORK. If M > 0, LZWORK >= MAX(1,2*N+MAX(MIN(N,M)-2,0)); If M = 0, LZWORK >= 1. For optimum performance LZWORK should sometimes be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the Lyapunov equation is (nearly) singular (warning indicator); if DICO = 'C' this means that while the matrix A (or the factor S) has computed eigenvalues with negative real parts, it is only just stable in the sense that small perturbations in A can make one or more of the eigenvalues have a non-negative real part; if DICO = 'D' this means that while the matrix A (or the factor S) has computed eigenvalues inside the unit circle, it is nevertheless only just convergent, in the sense that small perturbations in A can make one or more of the eigenvalues lie outside the unit circle; perturbed values were used to solve the equation; = 2: if FACT = 'N' and DICO = 'C', but the matrix A is not stable (that is, one or more of the eigenvalues of A has a non-negative real part), or DICO = 'D', but the matrix A is not convergent (that is, one or more of the eigenvalues of A lies outside the unit circle); however, A will still have been factored and the eigenvalues of A returned in W; = 3: if FACT = 'F' and DICO = 'C', but the Schur factor S supplied in the array A is not stable (that is, one or more of the eigenvalues of S has a non-negative real part), or DICO = 'D', but the Schur factor S supplied in the array A is not convergent (that is, one or more of the eigenvalues of S lies outside the unit circle); the eigenvalues of A are still returned in W; = 6: if FACT = 'N' and the LAPACK Library routine ZGEES has failed to converge. This failure is not likely to occur. The matrix B will be unaltered but A will be destroyed.Method
The method used by the routine is based on the Bartels and Stewart method [1], except that it finds the upper triangular matrix U directly without first finding X and without the need to form the normal matrix op(B)**H * op(B). The Schur factorization of a square matrix A is given by H A = QSQ , where Q is unitary and S is an N-by-N upper triangular matrix. If A has already been factored prior to calling the routine, then the factors Q and S may be supplied and the initial factorization omitted. If TRANS = 'N' and 6*M > 7*N, the matrix B is factored as (QR factorization) _ _ B = P ( R ), ( 0 ) _ _ where P is an M-by-M unitary matrix and R is a square upper _ _ triangular matrix. Then, the matrix B = RQ is factored as _ B = PR. If TRANS = 'N' and 6*M <= 7*N, the matrix BQ is factored as BQ = P ( R ), M >= N, BQ = P ( R Z ), M < N. ( 0 ) If TRANS = 'C' and 6*M > 7*N, the matrix B is factored as (RQ factorization) _ _ B = ( 0 R ) P, _ _ where P is an M-by-M unitary matrix and R is a square upper _ H _ triangular matrix. Then, the matrix B = Q R is factored as _ B = RP. H If TRANS = 'C' and 6*M <= 7*N, the matrix Q B is factored as H H ( Z ) Q B = ( 0 R ) P, M >= N, Q B = ( ) P, M < N. ( R ) These factorizations are utilised to either transform the continuous-time Lyapunov equation to the canonical form H H H 2 H op(S) *op(V) *op(V) + op(V) *op(V)*op(S) = -scale *op(F) *op(F), or the discrete-time Lyapunov equation to the canonical form H H H 2 H op(S) *op(V) *op(V)*op(S) - op(V) *op(V) = -scale *op(F) *op(F), where V and F are upper triangular, and F = R, M >= N, F = ( R Z ), M < N, if TRANS = 'N'; ( 0 0 ) F = R, M >= N, F = ( 0 Z ), M < N, if TRANS = 'C'. ( 0 R ) The transformed equation is then solved for V, from which U is obtained via the QR factorization of V*Q**H, if TRANS = 'N', or via the RQ factorization of Q*V, if TRANS = 'C'.References
[1] Bartels, R.H. and Stewart, G.W. Solution of the matrix equation A'X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-325, 1982.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
The Lyapunov equation may be very ill-conditioned. In particular, if A is only just stable (or convergent) then the Lyapunov equation will be ill-conditioned. A symptom of ill-conditioning is "large" elements in U relative to those of A and B, or a "small" value for scale. SB03OZ routine can be also used for solving "unstable" Lyapunov equations, i.e., when matrix A has all eigenvalues with positive real parts, if DICO = 'C', or with moduli greater than one, if DICO = 'D'. Specifically, one may solve for X = op(U)**H*op(U) either the continuous-time Lyapunov equation H 2 H op(A) *X + X*op(A) = scale *op(B) *op(B), (3) or the discrete-time Lyapunov equation H 2 H op(A) *X*op(A) - X = scale *op(B) *op(B), (4) provided, for equation (3), the given matrix A is replaced by -A, or, for equation (4), the given matrices A and B are replaced by inv(A) and B*inv(A), if TRANS = 'N' (or inv(A)*B, if TRANS = 'C'), respectively. Although the inversion generally can rise numerical problems, in case of equation (4) it is expected that the matrix A is enough well-conditioned, having only eigenvalues with moduli greater than 1.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB03PD.html 0000664 0000000 0000000 00000021300 14560147231 0020341 0 ustar 00root root 0000000 0000000
Purpose
To solve the real discrete Lyapunov matrix equation op(A)'*X*op(A) - X = scale*C and/or estimate the quantity, called separation, sepd(op(A),op(A)') = min norm(op(A)'*X*op(A) - X)/norm(X) where op(A) = A or A' (A**T) and C is symmetric (C = C'). (A' denotes the transpose of the matrix A.) A is N-by-N, the right hand side C and the solution X are N-by-N, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X.Specification
SUBROUTINE SB03PD( JOB, FACT, TRANA, N, A, LDA, U, LDU, C, LDC, $ SCALE, SEPD, FERR, WR, WI, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER FACT, JOB, TRANA INTEGER INFO, LDA, LDC, LDU, LDWORK, N DOUBLE PRECISION FERR, SCALE, SEPD C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * ), $ U( LDU, * ), WI( * ), WR( * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'X': Compute the solution only; = 'S': Compute the separation only; = 'B': Compute both the solution and the separation. FACT CHARACTER*1 Specifies whether or not the real Schur factorization of the matrix A is supplied on entry, as follows: = 'F': On entry, A and U contain the factors from the real Schur factorization of the matrix A; = 'N': The Schur factorization of A will be computed and the factors will be stored in A and U. 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).Input/Output Parameters
N (input) INTEGER The order of the matrices A, X, and C. N >= 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. If FACT = 'F', then A contains an upper quasi-triangular matrix in Schur canonical form. On exit, if INFO = 0 or INFO = N+1, the leading N-by-N part of this array contains the upper quasi-triangular matrix in Schur canonical form from the Shur factorization of A. The contents of array A is not modified if FACT = 'F'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). U (input or output) DOUBLE PRECISION array, dimension (LDU,N) If FACT = 'F', then U is an input argument and on entry it must contain the orthogonal matrix U from the real Schur factorization of A. If 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 the real Schur factorization of A. LDU INTEGER The leading dimension of array U. LDU >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry with JOB = 'X' or 'B', the leading N-by-N part of this array must contain the symmetric matrix C. On exit with JOB = 'X' or 'B', if INFO = 0 or INFO = N+1, the leading N-by-N part of C has been overwritten by the symmetric solution matrix X. If JOB = 'S', C is not referenced. LDC INTEGER The leading dimension of array C. LDC >= 1, if JOB = 'S'; LDC >= MAX(1,N), otherwise. SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing. SEPD (output) DOUBLE PRECISION If JOB = 'S' or JOB = 'B', and INFO = 0 or INFO = N+1, SEPD contains the estimate in the 1-norm of sepd(op(A),op(A)'). If JOB = 'X' or N = 0, SEPD is not referenced. FERR (output) DOUBLE PRECISION If JOB = 'B', and INFO = 0 or INFO = N+1, FERR contains an estimated forward error bound for the solution X. If XTRUE is the true solution, FERR bounds the relative error in the computed solution, measured in the Frobenius norm: norm(X - XTRUE)/norm(XTRUE). If JOB = 'X' or JOB = 'S', FERR is not referenced. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) If FACT = 'N', and INFO = 0 or INFO = N+1, WR and WI contain the real and imaginary parts, respectively, of the eigenvalues of A. If FACT = 'F', WR and WI are not referenced.Workspace
IWORK INTEGER array, dimension (N*N) This array is not referenced if JOB = 'X'. 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 length of the array DWORK. LDWORK >= 1 and If JOB = 'X' then If FACT = 'F', LDWORK >= MAX(N*N,2*N); If FACT = 'N', LDWORK >= MAX(N*N,3*N). If JOB = 'S' or JOB = 'B' then LDWORK >= 2*N*N + 2*N. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues (see LAPACK Library routine DGEES); elements i+1:n of WR and WI contain eigenvalues which have converged, and A contains the partially converged Schur form; = N+1: if matrix A has almost reciprocal eigenvalues; perturbed values were used to solve the equation (but the matrix A is unchanged).Method
After reducing matrix A to real Schur canonical form (if needed), a discrete-time version of the Bartels-Stewart algorithm is used. A set of equivalent linear algebraic systems of equations of order at most four are formed and solved using Gaussian elimination with complete pivoting.References
[1] Barraud, A.Y. T A numerical algorithm to solve A XA - X = Q. IEEE Trans. Auto. Contr., AC-22, pp. 883-885, 1977. [2] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
SEPD is defined as sepd( op(A), op(A)' ) = sigma_min( T ) where sigma_min(T) is the smallest singular value of the N*N-by-N*N matrix T = kprod( op(A)', op(A)' ) - I(N**2). I(N**2) is an N*N-by-N*N identity matrix, and kprod denotes the Kronecker product. The program estimates sigma_min(T) by the reciprocal of an estimate of the 1-norm of inverse(T). The true reciprocal 1-norm of inverse(T) cannot differ from sigma_min(T) by more than a factor of N. When SEPD is small, small changes in A, C can cause large changes in the solution of the equation. An approximate bound on the maximum relative error in the computed solution is EPS * norm(A)**2 / SEPD where EPS is the machine precision.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB03QD.html 0000664 0000000 0000000 00000037256 14560147231 0020363 0 ustar 00root root 0000000 0000000
Purpose
To estimate the conditioning and compute an error bound on the solution of the real continuous-time Lyapunov matrix equation op(A)'*X + X*op(A) = scale*C where op(A) = A or A' (A**T) and C is symmetric (C = C**T). The matrix A is N-by-N, the right hand side C and the solution X are N-by-N symmetric matrices, and scale is a given scale factor.Specification
SUBROUTINE SB03QD( JOB, FACT, TRANA, UPLO, LYAPUN, N, SCALE, A, $ LDA, T, LDT, U, LDU, C, LDC, X, LDX, SEP, $ RCOND, FERR, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER FACT, JOB, LYAPUN, TRANA, UPLO INTEGER INFO, LDA, LDC, LDT, LDU, LDWORK, LDX, N DOUBLE PRECISION FERR, RCOND, SCALE, SEP C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * ), $ T( LDT, * ), U( LDU, * ), X( LDX, * )Arguments
Mode Parameters
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 A 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 A; = 'N': The Schur factorization of A 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 matrix C 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., X <-- U'*X*U; = 'R': Solve reduced Lyapunov equations only, without updating the right-hand sides and solutions.Input/Output Parameters
N (input) INTEGER The order of the matrices A, X and C. N >= 0. SCALE (input) DOUBLE PRECISION The scale factor, scale, set by a Lyapunov solver. 0 <= SCALE <= 1. 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 original 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/output) DOUBLE PRECISION array, dimension (LDT,N) If FACT = 'F', then 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 A. If FACT = 'N', then this array need not be set on input. On exit, (if INFO = 0 or INFO = N+1, for FACT = 'N') 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 A. 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 A. 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 A. 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'. C (input) DOUBLE PRECISION array, dimension (LDC,N) If UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the matrix C of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. If UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the matrix C of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. LDC INTEGER The leading dimension of the array C. LDC >= 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 X of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,N). SEP (output) DOUBLE PRECISION If JOB = 'C' or JOB = 'B', the estimated quantity sep(op(A),-op(A)'). If N = 0, or X = 0, or JOB = 'E', SEP is not referenced. RCOND (output) DOUBLE PRECISION If JOB = 'C' or JOB = 'B', an estimate of the reciprocal condition number of the continuous-time Lyapunov 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.Workspace
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. If JOB = 'C', then LDWORK >= MAX(1,2*N*N), if FACT = 'F'; LDWORK >= MAX(1,2*N*N,5*N), if FACT = 'N'. If JOB = 'E', or JOB = 'B', and LYAPUN = 'O', then LDWORK >= MAX(1,3*N*N), if FACT = 'F'; LDWORK >= MAX(1,3*N*N,5*N), if FACT = 'N'. If JOB = 'E', or JOB = 'B', and LYAPUN = 'R', then LDWORK >= MAX(1,3*N*N+N-1), if FACT = 'F'; LDWORK >= MAX(1,3*N*N+N-1,5*N), if FACT = 'N'. For optimum performance LDWORK should sometimes 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.Error Indicator
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 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 the matrices T and -T' have common or very close eigenvalues; perturbed values were used to solve Lyapunov equations, but the matrix T, if given (for FACT = 'F'), is unchanged.Method
The condition number of the continuous-time Lyapunov equation is estimated as cond = (norm(Theta)*norm(A) + norm(inv(Omega))*norm(C))/norm(X), where Omega and Theta are linear operators defined by Omega(W) = op(A)'*W + W*op(A), Theta(W) = inv(Omega(op(W)'*X + X*op(W))). The routine estimates the quantities sep(op(A),-op(A)') = 1 / norm(inv(Omega)) and norm(Theta) using 1-norm condition estimators. The forward error bound is estimated using a practical error bound similar to the one proposed in [1].References
[1] Higham, N.J. Perturbation theory and backward error for AX-XB=C. BIT, vol. 33, pp. 124-136, 1993.Numerical Aspects
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.Further Comments
The option LYAPUN = 'R' may occasionally produce slightly worse or better estimates, and it is much faster than the option 'O'. When SEP 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.Example
Program Text
* SB03QD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDC, LDT, LDU, LDX PARAMETER ( LDA = NMAX, LDC = NMAX, LDT = NMAX, $ LDU = NMAX, LDX = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, 3*NMAX*NMAX + NMAX - 1, $ 5*NMAX ) ) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) * .. Local Scalars .. DOUBLE PRECISION FERR, RCOND, SCALE, SEP INTEGER I, INFO1, INFO2, J, N CHARACTER*1 DICO, FACT, JOB, LYAPUN, TRANA, TRANAT, UPLO * .. Local Arrays .. INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), C(LDC,NMAX), DWORK(LDWORK), $ T(LDT,NMAX), U(LDU,NMAX), X(LDX,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DLACPY, MA02ED, MB01RU, SB03MD, SB03QD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) DICO = 'C' * 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 = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( FACT, 'F' ) ) READ ( NIN, FMT = * ) $ ( ( U(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'Full', N, N, A, LDA, T, LDT ) CALL DLACPY( 'Full', N, N, C, LDC, X, LDX ) * Solve the continuous-time Lyapunov matrix equation. CALL SB03MD( DICO, 'X', FACT, TRANA, N, T, LDT, U, LDU, X, LDX, $ SCALE, SEP, FERR, DWORK(1), DWORK(N+1), IWORK, $ DWORK(2*N+1), LDWORK-2*N, INFO1 ) * IF ( INFO1.EQ.0 ) THEN WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( X(I,J), J = 1,N ) 10 CONTINUE 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, C, LDC, $ U, LDU, C, LDC, DWORK, N*N, INFO2 ) END IF * Estimate the condition and error bound on the solution. CALL SB03QD( JOB, 'F', TRANA, UPLO, LYAPUN, N, SCALE, A, $ LDA, T, LDT, U, LDU, C, LDC, X, LDX, SEP, $ RCOND, FERR, IWORK, DWORK, LDWORK, INFO2 ) * IF ( INFO2.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO2 ELSE WRITE ( NOUT, FMT = 99993 ) SCALE WRITE ( NOUT, FMT = 99992 ) SEP 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 (' SB03QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB03MD =',I2) 99997 FORMAT (' INFO on exit from SB03QD =',I2) 99996 FORMAT (' The solution matrix X is') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' Scaling factor = ',F8.4) 99992 FORMAT (/' Estimated separation = ',F8.4) 99991 FORMAT (/' Estimated reciprocal condition number = ',F8.4) 99990 FORMAT (/' Estimated error bound = ',F8.4) ENDProgram Data
SB03QD EXAMPLE PROGRAM DATA 3 B N N U O 3.0 1.0 1.0 1.0 3.0 0.0 0.0 0.0 3.0 25.0 24.0 15.0 24.0 32.0 8.0 15.0 8.0 40.0Program Results
SB03QD EXAMPLE PROGRAM RESULTS The solution matrix X is 3.2604 2.7187 1.8616 2.7187 4.4271 0.5699 1.8616 0.5699 6.0461 Scaling factor = 1.0000 Estimated separation = 4.9068 Estimated reciprocal condition number = 0.3611 Estimated error bound = 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB03QX.html 0000664 0000000 0000000 00000015100 14560147231 0020367 0 ustar 00root root 0000000 0000000
Purpose
To estimate a forward error bound for the solution X of a real continuous-time Lyapunov matrix equation, op(A)'*X + X*op(A) = C, where op(A) = A or A' (A**T) and C is symmetric (C = C**T). The matrix A, the right hand side C, and the solution X are N-by-N. An absolute residual matrix, which takes into account the rounding errors in forming it, is given in the array R.Specification
SUBROUTINE SB03QX( TRANA, UPLO, LYAPUN, N, XANORM, T, LDT, U, LDU, $ R, LDR, FERR, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER LYAPUN, TRANA, UPLO INTEGER INFO, LDR, LDT, LDU, LDWORK, N DOUBLE PRECISION FERR, XANORM C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION DWORK( * ), R( LDR, * ), T( LDT, * ), $ U( LDU, * )Arguments
Mode Parameters
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 matrix R 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, as follows: = 'O': Solve the original Lyapunov equations, updating the right-hand sides and solutions with the matrix U, e.g., X <-- U'*X*U; = 'R': Solve reduced Lyapunov equations only, without updating the right-hand sides and solutions.Input/Output Parameters
N (input) INTEGER The order of the matrices A and R. N >= 0. XANORM (input) DOUBLE PRECISION The absolute (maximal) norm of the symmetric solution matrix X of the Lyapunov equation. XANORM >= 0. T (input) DOUBLE PRECISION array, dimension (LDT,N) 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 A. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N). U (input) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array must contain the orthogonal matrix U from a real Schur factorization of A. If LYAPUN = 'R', the array U is not referenced. LDU INTEGER The leading dimension of array U. LDU >= 1, if LYAPUN = 'R'; LDU >= MAX(1,N), if LYAPUN = 'O'. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the absolute residual matrix R, with bounds on rounding errors added. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the absolute residual matrix R, with bounds on rounding errors added. On exit, the leading N-by-N part of this array contains the symmetric absolute residual matrix R (with bounds on rounding errors added), fully stored. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). FERR (output) DOUBLE PRECISION 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 XANORM = 0, FERR is set to 0, without any calculations.Workspace
IWORK INTEGER array, dimension (N*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*N*N.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = N+1: if the matrices T and -T' have common or very close eigenvalues; perturbed values were used to solve Lyapunov equations (but the matrix T is unchanged).Method
The forward error bound is estimated using a practical error bound similar to the one proposed in [1], based on the 1-norm estimator in [2].References
[1] Higham, N.J. Perturbation theory and backward error for AX-XB=C. BIT, vol. 33, pp. 124-136, 1993. [2] Higham, N.J. FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation. ACM Trans. Math. Softw., 14, pp. 381-396, 1988.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
The option LYAPUN = 'R' may occasionally produce slightly worse or better estimates, and it is much faster than the option 'O'. The routine can be also used as a final step in estimating a forward error bound for the solution of a continuous-time algebraic matrix Riccati equation.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To estimate the separation between the matrices op(A) and -op(A)', sep(op(A),-op(A)') = min norm(op(A)'*X + X*op(A))/norm(X) = 1 / norm(inv(Omega)) and/or the 1-norm of Theta, where op(A) = A or A' (A**T), and Omega and Theta are linear operators associated to the real continuous-time Lyapunov matrix equation op(A)'*X + X*op(A) = C, defined by Omega(W) = op(A)'*W + W*op(A), Theta(W) = inv(Omega(op(W)'*X + X*op(W))). The 1-norm condition estimators are used.Specification
SUBROUTINE SB03QY( JOB, TRANA, LYAPUN, N, T, LDT, U, LDU, X, LDX, $ SEP, THNORM, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOB, LYAPUN, TRANA INTEGER INFO, LDT, LDU, LDWORK, LDX, N DOUBLE PRECISION SEP, THNORM C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION DWORK( * ), T( LDT, * ), U( LDU, * ), $ X( LDX, * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'S': Compute the separation only; = 'T': Compute the norm of Theta only; = 'B': Compute both the separation and the norm of Theta. 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). LYAPUN CHARACTER*1 Specifies whether or not the original Lyapunov equations should be solved, as follows: = 'O': Solve the original Lyapunov equations, updating the right-hand sides and solutions with the matrix U, e.g., X <-- U'*X*U; = 'R': Solve reduced Lyapunov equations only, without updating the right-hand sides and solutions.Input/Output Parameters
N (input) INTEGER The order of the matrices A and X. N >= 0. T (input) DOUBLE PRECISION array, dimension (LDT,N) 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 A. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N). U (input) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array must contain the orthogonal matrix U from a real Schur factorization of A. If LYAPUN = 'R', the array U is not referenced. LDU INTEGER The leading dimension of array U. LDU >= 1, if LYAPUN = 'R'; LDU >= MAX(1,N), if LYAPUN = 'O'. X (input) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array must contain the solution matrix X of the Lyapunov equation (reduced Lyapunov equation if LYAPUN = 'R'). If JOB = 'S', the array X is not referenced. LDX INTEGER The leading dimension of array X. LDX >= 1, if JOB = 'S'; LDX >= MAX(1,N), if JOB = 'T' or 'B'. SEP (output) DOUBLE PRECISION If JOB = 'S' or JOB = 'B', and INFO >= 0, SEP contains the estimated separation of the matrices op(A) and -op(A)'. If JOB = 'T' or N = 0, SEP is not referenced. THNORM (output) DOUBLE PRECISION If JOB = 'T' or JOB = 'B', and INFO >= 0, THNORM contains the estimated 1-norm of operator Theta. If JOB = 'S' or N = 0, THNORM is not referenced.Workspace
IWORK INTEGER array, dimension (N*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*N*N.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = N+1: if the matrices T and -T' have common or very close eigenvalues; perturbed values were used to solve Lyapunov equations (but the matrix T is unchanged).Method
SEP is defined as the separation of op(A) and -op(A)': sep( op(A), -op(A)' ) = sigma_min( K ) where sigma_min(K) is the smallest singular value of the N*N-by-N*N matrix K = kprod( I(N), op(A)' ) + kprod( op(A)', I(N) ). I(N) is an N-by-N identity matrix, and kprod denotes the Kronecker product. The routine estimates sigma_min(K) by the reciprocal of an estimate of the 1-norm of inverse(K), computed as suggested in [1]. This involves the solution of several continuous-time Lyapunov equations, either direct or transposed. The true reciprocal 1-norm of inverse(K) cannot differ from sigma_min(K) by more than a factor of N. The 1-norm of Theta is estimated similarly.References
[1] Higham, N.J. FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation. ACM Trans. Math. Softw., 14, pp. 381-396, 1988.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
When SEP is zero, the routine returns immediately, with THNORM (if requested) not set. In this case, the equation is singular. The option LYAPUN = 'R' may occasionally produce slightly worse or better estimates, and it is much faster than the option 'O'.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve the real Lyapunov matrix equation op(A)'*X + X*op(A) = scale*C and/or estimate the separation between the matrices op(A) and -op(A)', where op(A) = A or A' (A**T) and C is symmetric (C = C'). (A' denotes the transpose of the matrix A.) A is N-by-N, the right hand side C and the solution X are N-by-N, and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X.Specification
SUBROUTINE SB03RD( JOB, FACT, TRANA, N, A, LDA, U, LDU, C, LDC, $ SCALE, SEP, FERR, WR, WI, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER FACT, JOB, TRANA INTEGER INFO, LDA, LDC, LDU, LDWORK, N DOUBLE PRECISION FERR, SCALE, SEP C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * ), $ U( LDU, * ), WI( * ), WR( * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'X': Compute the solution only; = 'S': Compute the separation only; = 'B': Compute both the solution and the separation. FACT CHARACTER*1 Specifies whether or not the real Schur factorization of the matrix A is supplied on entry, as follows: = 'F': On entry, A and U contain the factors from the real Schur factorization of the matrix A; = 'N': The Schur factorization of A will be computed and the factors will be stored in A and U. 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).Input/Output Parameters
N (input) INTEGER The order of the matrices A, X, and C. N >= 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. If FACT = 'F', then A contains an upper quasi-triangular matrix in Schur canonical form. On exit, if INFO = 0 or INFO = N+1, the leading N-by-N part of this array contains the upper quasi-triangular matrix in Schur canonical form from the Shur factorization of A. The contents of array A is not modified if FACT = 'F'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). U (input or output) DOUBLE PRECISION array, dimension (LDU,N) If FACT = 'F', then U is an input argument and on entry it must contain the orthogonal matrix U from the real Schur factorization of A. If 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 the real Schur factorization of A. LDU INTEGER The leading dimension of array U. LDU >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry with JOB = 'X' or 'B', the leading N-by-N part of this array must contain the symmetric matrix C. On exit with JOB = 'X' or 'B', if INFO = 0 or INFO = N+1, the leading N-by-N part of C has been overwritten by the symmetric solution matrix X. If JOB = 'S', C is not referenced. LDC INTEGER The leading dimension of array C. LDC >= 1, if JOB = 'S'; LDC >= MAX(1,N), otherwise. SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing. SEP (output) DOUBLE PRECISION If JOB = 'S' or JOB = 'B', and INFO = 0 or INFO = N+1, SEP contains the estimated separation of the matrices op(A) and -op(A)'. If JOB = 'X' or N = 0, SEP is not referenced. FERR (output) DOUBLE PRECISION If JOB = 'B', and INFO = 0 or INFO = N+1, FERR contains an estimated forward error bound for the solution X. If XTRUE is the true solution, FERR bounds the relative error in the computed solution, measured in the Frobenius norm: norm(X - XTRUE)/norm(XTRUE). If JOB = 'X' or JOB = 'S', FERR is not referenced. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) If FACT = 'N', and INFO = 0 or INFO = N+1, WR and WI contain the real and imaginary parts, respectively, of the eigenvalues of A. If FACT = 'F', WR and WI are not referenced.Workspace
IWORK INTEGER array, dimension (N*N) This array is not referenced if JOB = 'X'. 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 length of the array DWORK. LDWORK >= 1 and If JOB = 'X' then If FACT = 'F', LDWORK >= N*N; If FACT = 'N', LDWORK >= MAX(N*N,3*N). If JOB = 'S' or JOB = 'B' then If FACT = 'F', LDWORK >= 2*N*N; If FACT = 'N', LDWORK >= MAX(2*N*N,3*N). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues (see LAPACK Library routine DGEES); elements i+1:n of WR and WI contain eigenvalues which have converged, and A contains the partially converged Schur form; = N+1: if the matrices A and -A' have common or very close eigenvalues; perturbed values were used to solve the equation (but the matrix A is unchanged).Method
After reducing matrix A to real Schur canonical form (if needed), the Bartels-Stewart algorithm is used. A set of equivalent linear algebraic systems of equations of order at most four are formed and solved using Gaussian elimination with complete pivoting.References
[1] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
SEP is defined as the separation of op(A) and -op(A)': sep( op(A), -op(A)' ) = sigma_min( T ) where sigma_min(T) is the smallest singular value of the N*N-by-N*N matrix T = kprod( I(N), op(A)' ) + kprod( op(A), I(N) ). I(N) is an N-by-N identity matrix, and kprod denotes the Kronecker product. The program estimates sigma_min(T) by the reciprocal of an estimate of the 1-norm of inverse(T). The true reciprocal 1-norm of inverse(T) cannot differ from sigma_min(T) by more than a factor of N. When SEP is small, small changes in A, C can cause large changes in the solution of the equation. An approximate bound on the maximum relative error in the computed solution is EPS * norm(A) / SEP where EPS is the machine precision.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB03SD.html 0000664 0000000 0000000 00000037304 14560147231 0020357 0 ustar 00root root 0000000 0000000
Purpose
To estimate the conditioning and compute an error bound on the solution of the real discrete-time Lyapunov matrix equation op(A)'*X*op(A) - X = scale*C where op(A) = A or A' (A**T) and C is symmetric (C = C**T). The matrix A is N-by-N, the right hand side C and the solution X are N-by-N symmetric matrices, and scale is a given scale factor.Specification
SUBROUTINE SB03SD( JOB, FACT, TRANA, UPLO, LYAPUN, N, SCALE, A, $ LDA, T, LDT, U, LDU, C, LDC, X, LDX, SEPD, $ RCOND, FERR, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER FACT, JOB, LYAPUN, TRANA, UPLO INTEGER INFO, LDA, LDC, LDT, LDU, LDWORK, LDX, N DOUBLE PRECISION FERR, RCOND, SCALE, SEPD C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * ), $ T( LDT, * ), U( LDU, * ), X( LDX, * )Arguments
Mode Parameters
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 A 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 A; = 'N': The Schur factorization of A 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 matrix C 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., X <-- U'*X*U; = 'R': Solve reduced Lyapunov equations only, without updating the right-hand sides and solutions.Input/Output Parameters
N (input) INTEGER The order of the matrices A, X and C. N >= 0. SCALE (input) DOUBLE PRECISION The scale factor, scale, set by a Lyapunov solver. 0 <= SCALE <= 1. 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 original 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/output) DOUBLE PRECISION array, dimension (LDT,N) If FACT = 'F', then 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 A. If FACT = 'N', then this array need not be set on input. On exit, (if INFO = 0 or INFO = N+1, for FACT = 'N') 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 A. 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 A. 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 A. 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'. C (input) DOUBLE PRECISION array, dimension (LDC,N) If UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the matrix C of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. If UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the matrix C of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. LDC INTEGER The leading dimension of the array C. LDC >= 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 X of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. The array X is modified internally, but restored on exit. 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(A),op(A)'). 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 Lyapunov 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.Workspace
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. LDWORK >= 1, if N = 0; else, LDWORK >= MAX(3,2*N*N) + N*N, if JOB = 'C', FACT = 'F'; LDWORK >= MAX(MAX(3,2*N*N) + N*N, 5*N), if JOB = 'C', FACT = 'N'; LDWORK >= MAX(3,2*N*N) + N*N + 2*N, if JOB = 'E', or JOB = 'B'. For optimum performance LDWORK should sometimes 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.Error Indicator
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 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 the matrix T has almost reciprocal eigenvalues; perturbed values were used to solve Lyapunov equations, but the matrix T, if given (for FACT = 'F'), is unchanged.Method
The condition number of the discrete-time Lyapunov equation is estimated as cond = (norm(Theta)*norm(A) + norm(inv(Omega))*norm(C))/norm(X), where Omega and Theta are linear operators defined by Omega(W) = op(A)'*W*op(A) - W, Theta(W) = inv(Omega(op(W)'*X*op(A) + op(A)'*X*op(W))). The routine estimates the quantities sepd(op(A),op(A)') = 1 / norm(inv(Omega)) and norm(Theta) using 1-norm condition estimators. The forward error bound is estimated using a practical error bound similar to the one proposed in [1].References
[1] Higham, N.J. Perturbation theory and backward error for AX-XB=C. BIT, vol. 33, pp. 124-136, 1993.Numerical Aspects
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.Further Comments
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.Example
Program Text
* SB03SD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDC, LDT, LDU, LDX PARAMETER ( LDA = NMAX, LDC = NMAX, LDT = NMAX, $ LDU = NMAX, LDX = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 3, 2*NMAX*NMAX ) + $ NMAX*NMAX + 2*NMAX ) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) * .. Local Scalars .. DOUBLE PRECISION FERR, RCOND, SCALE, SEPD INTEGER I, INFO1, INFO2, J, N CHARACTER*1 DICO, FACT, JOB, LYAPUN, TRANA, TRANAT, UPLO * .. Local Arrays .. INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), C(LDC,NMAX), DWORK(LDWORK), $ T(LDT,NMAX), U(LDU,NMAX), X(LDX,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DLACPY, MA02ED, MB01RU, SB03MD, SB03SD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) DICO = 'D' * 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 = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( FACT, 'F' ) ) READ ( NIN, FMT = * ) $ ( ( U(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,N ) CALL DLACPY( 'Full', N, N, A, LDA, T, LDT ) CALL DLACPY( 'Full', N, N, C, LDC, X, LDX ) * Solve the discrete-time Lyapunov matrix equation. CALL SB03MD( DICO, 'X', FACT, TRANA, N, T, LDT, U, LDU, X, LDX, $ SCALE, SEPD, FERR, DWORK(1), DWORK(N+1), IWORK, $ DWORK(2*N+1), LDWORK-2*N, INFO1 ) * IF ( INFO1.EQ.0 ) THEN WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( X(I,J), J = 1,N ) 10 CONTINUE 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, C, LDC, $ U, LDU, C, LDC, DWORK, N*N, INFO2 ) END IF * Estimate the condition and error bound on the solution. CALL SB03SD( JOB, 'F', TRANA, UPLO, LYAPUN, N, SCALE, A, $ LDA, T, LDT, U, LDU, C, LDC, X, LDX, SEPD, $ RCOND, FERR, IWORK, DWORK, LDWORK, INFO2 ) * IF ( INFO2.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO2 ELSE WRITE ( NOUT, FMT = 99993 ) SCALE 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 (' SB03SD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB03MD =',I2) 99997 FORMAT (' INFO on exit from SB03SD =',I2) 99996 FORMAT (' The solution matrix X is') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' Scaling factor = ',F8.4) 99992 FORMAT (/' Estimated separation = ',F8.4) 99991 FORMAT (/' Estimated reciprocal condition number = ',F8.4) 99990 FORMAT (/' Estimated error bound = ',F8.4) ENDProgram Data
SB03SD EXAMPLE PROGRAM DATA 3 B N N U O 3.0 1.0 1.0 1.0 3.0 0.0 0.0 0.0 3.0 25.0 24.0 15.0 24.0 32.0 8.0 15.0 8.0 40.0Program Results
SB03SD EXAMPLE PROGRAM RESULTS The solution matrix X is 2.0000 1.0000 1.0000 1.0000 3.0000 0.0000 1.0000 0.0000 4.0000 Scaling factor = 1.0000 Estimated separation = 5.2302 Estimated reciprocal condition number = 0.1832 Estimated error bound = 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB03SX.html 0000664 0000000 0000000 00000015135 14560147231 0020401 0 ustar 00root root 0000000 0000000
Purpose
To estimate a forward error bound for the solution X of a real discrete-time Lyapunov matrix equation, op(A)'*X*op(A) - X = C, where op(A) = A or A' (A**T) and C is symmetric (C = C**T). The matrix A, the right hand side C, and the solution X are N-by-N. An absolute residual matrix, which takes into account the rounding errors in forming it, is given in the array R.Specification
SUBROUTINE SB03SX( TRANA, UPLO, LYAPUN, N, XANORM, T, LDT, U, LDU, $ R, LDR, FERR, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER LYAPUN, TRANA, UPLO INTEGER INFO, LDR, LDT, LDU, LDWORK, N DOUBLE PRECISION FERR, XANORM C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION DWORK( * ), R( LDR, * ), T( LDT, * ), $ U( LDU, * )Arguments
Mode Parameters
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 matrix R 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, as follows: = 'O': Solve the original Lyapunov equations, updating the right-hand sides and solutions with the matrix U, e.g., X <-- U'*X*U; = 'R': Solve reduced Lyapunov equations only, without updating the right-hand sides and solutions.Input/Output Parameters
N (input) INTEGER The order of the matrices A and R. N >= 0. XANORM (input) DOUBLE PRECISION The absolute (maximal) norm of the symmetric solution matrix X of the Lyapunov equation. XANORM >= 0. T (input) DOUBLE PRECISION array, dimension (LDT,N) 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 A. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N). U (input) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array must contain the orthogonal matrix U from a real Schur factorization of A. If LYAPUN = 'R', the array U is not referenced. LDU INTEGER The leading dimension of array U. LDU >= 1, if LYAPUN = 'R'; LDU >= MAX(1,N), if LYAPUN = 'O'. R (input/output) DOUBLE PRECISION array, dimension (LDR,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the absolute residual matrix R, with bounds on rounding errors added. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the absolute residual matrix R, with bounds on rounding errors added. On exit, the leading N-by-N part of this array contains the symmetric absolute residual matrix R (with bounds on rounding errors added), fully stored. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). FERR (output) DOUBLE PRECISION 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 XANORM = 0, FERR is set to 0, without any calculations.Workspace
IWORK INTEGER array, dimension (N*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= 0, if N = 0; LDWORK >= MAX(3,2*N*N), if N > 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = N+1: if T has almost reciprocal eigenvalues; perturbed values were used to solve Lyapunov equations (but the matrix T is unchanged).Method
The forward error bound is estimated using a practical error bound similar to the one proposed in [1], based on the 1-norm estimator in [2].References
[1] Higham, N.J. Perturbation theory and backward error for AX-XB=C. BIT, vol. 33, pp. 124-136, 1993. [2] Higham, N.J. FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation. ACM Trans. Math. Softw., 14, pp. 381-396, 1988.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
The option LYAPUN = 'R' may occasionally produce slightly worse or better estimates, and it is much faster than the option 'O'. The routine can be also used as a final step in estimating a forward error bound for the solution of a discrete-time algebraic matrix Riccati equation.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To estimate the "separation" between the matrices op(A) and op(A)', sepd(op(A),op(A)') = min norm(op(A)'*X*op(A) - X)/norm(X) = 1 / norm(inv(Omega)) and/or the 1-norm of Theta, where op(A) = A or A' (A**T), and Omega and Theta are linear operators associated to the real discrete-time Lyapunov matrix equation op(A)'*X*op(A) - X = C, defined by Omega(W) = op(A)'*W*op(A) - W, Theta(W) = inv(Omega(op(W)'*X*op(A) + op(A)'*X*op(W))). The 1-norm condition estimators are used.Specification
SUBROUTINE SB03SY( JOB, TRANA, LYAPUN, N, T, LDT, U, LDU, XA, $ LDXA, SEPD, THNORM, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER JOB, LYAPUN, TRANA INTEGER INFO, LDT, LDU, LDWORK, LDXA, N DOUBLE PRECISION SEPD, THNORM C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION DWORK( * ), T( LDT, * ), U( LDU, * ), $ XA( LDXA, * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'S': Compute the separation only; = 'T': Compute the norm of Theta only; = 'B': Compute both the separation and the norm of Theta. 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). LYAPUN CHARACTER*1 Specifies whether or not the original Lyapunov equations should be solved, as follows: = 'O': Solve the original Lyapunov equations, updating the right-hand sides and solutions with the matrix U, e.g., X <-- U'*X*U; = 'R': Solve reduced Lyapunov equations only, without updating the right-hand sides and solutions.Input/Output Parameters
N (input) INTEGER The order of the matrices A and X. N >= 0. T (input) DOUBLE PRECISION array, dimension (LDT,N) 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 A. LDT INTEGER The leading dimension of array T. LDT >= MAX(1,N). U (input) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array must contain the orthogonal matrix U from a real Schur factorization of A. If LYAPUN = 'R', the array U is not referenced. LDU INTEGER The leading dimension of array U. LDU >= 1, if LYAPUN = 'R'; LDU >= MAX(1,N), if LYAPUN = 'O'. XA (input) DOUBLE PRECISION array, dimension (LDXA,N) The leading N-by-N part of this array must contain the matrix product X*op(A), if LYAPUN = 'O', or U'*X*U*op(T), if LYAPUN = 'R', in the Lyapunov equation. If JOB = 'S', the array XA is not referenced. LDXA INTEGER The leading dimension of array XA. LDXA >= 1, if JOB = 'S'; LDXA >= MAX(1,N), if JOB = 'T' or 'B'. SEPD (output) DOUBLE PRECISION If JOB = 'S' or JOB = 'B', and INFO >= 0, SEPD contains the estimated quantity sepd(op(A),op(A)'). If JOB = 'T' or N = 0, SEPD is not referenced. THNORM (output) DOUBLE PRECISION If JOB = 'T' or JOB = 'B', and INFO >= 0, THNORM contains the estimated 1-norm of operator Theta. If JOB = 'S' or N = 0, THNORM is not referenced.Workspace
IWORK INTEGER array, dimension (N*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= 0, if N = 0; LDWORK >= MAX(3,2*N*N), if N > 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = N+1: if T has (almost) reciprocal eigenvalues; perturbed values were used to solve Lyapunov equations (but the matrix T is unchanged).Method
SEPD is defined as sepd( op(A), op(A)' ) = sigma_min( K ) where sigma_min(K) is the smallest singular value of the N*N-by-N*N matrix K = kprod( op(A)', op(A)' ) - I(N**2). I(N**2) is an N*N-by-N*N identity matrix, and kprod denotes the Kronecker product. The routine estimates sigma_min(K) by the reciprocal of an estimate of the 1-norm of inverse(K), computed as suggested in [1]. This involves the solution of several discrete- time Lyapunov equations, either direct or transposed. The true reciprocal 1-norm of inverse(K) cannot differ from sigma_min(K) by more than a factor of N. The 1-norm of Theta is estimated similarly.References
[1] Higham, N.J. FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation. ACM Trans. Math. Softw., 14, pp. 381-396, 1988.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
When SEPD is zero, the routine returns immediately, with THNORM (if requested) not set. In this case, the equation is singular. The option LYAPUN = 'R' may occasionally produce slightly worse or better estimates, and it is much faster than the option 'O'.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve the real continuous-time Lyapunov matrix equation op(A)'*X + X*op(A) = scale*C, estimate the conditioning, and compute an error bound on the solution X, where op(A) = A or A' (A**T), the matrix A is N-by-N, the right hand side C and the solution X are N-by-N symmetric matrices (C = C', X = X'), and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X.Specification
SUBROUTINE SB03TD( JOB, FACT, TRANA, UPLO, LYAPUN, N, SCALE, A, $ LDA, T, LDT, U, LDU, C, LDC, X, LDX, SEP, $ RCOND, FERR, WR, WI, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER FACT, JOB, LYAPUN, TRANA, UPLO INTEGER INFO, LDA, LDC, LDT, LDU, LDWORK, LDX, N DOUBLE PRECISION FERR, RCOND, SCALE, SEP C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * ), $ T( LDT, * ), U( LDU, * ), WI( * ), WR( * ), $ X( LDX, * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'X': Compute the solution only; = 'S': Compute the separation only; = 'C': Compute the reciprocal condition number only; = 'E': Compute the error bound only; = 'A': Compute all: the solution, separation, reciprocal condition number, and the error bound. FACT CHARACTER*1 Specifies whether or not the real Schur factorization of the matrix A 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 A; = 'N': The Schur factorization of A 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 matrix C is to be used, as follows: = 'U': Upper triangular part; = 'L': Lower triangular part. LYAPUN CHARACTER*1 Specifies whether or not the original or "reduced" Lyapunov equations should be solved, as follows: = 'O': Solve the original Lyapunov equations, updating the right-hand sides and solutions with the matrix U, e.g., X <-- U'*X*U; = 'R': Solve reduced Lyapunov equations only, without updating the right-hand sides and solutions. This means that a real Schur form T of A appears in the equation, instead of A.Input/Output Parameters
N (input) INTEGER The order of the matrices A, X, and C. N >= 0. SCALE (input or output) DOUBLE PRECISION If JOB = 'C' or JOB = 'E', SCALE is an input argument: the scale factor, set by a Lyapunov solver. 0 <= SCALE <= 1. If JOB = 'X' or JOB = 'A', SCALE is an output argument: the scale factor, scale, set less than or equal to 1 to prevent the solution overflowing. If JOB = 'S', this argument is not used. A (input) DOUBLE PRECISION array, dimension (LDA,N) If FACT = 'N' or (LYAPUN = 'O' and JOB <> 'X'), the leading N-by-N part of this array must contain the original matrix A. If FACT = 'F' and (LYAPUN = 'R' or JOB = 'X'), A is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N), if FACT = 'N' or LYAPUN = 'O' and JOB <> 'X'; LDA >= 1, otherwise. T (input/output) DOUBLE PRECISION array, dimension (LDT,N) If FACT = 'F', then 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 A. If FACT = 'N', then this array need not be set on input. On exit, (if INFO = 0 or INFO = N+1, for FACT = 'N') 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 A. The contents of array T is not modified if FACT = 'F'. 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 A. 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 A. 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'. C (input) DOUBLE PRECISION array, dimension (LDC,N) If JOB <> 'S' and UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the matrix C of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. If JOB <> 'S' and UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the matrix C of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. The remaining strictly triangular part of this array is used as workspace. If JOB = 'X', then this array may be identified with X in the call of this routine. If JOB = 'S', the array C is not referenced. LDC INTEGER The leading dimension of the array C. LDC >= 1, if JOB = 'S'; LDC >= MAX(1,N), otherwise. X (input or output) DOUBLE PRECISION array, dimension (LDX,N) If JOB = 'C' or 'E', then X is an input argument and on entry, the leading N-by-N part of this array must contain the symmetric solution matrix X of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. If JOB = 'X' or 'A', then X is an output argument and on exit, if INFO = 0 or INFO = N+1, the leading N-by-N part of this array contains the symmetric solution matrix X of of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. If JOB = 'S', the array X is not referenced. LDX INTEGER The leading dimension of the array X. LDX >= 1, if JOB = 'S'; LDX >= MAX(1,N), otherwise. SEP (output) DOUBLE PRECISION If JOB = 'S' or JOB = 'C' or JOB = 'A', and INFO = 0 or INFO = N+1, SEP contains the estimated separation of the matrices op(A) and -op(A)', sep(op(A),-op(A)'). If N = 0, or X = 0, or JOB = 'X' or JOB = 'E', SEP is not referenced. RCOND (output) DOUBLE PRECISION If JOB = 'C' or JOB = 'A', an estimate of the reciprocal condition number of the continuous-time Lyapunov equation. If N = 0 or X = 0, RCOND is set to 1 or 0, respectively. If JOB = 'X' or JOB = 'S' or JOB = 'E', RCOND is not referenced. FERR (output) DOUBLE PRECISION If JOB = 'E' or JOB = 'A', and INFO = 0 or INFO = N+1, FERR contains an estimated forward error bound for the solution X. If XTRUE is the true solution, FERR bounds the relative error in the computed solution, measured in the Frobenius norm: norm(X - XTRUE)/norm(XTRUE). If N = 0 or X = 0, FERR is set to 0. If JOB = 'X' or JOB = 'S' or JOB = 'C', FERR is not referenced. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) If FACT = 'N', and INFO = 0 or INFO = N+1, WR and WI contain the real and imaginary parts, respectively, of the eigenvalues of A. If FACT = 'F', WR and WI are not referenced.Workspace
IWORK INTEGER array, dimension (N*N) This array is not referenced if JOB = 'X'. 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 length of the array DWORK. If JOB = 'X', then LDWORK >= MAX(1,N*N), if FACT = 'F'; LDWORK >= MAX(1,MAX(N*N,3*N)), if FACT = 'N'. If JOB = 'S' or JOB = 'C', then LDWORK >= MAX(1,2*N*N), if FACT = 'F'; LDWORK >= MAX(1,2*N*N,3*N), if FACT = 'N'. If JOB = 'E', or JOB = 'A', and LYAPUN = 'O', then LDWORK >= MAX(1,3*N*N); If JOB = 'E', or JOB = 'A', and LYAPUN = 'R', then LDWORK >= MAX(1,3*N*N+N-1). For optimum performance LDWORK should sometimes be larger.Error Indicator
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 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 the elements i+1:n of WR and WI contain the real and imaginary parts, respectively, of the converged eigenvalues; this error is unlikely to appear; = N+1: if the matrices T and -T' have common or very close eigenvalues; perturbed values were used to solve Lyapunov equations, but the matrix T, if given (for FACT = 'F'), is unchanged.Method
After reducing matrix A to real Schur canonical form (if needed), the Bartels-Stewart algorithm is used. A set of equivalent linear algebraic systems of equations of order at most four are formed and solved using Gaussian elimination with complete pivoting. The condition number of the continuous-time Lyapunov equation is estimated as cond = (norm(Theta)*norm(A) + norm(inv(Omega))*norm(C))/norm(X), where Omega and Theta are linear operators defined by Omega(W) = op(A)'*W + W*op(A), Theta(W) = inv(Omega(op(W)'*X + X*op(W))). The routine estimates the quantities sep(op(A),-op(A)') = 1 / norm(inv(Omega)) and norm(Theta) using 1-norm condition estimators. The forward error bound is estimated using a practical error bound similar to the one proposed in [2].References
[1] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Higham, N.J. Perturbation theory and backward error for AX-XB=C. BIT, vol. 33, pp. 124-136, 1993.Numerical Aspects
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.Further Comments
The separation of op(A) and -op(A)' can also be defined as sep( op(A), -op(A)' ) = sigma_min( T ), where sigma_min(T) is the smallest singular value of the N*N-by-N*N matrix T = kprod( I(N), op(A)' ) + kprod( op(A)', I(N) ). I(N) is an N-by-N identity matrix, and kprod denotes the Kronecker product. The routine estimates sigma_min(T) by the reciprocal of an estimate of the 1-norm of inverse(T). The true reciprocal 1-norm of inverse(T) cannot differ from sigma_min(T) by more than a factor of N.Example
Program Text
* SB03TD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDC, LDT, LDU, LDX PARAMETER ( LDA = NMAX, LDC = NMAX, LDT = NMAX, $ LDU = NMAX, LDX = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, 3*NMAX*NMAX + NMAX - 1 ) ) * .. Local Scalars .. DOUBLE PRECISION FERR, RCOND, SCALE, SEP INTEGER I, INFO, J, N CHARACTER*1 DICO, FACT, JOB, LYAPUN, TRANA, UPLO * .. Local Arrays .. INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), C(LDC,NMAX), DWORK(LDWORK), $ T(LDT,NMAX), U(LDU,NMAX), X(LDX,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB03TD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) DICO = 'C' * 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 = 99994 ) N ELSE IF ( LSAME( JOB, 'C' ) .OR. LSAME( JOB, 'E' ) ) $ READ ( NIN, FMT = * ) SCALE IF ( LSAME( FACT, 'N' ) .OR. ( LSAME( LYAPUN, 'O' ) .AND. $ .NOT.LSAME( JOB, 'X') ) ) $ READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( FACT, 'F' ) ) THEN READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( LYAPUN, 'O' ) ) $ READ ( NIN, FMT = * ) ( ( U(I,J), J = 1,N ), I = 1,N ) END IF IF ( .NOT.LSAME( JOB, 'S' ) ) $ READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( JOB, 'C' ) .OR. LSAME( JOB, 'E' ) ) $ READ ( NIN, FMT = * ) ( ( X(I,J), J = 1,N ), I = 1,N ) * Solve the continuous-time Lyapunov matrix equation and/or * estimate the condition and error bound on the solution. CALL SB03TD( JOB, FACT, TRANA, UPLO, LYAPUN, N, SCALE, A, LDA, $ T, LDT, U, LDU, C, LDC, X, LDX, SEP, RCOND, FERR, $ DWORK(1), DWORK(N+1), IWORK, DWORK(2*N+1), $ LDWORK-2*N, INFO ) * IF ( INFO.EQ.0 ) THEN IF ( LSAME( JOB, 'X' ) .OR. LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( X(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99993 ) SCALE END IF IF ( LSAME( JOB, 'S' ) .OR. LSAME( JOB, 'C' ) $ .OR. LSAME( JOB, 'A' ) ) $ WRITE ( NOUT, FMT = 99992 ) SEP IF ( LSAME( JOB, 'C' ) .OR. LSAME( JOB, 'A' ) ) $ WRITE ( NOUT, FMT = 99991 ) RCOND IF ( LSAME( JOB, 'E' ) .OR. LSAME( JOB, 'A' ) ) $ WRITE ( NOUT, FMT = 99990 ) FERR ELSE WRITE ( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' SB03TD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB03TD =',I2) 99996 FORMAT (' The solution matrix X is') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' Scaling factor = ',F8.4) 99992 FORMAT (/' Estimated separation = ',F8.4) 99991 FORMAT (/' Estimated reciprocal condition number = ',F8.4) 99990 FORMAT (/' Estimated error bound = ',F8.4) ENDProgram Data
SB03TD EXAMPLE PROGRAM DATA 3 A N N U O 3.0 1.0 1.0 1.0 3.0 0.0 0.0 0.0 3.0 25.0 24.0 15.0 24.0 32.0 8.0 15.0 8.0 40.0Program Results
SB03TD EXAMPLE PROGRAM RESULTS The solution matrix X is 3.2604 2.7187 1.8616 2.7187 4.4271 0.5699 1.8616 0.5699 6.0461 Scaling factor = 1.0000 Estimated separation = 4.9068 Estimated reciprocal condition number = 0.3611 Estimated error bound = 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB03UD.html 0000664 0000000 0000000 00000044206 14560147231 0020360 0 ustar 00root root 0000000 0000000
Purpose
To solve the real discrete-time Lyapunov matrix equation op(A)'*X*op(A) - X = scale*C, estimate the conditioning, and compute an error bound on the solution X, where op(A) = A or A' (A**T), the matrix A is N-by-N, the right hand side C and the solution X are N-by-N symmetric matrices (C = C', X = X'), and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X.Specification
SUBROUTINE SB03UD( JOB, FACT, TRANA, UPLO, LYAPUN, N, SCALE, A, $ LDA, T, LDT, U, LDU, C, LDC, X, LDX, SEPD, $ RCOND, FERR, WR, WI, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER FACT, JOB, LYAPUN, TRANA, UPLO INTEGER INFO, LDA, LDC, LDT, LDU, LDWORK, LDX, N DOUBLE PRECISION FERR, RCOND, SCALE, SEPD C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * ), $ T( LDT, * ), U( LDU, * ), WI( * ), WR( * ), $ X( LDX, * )Arguments
Mode Parameters
JOB CHARACTER*1 Specifies the computation to be performed, as follows: = 'X': Compute the solution only; = 'S': Compute the separation only; = 'C': Compute the reciprocal condition number only; = 'E': Compute the error bound only; = 'A': Compute all: the solution, separation, reciprocal condition number, and the error bound. FACT CHARACTER*1 Specifies whether or not the real Schur factorization of the matrix A 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 A; = 'N': The Schur factorization of A 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 matrix C is to be used, as follows: = 'U': Upper triangular part; = 'L': Lower triangular part. LYAPUN CHARACTER*1 Specifies whether or not the original or "reduced" Lyapunov equations should be solved, as follows: = 'O': Solve the original Lyapunov equations, updating the right-hand sides and solutions with the matrix U, e.g., X <-- U'*X*U; = 'R': Solve reduced Lyapunov equations only, without updating the right-hand sides and solutions. This means that a real Schur form T of A appears in the equation, instead of A.Input/Output Parameters
N (input) INTEGER The order of the matrices A, X, and C. N >= 0. SCALE (input or output) DOUBLE PRECISION If JOB = 'C' or JOB = 'E', SCALE is an input argument: the scale factor, set by a Lyapunov solver. 0 <= SCALE <= 1. If JOB = 'X' or JOB = 'A', SCALE is an output argument: the scale factor, scale, set less than or equal to 1 to prevent the solution overflowing. If JOB = 'S', this argument is not used. A (input) DOUBLE PRECISION array, dimension (LDA,N) If FACT = 'N' or (LYAPUN = 'O' and JOB <> 'X'), the leading N-by-N part of this array must contain the original matrix A. If FACT = 'F' and (LYAPUN = 'R' or JOB = 'X'), A is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N), if FACT = 'N' or LYAPUN = 'O' and JOB <> 'X'; LDA >= 1, otherwise. T (input/output) DOUBLE PRECISION array, dimension (LDT,N) If FACT = 'F', then 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 A. If FACT = 'N', then this array need not be set on input. On exit, (if INFO = 0 or INFO = N+1, for FACT = 'N') 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 A. The contents of array T is not modified if FACT = 'F'. 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 A. 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 A. 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'. C (input) DOUBLE PRECISION array, dimension (LDC,N) If JOB <> 'S' and UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the matrix C of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. If JOB <> 'S' and UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the matrix C of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. The remaining strictly triangular part of this array is used as workspace. If JOB = 'X', then this array may be identified with X in the call of this routine. If JOB = 'S', the array C is not referenced. LDC INTEGER The leading dimension of the array C. LDC >= 1, if JOB = 'S'; LDC >= MAX(1,N), otherwise. X (input or output) DOUBLE PRECISION array, dimension (LDX,N) If JOB = 'C' or 'E', then X is an input argument and on entry, the leading N-by-N part of this array must contain the symmetric solution matrix X of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. If JOB = 'X' or 'A', then X is an output argument and on exit, if INFO = 0 or INFO = N+1, the leading N-by-N part of this array contains the symmetric solution matrix X of of the original Lyapunov equation (with matrix A), if LYAPUN = 'O', or of the reduced Lyapunov equation (with matrix T), if LYAPUN = 'R'. If JOB = 'S', the array X is not referenced. LDX INTEGER The leading dimension of the array X. LDX >= 1, if JOB = 'S'; LDX >= MAX(1,N), otherwise. SEPD (output) DOUBLE PRECISION If JOB = 'S' or JOB = 'C' or JOB = 'A', and INFO = 0 or INFO = N+1, SEPD contains the estimated separation of the matrices op(A) and op(A)', sepd(op(A),op(A)'). If N = 0, or X = 0, or JOB = 'X' or JOB = 'E', SEPD is not referenced. RCOND (output) DOUBLE PRECISION If JOB = 'C' or JOB = 'A', an estimate of the reciprocal condition number of the continuous-time Lyapunov equation. If N = 0 or X = 0, RCOND is set to 1 or 0, respectively. If JOB = 'X' or JOB = 'S' or JOB = 'E', RCOND is not referenced. FERR (output) DOUBLE PRECISION If JOB = 'E' or JOB = 'A', and INFO = 0 or INFO = N+1, FERR contains an estimated forward error bound for the solution X. If XTRUE is the true solution, FERR bounds the relative error in the computed solution, measured in the Frobenius norm: norm(X - XTRUE)/norm(XTRUE). If N = 0 or X = 0, FERR is set to 0. If JOB = 'X' or JOB = 'S' or JOB = 'C', FERR is not referenced. WR (output) DOUBLE PRECISION array, dimension (N) WI (output) DOUBLE PRECISION array, dimension (N) If FACT = 'N', and INFO = 0 or INFO = N+1, WR and WI contain the real and imaginary parts, respectively, of the eigenvalues of A. If FACT = 'F', WR and WI are not referenced.Workspace
IWORK INTEGER array, dimension (N*N) This array is not referenced if JOB = 'X'. 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 length of the array DWORK. If JOB = 'X', then LDWORK >= MAX(1,N*N,2*N), if FACT = 'F'; LDWORK >= MAX(1,N*N,3*N), if FACT = 'N'. If JOB = 'S', then LDWORK >= MAX(3,2*N*N). If JOB = 'C', then LDWORK >= MAX(3,2*N*N) + N*N. If JOB = 'E', or JOB = 'A', then LDWORK >= MAX(3,2*N*N) + N*N + 2*N. For optimum performance LDWORK should sometimes be larger.Error Indicator
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 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 the elements i+1:n of WR and WI contain the real and imaginary parts, respectively, of the converged eigenvalues; this error is unlikely to appear; = N+1: if the matrix T has almost reciprocal eigenvalues; perturbed values were used to solve Lyapunov equations, but the matrix T, if given (for FACT = 'F'), is unchanged.Method
After reducing matrix A to real Schur canonical form (if needed), a discrete-time version of the Bartels-Stewart algorithm is used. A set of equivalent linear algebraic systems of equations of order at most four are formed and solved using Gaussian elimination with complete pivoting. The condition number of the discrete-time Lyapunov equation is estimated as cond = (norm(Theta)*norm(A) + norm(inv(Omega))*norm(C))/norm(X), where Omega and Theta are linear operators defined by Omega(W) = op(A)'*W*op(A) - W, Theta(W) = inv(Omega(op(W)'*X*op(A) + op(A)'*X*op(W))). The routine estimates the quantities sepd(op(A),op(A)') = 1 / norm(inv(Omega)) and norm(Theta) using 1-norm condition estimators. The forward error bound is estimated using a practical error bound similar to the one proposed in [3].References
[1] Barraud, A.Y. T A numerical algorithm to solve A XA - X = Q. IEEE Trans. Auto. Contr., AC-22, pp. 883-885, 1977. [2] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [3] Higham, N.J. Perturbation theory and backward error for AX-XB=C. BIT, vol. 33, pp. 124-136, 1993.Numerical Aspects
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.Further Comments
The "separation" sepd of op(A) and op(A)' can also be defined as sepd( op(A), op(A)' ) = sigma_min( T ), where sigma_min(T) is the smallest singular value of the N*N-by-N*N matrix T = kprod( op(A)', op(A)' ) - I(N**2). I(N**2) is an N*N-by-N*N identity matrix, and kprod denotes the Kronecker product. The routine estimates sigma_min(T) by the reciprocal of an estimate of the 1-norm of inverse(T). The true reciprocal 1-norm of inverse(T) cannot differ from sigma_min(T) by more than a factor of N.Example
Program Text
* SB03UD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDC, LDT, LDU, LDX PARAMETER ( LDA = NMAX, LDC = NMAX, LDT = NMAX, $ LDU = NMAX, LDX = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 3, 2*NMAX*NMAX ) + $ NMAX*NMAX + 2*NMAX ) * .. Local Scalars .. DOUBLE PRECISION FERR, RCOND, SCALE, SEPD INTEGER I, INFO, J, N CHARACTER*1 DICO, FACT, JOB, LYAPUN, TRANA, UPLO * .. Local Arrays .. INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), C(LDC,NMAX), DWORK(LDWORK), $ T(LDT,NMAX), U(LDU,NMAX), X(LDX,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB03UD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) DICO = 'D' * 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 = 99994 ) N ELSE IF ( LSAME( JOB, 'C' ) .OR. LSAME( JOB, 'E' ) ) $ READ ( NIN, FMT = * ) SCALE IF ( LSAME( FACT, 'N' ) .OR. ( LSAME( LYAPUN, 'O' ) .AND. $ .NOT.LSAME( JOB, 'X') ) ) $ READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( FACT, 'F' ) ) THEN READ ( NIN, FMT = * ) ( ( T(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( LYAPUN, 'O' ) ) $ READ ( NIN, FMT = * ) ( ( U(I,J), J = 1,N ), I = 1,N ) END IF IF ( .NOT.LSAME( JOB, 'S' ) ) $ READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( JOB, 'C' ) .OR. LSAME( JOB, 'E' ) ) $ READ ( NIN, FMT = * ) ( ( X(I,J), J = 1,N ), I = 1,N ) * Solve the discrete-time Lyapunov matrix equation and/or * estimate the condition and error bound on the solution. CALL SB03UD( JOB, FACT, TRANA, UPLO, LYAPUN, N, SCALE, A, LDA, $ T, LDT, U, LDU, C, LDC, X, LDX, SEPD, RCOND, FERR, $ DWORK(1), DWORK(N+1), IWORK, DWORK(2*N+1), $ LDWORK-2*N, INFO ) * IF ( INFO.EQ.0 ) THEN IF ( LSAME( JOB, 'X' ) .OR. LSAME( JOB, 'A' ) ) THEN WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( X(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99993 ) SCALE END IF IF ( LSAME( JOB, 'S' ) .OR. LSAME( JOB, 'C' ) $ .OR. LSAME( JOB, 'A' ) ) $ WRITE ( NOUT, FMT = 99992 ) SEPD IF ( LSAME( JOB, 'C' ) .OR. LSAME( JOB, 'A' ) ) $ WRITE ( NOUT, FMT = 99991 ) RCOND IF ( LSAME( JOB, 'E' ) .OR. LSAME( JOB, 'A' ) ) $ WRITE ( NOUT, FMT = 99990 ) FERR ELSE WRITE ( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' SB03UD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB03UD =',I2) 99996 FORMAT (' The solution matrix X is') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' Scaling factor = ',F8.4) 99992 FORMAT (/' Estimated separation = ',F8.4) 99991 FORMAT (/' Estimated reciprocal condition number = ',F8.4) 99990 FORMAT (/' Estimated error bound = ',F8.4) ENDProgram Data
SB03UD EXAMPLE PROGRAM DATA 3 A N N U O 3.0 1.0 1.0 1.0 3.0 0.0 0.0 0.0 3.0 25.0 24.0 15.0 24.0 32.0 8.0 15.0 8.0 40.0Program Results
SB03UD EXAMPLE PROGRAM RESULTS The solution matrix X is 2.0000 1.0000 1.0000 1.0000 3.0000 0.0000 1.0000 0.0000 4.0000 Scaling factor = 1.0000 Estimated separation = 5.2302 Estimated reciprocal condition number = 0.1832 Estimated error bound = 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB04MD.html 0000664 0000000 0000000 00000021056 14560147231 0020347 0 ustar 00root root 0000000 0000000
Purpose
To solve for X the continuous-time Sylvester equation AX + XB = C where A, B, C and X are general N-by-N, M-by-M, N-by-M and N-by-M matrices respectively.Specification
SUBROUTINE SB04MD( N, M, A, LDA, B, LDB, C, LDC, Z, LDZ, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDWORK, LDZ, M, N C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), Z(LDZ,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The order of the matrix B. M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the coefficient matrix A of the equation. On exit, the leading N-by-N upper Hessenberg part of this array contains the matrix H, and the remainder of the leading N-by-N part, together with the elements 2,3,...,N of array DWORK, contain the orthogonal transformation matrix U (stored in factored form). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading M-by-M part of this array must contain the coefficient matrix B of the equation. On exit, the leading M-by-M part of this array contains the quasi-triangular Schur factor S of the matrix B'. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M). C (input/output) DOUBLE PRECISION array, dimension (LDC,M) On entry, the leading N-by-M part of this array must contain the coefficient matrix C of the equation. On exit, the leading N-by-M part of this array contains the solution matrix X of the problem. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). Z (output) DOUBLE PRECISION array, dimension (LDZ,M) The leading M-by-M part of this array contains the orthogonal matrix Z used to transform B' to real upper Schur form. LDZ INTEGER The leading dimension of array Z. LDZ >= MAX(1,M).Workspace
IWORK INTEGER array, dimension (4*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and DWORK(2), DWORK(3),..., DWORK(N) contain the scalar factors of the elementary reflectors used to reduce A to upper Hessenberg form, as returned by LAPACK Library routine DGEHRD. LDWORK INTEGER The length of the array DWORK. LDWORK = MAX(1, 2*N*N + 8*N, 5*M, N + M). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, 1 <= i <= M, the QR algorithm failed to compute all the eigenvalues (see LAPACK Library routine DGEES); > M: if a singular matrix was encountered whilst solving for the (INFO-M)-th column of matrix X.Method
The matrix A is transformed to upper Hessenberg form H = U'AU by the orthogonal transformation matrix U; matrix B' is transformed to real upper Schur form S = Z'B'Z using the orthogonal transformation matrix Z. The matrix C is also multiplied by the transformations, F = U'CZ, and the solution matrix Y of the transformed system HY + YS' = F is computed by back substitution. Finally, the matrix Y is then multiplied by the orthogonal transformation matrices, X = UYZ', in order to obtain the solution matrix X to the original problem.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979.Numerical Aspects
3 3 2 2 The algorithm requires about (5/3) N + 10 M + 5 N M + 2.5 M N operations and is backward stable.Further Comments
NoneExample
Program Text
* SB04MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDC, LDZ PARAMETER ( LDA = NMAX, LDB = MMAX, LDC = NMAX, $ LDZ = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 4*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, 2*NMAX*NMAX+8*NMAX, 5*MMAX, $ NMAX+MMAX ) ) * .. Local Scalars .. INTEGER I, INFO, J, M, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,MMAX), $ DWORK(LDWORK), Z(LDZ,MMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL SB04MD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,M ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,M ), I = 1,N ) * Find the solution matrix X. CALL SB04MD( N, M, A, LDA, B, LDB, C, LDC, Z, LDZ, IWORK, $ 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 ) ( C(I,J), J = 1,M ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( Z(I,J), J = 1,M ) 40 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' SB04MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB04MD = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The orthogonal matrix Z is ') 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
SB04MD EXAMPLE PROGRAM DATA 3 2 2.0 1.0 3.0 0.0 2.0 1.0 6.0 1.0 2.0 2.0 1.0 1.0 6.0 2.0 1.0 1.0 4.0 0.0 5.0Program Results
SB04MD EXAMPLE PROGRAM RESULTS The solution matrix X is -2.7685 0.5498 -1.0531 0.6865 4.5257 -0.4389 The orthogonal matrix Z is -0.9732 -0.2298 0.2298 -0.9732
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB04MR.html 0000664 0000000 0000000 00000006247 14560147231 0020372 0 ustar 00root root 0000000 0000000
Purpose
To solve a linear algebraic system of order M whose coefficient matrix has zeros below the second subdiagonal. The matrix is stored compactly, row-wise.Specification
SUBROUTINE SB04MR( M, D, IPR, INFO ) C .. Scalar Arguments .. INTEGER INFO, M C .. Array Arguments .. INTEGER IPR(*) DOUBLE PRECISION D(*)Arguments
Input/Output Parameters
M (input) INTEGER The order of the system. M >= 0. Note that parameter M should have twice the value in the original problem (see SLICOT Library routine SB04MU). D (input/output) DOUBLE PRECISION array, dimension (M*(M+1)/2+3*M) On entry, the first M*(M+1)/2 + 2*M elements of this array must contain the coefficient matrix, stored compactly, row-wise, and the next M elements must contain the right hand side of the linear system, as set by SLICOT Library routine SB04MU. On exit, the content of this array is updated, the last M elements containing the solution with components interchanged (see IPR). IPR (output) INTEGER array, dimension (2*M) The leading M elements contain information about the row interchanges performed for solving the system. Specifically, the i-th component of the solution is specified by IPR(i).Error Indicator
INFO INTEGER = 0: successful exit; = 1: if a singular matrix was encountered.Method
Gaussian elimination with partial pivoting is used. The rows of the matrix are not actually permuted, only their indices are interchanged in array IPR.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct and solve a linear algebraic system of order 2*M whose coefficient matrix has zeros below the second subdiagonal. Such systems appear when solving continuous-time Sylvester equations using the Hessenberg-Schur method.Specification
SUBROUTINE SB04MU( N, M, IND, A, LDA, B, LDB, C, LDC, D, IPR, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, IND, LDA, LDB, LDC, M, N C .. Array Arguments .. INTEGER IPR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix B. N >= 0. M (input) INTEGER The order of the matrix A. M >= 0. IND (input) INTEGER IND and IND - 1 specify the indices of the columns in C to be computed. IND > 1. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain an upper Hessenberg matrix. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). B (input) DOUBLE PRECISION array, dimension (LDB,N) The leading N-by-N part of this array must contain a matrix in real Schur form. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the coefficient matrix C of the equation. On exit, the leading M-by-N part of this array contains the matrix C with columns IND-1 and IND updated. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M).Workspace
D DOUBLE PRECISION array, dimension (2*M*M+7*M) IPR INTEGER array, dimension (4*M)Error Indicator
INFO INTEGER = 0: successful exit; > 0: if INFO = IND, a singular matrix was encountered.Method
A special linear algebraic system of order 2*M, whose coefficient matrix has zeros below the second subdiagonal is constructed and solved. The coefficient matrix is stored compactly, row-wise.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve a linear algebraic system of order M whose coefficient matrix is in upper Hessenberg form, stored compactly, row-wise.Specification
SUBROUTINE SB04MW( M, D, IPR, INFO ) C .. Scalar Arguments .. INTEGER INFO, M C .. Array Arguments .. INTEGER IPR(*) DOUBLE PRECISION D(*)Arguments
Input/Output Parameters
M (input) INTEGER The order of the system. M >= 0. D (input/output) DOUBLE PRECISION array, dimension (M*(M+1)/2+2*M) On entry, the first M*(M+1)/2 + M elements of this array must contain an upper Hessenberg matrix, stored compactly, row-wise, and the next M elements must contain the right hand side of the linear system, as set by SLICOT Library routine SB04MY. On exit, the content of this array is updated, the last M elements containing the solution with components interchanged (see IPR). IPR (output) INTEGER array, dimension (2*M) The leading M elements contain information about the row interchanges performed for solving the system. Specifically, the i-th component of the solution is specified by IPR(i).Error Indicator
INFO INTEGER = 0: successful exit; = 1: if a singular matrix was encountered.Method
Gaussian elimination with partial pivoting is used. The rows of the matrix are not actually permuted, only their indices are interchanged in array IPR.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct and solve a linear algebraic system of order M whose coefficient matrix is in upper Hessenberg form. Such systems appear when solving Sylvester equations using the Hessenberg-Schur method.Specification
SUBROUTINE SB04MY( N, M, IND, A, LDA, B, LDB, C, LDC, D, IPR, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, IND, LDA, LDB, LDC, M, N C .. Array Arguments .. INTEGER IPR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix B. N >= 0. M (input) INTEGER The order of the matrix A. M >= 0. IND (input) INTEGER The index of the column in C to be computed. IND >= 1. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain an upper Hessenberg matrix. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). B (input) DOUBLE PRECISION array, dimension (LDB,N) The leading N-by-N part of this array must contain a matrix in real Schur form. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the coefficient matrix C of the equation. On exit, the leading M-by-N part of this array contains the matrix C with column IND updated. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M).Workspace
D DOUBLE PRECISION array, dimension (M*(M+1)/2+2*M) IPR INTEGER array, dimension (2*M)Error Indicator
INFO INTEGER = 0: successful exit; > 0: if INFO = IND, a singular matrix was encountered.Method
A special linear algebraic system of order M, with coefficient matrix in upper Hessenberg form is constructed and solved. The coefficient matrix is stored compactly, row-wise.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X the continuous-time Sylvester equation AX + XB = C, with at least one of the matrices A or B in Schur form and the other in Hessenberg or Schur form (both either upper or lower); A, B, C and X are N-by-N, M-by-M, N-by-M, and N-by-M matrices, respectively.Specification
SUBROUTINE SB04ND( ABSCHU, ULA, ULB, N, M, A, LDA, B, LDB, C, $ LDC, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER ABSCHU, ULA, ULB INTEGER INFO, LDA, LDB, LDC, LDWORK, M, N DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*)Arguments
Mode Parameters
ABSCHU CHARACTER*1 Indicates whether A and/or B is/are in Schur or Hessenberg form as follows: = 'A': A is in Schur form, B is in Hessenberg form; = 'B': B is in Schur form, A is in Hessenberg form; = 'S': Both A and B are in Schur form. ULA CHARACTER*1 Indicates whether A is in upper or lower Schur form or upper or lower Hessenberg form as follows: = 'U': A is in upper Hessenberg form if ABSCHU = 'B' and upper Schur form otherwise; = 'L': A is in lower Hessenberg form if ABSCHU = 'B' and lower Schur form otherwise. ULB CHARACTER*1 Indicates whether B is in upper or lower Schur form or upper or lower Hessenberg form as follows: = 'U': B is in upper Hessenberg form if ABSCHU = 'A' and upper Schur form otherwise; = 'L': B is in lower Hessenberg form if ABSCHU = 'A' and lower Schur form otherwise.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The order of the matrix B. M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the coefficient matrix A of the equation. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading M-by-M part of this array must contain the coefficient matrix B of the equation. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M). C (input/output) DOUBLE PRECISION array, dimension (LDC,M) On entry, the leading N-by-M part of this array must contain the coefficient matrix C of the equation. On exit, if INFO = 0, the leading N-by-M part of this array contains the solution matrix X of the problem. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity in the Sylvester equation. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then a default tolerance, defined by TOLDEF = EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not referenced if ABSCHU = 'S', ULA = 'U', and ULB = 'U'.Workspace
IWORK INTEGER array, dimension (2*MAX(M,N)) This parameter is not referenced if ABSCHU = 'S', ULA = 'U', and ULB = 'U'. DWORK DOUBLE PRECISION array, dimension (LDWORK) This parameter is not referenced if ABSCHU = 'S', ULA = 'U', and ULB = 'U'. LDWORK INTEGER The length of the array DWORK. LDWORK = 0, if ABSCHU = 'S', ULA = 'U', and ULB = 'U'; LDWORK = 2*MAX(M,N)*(4 + 2*MAX(M,N)), otherwise.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if a (numerically) singular matrix T was encountered during the computation of the solution matrix X. That is, the estimated reciprocal condition number of T is less than or equal to TOL.Method
Matrices A and B are assumed to be in (upper or lower) Hessenberg or Schur form (with at least one of them in Schur form). The solution matrix X is then computed by rows or columns via the back substitution scheme proposed by Golub, Nash and Van Loan (see [1]), which involves the solution of triangular systems of equations that are constructed recursively and which may be nearly singular if A and -B have close eigenvalues. If near singularity is detected, then the routine returns with the Error Indicator (INFO) set to 1.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979.Numerical Aspects
2 2 The algorithm requires approximately 5M N + 0.5MN operations in 2 2 the worst case and 2.5M N + 0.5MN operations in the best case (where M is the order of the matrix in Hessenberg form and N is the order of the matrix in Schur form) and is mixed stable (see [1]).Further Comments
NoneExample
Program Text
* SB04ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = MMAX, LDC = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 2*( MAX( NMAX,MMAX ) )* $ ( 4+2*( MAX( NMAX,MMAX ) ) ) ) INTEGER LIWORK PARAMETER ( LIWORK = 2*MAX( NMAX,MMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N CHARACTER*1 ABSCHU, ULA, ULB * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,MMAX), $ DWORK(LDWORK) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL SB04ND * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, TOL, ULA, ULB, ABSCHU IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99994 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,M ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,M ), I = 1,N ) * Find the solution matrix X. CALL SB04ND( ABSCHU, ULA, ULB, N, M, A, LDA, B, LDB, C, $ LDC, TOL, IWORK, 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 ) ( C(I,J), J = 1,M ) 20 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' SB04ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB04ND = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
SB04ND EXAMPLE PROGRAM DATA 5 3 0.0 U U B 17.0 24.0 1.0 8.0 15.0 23.0 5.0 7.0 14.0 16.0 0.0 6.0 13.0 20.0 22.0 0.0 0.0 19.0 21.0 3.0 0.0 0.0 0.0 2.0 9.0 8.0 1.0 6.0 0.0 5.0 7.0 0.0 9.0 2.0 62.0 -12.0 26.0 59.0 -10.0 31.0 70.0 -6.0 9.0 35.0 31.0 -7.0 36.0 -15.0 7.0Program Results
SB04ND EXAMPLE PROGRAM RESULTS The solution matrix X is 0.0000 0.0000 1.0000 1.0000 0.0000 0.0000 0.0000 1.0000 0.0000 1.0000 1.0000 -1.0000 2.0000 -2.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB04NV.html 0000664 0000000 0000000 00000006500 14560147231 0020367 0 ustar 00root root 0000000 0000000
Purpose
To construct the right-hand sides D for a system of equations in Hessenberg form solved via SB04NX (case with 2 right-hand sides).Specification
SUBROUTINE SB04NV( ABSCHR, UL, N, M, C, LDC, INDX, AB, LDAB, D ) C .. Scalar Arguments .. CHARACTER ABSCHR, UL INTEGER INDX, LDAB, LDC, M, N C .. Array Arguments .. DOUBLE PRECISION AB(LDAB,*), C(LDC,*), D(*)Arguments
Mode Parameters
ABSCHR CHARACTER*1 Indicates whether AB contains A or B, as follows: = 'A': AB contains A; = 'B': AB contains B. UL CHARACTER*1 Indicates whether AB is upper or lower Hessenberg matrix, as follows: = 'U': AB is upper Hessenberg; = 'L': AB is lower Hessenberg.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The order of the matrix B. M >= 0. C (input) DOUBLE PRECISION array, dimension (LDC,M) The leading N-by-M part of this array must contain both the not yet modified part of the coefficient matrix C of the Sylvester equation AX + XB = C, and both the currently computed part of the solution of the Sylvester equation. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). INDX (input) INTEGER The position of the first column/row of C to be used in the construction of the right-hand side D. AB (input) DOUBLE PRECISION array, dimension (LDAB,*) The leading N-by-N or M-by-M part of this array must contain either A or B of the Sylvester equation AX + XB = C. LDAB INTEGER The leading dimension of array AB. LDAB >= MAX(1,N) or LDAB >= MAX(1,M) (depending on ABSCHR = 'A' or ABSCHR = 'B', respectively). D (output) DOUBLE PRECISION array, dimension (*) The leading 2*N or 2*M part of this array (depending on ABSCHR = 'B' or ABSCHR = 'A', respectively) contains the right-hand side stored as a matrix with two rows.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct the right-hand side D for a system of equations in Hessenberg form solved via SB04NY (case with 1 right-hand side).Specification
SUBROUTINE SB04NW( ABSCHR, UL, N, M, C, LDC, INDX, AB, LDAB, D ) C .. Scalar Arguments .. CHARACTER ABSCHR, UL INTEGER INDX, LDAB, LDC, M, N C .. Array Arguments .. DOUBLE PRECISION AB(LDAB,*), C(LDC,*), D(*)Arguments
Mode Parameters
ABSCHR CHARACTER*1 Indicates whether AB contains A or B, as follows: = 'A': AB contains A; = 'B': AB contains B. UL CHARACTER*1 Indicates whether AB is upper or lower Hessenberg matrix, as follows: = 'U': AB is upper Hessenberg; = 'L': AB is lower Hessenberg.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The order of the matrix B. M >= 0. C (input) DOUBLE PRECISION array, dimension (LDC,M) The leading N-by-M part of this array must contain both the not yet modified part of the coefficient matrix C of the Sylvester equation AX + XB = C, and both the currently computed part of the solution of the Sylvester equation. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). INDX (input) INTEGER The position of the column/row of C to be used in the construction of the right-hand side D. AB (input) DOUBLE PRECISION array, dimension (LDAB,*) The leading N-by-N or M-by-M part of this array must contain either A or B of the Sylvester equation AX + XB = C. LDAB INTEGER The leading dimension of array AB. LDAB >= MAX(1,N) or LDAB >= MAX(1,M) (depending on ABSCHR = 'A' or ABSCHR = 'B', respectively). D (output) DOUBLE PRECISION array, dimension (*) The leading N or M part of this array (depending on ABSCHR = 'B' or ABSCHR = 'A', respectively) contains the right-hand side.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve a system of equations in Hessenberg form with two consecutive offdiagonals and two right-hand sides.Specification
SUBROUTINE SB04NX( RC, UL, M, A, LDA, LAMBD1, LAMBD2, LAMBD3, $ LAMBD4, D, TOL, IWORK, DWORK, LDDWOR, INFO ) C .. Scalar Arguments .. CHARACTER RC, UL INTEGER INFO, LDA, LDDWOR, M DOUBLE PRECISION LAMBD1, LAMBD2, LAMBD3, LAMBD4, TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), D(*), DWORK(LDDWOR,*)Arguments
Mode Parameters
RC CHARACTER*1 Indicates processing by columns or rows, as follows: = 'R': Row transformations are applied; = 'C': Column transformations are applied. UL CHARACTER*1 Indicates whether AB is upper or lower Hessenberg matrix, as follows: = 'U': AB is upper Hessenberg; = 'L': AB is lower Hessenberg.Input/Output Parameters
M (input) INTEGER The order of the matrix A. M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain a matrix A in Hessenberg form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). LAMBD1, (input) DOUBLE PRECISION LAMBD2, These variables must contain the 2-by-2 block to be added LAMBD3, to the diagonal blocks of A. LAMBD4 D (input/output) DOUBLE PRECISION array, dimension (2*M) On entry, this array must contain the two right-hand side vectors of the Hessenberg system, stored row-wise. On exit, if INFO = 0, this array contains the two solution vectors of the Hessenberg system, stored row-wise.Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity of the triangular factor R of the Hessenberg matrix. A matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular.Workspace
IWORK INTEGER array, dimension (2*M) DWORK DOUBLE PRECISION array, dimension (LDDWOR,2*M+3) The leading 2*M-by-2*M part of this array is used for computing the triangular factor of the QR decomposition of the Hessenberg matrix. The remaining 6*M elements are used as workspace for the computation of the reciprocal condition estimate. LDDWOR INTEGER The leading dimension of array DWORK. LDDWOR >= MAX(1,2*M).Error Indicator
INFO INTEGER = 0: successful exit; = 1: if the Hessenberg matrix is (numerically) singular. That is, its estimated reciprocal condition number is less than or equal to TOL.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve a system of equations in Hessenberg form with one offdiagonal and one right-hand side.Specification
SUBROUTINE SB04NY( RC, UL, M, A, LDA, LAMBDA, D, TOL, IWORK, $ DWORK, LDDWOR, INFO ) C .. Scalar Arguments .. CHARACTER RC, UL INTEGER INFO, LDA, LDDWOR, M DOUBLE PRECISION LAMBDA, TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), D(*), DWORK(LDDWOR,*)Arguments
Mode Parameters
RC CHARACTER*1 Indicates processing by columns or rows, as follows: = 'R': Row transformations are applied; = 'C': Column transformations are applied. UL CHARACTER*1 Indicates whether AB is upper or lower Hessenberg matrix, as follows: = 'U': AB is upper Hessenberg; = 'L': AB is lower Hessenberg.Input/Output Parameters
M (input) INTEGER The order of the matrix A. M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain a matrix A in Hessenberg form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). LAMBDA (input) DOUBLE PRECISION This variable must contain the value to be added to the diagonal elements of A. D (input/output) DOUBLE PRECISION array, dimension (M) On entry, this array must contain the right-hand side vector of the Hessenberg system. On exit, if INFO = 0, this array contains the solution vector of the Hessenberg system.Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity of the triangular factor R of the Hessenberg matrix. A matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular.Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (LDDWOR,M+3) The leading M-by-M part of this array is used for computing the triangular factor of the QR decomposition of the Hessenberg matrix. The remaining 3*M elements are used as workspace for the computation of the reciprocal condition estimate. LDDWOR INTEGER The leading dimension of array DWORK. LDDWOR >= MAX(1,M).Error Indicator
INFO INTEGER = 0: successful exit; = 1: if the Hessenberg matrix is (numerically) singular. That is, its estimated reciprocal condition number is less than or equal to TOL.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for R and L one of the generalized Sylvester equations A * R - L * B = scale * C ) ) (1) D * R - L * E = scale * F ) or A' * R + D' * L = scale * C ) ) (2) R * B' + L * E' = scale * (-F) ) where A and D are M-by-M matrices, B and E are N-by-N matrices and C, F, R and L are M-by-N matrices. The solution (R, L) overwrites (C, F). 0 <= SCALE <= 1 is an output scaling factor chosen to avoid overflow. The routine also optionally computes a Dif estimate, which measures the separation of the spectrum of the matrix pair (A,D) from the spectrum of the matrix pair (B,E), Dif[(A,D),(B,E)].Specification
SUBROUTINE SB04OD( REDUCE, TRANS, JOBD, M, N, A, LDA, B, LDB, C, $ LDC, D, LDD, E, LDE, F, LDF, SCALE, DIF, P, $ LDP, Q, LDQ, U, LDU, V, LDV, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBD, REDUCE, TRANS INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDF, LDP, LDQ, $ LDU, LDV, LDWORK, M, N DOUBLE PRECISION DIF, SCALE C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), E(LDE,*), F(LDF,*), P(LDP,*), $ Q(LDQ,*), U(LDU,*), V(LDV,*)Arguments
Mode Parameters
REDUCE CHARACTER*1 Indicates whether the matrix pairs (A,D) and/or (B,E) are to be reduced to generalized Schur form as follows: = 'R': The matrix pairs (A,D) and (B,E) are to be reduced to generalized (real) Schur canonical form; = 'A': The matrix pair (A,D) only is to be reduced to generalized (real) Schur canonical form, and the matrix pair (B,E) already is in this form; = 'B': The matrix pair (B,E) only is to be reduced to generalized (real) Schur canonical form, and the matrix pair (A,D) already is in this form; = 'N': The matrix pairs (A,D) and (B,E) are already in generalized (real) Schur canonical form, as produced by LAPACK routine DGGES. TRANS CHARACTER*1 Indicates which of the equations, (1) or (2), is to be solved as follows: = 'N': The generalized Sylvester equation (1) is to be solved; = 'T': The "transposed" generalized Sylvester equation (2) is to be solved. JOBD CHARACTER*1 Indicates whether the Dif estimator is to be computed as follows: = '1': Only the one-norm-based Dif estimate is computed and stored in DIF; = '2': Only the Frobenius norm-based Dif estimate is computed and stored in DIF; = 'D': The equation (1) is solved and the one-norm-based Dif estimate is computed and stored in DIF; = 'F': The equation (1) is solved and the Frobenius norm- based Dif estimate is computed and stored in DIF; = 'N': The Dif estimator is not required and hence DIF is not referenced. (Solve either (1) or (2) only.) JOBD is not referenced if TRANS = 'T'.Input/Output Parameters
M (input) INTEGER The order of the matrices A and D and the number of rows of the matrices C, F, R and L. M >= 0. N (input) INTEGER The order of the matrices B and E and the number of columns of the matrices C, F, R and L. N >= 0. No computations are performed if N = 0 or M = 0, but SCALE and DIF (if JOB <> 'N') are set to 1. A (input/output) DOUBLE PRECISION array, dimension (LDA,M) On entry, the leading M-by-M part of this array must contain the coefficient matrix A of the equation; A must be in upper quasi-triangular form if REDUCE = 'B' or 'N'. On exit, the leading M-by-M part of this array contains the upper quasi-triangular form of A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N part of this array must contain the coefficient matrix B of the equation; B must be in upper quasi-triangular form if REDUCE = 'A' or 'N'. On exit, the leading N-by-N part of this array contains the upper quasi-triangular form of B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the right-hand side matrix C of the first equation in (1) or (2). On exit, if JOBD = 'N', 'D' or 'F', the leading M-by-N part of this array contains the solution matrix R of the problem; if JOBD = '1' or '2' and TRANS = 'N', the leading M-by-N part of this array contains the solution matrix R achieved during the computation of the Dif estimate. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading M-by-M part of this array must contain the coefficient matrix D of the equation; D must be in upper triangular form if REDUCE = 'B' or 'N'. On exit, the leading M-by-M part of this array contains the upper triangular form of D. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,M). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the coefficient matrix E of the equation; E must be in upper triangular form if REDUCE = 'A' or 'N'. On exit, the leading N-by-N part of this array contains the upper triangular form of E. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). F (input/output) DOUBLE PRECISION array, dimension (LDF,N) On entry, the leading M-by-N part of this array must contain the right-hand side matrix F of the second equation in (1) or (2). On exit, if JOBD = 'N', 'D' or 'F', the leading M-by-N part of this array contains the solution matrix L of the problem; if JOBD = '1' or '2' and TRANS = 'N', the leading M-by-N part of this array contains the solution matrix L achieved during the computation of the Dif estimate. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M). SCALE (output) DOUBLE PRECISION The scaling factor in (1) or (2). If 0 < SCALE < 1, C and F hold the solutions R and L, respectively, to a slightly perturbed system, but the computed generalized (real) Schur canonical form matrices P'*A*Q, U'*B*V, P'*D*Q and U'*E*V (see METHOD), or input matrices A, B, D, and E (if already reduced to these forms), have not been changed. If SCALE = 0, C and F hold the solutions R and L, respectively, to the homogeneous system with C = F = 0. Normally, SCALE = 1. DIF (output) DOUBLE PRECISION If TRANS = 'N' and JOBD <> 'N', then DIF contains the value of the Dif estimator, which is an upper bound of -1 Dif[(A,D),(B,E)] = sigma_min(Z) = 1/||Z ||, in either the one-norm, or Frobenius norm, respectively (see METHOD). Otherwise, DIF is not referenced. P (output) DOUBLE PRECISION array, dimension (LDP,*) If REDUCE = 'R' or 'A', then the leading M-by-M part of this array contains the (left) transformation matrix used to reduce (A,D) to generalized Schur form. Otherwise, P is not referenced and can be supplied as a dummy array (i.e. set parameter LDP = 1 and declare this array to be P(1,1) in the calling program). LDP INTEGER The leading dimension of array P. LDP >= MAX(1,M) if REDUCE = 'R' or 'A', LDP >= 1 if REDUCE = 'B' or 'N'. Q (output) DOUBLE PRECISION array, dimension (LDQ,*) If REDUCE = 'R' or 'A', then the leading M-by-M part of this array contains the (right) transformation matrix used to reduce (A,D) to generalized Schur form. Otherwise, Q is not referenced and can be supplied as a dummy array (i.e. set parameter LDQ = 1 and declare this array to be Q(1,1) in the calling program). LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,M) if REDUCE = 'R' or 'A', LDQ >= 1 if REDUCE = 'B' or 'N'. U (output) DOUBLE PRECISION array, dimension (LDU,*) If REDUCE = 'R' or 'B', then the leading N-by-N part of this array contains the (left) transformation matrix used to reduce (B,E) to generalized Schur form. Otherwise, U is not referenced and can be supplied as a dummy array (i.e. set parameter LDU = 1 and declare this array to be U(1,1) in the calling program). LDU INTEGER The leading dimension of array U. LDU >= MAX(1,N) if REDUCE = 'R' or 'B', LDU >= 1 if REDUCE = 'A' or 'N'. V (output) DOUBLE PRECISION array, dimension (LDV,*) If REDUCE = 'R' or 'B', then the leading N-by-N part of this array contains the (right) transformation matrix used to reduce (B,E) to generalized Schur form. Otherwise, V is not referenced and can be supplied as a dummy array (i.e. set parameter LDV = 1 and declare this array to be V(1,1) in the calling program). LDV INTEGER The leading dimension of array V. LDV >= MAX(1,N) if REDUCE = 'R' or 'B', LDV >= 1 if REDUCE = 'A' or 'N'.Workspace
IWORK INTEGER array, dimension (M+N+6) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. If TRANS = 'N' and JOBD = 'D' or 'F', then LDWORK = MAX(1,11*MN,10*MN+23,2*M*N) if REDUCE = 'R'; LDWORK = MAX(1,11*M, 10*M+23, 2*M*N) if REDUCE = 'A'; LDWORK = MAX(1,11*N, 10*N+23, 2*M*N) if REDUCE = 'B'; LDWORK = MAX(1,2*M*N) if REDUCE = 'N', where MN = max(M,N). Otherwise, the term 2*M*N above should be omitted. For optimum performance LDWORK should be larger. If LDWORK = -1 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 is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if REDUCE <> 'N' and either (A,D) and/or (B,E) cannot be reduced to generalized Schur form; = 2: if REDUCE = 'N' and either A or B is not in upper quasi-triangular form; = 3: if a singular matrix was encountered during the computation of the solution matrices R and L, that is (A,D) and (B,E) have common or close eigenvalues.Method
For the case TRANS = 'N', and REDUCE = 'R' or 'N', the algorithm used by the routine consists of four steps (see [1] and [2]) as follows: (a) if REDUCE = 'R', then the matrix pairs (A,D) and (B,E) are transformed to generalized Schur form, i.e. orthogonal matrices P, Q, U and V are computed such that P' * A * Q and U' * B * V are in upper quasi-triangular form and P' * D * Q and U' * E * V are in upper triangular form; (b) if REDUCE = 'R', then the matrices C and F are transformed to give P' * C * V and P' * F * V respectively; (c) if REDUCE = 'R', then the transformed system P' * A * Q * R1 - L1 * U' * B * V = scale * P' * C * V P' * D * Q * R1 - L1 * U' * E * V = scale * P' * F * V is solved to give R1 and L1; otherwise, equation (1) is solved to give R and L directly. The Dif estimator is also computed if JOBD <> 'N'. (d) if REDUCE = 'R', then the solution is transformed back to give R = Q * R1 * V' and L = P * L1 * U'. By using Kronecker products, equation (1) can also be written as the system of linear equations Z * x = scale*y (see [1]), where | I*A I*D | Z = | |. |-B'*I -E'*I | -1 If JOBD <> 'N', then a lower bound on ||Z ||, in either the one- norm or Frobenius norm, is computed, which in most cases is a reliable estimate of the true value. Notice that since Z is a matrix of order 2 * M * N, the exact value of Dif (i.e., in the Frobenius norm case, the smallest singular value of Z) may be very expensive to compute. The case TRANS = 'N', and REDUCE = 'A' or 'B', is similar, but only one of the matrix pairs should be reduced and the calculations simplify. For the case TRANS = 'T', and REDUCE = 'R' or 'N', the algorithm is similar, but the steps (b), (c), and (d) are as follows: (b) if REDUCE = 'R', then the matrices C and F are transformed to give Q' * C * V and P' * F * U respectively; (c) if REDUCE = 'R', then the transformed system Q' * A' * P * R1 + Q' * D' * P * L1 = scale * Q' * C * V R1 * V' * B' * U + L1 * V' * E' * U = -scale * P' * F * U is solved to give R1 and L1; otherwise, equation (2) is solved to give R and L directly. (d) if REDUCE = 'R', then the solution is transformed back to give R = P * R1 * V' and L = P * L1 * V'.References
[1] Kagstrom, B. and Westin, L. Generalized Schur Methods with Condition Estimators for Solving the Generalized Sylvester Equation. IEEE Trans. Auto. Contr., 34, pp. 745-751, 1989. [2] Kagstrom, B. and Westin, L. GSYLV - Fortran Routines for the Generalized Schur Method with Dif Estimators for Solving the Generalized Sylvester Equation. Report UMINF-132.86, Institute of Information Processing, Univ. of Umea, Sweden, July 1987. [3] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur Method for the Problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979. [4] Kagstrom, B. and Van Dooren, P. Additive Decomposition of a Transfer Function with respect to a Specified Region. In: "Signal Processing, Scattering and Operator Theory, and Numerical Methods" (Eds. M.A. Kaashoek et al.). Proceedings of MTNS-89, Vol. 3, pp. 469-477, Birkhauser Boston Inc., 1990. [5] Kagstrom, B. and Van Dooren, P. A Generalized State-space Approach for the Additive Decomposition of a Transfer Matrix. Report UMINF-91.12, Institute of Information Processing, Univ. of Umea, Sweden, April 1991.Numerical Aspects
The algorithm is backward stable. A reliable estimate for the condition number of Z in the Frobenius norm, is (see [1]) K(Z) = SQRT( ||A||**2 + ||B||**2 + ||C||**2 + ||D||**2 )/DIF. If mu is an upper bound on the relative error of the elements of the matrices A, B, C, D, E and F, then the relative error in the actual solution is approximately mu * K(Z). The relative error in the computed solution (due to rounding errors) is approximately EPS * K(Z), where EPS is the machine precision (see LAPACK Library routine DLAMCH).Further Comments
For applications of the generalized Sylvester equation in control theory, see [4] and [5].Example
Program Text
* SB04OD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ONE PARAMETER ( ONE = 1.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 10, NMAX = 10 ) INTEGER LDA, LDB, LDC, LDD, LDE, LDF, LDP, LDQ, LDU, LDV PARAMETER ( LDA = MMAX, LDB = NMAX, LDC = MMAX, LDD = MMAX, $ LDE = NMAX, LDF = MMAX, LDP = MMAX, LDQ = MMAX, $ LDU = NMAX, LDV = NMAX ) INTEGER LDWORK, LIWORK PARAMETER ( LDWORK = MAX(11*MAX(MMAX,NMAX), $ 10*MAX(MMAX,NMAX)+23,2*MMAX*NMAX), $ LIWORK = MMAX+NMAX+6 ) * .. Local Scalars .. DOUBLE PRECISION DIF, SCALE INTEGER I, INFO, J, M, N CHARACTER*1 JOBD, REDUCE, TRANS * .. Local Arrays .. DOUBLE PRECISION A(LDA,MMAX), B(LDB,NMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), E(LDE,NMAX), $ F(LDF,NMAX), P(LDP,MMAX), Q(LDQ,MMAX), $ U(LDU,NMAX), V(LDV,NMAX) INTEGER IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB04OD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, REDUCE, TRANS, JOBD IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,M ), I = 1,M ) IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,M ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,M ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( F(I,J), J = 1,N ), I = 1,M ) * Find the solution matrices L and R. CALL SB04OD( REDUCE, TRANS, JOBD, M, N, A, LDA, B, LDB, C, $ LDC, D, LDD, E, LDE, F, LDF, SCALE, DIF, P, $ LDP, Q, LDQ, U, LDU, V, LDV, IWORK, DWORK, $ LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, M WRITE ( NOUT, FMT = 99991 ) ( F(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99991 ) ( C(I,J), J = 1,N ) 40 CONTINUE IF ( LSAME( REDUCE, 'R' ).OR.LSAME( REDUCE, 'A' ) ) THEN WRITE ( NOUT, FMT = 99995 ) DO 60 I = 1, M WRITE ( NOUT, FMT = 99991 ) ( P(I,J), J = 1,M ) 60 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 80 I = 1, M WRITE ( NOUT, FMT = 99991 ) ( Q(I,J), J = 1,M ) 80 CONTINUE END IF IF ( LSAME( REDUCE, 'R' ).OR.LSAME( REDUCE, 'B' ) ) THEN WRITE ( NOUT, FMT = 99993 ) DO 100 I = 1, N WRITE ( NOUT, FMT = 99991 ) ( U(I,J), J = 1,N ) 100 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 120 I = 1, N WRITE ( NOUT, FMT = 99991 ) ( V(I,J), J = 1,N ) 120 CONTINUE END IF IF ( SCALE.NE.ONE ) WRITE ( NOUT, FMT = 99987 ) SCALE IF ( .NOT.LSAME( JOBD, 'N' ) ) $ WRITE ( NOUT, FMT = 99990 ) DIF END IF END IF END IF * STOP * 99999 FORMAT (' SB04OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB04OD = ',I2) 99997 FORMAT (' The solution matrix L is ') 99996 FORMAT (/' The solution matrix R is ') 99995 FORMAT (/' The left transformation matrix P is ') 99994 FORMAT (/' The right transformation matrix Q is ') 99993 FORMAT (/' The left transformation matrix U is ') 99992 FORMAT (/' The right transformation matrix V is ') 99991 FORMAT (20(1X,F8.4)) 99990 FORMAT (/' DIF = ',F8.4) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' SCALE = ',F8.4) ENDProgram Data
SB04OD EXAMPLE PROGRAM DATA 3 2 R N D 1.6 -3.1 1.9 -3.8 4.2 2.4 0.5 2.2 -4.5 1.1 0.1 -1.3 -3.1 -2.0 28.9 -5.7 -11.8 12.9 -31.7 2.5 0.1 1.7 -2.5 0.0 0.9 0.1 5.1 -7.3 6.0 2.4 -3.6 2.5 0.5 23.8 -11.0 -10.4 39.5 -74.8Program Results
SB04OD EXAMPLE PROGRAM RESULTS The solution matrix L is -0.7538 -1.6210 2.1778 1.7005 -3.5029 2.7961 The solution matrix R is 1.3064 2.7989 0.3698 -5.3376 -0.8767 6.7500 The left transformation matrix P is -0.3093 -0.9502 0.0383 0.9366 -0.2974 0.1851 -0.1645 0.0932 0.9820 The right transformation matrix Q is -0.6097 -0.7920 -0.0314 0.6310 -0.5090 0.5854 0.4796 -0.3371 -0.8102 The left transformation matrix U is -0.8121 0.5835 0.5835 0.8121 The right transformation matrix V is -0.9861 0.1660 0.1660 0.9861 DIF = 0.1147
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB04OW.html 0000664 0000000 0000000 00000014115 14560147231 0020372 0 ustar 00root root 0000000 0000000
Purpose
To solve a periodic Sylvester equation A * R - L * B = scale * C (1) D * L - R * E = scale * F, using Level 1 and 2 BLAS, where R and L are unknown M-by-N matrices, (A, D), (B, E) and (C, F) are given matrix pairs of size M-by-M, N-by-N and M-by-N, respectively, with real entries. (A, D) and (B, E) must be in periodic Schur form, i.e. A, B are upper quasi triangular and D, E are upper triangular. The solution (R, L) overwrites (C, F). 0 <= SCALE <= 1 is an output scaling factor chosen to avoid overflow. This routine is largely based on the LAPACK routine DTGSY2 developed by Bo Kagstrom and Peter Poromaa.Specification
SUBROUTINE SB04OW( M, N, A, LDA, B, LDB, C, LDC, D, LDD, E, LDE, $ F, LDF, SCALE, IWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDF, M, N DOUBLE PRECISION SCALE C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ E(LDE,*), F(LDF,*)Arguments
Input/Output Parameters
M (input) INTEGER The order of A and D, and the row dimension of C, F, R and L. M >= 0. N (input) INTEGER The order of B and E, and the column dimension of C, F, R and L. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,M) On entry, the leading M-by-M part of this array must contain the upper quasi triangular matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,M). B (input) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N part of this array must contain the upper quasi triangular matrix B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the first matrix equation in (1). On exit, the leading M-by-N part of this array contains the solution R. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M). D (input) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading M-by-M part of this array must contain the upper triangular matrix D. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,M). E (input) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the upper triangular matrix E. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). F (input/output) DOUBLE PRECISION array, dimension (LDF,N) On entry, the leading M-by-N part of this array must contain the right-hand-side of the second matrix equation in (1). On exit, the leading M-by-N part of this array contains the solution L. LDF INTEGER The leading dimension of the array F. LDF >= MAX(1,M). SCALE (output) DOUBLE PRECISION On exit, 0 <= SCALE <= 1. If 0 < SCALE < 1, the arrays C and F will hold the solutions R and L, respectively, to a slightly perturbed system but the input matrices A, B, D and E have not been changed. If SCALE = 0, C and F will hold solutions to the homogeneous system with C = F = 0. Normally, SCALE = 1.Workspace
IWORK INTEGER array, dimension (M+N+2)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: the matrix products A*D and B*E have common or very close eigenvalues.Method
In matrix notation solving equation (1) corresponds to solving Z*x = scale*b, where Z is defined as Z = [ kron(In, A) -kron(B', Im) ] (2) [ -kron(E', Im) kron(In, D) ], Ik is the identity matrix of size k and X' is the transpose of X. kron(X, Y) is the Kronecker product between the matrices X and Y. In the process of solving (1), we solve a number of such systems where Dim(Im), Dim(In) = 1 or 2.References
[1] Kagstrom, B. A Direct Method for Reordering Eigenvalues in the Generalized Real Schur Form of a Regular Matrix Pair (A,B). M.S. Moonen et al (eds.), Linear Algebra for Large Scale and Real-Time Applications, Kluwer Academic Publ., pp. 195-218, 1993. [2] Sreedhar, J. and Van Dooren, P. A Schur approach for solving some periodic matrix equations. U. Helmke et al (eds.), Systems and Networks: Mathematical Theory and Applications, Akademie Verlag, Berlin, vol. 77, pp. 339-362, 1994.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X either the real continuous-time Sylvester equation op(A)*X + ISGN*X*op(B) = scale*C, (1) or the real discrete-time Sylvester equation op(A)*X*op(B) + ISGN*X = scale*C, (2) where op(M) = M or M**T, and ISGN = 1 or -1. A is M-by-M and B is N-by-N; the right hand side C and the solution X are M-by-N; and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. The solution matrix X is overwritten onto C. If A and/or B are not (upper) quasi-triangular, that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks, they are reduced to Schur canonical form, that is, quasi-triangular with each 2-by-2 diagonal block having its diagonal elements equal and its off-diagonal elements of opposite sign.Specification
SUBROUTINE SB04PD( DICO, FACTA, FACTB, TRANA, TRANB, ISGN, M, N, $ A, LDA, U, LDU, B, LDB, V, LDV, C, LDC, SCALE, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACTA, FACTB, TRANA, TRANB INTEGER INFO, ISGN, LDA, LDB, LDC, LDU, LDV, LDWORK, M, $ N DOUBLE PRECISION SCALE C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), U( LDU, * ), V( LDV, * )Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the equation from which X is to be determined as follows: = 'C': Equation (1), continuous-time case; = 'D': Equation (2), discrete-time case. FACTA CHARACTER*1 Specifies whether or not the real Schur factorization of the matrix A is supplied on entry, as follows: = 'F': On entry, A and U contain the factors from the real Schur factorization of the matrix A; = 'N': The Schur factorization of A will be computed and the factors will be stored in A and U; = 'S': The matrix A is quasi-triangular (or Schur). FACTB CHARACTER*1 Specifies whether or not the real Schur factorization of the matrix B is supplied on entry, as follows: = 'F': On entry, B and V contain the factors from the real Schur factorization of the matrix B; = 'N': The Schur factorization of B will be computed and the factors will be stored in B and V; = 'S': The matrix B is quasi-triangular (or Schur). 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). TRANB CHARACTER*1 Specifies the form of op(B) to be used, as follows: = 'N': op(B) = B (No transpose); = 'T': op(B) = B**T (Transpose); = 'C': op(B) = B**T (Conjugate transpose = Transpose). ISGN INTEGER Specifies the sign of the equation as described before. ISGN may only be 1 or -1.Input/Output Parameters
M (input) INTEGER The order of the matrix A, and the number of rows in the matrices X and C. M >= 0. N (input) INTEGER The order of the matrix B, and the number of columns in the matrices X and C. N >= 0. A (input or input/output) DOUBLE PRECISION array, dimension (LDA,M) On entry, the leading M-by-M part of this array must contain the matrix A. If FACTA = 'S', then A contains a quasi-triangular matrix, and if FACTA = 'F', then A is in Schur canonical form; the elements below the upper Hessenberg part of the array A are not referenced. On exit, if FACTA = 'N', and INFO = 0 or INFO >= M+1, the leading M-by-M upper Hessenberg part of this array contains the upper quasi-triangular matrix in Schur canonical form from the Schur factorization of A. The contents of array A is not modified if FACTA = 'F' or 'S'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). U (input or output) DOUBLE PRECISION array, dimension (LDU,M) If FACTA = 'F', then U is an input argument and on entry the leading M-by-M part of this array must contain the orthogonal matrix U of the real Schur factorization of A. If FACTA = 'N', then U is an output argument and on exit, if INFO = 0 or INFO >= M+1, it contains the orthogonal M-by-M matrix from the real Schur factorization of A. If FACTA = 'S', the array U is not referenced. LDU INTEGER The leading dimension of array U. LDU >= MAX(1,M), if FACTA = 'F' or 'N'; LDU >= 1, if FACTA = 'S'. B (input or input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N part of this array must contain the matrix B. If FACTB = 'S', then B contains a quasi-triangular matrix, and if FACTB = 'F', then B is in Schur canonical form; the elements below the upper Hessenberg part of the array B are not referenced. On exit, if FACTB = 'N', and INFO = 0 or INFO = M+N+1, the leading N-by-N upper Hessenberg part of this array contains the upper quasi-triangular matrix in Schur canonical form from the Schur factorization of B. The contents of array B is not modified if FACTB = 'F' or 'S'. LDB (input) INTEGER The leading dimension of the array B. LDB >= max(1,N). V (input or output) DOUBLE PRECISION array, dimension (LDV,N) If FACTB = 'F', then V is an input argument and on entry the leading N-by-N part of this array must contain the orthogonal matrix V of the real Schur factorization of B. If FACTB = 'N', then V is an output argument and on exit, if INFO = 0 or INFO = M+N+1, it contains the orthogonal N-by-N matrix from the real Schur factorization of B. If FACTB = 'S', the array V is not referenced. LDV INTEGER The leading dimension of array V. LDV >= MAX(1,N), if FACTB = 'F' or 'N'; LDV >= 1, if FACTB = 'S'. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the right hand side matrix C. On exit, if INFO = 0 or INFO = M+N+1, the leading M-by-N part of this array contains the solution matrix X. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M). SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or M+N+1, then: DWORK(1) returns the optimal value of LDWORK; if FACTA = 'N', DWORK(1+i) and DWORK(1+M+i), i = 1,...,M, contain the real and imaginary parts, respectively, of the eigenvalues of A; and, if FACTB = 'N', DWORK(1+f+j) and DWORK(1+f+N+j), j = 1,...,N, with f = 2*M if FACTA = 'N', and f = 0, otherwise, contain the real and imaginary parts, respectively, of the eigenvalues of B. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, a+MAX( c, b+d, b+e ) ), where a = 1+2*M, if FACTA = 'N', a = 0, if FACTA <> 'N', b = 2*N, if FACTB = 'N', FACTA = 'N', b = 1+2*N, if FACTB = 'N', FACTA <> 'N', b = 0, if FACTB <> 'N', c = 3*M, if FACTA = 'N', c = M, if FACTA = 'F', c = 0, if FACTA = 'S', d = 3*N, if FACTB = 'N', d = N, if FACTB = 'F', d = 0, if FACTB = 'S', e = M, if DICO = 'C', FACTA <> 'S', e = 0, if DICO = 'C', FACTA = 'S', e = 2*M, if DICO = 'D'. An upper bound is LDWORK = 1+2*M+MAX( 3*M, 5*N, 2*N+2*M ). For good performance, LDWORK should be larger, e.g., LDWORK = 1+2*M+MAX( 3*M, 5*N, 2*N+2*M, 2*N+M*N ).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = i: if INFO = i, i = 1,...,M, the QR algorithm failed to compute all the eigenvalues of the matrix A (see LAPACK Library routine DGEES); the elements 2+i:1+M and 2+i+M:1+2*M of DWORK contain the real and imaginary parts, respectively, of the eigenvalues of A which have converged, and the array A contains the partially converged Schur form; = M+j: if INFO = M+j, j = 1,...,N, the QR algorithm failed to compute all the eigenvalues of the matrix B (see LAPACK Library routine DGEES); the elements 2+f+j:1+f+N and 2+f+j+N:1+f+2*N of DWORK contain the real and imaginary parts, respectively, of the eigenvalues of B which have converged, and the array B contains the partially converged Schur form; as defined for the parameter DWORK, f = 2*M, if FACTA = 'N', f = 0, if FACTA <> 'N'; = M+N+1: if DICO = 'C', and the matrices A and -ISGN*B have common or very close eigenvalues, or if DICO = 'D', and the matrices A and -ISGN*B have almost reciprocal eigenvalues (that is, if lambda(i) and mu(j) are eigenvalues of A and -ISGN*B, then lambda(i) = 1/mu(j) for some i and j); perturbed values were used to solve the equation (but the matrices A and B are unchanged).Method
An extension and refinement of the algorithms in [1,2] is used. If the matrices A and/or B are not quasi-triangular (see PURPOSE), they are reduced to Schur canonical form A = U*S*U', B = V*T*V', where U, V are orthogonal, and S, T are block upper triangular with 1-by-1 and 2-by-2 blocks on their diagonal. The right hand side matrix C is updated accordingly, C = U'*C*V; then, the solution matrix X of the "reduced" Sylvester equation (with A and B in (1) or (2) replaced by S and T, respectively), is computed column-wise via a back substitution scheme. A set of equivalent linear algebraic systems of equations of order at most four are formed and solved using Gaussian elimination with complete pivoting. Finally, the solution X of the original equation is obtained from the updating formula X = U*X*V'. If A and/or B are already quasi-triangular (or in Schur form), the initial factorizations and the corresponding updating steps are omitted.References
[1] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] 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.Numerical Aspects
The algorithm is stable and reliable, since orthogonal transformations and Gaussian elimination with complete pivoting are used. If INFO = M+N+1, the Sylvester equation is numerically singular.Further Comments
NoneExample
Program Text
* SB04PD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER LDA, LDB, LDC, LDU, LDV PARAMETER ( LDA = MMAX, LDB = NMAX, LDC = MMAX, $ LDU = MMAX, LDV = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 1 + 2*MMAX + MAX( 3*MMAX, 5*NMAX, $ 2*( NMAX + MMAX ) ) ) * .. Local Scalars .. CHARACTER DICO, FACTA, FACTB, TRANA, TRANB INTEGER I, INFO, ISGN, J, M, N DOUBLE PRECISION SCALE * .. Local Arrays .. DOUBLE PRECISION A(LDA,MMAX), B(LDB,NMAX), C(LDC,NMAX), $ DWORK(LDWORK), U(LDU,MMAX), V(LDV,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB04PD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, ISGN, DICO, FACTA, FACTB, TRANA, TRANB IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,M ), I = 1,M ) IF ( LSAME( FACTA, 'F' ) ) $ READ ( NIN, FMT = * ) ( ( U(I,J), J = 1,M ), I = 1,M ) IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( FACTB, 'F' ) ) $ READ ( NIN, FMT = * ) ( ( V(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,M ) * Find the solution matrix X. CALL SB04PD( DICO, FACTA, FACTB, TRANA, TRANB, ISGN, M, N, $ A, LDA, U, LDU, B, LDB, V, LDV, C, LDC, SCALE, $ DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) $ WRITE ( NOUT, FMT = 99998 ) INFO IF ( INFO.EQ.0 .OR. INFO.EQ.M+N+1 ) THEN WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) SCALE IF ( LSAME( FACTA, 'N' ) ) THEN WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( U(I,J), J = 1,M ) 40 CONTINUE END IF IF ( LSAME( FACTB, 'N' ) ) THEN WRITE ( NOUT, FMT = 99993 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( V(I,J), J = 1,N ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SB04PD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB04PD = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' Scaling factor = ',F8.4) 99994 FORMAT (/' The orthogonal matrix U is ') 99993 FORMAT (/' The orthogonal matrix V is ') 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
SB04PD EXAMPLE PROGRAM DATA 3 2 1 D N N N N 2.0 1.0 3.0 0.0 2.0 1.0 6.0 1.0 2.0 2.0 1.0 1.0 6.0 2.0 1.0 1.0 4.0 0.0 5.0Program Results
SB04PD EXAMPLE PROGRAM RESULTS The solution matrix X is -0.3430 0.1995 -0.1856 0.4192 0.6922 -0.2952 Scaling factor = 1.0000 The orthogonal matrix U is 0.5396 -0.7797 0.3178 0.1954 -0.2512 -0.9480 -0.8190 -0.5736 -0.0168 The orthogonal matrix V is -0.9732 -0.2298 0.2298 -0.9732
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB04PX.html 0000664 0000000 0000000 00000011314 14560147231 0020372 0 ustar 00root root 0000000 0000000
Purpose
To solve for the N1-by-N2 matrix X, 1 <= N1,N2 <= 2, in op(TL)*X*op(TR) + ISGN*X = SCALE*B, where TL is N1-by-N1, TR is N2-by-N2, B is N1-by-N2, and ISGN = 1 or -1. op(T) = T or T', where T' denotes the transpose of T.Specification
SUBROUTINE SB04PX( LTRANL, LTRANR, ISGN, N1, N2, TL, LDTL, TR, $ LDTR, B, LDB, SCALE, X, LDX, XNORM, INFO ) C .. Scalar Arguments .. LOGICAL LTRANL, LTRANR INTEGER INFO, ISGN, LDB, LDTL, LDTR, LDX, N1, N2 DOUBLE PRECISION SCALE, XNORM C .. Array Arguments .. DOUBLE PRECISION B( LDB, * ), TL( LDTL, * ), TR( LDTR, * ), $ X( LDX, * )Arguments
Mode Parameters
LTRANL LOGICAL Specifies the form of op(TL) to be used, as follows: = .FALSE.: op(TL) = TL, = .TRUE. : op(TL) = TL'. LTRANR LOGICAL Specifies the form of op(TR) to be used, as follows: = .FALSE.: op(TR) = TR, = .TRUE. : op(TR) = TR'. ISGN INTEGER Specifies the sign of the equation as described before. ISGN may only be 1 or -1.Input/Output Parameters
N1 (input) INTEGER The order of matrix TL. N1 may only be 0, 1 or 2. N2 (input) INTEGER The order of matrix TR. N2 may only be 0, 1 or 2. TL (input) DOUBLE PRECISION array, dimension (LDTL,N1) The leading N1-by-N1 part of this array must contain the matrix TL. LDTL INTEGER The leading dimension of array TL. LDTL >= MAX(1,N1). TR (input) DOUBLE PRECISION array, dimension (LDTR,N2) The leading N2-by-N2 part of this array must contain the matrix TR. LDTR INTEGER The leading dimension of array TR. LDTR >= MAX(1,N2). B (input) DOUBLE PRECISION array, dimension (LDB,N2) The leading N1-by-N2 part of this array must contain the right-hand side of the equation. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N1). SCALE (output) DOUBLE PRECISION The scale factor. SCALE is chosen less than or equal to 1 to prevent the solution overflowing. X (output) DOUBLE PRECISION array, dimension (LDX,N2) The leading N1-by-N2 part of this array contains the solution of the equation. Note that X may be identified with B in the calling statement. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N1). XNORM (output) DOUBLE PRECISION The infinity-norm of the solution.Error Indicator
INFO INTEGER = 0: successful exit; = 1: if TL and -ISGN*TR have almost reciprocal eigenvalues, so TL or TR is perturbed to get a nonsingular equation. NOTE: In the interests of speed, this routine does not check the inputs for errors.Method
The equivalent linear algebraic system of equations is formed and solved using Gaussian elimination with complete pivoting.References
[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.Numerical Aspects
The algorithm is stable and reliable, since Gaussian elimination with complete pivoting is used.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X the discrete-time Sylvester equation op(A)*X*op(B) + ISGN*X = scale*C, where op(A) = A or A**T, A and B are both upper quasi-triangular, and ISGN = 1 or -1. A is M-by-M and B is N-by-N; the right hand side C and the solution X are M-by-N; and scale is an output scale factor, set less than or equal to 1 to avoid overflow in X. The solution matrix X is overwritten onto C. A and B must be in Schur canonical form (as returned by LAPACK Library routine DHSEQR), that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign.Specification
SUBROUTINE SB04PY( TRANA, TRANB, ISGN, M, N, A, LDA, B, LDB, C, $ LDC, SCALE, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANA, TRANB INTEGER INFO, ISGN, LDA, LDB, LDC, M, N DOUBLE PRECISION SCALE C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * )Arguments
Mode Parameters
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). TRANB CHARACTER*1 Specifies the form of op(B) to be used, as follows: = 'N': op(B) = B (No transpose); = 'T': op(B) = B**T (Transpose); = 'C': op(B) = B**T (Conjugate transpose = Transpose). ISGN INTEGER Specifies the sign of the equation as described before. ISGN may only be 1 or -1.Input/Output Parameters
M (input) INTEGER The order of the matrix A, and the number of rows in the matrices X and C. M >= 0. N (input) INTEGER The order of the matrix B, and the number of columns in the matrices X and C. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain the upper quasi-triangular matrix A, in Schur canonical form. The part of A below the first sub-diagonal is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). B (input) DOUBLE PRECISION array, dimension (LDB,N) The leading N-by-N part of this array must contain the upper quasi-triangular matrix B, in Schur canonical form. The part of B below the first sub-diagonal is not referenced. LDB (input) INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the right hand side matrix C. On exit, if INFO >= 0, the leading M-by-N part of this array contains the solution matrix X. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M). SCALE (output) DOUBLE PRECISION The scale factor, scale, set less than or equal to 1 to prevent the solution overflowing.Workspace
DWORK DOUBLE PRECISION array, dimension (2*M)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: A and -ISGN*B have almost reciprocal eigenvalues; perturbed values were used to solve the equation (but the matrices A and B are unchanged).Method
The solution matrix X is computed column-wise via a back substitution scheme, an extension and refinement of the algorithm in [1], similar to that used in [2] for continuous-time Sylvester equations. A set of equivalent linear algebraic systems of equations of order at most four are formed and solved using Gaussian elimination with complete pivoting.References
[1] Bartels, R.H. and Stewart, G.W. T Solution of the matrix equation A X + XB = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] 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.Numerical Aspects
The algorithm is stable and reliable, since Gaussian elimination with complete pivoting is used.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X the discrete-time Sylvester equation X + AXB = C, where A, B, C and X are general N-by-N, M-by-M, N-by-M and N-by-M matrices respectively. A Hessenberg-Schur method, which reduces A to upper Hessenberg form, H = U'AU, and B' to real Schur form, S = Z'B'Z (with U, Z orthogonal matrices), is used.Specification
SUBROUTINE SB04QD( N, M, A, LDA, B, LDB, C, LDC, Z, LDZ, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDWORK, LDZ, M, N C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), Z(LDZ,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The order of the matrix B. M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the coefficient matrix A of the equation. On exit, the leading N-by-N upper Hessenberg part of this array contains the matrix H, and the remainder of the leading N-by-N part, together with the elements 2,3,...,N of array DWORK, contain the orthogonal transformation matrix U (stored in factored form). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading M-by-M part of this array must contain the coefficient matrix B of the equation. On exit, the leading M-by-M part of this array contains the quasi-triangular Schur factor S of the matrix B'. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M). C (input/output) DOUBLE PRECISION array, dimension (LDC,M) On entry, the leading N-by-M part of this array must contain the coefficient matrix C of the equation. On exit, the leading N-by-M part of this array contains the solution matrix X of the problem. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). Z (output) DOUBLE PRECISION array, dimension (LDZ,M) The leading M-by-M part of this array contains the orthogonal matrix Z used to transform B' to real upper Schur form. LDZ INTEGER The leading dimension of array Z. LDZ >= MAX(1,M).Workspace
IWORK INTEGER array, dimension (4*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, and DWORK(2), DWORK(3),..., DWORK(N) contain the scalar factors of the elementary reflectors used to reduce A to upper Hessenberg form, as returned by LAPACK Library routine DGEHRD. LDWORK INTEGER The length of the array DWORK. LDWORK = MAX(1, 2*N*N + 9*N, 5*M, N + M). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, 1 <= i <= M, the QR algorithm failed to compute all the eigenvalues of B (see LAPACK Library routine DGEES); > M: if a singular matrix was encountered whilst solving for the (INFO-M)-th column of matrix X.Method
The matrix A is transformed to upper Hessenberg form H = U'AU by the orthogonal transformation matrix U; matrix B' is transformed to real upper Schur form S = Z'B'Z using the orthogonal transformation matrix Z. The matrix C is also multiplied by the transformations, F = U'CZ, and the solution matrix Y of the transformed system Y + HYS' = F is computed by back substitution. Finally, the matrix Y is then multiplied by the orthogonal transformation matrices, X = UYZ', in order to obtain the solution matrix X to the original problem.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979. [2] Sima, V. Algorithms for Linear-quadratic Optimization. Marcel Dekker, Inc., New York, 1996.Numerical Aspects
3 3 2 2 The algorithm requires about (5/3) N + 10 M + 5 N M + 2.5 M N operations and is backward stable.Further Comments
NoneExample
Program Text
* SB04QD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDC, LDZ PARAMETER ( LDA = NMAX, LDB = MMAX, LDC = NMAX, $ LDZ = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 4*NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, 2*NMAX*NMAX+9*NMAX, 5*MMAX, $ NMAX+MMAX ) ) * .. Local Scalars .. INTEGER I, INFO, J, M, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,MMAX), $ DWORK(LDWORK), Z(LDZ,MMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL SB04QD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,M ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,M ), I = 1,N ) * Find the solution matrix X. CALL SB04QD( N, M, A, LDA, B, LDB, C, LDC, Z, LDZ, IWORK, $ 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 ) ( C(I,J), J = 1,M ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99996 ) ( Z(I,J), J = 1,M ) 40 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' SB04QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB04QD = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The orthogonal matrix Z is ') 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
SB04QD EXAMPLE PROGRAM DATA 3 3 1.0 2.0 3.0 6.0 7.0 8.0 9.0 2.0 3.0 7.0 2.0 3.0 2.0 1.0 2.0 3.0 4.0 1.0 271.0 135.0 147.0 923.0 494.0 482.0 578.0 383.0 287.0Program Results
SB04QD EXAMPLE PROGRAM RESULTS The solution matrix X is 2.0000 3.0000 6.0000 4.0000 7.0000 1.0000 5.0000 3.0000 2.0000 The orthogonal matrix Z is 0.8337 0.5204 -0.1845 0.3881 -0.7900 -0.4746 0.3928 -0.3241 0.8606
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB04QR.html 0000664 0000000 0000000 00000006532 14560147231 0020373 0 ustar 00root root 0000000 0000000
Purpose
To solve a linear algebraic system of order M whose coefficient matrix has zeros below the third subdiagonal and zero elements on the third subdiagonal with even column indices. The matrix is stored compactly, row-wise.Specification
SUBROUTINE SB04QR( M, D, IPR, INFO ) C .. Scalar Arguments .. INTEGER INFO, M C .. Array Arguments .. INTEGER IPR(*) DOUBLE PRECISION D(*)Arguments
Input/Output Parameters
M (input) INTEGER The order of the system. M >= 0, M even. Note that parameter M should have twice the value in the original problem (see SLICOT Library routine SB04QU). D (input/output) DOUBLE PRECISION array, dimension (M*M/2+4*M) On entry, the first M*M/2 + 3*M elements of this array must contain the coefficient matrix, stored compactly, row-wise, and the next M elements must contain the right hand side of the linear system, as set by SLICOT Library routine SB04QU. On exit, the content of this array is updated, the last M elements containing the solution with components interchanged (see IPR). IPR (output) INTEGER array, dimension (2*M) The leading M elements contain information about the row interchanges performed for solving the system. Specifically, the i-th component of the solution is specified by IPR(i).Error Indicator
INFO INTEGER = 0: successful exit; = 1: if a singular matrix was encountered.Method
Gaussian elimination with partial pivoting is used. The rows of the matrix are not actually permuted, only their indices are interchanged in array IPR.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979. [2] Sima, V. Algorithms for Linear-quadratic Optimization. Marcel Dekker, Inc., New York, 1996.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct and solve a linear algebraic system of order 2*M whose coefficient matrix has zeros below the third subdiagonal, and zero elements on the third subdiagonal with even column indices. Such systems appear when solving discrete-time Sylvester equations using the Hessenberg-Schur method.Specification
SUBROUTINE SB04QU( N, M, IND, A, LDA, B, LDB, C, LDC, D, IPR, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, IND, LDA, LDB, LDC, M, N C .. Array Arguments .. INTEGER IPR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix B. N >= 0. M (input) INTEGER The order of the matrix A. M >= 0. IND (input) INTEGER IND and IND - 1 specify the indices of the columns in C to be computed. IND > 1. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain an upper Hessenberg matrix. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). B (input) DOUBLE PRECISION array, dimension (LDB,N) The leading N-by-N part of this array must contain a matrix in real Schur form. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the coefficient matrix C of the equation. On exit, the leading M-by-N part of this array contains the matrix C with columns IND-1 and IND updated. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M).Workspace
D DOUBLE PRECISION array, dimension (2*M*M+8*M) IPR INTEGER array, dimension (4*M)Error Indicator
INFO INTEGER = 0: successful exit; > 0: if INFO = IND, a singular matrix was encountered.Method
A special linear algebraic system of order 2*M, whose coefficient matrix has zeros below the third subdiagonal and zero elements on the third subdiagonal with even column indices, is constructed and solved. The coefficient matrix is stored compactly, row-wise.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979. [2] Sima, V. Algorithms for Linear-quadratic Optimization. Marcel Dekker, Inc., New York, 1996.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct and solve a linear algebraic system of order M whose coefficient matrix is in upper Hessenberg form. Such systems appear when solving discrete-time Sylvester equations using the Hessenberg-Schur method.Specification
SUBROUTINE SB04QY( N, M, IND, A, LDA, B, LDB, C, LDC, D, IPR, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, IND, LDA, LDB, LDC, M, N C .. Array Arguments .. INTEGER IPR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix B. N >= 0. M (input) INTEGER The order of the matrix A. M >= 0. IND (input) INTEGER The index of the column in C to be computed. IND >= 1. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain an upper Hessenberg matrix. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). B (input) DOUBLE PRECISION array, dimension (LDB,N) The leading N-by-N part of this array must contain a matrix in real Schur form. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading M-by-N part of this array must contain the coefficient matrix C of the equation. On exit, the leading M-by-N part of this array contains the matrix C with column IND updated. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M).Workspace
D DOUBLE PRECISION array, dimension (M*(M+1)/2+2*M) IPR INTEGER array, dimension (2*M)Error Indicator
INFO INTEGER = 0: successful exit; > 0: if INFO = IND, a singular matrix was encountered.Method
A special linear algebraic system of order M, with coefficient matrix in upper Hessenberg form is constructed and solved. The coefficient matrix is stored compactly, row-wise.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979. [2] Sima, V. Algorithms for Linear-quadratic Optimization. Marcel Dekker, Inc., New York, 1996.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X the discrete-time Sylvester equation X + AXB = C, with at least one of the matrices A or B in Schur form and the other in Hessenberg or Schur form (both either upper or lower); A, B, C and X are N-by-N, M-by-M, N-by-M, and N-by-M matrices, respectively.Specification
SUBROUTINE SB04RD( ABSCHU, ULA, ULB, N, M, A, LDA, B, LDB, C, $ LDC, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER ABSCHU, ULA, ULB INTEGER INFO, LDA, LDB, LDC, LDWORK, M, N DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*)Arguments
Mode Parameters
ABSCHU CHARACTER*1 Indicates whether A and/or B is/are in Schur or Hessenberg form as follows: = 'A': A is in Schur form, B is in Hessenberg form; = 'B': B is in Schur form, A is in Hessenberg form; = 'S': Both A and B are in Schur form. ULA CHARACTER*1 Indicates whether A is in upper or lower Schur form or upper or lower Hessenberg form as follows: = 'U': A is in upper Hessenberg form if ABSCHU = 'B' and upper Schur form otherwise; = 'L': A is in lower Hessenberg form if ABSCHU = 'B' and lower Schur form otherwise. ULB CHARACTER*1 Indicates whether B is in upper or lower Schur form or upper or lower Hessenberg form as follows: = 'U': B is in upper Hessenberg form if ABSCHU = 'A' and upper Schur form otherwise; = 'L': B is in lower Hessenberg form if ABSCHU = 'A' and lower Schur form otherwise.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The order of the matrix B. M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the coefficient matrix A of the equation. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading M-by-M part of this array must contain the coefficient matrix B of the equation. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,M). C (input/output) DOUBLE PRECISION array, dimension (LDC,M) On entry, the leading N-by-M part of this array must contain the coefficient matrix C of the equation. On exit, if INFO = 0, the leading N-by-M part of this array contains the solution matrix X of the problem. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity in the Sylvester equation. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then a default tolerance, defined by TOLDEF = EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not referenced if ABSCHU = 'S', ULA = 'U', and ULB = 'U'.Workspace
IWORK INTEGER array, dimension (2*MAX(M,N)) This parameter is not referenced if ABSCHU = 'S', ULA = 'U', and ULB = 'U'. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK = 2*N, if ABSCHU = 'S', ULA = 'U', and ULB = 'U'; LDWORK = 2*MAX(M,N)*(4 + 2*MAX(M,N)), otherwise.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if a (numerically) singular matrix T was encountered during the computation of the solution matrix X. That is, the estimated reciprocal condition number of T is less than or equal to TOL.Method
Matrices A and B are assumed to be in (upper or lower) Hessenberg or Schur form (with at least one of them in Schur form). The solution matrix X is then computed by rows or columns via the back substitution scheme proposed by Golub, Nash and Van Loan (see [1]), which involves the solution of triangular systems of equations that are constructed recursively and which may be nearly singular if A and -B have almost reciprocal eigenvalues. If near singularity is detected, then the routine returns with the Error Indicator (INFO) set to 1.References
[1] Golub, G.H., Nash, S. and Van Loan, C.F. A Hessenberg-Schur method for the problem AX + XB = C. IEEE Trans. Auto. Contr., AC-24, pp. 909-913, 1979. [2] Sima, V. Algorithms for Linear-quadratic Optimization. Marcel Dekker, Inc., New York, 1996.Numerical Aspects
2 2 The algorithm requires approximately 5M N + 0.5MN operations in 2 2 the worst case and 2.5M N + 0.5MN operations in the best case (where M is the order of the matrix in Hessenberg form and N is the order of the matrix in Schur form) and is mixed stable (see [1]).Further Comments
NoneExample
Program Text
* SB04RD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = MMAX, LDC = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 2*( MAX( NMAX,MMAX ) )* $ ( 4+2*( MAX( NMAX,MMAX ) ) ) ) INTEGER LIWORK PARAMETER ( LIWORK = 2*MAX( NMAX,MMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N CHARACTER*1 ABSCHU, ULA, ULB * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,MMAX), $ DWORK(LDWORK) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL SB04RD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, TOL, ULA, ULB, ABSCHU IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99994 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,M ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,M ), I = 1,N ) * Find the solution matrix X. CALL SB04RD( ABSCHU, ULA, ULB, N, M, A, LDA, B, LDB, C, $ LDC, TOL, IWORK, 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 ) ( C(I,J), J = 1,M ) 20 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' SB04RD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB04RD = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
SB04RD EXAMPLE PROGRAM DATA 5 5 0.0 U U B 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 1.0 0.0 2.0 3.0 4.0 5.0 0.0 0.0 6.0 7.0 8.0 0.0 0.0 0.0 9.0 1.0 1.0 2.0 3.0 4.0 5.0 0.0 1.0 2.0 3.0 4.0 0.0 0.0 1.0 2.0 3.0 0.0 0.0 0.0 1.0 -5.0 0.0 0.0 0.0 4.0 1.0 2.0 4.0 10.0 40.0 7.0 6.0 20.0 40.0 74.0 38.0 0.0 2.0 8.0 36.0 2.0 0.0 0.0 6.0 52.0 -9.0 0.0 0.0 0.0 13.0 -43.0Program Results
SB04RD EXAMPLE PROGRAM RESULTS The solution matrix X is 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB04RV.html 0000664 0000000 0000000 00000010003 14560147231 0020364 0 ustar 00root root 0000000 0000000
Purpose
To construct the right-hand sides D for a system of equations in quasi-Hessenberg form solved via SB04RX (case with 2 right-hand sides).Specification
SUBROUTINE SB04RV( ABSCHR, UL, N, M, C, LDC, INDX, AB, LDAB, BA, $ LDBA, D, DWORK ) C .. Scalar Arguments .. CHARACTER ABSCHR, UL INTEGER INDX, LDAB, LDBA, LDC, M, N C .. Array Arguments .. DOUBLE PRECISION AB(LDAB,*), BA(LDBA,*), C(LDC,*), D(*), DWORK(*)Arguments
Mode Parameters
ABSCHR CHARACTER*1 Indicates whether AB contains A or B, as follows: = 'A': AB contains A; = 'B': AB contains B. UL CHARACTER*1 Indicates whether AB is upper or lower Hessenberg matrix, as follows: = 'U': AB is upper Hessenberg; = 'L': AB is lower Hessenberg.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The order of the matrix B. M >= 0. C (input) DOUBLE PRECISION array, dimension (LDC,M) The leading N-by-M part of this array must contain both the not yet modified part of the coefficient matrix C of the Sylvester equation X + AXB = C, and both the currently computed part of the solution of the Sylvester equation. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). INDX (input) INTEGER The position of the first column/row of C to be used in the construction of the right-hand side D. AB (input) DOUBLE PRECISION array, dimension (LDAB,*) The leading N-by-N or M-by-M part of this array must contain either A or B of the Sylvester equation X + AXB = C. LDAB INTEGER The leading dimension of array AB. LDAB >= MAX(1,N) or LDAB >= MAX(1,M) (depending on ABSCHR = 'A' or ABSCHR = 'B', respectively). BA (input) DOUBLE PRECISION array, dimension (LDBA,*) The leading N-by-N or M-by-M part of this array must contain either A or B of the Sylvester equation X + AXB = C, the matrix not contained in AB. LDBA INTEGER The leading dimension of array BA. LDBA >= MAX(1,N) or LDBA >= MAX(1,M) (depending on ABSCHR = 'B' or ABSCHR = 'A', respectively). D (output) DOUBLE PRECISION array, dimension (*) The leading 2*N or 2*M part of this array (depending on ABSCHR = 'B' or ABSCHR = 'A', respectively) contains the right-hand side stored as a matrix with two rows.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) where LDWORK is equal to 2*N or 2*M (depending on ABSCHR = 'B' or ABSCHR = 'A', respectively).Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct the right-hand side D for a system of equations in Hessenberg form solved via SB04RY (case with 1 right-hand side).Specification
SUBROUTINE SB04RW( ABSCHR, UL, N, M, C, LDC, INDX, AB, LDAB, BA, $ LDBA, D, DWORK ) C .. Scalar Arguments .. CHARACTER ABSCHR, UL INTEGER INDX, LDAB, LDBA, LDC, M, N C .. Array Arguments .. DOUBLE PRECISION AB(LDAB,*), BA(LDBA,*), C(LDC,*), D(*), DWORK(*)Arguments
Mode Parameters
ABSCHR CHARACTER*1 Indicates whether AB contains A or B, as follows: = 'A': AB contains A; = 'B': AB contains B. UL CHARACTER*1 Indicates whether AB is upper or lower Hessenberg matrix, as follows: = 'U': AB is upper Hessenberg; = 'L': AB is lower Hessenberg.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The order of the matrix B. M >= 0. C (input) DOUBLE PRECISION array, dimension (LDC,M) The leading N-by-M part of this array must contain both the not yet modified part of the coefficient matrix C of the Sylvester equation X + AXB = C, and both the currently computed part of the solution of the Sylvester equation. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N). INDX (input) INTEGER The position of the column/row of C to be used in the construction of the right-hand side D. AB (input) DOUBLE PRECISION array, dimension (LDAB,*) The leading N-by-N or M-by-M part of this array must contain either A or B of the Sylvester equation X + AXB = C. LDAB INTEGER The leading dimension of array AB. LDAB >= MAX(1,N) or LDAB >= MAX(1,M) (depending on ABSCHR = 'A' or ABSCHR = 'B', respectively). BA (input) DOUBLE PRECISION array, dimension (LDBA,*) The leading N-by-N or M-by-M part of this array must contain either A or B of the Sylvester equation X + AXB = C, the matrix not contained in AB. LDBA INTEGER The leading dimension of array BA. LDBA >= MAX(1,N) or LDBA >= MAX(1,M) (depending on ABSCHR = 'B' or ABSCHR = 'A', respectively). D (output) DOUBLE PRECISION array, dimension (*) The leading N or M part of this array (depending on ABSCHR = 'B' or ABSCHR = 'A', respectively) contains the right-hand side.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) where LDWORK is equal to N or M (depending on ABSCHR = 'B' or ABSCHR = 'A', respectively).Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve a system of equations in quasi-Hessenberg form (Hessenberg form plus two consecutive offdiagonals) with two right-hand sides.Specification
SUBROUTINE SB04RX( RC, UL, M, A, LDA, LAMBD1, LAMBD2, LAMBD3, $ LAMBD4, D, TOL, IWORK, DWORK, LDDWOR, INFO ) C .. Scalar Arguments .. CHARACTER RC, UL INTEGER INFO, LDA, LDDWOR, M DOUBLE PRECISION LAMBD1, LAMBD2, LAMBD3, LAMBD4, TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), D(*), DWORK(LDDWOR,*)Arguments
Mode Parameters
RC CHARACTER*1 Indicates processing by columns or rows, as follows: = 'R': Row transformations are applied; = 'C': Column transformations are applied. UL CHARACTER*1 Indicates whether A is upper or lower Hessenberg matrix, as follows: = 'U': A is upper Hessenberg; = 'L': A is lower Hessenberg.Input/Output Parameters
M (input) INTEGER The order of the matrix A. M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain a matrix A in Hessenberg form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). LAMBD1, (input) DOUBLE PRECISION LAMBD2, These variables must contain the 2-by-2 block to be LAMBD3, multiplied to the elements of A. LAMBD4 D (input/output) DOUBLE PRECISION array, dimension (2*M) On entry, this array must contain the two right-hand side vectors of the quasi-Hessenberg system, stored row-wise. On exit, if INFO = 0, this array contains the two solution vectors of the quasi-Hessenberg system, stored row-wise.Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity of the triangular factor R of the quasi-Hessenberg matrix. A matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular.Workspace
IWORK INTEGER array, dimension (2*M) DWORK DOUBLE PRECISION array, dimension (LDDWOR,2*M+3) The leading 2*M-by-2*M part of this array is used for computing the triangular factor of the QR decomposition of the quasi-Hessenberg matrix. The remaining 6*M elements are used as workspace for the computation of the reciprocal condition estimate. LDDWOR INTEGER The leading dimension of array DWORK. LDDWOR >= MAX(1,2*M).Error Indicator
INFO INTEGER = 0: successful exit; = 1: if the quasi-Hessenberg matrix is (numerically) singular. That is, its estimated reciprocal condition number is less than or equal to TOL.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve a system of equations in Hessenberg form with one right-hand side.Specification
SUBROUTINE SB04RY( RC, UL, M, A, LDA, LAMBDA, D, TOL, IWORK, $ DWORK, LDDWOR, INFO ) C .. Scalar Arguments .. CHARACTER RC, UL INTEGER INFO, LDA, LDDWOR, M DOUBLE PRECISION LAMBDA, TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), D(*), DWORK(LDDWOR,*)Arguments
Mode Parameters
RC CHARACTER*1 Indicates processing by columns or rows, as follows: = 'R': Row transformations are applied; = 'C': Column transformations are applied. UL CHARACTER*1 Indicates whether A is upper or lower Hessenberg matrix, as follows: = 'U': A is upper Hessenberg; = 'L': A is lower Hessenberg.Input/Output Parameters
M (input) INTEGER The order of the matrix A. M >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain a matrix A in Hessenberg form. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M). LAMBDA (input) DOUBLE PRECISION This variable must contain the value to be multiplied with the elements of A. D (input/output) DOUBLE PRECISION array, dimension (M) On entry, this array must contain the right-hand side vector of the Hessenberg system. On exit, if INFO = 0, this array contains the solution vector of the Hessenberg system.Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity of the triangular factor R of the Hessenberg matrix. A matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular.Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (LDDWOR,M+3) The leading M-by-M part of this array is used for computing the triangular factor of the QR decomposition of the Hessenberg matrix. The remaining 3*M elements are used as workspace for the computation of the reciprocal condition estimate. LDDWOR INTEGER The leading dimension of array DWORK. LDDWOR >= MAX(1,M).Error Indicator
INFO INTEGER = 0: successful exit; = 1: if the Hessenberg matrix is (numerically) singular. That is, its estimated reciprocal condition number is less than or equal to TOL.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To construct the minimum norm feedback matrix F to perform "deadbeat control" on a (A,B)-pair of a state-space model (which must be preliminarily reduced to upper "staircase" form using SLICOT Library routine AB01OD) such that the matrix R = A + BFU' is nilpotent. (The transformation matrix U reduces R to upper Schur form with zero blocks on its diagonal (of dimension KSTAIR(i)) and therefore contains bases for the i-th controllable subspaces, where i = 1,...,KMAX).Specification
SUBROUTINE SB06ND( N, M, KMAX, A, LDA, B, LDB, KSTAIR, U, LDU, F, $ LDF, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, KMAX, LDA, LDB, LDF, LDU, M, N C .. Array Arguments .. INTEGER KSTAIR(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), F(LDF,*), U(LDU,*)Arguments
Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The actual input dimension. M >= 0. KMAX (input) INTEGER The number of "stairs" in the staircase form as produced by SLICOT Library routine AB01OD. 0 <= KMAX <= N. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the transformed state-space matrix of the (A,B)-pair with triangular stairs, as produced by SLICOT Library routine AB01OD (with option STAGES = 'A'). On exit, the leading N-by-N part of this array contains the matrix U'AU + U'BF. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the transformed triangular input matrix of the (A,B)-pair as produced by SLICOT Library routine AB01OD (with option STAGES = 'A'). On exit, the leading N-by-M part of this array contains the matrix U'B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). KSTAIR (input) INTEGER array, dimension (KMAX) The leading KMAX elements of this array must contain the dimensions of each "stair" as produced by SLICOT Library routine AB01OD. U (input/output) DOUBLE PRECISION array, dimension (LDU,N) On entry, the leading N-by-N part of this array must contain either a transformation matrix (e.g. from a previous call to other SLICOT routine) or be initialised as the identity matrix. On exit, the leading N-by-N part of this array contains the product of the input matrix U and the state-space transformation matrix which reduces A + BFU' to real Schur form. LDU INTEGER The leading dimension of array U. LDU >= MAX(1,N). F (output) DOUBLE PRECISION array, dimension (LDF,N) The leading M-by-N part of this array contains the deadbeat feedback matrix F. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M).Workspace
DWORK DOUBLE PRECISION array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Starting from the (A,B)-pair in "staircase form" with "triangular" stairs, dimensions KSTAIR(i+1) x KSTAIR(i), (described by the vector KSTAIR): | B | A * . . . * | | 1| 11 . . | | | A A . . | | | 21 22 . . | | | . . . | [ B | A ] = | | . . * | | | . . | | 0 | 0 | | | A A | | | r,r-1 rr | where the i-th diagonal block of A has dimension KSTAIR(i), for i = 1,2,...,r, the feedback matrix F is constructed recursively in r steps (where the number of "stairs" r is given by KMAX). In each step a unitary state-space transformation U and a part of F are updated in order to achieve the final form: | 0 A * . . . * | | 12 . . | | . . | | 0 A . . | | 23 . . | | . . | [ U'AU + U'BF ] = | . . * | . | . . | | | | A | | r-1,r| | | | 0 |References
[1] Van Dooren, P. Deadbeat control: a special inverse eigenvalue problem. BIT, 24, pp. 681-699, 1984.Numerical Aspects
The algorithm requires O((N + M) * N**2) operations and is mixed numerical stable (see [1]).Further Comments
NoneExample
Program Text
* SB06ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDU, LDV, LDF PARAMETER ( LDA = NMAX, LDB = NMAX, LDU = NMAX, $ LDV = MMAX, LDF = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX + MAX(NMAX,3*MMAX) ) * PARAMETER ( LDWORK = 4*NMAX) DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, KMAX, M, N, NCONT CHARACTER*1 JOBU, JOBV * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), DWORK(LDWORK), $ F(LDF,NMAX), U(LDU,NMAX), V(LDV,MMAX) INTEGER IWORK(LIWORK), KSTAIR(NMAX) C .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL AB01OD, DLASET, SB06ND * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, TOL, JOBU, JOBV IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), I = 1,N ), J = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) * First put (A,B) into staircase form with triangular pivots * and determine the stairsizes. CALL AB01OD( 'A', JOBU, JOBV, N, M, A, LDA, B, LDB, U, $ LDU, V, LDV, NCONT, KMAX, KSTAIR, TOL, IWORK, $ DWORK, LDWORK, INFO ) * IF ( INFO.EQ.0 ) THEN IF( LSAME( JOBU, 'N' ) ) THEN * Initialize U as the identity matrix. CALL DLASET( 'Full', N, N, ZERO, ONE, U, LDU ) END IF * Perform "deadbeat control" to give F. CALL SB06ND( N, M, KMAX, A, LDA, B, LDB, KSTAIR, U, LDU, $ F, LDF, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) DO 60 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( F(I,J), J = 1,N ) 60 CONTINUE END IF ELSE WRITE ( NOUT, FMT = 99998 ) INFO END IF END IF END IF STOP * 99999 FORMAT (' SB06ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from AB01OD = ',I2) 99997 FORMAT (' INFO on exit from SB06ND = ',I2) 99996 FORMAT (' The deadbeat feedback matrix F is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
SB06ND EXAMPLE PROGRAM DATA 5 2 0.0 N N -17.0 24.0 41.0 68.0 15.0 23.0 -35.0 27.0 14.0 16.0 34.0 26.0 -13.0 20.0 22.0 10.0 12.0 19.0 -21.0 63.0 11.0 18.0 25.0 52.0 -29.0 -31.0 14.0 74.0 -69.0 -59.0 16.0 16.0 -25.0 -25.0 36.0Program Results
SB06ND EXAMPLE PROGRAM RESULTS The deadbeat feedback matrix F is -0.4819 -0.5782 -2.7595 -3.1093 0.0000 0.2121 -0.4462 0.7698 -1.5421 -0.5773
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB08CD.html 0000664 0000000 0000000 00000040565 14560147231 0020347 0 ustar 00root root 0000000 0000000
Purpose
To construct, for a given system G = (A,B,C,D), an output injection matrix H, an orthogonal transformation matrix Z, and a gain matrix V, such that the systems Q = (Z'*(A+H*C)*Z, Z'*(B+H*D), V*C*Z, V*D) and R = (Z'*(A+H*C)*Z, Z'*H, V*C*Z, V) provide a stable left coprime factorization of G in the form -1 G = R * Q, where G, Q and R are the corresponding transfer-function matrices and the denominator R is co-inner, that is, R(s)*R'(-s) = I in the continuous-time case, or R(z)*R'(1/z) = I in the discrete-time case. The Z matrix is not explicitly computed. Note: G must have no observable poles on the imaginary axis for a continuous-time system, or on the unit circle for a discrete-time system. If the given state-space representation is not detectable, the undetectable part of the original system is automatically deflated and the order of the systems Q and R is accordingly reduced.Specification
SUBROUTINE SB08CD( DICO, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ NQ, NR, BR, LDBR, DR, LDDR, TOL, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO INTEGER INFO, IWARN, LDA, LDB, LDBR, LDC, LDD, LDDR, $ LDWORK, M, N, NQ, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), BR(LDBR,*), C(LDC,*), $ D(LDD,*), DR(LDDR,*), DWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system.Input/Output Parameters
N (input) INTEGER The dimension of the state vector, i.e. the order of the matrix A, and also the number of rows of the matrices B and BR, and the number of columns of the matrix C. N >= 0. M (input) INTEGER The dimension of input vector, i.e. the number of columns of the matrices B and D. M >= 0. P (input) INTEGER The dimension of output vector, i.e. the number of rows of the matrices C, D and DR, and the number of columns of the matrices BR and DR. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. The matrix A must not have observable eigenvalues on the imaginary axis, if DICO = 'C', or on the unit circle, if DICO = 'D'. On exit, the leading NQ-by-NQ part of this array contains the leading NQ-by-NQ part of the matrix Z'*(A+H*C)*Z, the state dynamics matrix of the numerator factor Q, in a real Schur form. The leading NR-by-NR part of this matrix represents the state dynamics matrix of a minimal realization of the denominator factor R. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) On entry, the leading N-by-M part of this array must contain the input/state matrix. On exit, the leading NQ-by-M part of this array contains the leading NQ-by-M part of the matrix Z'*(B+H*D), the input/state matrix of the numerator factor Q. The remaining part of this array is needed as workspace. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-NQ part of this array contains the leading P-by-NQ part of the matrix V*C*Z, the state/output matrix of the numerator factor Q. The first NR columns of this array represent the state/output matrix of a minimal realization of the denominator factor R. The remaining part of this array is needed as workspace. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P), if N > 0. LDC >= 1, if N = 0. D (input/output) DOUBLE PRECISION array, dimension (LDD,MAX(M,P)) On entry, the leading P-by-M part of this array must contain the input/output matrix. On exit, the leading P-by-M part of this array contains the matrix V*D representing the input/output matrix of the numerator factor Q. The remaining part of this array is needed as workspace. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,M,P). NQ (output) INTEGER The order of the resulting factors Q and R. Generally, NQ = N - NS, where NS is the number of unobservable eigenvalues outside the stability region. NR (output) INTEGER The order of the minimal realization of the factor R. Generally, NR is the number of observable eigenvalues of A outside the stability region (the number of modified eigenvalues). BR (output) DOUBLE PRECISION array, dimension (LDBR,P) The leading NQ-by-P part of this array contains the leading NQ-by-P part of the output injection matrix Z'*H, which reflects the eigenvalues of A lying outside the stable region to values which are symmetric with respect to the imaginary axis (if DICO = 'C') or the unit circle (if DICO = 'D'). The first NR rows of this matrix form the input/state matrix of a minimal realization of the denominator factor R. LDBR INTEGER The leading dimension of array BR. LDBR >= MAX(1,N). DR (output) DOUBLE PRECISION array, dimension (LDDR,P) The leading P-by-P part of this array contains the lower triangular matrix V representing the input/output matrix of the denominator factor R. LDDR INTEGER The leading dimension of array DR. LDDR >= MAX(1,P).Tolerances
TOL DOUBLE PRECISION The absolute tolerance level below which the elements of C are considered zero (used for observability tests). If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS*NORM(C), is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH) and NORM(C) denotes the infinity-norm of C.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LDWORK >= MAX( 1, P*N + MAX( N*(N+5),P*(P+2),4*P,4*M ) ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = K: K violations of the numerical stability condition NORM(H) <= 10*NORM(A)/NORM(C) occured during the assignment of eigenvalues.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to a real Schur form failed; = 2: a failure was detected during the ordering of the real Schur form of A, or in the iterative process for reordering the eigenvalues of Z'*(A + H*C)*Z along the diagonal; = 3: if DICO = 'C' and the matrix A has an observable eigenvalue on the imaginary axis, or DICO = 'D' and A has an observable eigenvalue on the unit circle.Method
The subroutine uses the right coprime factorization algorithm with inner denominator of [1] applied to G'.References
[1] Varga A. A Schur method for computing coprime factorizations with inner denominators and applications in model reduction. Proc. ACC'93, San Francisco, CA, pp. 2130-2131, 1993.Numerical Aspects
3 The algorithm requires no more than 14N floating point operations.Further Comments
NoneExample
Program Text
* SB08CD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MPMAX PARAMETER ( MPMAX = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDBR, LDC, LDD, LDDR PARAMETER ( LDA = NMAX, LDB = NMAX, LDBR = NMAX, $ LDC = MPMAX, LDD = MPMAX, LDDR = PMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*PMAX + MAX( NMAX*( NMAX + 5 ), $ PMAX*( PMAX + 2 ), 4*PMAX, 4*MMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, IWARN, J, M, N, NQ, NR, P CHARACTER*1 DICO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MPMAX), BR(LDBR,PMAX), $ C(LDC,NMAX), D(LDD,MPMAX), DR(LDDR,PMAX), $ DWORK(LDWORK) * .. External Subroutines .. EXTERNAL SB08CD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, DICO IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1, N ), I = 1, N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1, M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1, N ), I = 1, P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1, M ), I = 1, P ) * Find a RCFID for (A,B,C,D). CALL SB08CD( DICO, N, M, P, A, LDA, B, LDB, C, LDC, $ D, LDD, NQ, NR, BR, LDBR, DR, LDDR, TOL, $ DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NQ WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1, NQ ) 20 CONTINUE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NQ WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M ) 40 CONTINUE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1, NQ ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1, M ) 70 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99986 ) DO 80 I = 1, NR WRITE ( NOUT, FMT = 99995 ) $ ( A(I,J), J = 1, NR ) 80 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99985 ) DO 90 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( BR(I,J), J = 1, P ) 90 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99984 ) DO 100 I = 1, P WRITE ( NOUT, FMT = 99995 ) $ ( C(I,J), J = 1, NR ) 100 CONTINUE WRITE ( NOUT, FMT = 99983 ) DO 110 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( DR(I,J), J = 1, P ) 110 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SB08CD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB08CD = ',I2) 99996 FORMAT (/' The numerator state dynamics matrix AQ is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The numerator input/state matrix BQ is ') 99992 FORMAT (/' The numerator state/output matrix CQ is ') 99991 FORMAT (/' The numerator input/output matrix DQ is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99986 FORMAT (/' The denominator state dynamics matrix AR is ') 99985 FORMAT (/' The denominator input/state matrix BR is ') 99984 FORMAT (/' The denominator state/output matrix CR is ') 99983 FORMAT (/' The denominator input/output matrix DR is ') ENDProgram Data
SB08CD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 1.E-10 C -0.04165 0.0000 4.9200 0.4920 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 0.0545 0.0000 0.0000 0.0000 0.0000 0.0000 -0.49200 0.004165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 0.5210 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
SB08CD EXAMPLE PROGRAM RESULTS The numerator state dynamics matrix AQ is -0.1605 0.0523 0.9423 2.0193 0.4166 0.2518 1.6140 -0.4489 -0.1605 1.7955 3.8719 -0.2394 0.0491 -0.8740 0.0000 0.0000 -12.4245 3.5463 -0.0057 0.0254 -0.0053 0.0000 0.0000 0.0000 -3.5957 -0.0153 -0.0290 -0.0616 0.0000 0.0000 0.0000 0.0000 -13.1627 -1.9835 -3.6182 0.0000 0.0000 0.0000 0.0000 0.0000 -1.4178 5.6218 0.0000 0.0000 0.0000 0.0000 0.0000 -0.8374 -1.4178 The numerator input/state matrix BQ is -1.0157 0.2554 0.5523 0.4443 0.0056 -11.6989 0.0490 4.3728 11.7198 -0.0038 -2.8173 0.0308 3.1018 -0.0009 The numerator state/output matrix CQ is 0.1975 -0.1063 -0.0006 -0.0083 0.1279 0.8797 0.3994 0.8541 -0.4513 -0.0007 -0.0041 0.0305 -0.2562 0.0122 0.4668 0.8826 0.0248 -0.0506 0.0000 0.0022 -0.0017 The numerator input/output matrix DQ is 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The denominator state dynamics matrix AR is -0.1605 0.0523 -0.4489 -0.1605 The denominator input/state matrix BR is -0.0158 -0.0692 -0.1688 0.0306 0.1281 -0.4984 The denominator state/output matrix CR is 0.1975 -0.1063 0.8541 -0.4513 0.4668 0.8826 The denominator input/output matrix DR is 1.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB08DD.html 0000664 0000000 0000000 00000037627 14560147231 0020355 0 ustar 00root root 0000000 0000000
Purpose
To construct, for a given system G = (A,B,C,D), a feedback matrix F, an orthogonal transformation matrix Z, and a gain matrix V, such that the systems Q = (Z'*(A+B*F)*Z, Z'*B*V, (C+D*F)*Z, D*V) and R = (Z'*(A+B*F)*Z, Z'*B*V, F*Z, V) provide a stable right coprime factorization of G in the form -1 G = Q * R , where G, Q and R are the corresponding transfer-function matrices and the denominator R is inner, that is, R'(-s)*R(s) = I in the continuous-time case, or R'(1/z)*R(z) = I in the discrete-time case. The Z matrix is not explicitly computed. Note: G must have no controllable poles on the imaginary axis for a continuous-time system, or on the unit circle for a discrete-time system. If the given state-space representation is not stabilizable, the unstabilizable part of the original system is automatically deflated and the order of the systems Q and R is accordingly reduced.Specification
SUBROUTINE SB08DD( DICO, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ NQ, NR, CR, LDCR, DR, LDDR, TOL, DWORK, LDWORK, $ IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO INTEGER INFO, IWARN, LDA, LDB, LDC, LDCR, LDD, LDDR, $ LDWORK, M, N, NQ, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), CR(LDCR,*), $ D(LDD,*), DR(LDDR,*), DWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system.Input/Output Parameters
N (input) INTEGER The dimension of the state vector, i.e. the order of the matrix A, and also the number of rows of the matrix B and the number of columns of the matrices C and CR. N >= 0. M (input) INTEGER The dimension of input vector, i.e. the number of columns of the matrices B, D and DR and the number of rows of the matrices CR and DR. M >= 0. P (input) INTEGER The dimension of output vector, i.e. the number of rows of the matrices C and D. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. The matrix A must not have controllable eigenvalues on the imaginary axis, if DICO = 'C', or on the unit circle, if DICO = 'D'. On exit, the leading NQ-by-NQ part of this array contains the leading NQ-by-NQ part of the matrix Z'*(A+B*F)*Z, the state dynamics matrix of the numerator factor Q, in a real Schur form. The trailing NR-by-NR part of this matrix represents the state dynamics matrix of a minimal realization of the denominator factor R. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix. On exit, the leading NQ-by-M part of this array contains the leading NQ-by-M part of the matrix Z'*B*V, the input/state matrix of the numerator factor Q. The last NR rows of this matrix form the input/state matrix of a minimal realization of the denominator factor R. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-NQ part of this array contains the leading P-by-NQ part of the matrix (C+D*F)*Z, the state/output matrix of the numerator factor Q. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the input/output matrix. On exit, the leading P-by-M part of this array contains the matrix D*V representing the input/output matrix of the numerator factor Q. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NQ (output) INTEGER The order of the resulting factors Q and R. Generally, NQ = N - NS, where NS is the number of uncontrollable eigenvalues outside the stability region. NR (output) INTEGER The order of the minimal realization of the factor R. Generally, NR is the number of controllable eigenvalues of A outside the stability region (the number of modified eigenvalues). CR (output) DOUBLE PRECISION array, dimension (LDCR,N) The leading M-by-NQ part of this array contains the leading M-by-NQ part of the feedback matrix F*Z, which reflects the eigenvalues of A lying outside the stable region to values which are symmetric with respect to the imaginary axis (if DICO = 'C') or the unit circle (if DICO = 'D'). The last NR columns of this matrix form the state/output matrix of a minimal realization of the denominator factor R. LDCR INTEGER The leading dimension of array CR. LDCR >= MAX(1,M). DR (output) DOUBLE PRECISION array, dimension (LDDR,M) The leading M-by-M part of this array contains the upper triangular matrix V of order M representing the input/output matrix of the denominator factor R. LDDR INTEGER The leading dimension of array DR. LDDR >= MAX(1,M).Tolerances
TOL DOUBLE PRECISION The absolute tolerance level below which the elements of B are considered zero (used for controllability tests). If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS*NORM(B), is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH) and NORM(B) denotes the 1-norm of B.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LDWORK >= MAX( 1, N*(N+5), M*(M+2), 4*M, 4*P ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = K: K violations of the numerical stability condition NORM(F) <= 10*NORM(A)/NORM(B) occured during the assignment of eigenvalues.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to a real Schur form failed; = 2: a failure was detected during the ordering of the real Schur form of A, or in the iterative process for reordering the eigenvalues of Z'*(A + B*F)*Z along the diagonal; = 3: if DICO = 'C' and the matrix A has a controllable eigenvalue on the imaginary axis, or DICO = 'D' and A has a controllable eigenvalue on the unit circle.Method
The subroutine is based on the factorization algorithm of [1].References
[1] Varga A. A Schur method for computing coprime factorizations with inner denominators and applications in model reduction. Proc. ACC'93, San Francisco, CA, pp. 2130-2131, 1993.Numerical Aspects
3 The algorithm requires no more than 14N floating point operations.Further Comments
NoneExample
Program Text
* SB08DD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDCR, LDD, LDDR PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDCR = MMAX, LDD = PMAX, LDDR = MMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX*( NMAX + 5 ), $ MMAX*( MMAX + 2 ), $ 4*NMAX, 4*PMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, IWARN, J, M, N, NQ, NR, P CHARACTER*1 DICO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ CR(LDCR,NMAX), D(LDD,MMAX), DR(LDDR,MMAX), $ DWORK(LDWORK) * .. External Subroutines .. EXTERNAL SB08DD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, DICO IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1, N ), I = 1, N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1, M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1, N ), I = 1, P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1, M ), I = 1, P ) * Find a RCFID for (A,B,C,D). CALL SB08DD( DICO, N, M, P, A, LDA, B, LDB, C, LDC, $ D, LDD, NQ, NR, CR, LDCR, DR, LDDR, TOL, $ DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NQ WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1, NQ ) 20 CONTINUE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NQ WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M ) 40 CONTINUE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1, NQ ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1, M ) 70 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99986 ) DO 80 I = NQ-NR+1, NQ WRITE ( NOUT, FMT = 99995 ) $ ( A(I,J), J = NQ-NR+1, NQ ) 80 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99985 ) DO 90 I = NQ-NR+1, NQ WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M ) 90 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99984 ) DO 100 I = 1, M WRITE ( NOUT, FMT = 99995 ) $ ( CR(I,J), J = NQ-NR+1, NQ ) 100 CONTINUE WRITE ( NOUT, FMT = 99983 ) DO 110 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( DR(I,J), J = 1, M ) 110 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SB08DD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB08DD = ',I2) 99996 FORMAT (/' The numerator state dynamics matrix AQ is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The numerator input/state matrix BQ is ') 99992 FORMAT (/' The numerator state/output matrix CQ is ') 99991 FORMAT (/' The numerator input/output matrix DQ is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99986 FORMAT (/' The denominator state dynamics matrix AR is ') 99985 FORMAT (/' The denominator input/state matrix BR is ') 99984 FORMAT (/' The denominator state/output matrix CR is ') 99983 FORMAT (/' The denominator input/output matrix DR is ') ENDProgram Data
SB08DD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 1.E-10 C -0.04165 0.0000 4.9200 0.4920 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 0.0545 0.0000 0.0000 0.0000 0.0000 0.0000 -0.49200 0.004165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 0.5210 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
SB08DD EXAMPLE PROGRAM RESULTS The numerator state dynamics matrix AQ is -1.4178 -5.1682 3.2450 -0.2173 0.0564 -4.1066 -0.2336 0.9109 -1.4178 -2.1262 0.1231 0.0805 -0.4816 0.2196 0.0000 0.0000 -13.1627 0.0608 -0.0218 3.8320 0.3429 0.0000 0.0000 0.0000 -3.5957 -3.3373 0.0816 -4.1237 0.0000 0.0000 0.0000 0.0000 -12.4245 -0.3133 4.4255 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1605 -0.0772 0.0000 0.0000 0.0000 0.0000 0.0000 0.3040 -0.1605 The numerator input/state matrix BQ is 5.0302 -0.0063 0.7078 -0.0409 -11.3663 0.0051 0.1760 0.5879 -0.0265 12.2119 1.1050 0.3215 0.0066 -2.5822 The numerator state/output matrix CQ is -0.8659 0.2787 -0.3432 0.0020 0.0000 0.2325 0.0265 0.0797 -0.3951 0.0976 -0.0292 0.0062 0.8985 0.1406 -0.0165 -0.0645 0.0097 0.8032 -0.1602 0.0874 -0.5630 The numerator input/output matrix DQ is 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The denominator state dynamics matrix AR is -0.1605 -0.0772 0.3040 -0.1605 The denominator input/state matrix BR is 1.1050 0.3215 0.0066 -2.5822 The denominator state/output matrix CR is -0.2288 -0.0259 -0.0070 0.1497 The denominator input/output matrix DR is 1.0000 0.0000 0.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB08ED.html 0000664 0000000 0000000 00000040500 14560147231 0020336 0 ustar 00root root 0000000 0000000
Purpose
To construct, for a given system G = (A,B,C,D), an output injection matrix H and an orthogonal transformation matrix Z, such that the systems Q = (Z'*(A+H*C)*Z, Z'*(B+H*D), C*Z, D) and R = (Z'*(A+H*C)*Z, Z'*H, C*Z, I) provide a stable left coprime factorization of G in the form -1 G = R * Q, where G, Q and R are the corresponding transfer-function matrices. The resulting state dynamics matrix of the systems Q and R has eigenvalues lying inside a given stability domain. The Z matrix is not explicitly computed. Note: If the given state-space representation is not detectable, the undetectable part of the original system is automatically deflated and the order of the systems Q and R is accordingly reduced.Specification
SUBROUTINE SB08ED( DICO, N, M, P, ALPHA, A, LDA, B, LDB, C, LDC, $ D, LDD, NQ, NR, BR, LDBR, DR, LDDR, TOL, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO INTEGER INFO, IWARN, LDA, LDB, LDBR, LDC, LDD, LDDR, $ LDWORK, M, N, NQ, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), ALPHA(*), B(LDB,*), BR(LDBR,*), $ C(LDC,*), D(LDD,*), DR(LDDR,*), DWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system.Input/Output Parameters
N (input) INTEGER The dimension of the state vector, i.e. the order of the matrix A, and also the number of rows of the matrices B and BR, and the number of columns of the matrix C. N >= 0. M (input) INTEGER The dimension of input vector, i.e. the number of columns of the matrices B and D. M >= 0. P (input) INTEGER The dimension of output vector, i.e. the number of rows of the matrices C, D and DR, and the number of columns of the matrices BR and DR. P >= 0. ALPHA (input) DOUBLE PRECISION array, dimension (2) ALPHA(1) contains the desired stability degree to be assigned for the eigenvalues of A+H*C, and ALPHA(2) the stability margin. The eigenvalues outside the ALPHA(2)-stability region will be assigned to have the real parts equal to ALPHA(1) < 0 and unmodified imaginary parts for a continuous-time system (DICO = 'C'), or moduli equal to 0 <= ALPHA(2) < 1 for a discrete-time system (DICO = 'D'). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, the leading NQ-by-NQ part of this array contains the leading NQ-by-NQ part of the matrix Z'*(A+H*C)*Z, the state dynamics matrix of the numerator factor Q, in a real Schur form. The leading NR-by-NR part of this matrix represents the state dynamics matrix of a minimal realization of the denominator factor R. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) On entry, the leading N-by-M part of this array must contain the input/state matrix of the system. On exit, the leading NQ-by-M part of this array contains the leading NQ-by-M part of the matrix Z'*(B+H*D), the input/state matrix of the numerator factor Q. The remaining part of this array is needed as workspace. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix of the system. On exit, the leading P-by-NQ part of this array contains the leading P-by-NQ part of the matrix C*Z, the state/output matrix of the numerator factor Q. The first NR columns of this array represent the state/output matrix of a minimal realization of the denominator factor R. The remaining part of this array is needed as workspace. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P), if N > 0. LDC >= 1, if N = 0. D (input) DOUBLE PRECISION array, dimension (LDD,MAX(M,P)) The leading P-by-M part of this array must contain the input/output matrix. D represents also the input/output matrix of the numerator factor Q. This array is modified internally, but restored on exit. The remaining part of this array is needed as workspace. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,M,P). NQ (output) INTEGER The order of the resulting factors Q and R. Generally, NQ = N - NS, where NS is the number of unobservable eigenvalues outside the stability region. NR (output) INTEGER The order of the minimal realization of the factor R. Generally, NR is the number of observable eigenvalues of A outside the stability region (the number of modified eigenvalues). BR (output) DOUBLE PRECISION array, dimension (LDBR,P) The leading NQ-by-P part of this array contains the leading NQ-by-P part of the output injection matrix Z'*H, which moves the eigenvalues of A lying outside the ALPHA-stable region to values on the ALPHA-stability boundary. The first NR rows of this matrix form the input/state matrix of a minimal realization of the denominator factor R. LDBR INTEGER The leading dimension of array BR. LDBR >= MAX(1,N). DR (output) DOUBLE PRECISION array, dimension (LDDR,P) The leading P-by-P part of this array contains an identity matrix representing the input/output matrix of the denominator factor R. LDDR INTEGER The leading dimension of array DR. LDDR >= MAX(1,P).Tolerances
TOL DOUBLE PRECISION The absolute tolerance level below which the elements of C are considered zero (used for observability tests). If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS*NORM(C), is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH) and NORM(C) denotes the infinity-norm of C.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LDWORK >= MAX( 1, N*P + MAX( N*(N+5), 5*P, 4*M ) ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = K: K violations of the numerical stability condition NORM(H) <= 10*NORM(A)/NORM(C) occured during the assignment of eigenvalues.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to a real Schur form failed; = 2: a failure was detected during the ordering of the real Schur form of A, or in the iterative process for reordering the eigenvalues of Z'*(A + H*C)*Z along the diagonal.Method
The subroutine uses the right coprime factorization algorithm of [1] applied to G'.References
[1] Varga A. Coprime factors model reduction method based on square-root balancing-free techniques. System Analysis, Modelling and Simulation, vol. 11, pp. 303-311, 1993.Numerical Aspects
3 The algorithm requires no more than 14N floating point operations.Further Comments
NoneExample
Program Text
* SB08ED EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MPMAX PARAMETER ( MPMAX = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDBR, LDC, LDD, LDDR PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = MPMAX, $ LDD = MPMAX, LDBR = NMAX, LDDR = PMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*PMAX + MAX( NMAX*( NMAX + 5 ), $ 5*PMAX, 4*MMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, IWARN, J, M, N, NQ, NR, P CHARACTER*1 DICO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALPHA(2), B(LDB,MPMAX), $ BR(LDBR,PMAX), C(LDC,NMAX), D(LDD,MPMAX), $ DR(LDDR,PMAX), DWORK(LDWORK) * .. External Subroutines .. EXTERNAL SB08ED * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, ALPHA(1), TOL, DICO ALPHA(2) = ALPHA(1) IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1, N ), I = 1, N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1, M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1, N ), I = 1, P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1, M ), I = 1, P ) * Find a LCF for (A,B,C,D). CALL SB08ED( DICO, N, M, P, ALPHA, A, LDA, B, LDB, C, $ LDC, D, LDD, NQ, NR, BR, LDBR, DR, LDDR, $ TOL, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NQ WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1, NQ ) 20 CONTINUE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NQ WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M ) 40 CONTINUE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1, NQ ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1, M ) 70 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99986 ) DO 80 I = 1, NR WRITE ( NOUT, FMT = 99995 ) $ ( A(I,J), J = 1, NR ) 80 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99985 ) DO 90 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( BR(I,J), J = 1, P ) 90 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99984 ) DO 100 I = 1, P WRITE ( NOUT, FMT = 99995 ) $ ( C(I,J), J = 1, NR ) 100 CONTINUE WRITE ( NOUT, FMT = 99983 ) DO 110 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( DR(I,J), J = 1, P ) 110 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SB08ED EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB08ED = ',I2) 99996 FORMAT (/' The numerator state dynamics matrix AQ is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The numerator input/state matrix BQ is ') 99992 FORMAT (/' The numerator state/output matrix CQ is ') 99991 FORMAT (/' The numerator input/output matrix DQ is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99986 FORMAT (/' The denominator state dynamics matrix AR is ') 99985 FORMAT (/' The denominator input/state matrix BR is ') 99984 FORMAT (/' The denominator state/output matrix CR is ') 99983 FORMAT (/' The denominator input/output matrix DR is ') ENDProgram Data
SB08ED EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 -1.0 1.E-10 C -0.04165 0.0000 4.9200 0.4920 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 0.0545 0.0000 0.0000 0.0000 0.0000 0.0000 -0.49200 0.004165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 0.5210 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
SB08ED EXAMPLE PROGRAM RESULTS The numerator state dynamics matrix AQ is -1.0000 0.0526 -0.1408 -0.3060 0.4199 0.2408 1.7274 -0.4463 -1.0000 2.0067 4.3895 0.0062 0.1813 0.0895 0.0000 0.0000 -12.4245 3.5463 -0.0057 0.0254 -0.0053 0.0000 0.0000 0.0000 -3.5957 -0.0153 -0.0290 -0.0616 0.0000 0.0000 0.0000 0.0000 -13.1627 -1.9835 -3.6182 0.0000 0.0000 0.0000 0.0000 0.0000 -1.4178 5.6218 0.0000 0.0000 0.0000 0.0000 0.0000 -0.8374 -1.4178 The numerator input/state matrix BQ is -1.1544 -0.0159 -0.0631 0.5122 0.0056 -11.6989 0.0490 4.3728 11.7198 -0.0038 -2.8173 0.0308 3.1018 -0.0009 The numerator state/output matrix CQ is 0.2238 0.0132 -0.0006 -0.0083 0.1279 0.8797 0.3994 0.9639 0.0643 -0.0007 -0.0041 0.0305 -0.2562 0.0122 -0.0660 0.9962 0.0248 -0.0506 0.0000 0.0022 -0.0017 The numerator input/output matrix DQ is 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The denominator state dynamics matrix AR is -1.0000 0.0526 -0.4463 -1.0000 The denominator input/state matrix BR is -0.2623 -1.1297 0.0764 -0.0155 -0.0752 -1.1676 The denominator state/output matrix CR is 0.2238 0.0132 0.9639 0.0643 -0.0660 0.9962 The denominator input/output matrix DR is 1.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB08FD.html 0000664 0000000 0000000 00000037326 14560147231 0020353 0 ustar 00root root 0000000 0000000
Purpose
To construct, for a given system G = (A,B,C,D), a feedback matrix F and an orthogonal transformation matrix Z, such that the systems Q = (Z'*(A+B*F)*Z, Z'*B, (C+D*F)*Z, D) and R = (Z'*(A+B*F)*Z, Z'*B, F*Z, I) provide a stable right coprime factorization of G in the form -1 G = Q * R , where G, Q and R are the corresponding transfer-function matrices. The resulting state dynamics matrix of the systems Q and R has eigenvalues lying inside a given stability domain. The Z matrix is not explicitly computed. Note: If the given state-space representation is not stabilizable, the unstabilizable part of the original system is automatically deflated and the order of the systems Q and R is accordingly reduced.Specification
SUBROUTINE SB08FD( DICO, N, M, P, ALPHA, A, LDA, B, LDB, C, LDC, $ D, LDD, NQ, NR, CR, LDCR, DR, LDDR, TOL, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO INTEGER INFO, IWARN, LDA, LDB, LDC, LDCR, LDD, LDDR, $ LDWORK, M, N, NQ, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), ALPHA(*), B(LDB,*), C(LDC,*), $ CR(LDCR,*), D(LDD,*), DR(LDDR,*), DWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original system as follows: = 'C': continuous-time system; = 'D': discrete-time system.Input/Output Parameters
N (input) INTEGER The dimension of the state vector, i.e. the order of the matrix A, and also the number of rows of the matrix B and the number of columns of the matrices C and CR. N >= 0. M (input) INTEGER The dimension of input vector, i.e. the number of columns of the matrices B, D and DR and the number of rows of the matrices CR and DR. M >= 0. P (input) INTEGER The dimension of output vector, i.e. the number of rows of the matrices C and D. P >= 0. ALPHA (input) DOUBLE PRECISION array, dimension (2) ALPHA(1) contains the desired stability degree to be assigned for the eigenvalues of A+B*F, and ALPHA(2) the stability margin. The eigenvalues outside the ALPHA(2)-stability region will be assigned to have the real parts equal to ALPHA(1) < 0 and unmodified imaginary parts for a continuous-time system (DICO = 'C'), or moduli equal to 0 <= ALPHA(2) < 1 for a discrete-time system (DICO = 'D'). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, the leading NQ-by-NQ part of this array contains the leading NQ-by-NQ part of the matrix Z'*(A+B*F)*Z, the state dynamics matrix of the numerator factor Q, in a real Schur form. The trailing NR-by-NR part of this matrix represents the state dynamics matrix of a minimal realization of the denominator factor R. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix. On exit, the leading NQ-by-M part of this array contains the leading NQ-by-M part of the matrix Z'*B, the input/state matrix of the numerator factor Q. The last NR rows of this matrix form the input/state matrix of a minimal realization of the denominator factor R. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-NQ part of this array contains the leading P-by-NQ part of the matrix (C+D*F)*Z, the state/output matrix of the numerator factor Q. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the input/output matrix. D represents also the input/output matrix of the numerator factor Q. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). NQ (output) INTEGER The order of the resulting factors Q and R. Generally, NQ = N - NS, where NS is the number of uncontrollable eigenvalues outside the stability region. NR (output) INTEGER The order of the minimal realization of the factor R. Generally, NR is the number of controllable eigenvalues of A outside the stability region (the number of modified eigenvalues). CR (output) DOUBLE PRECISION array, dimension (LDCR,N) The leading M-by-NQ part of this array contains the leading M-by-NQ part of the feedback matrix F*Z, which moves the eigenvalues of A lying outside the ALPHA-stable region to values which are on the ALPHA-stability boundary. The last NR columns of this matrix form the state/output matrix of a minimal realization of the denominator factor R. LDCR INTEGER The leading dimension of array CR. LDCR >= MAX(1,M). DR (output) DOUBLE PRECISION array, dimension (LDDR,M) The leading M-by-M part of this array contains an identity matrix representing the input/output matrix of the denominator factor R. LDDR INTEGER The leading dimension of array DR. LDDR >= MAX(1,M).Tolerances
TOL DOUBLE PRECISION The absolute tolerance level below which the elements of B are considered zero (used for controllability tests). If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS*NORM(B), is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH) and NORM(B) denotes the 1-norm of B.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LWORK >= MAX( 1, N*(N+5), 5*M, 4*P ). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = K: K violations of the numerical stability condition NORM(F) <= 10*NORM(A)/NORM(B) occured during the assignment of eigenvalues.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A to a real Schur form failed; = 2: a failure was detected during the ordering of the real Schur form of A, or in the iterative process for reordering the eigenvalues of Z'*(A + B*F)*Z along the diagonal.Method
The subroutine is based on the factorization algorithm of [1].References
[1] Varga A. Coprime factors model reduction method based on square-root balancing-free techniques. System Analysis, Modelling and Simulation, vol. 11, pp. 303-311, 1993.Numerical Aspects
3 The algorithm requires no more than 14N floating point operations.Further Comments
NoneExample
Program Text
* SB08FD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDCR, LDD, LDDR PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDCR = MMAX, LDD = PMAX, LDDR = MMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX*( NMAX + 5 ), 5*MMAX, $ 4*PMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, IWARN, J, M, N, NQ, NR, P CHARACTER*1 DICO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALPHA(2), B(LDB,MMAX), C(LDC,NMAX), $ CR(LDCR,NMAX), D(LDD,MMAX), DR(LDDR,MMAX), $ DWORK(LDWORK) * .. External Subroutines .. EXTERNAL SB08FD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, ALPHA(1), TOL, DICO ALPHA(2) = ALPHA(1) IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1, N ), I = 1, N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1, M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1, N ), I = 1, P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1, M ), I = 1, P ) * Find a RCF for (A,B,C,D). CALL SB08FD( DICO, N, M, P, ALPHA, A, LDA, B, LDB, C, $ LDC, D, LDD, NQ, NR, CR, LDCR, DR, LDDR, $ TOL, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NQ WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1, NQ ) 20 CONTINUE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NQ WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M ) 40 CONTINUE IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1, NQ ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1, M ) 70 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99986 ) DO 80 I = NQ-NR+1, NQ WRITE ( NOUT, FMT = 99995 ) $ ( A(I,J), J = NQ-NR+1, NQ ) 80 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99985 ) DO 90 I = NQ-NR+1, NQ WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M ) 90 CONTINUE IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99984 ) DO 100 I = 1, M WRITE ( NOUT, FMT = 99995 ) $ ( CR(I,J), J = NQ-NR+1, NQ ) 100 CONTINUE WRITE ( NOUT, FMT = 99983 ) DO 110 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( DR(I,J), J = 1, M ) 110 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SB08FD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB08FD = ',I2) 99996 FORMAT (/' The numerator state dynamics matrix AQ is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The numerator input/state matrix BQ is ') 99992 FORMAT (/' The numerator state/output matrix CQ is ') 99991 FORMAT (/' The numerator input/output matrix DQ is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99986 FORMAT (/' The denominator state dynamics matrix AR is ') 99985 FORMAT (/' The denominator input/state matrix BR is ') 99984 FORMAT (/' The denominator state/output matrix CR is ') 99983 FORMAT (/' The denominator input/output matrix DR is ') ENDProgram Data
SB08FD EXAMPLE PROGRAM DATA (Continuous system) 7 2 3 -1.0 1.E-10 C -0.04165 0.0000 4.9200 0.4920 0.0000 0.0000 0.0000 -5.2100 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 0.0000 0.0000 0.5450 0.0000 0.0000 0.0000 0.0545 0.0000 0.0000 0.0000 0.0000 0.0000 -0.49200 0.004165 0.0000 4.9200 0.0000 0.0000 0.0000 0.0000 0.5210 -12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.3300 -3.3300 0.0000 0.0000 12.500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 12.500 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000Program Results
SB08FD EXAMPLE PROGRAM RESULTS The numerator state dynamics matrix AQ is -1.4178 -5.1682 3.2450 -0.2173 0.0564 -3.2129 -3.6183 0.9109 -1.4178 -2.1262 0.1231 0.0805 -0.4392 -0.2528 0.0000 0.0000 -13.1627 0.0608 -0.0218 2.3461 5.8272 0.0000 0.0000 0.0000 -3.5957 -3.3373 1.3622 -3.6083 0.0000 0.0000 0.0000 0.0000 -12.4245 -9.8634 8.1191 0.0000 0.0000 0.0000 0.0000 0.0000 -1.0000 -0.0135 0.0000 0.0000 0.0000 0.0000 0.0000 1.7393 -1.0000 The numerator input/state matrix BQ is 5.0302 -0.0063 0.7078 -0.0409 -11.3663 0.0051 0.1760 0.5879 -0.0265 12.2119 1.0104 1.3262 0.4474 -2.2388 The numerator state/output matrix CQ is -0.8659 0.2787 -0.3432 0.0020 0.0000 0.2026 0.1172 0.0797 -0.3951 0.0976 -0.0292 0.0062 0.7676 0.4879 -0.0165 -0.0645 0.0097 0.8032 -0.1602 0.3050 -0.4812 The numerator input/output matrix DQ is 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The denominator state dynamics matrix AR is -1.0000 -0.0135 1.7393 -1.0000 The denominator input/state matrix BR is 1.0104 1.3262 0.4474 -2.2388 The denominator state/output matrix CR is -0.1091 -0.4653 -0.7055 0.4766 The denominator input/output matrix DR is 1.0000 0.0000 0.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB08GD.html 0000664 0000000 0000000 00000013377 14560147231 0020354 0 ustar 00root root 0000000 0000000
Purpose
To construct the state-space representation for the system G = (A,B,C,D) from the factors Q = (AQR,BQ,CQR,DQ) and R = (AQR,BR,CQR,DR) of its left coprime factorization -1 G = R * Q, where G, Q and R are the corresponding transfer-function matrices.Specification
SUBROUTINE SB08GD( N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, BR, $ LDBR, DR, LDDR, IWORK, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDBR, LDC, LDD, LDDR, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), BR(LDBR,*), C(LDC,*), $ D(LDD,*), DR(LDDR,*), DWORK(*) INTEGER IWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. Also the number of rows of the matrices B and BR and the number of columns of the matrix C. N represents the order of the systems Q and R. N >= 0. M (input) INTEGER The dimension of input vector, i.e. the number of columns of the matrices B and D. M >= 0. P (input) INTEGER The dimension of output vector, i.e. the number of rows of the matrices C, D and DR and the number of columns of the matrices BR and DR. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix AQR of the systems Q and R. On exit, the leading N-by-N part of this array contains the state dynamics matrix of the system G. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix BQ of the system Q. On exit, the leading N-by-M part of this array contains the input/state matrix of the system G. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix CQR of the systems Q and R. On exit, the leading P-by-N part of this array contains the state/output matrix of the system G. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the input/output matrix DQ of the system Q. On exit, the leading P-by-M part of this array contains the input/output matrix of the system G. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). BR (input) DOUBLE PRECISION array, dimension (LDBR,P) The leading N-by-P part of this array must contain the input/state matrix BR of the system R. LDBR INTEGER The leading dimension of array BR. LDBR >= MAX(1,N). DR (input/output) DOUBLE PRECISION array, dimension (LDDR,P) On entry, the leading P-by-P part of this array must contain the input/output matrix DR of the system R. On exit, the leading P-by-P part of this array contains the LU factorization of the matrix DR, as computed by LAPACK Library routine DGETRF. LDDR INTEGER The leading dimension of array DR. LDDR >= MAX(1,P).Workspace
IWORK INTEGER array, dimension (P) DWORK DOUBLE PRECISION array, dimension (MAX(1,4*P)) On exit, DWORK(1) contains an estimate of the reciprocal condition number of the matrix DR.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the matrix DR is singular; = 2: the matrix DR is numerically singular (warning); the calculations continued.Method
The subroutine computes the matrices of the state-space representation G = (A,B,C,D) by using the formulas: -1 -1 A = AQR - BR * DR * CQR, C = DR * CQR, -1 -1 B = BQ - BR * DR * DQ, D = DR * DQ.References
[1] Varga A. Coprime factors model reduction method based on square-root balancing-free techniques. System Analysis, Modelling and Simulation, vol. 11, pp. 303-311, 1993.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB08HD.html 0000664 0000000 0000000 00000013420 14560147231 0020342 0 ustar 00root root 0000000 0000000
Purpose
To construct the state-space representation for the system G = (A,B,C,D) from the factors Q = (AQR,BQR,CQ,DQ) and R = (AQR,BQR,CR,DR) of its right coprime factorization -1 G = Q * R , where G, Q and R are the corresponding transfer-function matrices.Specification
SUBROUTINE SB08HD( N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, CR, $ LDCR, DR, LDDR, IWORK, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDCR, LDD, LDDR, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), CR(LDCR,*), $ D(LDD,*), DR(LDDR,*), DWORK(*) INTEGER IWORK(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. Also the number of rows of the matrix B and the number of columns of the matrices C and CR. N represents the order of the systems Q and R. N >= 0. M (input) INTEGER The dimension of input vector. Also the number of columns of the matrices B, D and DR and the number of rows of the matrices CR and DR. M >= 0. P (input) INTEGER The dimension of output vector. Also the number of rows of the matrices C and D. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix AQR of the systems Q and R. On exit, the leading N-by-N part of this array contains the state dynamics matrix of the system G. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix BQR of the systems Q and R. On exit, the leading N-by-M part of this array contains the input/state matrix of the system G. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix CQ of the system Q. On exit, the leading P-by-N part of this array contains the state/output matrix of the system G. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the input/output matrix DQ of the system Q. On exit, the leading P-by-M part of this array contains the input/output matrix of the system G. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). CR (input) DOUBLE PRECISION array, dimension (LDCR,N) The leading M-by-N part of this array must contain the state/output matrix CR of the system R. LDCR INTEGER The leading dimension of array CR. LDCR >= MAX(1,M). DR (input/output) DOUBLE PRECISION array, dimension (LDDR,M) On entry, the leading M-by-M part of this array must contain the input/output matrix DR of the system R. On exit, the leading M-by-M part of this array contains the LU factorization of the matrix DR, as computed by LAPACK Library routine DGETRF. LDDR INTEGER The leading dimension of array DR. LDDR >= MAX(1,M).Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (MAX(1,4*M)) On exit, DWORK(1) contains an estimate of the reciprocal condition number of the matrix DR.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the matrix DR is singular; = 2: the matrix DR is numerically singular (warning); the calculations continued.Method
The subroutine computes the matrices of the state-space representation G = (A,B,C,D) by using the formulas: -1 -1 A = AQR - BQR * DR * CR, B = BQR * DR , -1 -1 C = CQ - DQ * DR * CR, D = DQ * DR .References
[1] Varga A. Coprime factors model reduction method based on square-root balancing-free techniques. System Analysis, Modelling and Simulation, vol. 11, pp. 303-311, 1993.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB08MD.html 0000664 0000000 0000000 00000023014 14560147231 0020347 0 ustar 00root root 0000000 0000000
Purpose
To compute a real polynomial E(s) such that (a) E(-s) * E(s) = A(-s) * A(s) and (b) E(s) is stable - that is, all the zeros of E(s) have non-positive real parts, which corresponds to computing the spectral factorization of the real polynomial A(s) arising from continuous optimality problems. The input polynomial may be supplied either in the form A(s) = a(0) + a(1) * s + ... + a(DA) * s**DA or as B(s) = A(-s) * A(s) = b(0) + b(1) * s**2 + ... + b(DA) * s**(2*DA) (1)Specification
SUBROUTINE SB08MD( ACONA, DA, A, RES, E, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER ACONA INTEGER DA, INFO, LDWORK DOUBLE PRECISION RES C .. Array Arguments .. DOUBLE PRECISION A(*), DWORK(*), E(*)Arguments
Mode Parameters
ACONA CHARACTER*1 Indicates whether the coefficients of A(s) or B(s) = A(-s) * A(s) are to be supplied as follows: = 'A': The coefficients of A(s) are to be supplied; = 'B': The coefficients of B(s) are to be supplied.Input/Output Parameters
DA (input) INTEGER The degree of the polynomials A(s) and E(s). DA >= 0. A (input/output) DOUBLE PRECISION array, dimension (DA+1) On entry, this array must contain either the coefficients of the polynomial A(s) in increasing powers of s if ACONA = 'A', or the coefficients of the polynomial B(s) in increasing powers of s**2 (see equation (1)) if ACONA = 'B'. On exit, this array contains the coefficients of the polynomial B(s) in increasing powers of s**2. RES (output) DOUBLE PRECISION An estimate of the accuracy with which the coefficients of the polynomial E(s) have been computed (see also METHOD and NUMERICAL ASPECTS). E (output) DOUBLE PRECISION array, dimension (DA+1) The coefficients of the spectral factor E(s) in increasing powers of s.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= 5*DA+5.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if on entry, A(I) = 0.0, for I = 1,2,...,DA+1. = 2: if on entry, ACONA = 'B' but the supplied coefficients of the polynomial B(s) are not the coefficients of A(-s) * A(s) for some real A(s); in this case, RES and E are unassigned; = 3: if the iterative process (see METHOD) has failed to converge in 30 iterations; = 4: if the last computed iterate (see METHOD) is unstable. If ACONA = 'B', then the supplied coefficients of the polynomial B(s) may not be the coefficients of A(-s) * A(s) for some real A(s).Method
_ _ Let A(s) be the conjugate polynomial of A(s), i.e., A(s) = A(-s). The method used by the routine is based on applying the Newton-Raphson iteration to the function _ _ F(e) = A * A - e * e, which leads to the iteration formulae (see [1]): _(i) (i) _(i) (i) _ ) q * x + x * q = 2 A * A ) ) for i = 0, 1, 2,... (i+1) (i) (i) ) q = (q + x )/2 ) (0) DA Starting from q = (1 + s) (which has no zeros in the closed (1) (2) (3) right half-plane), the sequence of iterates q , q , q ,... converges to a solution of F(e) = 0 which has no zeros in the open right half-plane. The iterates satisfy the following conditions: (i) (a) q is a stable polynomial (no zeros in the closed right half-plane) and (i) (i-1) (b) q (1) <= q (1). (i-1) (i) The iterative process stops with q , (where i <= 30) if q violates either (a) or (b), or if the condition _(i) (i) _ (c) RES = ||(q q - A A)|| < tol, is satisfied, where || . || denotes the largest coefficient of _(i) (i) _ the polynomial (q q - A A) and tol is an estimate of the _(i) (i) rounding error in the computed coefficients of q q . If there is no convergence after 30 iterations then the routine returns with the Error Indicator (INFO) set to 3, and the value of RES may indicate whether or not the last computed iterate is close to the solution. If ACONA = 'B', then it is possible that the equation e(-s) * e(s) = B(s) has no real solution, which will be the case if A(1) < 0 or if ( -1)**DA * A(DA+1) < 0.References
[1] Vostry, Z. New Algorithm for Polynomial Spectral Factorization with Quadratic Convergence II. Kybernetika, 12, pp. 248-259, 1976.Numerical Aspects
The conditioning of the problem depends upon the distance of the zeros of A(s) from the imaginary axis and on their multiplicity. For a well-conditioned problem the accuracy of the computed coefficients of E(s) is of the order of RES. However, for problems with zeros near the imaginary axis or with multiple zeros, the value of RES may be an overestimate of the true accuracy.Further Comments
In order for the problem e(-s) * e(s) = B(s) to have a real solution e(s), it is necessary and sufficient that B(j*omega) >= 0 for any purely imaginary argument j*omega (see [1]).Example
Program Text
* SB08MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DAMAX PARAMETER ( DAMAX = 10 ) INTEGER LDWORK PARAMETER ( LDWORK = 5*DAMAX+5 ) * .. Local Scalars .. DOUBLE PRECISION RES INTEGER DA, I, INFO CHARACTER*1 ACONA * .. Local Arrays .. DOUBLE PRECISION A(DAMAX+1), DWORK(LDWORK), E(DAMAX+1) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB08MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) READ ( NIN, FMT = '()' ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = * ) DA, ACONA IF ( DA.LE.-1 .OR. DA.GT.DAMAX ) THEN WRITE ( NOUT, FMT = 99993 ) DA ELSE READ ( NIN, FMT = * ) ( A(I), I = 1,DA+1 ) * Compute the spectral factorization of the given polynomial. CALL SB08MD( ACONA, DA, A, RES, E, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( ACONA, 'A' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 20 I = 0, DA WRITE ( NOUT, FMT = 99995 ) 2*I, A(I+1) 20 CONTINUE WRITE ( NOUT, FMT = * ) END IF WRITE ( NOUT, FMT = 99996 ) DO 40 I = 0, DA WRITE ( NOUT, FMT = 99995 ) I, E(I+1) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) RES END IF END IF * STOP * 99999 FORMAT (' SB08MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB08MD = ',I2) 99997 FORMAT (' The coefficients of the polynomial B(s) are ',//' powe', $ 'r of s coefficient ') 99996 FORMAT (' The coefficients of the spectral factor E(s) are ', $ //' power of s coefficient ') 99995 FORMAT (2X,I5,9X,F9.4) 99994 FORMAT (/' RES = ',1P,E8.1) 99993 FORMAT (/' DA is out of range.',/' DA = ',I5) ENDProgram Data
SB08MD EXAMPLE PROGRAM DATA 3 A 8.0 -6.0 -3.0 1.0Program Results
SB08MD EXAMPLE PROGRAM RESULTS The coefficients of the polynomial B(s) are power of s coefficient 0 64.0000 2 -84.0000 4 21.0000 6 -1.0000 The coefficients of the spectral factor E(s) are power of s coefficient 0 8.0000 1 14.0000 2 7.0000 3 1.0000 RES = 2.7E-15
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB08ND.html 0000664 0000000 0000000 00000023051 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To compute a real polynomial E(z) such that (a) E(1/z) * E(z) = A(1/z) * A(z) and (b) E(z) is stable - that is, E(z) has no zeros with modulus greater than 1, which corresponds to computing the spectral factorization of the real polynomial A(z) arising from discrete optimality problems. The input polynomial may be supplied either in the form A(z) = a(0) + a(1) * z + ... + a(DA) * z**DA or as B(z) = A(1/z) * A(z) = b(0) + b(1) * (z + 1/z) + ... + b(DA) * (z**DA + 1/z**DA) (1)Specification
SUBROUTINE SB08ND( ACONA, DA, A, RES, E, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER ACONA INTEGER DA, INFO, LDWORK DOUBLE PRECISION RES C .. Array Arguments .. DOUBLE PRECISION A(*), DWORK(*), E(*)Arguments
Mode Parameters
ACONA CHARACTER*1 Indicates whether the coefficients of A(z) or B(z) = A(1/z) * A(z) are to be supplied as follows: = 'A': The coefficients of A(z) are to be supplied; = 'B': The coefficients of B(z) are to be supplied.Input/Output Parameters
DA (input) INTEGER The degree of the polynomials A(z) and E(z). DA >= 0. A (input/output) DOUBLE PRECISION array, dimension (DA+1) On entry, if ACONA = 'A', this array must contain the coefficients of the polynomial A(z) in increasing powers of z, and if ACONA = 'B', this array must contain the coefficients b ,b ,...,b of the polynomial B(z) in 0 1 DA equation (1). That is, A(i) = b for i = 1,2,...,DA+1. i-1 On exit, this array contains the coefficients of the polynomial B(z) in eqation (1). Specifically, A(i) contains b , for i = 1,2,...DA+1. i-1 RES (output) DOUBLE PRECISION An estimate of the accuracy with which the coefficients of the polynomial E(z) have been computed (see also METHOD and NUMERICAL ASPECTS). E (output) DOUBLE PRECISION array, dimension (DA+1) The coefficients of the spectral factor E(z) in increasing powers of z.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= 5*DA+5.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 2: if on entry, ACONA = 'B' but the supplied coefficients of the polynomial B(z) are not the coefficients of A(1/z) * A(z) for some real A(z); in this case, RES and E are unassigned; = 3: if the iterative process (see METHOD) has failed to converge in 30 iterations; = 4: if the last computed iterate (see METHOD) is unstable. If ACONA = 'B', then the supplied coefficients of the polynomial B(z) may not be the coefficients of A(1/z) * A(z) for some real A(z).Method
_ _ Let A(z) be the conjugate polynomial of A(z), i.e., A(z) = A(1/z). The method used by the routine is based on applying the Newton-Raphson iteration to the function _ _ F(e) = A * A - e * e, which leads to the iteration formulae (see [1] and [2]) _(i) (i) _(i) (i) _ ) q * x + x * q = 2 A * A ) ) for i = 0, 1, 2,... (i+1) (i) (i) ) q = (q + x )/2 ) The iteration starts from (0) DA q (z) = (b(0) + b(1) * z + ... + b(DA) * z ) / SQRT( b(0)) which is a Hurwitz polynomial that has no zeros in the closed unit (i) circle (see [2], Theorem 3). Then lim q = e, the convergence is uniform and e is a Hurwitz polynomial. The iterates satisfy the following conditions: (i) (a) q has no zeros in the closed unit circle, (i) (i-1) (b) q <= q and 0 0 DA (i) 2 DA 2 (c) SUM (q ) - SUM (A ) >= 0. k=0 k k=0 k (i) The iterative process stops if q violates (a), (b) or (c), or if the condition _(i) (i) _ (d) RES = ||(q q - A A)|| < tol, is satisfied, where || . || denotes the largest coefficient of _(i) (i) _ the polynomial (q q - A A) and tol is an estimate of the _(i) (i) rounding error in the computed coefficients of q q . If (i-1) condition (a) or (b) is violated then q is taken otherwise (i) q is used. Thus the computed reciprocal polynomial E(z) = z**DA * q(1/z) is stable. If there is no convergence after 30 iterations then the routine returns with the Error Indicator (INFO) set to 3, and the value of RES may indicate whether or not the last computed iterate is close to the solution. (0) If ACONA = 'B', then it is possible that q is not a Hurwitz polynomial, in which case the equation e(1/z) * e(z) = B(z) has no real solution (see [2], Theorem 3).References
[1] Kucera, V. Discrete Linear Control, The polynomial Approach. John Wiley & Sons, Chichester, 1979. [2] Vostry, Z. New Algorithm for Polynomial Spectral Factorization with Quadratic Convergence I. Kybernetika, 11, pp. 415-422, 1975.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* SB08ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER DAMAX PARAMETER ( DAMAX = 10 ) INTEGER LDWORK PARAMETER ( LDWORK = 5*DAMAX+5 ) * .. Local Scalars .. DOUBLE PRECISION RES INTEGER DA, I, INFO CHARACTER*1 ACONA * .. Local Arrays .. DOUBLE PRECISION A(DAMAX+1), DWORK(LDWORK), E(DAMAX+1) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SB08ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) READ ( NIN, FMT = '()' ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = * ) DA, ACONA IF ( DA.LE.-1 .OR. DA.GT.DAMAX ) THEN WRITE ( NOUT, FMT = 99993 ) DA ELSE READ ( NIN, FMT = * ) ( A(I), I = 1,DA+1 ) * Compute the spectral factorization of the given polynomial. CALL SB08ND( ACONA, DA, A, RES, E, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( ACONA, 'A' ) ) THEN WRITE ( NOUT, FMT = 99997 ) DO 20 I = 0, DA WRITE ( NOUT, FMT = 99995 ) I, A(I+1) 20 CONTINUE WRITE ( NOUT, FMT = * ) END IF WRITE ( NOUT, FMT = 99996 ) DO 40 I = 0, DA WRITE ( NOUT, FMT = 99995 ) I, E(I+1) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) RES END IF END IF * STOP * 99999 FORMAT (' SB08ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB08ND = ',I2) 99997 FORMAT (' The coefficients of the polynomial B(z) are ',//' powe', $ 'r of z coefficient ') 99996 FORMAT (' The coefficients of the spectral factor E(z) are ', $ //' power of z coefficient ') 99995 FORMAT (2X,I5,9X,F9.4) 99994 FORMAT (/' RES = ',1P,E8.1) 99993 FORMAT (/' DA is out of range.',/' DA = ',I5) ENDProgram Data
SB08ND EXAMPLE PROGRAM DATA 2 A 2.0 4.5 1.0Program Results
SB08ND EXAMPLE PROGRAM RESULTS The coefficients of the polynomial B(z) are power of z coefficient 0 25.2500 1 13.5000 2 2.0000 The coefficients of the spectral factor E(z) are power of z coefficient 0 0.5000 1 3.0000 2 4.0000 RES = 4.4E-16
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB09MD.html 0000664 0000000 0000000 00000020422 14560147231 0020350 0 ustar 00root root 0000000 0000000
Purpose
To compare two multivariable sequences M1(k) and M2(k) for k = 1,2,...,N, and evaluate their closeness. Each of the parameters M1(k) and M2(k) is an NC by NB matrix.Specification
SUBROUTINE SB09MD( N, NC, NB, H1, LDH1, H2, LDH2, SS, LDSS, SE, $ LDSE, PRE, LDPRE, TOL, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDH1, LDH2, LDPRE, LDSE, LDSS, N, NB, NC DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION H1(LDH1,*), H2(LDH2,*), PRE(LDPRE,*), $ SE(LDSE,*), SS(LDSS,*)Arguments
Input/Output Parameters
N (input) INTEGER The number of parameters. N >= 0. NC (input) INTEGER The number of rows in M1(k) and M2(k). NC >= 0. NB (input) INTEGER The number of columns in M1(k) and M2(k). NB >= 0. H1 (input) DOUBLE PRECISION array, dimension (LDH1,N*NB) The leading NC-by-N*NB part of this array must contain the multivariable sequence M1(k), where k = 1,2,...,N. Each parameter M1(k) is an NC-by-NB matrix, whose (i,j)-th element must be stored in H1(i,(k-1)*NB+j) for i = 1,2,...,NC and j = 1,2,...,NB. LDH1 INTEGER The leading dimension of array H1. LDH1 >= MAX(1,NC). H2 (input) DOUBLE PRECISION array, dimension (LDH2,N*NB) The leading NC-by-N*NB part of this array must contain the multivariable sequence M2(k), where k = 1,2,...,N. Each parameter M2(k) is an NC-by-NB matrix, whose (i,j)-th element must be stored in H2(i,(k-1)*NB+j) for i = 1,2,...,NC and j = 1,2,...,NB. LDH2 INTEGER The leading dimension of array H2. LDH2 >= MAX(1,NC). SS (output) DOUBLE PRECISION array, dimension (LDSS,NB) The leading NC-by-NB part of this array contains the matrix SS. LDSS INTEGER The leading dimension of array SS. LDSS >= MAX(1,NC). SE (output) DOUBLE PRECISION array, dimension (LDSE,NB) The leading NC-by-NB part of this array contains the quadratic error matrix SE. LDSE INTEGER The leading dimension of array SE. LDSE >= MAX(1,NC). PRE (output) DOUBLE PRECISION array, dimension (LDPRE,NB) The leading NC-by-NB part of this array contains the percentage relative error matrix PRE. LDPRE INTEGER The leading dimension of array PRE. LDPRE >= MAX(1,NC).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in the computation of the error matrices SE and PRE. If the user sets TOL to be less than EPS then the tolerance is taken as EPS, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The (i,j)-th element of the matrix SS is defined by: N 2 SS = SUM M1 (k) . (1) ij k=1 ij The (i,j)-th element of the quadratic error matrix SE is defined by: N 2 SE = SUM (M1 (k) - M2 (k)) . (2) ij k=1 ij ij The (i,j)-th element of the percentage relative error matrix PRE is defined by: PRE = 100 x SQRT( SE / SS ). (3) ij ij ij The following precautions are taken by the routine to guard against underflow and overflow: (i) if ABS( M1 (k) ) > 1/TOL or ABS( M1 (k) - M2 (k) ) > 1/TOL, ij ij ij then SE and SS are set to 1/TOL and PRE is set to 1; and ij ij ij (ii) if ABS( SS ) <= TOL, then PRE is set to 100. ij ijNumerical Aspects
The algorithm requires approximately 2xNBxNCx(N+1) multiplications/divisions, 4xNBxNCxN additions/subtractions and NBxNC square roots.Further Comments
NoneExample
Program Text
* SB09MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, NCMAX, NBMAX PARAMETER ( NMAX = 20, NCMAX = 20, NBMAX = 20 ) INTEGER LDH1, LDH2, LDSS, LDSE, LDPRE PARAMETER ( LDH1 = NCMAX, LDH2 = NCMAX, LDSS = NCMAX, $ LDSE = NCMAX, LDPRE = NCMAX ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, N, NB, NC * .. Local Arrays .. DOUBLE PRECISION H1(LDH1,NMAX*NBMAX), H2(LDH2,NMAX*NBMAX), $ PRE(LDPRE,NBMAX), SE(LDSE,NBMAX), SS(LDSS,NBMAX) * .. External Subroutines .. EXTERNAL SB09MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, NC, NB, TOL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE IF ( NB.LT.0 .OR. NB.GT.NBMAX ) THEN WRITE ( NOUT, FMT = 99992 ) NB ELSE IF ( NC.LT.0 .OR. NC.GT.NCMAX ) THEN WRITE ( NOUT, FMT = 99991 ) NC ELSE READ ( NIN, FMT = * ) ( ( H1(I,J), I = 1,NC ), J = 1,N*NB ) READ ( NIN, FMT = * ) ( ( H2(I,J), I = 1,NC ), J = 1,N*NB ) * Compare the given sequences and evaluate their closeness. CALL SB09MD( N, NC, NB, H1, LDH1, H2, LDH2, SS, LDSS, SE, LDSE, $ PRE, LDPRE, TOL, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, NC WRITE ( NOUT, FMT = 99996 ) ( SS(I,J), J = 1,NB ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 40 I = 1, NC WRITE ( NOUT, FMT = 99996 ) ( SE(I,J), J = 1,NB ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, NC WRITE ( NOUT, FMT = 99996 ) ( PRE(I,J), J = 1,NB ) 60 CONTINUE END IF END IF STOP * 99999 FORMAT (' SB09MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB09MD = ',I2) 99997 FORMAT (' The sum-of-squares matrix SS is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The quadratic error matrix SE is ') 99994 FORMAT (/' The percentage relative error matrix PRE is ') 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' NB is out of range.',/' NB = ',I5) 99991 FORMAT (/' NC is out of range.',/' NC = ',I5) ENDProgram Data
SB09MD EXAMPLE PROGRAM DATA 2 2 2 0.0 1.3373 0.1205 0.6618 -0.3372 -0.4062 1.6120 0.9299 0.7429 1.1480 -0.1837 0.8843 -0.4947 -0.4616 1.4674 0.6028 0.9524Program Results
SB09MD EXAMPLE PROGRAM RESULTS The sum-of-squares matrix SS is 1.9534 1.3027 2.6131 0.6656 The quadratic error matrix SE is 0.0389 0.1565 0.1134 0.0687 The percentage relative error matrix PRE is 14.1125 34.6607 20.8363 32.1262
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10AD.html 0000664 0000000 0000000 00000035373 14560147231 0020337 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrices of an H-infinity optimal n-state controller | AK | BK | K = |----|----|, | CK | DK | using modified Glover's and Doyle's 1988 formulas, for the system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| | C1 | D11 D12 | | C | D | | C2 | D21 D22 | and for the estimated minimal possible value of gamma with respect to GTOL, where B2 has as column size the number of control inputs (NCON) and C2 has as row size the number of measurements (NMEAS) being provided to the controller, and then to compute the matrices of the closed-loop system | AC | BC | G = |----|----|, | CC | DC | if the stabilizing controller exists. It is assumed that (A1) (A,B2) is stabilizable and (C2,A) is detectable, (A2) D12 is full column rank and D21 is full row rank, (A3) | A-j*omega*I B2 | has full column rank for all omega, | C1 D12 | (A4) | A-j*omega*I B1 | has full row rank for all omega. | C2 D21 |Specification
SUBROUTINE SB10AD( JOB, N, M, NP, NCON, NMEAS, GAMMA, A, LDA, $ B, LDB, C, LDC, D, LDD, AK, LDAK, BK, LDBK, CK, $ LDCK, DK, LDDK, AC, LDAC, BC, LDBC, CC, LDCC, $ DC, LDDC, RCOND, GTOL, ACTOL, IWORK, LIWORK, $ DWORK, LDWORK, BWORK, LBWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, JOB, LBWORK, LDA, LDAC, LDAK, LDB, LDBC, $ LDBK, LDC, LDCC, LDCK, LDD, LDDC, LDDK, LDWORK, $ LIWORK, M, N, NCON, NMEAS, NP DOUBLE PRECISION ACTOL, GAMMA, GTOL C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), AC( LDAC, * ), AK( LDAK, * ), $ B( LDB, * ), BC( LDBC, * ), BK( LDBK, * ), $ C( LDC, * ), CC( LDCC, * ), CK( LDCK, * ), $ D( LDD, * ), DC( LDDC, * ), DK( LDDK, * ), $ DWORK( * ), RCOND( 4 )Arguments
Input/Output Parameters
JOB (input) INTEGER Indicates the strategy for reducing the GAMMA value, as follows: = 1: Use bisection method for decreasing GAMMA from GAMMA to GAMMAMIN until the closed-loop system leaves stability. = 2: Scan from GAMMA to 0 trying to find the minimal GAMMA for which the closed-loop system retains stability. = 3: First bisection, then scanning. = 4: Find suboptimal controller only. N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. GAMMA (input/output) DOUBLE PRECISION The initial value of gamma on input. It is assumed that gamma is sufficiently large so that the controller is admissible. GAMMA >= 0. On output it contains the minimal estimated gamma. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NMEAS) The leading N-by-NMEAS part of this array contains the controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading NCON-by-N part of this array contains the controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (output) DOUBLE PRECISION array, dimension (LDDK,NMEAS) The leading NCON-by-NMEAS part of this array contains the controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON). AC (output) DOUBLE PRECISION array, dimension (LDAC,2*N) The leading 2*N-by-2*N part of this array contains the closed-loop system state matrix AC. LDAC INTEGER The leading dimension of the array AC. LDAC >= max(1,2*N). BC (output) DOUBLE PRECISION array, dimension (LDBC,M-NCON) The leading 2*N-by-(M-NCON) part of this array contains the closed-loop system input matrix BC. LDBC INTEGER The leading dimension of the array BC. LDBC >= max(1,2*N). CC (output) DOUBLE PRECISION array, dimension (LDCC,2*N) The leading (NP-NMEAS)-by-2*N part of this array contains the closed-loop system output matrix CC. LDCC INTEGER The leading dimension of the array CC. LDCC >= max(1,NP-NMEAS). DC (output) DOUBLE PRECISION array, dimension (LDDC,M-NCON) The leading (NP-NMEAS)-by-(M-NCON) part of this array contains the closed-loop system input/output matrix DC. LDDC INTEGER The leading dimension of the array DC. LDDC >= max(1,NP-NMEAS). RCOND (output) DOUBLE PRECISION array, dimension (4) For the last successful step: RCOND(1) contains the reciprocal condition number of the control transformation matrix; RCOND(2) contains the reciprocal condition number of the measurement transformation matrix; RCOND(3) contains an estimate of the reciprocal condition number of the X-Riccati equation; RCOND(4) contains an estimate of the reciprocal condition number of the Y-Riccati equation.Tolerances
GTOL DOUBLE PRECISION Tolerance used for controlling the accuracy of GAMMA and its distance to the estimated minimal possible value of GAMMA. If GTOL <= 0, then a default value equal to sqrt(EPS) is used, where EPS is the relative machine precision. ACTOL DOUBLE PRECISION Upper bound for the poles of the closed-loop system used for determining if it is stable. ACTOL <= 0 for stable systems.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER The dimension of the array IWORK. LIWORK >= max(2*max(N,M-NCON,NP-NMEAS,NCON,NMEAS),N*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= LW1 + max(1,LW2,LW3,LW4,LW5 + MAX(LW6,LW7)), where LW1 = N*M + NP*N + NP*M + M2*M2 + NP2*NP2; LW2 = max( ( N + NP1 + 1 )*( N + M2 ) + max( 3*( N + M2 ) + N + NP1, 5*( N + M2 ) ), ( N + NP2 )*( N + M1 + 1 ) + max( 3*( N + NP2 ) + N + M1, 5*( N + NP2 ) ), M2 + NP1*NP1 + max( NP1*max( N, M1 ), 3*M2 + NP1, 5*M2 ), NP2 + M1*M1 + max( max( N, NP1 )*M1, 3*NP2 + M1, 5*NP2 ) ); LW3 = max( ND1*M1 + max( 4*min( ND1, M1 ) + max( ND1,M1 ), 6*min( ND1, M1 ) ), NP1*ND2 + max( 4*min( NP1, ND2 ) + max( NP1,ND2 ), 6*min( NP1, ND2 ) ) ); LW4 = 2*M*M + NP*NP + 2*M*N + M*NP + 2*N*NP; LW5 = 2*N*N + M*N + N*NP; LW6 = max( M*M + max( 2*M1, 3*N*N + max( N*M, 10*N*N + 12*N + 5 ) ), NP*NP + max( 2*NP1, 3*N*N + max( N*NP, 10*N*N + 12*N + 5 ) )); LW7 = M2*NP2 + NP2*NP2 + M2*M2 + max( ND1*ND1 + max( 2*ND1, ( ND1 + ND2 )*NP2 ), ND2*ND2 + max( 2*ND2, ND2*M2 ), 3*N, N*( 2*NP2 + M2 ) + max( 2*N*M2, M2*NP2 + max( M2*M2 + 3*M2, NP2*( 2*NP2 + M2 + max( NP2, N ) ) ) ) ); M1 = M - M2, NP1 = NP - NP2, ND1 = NP1 - M2, ND2 = M1 - NP2. For good performance, LDWORK must generally be larger. BWORK LOGICAL array, dimension (LBWORK) LBWORK INTEGER The dimension of the array BWORK. LBWORK >= 2*N.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix | A-j*omega*I B2 | had not full | C1 D12 | column rank in respect to the tolerance EPS; = 2: if the matrix | A-j*omega*I B1 | had not full row | C2 D21 | rank in respect to the tolerance EPS; = 3: if the matrix D12 had not full column rank in respect to the tolerance SQRT(EPS); = 4: if the matrix D21 had not full row rank in respect to the tolerance SQRT(EPS); = 5: if the singular value decomposition (SVD) algorithm did not converge (when computing the SVD of one of the matrices |A B2 |, |A B1 |, D12 or D21); |C1 D12| |C2 D21| = 6: if the controller is not admissible (too small value of gamma); = 7: if the X-Riccati equation was not solved successfully (the controller is not admissible or there are numerical difficulties); = 8: if the Y-Riccati equation was not solved successfully (the controller is not admissible or there are numerical difficulties); = 9: if the determinant of Im2 + Tu*D11HAT*Ty*D22 is zero [3]; = 10: if there are numerical problems when estimating singular values of D1111, D1112, D1111', D1121'; = 11: if the matrices Inp2 - D22*DK or Im2 - DK*D22 are singular to working precision; = 12: if a stabilizing controller cannot be found.Method
The routine implements the Glover's and Doyle's 1988 formulas [1], [2], modified to improve the efficiency as described in [3]. JOB = 1: It tries with a decreasing value of GAMMA, starting with the given, and with the newly obtained controller estimates of the closed-loop system. If it is stable, (i.e., max(eig(AC)) < ACTOL) the iterations can be continued until the given tolerance between GAMMA and the estimated GAMMAMIN is reached. Otherwise, in the next step GAMMA is increased. The step in the all next iterations is step = step/2. The closed-loop system is obtained by the formulas given in [2]. JOB = 2: The same as for JOB = 1, but with non-varying step till GAMMA = 0, step = max(0.1, GTOL). JOB = 3: Combines the JOB = 1 and JOB = 2 cases for a quicker procedure. JOB = 4: Suboptimal controller for current GAMMA only.References
[1] Glover, K. and Doyle, J.C. State-space formulae for all stabilizing controllers that satisfy an Hinf norm bound and relations to risk sensitivity. Systems and Control Letters, vol. 11, pp. 167-172, 1988. [2] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, MA, 1995. [3] Petkov, P.Hr., Gu, D.W., and Konstantinov, M.M. Fortran 77 routines for Hinf and H2 design of continuous-time linear control systems. Rep. 98-14, Department of Engineering, Leicester University, Leicester, U.K., 1998.Numerical Aspects
The accuracy of the result depends on the condition numbers of the input and output transformations and on the condition numbers of the two Riccati equations, as given by the values of RCOND(1), RCOND(2), RCOND(3) and RCOND(4), respectively. This approach by estimating the closed-loop system and checking its poles seems to be reliable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10DD.html 0000664 0000000 0000000 00000042240 14560147231 0020331 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrices of an H-infinity (sub)optimal n-state controller | AK | BK | K = |----|----|, | CK | DK | for the discrete-time system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| | C1 | D11 D12 | | C | D | | C2 | D21 D22 | and for a given value of gamma, where B2 has as column size the number of control inputs (NCON) and C2 has as row size the number of measurements (NMEAS) being provided to the controller. It is assumed that (A1) (A,B2) is stabilizable and (C2,A) is detectable, (A2) D12 is full column rank and D21 is full row rank, j*Theta (A3) | A-e *I B2 | has full column rank for all | C1 D12 | 0 <= Theta < 2*Pi , j*Theta (A4) | A-e *I B1 | has full row rank for all | C2 D21 | 0 <= Theta < 2*Pi .Specification
SUBROUTINE SB10DD( N, M, NP, NCON, NMEAS, GAMMA, A, LDA, B, LDB, $ C, LDC, D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, $ DK, LDDK, X, LDX, Z, LDZ, RCOND, TOL, IWORK, $ DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, $ LDDK, LDWORK, LDX, LDZ, M, N, NCON, NMEAS, NP DOUBLE PRECISION GAMMA, TOL C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), $ D( LDD, * ), DK( LDDK, * ), DWORK( * ), $ RCOND( * ), X( LDX, * ), Z( LDZ, * ) LOGICAL BWORK( * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. GAMMA (input) DOUBLE PRECISION The value of gamma. It is assumed that gamma is sufficiently large so that the controller is admissible. GAMMA > 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NMEAS) The leading N-by-NMEAS part of this array contains the controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading NCON-by-N part of this array contains the controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (output) DOUBLE PRECISION array, dimension (LDDK,NMEAS) The leading NCON-by-NMEAS part of this array contains the controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON). X (output) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array contains the matrix X, solution of the X-Riccati equation. LDX INTEGER The leading dimension of the array X. LDX >= max(1,N). Z (output) DOUBLE PRECISION array, dimension (LDZ,N) The leading N-by-N part of this array contains the matrix Z, solution of the Z-Riccati equation. LDZ INTEGER The leading dimension of the array Z. LDZ >= max(1,N). RCOND (output) DOUBLE PRECISION array, dimension (8) RCOND contains estimates of the reciprocal condition numbers of the matrices which are to be inverted and estimates of the reciprocal condition numbers of the Riccati equations which have to be solved during the computation of the controller. (See the description of the algorithm in [2].) RCOND(1) contains the reciprocal condition number of the matrix R3; RCOND(2) contains the reciprocal condition number of the matrix R1 - R2'*inv(R3)*R2; RCOND(3) contains the reciprocal condition number of the matrix V21; RCOND(4) contains the reciprocal condition number of the matrix St3; RCOND(5) contains the reciprocal condition number of the matrix V12; RCOND(6) contains the reciprocal condition number of the matrix Im2 + DKHAT*D22 RCOND(7) contains the reciprocal condition number of the X-Riccati equation; RCOND(8) contains the reciprocal condition number of the Z-Riccati equation.Tolerances
TOL DOUBLE PRECISION Tolerance used in neglecting the small singular values in rank determination. If TOL <= 0, then a default value equal to 1000*EPS is used, where EPS is the relative machine precision.Workspace
IWORK INTEGER array, dimension (max(2*max(M2,N),M,M2+NP2,N*N)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= max(LW1,LW2,LW3,LW4), where LW1 = (N+NP1+1)*(N+M2) + max(3*(N+M2)+N+NP1,5*(N+M2)); LW2 = (N+NP2)*(N+M1+1) + max(3*(N+NP2)+N+M1,5*(N+NP2)); LW3 = 13*N*N + 2*M*M + N*(8*M+NP2) + M1*(M2+NP2) + 6*N + max(14*N+23,16*N,2*N+M,3*M); LW4 = 13*N*N + M*M + (8*N+M+M2+2*NP2)*(M2+NP2) + 6*N + N*(M+NP2) + max(14*N+23,16*N,2*N+M2+NP2,3*(M2+NP2)); For good performance, LDWORK must generally be larger. Denoting Q = max(M1,M2,NP1,NP2), an upper bound is max((N+Q)*(N+Q+6),13*N*N + M*M + 2*Q*Q + N*(M+Q) + max(M*(M+7*N),2*Q*(8*N+M+2*Q)) + 6*N + max(14*N+23,16*N,2*N+max(M,2*Q),3*max(M,2*Q)). BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; j*Theta = 1: if the matrix | A-e *I B2 | had not full | C1 D12 | column rank; j*Theta = 2: if the matrix | A-e *I B1 | had not full | C2 D21 | row rank; = 3: if the matrix D12 had not full column rank; = 4: if the matrix D21 had not full row rank; = 5: if the controller is not admissible (too small value of gamma); = 6: if the X-Riccati equation was not solved successfully (the controller is not admissible or there are numerical difficulties); = 7: if the Z-Riccati equation was not solved successfully (the controller is not admissible or there are numerical difficulties); = 8: if the matrix Im2 + DKHAT*D22 is singular. = 9: if the singular value decomposition (SVD) algorithm did not converge (when computing the SVD of one of the matrices |A B2 |, |A B1 |, D12 or D21). |C1 D12| |C2 D21|Method
The routine implements the method presented in [1].References
[1] Green, M. and Limebeer, D.J.N. Linear Robust Control. Prentice-Hall, Englewood Cliffs, NJ, 1995. [2] Petkov, P.Hr., Gu, D.W., and Konstantinov, M.M. Fortran 77 routines for Hinf and H2 design of linear discrete-time control systems. Report 99-8, Department of Engineering, Leicester University, April 1999.Numerical Aspects
With approaching the minimum value of gamma some of the matrices which are to be inverted tend to become ill-conditioned and the X- or Z-Riccati equation may also become ill-conditioned which may deteriorate the accuracy of the result. (The corresponding reciprocal condition numbers are given in the output array RCOND.)Further Comments
NoneExample
Program Text
* SB10DD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 10, MMAX = 10, PMAX = 10 ) INTEGER LDA, LDB, LDC, LDD, LDAK, LDBK, LDCK, LDDK, LDX, $ LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, LDD = PMAX, $ LDAK = NMAX, LDBK = NMAX, LDCK = PMAX, $ LDDK = PMAX, LDX = NMAX, LDZ = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 2*MAX( MMAX, NMAX ), $ MMAX + PMAX, NMAX*NMAX ) ) INTEGER MPMX PARAMETER ( MPMX = MAX( MMAX, PMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = $ MAX( ( NMAX + MPMX )*( NMAX + MPMX + 6 ), $ 13*NMAX*NMAX + MMAX*MMAX + 2*MPMX*MPMX + $ NMAX*( MMAX + MPMX ) + $ MAX( MMAX*( MMAX + 7*NMAX ), $ 2*MPMX*( 8*NMAX + MMAX + 2*MPMX ) ) $ + 6*NMAX + $ MAX( 14*NMAX + 23, 16*NMAX, $ 2*NMAX + MAX( MMAX, 2*MPMX ), $ 3*MAX( MMAX, 2*MPMX ) ) ) ) * .. Local Scalars .. DOUBLE PRECISION GAMMA, TOL INTEGER I, INFO, J, M, N, NCON, NMEAS, NP * .. Local Arrays .. LOGICAL BWORK(2*NMAX) INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), AK(LDA,NMAX), B(LDB,MMAX), $ BK(LDBK,PMAX), C(LDC,NMAX), CK(LDCK,NMAX), $ D(LDD,MMAX), DK(LDDK,PMAX), X(LDX,NMAX), $ Z(LDZ,NMAX), DWORK(LDWORK), RCOND( 8 ) * .. External Subroutines .. EXTERNAL SB10DD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, NP, NCON, NMEAS IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE IF ( NP.LT.0 .OR. NP.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) NP ELSE IF ( NCON.LT.0 .OR. NCON.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) NCON ELSE IF ( NMEAS.LT.0 .OR. NMEAS.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) NMEAS ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,NP ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,NP ) READ ( NIN, FMT = * ) GAMMA, TOL CALL SB10DD( N, M, NP, NCON, NMEAS, GAMMA, A, LDA, B, LDB, $ C, LDC, D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, $ DK, LDDK, X, LDX, Z, LDZ, RCOND, TOL, IWORK, $ DWORK, LDWORK, BWORK, INFO ) IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( AK(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( BK(I,J), J = 1,NMEAS ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, NCON WRITE ( NOUT, FMT = 99992 ) ( CK(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, NCON WRITE ( NOUT, FMT = 99992 ) ( DK(I,J), J = 1,NMEAS ) 40 CONTINUE WRITE( NOUT, FMT = 99993 ) WRITE( NOUT, FMT = 99991 ) ( RCOND(I), I = 1, 8 ) ELSE WRITE( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' SB10DD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' INFO on exit from SB10DD =',I2) 99997 FORMAT (/' The controller state matrix AK is'/) 99996 FORMAT (/' The controller input matrix BK is'/) 99995 FORMAT (/' The controller output matrix CK is'/) 99994 FORMAT (/' The controller matrix DK is'/) 99993 FORMAT (/' The estimated condition numbers are'/) 99992 FORMAT (10(1X,F8.4)) 99991 FORMAT ( 5(1X,D12.5)) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' NP is out of range.',/' NP = ',I5) 99987 FORMAT (/' NCON is out of range.',/' NCON = ',I5) 99986 FORMAT (/' NMEAS is out of range.',/' NMEAS = ',I5) ENDProgram Data
SB10DD EXAMPLE PROGRAM DATA 6 5 5 2 2 -0.7 0.0 0.3 0.0 -0.5 -0.1 -0.6 0.2 -0.4 -0.3 0.0 0.0 -0.5 0.7 -0.1 0.0 0.0 -0.8 -0.7 0.0 0.0 -0.5 -1.0 0.0 0.0 0.3 0.6 -0.9 0.1 -0.4 0.5 -0.8 0.0 0.0 0.2 -0.9 -1.0 -2.0 -2.0 1.0 0.0 1.0 0.0 1.0 -2.0 1.0 -3.0 -4.0 0.0 2.0 -2.0 1.0 -2.0 1.0 0.0 -1.0 0.0 1.0 -2.0 0.0 3.0 1.0 0.0 3.0 -1.0 -2.0 1.0 -1.0 2.0 -2.0 0.0 -3.0 -3.0 0.0 1.0 -1.0 1.0 0.0 0.0 2.0 0.0 -4.0 0.0 -2.0 1.0 -3.0 0.0 0.0 3.0 1.0 0.0 1.0 -2.0 1.0 0.0 -2.0 1.0 -1.0 -2.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 2.0 -1.0 -3.0 0.0 1.0 0.0 1.0 0.0 1.0 -1.0 0.0 0.0 1.0 2.0 1.0 111.294 0.00000001Program Results
SB10DD EXAMPLE PROGRAM RESULTS The controller state matrix AK is -18.0030 52.0376 26.0831 -0.4271 -40.9022 18.0857 18.8203 -57.6244 -29.0938 0.5870 45.3309 -19.8644 -26.5994 77.9693 39.0368 -1.4020 -60.1129 26.6910 -21.4163 62.1719 30.7507 -0.9201 -48.6221 21.8351 -0.8911 4.2787 2.3286 -0.2424 -3.0376 1.2169 -5.3286 16.1955 8.4824 -0.2489 -12.2348 5.1590 The controller input matrix BK is 16.9788 14.1648 -18.9215 -15.6726 25.2046 21.2848 20.1122 16.8322 1.4104 1.2040 5.3181 4.5149 The controller output matrix CK is -9.1941 27.5165 13.7364 -0.3639 -21.5983 9.6025 3.6490 -10.6194 -5.2772 0.2432 8.1108 -3.6293 The controller matrix DK is 9.0317 7.5348 -3.4006 -2.8219 The estimated condition numbers are 0.24960D+00 0.98548D+00 0.99186D+00 0.63733D-05 0.48625D+00 0.29430D-01 0.56942D-02 0.12470D-01
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10ED.html 0000664 0000000 0000000 00000041111 14560147231 0020326 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrices of the H2 optimal n-state controller | AK | BK | K = |----|----| | CK | DK | for the discrete-time system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| , | C1 | 0 D12 | | C | D | | C2 | D21 D22 | where B2 has as column size the number of control inputs (NCON) and C2 has as row size the number of measurements (NMEAS) being provided to the controller. It is assumed that (A1) (A,B2) is stabilizable and (C2,A) is detectable, (A2) D12 is full column rank and D21 is full row rank, j*Theta (A3) | A-e *I B2 | has full column rank for all | C1 D12 | 0 <= Theta < 2*Pi , j*Theta (A4) | A-e *I B1 | has full row rank for all | C2 D21 | 0 <= Theta < 2*Pi .Specification
SUBROUTINE SB10ED( N, M, NP, NCON, NMEAS, A, LDA, B, LDB, C, LDC, $ D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, $ RCOND, TOL, IWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, $ LDDK, LDWORK, M, N, NCON, NMEAS, NP DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), $ D( LDD, * ), DK( LDDK, * ), DWORK( * ), $ RCOND( * ) LOGICAL BWORK( * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. A (input/worksp.) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. This array is modified internally, but it is restored on exit. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NMEAS) The leading N-by-NMEAS part of this array contains the controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading NCON-by-N part of this array contains the controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (output) DOUBLE PRECISION array, dimension (LDDK,NMEAS) The leading NCON-by-NMEAS part of this array contains the controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON). RCOND (output) DOUBLE PRECISION array, dimension (7) RCOND contains estimates the reciprocal condition numbers of the matrices which are to be inverted and the reciprocal condition numbers of the Riccati equations which have to be solved during the computation of the controller. (See the description of the algorithm in [2].) RCOND(1) contains the reciprocal condition number of the control transformation matrix TU; RCOND(2) contains the reciprocal condition number of the measurement transformation matrix TY; RCOND(3) contains the reciprocal condition number of the matrix Im2 + B2'*X2*B2; RCOND(4) contains the reciprocal condition number of the matrix Ip2 + C2*Y2*C2'; RCOND(5) contains the reciprocal condition number of the X-Riccati equation; RCOND(6) contains the reciprocal condition number of the Y-Riccati equation; RCOND(7) contains the reciprocal condition number of the matrix Im2 + DKHAT*D22 .Tolerances
TOL DOUBLE PRECISION Tolerance used for controlling the accuracy of the transformations applied for diagonalizing D12 and D21, and for checking the nonsingularity of the matrices to be inverted. If TOL <= 0, then a default value equal to sqrt(EPS) is used, where EPS is the relative machine precision.Workspace
IWORK INTEGER array, dimension (max(2*M2,2*N,N*N,NP2)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= N*M + NP*(N+M) + M2*M2 + NP2*NP2 + max(1,LW1,LW2,LW3,LW4,LW5,LW6), where LW1 = (N+NP1+1)*(N+M2) + max(3*(N+M2)+N+NP1,5*(N+M2)), LW2 = (N+NP2)*(N+M1+1) + max(3*(N+NP2)+N+M1,5*(N+NP2)), LW3 = M2 + NP1*NP1 + max(NP1*max(N,M1),3*M2+NP1,5*M2), LW4 = NP2 + M1*M1 + max(max(N,NP1)*M1,3*NP2+M1,5*NP2), LW5 = 2*N*N+max(1,14*N*N+6*N+max(14*N+23,16*N),M2*(N+M2+ max(3,M1)),NP2*(N+NP2+3)), LW6 = max(N*M2,N*NP2,M2*NP2,M2*M2+4*M2), with M1 = M - M2 and NP1 = NP - NP2. For good performance, LDWORK must generally be larger. Denoting Q = max(M1,M2,NP1,NP2), an upper bound is 2*Q*(3*Q+2*N)+max(1,(N+Q)*(N+Q+6),Q*(Q+max(N,Q,5)+1), 2*N*N+max(1,14*N*N+6*N+max(14*N+23,16*N), Q*(N+Q+max(Q,3)))). BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; j*Theta = 1: if the matrix | A-e *I B2 | had not full | C1 D12 | column rank in respect to the tolerance EPS; j*Theta = 2: if the matrix | A-e *I B1 | had not full | C2 D21 | row rank in respect to the tolerance EPS; = 3: if the matrix D12 had not full column rank in respect to the tolerance TOL; = 4: if the matrix D21 had not full row rank in respect to the tolerance TOL; = 5: if the singular value decomposition (SVD) algorithm did not converge (when computing the SVD of one of the matrices |A-I B2 |, |A-I B1 |, D12 or D21). |C1 D12| |C2 D21| = 6: if the X-Riccati equation was not solved successfully; = 7: if the matrix Im2 + B2'*X2*B2 is not positive definite, or it is numerically singular (with respect to the tolerance TOL); = 8: if the Y-Riccati equation was not solved successfully; = 9: if the matrix Ip2 + C2*Y2*C2' is not positive definite, or it is numerically singular (with respect to the tolerance TOL); =10: if the matrix Im2 + DKHAT*D22 is singular, or its estimated condition number is larger than or equal to 1/TOL.Method
The routine implements the formulas given in [1].References
[1] Zhou, K., Doyle, J.C., and Glover, K. Robust and Optimal Control. Prentice-Hall, Upper Saddle River, NJ, 1996. [2] Petkov, P.Hr., Gu, D.W., and Konstantinov, M.M. Fortran 77 routines for Hinf and H2 design of linear discrete-time control systems. Report 99-8, Department of Engineering, Leicester University, April 1999.Numerical Aspects
The accuracy of the result depends on the condition numbers of the matrices which are to be inverted and on the condition numbers of the matrix Riccati equations which are to be solved in the computation of the controller. (The corresponding reciprocal condition numbers are given in the output array RCOND.)Further Comments
NoneExample
Program Text
* SB10ED EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 10, MMAX = 10, PMAX = 10 ) INTEGER LDA, LDB, LDC, LDD, LDAK, LDBK, LDCK, LDDK PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, LDD = PMAX, $ LDAK = NMAX, LDBK = NMAX, LDCK = PMAX, $ LDDK = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 2*MMAX, PMAX, 2*NMAX, $ NMAX*NMAX ) ) INTEGER MPMX PARAMETER ( MPMX = MAX( MMAX, PMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 2*MPMX*( 3*MPMX + 2*NMAX ) + $ MAX( ( NMAX + MPMX )*( NMAX + MPMX + 6 ), $ MPMX*( MPMX + MAX( NMAX, MPMX, 5 ) + 1 ), $ 2*NMAX*NMAX + MAX( 14*NMAX*NMAX + 6*NMAX + $ MAX( 14*NMAX + 23, 16*NMAX ), $ MPMX*( NMAX + MPMX + MAX( MPMX, 3 ) ) ) ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N, NCON, NMEAS, NP * .. Local Arrays .. LOGICAL BWORK(2*NMAX) INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), AK(LDA,NMAX), B(LDB,MMAX), $ BK(LDBK,MMAX), C(LDC,NMAX), CK(LDCK,NMAX), $ D(LDD,MMAX), DK(LDDK,MMAX), DWORK(LDWORK), $ RCOND( 8 ) * .. External Subroutines .. EXTERNAL SB10ED * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, NP, NCON, NMEAS IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE IF ( NP.LT.0 .OR. NP.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) NP ELSE IF ( NCON.LT.0 .OR. NCON.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) NCON ELSE IF ( NMEAS.LT.0 .OR. NMEAS.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) NMEAS ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,NP ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,NP ) READ ( NIN, FMT = * ) TOL CALL SB10ED( N, M, NP, NCON, NMEAS, A, LDA, B, LDB, $ C, LDC, D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, $ DK, LDDK, RCOND, TOL, IWORK, DWORK, LDWORK, $ BWORK, INFO ) IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( AK(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( BK(I,J), J = 1,NMEAS ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, NCON WRITE ( NOUT, FMT = 99992 ) ( CK(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, NCON WRITE ( NOUT, FMT = 99992 ) ( DK(I,J), J = 1,NMEAS ) 40 CONTINUE WRITE( NOUT, FMT = 99993 ) WRITE( NOUT, FMT = 99991 ) ( RCOND(I), I = 1, 7 ) ELSE WRITE( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' SB10ED EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' INFO on exit from SB10ED =',I2) 99997 FORMAT (' The controller state matrix AK is'/) 99996 FORMAT (/' The controller input matrix BK is'/) 99995 FORMAT (/' The controller output matrix CK is'/) 99994 FORMAT (/' The controller matrix DK is'/) 99993 FORMAT (/' The estimated condition numbers are'/) 99992 FORMAT (10(1X,F8.4)) 99991 FORMAT ( 5(1X,D12.5)) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' NCON is out of range.',/' NCON = ',I5) 99986 FORMAT (/' NMEAS is out of range.',/' NMEAS = ',I5) ENDProgram Data
SB10ED EXAMPLE PROGRAM DATA 6 5 5 2 2 -0.7 0.0 0.3 0.0 -0.5 -0.1 -0.6 0.2 -0.4 -0.3 0.0 0.0 -0.5 0.7 -0.1 0.0 0.0 -0.8 -0.7 0.0 0.0 -0.5 -1.0 0.0 0.0 0.3 0.6 -0.9 0.1 -0.4 0.5 -0.8 0.0 0.0 0.2 -0.9 -1.0 -2.0 -2.0 1.0 0.0 1.0 0.0 1.0 -2.0 1.0 -3.0 -4.0 0.0 2.0 -2.0 1.0 -2.0 1.0 0.0 -1.0 0.0 1.0 -2.0 0.0 3.0 1.0 0.0 3.0 -1.0 -2.0 1.0 -1.0 2.0 -2.0 0.0 -3.0 -3.0 0.0 1.0 -1.0 1.0 0.0 0.0 2.0 0.0 -4.0 0.0 -2.0 1.0 -3.0 0.0 0.0 3.0 1.0 0.0 1.0 -2.0 1.0 0.0 -2.0 1.0 -1.0 -2.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 2.0 -1.0 -3.0 0.0 1.0 0.0 1.0 0.0 1.0 -1.0 0.0 0.0 1.0 2.0 1.0 0.00000001Program Results
SB10ED EXAMPLE PROGRAM RESULTS The controller state matrix AK is -0.0551 -2.1891 -0.6607 -0.2532 0.6674 -1.0044 -1.0379 2.3804 0.5031 0.3960 -0.6605 1.2673 -0.0876 -2.1320 -0.4701 -1.1461 1.2927 -1.5116 -0.1358 -2.1237 -0.9560 -0.7144 0.6673 -0.7957 0.4900 0.0895 0.2634 -0.2354 0.1623 -0.2663 0.1672 -0.4163 0.2871 -0.1983 0.4944 -0.6967 The controller input matrix BK is -0.5985 -0.5464 0.5285 0.6087 -0.7600 -0.4472 -0.7288 -0.6090 0.0532 0.0658 -0.0663 0.0059 The controller output matrix CK is 0.2500 -1.0200 -0.3371 -0.2733 0.2747 -0.4444 0.0654 0.2095 0.0632 0.2089 -0.1895 0.1834 The controller matrix DK is -0.2181 -0.2070 0.1094 0.1159 The estimated condition numbers are 0.10000D+01 0.10000D+01 0.25207D+00 0.83985D-01 0.48628D-02 0.55015D-03 0.49886D+00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10FD.html 0000664 0000000 0000000 00000045606 14560147231 0020344 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrices of an H-infinity (sub)optimal n-state controller | AK | BK | K = |----|----|, | CK | DK | using modified Glover's and Doyle's 1988 formulas, for the system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| | C1 | D11 D12 | | C | D | | C2 | D21 D22 | and for a given value of gamma, where B2 has as column size the number of control inputs (NCON) and C2 has as row size the number of measurements (NMEAS) being provided to the controller. It is assumed that (A1) (A,B2) is stabilizable and (C2,A) is detectable, (A2) D12 is full column rank and D21 is full row rank, (A3) | A-j*omega*I B2 | has full column rank for all omega, | C1 D12 | (A4) | A-j*omega*I B1 | has full row rank for all omega. | C2 D21 |Specification
SUBROUTINE SB10FD( N, M, NP, NCON, NMEAS, GAMMA, A, LDA, B, LDB, $ C, LDC, D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, $ DK, LDDK, RCOND, TOL, IWORK, DWORK, LDWORK, $ BWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, $ LDDK, LDWORK, M, N, NCON, NMEAS, NP DOUBLE PRECISION GAMMA, TOL C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), $ D( LDD, * ), DK( LDDK, * ), DWORK( * ), $ RCOND( 4 )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. GAMMA (input) DOUBLE PRECISION The value of gamma. It is assumed that gamma is sufficiently large so that the controller is admissible. GAMMA >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NMEAS) The leading N-by-NMEAS part of this array contains the controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading NCON-by-N part of this array contains the controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (output) DOUBLE PRECISION array, dimension (LDDK,NMEAS) The leading NCON-by-NMEAS part of this array contains the controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON). RCOND (output) DOUBLE PRECISION array, dimension (4) RCOND(1) contains the reciprocal condition number of the control transformation matrix; RCOND(2) contains the reciprocal condition number of the measurement transformation matrix; RCOND(3) contains an estimate of the reciprocal condition number of the X-Riccati equation; RCOND(4) contains an estimate of the reciprocal condition number of the Y-Riccati equation.Tolerances
TOL DOUBLE PRECISION Tolerance used for controlling the accuracy of the applied transformations for computing the normalized form in SLICOT Library routine SB10PD. Transformation matrices whose reciprocal condition numbers are less than TOL are not allowed. If TOL <= 0, then a default value equal to sqrt(EPS) is used, where EPS is the relative machine precision.Workspace
IWORK INTEGER array, dimension (LIWORK), where LIWORK = max(2*max(N,M-NCON,NP-NMEAS,NCON),N*N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= N*M + NP*(N+M) + M2*M2 + NP2*NP2 + max(1,LW1,LW2,LW3,LW4,LW5,LW6), where LW1 = (N+NP1+1)*(N+M2) + max(3*(N+M2)+N+NP1,5*(N+M2)), LW2 = (N+NP2)*(N+M1+1) + max(3*(N+NP2)+N+M1,5*(N+NP2)), LW3 = M2 + NP1*NP1 + max(NP1*max(N,M1),3*M2+NP1,5*M2), LW4 = NP2 + M1*M1 + max(max(N,NP1)*M1,3*NP2+M1,5*NP2), LW5 = 2*N*N + N*(M+NP) + max(1,M*M + max(2*M1,3*N*N+max(N*M,10*N*N+12*N+5)), NP*NP + max(2*NP1,3*N*N + max(N*NP,10*N*N+12*N+5))), LW6 = 2*N*N + N*(M+NP) + max(1, M2*NP2 + NP2*NP2 + M2*M2 + max(D1*D1 + max(2*D1, (D1+D2)*NP2), D2*D2 + max(2*D2, D2*M2), 3*N, N*(2*NP2 + M2) + max(2*N*M2, M2*NP2 + max(M2*M2+3*M2, NP2*(2*NP2+ M2+max(NP2,N)))))), with D1 = NP1 - M2, D2 = M1 - NP2, NP1 = NP - NP2, M1 = M - M2. For good performance, LDWORK must generally be larger. Denoting Q = max(M1,M2,NP1,NP2), an upper bound is 2*Q*(3*Q+2*N)+max(1,(N+Q)*(N+Q+6),Q*(Q+max(N,Q,5)+1), 2*N*(N+2*Q)+max(1,4*Q*Q+ max(2*Q,3*N*N+max(2*N*Q,10*N*N+12*N+5)), Q*(3*N+3*Q+max(2*N,4*Q+max(N,Q))))). BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix | A-j*omega*I B2 | had not full | C1 D12 | column rank in respect to the tolerance EPS; = 2: if the matrix | A-j*omega*I B1 | had not full row | C2 D21 | rank in respect to the tolerance EPS; = 3: if the matrix D12 had not full column rank in respect to the tolerance TOL; = 4: if the matrix D21 had not full row rank in respect to the tolerance TOL; = 5: if the singular value decomposition (SVD) algorithm did not converge (when computing the SVD of one of the matrices |A B2 |, |A B1 |, D12 or D21). |C1 D12| |C2 D21| = 6: if the controller is not admissible (too small value of gamma); = 7: if the X-Riccati equation was not solved successfully (the controller is not admissible or there are numerical difficulties); = 8: if the Y-Riccati equation was not solved successfully (the controller is not admissible or there are numerical difficulties); = 9: if the determinant of Im2 + Tu*D11HAT*Ty*D22 is zero [3].Method
The routine implements the Glover's and Doyle's 1988 formulas [1], [2] modified to improve the efficiency as described in [3].References
[1] Glover, K. and Doyle, J.C. State-space formulae for all stabilizing controllers that satisfy an Hinf norm bound and relations to risk sensitivity. Systems and Control Letters, vol. 11, pp. 167-172, 1988. [2] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, Mass., 1995. [3] Petkov, P.Hr., Gu, D.W., and Konstantinov, M.M. Fortran 77 routines for Hinf and H2 design of continuous-time linear control systems. Rep. 98-14, Department of Engineering, Leicester University, Leicester, U.K., 1998.Numerical Aspects
The accuracy of the result depends on the condition numbers of the input and output transformations and on the condition numbers of the two Riccati equations, as given by the values of RCOND(1), RCOND(2), RCOND(3) and RCOND(4), respectively.Further Comments
NoneExample
Program Text
* SB10FD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX, N2MAX PARAMETER ( NMAX = 10, MMAX = 10, PMAX = 10, N2MAX = 20 ) INTEGER LDA, LDB, LDC, LDD, LDAK, LDBK, LDCK, LDDK, $ LDAC, LDBC, LDCC, LDDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, LDD = PMAX, $ LDAK = NMAX, LDBK = NMAX, LDCK = MMAX, $ LDDK = MMAX, LDAC = 2*NMAX, LDBC = 2*NMAX, $ LDCC = PMAX, LDDC = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 2*MAX( NMAX, MMAX, PMAX ), $ NMAX*NMAX ) ) INTEGER MPMX PARAMETER ( MPMX = MAX( MMAX, PMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 2*MPMX*( 3*MPMX + 2*NMAX ) + $ MAX( ( NMAX + MPMX )*( NMAX + MPMX + 6 ), $ MPMX*( MPMX + MAX( NMAX, MPMX, 5 ) + 1 ), $ 2*NMAX*( NMAX + 2*MPMX ) + $ MAX( 4*MPMX*MPMX + MAX( 2*MPMX, 3*NMAX*NMAX + $ MAX( 2*NMAX*MPMX, 10*NMAX*NMAX+12*NMAX+5 ) ), $ MPMX*( 3*NMAX + 3*MPMX + $ MAX( 2*NMAX, 4*MPMX + $ MAX( NMAX, MPMX ) ) ) ) ) ) * .. Local Scalars .. INTEGER SDIM LOGICAL SELECT DOUBLE PRECISION GAMMA, TOL INTEGER I, INFO1, INFO2, INFO3, J, M, N, NCON, NMEAS, NP * .. Local Arrays .. LOGICAL BWORK(N2MAX) INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), AK(LDAK,NMAX), AC(LDAC,N2MAX), $ B(LDB,MMAX), BK(LDBK,PMAX), BC(LDBC,MMAX), $ C(LDC,NMAX), CK(LDCK,NMAX), CC(LDCC,N2MAX), $ D(LDD,MMAX), DK(LDDK,PMAX), DC(LDDC,MMAX), $ DWORK(LDWORK), RCOND( 4 ) * .. External Subroutines .. EXTERNAL SB10FD, SB10LD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, NP, NCON, NMEAS IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99987 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99986 ) M ELSE IF ( NP.LT.0 .OR. NP.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99985 ) NP ELSE IF ( NCON.LT.0 .OR. NCON.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99984 ) NCON ELSE IF ( NMEAS.LT.0 .OR. NMEAS.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99983 ) NMEAS ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,NP ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,NP ) READ ( NIN, FMT = * ) GAMMA, TOL * Compute the suboptimal controller CALL SB10FD( N, M, NP, NCON, NMEAS, GAMMA, A, LDA, B, LDB, $ C, LDC, D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, $ DK, LDDK, RCOND, TOL, IWORK, DWORK, LDWORK, $ BWORK, INFO1 ) * IF ( INFO1.EQ.0 ) THEN WRITE ( NOUT, FMT = 99996 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99989 ) ( AK(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99989 ) ( BK(I,J), J = 1,NMEAS ) 20 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 30 I = 1, NCON WRITE ( NOUT, FMT = 99989 ) ( CK(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NCON WRITE ( NOUT, FMT = 99989 ) ( DK(I,J), J = 1,NMEAS ) 40 CONTINUE WRITE( NOUT, FMT = 99992 ) WRITE( NOUT, FMT = 99988 ) ( RCOND(I), I = 1, 4 ) * Compute the closed-loop matrices CALL SB10LD(N, M, NP, NCON, NMEAS, A, LDA, B, LDB, C, LDC, $ D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, $ AC, LDAC, BC, LDBC, CC, LDCC, DC, LDDC, IWORK, $ DWORK, LDWORK, INFO2 ) * IF ( INFO2.EQ.0 ) THEN * Compute the closed-loop poles CALL DGEES( 'N','N', SELECT, 2*N, AC, LDAC, SDIM, $ DWORK(1), DWORK(2*N+1), DWORK, 2*N, $ DWORK(4*N+1), LDWORK-4*N, BWORK, INFO3) * IF( INFO3.EQ.0 ) THEN WRITE( NOUT, FMT = 99991 ) WRITE( NOUT, FMT = 99988 ) (DWORK(I), I =1, 2*N) WRITE( NOUT, FMT = 99990 ) WRITE( NOUT, FMT = 99988 ) (DWORK(2*N+I), I =1, 2*N) ELSE WRITE( NOUT, FMT = 99996 ) INFO3 END IF ELSE WRITE( NOUT, FMT = 99997 ) INFO2 END IF ELSE WRITE( NOUT, FMT = 99998 ) INFO1 END IF END IF STOP * 99999 FORMAT (' SB10FD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' INFO on exit from SB10FD =',I2) 99997 FORMAT (/' INFO on exit from SB10LD =',I2) 99996 FORMAT (' The controller state matrix AK is'/) 99995 FORMAT (/' The controller input matrix BK is'/) 99994 FORMAT (/' The controller output matrix CK is'/) 99993 FORMAT (/' The controller matrix DK is'/) 99992 FORMAT (/' The estimated condition numbers are'/) 99991 FORMAT (/' The real parts of the closed-loop system poles are'/) 99990 FORMAT (/' The imaginary parts of the closed-loop system', $ ' poles are'/) 99989 FORMAT (10(1X,F8.4)) 99988 FORMAT ( 5(1X,D12.5)) 99987 FORMAT (/' N is out of range.',/' N = ',I5) 99986 FORMAT (/' M is out of range.',/' M = ',I5) 99985 FORMAT (/' N is out of range.',/' N = ',I5) 99984 FORMAT (/' NCON is out of range.',/' NCON = ',I5) 99983 FORMAT (/' NMEAS is out of range.',/' NMEAS = ',I5) ENDProgram Data
SB10FD EXAMPLE PROGRAM DATA 6 5 5 2 2 -1.0 0.0 4.0 5.0 -3.0 -2.0 -2.0 4.0 -7.0 -2.0 0.0 3.0 -6.0 9.0 -5.0 0.0 2.0 -1.0 -8.0 4.0 7.0 -1.0 -3.0 0.0 2.0 5.0 8.0 -9.0 1.0 -4.0 3.0 -5.0 8.0 0.0 2.0 -6.0 -3.0 -4.0 -2.0 1.0 0.0 2.0 0.0 1.0 -5.0 2.0 -5.0 -7.0 0.0 7.0 -2.0 4.0 -6.0 1.0 1.0 -2.0 -3.0 9.0 -8.0 0.0 5.0 1.0 -2.0 3.0 -6.0 -2.0 1.0 -1.0 2.0 -4.0 0.0 -3.0 -3.0 0.0 5.0 -1.0 1.0 1.0 -7.0 5.0 0.0 -8.0 2.0 -2.0 9.0 -3.0 4.0 0.0 3.0 7.0 0.0 1.0 -2.0 1.0 -6.0 -2.0 1.0 -2.0 -3.0 0.0 0.0 0.0 4.0 0.0 1.0 0.0 5.0 -3.0 -4.0 0.0 1.0 0.0 1.0 0.0 1.0 -3.0 0.0 0.0 1.0 7.0 1.0 15.0 0.00000001Program Results
SB10FD EXAMPLE PROGRAM RESULTS The controller state matrix AK is -2.8043 14.7367 4.6658 8.1596 0.0848 2.5290 4.6609 3.2756 -3.5754 -2.8941 0.2393 8.2920 -15.3127 23.5592 -7.1229 2.7599 5.9775 -2.0285 -22.0691 16.4758 12.5523 -16.3602 4.4300 -3.3168 30.6789 -3.9026 -1.3868 26.2357 -8.8267 10.4860 -5.7429 0.0577 10.8216 -11.2275 1.5074 -10.7244 The controller input matrix BK is -0.1581 -0.0793 -0.9237 -0.5718 0.7984 0.6627 0.1145 0.1496 -0.6743 -0.2376 0.0196 -0.7598 The controller output matrix CK is -0.2480 -0.1713 -0.0880 0.1534 0.5016 -0.0730 2.8810 -0.3658 1.3007 0.3945 1.2244 2.5690 The controller matrix DK is 0.0554 0.1334 -0.3195 0.0333 The estimated condition numbers are 0.10000D+01 0.10000D+01 0.11241D-01 0.80492D-03 The real parts of the closed-loop system poles are -0.10731D+03 -0.66556D+02 -0.38269D+02 -0.38269D+02 -0.20089D+02 -0.62557D+01 -0.62557D+01 -0.32405D+01 -0.32405D+01 -0.17178D+01 -0.41466D+01 -0.76437D+01 The imaginary parts of the closed-loop system poles are 0.00000D+00 0.00000D+00 0.13114D+02 -0.13114D+02 0.00000D+00 0.12961D+02 -0.12961D+02 0.67998D+01 -0.67998D+01 0.00000D+00 0.00000D+00 0.00000D+00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10HD.html 0000664 0000000 0000000 00000034155 14560147231 0020343 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrices of the H2 optimal n-state controller | AK | BK | K = |----|----| | CK | DK | for the system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| , | C1 | 0 D12 | | C | D | | C2 | D21 D22 | where B2 has as column size the number of control inputs (NCON) and C2 has as row size the number of measurements (NMEAS) being provided to the controller. It is assumed that (A1) (A,B2) is stabilizable and (C2,A) is detectable, (A2) The block D11 of D is zero, (A3) D12 is full column rank and D21 is full row rank.Specification
SUBROUTINE SB10HD( N, M, NP, NCON, NMEAS, A, LDA, B, LDB, C, LDC, $ D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, $ RCOND, TOL, IWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, $ LDDK, LDWORK, M, N, NCON, NMEAS, NP DOUBLE PRECISION TOL C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), $ D( LDD, * ), DK( LDDK, * ), DWORK( * ), $ RCOND( 4 )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NMEAS) The leading N-by-NMEAS part of this array contains the controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading NCON-by-N part of this array contains the controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (output) DOUBLE PRECISION array, dimension (LDDK,NMEAS) The leading NCON-by-NMEAS part of this array contains the controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON). RCOND (output) DOUBLE PRECISION array, dimension (4) RCOND(1) contains the reciprocal condition number of the control transformation matrix; RCOND(2) contains the reciprocal condition number of the measurement transformation matrix; RCOND(3) contains an estimate of the reciprocal condition number of the X-Riccati equation; RCOND(4) contains an estimate of the reciprocal condition number of the Y-Riccati equation.Tolerances
TOL DOUBLE PRECISION Tolerance used for controlling the accuracy of the applied transformations for computing the normalized form in SLICOT Library routine SB10UD. Transformation matrices whose reciprocal condition numbers are less than TOL are not allowed. If TOL <= 0, then a default value equal to sqrt(EPS) is used, where EPS is the relative machine precision.Workspace
IWORK INTEGER array, dimension (max(2*N,N*N)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= N*M + NP*(N+M) + M2*M2 + NP2*NP2 + max(max(M2 + NP1*NP1 + max(NP1*N,3*M2+NP1,5*M2), NP2 + M1*M1 + max(M1*N,3*NP2+M1,5*NP2), N*M2,NP2*N,NP2*M2,1), N*(14*N+12+M2+NP2)+5), where M1 = M - M2 and NP1 = NP - NP2. For good performance, LDWORK must generally be larger. Denoting Q = max(M1,M2,NP1,NP2), an upper bound is 2*Q*(3*Q+2*N)+max(1,Q*(Q+max(N,5)+1),N*(14*N+12+2*Q)+5). BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix D12 had not full column rank in respect to the tolerance TOL; = 2: if the matrix D21 had not full row rank in respect to the tolerance TOL; = 3: if the singular value decomposition (SVD) algorithm did not converge (when computing the SVD of one of the matrices D12 or D21). = 4: if the X-Riccati equation was not solved successfully; = 5: if the Y-Riccati equation was not solved successfully.Method
The routine implements the formulas given in [1], [2].References
[1] Zhou, K., Doyle, J.C., and Glover, K. Robust and Optimal Control. Prentice-Hall, Upper Saddle River, NJ, 1996. [2] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, Mass., 1995.Numerical Aspects
The accuracy of the result depends on the condition numbers of the input and output transformations and on the condition numbers of the two Riccati equations, as given by the values of RCOND(1), RCOND(2), RCOND(3) and RCOND(4), respectively.Further Comments
NoneExample
Program Text
* SB10HD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 10, MMAX = 10, PMAX = 10 ) INTEGER LDA, LDB, LDC, LDD, LDAK, LDBK, LDCK, LDDK PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, LDD = PMAX, $ LDAK = NMAX, LDBK = NMAX, LDCK = PMAX, $ LDDK = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 2*NMAX, NMAX*NMAX ) ) INTEGER MPMX PARAMETER ( MPMX = MAX( MMAX, PMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 2*MPMX*( 2*NMAX + 3*MPMX ) + $ MAX( MPMX*( MPMX + MAX( NMAX, 5 ) + 1 ), $ NMAX*( 14*NMAX + 12 + 2*MPMX ) + 5 ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N, NCON, NMEAS, NP * .. Local Arrays .. LOGICAL BWORK(2*NMAX) INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), AK(LDA,NMAX), B(LDB,MMAX), $ BK(LDBK,MMAX), C(LDC,NMAX), CK(LDCK,NMAX), $ D(LDD,MMAX), DK(LDDK,MMAX), DWORK(LDWORK), $ RCOND( 4 ) * .. External Subroutines .. EXTERNAL SB10HD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, NP, NCON, NMEAS IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE IF ( NP.LT.0 .OR. NP.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) NP ELSE IF ( NCON.LT.0 .OR. NCON.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) NCON ELSE IF ( NMEAS.LT.0 .OR. NMEAS.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) NMEAS ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,NP ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,NP ) READ ( NIN, FMT = * ) TOL * Compute the optimal H2 controller CALL SB10HD( N, M, NP, NCON, NMEAS, A, LDA, B, LDB, $ C, LDC, D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, $ DK, LDDK, RCOND, TOL, IWORK, DWORK, LDWORK, $ BWORK, INFO ) * IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( AK(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( BK(I,J), J = 1,NMEAS ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, NCON WRITE ( NOUT, FMT = 99992 ) ( CK(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, NCON WRITE ( NOUT, FMT = 99992 ) ( DK(I,J), J = 1,NMEAS ) 40 CONTINUE WRITE( NOUT, FMT = 99993 ) WRITE( NOUT, FMT = 99991 ) ( RCOND(I), I = 1, 4 ) ELSE WRITE( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' SB10HD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' INFO on exit from SB10HD =',I2) 99997 FORMAT (' The controller state matrix AK is'/) 99996 FORMAT (/' The controller input matrix BK is'/) 99995 FORMAT (/' The controller output matrix CK is'/) 99994 FORMAT (/' The controller matrix DK is'/) 99993 FORMAT (/' The estimated condition numbers are'/) 99992 FORMAT (6(1X,F10.4)) 99991 FORMAT (5(1X,D12.5)) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' NCON is out of range.',/' NCON = ',I5) 99986 FORMAT (/' NMEAS is out of range.',/' NMEAS = ',I5) ENDProgram Data
SB10HD EXAMPLE PROGRAM DATA 6 5 5 2 2 -1.0 0.0 4.0 5.0 -3.0 -2.0 -2.0 4.0 -7.0 -2.0 0.0 3.0 -6.0 9.0 -5.0 0.0 2.0 -1.0 -8.0 4.0 7.0 -1.0 -3.0 0.0 2.0 5.0 8.0 -9.0 1.0 -4.0 3.0 -5.0 8.0 0.0 2.0 -6.0 -3.0 -4.0 -2.0 1.0 0.0 2.0 0.0 1.0 -5.0 2.0 -5.0 -7.0 0.0 7.0 -2.0 4.0 -6.0 1.0 1.0 -2.0 -3.0 9.0 -8.0 0.0 5.0 1.0 -2.0 3.0 -6.0 -2.0 1.0 -1.0 2.0 -4.0 0.0 -3.0 -3.0 0.0 5.0 -1.0 1.0 1.0 -7.0 5.0 0.0 -8.0 2.0 -2.0 9.0 -3.0 4.0 0.0 3.0 7.0 0.0 1.0 -2.0 1.0 -6.0 -2.0 0.0 0.0 0.0 -4.0 -1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 1.0 3.0 1.0 0.0 1.0 -3.0 -2.0 0.0 1.0 7.0 1.0 0.00000001Program Results
SB10HD EXAMPLE PROGRAM RESULTS The controller state matrix AK is 88.0015 -145.7298 -46.2424 82.2168 -45.2996 -31.1407 25.7489 -31.4642 -12.4198 9.4625 -3.5182 2.7056 54.3008 -102.4013 -41.4968 50.8412 -20.1286 -26.7191 108.1006 -198.0785 -45.4333 70.3962 -25.8591 -37.2741 -115.8900 226.1843 47.2549 -47.8435 -12.5004 34.7474 59.0362 -101.8471 -20.1052 36.7834 -16.1063 -26.4309 The controller input matrix BK is 3.7345 3.4758 -0.3020 0.6530 3.4735 4.0499 4.3198 7.2755 -3.9424 -10.5942 2.1784 2.5048 The controller output matrix CK is -2.3346 3.2556 0.7150 -0.9724 0.6962 0.4074 7.6899 -8.4558 -2.9642 7.0365 -4.2844 0.1390 The controller matrix DK is 0.0000 0.0000 0.0000 0.0000 The estimated condition numbers are 0.23570D+00 0.26726D+00 0.22747D-01 0.21130D-02
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10ID.html 0000664 0000000 0000000 00000027473 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrices of the positive feedback controller | Ak | Bk | K = |----|----| | Ck | Dk | for the shaped plant | A | B | G = |---|---| | C | D | in the McFarlane/Glover Loop Shaping Design Procedure.Specification
SUBROUTINE SB10ID( N, M, NP, A, LDA, B, LDB, C, LDC, D, LDD, $ FACTOR, NK, AK, LDAK, BK, LDBK, CK, LDCK, $ DK, LDDK, RCOND, IWORK, DWORK, LDWORK, BWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, $ LDDK, LDWORK, M, N, NK, NP DOUBLE PRECISION FACTOR C .. Array Arguments .. INTEGER IWORK( * ) LOGICAL BWORK( * ) DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), $ D( LDD, * ), DK( LDDK, * ), DWORK( * ), $ RCOND( 2 )Arguments
Input/Output Parameters
N (input) INTEGER The order of the plant. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A of the shaped plant. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B of the shaped plant. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C of the shaped plant. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system matrix D of the shaped plant. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). FACTOR (input) DOUBLE PRECISION = 1 implies that an optimal controller is required; > 1 implies that a suboptimal controller is required, achieving a performance FACTOR less than optimal. FACTOR >= 1. NK (output) INTEGER The order of the positive feedback controller. NK <= N. AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading NK-by-NK part of this array contains the controller state matrix Ak. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NP) The leading NK-by-NP part of this array contains the controller input matrix Bk. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading M-by-NK part of this array contains the controller output matrix Ck. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,M). DK (output) DOUBLE PRECISION array, dimension (LDDK,NP) The leading M-by-NP part of this array contains the controller matrix Dk. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,M). RCOND (output) DOUBLE PRECISION array, dimension (2) RCOND(1) contains an estimate of the reciprocal condition number of the X-Riccati equation; RCOND(2) contains an estimate of the reciprocal condition number of the Z-Riccati equation.Workspace
IWORK INTEGER array, dimension (max(2*N,N*N,M,NP)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 4*N*N + M*M + NP*NP + 2*M*N + N*NP + 4*N + max( 6*N*N + 5 + max(1,4*N*N+8*N), N*NP + 2*N ). For good performance, LDWORK must generally be larger. An upper bound of LDWORK in the above formula is LDWORK >= 10*N*N + M*M + NP*NP + 2*M*N + 2*N*NP + 4*N + 5 + max(1,4*N*N+8*N). BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the X-Riccati equation is not solved successfully; = 2: the Z-Riccati equation is not solved successfully; = 3: the iteration to compute eigenvalues or singular values failed to converge; = 4: the matrix Ip - D*Dk is singular; = 5: the matrix Im - Dk*D is singular; = 6: the closed-loop system is unstable.Method
The routine implements the formulas given in [1].References
[1] McFarlane, D. and Glover, K. A loop shaping design procedure using H_infinity synthesis. IEEE Trans. Automat. Control, vol. AC-37, no. 6, pp. 759-769, 1992.Numerical Aspects
The accuracy of the results depends on the conditioning of the two Riccati equations solved in the controller design (see the output parameter RCOND).Further Comments
NoneExample
Program Text
* SB10ID EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 10, MMAX = 10, PMAX = 10 ) INTEGER LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, LDDK PARAMETER ( LDA = NMAX, LDAK = NMAX, LDB = NMAX, $ LDBK = NMAX, LDC = PMAX, LDCK = MMAX, $ LDD = PMAX, LDDK = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX( 2*NMAX, NMAX*NMAX, MMAX, PMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 4*NMAX*NMAX + MMAX*MMAX + PMAX*PMAX + $ 2*MMAX*NMAX + NMAX*PMAX + 4*NMAX + $ MAX( 10*NMAX*NMAX + 8*NMAX + 5, $ NMAX*PMAX + 2*NMAX ) ) * .. Local Scalars .. DOUBLE PRECISION FACTOR INTEGER I, INFO, J, M, N, NK, NP * .. Local Arrays .. LOGICAL BWORK(2*NMAX) INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), AK(LDA,NMAX), B(LDB,MMAX), $ BK(LDBK,PMAX), C(LDC,NMAX), CK(LDCK,NMAX), $ D(LDD,MMAX), DK(LDDK,PMAX), DWORK(LDWORK), $ RCOND( 2 ) * .. External Subroutines .. EXTERNAL SB10ID * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, NP IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE IF ( NP.LT.0 .OR. NP.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) NP ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,NP ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,NP ) READ ( NIN, FMT = * ) FACTOR CALL SB10ID( N, M, NP, A, LDA, B, LDB, C, LDC, D, LDD, $ FACTOR, NK, AK, LDAK, BK, LDBK, CK, LDCK, $ DK, LDDK, RCOND, IWORK, DWORK, LDWORK, $ BWORK, INFO ) IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, NK WRITE ( NOUT, FMT = 99992 ) ( AK(I,J), J = 1,NK ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NK WRITE ( NOUT, FMT = 99992 ) ( BK(I,J), J = 1,NP ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, M WRITE ( NOUT, FMT = 99992 ) ( CK(I,J), J = 1,NK ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99992 ) ( DK(I,J), J = 1,NP ) 40 CONTINUE WRITE( NOUT, FMT = 99993 ) WRITE( NOUT, FMT = 99991 ) ( RCOND(I), I = 1, 2 ) ELSE WRITE( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' SB10ID EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' INFO on exit from SB10ID =',I2) 99997 FORMAT (/' The controller state matrix AK is'/) 99996 FORMAT (/' The controller input matrix BK is'/) 99995 FORMAT (/' The controller output matrix CK is'/) 99994 FORMAT (/' The controller matrix DK is'/) 99993 FORMAT (/' The estimated condition numbers are'/) 99992 FORMAT (10(1X,F9.4)) 99991 FORMAT ( 2(1X,D12.5)) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' NP is out of range.',/' NP = ',I5) ENDProgram Data
SB10ID EXAMPLE PROGRAM DATA 6 2 3 -1.0 0.0 4.0 5.0 -3.0 -2.0 -2.0 4.0 -7.0 -2.0 0.0 3.0 -6.0 9.0 -5.0 0.0 2.0 -1.0 -8.0 4.0 7.0 -1.0 -3.0 0.0 2.0 5.0 8.0 -9.0 1.0 -4.0 3.0 -5.0 8.0 0.0 2.0 -6.0 -3.0 -4.0 2.0 0.0 -5.0 -7.0 4.0 -6.0 -3.0 9.0 1.0 -2.0 1.0 -1.0 2.0 -4.0 0.0 -3.0 -3.0 0.0 5.0 -1.0 1.0 1.0 -7.0 5.0 0.0 -8.0 2.0 -2.0 1.0 -2.0 0.0 4.0 5.0 -3.0 1.0Program Results
SB10ID EXAMPLE PROGRAM RESULTS The controller state matrix AK is -39.0671 9.9293 22.2322 -27.4113 43.8655 -6.6117 3.0006 11.0878 -11.4130 15.4269 33.6805 -6.6934 -23.9953 14.1438 -33.4358 -32.3191 9.7316 25.4033 -24.0473 42.0517 -44.1655 18.7767 34.8873 -42.4369 50.8437 The controller input matrix BK is -10.2905 -16.5382 -10.9782 -4.3598 -8.7525 -5.1447 6.5962 1.8975 6.2316 -9.8770 -14.7041 -11.8778 -9.6726 -22.7309 -18.2692 The controller output matrix CK is -0.6647 -0.0599 -1.0376 0.5619 1.7297 -8.4202 3.9573 7.3094 -7.6283 10.6768 The controller matrix DK is 0.8466 0.4979 -0.6993 -1.2226 -4.8689 -4.5056 The estimated condition numbers are 0.13861D-01 0.90541D-02
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10JD.html 0000664 0000000 0000000 00000011572 14560147231 0020343 0 ustar 00root root 0000000 0000000
Purpose
To convert the descriptor state-space system E*dx/dt = A*x + B*u y = C*x + D*u into regular state-space form dx/dt = Ad*x + Bd*u y = Cd*x + Dd*u .Specification
SUBROUTINE SB10JD( N, M, NP, A, LDA, B, LDB, C, LDC, D, LDD, E, $ LDE, NSYS, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDWORK, M, N, $ NP, NSYS C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), DWORK( * ), E( LDE, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the descriptor system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state matrix A of the descriptor system. On exit, the leading NSYS-by-NSYS part of this array contains the state matrix Ad of the converted system. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B of the descriptor system. On exit, the leading NSYS-by-M part of this array contains the input matrix Bd of the converted system. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading NP-by-N part of this array must contain the output matrix C of the descriptor system. On exit, the leading NP-by-NSYS part of this array contains the output matrix Cd of the converted system. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading NP-by-M part of this array must contain the matrix D of the descriptor system. On exit, the leading NP-by-M part of this array contains the matrix Dd of the converted system. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the matrix E of the descriptor system. On exit, this array contains no useful information. LDE INTEGER The leading dimension of the array E. LDE >= max(1,N). NSYS (output) INTEGER The order of the converted state-space system.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= max( 1, 2*N*N + 2*N + N*MAX( 5, N + M + NP ) ). For good performance, LDWORK must generally be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the iteration for computing singular value decomposition did not converge.Method
The routine performs the transformations described in [1].References
[1] Chiang, R.Y. and Safonov, M.G. Robust Control Toolbox User's Guide. The MathWorks Inc., Natick, Mass., 1992.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrices of the positive feedback controller | Ak | Bk | K = |----|----| | Ck | Dk | for the shaped plant | A | B | G = |---|---| | C | 0 | in the Discrete-Time Loop Shaping Design Procedure.Specification
SUBROUTINE SB10KD( N, M, NP, A, LDA, B, LDB, C, LDC, FACTOR, $ AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, RCOND, $ IWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDDK, $ LDWORK, M, N, NP DOUBLE PRECISION FACTOR C .. Array Arguments .. INTEGER IWORK( * ) LOGICAL BWORK( * ) DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), $ DK( LDDK, * ), DWORK( * ), RCOND( 4 )Arguments
Input/Output Parameters
N (input) INTEGER The order of the plant. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A of the shaped plant. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B of the shaped plant. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C of the shaped plant. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). FACTOR (input) DOUBLE PRECISION = 1 implies that an optimal controller is required; > 1 implies that a suboptimal controller is required achieving a performance FACTOR less than optimal. FACTOR >= 1. AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix Ak. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NP) The leading N-by-NP part of this array contains the controller input matrix Bk. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading M-by-N part of this array contains the controller output matrix Ck. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,M). DK (output) DOUBLE PRECISION array, dimension (LDDK,NP) The leading M-by-NP part of this array contains the controller matrix Dk. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,M). RCOND (output) DOUBLE PRECISION array, dimension (4) RCOND(1) contains an estimate of the reciprocal condition number of the linear system of equations from which the solution of the P-Riccati equation is obtained; RCOND(2) contains an estimate of the reciprocal condition number of the linear system of equations from which the solution of the Q-Riccati equation is obtained; RCOND(3) contains an estimate of the reciprocal condition number of the linear system of equations from which the solution of the X-Riccati equation is obtained; RCOND(4) contains an estimate of the reciprocal condition number of the matrix Rx + Bx'*X*Bx (see the comments in the code).Workspace
IWORK INTEGER array, dimension (2*max(N,NP+M)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 15*N*N + 6*N + max( 14*N+23, 16*N, 2*N+NP+M, 3*(NP+M) ) + max( N*N, 11*N*NP + 2*M*M + 8*NP*NP + 8*M*N + 4*M*NP + NP ). For good performance, LDWORK must generally be larger. BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the P-Riccati equation is not solved successfully; = 2: the Q-Riccati equation is not solved successfully; = 3: the X-Riccati equation is not solved successfully; = 4: the iteration to compute eigenvalues failed to converge; = 5: the matrix Rx + Bx'*X*Bx is singular; = 6: the closed-loop system is unstable.Method
The routine implements the method presented in [1].References
[1] McFarlane, D. and Glover, K. A loop shaping design procedure using H_infinity synthesis. IEEE Trans. Automat. Control, vol. AC-37, no. 6, pp. 759-769, 1992.Numerical Aspects
The accuracy of the results depends on the conditioning of the two Riccati equations solved in the controller design. For better conditioning it is advised to take FACTOR > 1.Further Comments
NoneExample
Program Text
* SB10KD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 10, MMAX = 10, PMAX = 10 ) INTEGER LDA, LDAK, LDB, LDBK, LDC, LDCK, LDDK PARAMETER ( LDA = NMAX, LDAK = NMAX, LDB = NMAX, $ LDBK = NMAX, LDC = PMAX, LDCK = MMAX, $ LDDK = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 2*MAX( NMAX, MMAX + PMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 15*NMAX*NMAX + 6*NMAX + $ MAX( 14*NMAX + 23, 16*NMAX, $ 2*NMAX+PMAX+MMAX, $ 3*(PMAX+MMAX) ) + $ MAX( NMAX*NMAX, $ 11*NMAX*PMAX + 2*MMAX*MMAX + $ 8*PMAX*PMAX + 8*MMAX*NMAX + $ 4*MMAX*PMAX + PMAX ) ) * .. Local Scalars .. DOUBLE PRECISION FACTOR INTEGER I, INFO, J, M, N, NP * .. Local Arrays .. LOGICAL BWORK(2*NMAX) INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), AK(LDA,NMAX), B(LDB,MMAX), $ BK(LDBK,PMAX), C(LDC,NMAX), CK(LDCK,NMAX), $ DK(LDDK,PMAX), DWORK(LDWORK), RCOND(4) * .. External Subroutines .. EXTERNAL SB10KD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, NP IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE IF ( NP.LT.0 .OR. NP.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) NP ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,NP ) READ ( NIN, FMT = * ) FACTOR CALL SB10KD( N, M, NP, A, LDA, B, LDB, C, LDC, FACTOR, AK, $ LDAK, BK, LDBK, CK, LDCK, DK, LDDK, RCOND, $ IWORK, DWORK, LDWORK, BWORK, INFO ) IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( AK(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( BK(I,J), J = 1,NP ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, M WRITE ( NOUT, FMT = 99992 ) ( CK(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99992 ) ( DK(I,J), J = 1,NP ) 40 CONTINUE WRITE( NOUT, FMT = 99993 ) WRITE( NOUT, FMT = 99991 ) ( RCOND(I), I = 1, 4 ) ELSE WRITE( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' SB10KD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' INFO on exit from SB10KD =',I2) 99997 FORMAT (/' The controller state matrix AK is'/) 99996 FORMAT (/' The controller input matrix BK is'/) 99995 FORMAT (/' The controller output matrix CK is'/) 99994 FORMAT (/' The controller matrix DK is'/) 99993 FORMAT (/' The estimated condition numbers are'/) 99992 FORMAT (10(1X,F8.4)) 99991 FORMAT ( 5(1X,D12.5)) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' NP is out of range.',/' NP = ',I5) ENDProgram Data
SB10KD EXAMPLE PROGRAM DATA 6 2 2 0.2 0.0 0.3 0.0 -0.3 -0.1 -0.3 0.2 -0.4 -0.3 0.0 0.0 -0.1 0.1 -0.1 0.0 0.0 -0.3 0.1 0.0 0.0 -0.1 -0.1 0.0 0.0 0.3 0.6 0.2 0.1 -0.4 0.2 -0.4 0.0 0.0 0.2 -0.2 -1.0 -2.0 1.0 3.0 -3.0 -4.0 1.0 -2.0 0.0 1.0 1.0 5.0 1.0 -1.0 2.0 -2.0 0.0 -3.0 -3.0 0.0 1.0 -1.0 1.0 -1.0 1.1Program Results
SB10KD EXAMPLE PROGRAM RESULTS The controller state matrix AK is 0.0337 0.0222 0.0858 0.1264 -0.1872 0.1547 0.4457 0.0668 -0.2255 -0.3204 -0.4548 -0.0691 -0.2419 -0.2506 -0.0982 -0.1321 -0.0130 -0.0838 -0.4402 0.3654 -0.0335 -0.2444 0.6366 -0.6469 -0.3623 0.3854 0.4162 0.4502 0.0065 0.1261 -0.0121 -0.4377 0.0604 0.2265 -0.3389 0.4542 The controller input matrix BK is 0.0931 -0.0269 -0.0872 0.1599 0.0956 -0.1469 -0.1728 0.0129 0.2022 -0.1154 0.2419 -0.1737 The controller output matrix CK is -0.3677 0.2188 0.0403 -0.0854 0.3564 -0.3535 0.1624 -0.0708 0.0058 0.0606 -0.2163 0.1802 The controller matrix DK is -0.0857 -0.0246 0.0460 0.0074 The estimated condition numbers are 0.11269D-01 0.17596D-01 0.18225D+00 0.75968D-03
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10LD.html 0000664 0000000 0000000 00000016247 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To compute the matrices of the closed-loop system | AC | BC | G = |----|----|, | CC | DC | from the matrices of the open-loop system | A | B | P = |---|---| | C | D | and the matrices of the controller | AK | BK | K = |----|----|. | CK | DK |Specification
SUBROUTINE SB10LD( N, M, NP, NCON, NMEAS, A, LDA, B, LDB, C, LDC, $ D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, $ AC, LDAC, BC, LDBC, CC, LDCC, DC, LDDC, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAC, LDAK, LDB, LDBC, LDBK, LDC, $ LDCC, LDCK, LDD, LDDC, LDDK, LDWORK, M, N, $ NCON, NMEAS, NP C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), AC( LDAC, * ), AK( LDAK, * ), $ B( LDB, * ), BC( LDBC, * ), BK( LDBK, * ), $ C( LDC, * ), CC( LDCC, * ), CK( LDCK, * ), $ D( LDD, * ), DC( LDDC, * ), DK( LDDK, * ), $ DWORK( * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0. NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0. M-NCON >= NMEAS. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). AK (input) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array must contain the controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (input) DOUBLE PRECISION array, dimension (LDBK,NMEAS) The leading N-by-NMEAS part of this array must contain the controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (input) DOUBLE PRECISION array, dimension (LDCK,N) The leading NCON-by-N part of this array must contain the controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (input) DOUBLE PRECISION array, dimension (LDDK,NMEAS) The leading NCON-by-NMEAS part of this array must contain the controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON). AC (output) DOUBLE PRECISION array, dimension (LDAC,2*N) The leading 2*N-by-2*N part of this array contains the closed-loop system state matrix AC. LDAC INTEGER The leading dimension of the array AC. LDAC >= max(1,2*N). BC (output) DOUBLE PRECISION array, dimension (LDBC,M-NCON) The leading 2*N-by-(M-NCON) part of this array contains the closed-loop system input matrix BC. LDBC INTEGER The leading dimension of the array BC. LDBC >= max(1,2*N). CC (output) DOUBLE PRECISION array, dimension (LDCC,2*N) The leading (NP-NMEAS)-by-2*N part of this array contains the closed-loop system output matrix CC. LDCC INTEGER The leading dimension of the array CC. LDCC >= max(1,NP-NMEAS). DC (output) DOUBLE PRECISION array, dimension (LDDC,M-NCON) The leading (NP-NMEAS)-by-(M-NCON) part of this array contains the closed-loop system input/output matrix DC. LDDC INTEGER The leading dimension of the array DC. LDDC >= max(1,NP-NMEAS).Workspace
IWORK INTEGER array, dimension (2*max(NCON,NMEAS)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 2*M*M+NP*NP+2*M*N+M*NP+2*N*NP. For good performance, LDWORK must generally be larger. Error Indicactor INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix Inp2 - D22*DK is singular to working precision; = 2: if the matrix Im2 - DK*D22 is singular to working precision.Method
The routine implements the formulas given in [1].References
[1] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, Mass., 1995.Numerical Aspects
The accuracy of the result depends on the condition numbers of the matrices Inp2 - D22*DK and Im2 - DK*D22.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To perform the D-step in the D-K iteration. It handles continuous-time case.Specification
SUBROUTINE SB10MD( NC, MP, LENDAT, F, ORD, MNB, NBLOCK, ITYPE, $ QUTOL, A, LDA, B, LDB, C, LDC, D, LDD, OMEGA, $ TOTORD, AD, LDAD, BD, LDBD, CD, LDCD, DD, LDDD, $ MJU, IWORK, LIWORK, DWORK, LDWORK, ZWORK, $ LZWORK, INFO ) C .. Scalar Arguments .. INTEGER F, INFO, LDA, LDAD, LDB, LDBD, LDC, LDCD, LDD, $ LDDD, LDWORK, LENDAT, LIWORK, LZWORK, MNB, MP, $ NC, ORD, TOTORD DOUBLE PRECISION QUTOL C .. Array Arguments .. INTEGER ITYPE(*), IWORK(*), NBLOCK(*) DOUBLE PRECISION A(LDA, *), AD(LDAD, *), B(LDB, *), BD(LDBD, *), $ C(LDC, *), CD(LDCD, *), D(LDD, *), DD(LDDD, *), $ DWORK(*), MJU(*), OMEGA(*) COMPLEX*16 ZWORK(*)Arguments
Input/Output Parameters
NC (input) INTEGER The order of the matrix A. NC >= 0. MP (input) INTEGER The order of the matrix D. MP >= 0. LENDAT (input) INTEGER The length of the vector OMEGA. LENDAT >= 2. F (input) INTEGER The number of the measurements and controls, i.e., the size of the block I_f in the D-scaling system. F >= 0. ORD (input/output) INTEGER The MAX order of EACH block in the fitting procedure. ORD <= LENDAT-1. On exit, if ORD < 1 then ORD = 1. MNB (input) INTEGER The number of diagonal blocks in the block structure of the uncertainty, and the length of the vectors NBLOCK and ITYPE. 1 <= MNB <= MP. NBLOCK (input) INTEGER array, dimension (MNB) The vector of length MNB containing the block structure of the uncertainty. NBLOCK(I), I = 1:MNB, is the size of each block. ITYPE (input) INTEGER array, dimension (MNB) The vector of length MNB indicating the type of each block. For I = 1 : MNB, ITYPE(I) = 1 indicates that the corresponding block is a real block. IN THIS CASE ONLY MJU(JW) WILL BE ESTIMATED CORRECTLY, BUT NOT D(S)! ITYPE(I) = 2 indicates that the corresponding block is a complex block. THIS IS THE ONLY ALLOWED VALUE NOW! NBLOCK(I) must be equal to 1 if ITYPE(I) is equal to 1. QUTOL (input) DOUBLE PRECISION The acceptable mean relative error between the D(jw) and the frequency responce of the estimated block [ADi,BDi;CDi,DDi]. When it is reached, the result is taken as good enough. A good value is QUTOL = 2.0. If QUTOL < 0 then only mju(jw) is being estimated, not D(s). A (input/output) DOUBLE PRECISION array, dimension (LDA,NC) On entry, the leading NC-by-NC part of this array must contain the A matrix of the closed-loop system. On exit, if MP > 0, the leading NC-by-NC part of this array contains an upper Hessenberg matrix similar to A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,NC). B (input/output) DOUBLE PRECISION array, dimension (LDB,MP) On entry, the leading NC-by-MP part of this array must contain the B matrix of the closed-loop system. On exit, the leading NC-by-MP part of this array contains the transformed B matrix corresponding to the Hessenberg form of A. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,NC). C (input/output) DOUBLE PRECISION array, dimension (LDC,NC) On entry, the leading MP-by-NC part of this array must contain the C matrix of the closed-loop system. On exit, the leading MP-by-NC part of this array contains the transformed C matrix corresponding to the Hessenberg form of A. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,MP). D (input) DOUBLE PRECISION array, dimension (LDD,MP) The leading MP-by-MP part of this array must contain the D matrix of the closed-loop system. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,MP). OMEGA (input) DOUBLE PRECISION array, dimension (LENDAT) The vector with the frequencies. TOTORD (output) INTEGER The TOTAL order of the D-scaling system. TOTORD is set to zero, if QUTOL < 0. AD (output) DOUBLE PRECISION array, dimension (LDAD,MP*ORD) The leading TOTORD-by-TOTORD part of this array contains the A matrix of the D-scaling system. Not referenced if QUTOL < 0. LDAD INTEGER The leading dimension of the array AD. LDAD >= MAX(1,MP*ORD), if QUTOL >= 0; LDAD >= 1, if QUTOL < 0. BD (output) DOUBLE PRECISION array, dimension (LDBD,MP+F) The leading TOTORD-by-(MP+F) part of this array contains the B matrix of the D-scaling system. Not referenced if QUTOL < 0. LDBD INTEGER The leading dimension of the array BD. LDBD >= MAX(1,MP*ORD), if QUTOL >= 0; LDBD >= 1, if QUTOL < 0. CD (output) DOUBLE PRECISION array, dimension (LDCD,MP*ORD) The leading (MP+F)-by-TOTORD part of this array contains the C matrix of the D-scaling system. Not referenced if QUTOL < 0. LDCD INTEGER The leading dimension of the array CD. LDCD >= MAX(1,MP+F), if QUTOL >= 0; LDCD >= 1, if QUTOL < 0. DD (output) DOUBLE PRECISION array, dimension (LDDD,MP+F) The leading (MP+F)-by-(MP+F) part of this array contains the D matrix of the D-scaling system. Not referenced if QUTOL < 0. LDDD INTEGER The leading dimension of the array DD. LDDD >= MAX(1,MP+F), if QUTOL >= 0; LDDD >= 1, if QUTOL < 0. MJU (output) DOUBLE PRECISION array, dimension (LENDAT) The vector with the upper bound of the structured singular value (mju) for each frequency in OMEGA.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK INTEGER The length of the array IWORK. LIWORK >= MAX( NC, 4*MNB-2, MP, 2*ORD+1 ), if QUTOL >= 0; LIWORK >= MAX( NC, 4*MNB-2, MP ), if QUTOL < 0. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK, DWORK(2) returns the optimal value of LZWORK, and DWORK(3) returns an estimate of the minimum reciprocal of the condition numbers (with respect to inversion) of the generated Hessenberg matrices. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 3, LWM, LWD ), where LWM = LWA + MAX( NC + MAX( NC, MP-1 ), 2*MP*MP*MNB - MP*MP + 9*MNB*MNB + MP*MNB + 11*MP + 33*MNB - 11 ); LWD = LWB + MAX( 2, LW1, LW2, LW3, LW4, 2*ORD ), if QUTOL >= 0; LWD = 0, if QUTOL < 0; LWA = MP*LENDAT + 2*MNB + MP - 1; LWB = LENDAT*(MP + 2) + ORD*(ORD + 2) + 1; LW1 = 2*LENDAT + 4*HNPTS; HNPTS = 2048; LW2 = LENDAT + 6*HNPTS; MN = MIN( 2*LENDAT, 2*ORD+1 ); LW3 = 2*LENDAT*(2*ORD + 1) + MAX( 2*LENDAT, 2*ORD + 1 ) + MAX( MN + 6*ORD + 4, 2*MN + 1 ); LW4 = MAX( ORD*ORD + 5*ORD, 6*ORD + 1 + MIN( 1, ORD ) ). ZWORK COMPLEX*16 array, dimension (LZWORK) LZWORK INTEGER The length of the array ZWORK. LZWORK >= MAX( LZM, LZD ), where LZM = MAX( MP*MP + NC*MP + NC*NC + 2*NC, 6*MP*MP*MNB + 13*MP*MP + 6*MNB + 6*MP - 3 ); LZD = MAX( LENDAT*(2*ORD + 3), ORD*ORD + 3*ORD + 1 ), if QUTOL >= 0; LZD = 0, if QUTOL < 0.Error Indicator
INFO (output) INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if one or more values w in OMEGA are (close to some) poles of the closed-loop system, i.e., the matrix jw*I - A is (numerically) singular; = 2: the block sizes must be positive integers; = 3: the sum of block sizes must be equal to MP; = 4: the size of a real block must be equal to 1; = 5: the block type must be either 1 or 2; = 6: errors in solving linear equations or in matrix inversion; = 7: errors in computing eigenvalues or singular values. = 1i: INFO on exit from SB10YD is i. (1i means 10 + i.)Method
I. First, W(jw) for the given closed-loop system is being estimated. II. Now, AB13MD SLICOT subroutine can obtain the D(jw) scaling system with respect to NBLOCK and ITYPE, and colaterally, mju(jw). If QUTOL < 0 then the estimations stop and the routine exits. III. Now that we have D(jw), SB10YD subroutine can do block-by- block fit. For each block it tries with an increasing order of the fit, starting with 1 until the (mean quadratic error + max quadratic error)/2 between the Dii(jw) and the estimated frequency responce of the block becomes less than or equal to the routine argument QUTOL, or the order becomes equal to ORD. IV. Arrange the obtained blocks in the AD, BD, CD and DD matrices and estimate the total order of D(s), TOTORD. V. Add the system I_f to the system obtained in IV.References
[1] Balas, G., Doyle, J., Glover, K., Packard, A. and Smith, R. Mu-analysis and Synthesis toolbox - User's Guide, The Mathworks Inc., Natick, MA, USA, 1998.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10PD.html 0000664 0000000 0000000 00000020245 14560147231 0020346 0 ustar 00root root 0000000 0000000
Purpose
To reduce the matrices D12 and D21 of the linear time-invariant system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| | C1 | D11 D12 | | C | D | | C2 | D21 D22 | to unit diagonal form, to transform the matrices B, C, and D11 to satisfy the formulas in the computation of an H2 and H-infinity (sub)optimal controllers and to check the rank conditions.Specification
SUBROUTINE SB10PD( N, M, NP, NCON, NMEAS, A, LDA, B, LDB, C, LDC, $ D, LDD, TU, LDTU, TY, LDTY, RCOND, TOL, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDTU, LDTY, LDWORK, $ M, N, NCON, NMEAS, NP DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), DWORK( * ), RCOND( 2 ), $ TU( LDTU, * ), TY( LDTY, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the system input matrix B. On exit, the leading N-by-M part of this array contains the transformed system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading NP-by-N part of this array must contain the system output matrix C. On exit, the leading NP-by-N part of this array contains the transformed system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading NP-by-M part of this array must contain the system input/output matrix D. The NMEAS-by-NCON trailing submatrix D22 is not referenced. On exit, the leading (NP-NMEAS)-by-(M-NCON) part of this array contains the transformed submatrix D11. The transformed submatrices D12 = [ 0 Im2 ]' and D21 = [ 0 Inp2 ] are not stored. The corresponding part of this array contains no useful information. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). TU (output) DOUBLE PRECISION array, dimension (LDTU,M2) The leading M2-by-M2 part of this array contains the control transformation matrix TU. LDTU INTEGER The leading dimension of the array TU. LDTU >= max(1,M2). TY (output) DOUBLE PRECISION array, dimension (LDTY,NP2) The leading NP2-by-NP2 part of this array contains the measurement transformation matrix TY. LDTY INTEGER The leading dimension of the array TY. LDTY >= max(1,NP2). RCOND (output) DOUBLE PRECISION array, dimension (2) RCOND(1) contains the reciprocal condition number of the control transformation matrix TU; RCOND(2) contains the reciprocal condition number of the measurement transformation matrix TY. RCOND is set even if INFO = 3 or INFO = 4; if INFO = 3, then RCOND(2) was not computed, but it is set to 0.Tolerances
TOL DOUBLE PRECISION Tolerance used for controlling the accuracy of the applied transformations. Transformation matrices TU and TY whose reciprocal condition numbers are less than TOL are not allowed. If TOL <= 0, then a default value equal to sqrt(EPS) is used, where EPS is the relative machine precision.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX(1,LW1,LW2,LW3,LW4), where LW1 = (N+NP1+1)*(N+M2) + MAX(3*(N+M2)+N+NP1,5*(N+M2)), LW2 = (N+NP2)*(N+M1+1) + MAX(3*(N+NP2)+N+M1,5*(N+NP2)), LW3 = M2 + NP1*NP1 + MAX(NP1*MAX(N,M1),3*M2+NP1,5*M2), LW4 = NP2 + M1*M1 + MAX(MAX(N,NP1)*M1,3*NP2+M1,5*NP2), with M1 = M - M2 and NP1 = NP - NP2. For good performance, LDWORK must generally be larger. Denoting Q = MAX(M1,M2,NP1,NP2), an upper bound is MAX(1,(N+Q)*(N+Q+6),Q*(Q+MAX(N,Q,5)+1).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix | A B2 | had not full column rank | C1 D12 | in respect to the tolerance EPS; = 2: if the matrix | A B1 | had not full row rank in | C2 D21 | respect to the tolerance EPS; = 3: if the matrix D12 had not full column rank in respect to the tolerance TOL; = 4: if the matrix D21 had not full row rank in respect to the tolerance TOL; = 5: if the singular value decomposition (SVD) algorithm did not converge (when computing the SVD of one of the matrices |A B2 |, |A B1 |, D12 or D21). |C1 D12| |C2 D21|Method
The routine performs the transformations described in [2].References
[1] Glover, K. and Doyle, J.C. State-space formulae for all stabilizing controllers that satisfy an Hinf norm bound and relations to risk sensitivity. Systems and Control Letters, vol. 11, pp. 167-172, 1988. [2] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, Mass., 1995.Numerical Aspects
The precision of the transformations can be controlled by the condition numbers of the matrices TU and TY as given by the values of RCOND(1) and RCOND(2), respectively. An error return with INFO = 3 or INFO = 4 will be obtained if the condition number of TU or TY, respectively, would exceed 1/TOL.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the state feedback and the output injection matrices for an H-infinity (sub)optimal n-state controller, using Glover's and Doyle's 1988 formulas, for the system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| | C1 | D11 D12 | | C | D | | C2 | D21 D22 | and for a given value of gamma, where B2 has as column size the number of control inputs (NCON) and C2 has as row size the number of measurements (NMEAS) being provided to the controller. It is assumed that (A1) (A,B2) is stabilizable and (C2,A) is detectable, (A2) D12 is full column rank with D12 = | 0 | and D21 is | I | full row rank with D21 = | 0 I | as obtained by the subroutine SB10PD, (A3) | A-j*omega*I B2 | has full column rank for all omega, | C1 D12 | (A4) | A-j*omega*I B1 | has full row rank for all omega. | C2 D21 |Specification
SUBROUTINE SB10QD( N, M, NP, NCON, NMEAS, GAMMA, A, LDA, B, LDB, $ C, LDC, D, LDD, F, LDF, H, LDH, X, LDX, Y, LDY, $ XYCOND, IWORK, DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDF, LDH, LDWORK, $ LDX, LDY, M, N, NCON, NMEAS, NP DOUBLE PRECISION GAMMA C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * ), DWORK( * ), F( LDF, * ), $ H( LDH, * ), X( LDX, * ), XYCOND( 2 ), $ Y( LDY, * ) LOGICAL BWORK( * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. GAMMA (input) DOUBLE PRECISION The value of gamma. It is assumed that gamma is sufficiently large so that the controller is admissible. GAMMA >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). F (output) DOUBLE PRECISION array, dimension (LDF,N) The leading M-by-N part of this array contains the state feedback matrix F. LDF INTEGER The leading dimension of the array F. LDF >= max(1,M). H (output) DOUBLE PRECISION array, dimension (LDH,NP) The leading N-by-NP part of this array contains the output injection matrix H. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). X (output) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array contains the matrix X, solution of the X-Riccati equation. LDX INTEGER The leading dimension of the array X. LDX >= max(1,N). Y (output) DOUBLE PRECISION array, dimension (LDY,N) The leading N-by-N part of this array contains the matrix Y, solution of the Y-Riccati equation. LDY INTEGER The leading dimension of the array Y. LDY >= max(1,N). XYCOND (output) DOUBLE PRECISION array, dimension (2) XYCOND(1) contains an estimate of the reciprocal condition number of the X-Riccati equation; XYCOND(2) contains an estimate of the reciprocal condition number of the Y-Riccati equation.Workspace
IWORK INTEGER array, dimension (max(2*max(N,M-NCON,NP-NMEAS),N*N)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= max(1,M*M + max(2*M1,3*N*N + max(N*M,10*N*N+12*N+5)), NP*NP + max(2*NP1,3*N*N + max(N*NP,10*N*N+12*N+5))), where M1 = M - M2 and NP1 = NP - NP2. For good performance, LDWORK must generally be larger. Denoting Q = MAX(M1,M2,NP1,NP2), an upper bound is max(1,4*Q*Q+max(2*Q,3*N*N + max(2*N*Q,10*N*N+12*N+5))). BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the controller is not admissible (too small value of gamma); = 2: if the X-Riccati equation was not solved successfully (the controller is not admissible or there are numerical difficulties); = 3: if the Y-Riccati equation was not solved successfully (the controller is not admissible or there are numerical difficulties).Method
The routine implements the Glover's and Doyle's formulas [1],[2] modified as described in [3]. The X- and Y-Riccati equations are solved with condition and accuracy estimates [4].References
[1] Glover, K. and Doyle, J.C. State-space formulae for all stabilizing controllers that satisfy an Hinf norm bound and relations to risk sensitivity. Systems and Control Letters, vol. 11, pp. 167-172, 1988. [2] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, Mass., 1995. [3] Petkov, P.Hr., Gu, D.W., and Konstantinov, M.M. Fortran 77 routines for Hinf and H2 design of continuous-time linear control systems. Rep. 98-14, Department of Engineering, Leicester University, Leicester, U.K., 1998. [4] Petkov, P.Hr., Konstantinov, M.M., and Mehrmann, V. DGRSVX and DMSRIC: Fortan 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.Numerical Aspects
The precision of the solution of the matrix Riccati equations can be controlled by the values of the condition numbers XYCOND(1) and XYCOND(2) of these equations.Further Comments
The Riccati equations are solved by the Schur approach implementing condition and accuracy estimates.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrices of an H-infinity (sub)optimal controller | AK | BK | K = |----|----|, | CK | DK | from the state feedback matrix F and output injection matrix H as determined by the SLICOT Library routine SB10QD.Specification
SUBROUTINE SB10RD( N, M, NP, NCON, NMEAS, GAMMA, A, LDA, B, LDB, $ C, LDC, D, LDD, F, LDF, H, LDH, TU, LDTU, TY, $ LDTY, X, LDX, Y, LDY, AK, LDAK, BK, LDBK, CK, $ LDCK, DK, LDDK, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, $ LDDK, LDF, LDH, LDTU, LDTY, LDWORK, LDX, LDY, $ M, N, NCON, NMEAS, NP DOUBLE PRECISION GAMMA C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), $ D( LDD, * ), DK( LDDK, * ), DWORK( * ), $ F( LDF, * ), H( LDH, * ), TU( LDTU, * ), $ TY( LDTY, * ), X( LDX, * ), Y( LDY, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0. NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0. M-NCON >= NMEAS. GAMMA (input) DOUBLE PRECISION The value of gamma. It is assumed that gamma is sufficiently large so that the controller is admissible. GAMMA >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). F (input) DOUBLE PRECISION array, dimension (LDF,N) The leading M-by-N part of this array must contain the state feedback matrix F. LDF INTEGER The leading dimension of the array F. LDF >= max(1,M). H (input) DOUBLE PRECISION array, dimension (LDH,NP) The leading N-by-NP part of this array must contain the output injection matrix H. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). TU (input) DOUBLE PRECISION array, dimension (LDTU,M2) The leading M2-by-M2 part of this array must contain the control transformation matrix TU, as obtained by the SLICOT Library routine SB10PD. LDTU INTEGER The leading dimension of the array TU. LDTU >= max(1,M2). TY (input) DOUBLE PRECISION array, dimension (LDTY,NP2) The leading NP2-by-NP2 part of this array must contain the measurement transformation matrix TY, as obtained by the SLICOT Library routine SB10PD. LDTY INTEGER The leading dimension of the array TY. LDTY >= max(1,NP2). X (input) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array must contain the matrix X, solution of the X-Riccati equation, as obtained by the SLICOT Library routine SB10QD. LDX INTEGER The leading dimension of the array X. LDX >= max(1,N). Y (input) DOUBLE PRECISION array, dimension (LDY,N) The leading N-by-N part of this array must contain the matrix Y, solution of the Y-Riccati equation, as obtained by the SLICOT Library routine SB10QD. LDY INTEGER The leading dimension of the array Y. LDY >= max(1,N). AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NMEAS) The leading N-by-NMEAS part of this array contains the controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading NCON-by-N part of this array contains the controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (output) DOUBLE PRECISION array, dimension (LDDK,NMEAS) The leading NCON-by-NMEAS part of this array contains the controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON).Workspace
IWORK INTEGER array, dimension (LIWORK), where LIWORK = max(2*(max(NP,M)-M2-NP2,M2,N),NP2) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= max(1, M2*NP2 + NP2*NP2 + M2*M2 + max(D1*D1 + max(2*D1, (D1+D2)*NP2), D2*D2 + max(2*D2, D2*M2), 3*N, N*(2*NP2 + M2) + max(2*N*M2, M2*NP2 + max(M2*M2+3*M2, NP2*(2*NP2+ M2+max(NP2,N)))))) where D1 = NP1 - M2, D2 = M1 - NP2, NP1 = NP - NP2, M1 = M - M2. For good performance, LDWORK must generally be larger. Denoting Q = max(M1,M2,NP1,NP2), an upper bound is max( 1, Q*(3*Q + 3*N + max(2*N, 4*Q + max(Q, N)))).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the controller is not admissible (too small value of gamma); = 2: if the determinant of Im2 + Tu*D11HAT*Ty*D22 is zero.Method
The routine implements the Glover's and Doyle's formulas [1],[2].References
[1] Glover, K. and Doyle, J.C. State-space formulae for all stabilizing controllers that satisfy an Hinf norm bound and relations to risk sensitivity. Systems and Control Letters, vol. 11, pp. 167-172, 1988. [2] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, Mass., 1995.Numerical Aspects
The accuracy of the result depends on the condition numbers of the input and output transformations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrices of the H2 optimal controller | AK | BK | K = |----|----|, | CK | DK | for the normalized discrete-time system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| | C1 | D11 D12 | | C | D | | C2 | D21 0 | where B2 has as column size the number of control inputs (NCON) and C2 has as row size the number of measurements (NMEAS) being provided to the controller. It is assumed that (A1) (A,B2) is stabilizable and (C2,A) is detectable, (A2) D12 is full column rank with D12 = | 0 | and D21 is | I | full row rank with D21 = | 0 I | as obtained by the SLICOT Library routine SB10PD, j*Theta (A3) | A-e *I B2 | has full column rank for all | C1 D12 | 0 <= Theta < 2*Pi , j*Theta (A4) | A-e *I B1 | has full row rank for all | C2 D21 | 0 <= Theta < 2*Pi .Specification
SUBROUTINE SB10SD( N, M, NP, NCON, NMEAS, A, LDA, B, LDB, C, LDC, $ D, LDD, AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, $ X, LDX, Y, LDY, RCOND, TOL, IWORK, DWORK, $ LDWORK, BWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, $ LDDK, LDWORK, LDX, LDY, M, N, NCON, NMEAS, NP DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), $ D( LDD, * ), DK( LDDK, * ), DWORK( * ), $ RCOND( * ), X( LDX, * ), Y( LDY, * ) LOGICAL BWORK( * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. Only the leading (NP-NP2)-by-(M-M2) submatrix D11 is used. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NMEAS) The leading N-by-NMEAS part of this array contains the controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading NCON-by-N part of this array contains the controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (output) DOUBLE PRECISION array, dimension (LDDK,NMEAS) The leading NCON-by-NMEAS part of this array contains the controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON). X (output) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array contains the matrix X, solution of the X-Riccati equation. LDX INTEGER The leading dimension of the array X. LDX >= max(1,N). Y (output) DOUBLE PRECISION array, dimension (LDY,N) The leading N-by-N part of this array contains the matrix Y, solution of the Y-Riccati equation. LDY INTEGER The leading dimension of the array Y. LDY >= max(1,N). RCOND (output) DOUBLE PRECISION array, dimension (4) RCOND contains estimates of the reciprocal condition numbers of the matrices which are to be inverted and the reciprocal condition numbers of the Riccati equations which have to be solved during the computation of the controller. (See the description of the algorithm in [2].) RCOND(1) contains the reciprocal condition number of the matrix Im2 + B2'*X2*B2; RCOND(2) contains the reciprocal condition number of the matrix Ip2 + C2*Y2*C2'; RCOND(3) contains the reciprocal condition number of the X-Riccati equation; RCOND(4) contains the reciprocal condition number of the Y-Riccati equation.Tolerances
TOL DOUBLE PRECISION Tolerance used in determining the nonsingularity of the matrices which must be inverted. If TOL <= 0, then a default value equal to sqrt(EPS) is used, where EPS is the relative machine precision.Workspace
IWORK INTEGER array, dimension (max(M2,2*N,N*N,NP2)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= max(1, 14*N*N+6*N+max(14*N+23,16*N), M2*(N+M2+max(3,M1)), NP2*(N+NP2+3)), where M1 = M - M2. For good performance, LDWORK must generally be larger. BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the X-Riccati equation was not solved successfully; = 2: if the matrix Im2 + B2'*X2*B2 is not positive definite, or it is numerically singular (with respect to the tolerance TOL); = 3: if the Y-Riccati equation was not solved successfully; = 4: if the matrix Ip2 + C2*Y2*C2' is not positive definite, or it is numerically singular (with respect to the tolerance TOL).Method
The routine implements the formulas given in [1]. The X- and Y-Riccati equations are solved with condition estimates.References
[1] Zhou, K., Doyle, J.C., and Glover, K. Robust and Optimal Control. Prentice-Hall, Upper Saddle River, NJ, 1996. [2] Petkov, P.Hr., Gu, D.W., and Konstantinov, M.M. Fortran 77 routines for Hinf and H2 design of linear discrete-time control systems. Report 99-8, Department of Engineering, Leicester University, April 1999.Numerical Aspects
The accuracy of the result depends on the condition numbers of the matrices which are to be inverted and on the condition numbers of the matrix Riccati equations which are to be solved in the computation of the controller. (The corresponding reciprocal condition numbers are given in the output array RCOND.)Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrices of the H2 optimal discrete-time controller | AK | BK | K = |----|----|, | CK | DK | from the matrices of the controller for the normalized system, as determined by the SLICOT Library routine SB10SD.Specification
SUBROUTINE SB10TD( N, M, NP, NCON, NMEAS, D, LDD, TU, LDTU, TY, $ LDTY, AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, $ RCOND, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDAK, LDBK, LDCK, LDD, LDDK, LDTU, LDTY, $ LDWORK, M, N, NCON, NMEAS, NP DOUBLE PRECISION RCOND, TOL C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION AK( LDAK, * ), BK( LDBK, * ), CK( LDCK, * ), $ D( LDD, * ), DK( LDDK, * ), DWORK( * ), $ TU( LDTU, * ), TY( LDTY, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0. NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0. M-NCON >= NMEAS. D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. Only the trailing NMEAS-by-NCON submatrix D22 is used. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). TU (input) DOUBLE PRECISION array, dimension (LDTU,M2) The leading M2-by-M2 part of this array must contain the control transformation matrix TU, as obtained by the SLICOT Library routine SB10PD. LDTU INTEGER The leading dimension of the array TU. LDTU >= max(1,M2). TY (input) DOUBLE PRECISION array, dimension (LDTY,NP2) The leading NP2-by-NP2 part of this array must contain the measurement transformation matrix TY, as obtained by the SLICOT Library routine SB10PD. LDTY INTEGER The leading dimension of the array TY. LDTY >= max(1,NP2). AK (input/output) DOUBLE PRECISION array, dimension (LDAK,N) On entry, the leading N-by-N part of this array must contain controller state matrix for the normalized system as obtained by the SLICOT Library routine SB10SD. On exit, the leading N-by-N part of this array contains controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (input/output) DOUBLE PRECISION array, dimension (LDBK,NMEAS) On entry, the leading N-by-NMEAS part of this array must contain controller input matrix for the normalized system as obtained by the SLICOT Library routine SB10SD. On exit, the leading N-by-NMEAS part of this array contains controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (input/output) DOUBLE PRECISION array, dimension (LDCK,N) On entry, the leading NCON-by-N part of this array must contain controller output matrix for the normalized system as obtained by the SLICOT Library routine SB10SD. On exit, the leading NCON-by-N part of this array contains controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (input/output) DOUBLE PRECISION array, dimension (LDDK,NMEAS) On entry, the leading NCON-by-NMEAS part of this array must contain controller matrix DK for the normalized system as obtained by the SLICOT Library routine SB10SD. On exit, the leading NCON-by-NMEAS part of this array contains controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON). RCOND (output) DOUBLE PRECISION RCOND contains an estimate of the reciprocal condition number of the matrix Im2 + DKHAT*D22 which must be inverted in the computation of the controller.Tolerances
TOL DOUBLE PRECISION Tolerance used in determining the nonsingularity of the matrix which must be inverted. If TOL <= 0, then a default value equal to sqrt(EPS) is used, where EPS is the relative machine precision.Workspace
IWORK INTEGER array, dimension (2*M2) DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The dimension of the array DWORK. LDWORK >= max(N*M2,N*NP2,M2*NP2,M2*M2+4*M2).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix Im2 + DKHAT*D22 is singular, or the estimated condition number is larger than or equal to 1/TOL.Method
The routine implements the formulas given in [1].References
[1] Zhou, K., Doyle, J.C., and Glover, K. Robust and Optimal Control. Prentice-Hall, Upper Saddle River, NJ, 1996. [2] Petkov, P.Hr., Gu, D.W., and Konstantinov, M.M. Fortran 77 routines for Hinf and H2 design of linear discrete-time control systems. Report 99-8, Department of Engineering, Leicester University, April 1999.Numerical Aspects
The accuracy of the result depends on the condition numbers of the input and output transformations and of the matrix Im2 + DKHAT*D22.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce the matrices D12 and D21 of the linear time-invariant system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| | C1 | 0 D12 | | C | D | | C2 | D21 D22 | to unit diagonal form, and to transform the matrices B and C to satisfy the formulas in the computation of the H2 optimal controller.Specification
SUBROUTINE SB10UD( N, M, NP, NCON, NMEAS, B, LDB, C, LDC, D, LDD, $ TU, LDTU, TY, LDTY, RCOND, TOL, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, LDB, LDC, LDD, LDTU, LDTY, LDWORK, M, N, $ NCON, NMEAS, NP DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION B( LDB, * ), C( LDC, * ), D( LDD, * ), $ DWORK( * ), RCOND( 2 ), TU( LDTU, * ), $ TY( LDTY, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the system input matrix B. On exit, the leading N-by-M part of this array contains the transformed system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading NP-by-N part of this array must contain the system output matrix C. On exit, the leading NP-by-N part of this array contains the transformed system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading NP-by-M part of this array must contain the system input/output matrix D. The (NP-NMEAS)-by-(M-NCON) leading submatrix D11 is not referenced. On exit, the trailing NMEAS-by-NCON part (in the leading NP-by-M part) of this array contains the transformed submatrix D22. The transformed submatrices D12 = [ 0 Im2 ]' and D21 = [ 0 Inp2 ] are not stored. The corresponding part of this array contains no useful information. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). TU (output) DOUBLE PRECISION array, dimension (LDTU,M2) The leading M2-by-M2 part of this array contains the control transformation matrix TU. LDTU INTEGER The leading dimension of the array TU. LDTU >= max(1,M2). TY (output) DOUBLE PRECISION array, dimension (LDTY,NP2) The leading NP2-by-NP2 part of this array contains the measurement transformation matrix TY. LDTY INTEGER The leading dimension of the array TY. LDTY >= max(1,NP2). RCOND (output) DOUBLE PRECISION array, dimension (2) RCOND(1) contains the reciprocal condition number of the control transformation matrix TU; RCOND(2) contains the reciprocal condition number of the measurement transformation matrix TY. RCOND is set even if INFO = 1 or INFO = 2; if INFO = 1, then RCOND(2) was not computed, but it is set to 0.Tolerances
TOL DOUBLE PRECISION Tolerance used for controlling the accuracy of the applied transformations. Transformation matrices TU and TY whose reciprocal condition numbers are less than TOL are not allowed. If TOL <= 0, then a default value equal to sqrt(EPS) is used, where EPS is the relative machine precision.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX( M2 + NP1*NP1 + MAX(NP1*N,3*M2+NP1,5*M2), NP2 + M1*M1 + MAX(M1*N,3*NP2+M1,5*NP2), N*M2, NP2*N, NP2*M2, 1 ) where M1 = M - M2 and NP1 = NP - NP2. For good performance, LDWORK must generally be larger. Denoting Q = MAX(M1,M2,NP1,NP2), an upper bound is MAX(1,Q*(Q+MAX(N,5)+1)).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the matrix D12 had not full column rank in respect to the tolerance TOL; = 2: if the matrix D21 had not full row rank in respect to the tolerance TOL; = 3: if the singular value decomposition (SVD) algorithm did not converge (when computing the SVD of D12 or D21).Method
The routine performs the transformations described in [1], [2].References
[1] Zhou, K., Doyle, J.C., and Glover, K. Robust and Optimal Control. Prentice-Hall, Upper Saddle River, NJ, 1996. [2] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, Mass., 1995.Numerical Aspects
The precision of the transformations can be controlled by the condition numbers of the matrices TU and TY as given by the values of RCOND(1) and RCOND(2), respectively. An error return with INFO = 1 or INFO = 2 will be obtained if the condition number of TU or TY, respectively, would exceed 1/TOL.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the state feedback and the output injection matrices for an H2 optimal n-state controller for the system | A | B1 B2 | | A | B | P = |----|---------| = |---|---| | C1 | 0 D12 | | C | D | | C2 | D21 D22 | where B2 has as column size the number of control inputs (NCON) and C2 has as row size the number of measurements (NMEAS) being provided to the controller. It is assumed that (A1) (A,B2) is stabilizable and (C2,A) is detectable, (A2) D12 is full column rank with D12 = | 0 | and D21 is | I | full row rank with D21 = | 0 I | as obtained by the SLICOT Library routine SB10UD. Matrix D is not used explicitly.Specification
SUBROUTINE SB10VD( N, M, NP, NCON, NMEAS, A, LDA, B, LDB, C, LDC, $ F, LDF, H, LDH, X, LDX, Y, LDY, XYCOND, IWORK, $ DWORK, LDWORK, BWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDF, LDH, LDWORK, LDX, $ LDY, M, N, NCON, NMEAS, NP C .. Array Arguments .. LOGICAL BWORK( * ) INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), F( LDF, * ), H( LDH, * ), $ X( LDX, * ), XYCOND( 2 ), Y( LDY, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0, NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0, M-NCON >= NMEAS. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). F (output) DOUBLE PRECISION array, dimension (LDF,N) The leading NCON-by-N part of this array contains the state feedback matrix F. LDF INTEGER The leading dimension of the array F. LDF >= max(1,NCON). H (output) DOUBLE PRECISION array, dimension (LDH,NMEAS) The leading N-by-NMEAS part of this array contains the output injection matrix H. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). X (output) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array contains the matrix X, solution of the X-Riccati equation. LDX INTEGER The leading dimension of the array X. LDX >= max(1,N). Y (output) DOUBLE PRECISION array, dimension (LDY,N) The leading N-by-N part of this array contains the matrix Y, solution of the Y-Riccati equation. LDY INTEGER The leading dimension of the array Y. LDY >= max(1,N). XYCOND (output) DOUBLE PRECISION array, dimension (2) XYCOND(1) contains an estimate of the reciprocal condition number of the X-Riccati equation; XYCOND(2) contains an estimate of the reciprocal condition number of the Y-Riccati equation.Workspace
IWORK INTEGER array, dimension (max(2*N,N*N)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 13*N*N + 12*N + 5. For good performance, LDWORK must generally be larger. BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the X-Riccati equation was not solved successfully; = 2: if the Y-Riccati equation was not solved successfully.Method
The routine implements the formulas given in [1], [2]. The X- and Y-Riccati equations are solved with condition and accuracy estimates [3].References
[1] Zhou, K., Doyle, J.C., and Glover, K. Robust and Optimal Control. Prentice-Hall, Upper Saddle River, NJ, 1996. [2] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, Mass., 1995. [3] Petkov, P.Hr., Konstantinov, M.M., and Mehrmann, V. DGRSVX and DMSRIC: Fortan 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.Numerical Aspects
The precision of the solution of the matrix Riccati equations can be controlled by the values of the condition numbers XYCOND(1) and XYCOND(2) of these equations.Further Comments
The Riccati equations are solved by the Schur approach implementing condition and accuracy estimates.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrices of the H2 optimal controller | AK | BK | K = |----|----|, | CK | DK | from the state feedback matrix F and output injection matrix H as determined by the SLICOT Library routine SB10VD.Specification
SUBROUTINE SB10WD( N, M, NP, NCON, NMEAS, A, LDA, B, LDB, C, LDC, $ D, LDD, F, LDF, H, LDH, TU, LDTU, TY, LDTY, $ AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, $ LDDK, LDF, LDH, LDTU, LDTY, M, N, NCON, NMEAS, $ NP C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), $ D( LDD, * ), DK( LDDK, * ), F( LDF, * ), $ H( LDH, * ), TU( LDTU, * ), TY( LDTY, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. NCON (input) INTEGER The number of control inputs (M2). M >= NCON >= 0. NP-NMEAS >= NCON. NMEAS (input) INTEGER The number of measurements (NP2). NP >= NMEAS >= 0. M-NCON >= NMEAS. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B. Only the submatrix B2 = B(:,M-M2+1:M) is used. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C. Only the submatrix C2 = C(NP-NP2+1:NP,:) is used. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D. Only the submatrix D22 = D(NP-NP2+1:NP,M-M2+1:M) is used. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). F (input) DOUBLE PRECISION array, dimension (LDF,N) The leading NCON-by-N part of this array must contain the state feedback matrix F. LDF INTEGER The leading dimension of the array F. LDF >= max(1,NCON). H (input) DOUBLE PRECISION array, dimension (LDH,NMEAS) The leading N-by-NMEAS part of this array must contain the output injection matrix H. LDH INTEGER The leading dimension of the array H. LDH >= max(1,N). TU (input) DOUBLE PRECISION array, dimension (LDTU,M2) The leading M2-by-M2 part of this array must contain the control transformation matrix TU, as obtained by the SLICOT Library routine SB10UD. LDTU INTEGER The leading dimension of the array TU. LDTU >= max(1,M2). TY (input) DOUBLE PRECISION array, dimension (LDTY,NP2) The leading NP2-by-NP2 part of this array must contain the measurement transformation matrix TY, as obtained by the SLICOT Library routine SB10UD. LDTY INTEGER The leading dimension of the array TY. LDTY >= max(1,NP2). AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix AK. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NMEAS) The leading N-by-NMEAS part of this array contains the controller input matrix BK. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading NCON-by-N part of this array contains the controller output matrix CK. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,NCON). DK (output) DOUBLE PRECISION array, dimension (LDDK,NMEAS) The leading NCON-by-NMEAS part of this array contains the controller input/output matrix DK. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,NCON).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine implements the formulas given in [1], [2].References
[1] Zhou, K., Doyle, J.C., and Glover, K. Robust and Optimal Control. Prentice-Hall, Upper Saddle River, NJ, 1996. [2] Balas, G.J., Doyle, J.C., Glover, K., Packard, A., and Smith, R. mu-Analysis and Synthesis Toolbox. The MathWorks Inc., Natick, Mass., 1995.Numerical Aspects
The accuracy of the result depends on the condition numbers of the input and output transformations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To fit a supplied frequency response data with a stable, minimum phase SISO (single-input single-output) system represented by its matrices A, B, C, D. It handles both discrete- and continuous-time cases.Specification
SUBROUTINE SB10YD( DISCFL, FLAG, LENDAT, RFRDAT, IFRDAT, OMEGA, N, $ A, LDA, B, C, D, TOL, IWORK, DWORK, LDWORK, $ ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. INTEGER DISCFL, FLAG, INFO, LDA, LDWORK, LENDAT, $ LZWORK, N DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA, *), B(*), C(*), D(*), DWORK(*), $ IFRDAT(*), OMEGA(*), RFRDAT(*) COMPLEX*16 ZWORK(*)Arguments
Input/Output Parameters
DISCFL (input) INTEGER Indicates the type of the system, as follows: = 0: continuous-time system; = 1: discrete-time system. FLAG (input) INTEGER If FLAG = 0, then the system zeros and poles are not constrained. If FLAG = 1, then the system zeros and poles will have negative real parts in the continuous-time case, or moduli less than 1 in the discrete-time case. Consequently, FLAG must be equal to 1 in mu-synthesis routines. LENDAT (input) INTEGER The length of the vectors RFRDAT, IFRDAT and OMEGA. LENDAT >= 2. RFRDAT (input) DOUBLE PRECISION array, dimension (LENDAT) The real part of the frequency data to be fitted. IFRDAT (input) DOUBLE PRECISION array, dimension (LENDAT) The imaginary part of the frequency data to be fitted. OMEGA (input) DOUBLE PRECISION array, dimension (LENDAT) The frequencies corresponding to RFRDAT and IFRDAT. These values must be nonnegative and monotonically increasing. Additionally, for discrete-time systems they must be between 0 and PI. N (input/output) INTEGER On entry, the desired order of the system to be fitted. N <= LENDAT-1. On exit, the order of the obtained system. The value of N could only be modified if N > 0 and FLAG = 1. A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array contains the matrix A. If FLAG = 1, then A is in an upper Hessenberg form, and corresponds to a minimal realization. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (output) DOUBLE PRECISION array, dimension (N) The computed vector B. C (output) DOUBLE PRECISION array, dimension (N) The computed vector C. If FLAG = 1, the first N-1 elements are zero (for the exit value of N). D (output) DOUBLE PRECISION array, dimension (1) The computed scalar D.Tolerances
TOL DOUBLE PRECISION The tolerance to be used for determining the effective rank of matrices. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = SIZE*EPS, is used instead, where SIZE is the product of the matrix dimensions, and EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (max(2,2*N+1)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK and DWORK(2) contains the optimal value of LZWORK. LDWORK INTEGER The length of the array DWORK. LDWORK = max( 2, LW1, LW2, LW3, LW4 ), where LW1 = 2*LENDAT + 4*HNPTS; HNPTS = 2048; LW2 = LENDAT + 6*HNPTS; MN = min( 2*LENDAT, 2*N+1 ) LW3 = 2*LENDAT*(2*N+1) + max( 2*LENDAT, 2*N+1 ) + max( MN + 6*N + 4, 2*MN + 1 ), if N > 0; LW3 = 4*LENDAT + 5 , if N = 0; LW4 = max( N*N + 5*N, 6*N + 1 + min( 1,N ) ), if FLAG = 1; LW4 = 0, if FLAG = 0. For optimum performance LDWORK should be larger. ZWORK COMPLEX*16 array, dimension (LZWORK) LZWORK INTEGER The length of the array ZWORK. LZWORK = LENDAT*(2*N+3), if N > 0; LZWORK = LENDAT, if N = 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the discrete --> continuous transformation cannot be made; = 2: if the system poles cannot be found; = 3: if the inverse system cannot be found, i.e., D is (close to) zero; = 4: if the system zeros cannot be found; = 5: if the state-space representation of the new transfer function T(s) cannot be found; = 6: if the continuous --> discrete transformation cannot be made.Method
First, if the given frequency data are corresponding to a continuous-time system, they are changed to a discrete-time system using a bilinear transformation with a scaled alpha. Then, the magnitude is obtained from the supplied data. Then, the frequency data are linearly interpolated around the unit-disc. Then, Oppenheim and Schafer complex cepstrum method is applied to get frequency data corresponding to a stable, minimum- phase system. This is done in the following steps: - Obtain LOG (magnitude) - Obtain IFFT of the result (DG01MD SLICOT subroutine); - halve the data at 0; - Obtain FFT of the halved data (DG01MD SLICOT subroutine); - Obtain EXP of the result. Then, the new frequency data are interpolated back to the original frequency. Then, based on these newly obtained data, the system matrices A, B, C, D are constructed; the very identification is performed by Least Squares Method using DGELSY LAPACK subroutine. If needed, a discrete-to-continuous time transformation is applied on the system matrices by AB04MD SLICOT subroutine. Finally, if requested, the poles and zeros of the system are checked. If some of them have positive real parts in the continuous-time case (or are not inside the unit disk in the complex plane in the discrete-time case), they are exchanged with their negatives (or reciprocals, respectively), to preserve the frequency response, while getting a minimum phase and stable system. This is done by SB10ZP SLICOT subroutine.References
[1] Oppenheim, A.V. and Schafer, R.W. Discrete-Time Signal Processing. Prentice-Hall Signal Processing Series, 1989. [2] Balas, G., Doyle, J., Glover, K., Packard, A., and Smith, R. Mu-analysis and Synthesis toolbox - User's Guide, The Mathworks Inc., Natick, MA, USA, 1998.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the matrices of the positive feedback controller | Ak | Bk | K = |----|----| | Ck | Dk | for the shaped plant | A | B | G = |---|---| | C | D | in the Discrete-Time Loop Shaping Design Procedure.Specification
SUBROUTINE SB10ZD( N, M, NP, A, LDA, B, LDB, C, LDC, D, LDD, $ FACTOR, AK, LDAK, BK, LDBK, CK, LDCK, DK, $ LDDK, RCOND, TOL, IWORK, DWORK, LDWORK, BWORK, $ INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, $ LDDK, LDWORK, M, N, NP DOUBLE PRECISION FACTOR, TOL C .. Array Arguments .. INTEGER IWORK( * ) LOGICAL BWORK( * ) DOUBLE PRECISION A ( LDA, * ), AK( LDAK, * ), B ( LDB, * ), $ BK( LDBK, * ), C ( LDC, * ), CK( LDCK, * ), $ D ( LDD, * ), DK( LDDK, * ), DWORK( * ), $ RCOND( 6 )Arguments
Input/Output Parameters
N (input) INTEGER The order of the plant. N >= 0. M (input) INTEGER The column size of the matrix B. M >= 0. NP (input) INTEGER The row size of the matrix C. NP >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the system state matrix A of the shaped plant. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the system input matrix B of the shaped plant. LDB INTEGER The leading dimension of the array B. LDB >= max(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading NP-by-N part of this array must contain the system output matrix C of the shaped plant. LDC INTEGER The leading dimension of the array C. LDC >= max(1,NP). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading NP-by-M part of this array must contain the system input/output matrix D of the shaped plant. LDD INTEGER The leading dimension of the array D. LDD >= max(1,NP). FACTOR (input) DOUBLE PRECISION = 1 implies that an optimal controller is required (not recommended); > 1 implies that a suboptimal controller is required achieving a performance FACTOR less than optimal. FACTOR >= 1. AK (output) DOUBLE PRECISION array, dimension (LDAK,N) The leading N-by-N part of this array contains the controller state matrix Ak. LDAK INTEGER The leading dimension of the array AK. LDAK >= max(1,N). BK (output) DOUBLE PRECISION array, dimension (LDBK,NP) The leading N-by-NP part of this array contains the controller input matrix Bk. LDBK INTEGER The leading dimension of the array BK. LDBK >= max(1,N). CK (output) DOUBLE PRECISION array, dimension (LDCK,N) The leading M-by-N part of this array contains the controller output matrix Ck. LDCK INTEGER The leading dimension of the array CK. LDCK >= max(1,M). DK (output) DOUBLE PRECISION array, dimension (LDDK,NP) The leading M-by-NP part of this array contains the controller matrix Dk. LDDK INTEGER The leading dimension of the array DK. LDDK >= max(1,M). RCOND (output) DOUBLE PRECISION array, dimension (6) RCOND(1) contains an estimate of the reciprocal condition number of the linear system of equations from which the solution of the P-Riccati equation is obtained; RCOND(2) contains an estimate of the reciprocal condition number of the linear system of equations from which the solution of the Q-Riccati equation is obtained; RCOND(3) contains an estimate of the reciprocal condition number of the matrix (gamma^2-1)*In - P*Q; RCOND(4) contains an estimate of the reciprocal condition number of the matrix Rx + Bx'*X*Bx; RCOND(5) contains an estimate of the reciprocal condition ^ number of the matrix Ip + D*Dk; RCOND(6) contains an estimate of the reciprocal condition ^ number of the matrix Im + Dk*D.Tolerances
TOL DOUBLE PRECISION Tolerance used for checking the nonsingularity of the matrices to be inverted. If TOL <= 0, then a default value equal to sqrt(EPS) is used, where EPS is the relative machine precision. TOL < 1.Workspace
IWORK INTEGER array, dimension (2*max(N,M+NP)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 16*N*N + 5*M*M + 7*NP*NP + 6*M*N + 7*M*NP + 7*N*NP + 6*N + 2*(M + NP) + max(14*N+23,16*N,2*M-1,2*NP-1). For good performance, LDWORK must generally be larger. BWORK LOGICAL array, dimension (2*N)Error Indicator
INFO (output) INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the P-Riccati equation is not solved successfully; = 2: the Q-Riccati equation is not solved successfully; = 3: the iteration to compute eigenvalues or singular values failed to converge; = 4: the matrix (gamma^2-1)*In - P*Q is singular; = 5: the matrix Rx + Bx'*X*Bx is singular; ^ = 6: the matrix Ip + D*Dk is singular; ^ = 7: the matrix Im + Dk*D is singular; = 8: the matrix Ip - D*Dk is singular; = 9: the matrix Im - Dk*D is singular; = 10: the closed-loop system is unstable.Method
The routine implements the formulas given in [1].References
[1] Gu, D.-W., Petkov, P.H., and Konstantinov, M.M. On discrete H-infinity loop shaping design procedure routines. Technical Report 00-6, Dept. of Engineering, Univ. of Leicester, UK, 2000.Numerical Aspects
The accuracy of the results depends on the conditioning of the two Riccati equations solved in the controller design. For better conditioning it is advised to take FACTOR > 1.Further Comments
NoneExample
Program Text
* SB10ZD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX, PMAX PARAMETER ( MMAX = 10, NMAX = 10, PMAX = 10 ) INTEGER LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, LDDK PARAMETER ( LDA = NMAX, LDAK = NMAX, LDB = NMAX, $ LDBK = NMAX, LDC = PMAX, LDCK = MMAX, $ LDD = PMAX, LDDK = MMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 2*MAX( NMAX, MMAX + PMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 16*NMAX*NMAX + 5*MMAX*MMAX + $ 7*PMAX*PMAX + 6*MMAX*NMAX + $ 7*MMAX*PMAX + 7*NMAX*PMAX + 6*NMAX + $ 2*( MMAX + PMAX ) + $ MAX( 14*NMAX + 23, 16*NMAX, $ 2*MMAX - 1, 2*PMAX - 1 ) ) * .. Local Scalars .. DOUBLE PRECISION FACTOR, TOL INTEGER I, INFO, J, M, N, NP * .. Local Arrays .. LOGICAL BWORK(2*NMAX) INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), AK(LDAK,NMAX), B(LDB,MMAX), $ BK(LDBK,PMAX), C(LDC,NMAX), CK(LDCK,NMAX), $ D(LDD,MMAX), DK(LDDK,PMAX), DWORK(LDWORK), $ RCOND( 6 ) * .. External Subroutines .. EXTERNAL SB10ZD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, NP IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE IF ( NP.LT.0 .OR. NP.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) NP ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,NP ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,NP ) READ ( NIN, FMT = * ) FACTOR, TOL CALL SB10ZD( N, M, NP, A, LDA, B, LDB, C, LDC, D, LDD, FACTOR, $ AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, RCOND, $ TOL, IWORK, DWORK, LDWORK, BWORK, INFO ) IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( AK(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99992 ) ( BK(I,J), J = 1,NP ) 20 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 30 I = 1, M WRITE ( NOUT, FMT = 99992 ) ( CK(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99992 ) ( DK(I,J), J = 1,NP ) 40 CONTINUE WRITE( NOUT, FMT = 99993 ) WRITE( NOUT, FMT = 99991 ) ( RCOND(I), I = 1,6 ) ELSE WRITE( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' SB10ZD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (/' INFO on exit from SB10ZD =',I2) 99997 FORMAT (/' The controller state matrix AK is'/) 99996 FORMAT (/' The controller input matrix BK is'/) 99995 FORMAT (/' The controller output matrix CK is'/) 99994 FORMAT (/' The controller matrix DK is'/) 99993 FORMAT (/' The estimated condition numbers are'/) 99992 FORMAT (10(1X,F8.4)) 99991 FORMAT ( 5(1X,D12.5)) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' NP is out of range.',/' NP = ',I5) ENDProgram Data
SB10LD EXAMPLE PROGRAM DATA 6 2 3 0.2 0.0 3.0 0.0 -0.3 -0.1 -3.0 0.2 -0.4 -0.3 0.0 0.0 -0.1 0.1 -1.0 0.0 0.0 -3.0 1.0 0.0 0.0 -1.0 -1.0 0.0 0.0 0.3 0.6 2.0 0.1 -0.4 0.2 -4.0 0.0 0.0 0.2 -2.0 -1.0 -2.0 1.0 3.0 -3.0 -4.0 1.0 -2.0 0.0 1.0 1.0 5.0 1.0 -1.0 2.0 -2.0 0.0 -3.0 -3.0 0.0 1.0 -1.0 1.0 -1.0 2.0 4.0 -3.0 0.0 5.0 1.0 10.0 -6.0 -7.0 8.0 2.0 -4.0 1.1 0.0Program Results
SB10ZD EXAMPLE PROGRAM RESULTS The controller state matrix AK is 1.0128 0.5101 -0.1546 1.1300 3.3759 0.4911 -2.1257 -1.4517 -0.4486 0.3493 -1.5506 -1.4296 -1.0930 -0.6026 -0.1344 0.2253 -1.5625 -0.6762 0.3207 0.1698 0.2376 -1.1781 -0.8705 0.2896 0.5017 0.9006 0.0668 2.3613 0.2049 0.3703 1.0787 0.6703 0.2783 -0.7213 0.4918 0.7435 The controller input matrix BK is 0.4132 0.3112 -0.8077 0.2140 0.4253 0.1811 -0.0710 0.0807 0.3558 -0.0121 -0.2019 0.0249 0.1047 0.1399 -0.0457 -0.2542 -0.3472 0.0523 The controller output matrix CK is -0.0372 -0.0456 -0.0040 0.0962 -0.2059 -0.0571 0.1999 0.2994 0.1335 -0.0251 -0.3108 0.2048 The controller matrix DK is 0.0629 -0.0022 0.0363 -0.0228 0.0195 0.0600 The estimated condition numbers are 0.27949D-03 0.66679D-03 0.45677D-01 0.23433D-07 0.68495D-01 0.76854D-01
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB10ZP.html 0000664 0000000 0000000 00000012445 14560147231 0020377 0 ustar 00root root 0000000 0000000
Purpose
To transform a SISO (single-input single-output) system [A,B;C,D] by mirroring its unstable poles and zeros in the boundary of the stability domain, thus preserving the frequency response of the system, but making it stable and minimum phase. Specifically, for a continuous-time system, the positive real parts of its poles and zeros are exchanged with their negatives. Discrete-time systems are first converted to continuous-time systems using a bilinear transformation, and finally converted back.Specification
SUBROUTINE SB10ZP( DISCFL, N, A, LDA, B, C, D, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER DISCFL, INFO, LDA, LDWORK, N C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( * ), C( * ), D( * ), DWORK( * )Arguments
Input/Output Parameters
DISCFL (input) INTEGER Indicates the type of the system, as follows: = 0: continuous-time system; = 1: discrete-time system. N (input/output) INTEGER On entry, the order of the original system. N >= 0. On exit, the order of the transformed, minimal system. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original system matrix A. On exit, the leading N-by-N part of this array contains the transformed matrix A, in an upper Hessenberg form. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the original system vector B. On exit, this array contains the transformed vector B. C (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the original system vector C. On exit, this array contains the transformed vector C. The first N-1 elements are zero (for the exit value of N). D (input/output) DOUBLE PRECISION array, dimension (1) On entry, this array must contain the original system scalar D. On exit, this array contains the transformed scalar D.Workspace
IWORK INTEGER array, dimension (max(2,N+1)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= max(N*N + 5*N, 6*N + 1 + min(1,N)). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the discrete --> continuous transformation cannot be made; = 2: if the system poles cannot be found; = 3: if the inverse system cannot be found, i.e., D is (close to) zero; = 4: if the system zeros cannot be found; = 5: if the state-space representation of the new transfer function T(s) cannot be found; = 6: if the continuous --> discrete transformation cannot be made.Method
First, if the system is discrete-time, it is transformed to continuous-time using alpha = beta = 1 in the bilinear transformation implemented in the SLICOT routine AB04MD. Then the eigenvalues of A, i.e., the system poles, are found. Then, the inverse of the original system is found and its poles, i.e., the system zeros, are evaluated. The obtained system poles Pi and zeros Zi are checked and if a positive real part is detected, it is exchanged by -Pi or -Zi. Then the polynomial coefficients of the transfer function T(s) = Q(s)/P(s) are found. The state-space representation of T(s) is then obtained. The system matrices B, C, D are scaled so that the transformed system has the same system gain as the original system. If the original system is discrete-time, then the result (which is continuous-time) is converted back to discrete-time.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute a reduced order controller (Acr,Bcr,Ccr,Dcr) for an original state-space controller representation (Ac,Bc,Cc,Dc) by using the frequency-weighted square-root or balancing-free square-root Balance & Truncate (B&T) or Singular Perturbation Approximation (SPA) model reduction methods. The algorithm tries to minimize the norm of the frequency-weighted error ||V*(K-Kr)*W|| where K and Kr are the transfer-function matrices of the original and reduced order controllers, respectively. V and W are special frequency-weighting transfer-function matrices constructed to enforce closed-loop stability and/or closed-loop performance. If G is the transfer-function matrix of the open-loop system, then the following weightings V and W can be used: -1 (a) V = (I-G*K) *G, W = I - to enforce closed-loop stability; -1 (b) V = I, W = (I-G*K) *G - to enforce closed-loop stability; -1 -1 (c) V = (I-G*K) *G, W = (I-G*K) - to enforce closed-loop stability and performance. G has the state space representation (A,B,C,D). If K is unstable, only the ALPHA-stable part of K is reduced.Specification
SUBROUTINE SB16AD( DICO, JOBC, JOBO, JOBMR, WEIGHT, EQUIL, ORDSEL, $ N, M, P, NC, NCR, ALPHA, A, LDA, B, LDB, $ C, LDC, D, LDD, AC, LDAC, BC, LDBC, CC, LDCC, $ DC, LDDC, NCS, HSVC, TOL1, TOL2, IWORK, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOBC, JOBO, JOBMR, ORDSEL, WEIGHT INTEGER INFO, IWARN, LDA, LDAC, LDB, LDBC, LDC, LDCC, $ LDD, LDDC, LDWORK, M, N, NC, NCR, NCS, P DOUBLE PRECISION ALPHA, TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), AC(LDAC,*), B(LDB,*), BC(LDBC,*), $ C(LDC,*), CC(LDCC,*), D(LDD,*), DC(LDDC,*), $ DWORK(*), HSVC(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the original controller as follows: = 'C': continuous-time controller; = 'D': discrete-time controller. JOBC CHARACTER*1 Specifies the choice of frequency-weighted controllability Grammian as follows: = 'S': choice corresponding to standard Enns' method [1]; = 'E': choice corresponding to the stability enhanced modified Enns' method of [2]. JOBO CHARACTER*1 Specifies the choice of frequency-weighted observability Grammian as follows: = 'S': choice corresponding to standard Enns' method [1]; = 'E': choice corresponding to the stability enhanced modified combination method of [2]. JOBMR CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root B&T method; = 'F': use the balancing-free square-root B&T method; = 'S': use the square-root SPA method; = 'P': use the balancing-free square-root SPA method. WEIGHT CHARACTER*1 Specifies the type of frequency-weighting, as follows: = 'N': no weightings are used (V = I, W = I); = 'O': stability enforcing left (output) weighting -1 V = (I-G*K) *G is used (W = I); = 'I': stability enforcing right (input) weighting -1 W = (I-G*K) *G is used (V = I); = 'P': stability and performance enforcing weightings -1 -1 V = (I-G*K) *G , W = (I-G*K) are used. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplets (A,B,C) and (Ac,Bc,Cc) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting order NCR is fixed; = 'A': the resulting order NCR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the open-loop system state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NC (input) INTEGER The order of the controller state-space representation, i.e., the order of the matrix AC. NC >= 0. NCR (input/output) INTEGER On entry with ORDSEL = 'F', NCR is the desired order of the resulting reduced order controller. 0 <= NCR <= NC. On exit, if INFO = 0, NCR is the order of the resulting reduced order controller. For a controller with NCU ALPHA-unstable eigenvalues and NCS ALPHA-stable eigenvalues (NCU+NCS = NC), NCR is set as follows: if ORDSEL = 'F', NCR is equal to NCU+MIN(MAX(0,NCR-NCU),NCMIN), where NCR is the desired order on entry, NCMIN is the number of frequency-weighted Hankel singular values greater than NCS*EPS*S1, EPS is the machine precision (see LAPACK Library Routine DLAMCH) and S1 is the largest Hankel singular value (computed in HSVC(1)); NCR can be further reduced to ensure HSVC(NCR-NCU) > HSVC(NCR+1-NCU); if ORDSEL = 'A', NCR is the sum of NCU and the number of Hankel singular values greater than MAX(TOL1,NCS*EPS*S1). ALPHA (input) DOUBLE PRECISION Specifies the ALPHA-stability boundary for the eigenvalues of the state dynamics matrix AC. For a continuous-time controller (DICO = 'C'), ALPHA <= 0 is the boundary value for the real parts of eigenvalues; for a discrete-time controller (DICO = 'D'), 0 <= ALPHA <= 1 represents the boundary value for the moduli of eigenvalues. The ALPHA-stability domain does not include the boundary. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A of the open-loop system. On exit, if INFO = 0 and EQUIL = 'S', the leading N-by-N part of this array contains the scaled state dynamics matrix of the open-loop system. If EQUIL = 'N', this array is unchanged on exit. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix B of the open-loop system. On exit, if INFO = 0 and EQUIL = 'S', the leading N-by-M part of this array contains the scaled input/state matrix of the open-loop system. If EQUIL = 'N', this array is unchanged on exit. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C of the open-loop system. On exit, if INFO = 0 and EQUIL = 'S', the leading P-by-N part of this array contains the scaled state/output matrix of the open-loop system. If EQUIL = 'N', this array is unchanged on exit. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the input/output matrix D of the open-loop system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). AC (input/output) DOUBLE PRECISION array, dimension (LDAC,NC) On entry, the leading NC-by-NC part of this array must contain the state dynamics matrix Ac of the original controller. On exit, if INFO = 0, the leading NCR-by-NCR part of this array contains the state dynamics matrix Acr of the reduced controller. The resulting Ac has a block-diagonal form with two blocks. For a system with NCU ALPHA-unstable eigenvalues and NCS ALPHA-stable eigenvalues (NCU+NCS = NC), the leading NCU-by-NCU block contains the unreduced part of Ac corresponding to the ALPHA-unstable eigenvalues. The trailing (NCR+NCS-NC)-by-(NCR+NCS-NC) block contains the reduced part of Ac corresponding to ALPHA-stable eigenvalues. LDAC INTEGER The leading dimension of array AC. LDAC >= MAX(1,NC). BC (input/output) DOUBLE PRECISION array, dimension (LDBC,P) On entry, the leading NC-by-P part of this array must contain the input/state matrix Bc of the original controller. On exit, if INFO = 0, the leading NCR-by-P part of this array contains the input/state matrix Bcr of the reduced controller. LDBC INTEGER The leading dimension of array BC. LDBC >= MAX(1,NC). CC (input/output) DOUBLE PRECISION array, dimension (LDCC,NC) On entry, the leading M-by-NC part of this array must contain the state/output matrix Cc of the original controller. On exit, if INFO = 0, the leading M-by-NCR part of this array contains the state/output matrix Ccr of the reduced controller. LDCC INTEGER The leading dimension of array CC. LDCC >= MAX(1,M). DC (input/output) DOUBLE PRECISION array, dimension (LDDC,P) On entry, the leading M-by-P part of this array must contain the input/output matrix Dc of the original controller. On exit, if INFO = 0, the leading M-by-P part of this array contains the input/output matrix Dcr of the reduced controller. LDDC INTEGER The leading dimension of array DC. LDDC >= MAX(1,M). NCS (output) INTEGER The dimension of the ALPHA-stable part of the controller. HSVC (output) DOUBLE PRECISION array, dimension (NC) If INFO = 0, the leading NCS elements of this array contain the frequency-weighted Hankel singular values, ordered decreasingly, of the ALPHA-stable part of the controller.Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of the reduced controller. For model reduction, the recommended value is TOL1 = c*S1, where c is a constant in the interval [0.00001,0.001], and S1 is the largest frequency-weighted Hankel singular value of the ALPHA-stable part of the original controller (computed in HSVC(1)). If TOL1 <= 0 on entry, the used default value is TOL1 = NCS*EPS*S1, where NCS is the number of ALPHA-stable eigenvalues of Ac and EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the ALPHA-stable part of the given controller. The recommended value is TOL2 = NCS*EPS*S1. This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0 and ORDSEL = 'A', then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (MAX(1,LIWRK1,LIWRK2)) LIWRK1 = 0, if JOBMR = 'B'; LIWRK1 = NC, if JOBMR = 'F'; LIWRK1 = 2*NC, if JOBMR = 'S' or 'P'; LIWRK2 = 0, if WEIGHT = 'N'; LIWRK2 = 2*(M+P), if WEIGHT = 'O', 'I', or 'P'. On exit, if INFO = 0, IWORK(1) contains NCMIN, the order of the computed minimal realization of the stable part of the controller. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*NC*NC + MAX( 1, LFREQ, LSQRED ), where LFREQ = (N+NC)*(N+NC+2*M+2*P)+ MAX((N+NC)*(N+NC+MAX(N+NC,M,P)+7), (M+P)*(M+P+4)) if WEIGHT = 'I' or 'O' or 'P'; LFREQ = NC*(MAX(M,P)+5) if WEIGHT = 'N' and EQUIL = 'N'; LFREQ = MAX(N,NC*(MAX(M,P)+5)) if WEIGHT = 'N' and EQUIL = 'S'; LSQRED = MAX( 1, 2*NC*NC+5*NC ); For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NCR is greater than NSMIN, the sum of the order of the ALPHA-unstable part and the order of a minimal realization of the ALPHA-stable part of the given controller; in this case, the resulting NCR is set equal to NSMIN; = 2: with ORDSEL = 'F', the selected order NCR corresponds to repeated singular values for the ALPHA-stable part of the controller, which are neither all included nor all excluded from the reduced model; in this case, the resulting NCR is automatically decreased to exclude all repeated singular values; = 3: with ORDSEL = 'F', the selected order NCR is less than the order of the ALPHA-unstable part of the given controller. In this case NCR is set equal to the order of the ALPHA-unstable part.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the closed-loop system is not well-posed; its feedthrough matrix is (numerically) singular; = 2: the computation of the real Schur form of the closed-loop state matrix failed; = 3: the closed-loop state matrix is not stable; = 4: the solution of a symmetric eigenproblem failed; = 5: the computation of the ordered real Schur form of Ac failed; = 6: the separation of the ALPHA-stable/unstable diagonal blocks failed because of very close eigenvalues; = 7: the computation of Hankel singular values failed.Method
Let K be the transfer-function matrix of the original linear controller d[xc(t)] = Ac*xc(t) + Bc*y(t) u(t) = Cc*xc(t) + Dc*y(t), (1) where d[xc(t)] is dxc(t)/dt for a continuous-time system and xc(t+1) for a discrete-time system. The subroutine SB16AD determines the matrices of a reduced order controller d[z(t)] = Acr*z(t) + Bcr*y(t) u(t) = Ccr*z(t) + Dcr*y(t), (2) such that the corresponding transfer-function matrix Kr minimizes the norm of the frequency-weighted error V*(K-Kr)*W, (3) where V and W are special stable transfer-function matrices chosen to enforce stability and/or performance of the closed-loop system [3] (see description of the parameter WEIGHT). The following procedure is used to reduce K in conjunction with the frequency-weighted balancing approach of [2] (see also [3]): 1) Decompose additively K, of order NC, as K = K1 + K2, such that K1 has only ALPHA-stable poles and K2, of order NCU, has only ALPHA-unstable poles. 2) Compute for K1 a B&T or SPA frequency-weighted approximation K1r of order NCR-NCU using the frequency-weighted balancing approach of [1] in conjunction with accuracy enhancing techniques specified by the parameter JOBMR. 3) Assemble the reduced model Kr as Kr = K1r + K2. For the reduction of the ALPHA-stable part, several accuracy enhancing techniques can be employed (see [2] for details). If JOBMR = 'B', the square-root B&T method of [1] is used. If JOBMR = 'F', the balancing-free square-root version of the B&T method [1] is used. If JOBMR = 'S', the square-root version of the SPA method [2,3] is used. If JOBMR = 'P', the balancing-free square-root version of the SPA method [2,3] is used. For each of these methods, two left and right truncation matrices are determined using the Cholesky factors of an input frequency-weighted controllability Grammian P and an output frequency-weighted observability Grammian Q. P and Q are determined as the leading NC-by-NC diagonal blocks of the controllability Grammian of K*W and of the observability Grammian of V*K. Special techniques developed in [2] are used to compute the Cholesky factors of P and Q directly (see also SLICOT Library routine SB16AY). The frequency-weighted Hankel singular values HSVC(1), ...., HSVC(NC) are computed as the square roots of the eigenvalues of the product P*Q.References
[1] Enns, D. Model reduction with balanced realizations: An error bound and a frequency weighted generalization. Proc. 23-th CDC, Las Vegas, pp. 127-132, 1984. [2] Varga, A. and Anderson, B.D.O. Square-root balancing-free methods for frequency-weighted balancing related model reduction. (report in preparation) [3] Anderson, B.D.O and Liu, Y. Controller reduction: concepts and approaches. IEEE Trans. Autom. Control, Vol. 34, pp. 802-812, 1989.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root techniques.Further Comments
NoneExample
Program Text
* SB16AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX, NCMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20, $ NCMAX = 20 ) INTEGER MPMAX, NNCMAX PARAMETER ( MPMAX = MMAX + PMAX, NNCMAX = NMAX + NCMAX ) INTEGER LDA, LDB, LDC, LDD, LDAC, LDBC, LDCC, LDDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDAC = NCMAX, LDBC = NCMAX, $ LDCC = PMAX, LDDC = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = 2*MAX( NCMAX, MPMAX ) ) INTEGER LDWORK PARAMETER ( LDWORK = 2*NCMAX*NCMAX + $ NNCMAX*( NNCMAX + 2*MPMAX ) + $ MAX( NNCMAX*( NNCMAX + $ MAX( NNCMAX, MMAX, PMAX ) + 7 ), $ MPMAX*( MPMAX + 4 ) ) ) * .. Local Scalars .. DOUBLE PRECISION ALPHA, TOL1, TOL2 INTEGER I, INFO, IWARN, J, M, N, NCR, NCS, NC, P CHARACTER*1 DICO, EQUIL, JOBC, JOBO, JOBMR, ORDSEL, WEIGHT * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), HSVC(NMAX), $ AC(LDAC,NCMAX), BC(LDBC,PMAX), CC(LDCC,NMAX), $ DC(LDDC,PMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL SB16AD * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NC, NCR, ALPHA, TOL1, TOL2, DICO, $ JOBC, JOBO, JOBMR, WEIGHT, EQUIL, ORDSEL 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 ) IF( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF( P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) IF( NC.LT.0 .OR. NC.GT.NCMAX ) THEN WRITE ( NOUT, FMT = 99986 ) NC ELSE IF( NC.GT.0 ) THEN READ ( NIN, FMT = * ) $ ( ( AC(I,J), J = 1,NC ), I = 1,NC ) READ ( NIN, FMT = * ) $ ( ( BC(I,J), J = 1,P ), I = 1, NC ) READ ( NIN, FMT = * ) $ ( ( CC(I,J), J = 1,NC ), I = 1,M ) END IF READ ( NIN, FMT = * ) $ ( ( DC(I,J), J = 1,P ), I = 1,M ) END IF * Find a reduced ssr for (AC,BC,CC,DC). CALL SB16AD( DICO, JOBC, JOBO, JOBMR, WEIGHT, EQUIL, $ ORDSEL, N, M, P, NC, NCR, ALPHA, A, LDA, $ B, LDB, C, LDC, D, LDD, AC, LDAC, BC, LDBC, $ CC, LDCC, DC, LDDC, NCS, HSVC, TOL1, TOL2, $ IWORK, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF( IWARN.NE.0) WRITE ( NOUT, FMT = 99984 ) IWARN WRITE ( NOUT, FMT = 99997 ) NCR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSVC(J), J = 1, NCS ) IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NCR WRITE ( NOUT, FMT = 99995 ) ( AC(I,J), J = 1,NCR ) 20 CONTINUE IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NCR WRITE ( NOUT, FMT = 99995 ) ( BC(I,J), J = 1,P ) 40 CONTINUE IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( CC(I,J), J = 1,NCR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( DC(I,J), J = 1,P ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SB16AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB16AD = ',I2) 99997 FORMAT (/' The order of reduced controller = ',I2) 99996 FORMAT (/' The reduced controller state dynamics matrix Ac is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced controller input/state matrix Bc is ') 99992 FORMAT (/' The reduced controller state/output matrix Cc is ') 99991 FORMAT (/' The reduced controller input/output matrix Dc is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of weighted ALPHA-stable', $ ' part are') 99986 FORMAT (/' NC is out of range.',/' NC = ',I5) 99984 FORMAT (' IWARN on exit from SB16AD = ',I2) ENDProgram Data
SB16AD EXAMPLE PROGRAM DATA (Continuous system) 3 1 1 3 2 0.0 0.1E0 0.0 C S S F I N F -1. 0. 4. 0. 2. 0. 0. 0. -3. 1. 1. 1. 1. 1. 1. 0. -26.4000 6.4023 4.3868 32.0000 0 0 0 8.0000 0 -16 0 0 9.2994 1.1624 0.1090 0Program Results
SB16AD EXAMPLE PROGRAM RESULTS The order of reduced controller = 2 The Hankel singular values of weighted ALPHA-stable part are 3.8253 0.2005 The reduced controller state dynamics matrix Ac is 9.1900 0.0000 0.0000 -34.5297 The reduced controller input/state matrix Bc is -11.9593 86.3137 The reduced controller state/output matrix Cc is 2.8955 -1.3566 The reduced controller input/output matrix Dc is 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB16AY.html 0000664 0000000 0000000 00000027261 14560147231 0020367 0 ustar 00root root 0000000 0000000
Purpose
To compute for given state-space representations (A,B,C,D) and (Ac,Bc,Cc,Dc) of the transfer-function matrices of the open-loop system G and feedback controller K, respectively, the Cholesky factors of the frequency-weighted controllability and observability Grammians corresponding to a frequency-weighted model reduction problem. The controller must stabilize the closed-loop system. The state matrix Ac must be in a block-diagonal real Schur form Ac = diag(Ac1,Ac2), where Ac1 contains the unstable eigenvalues of Ac and Ac2 contains the stable eigenvalues of Ac.Specification
SUBROUTINE SB16AY( DICO, JOBC, JOBO, WEIGHT, N, M, P, NC, NCS, $ A, LDA, B, LDB, C, LDC, D, LDD, $ AC, LDAC, BC, LDBC, CC, LDCC, DC, LDDC, $ SCALEC, SCALEO, S, LDS, R, LDR, $ IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBC, JOBO, WEIGHT INTEGER INFO, LDA, LDAC, LDB, LDBC, LDC, LDCC, LDD, LDDC, $ LDR, LDS, LDWORK, M, N, NC, NCS, P DOUBLE PRECISION SCALEC, SCALEO C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), AC(LDAC,*), B(LDB,*), BC(LDBC,*), $ C(LDC,*), CC(LDCC,*), D(LDD,*), DC(LDDC,*), $ DWORK(*), R(LDR,*), S(LDS,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the systems as follows: = 'C': G and K are continuous-time systems; = 'D': G and K are discrete-time systems. JOBC CHARACTER*1 Specifies the choice of frequency-weighted controllability Grammian as follows: = 'S': choice corresponding to standard Enns' method [1]; = 'E': choice corresponding to the stability enhanced modified Enns' method of [2]. JOBO CHARACTER*1 Specifies the choice of frequency-weighted observability Grammian as follows: = 'S': choice corresponding to standard Enns' method [1]; = 'E': choice corresponding to the stability enhanced modified combination method of [2]. WEIGHT CHARACTER*1 Specifies the type of frequency-weighting, as follows: = 'N': no weightings are used (V = I, W = I); = 'O': stability enforcing left (output) weighting -1 V = (I-G*K) *G is used (W = I); = 'I': stability enforcing right (input) weighting -1 W = (I-G*K) *G is used (V = I); = 'P': stability and performance enforcing weightings -1 -1 V = (I-G*K) *G , W = (I-G*K) are used.Input/Output Parameters
N (input) INTEGER The order of the open-loop system state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NC (input) INTEGER The order of the controller state-space representation, i.e., the order of the matrix AC. NC >= 0. NCS (input) INTEGER The dimension of the stable part of the controller, i.e., the order of matrix Ac2. NC >= NCS >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the system with the transfer-function matrix G. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the state/output matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the input/output matrix D of the open-loop system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). AC (input) DOUBLE PRECISION array, dimension (LDAC,NC) The leading NC-by-NC part of this array must contain the state dynamics matrix Ac of the controller in a block diagonal real Schur form Ac = diag(Ac1,Ac2), where Ac1 is (NC-NCS)-by-(NC-NCS) and contains the unstable eigenvalues of Ac, and Ac2 is NCS-by-NCS and contains the stable eigenvalues of Ac. LDAC INTEGER The leading dimension of array AC. LDAC >= MAX(1,NC). BC (input) DOUBLE PRECISION array, dimension (LDBC,P) The leading NC-by-P part of this array must contain the input/state matrix Bc of the controller. LDBC INTEGER The leading dimension of array BC. LDBC >= MAX(1,NC). CC (input) DOUBLE PRECISION array, dimension (LDCC,NC) The leading M-by-NC part of this array must contain the state/output matrix Cc of the controller. LDCC INTEGER The leading dimension of array CC. LDCC >= MAX(1,M). DC (input) DOUBLE PRECISION array, dimension (LDDC,P) The leading M-by-P part of this array must contain the input/output matrix Dc of the controller. LDDC INTEGER The leading dimension of array DC. LDDC >= MAX(1,M). SCALEC (output) DOUBLE PRECISION Scaling factor for the controllability Grammian. See METHOD. SCALEO (output) DOUBLE PRECISION Scaling factor for the observability Grammian. See METHOD. S (output) DOUBLE PRECISION array, dimension (LDS,NCS) The leading NCS-by-NCS upper triangular part of this array contains the Cholesky factor S of the frequency-weighted controllability Grammian P = S*S'. See METHOD. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,NCS). R (output) DOUBLE PRECISION array, dimension (LDR,NCS) The leading NCS-by-NCS upper triangular part of this array contains the Cholesky factor R of the frequency-weighted observability Grammian Q = R'*R. See METHOD. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,NCS).Workspace
IWORK INTEGER array, dimension (LIWRK) LIWRK = 0, if WEIGHT = 'N'; LIWRK = 2(M+P), if WEIGHT = 'O', 'I', or 'P'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, LFREQ ), where LFREQ = (N+NC)*(N+NC+2*M+2*P)+ MAX((N+NC)*(N+NC+MAX(N+NC,M,P)+7), (M+P)*(M+P+4)) if WEIGHT = 'I' or 'O' or 'P'; LFREQ = NCS*(MAX(M,P)+5) if WEIGHT = 'N'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the closed-loop system is not well-posed; its feedthrough matrix is (numerically) singular; = 2: the computation of the real Schur form of the closed-loop state matrix failed; = 3: the closed-loop state matrix is not stable; = 4: the solution of a symmetric eigenproblem failed; = 5: the NCS-by-NCS trailing part Ac2 of the state matrix Ac is not stable or not in a real Schur form.Method
If JOBC = 'S', the controllability Grammian P is determined as follows: - if WEIGHT = 'O' or 'N', P satisfies for a continuous-time controller the Lyapunov equation Ac2*P + P*Ac2' + scalec^2*Bc*Bc' = 0 and for a discrete-time controller Ac2*P*Ac2' - P + scalec^2*Bc*Bc' = 0; - if WEIGHT = 'I' or 'P', let Pi be the solution of the continuous-time Lyapunov equation Ai*Pi + Pi*Ai' + scalec^2*Bi*Bi' = 0 or of the discrete-time Lyapunov equation Ai*Pi*Ai' - Pi + scalec^2*Bi*Bi' = 0, where Ai and Bi are the state and input matrices of a special state-space realization of the input frequency weight (see [2]); P results as the trailing NCS-by-NCS part of Pi partitioned as Pi = ( * * ). ( * P ) If JOBC = 'E', a modified controllability Grammian P1 >= P is determined to guarantee stability for a modified Enns' method [2]. If JOBO = 'S', the observability Grammian Q is determined as follows: - if WEIGHT = 'I' or 'N', Q satisfies for a continuous-time controller the Lyapunov equation Ac2'*Q + Q*Ac2 + scaleo^2*Cc'*Cc = 0 and for a discrete-time controller Ac2'*Q*Ac2 - Q + scaleo^2*Cc'*Cc = 0; - if WEIGHT = 'O' or 'P', let Qo be the solution of the continuous-time Lyapunov equation Ao'*Qo + Qo*Ao + scaleo^2*Co'*Co = 0 or of the discrete-time Lyapunov equation Ao'*Qo*Ao - Qo + scaleo^2*Co'*Co = 0, where Ao and Co are the state and output matrices of a special state-space realization of the output frequency weight (see [2]); if WEIGHT = 'O', Q results as the leading NCS-by-NCS part of Qo partitioned as Qo = ( Q * ) ( * * ) while if WEIGHT = 'P', Q results as the trailing NCS-by-NCS part of Qo partitioned as Qo = ( * * ). ( * Q ) If JOBO = 'E', a modified observability Grammian Q1 >= Q is determined to guarantee stability for a modified Enns' method [2]. The routine computes directly the Cholesky factors S and R such that P = S*S' and Q = R'*R according to formulas developed in [2].References
[1] Enns, D. Model reduction with balanced realizations: An error bound and a frequency weighted generalization. Proc. CDC, Las Vegas, pp. 127-132, 1984. [2] Varga, A. and Anderson, B.D.O. Frequency-weighted balancing related controller reduction. Proceedings of the 15th IFAC World Congress, July 21-26, 2002, Barcelona, Spain, Vol.15, Part 1, 2002-07-21.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute, for a given open-loop model (A,B,C,D), and for given state feedback gain F and full observer gain G, such that A+B*F and A+G*C are stable, a reduced order controller model (Ac,Bc,Cc,Dc) using a coprime factorization based controller reduction approach. For reduction, either the square-root or the balancing-free square-root versions of the Balance & Truncate (B&T) or Singular Perturbation Approximation (SPA) model reduction methods are used in conjunction with stable coprime factorization techniques.Specification
SUBROUTINE SB16BD( DICO, JOBD, JOBMR, JOBCF, EQUIL, ORDSEL, $ N, M, P, NCR, A, LDA, B, LDB, C, LDC, D, LDD, $ F, LDF, G, LDG, DC, LDDC, HSV, TOL1, TOL2, $ IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, EQUIL, JOBCF, JOBD, JOBMR, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, LDDC, $ LDF, LDG, LDWORK, M, N, NCR, P DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DC(LDDC,*), DWORK(*), F(LDF,*), G(LDG,*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the open-loop system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model: = 'D': D is present; = 'Z': D is assumed a zero matrix. JOBMR CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root B&T method; = 'F': use the balancing-free square-root B&T method; = 'S': use the square-root SPA method; = 'P': use the balancing-free square-root SPA method. JOBCF CHARACTER*1 Specifies whether left or right coprime factorization is to be used as follows: = 'L': use left coprime factorization; = 'R': use right coprime factorization. EQUIL CHARACTER*1 Specifies whether the user wishes to perform a preliminary equilibration before performing order reduction as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting controller order NCR is fixed; = 'A': the resulting controller order NCR is automatically determined on basis of the given tolerance TOL1.Input/Output Parameters
N (input) INTEGER The order of the open-loop state-space representation, i.e., the order of the matrix A. N >= 0. N also represents the order of the original state-feedback controller. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NCR (input/output) INTEGER On entry with ORDSEL = 'F', NCR is the desired order of the resulting reduced order controller. 0 <= NCR <= N. On exit, if INFO = 0, NCR is the order of the resulting reduced order controller. NCR is set as follows: if ORDSEL = 'F', NCR is equal to MIN(NCR,NMIN), where NCR is the desired order on entry, and NMIN is the order of a minimal realization of an extended system Ge (see METHOD); NMIN is determined as the number of Hankel singular values greater than N*EPS*HNORM(Ge), where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and HNORM(Ge) is the Hankel norm of the extended system (computed in HSV(1)); if ORDSEL = 'A', NCR is equal to the number of Hankel singular values greater than MAX(TOL1,N*EPS*HNORM(Ge)). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, if INFO = 0, the leading NCR-by-NCR part of this array contains the state dynamics matrix Ac of the reduced controller. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the original input/state matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the original state/output matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) If JOBD = 'D', the leading P-by-M part of this array must contain the system direct input/output transmission matrix D. The array D is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P), if JOBD = 'D'; LDD >= 1, if JOBD = 'Z'. F (input/output) DOUBLE PRECISION array, dimension (LDF,N) On entry, the leading M-by-N part of this array must contain a stabilizing state feedback matrix. On exit, if INFO = 0, the leading M-by-NCR part of this array contains the state/output matrix Cc of the reduced controller. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M). G (input/output) DOUBLE PRECISION array, dimension (LDG,P) On entry, the leading N-by-P part of this array must contain a stabilizing observer gain matrix. On exit, if INFO = 0, the leading NCR-by-P part of this array contains the input/state matrix Bc of the reduced controller. LDG INTEGER The leading dimension of array G. LDG >= MAX(1,N). DC (output) DOUBLE PRECISION array, dimension (LDDC,P) If INFO = 0, the leading M-by-P part of this array contains the input/output matrix Dc of the reduced controller. LDDC INTEGER The leading dimension of array DC. LDDC >= MAX(1,M). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, it contains the N Hankel singular values of the extended system ordered decreasingly (see METHOD).Tolerances
TOL1 DOUBLE PRECISION If ORDSEL = 'A', TOL1 contains the tolerance for determining the order of the reduced extended system. For model reduction, the recommended value is TOL1 = c*HNORM(Ge), where c is a constant in the interval [0.00001,0.001], and HNORM(Ge) is the Hankel norm of the extended system (computed in HSV(1)). The value TOL1 = N*EPS*HNORM(Ge) is used by default if TOL1 <= 0 on entry, where EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL1 is ignored. TOL2 DOUBLE PRECISION The tolerance for determining the order of a minimal realization of the coprime factorization controller (see METHOD). The recommended value is TOL2 = N*EPS*HNORM(Ge) (see METHOD). This value is used by default if TOL2 <= 0 on entry. If TOL2 > 0 and ORDSEL = 'A', then TOL2 <= TOL1.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = 0, if ORDSEL = 'F' and NCR = N. Otherwise, LIWORK = MAX(PM,M), if JOBCF = 'L', LIWORK = MAX(PM,P), if JOBCF = 'R', where PM = 0, if JOBMR = 'B', PM = N, if JOBMR = 'F', PM = MAX(1,2*N), if JOBMR = 'S' or 'P'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= P*N, if ORDSEL = 'F' and NCR = N. Otherwise, LDWORK >= (N+M)*(M+P) + MAX(LWR,4*M), if JOBCF = 'L', LDWORK >= (N+P)*(M+P) + MAX(LWR,4*P), if JOBCF = 'R', where LWR = MAX(1,N*(2*N+MAX(N,M+P)+5)+N*(N+1)/2). For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NCR is greater than the order of a minimal realization of the controller.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the reduction of A+G*C to a real Schur form failed; = 2: the matrix A+G*C is not stable (if DICO = 'C'), or not convergent (if DICO = 'D'); = 3: the computation of Hankel singular values failed; = 4: the reduction of A+B*F to a real Schur form failed; = 5: the matrix A+B*F is not stable (if DICO = 'C'), or not convergent (if DICO = 'D').Method
Let be the linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t), (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system, and let Go(d) be the open-loop transfer-function matrix -1 Go(d) = C*(d*I-A) *B + D . Let F and G be the state feedback and observer gain matrices, respectively, chosen so that A+B*F and A+G*C are stable matrices. The controller has a transfer-function matrix K(d) given by -1 K(d) = F*(d*I-A-B*F-G*C-G*D*F) *G . The closed-loop transfer-function matrix is given by -1 Gcl(d) = Go(d)(I+K(d)Go(d)) . K(d) can be expressed as a left coprime factorization (LCF), -1 K(d) = M_left(d) *N_left(d) , or as a right coprime factorization (RCF), -1 K(d) = N_right(d)*M_right(d) , where M_left(d), N_left(d), N_right(d), and M_right(d) are stable transfer-function matrices. The subroutine SB16BD determines the matrices of a reduced controller d[z(t)] = Ac*z(t) + Bc*y(t) u(t) = Cc*z(t) + Dc*y(t), (2) with the transfer-function matrix Kr as follows: (1) If JOBCF = 'L', the extended system Ge(d) = [ N_left(d) M_left(d) ] is reduced to Ger(d) = [ N_leftr(d) M_leftr(d) ] by using either the B&T or SPA methods. The reduced order controller Kr(d) is computed as -1 Kr(d) = M_leftr(d) *N_leftr(d) ; (2) If JOBCF = 'R', the extended system Ge(d) = [ N_right(d) ] is reduced to [ M_right(d) ] Ger(d) = [ N_rightr(d) ] by using either the [ M_rightr(d) ] B&T or SPA methods. The reduced order controller Kr(d) is computed as -1 Kr(d) = N_rightr(d)* M_rightr(d) . If ORDSEL = 'A', the order of the controller is determined by computing the number of Hankel singular values greater than the given tolerance TOL1. The Hankel singular values are the square roots of the eigenvalues of the product of the controllability and observability Grammians of the extended system Ge. If JOBMR = 'B', the square-root B&T method of [1] is used. If JOBMR = 'F', the balancing-free square-root version of the B&T method [1] is used. If JOBMR = 'S', the square-root version of the SPA method [2,3] is used. If JOBMR = 'P', the balancing-free square-root version of the SPA method [2,3] is used.References
[1] Tombs, M.S. and Postlethwaite, I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987. [2] Varga, A. Efficient minimal realization procedure based on balancing. Proc. of IMACS/IFAC Symp. MCTS, Lille, France, May 1991, A. El Moudui, P. Borne, S. G. Tzafestas (Eds.), Vol. 2, pp. 42-46, 1991. [3] Varga, A. Coprime factors model reduction method based on square-root balancing-free techniques. System Analysis, Modelling and Simulation, Vol. 11, pp. 303-311, 1993. [4] Liu, Y., Anderson, B.D.O. and Ly, O.L. Coprime factorization controller reduction with Bezout identity induced frequency weighting. Automatica, vol. 26, pp. 233-249, 1990.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* SB16BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD, LDDC, LDF, LDG PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDDC = MMAX, LDF = MMAX, LDG = NMAX $ ) INTEGER LDWORK, LIWORK, MAXMP, MPMAX PARAMETER ( LIWORK = 2*NMAX, MAXMP = MAX( MMAX, PMAX ), $ MPMAX = MMAX + PMAX ) PARAMETER ( LDWORK = ( NMAX + MAXMP )*MPMAX + $ MAX ( NMAX*( 2*NMAX + $ MAX( NMAX, MPMAX ) + 5 ) $ + ( NMAX*( NMAX + 1 ) )/2, $ 4*MAXMP ) ) CHARACTER DICO, EQUIL, JOBCF, JOBD, JOBMR, ORDSEL INTEGER I, INFO, IWARN, J, M, N, NCR, P DOUBLE PRECISION TOL1, TOL2 * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DC(LDDC,PMAX), DWORK(LDWORK), $ F(LDF,NMAX), G(LDG,PMAX), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL SB16BD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NCR, TOL1, TOL2, $ DICO, JOBD, JOBMR, JOBCF, EQUIL, ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) READ ( NIN, FMT = * ) ( ( F(I,J), J = 1,N ), I = 1,M ) READ ( NIN, FMT = * ) ( ( G(I,J), J = 1,P ), I = 1,N ) * Find a reduced ssr for (A,B,C,D). CALL SB16BD( DICO, JOBD, JOBMR, JOBCF, EQUIL, ORDSEL, N, $ M, P, NCR, A, LDA, B, LDB, C, LDC, D, LDD, $ F, LDF, G, LDG, DC, LDDC, HSV, TOL1, TOL2, $ IWORK, DWORK, LDWORK, IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NCR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,N ) IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NCR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NCR ) 20 CONTINUE IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NCR WRITE ( NOUT, FMT = 99995 ) ( G(I,J), J = 1,P ) 40 CONTINUE IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( F(I,J), J = 1,NCR ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( DC(I,J), J = 1,M ) 80 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SB16BD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB16BD = ',I2) 99997 FORMAT (' The order of reduced controller = ',I2) 99996 FORMAT (/' The reduced controller state dynamics matrix Ac is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced controller input/state matrix Bc is ') 99992 FORMAT (/' The reduced controller state/output matrix Cc is ') 99991 FORMAT (/' The reduced controller input/output matrix Dc is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The Hankel singular values of extended system are:') ENDProgram Data
SB16BD EXAMPLE PROGRAM DATA (Continuous system) 8 1 1 4 0.1E0 0.0 C D F L S F 0 1.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0150 0.7650 0 0 0 0 0 0 -0.7650 -0.0150 0 0 0 0 0 0 0 0 -0.0280 1.4100 0 0 0 0 0 0 -1.4100 -0.0280 0 0 0 0 0 0 0 0 -0.0400 1.850 0 0 0 0 0 0 -1.8500 -0.040 0.0260 -0.2510 0.0330 -0.8860 -4.0170 0.1450 3.6040 0.2800 -.996 -.105 0.261 .009 -.001 -.043 0.002 -0.026 0.0 4.4721e-002 6.6105e-001 4.6986e-003 3.6014e-001 1.0325e-001 -3.7541e-002 -4.2685e-002 3.2873e-002 4.1089e-001 8.6846e-002 3.8523e-004 -3.6194e-003 -8.8037e-003 8.4205e-003 1.2349e-003 4.2632e-003Program Results
SB16BD EXAMPLE PROGRAM RESULTS The order of reduced controller = 4 The Hankel singular values of extended system are: 4.9078 4.8745 3.8455 3.7811 1.2289 1.1785 0.5176 0.1148 The reduced controller state dynamics matrix Ac is 0.5946 -0.7336 0.1914 -0.3368 0.5960 -0.0184 -0.1088 0.0207 1.2253 0.2043 0.1009 -1.4948 -0.0330 -0.0243 1.3440 0.0035 The reduced controller input/state matrix Bc is 0.0015 -0.0202 0.0159 -0.0544 The reduced controller state/output matrix Cc is 0.3534 0.0274 0.0337 -0.0320 The reduced controller input/output matrix Dc is 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB16CD.html 0000664 0000000 0000000 00000047540 14560147231 0020346 0 ustar 00root root 0000000 0000000
Purpose
To compute, for a given open-loop model (A,B,C,D), and for given state feedback gain F and full observer gain G, such that A+B*F and A+G*C are stable, a reduced order controller model (Ac,Bc,Cc) using a coprime factorization based controller reduction approach. For reduction of coprime factors, a stability enforcing frequency-weighted model reduction is performed using either the square-root or the balancing-free square-root versions of the Balance & Truncate (B&T) model reduction method.Specification
SUBROUTINE SB16CD( DICO, JOBD, JOBMR, JOBCF, ORDSEL, N, M, P, NCR, $ A, LDA, B, LDB, C, LDC, D, LDD, F, LDF, G, LDG, $ HSV, TOL, IWORK, DWORK, LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBCF, JOBD, JOBMR, ORDSEL INTEGER INFO, IWARN, LDA, LDB, LDC, LDD, $ LDF, LDG, LDWORK, M, N, NCR, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), F(LDF,*), G(LDG,*), HSV(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the open-loop system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model, as follows: = 'D': D is present; = 'Z': D is assumed a zero matrix. JOBMR CHARACTER*1 Specifies the model reduction approach to be used as follows: = 'B': use the square-root B&T method; = 'F': use the balancing-free square-root B&T method. JOBCF CHARACTER*1 Specifies whether left or right coprime factorization of the controller is to be used as follows: = 'L': use left coprime factorization; = 'R': use right coprime factorization. ORDSEL CHARACTER*1 Specifies the order selection method as follows: = 'F': the resulting controller order NCR is fixed; = 'A': the resulting controller order NCR is automatically determined on basis of the given tolerance TOL.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. N also represents the order of the original state-feedback controller. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NCR (input/output) INTEGER On entry with ORDSEL = 'F', NCR is the desired order of the resulting reduced order controller. 0 <= NCR <= N. On exit, if INFO = 0, NCR is the order of the resulting reduced order controller. NCR is set as follows: if ORDSEL = 'F', NCR is equal to MIN(NCR,NCRMIN), where NCR is the desired order on entry, and NCRMIN is the number of Hankel-singular values greater than N*EPS*S1, where EPS is the machine precision (see LAPACK Library Routine DLAMCH) and S1 is the largest Hankel singular value (computed in HSV(1)); NCR can be further reduced to ensure HSV(NCR) > HSV(NCR+1); if ORDSEL = 'A', NCR is equal to the number of Hankel singular values greater than MAX(TOL,N*EPS*S1). A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, if INFO = 0, the leading NCR-by-NCR part of this array contains the state dynamics matrix Ac of the reduced controller. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the open-loop system input/state matrix B. On exit, this array is overwritten with a NCR-by-M B&T approximation of the matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the open-loop system state/output matrix C. On exit, this array is overwritten with a P-by-NCR B&T approximation of the matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) On entry, if JOBD = 'D', the leading P-by-M part of this array must contain the system direct input/output transmission matrix D. The array D is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P), if JOBD = 'D'; LDD >= 1, if JOBD = 'Z'. F (input/output) DOUBLE PRECISION array, dimension (LDF,N) On entry, the leading M-by-N part of this array must contain a stabilizing state feedback matrix. On exit, if INFO = 0, the leading M-by-NCR part of this array contains the output/state matrix Cc of the reduced controller. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M). G (input/output) DOUBLE PRECISION array, dimension (LDG,P) On entry, the leading N-by-P part of this array must contain a stabilizing observer gain matrix. On exit, if INFO = 0, the leading NCR-by-P part of this array contains the input/state matrix Bc of the reduced controller. LDG INTEGER The leading dimension of array G. LDG >= MAX(1,N). HSV (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, HSV contains the N frequency-weighted Hankel singular values ordered decreasingly (see METHOD).Tolerances
TOL DOUBLE PRECISION If ORDSEL = 'A', TOL contains the tolerance for determining the order of reduced controller. The recommended value is TOL = c*S1, where c is a constant in the interval [0.00001,0.001], and S1 is the largest Hankel singular value (computed in HSV(1)). The value TOL = N*EPS*S1 is used by default if TOL <= 0 on entry, where EPS is the machine precision (see LAPACK Library Routine DLAMCH). If ORDSEL = 'F', the value of TOL is ignored.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK = 0, if JOBMR = 'B'; LIWORK = N, if JOBMR = 'F'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*N*N + MAX( 1, 2*N*N + 5*N, N*MAX(M,P), N*(N + MAX(N,MP) + MIN(N,MP) + 6)), where MP = M, if JOBCF = 'L'; MP = P, if JOBCF = 'R'. For optimum performance LDWORK should be larger.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: with ORDSEL = 'F', the selected order NCR is greater than the order of a minimal realization of the controller; = 2: with ORDSEL = 'F', the selected order NCR corresponds to repeated singular values, which are neither all included nor all excluded from the reduced controller. In this case, the resulting NCR is set automatically to the largest value such that HSV(NCR) > HSV(NCR+1).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: eigenvalue computation failure; = 2: the matrix A+G*C is not stable; = 3: the matrix A+B*F is not stable; = 4: the Lyapunov equation for computing the observability Grammian is (nearly) singular; = 5: the Lyapunov equation for computing the controllability Grammian is (nearly) singular; = 6: the computation of Hankel singular values failed.Method
Let be the linear system d[x(t)] = Ax(t) + Bu(t) y(t) = Cx(t) + Du(t), (1) where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1) for a discrete-time system, and let Go(d) be the open-loop transfer-function matrix -1 Go(d) = C*(d*I-A) *B + D . Let F and G be the state feedback and observer gain matrices, respectively, chosen such that A+BF and A+GC are stable matrices. The controller has a transfer-function matrix K(d) given by -1 K(d) = F*(d*I-A-B*F-G*C-G*D*F) *G . The closed-loop transfer function matrix is given by -1 Gcl(d) = Go(d)(I+K(d)Go(d)) . K(d) can be expressed as a left coprime factorization (LCF) -1 K(d) = M_left(d) *N_left(d), or as a right coprime factorization (RCF) -1 K(d) = N_right(d)*M_right(d) , where M_left(d), N_left(d), N_right(d), and M_right(d) are stable transfer-function matrices. The subroutine SB16CD determines the matrices of a reduced controller d[z(t)] = Ac*z(t) + Bc*y(t) u(t) = Cc*z(t), (2) with the transfer-function matrix Kr, using the following stability enforcing approach proposed in [1]: (1) If JOBCF = 'L', the frequency-weighted approximation problem is solved min||[M_left(d)-M_leftr(d) N_left(d)-N_leftr(d)][-Y(d)]|| , [ X(d)] where -1 G(d) = Y(d)*X(d) is a RCF of the open-loop system transfer-function matrix. The B&T model reduction technique is used in conjunction with the method proposed in [1]. (2) If JOBCF = 'R', the frequency-weighted approximation problem is solved min || [ -U(d) V(d) ] [ N_right(d)-N_rightr(d) ] || , [ M_right(d)-M_rightr(d) ] where -1 G(d) = V(d) *U(d) is a LCF of the open-loop system transfer-function matrix. The B&T model reduction technique is used in conjunction with the method proposed in [1]. If ORDSEL = 'A', the order of the controller is determined by computing the number of Hankel singular values greater than the given tolerance TOL. The Hankel singular values are the square roots of the eigenvalues of the product of two frequency-weighted Grammians P and Q, defined as follows. If JOBCF = 'L', then P is the controllability Grammian of a system of the form (A+BF,B,*,*), and Q is the observability Grammian of a system of the form (A+GC,*,F,*). This choice corresponds to an input frequency-weighted order reduction of left coprime factors [1]. If JOBCF = 'R', then P is the controllability Grammian of a system of the form (A+BF,G,*,*), and Q is the observability Grammian of a system of the form (A+GC,*,C,*). This choice corresponds to an output frequency-weighted order reduction of right coprime factors [1]. For the computation of truncation matrices, the B&T approach is used in conjunction with accuracy enhancing techniques. If JOBMR = 'B', the square-root B&T method of [2,4] is used. If JOBMR = 'F', the balancing-free square-root version of the B&T method [3,4] is used.References
[1] Liu, Y., Anderson, B.D.O. and Ly, O.L. Coprime factorization controller reduction with Bezout identity induced frequency weighting. Automatica, vol. 26, pp. 233-249, 1990. [2] Tombs, M.S. and Postlethwaite I. Truncated balanced realization of stable, non-minimal state-space systems. Int. J. Control, Vol. 46, pp. 1319-1330, 1987. [3] Varga, A. Efficient minimal realization procedure based on balancing. Proc. of IMACS/IFAC Symp. MCTS, Lille, France, May 1991, A. El Moudui, P. Borne, S. G. Tzafestas (Eds.), Vol. 2, pp. 42-46, 1991. [4] Varga, A. Coprime factors model reduction method based on square-root balancing-free techniques. System Analysis, Modelling and Simulation, Vol. 11, pp. 303-311, 1993.Numerical Aspects
The implemented methods rely on accuracy enhancing square-root or balancing-free square-root techniques. 3 The algorithms require less than 30N floating point operations.Further Comments
NoneExample
Program Text
* SB16CD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD, LDDC, LDF, LDG PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDDC = MMAX, LDF = MMAX, LDG = NMAX ) INTEGER LDWORK, LIWORK, MPMAX PARAMETER ( LIWORK = 2*NMAX, MPMAX = MAX( MMAX, PMAX ) ) PARAMETER ( LDWORK = 2*NMAX*NMAX + $ MAX( 2*NMAX*NMAX + 5*NMAX, $ NMAX*( NMAX + MAX( NMAX, MPMAX ) $ + MIN( NMAX, MPMAX ) + 6 ) ) $ ) CHARACTER DICO, JOBCF, JOBD, JOBMR, ORDSEL INTEGER I, INFO, IWARN, J, M, N, NCR, P DOUBLE PRECISION TOL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), $ F(LDF,NMAX), G(LDG,PMAX), HSV(NMAX) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL SB16CD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NCR, TOL, $ DICO, JOBD, JOBMR, JOBCF, ORDSEL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) READ ( NIN, FMT = * ) ( ( F(I,J), J = 1,N ), I = 1,M ) READ ( NIN, FMT = * ) ( ( G(I,J), J = 1,P ), I = 1,N ) * Find a reduced ssr for (A,B,C,D). CALL SB16CD( DICO, JOBD, JOBMR, JOBCF, ORDSEL, N, M, P, $ NCR, A, LDA, B, LDB, C, LDC, D, LDD, F, LDF, $ G, LDG, HSV, TOL, IWORK, DWORK, LDWORK, $ IWARN, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NCR WRITE ( NOUT, FMT = 99987 ) WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,N ) IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NCR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NCR ) 20 CONTINUE IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NCR WRITE ( NOUT, FMT = 99995 ) ( G(I,J), J = 1,P ) 40 CONTINUE IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, M WRITE ( NOUT, FMT = 99995 ) ( F(I,J), J = 1,NCR ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SB16CD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB16CD = ',I2) 99997 FORMAT (' The order of reduced controller = ',I2) 99996 FORMAT (/' The reduced controller state dynamics matrix Ac is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The reduced controller input/state matrix Bc is ') 99992 FORMAT (/' The reduced controller state/output matrix Cc is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The frequency-weighted Hankel singular values are:') ENDProgram Data
SB16CD EXAMPLE PROGRAM DATA (Continuous system) 8 1 1 2 0.1E0 C D F R F 0 1.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0150 0.7650 0 0 0 0 0 0 -0.7650 -0.0150 0 0 0 0 0 0 0 0 -0.0280 1.4100 0 0 0 0 0 0 -1.4100 -0.0280 0 0 0 0 0 0 0 0 -0.0400 1.850 0 0 0 0 0 0 -1.8500 -0.040 0.0260 -0.2510 0.0330 -0.8860 -4.0170 0.1450 3.6040 0.2800 -.996 -.105 0.261 .009 -.001 -.043 0.002 -0.026 0.0 4.472135954999638e-002 6.610515358414598e-001 4.698598960657579e-003 3.601363251422058e-001 1.032530880771415e-001 -3.754055214487997e-002 -4.268536964759344e-002 3.287284547842979e-002 4.108939884667451e-001 8.684600000000012e-002 3.852317308197148e-004 -3.619366874815911e-003 -8.803722876359955e-003 8.420521094001852e-003 1.234944428038507e-003 4.263205617645322e-003Program Results
SB16CD EXAMPLE PROGRAM RESULTS The order of reduced controller = 2 The frequency-weighted Hankel singular values are: 3.3073 0.7274 0.1124 0.0784 0.0242 0.0182 0.0101 0.0094 The reduced controller state dynamics matrix Ac is -0.4334 0.4884 -0.1950 -0.1093 The reduced controller input/state matrix Bc is -0.4231 -0.1785 The reduced controller state/output matrix Cc is -0.0326 -0.2307
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SB16CY.html 0000664 0000000 0000000 00000017315 14560147231 0020370 0 ustar 00root root 0000000 0000000
Purpose
To compute, for a given open-loop model (A,B,C,0), and for given state feedback gain F and full observer gain G, such that A+B*F and A+G*C are stable, the Cholesky factors Su and Ru of a controllability Grammian P = Su*Su' and of an observability Grammian Q = Ru'*Ru corresponding to a frequency-weighted model reduction of the left or right coprime factors of the state-feedback controller.Specification
SUBROUTINE SB16CY( DICO, JOBCF, N, M, P, A, LDA, B, LDB, C, LDC, $ F, LDF, G, LDG, SCALEC, SCALEO, S, LDS, R, LDR, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBCF INTEGER INFO, LDA, LDB, LDC, LDF, LDG, LDR, LDS, LDWORK, $ M, N, P DOUBLE PRECISION SCALEC, SCALEO C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ F(LDF,*), G(LDG,*), R(LDR,*), S(LDS,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the open-loop system as follows: = 'C': continuous-time system; = 'D': discrete-time system. JOBCF CHARACTER*1 Specifies whether a left or right coprime factorization of the state-feedback controller is to be used as follows: = 'L': use a left coprime factorization; = 'R': use a right coprime factorization.Input/Output Parameters
N (input) INTEGER The order of the open-loop state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the open-loop system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input/state matrix B of the open-loop system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the state/output matrix C of the open-loop system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). F (input) DOUBLE PRECISION array, dimension (LDF,N) The leading M-by-N part of this array must contain a stabilizing state feedback matrix. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,M). G (input) DOUBLE PRECISION array, dimension (LDG,P) The leading N-by-P part of this array must contain a stabilizing observer gain matrix. LDG INTEGER The leading dimension of array G. LDG >= MAX(1,N). SCALEC (output) DOUBLE PRECISION Scaling factor for the controllability Grammian. See METHOD. SCALEO (output) DOUBLE PRECISION Scaling factor for the observability Grammian. See METHOD. S (output) DOUBLE PRECISION array, dimension (LDS,N) The leading N-by-N upper triangular part of this array contains the Cholesky factor Su of frequency-weighted cotrollability Grammian P = Su*Su'. See METHOD. LDS INTEGER The leading dimension of the array S. LDS >= MAX(1,N). R (output) DOUBLE PRECISION array, dimension (LDR,N) The leading N-by-N upper triangular part of this array contains the Cholesky factor Ru of the frequency-weighted observability Grammian Q = Ru'*Ru. See METHOD. LDR INTEGER The leading dimension of the array R. LDR >= MAX(1,N).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N*(N + MAX(N,M) + MIN(N,M) + 6)), if JOBCF = 'L'; LDWORK >= MAX(1, N*(N + MAX(N,P) + MIN(N,P) + 6)), if JOBCF = 'R'. For optimum performance LDWORK should be larger. An upper bound for both cases is LDWORK >= MAX(1, N*(N + MAX(N,M,P) + 7)).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: eigenvalue computation failure; = 2: the matrix A+G*C is not stable; = 3: the matrix A+B*F is not stable; = 4: the Lyapunov equation for computing the observability Grammian is (nearly) singular; = 5: the Lyapunov equation for computing the controllability Grammian is (nearly) singular.Method
In accordance with the type of the coprime factorization of the controller (left or right), the Cholesky factors Su and Ru of the frequency-weighted controllability Grammian P = Su*Su' and of the frequency-weighted observability Grammian Q = Ru'*Ru are computed by solving appropriate Lyapunov or Stein equations [1]. If JOBCF = 'L' and DICO = 'C', P and Q are computed as the solutions of the following Lyapunov equations: (A+B*F)*P + P*(A+B*F)' + scalec^2*B*B' = 0, (1) (A+G*C)'*Q + Q*(A+G*C) + scaleo^2*F'*F = 0. (2) If JOBCF = 'L' and DICO = 'D', P and Q are computed as the solutions of the following Stein equations: (A+B*F)*P*(A+B*F)' - P + scalec^2*B*B' = 0, (3) (A+G*C)'*Q*(A+G*C) - Q + scaleo^2*F'*F = 0. (4) If JOBCF = 'R' and DICO = 'C', P and Q are computed as the solutions of the following Lyapunov equations: (A+B*F)*P + P*(A+B*F)' + scalec^2*G*G' = 0, (5) (A+G*C)'*Q + Q*(A+G*C) + scaleo^2*C'*C = 0. (6) If JOBCF = 'R' and DICO = 'D', P and Q are computed as the solutions of the following Stein equations: (A+B*F)*P*(A+B*F)' - P + scalec^2*G*G' = 0, (7) (A+G*C)'*Q*(A+G*C) - Q + scaleo^2*C'*C = 0. (8)References
[1] Liu, Y., Anderson, B.D.O. and Ly, O.L. Coprime factorization controller reduction with Bezout identity induced frequency weighting. Automatica, vol. 26, pp. 233-249, 1990.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X either the continuous-time algebraic Riccati equation -1 Q + A'XE + E'XA - (L+E'XB)R (L+E'XB)' = 0 , (1) or the discrete-time algebraic Riccati equation -1 E'XE = A'XA - (L+A'XB)(R + B'XB) (L+A'XB)' + Q , (2) where A, E, B, Q, R, and L are N-by-N, N-by-N, N-by-M, N-by-N, M-by-M and N-by-M matrices, respectively, such that Q = C'C, R = D'D and L = C'D; X is an N-by-N symmetric matrix. The routine also returns the computed values of the closed-loop spectrum of the system, i.e., the stable eigenvalues lambda(1),...,lambda(N) of the pencil (A - BF,E), where F is the optimal gain matrix, -1 F = R (L+E'XB)' , for (1), and -1 F = (R+B'XB) (L+A'XB)' , for (2). -1 Optionally, matrix G = BR B' may be given instead of B and R. Other options include the case with Q and/or R given in a factored form, Q = C'C, R = D'D, and with L a zero matrix. The routine uses the method of deflating subspaces, based on reordering the eigenvalues in a generalized Schur matrix pair. It is assumed that E is nonsingular, but this condition is not checked. Note that the definition (1) of the continuous-time algebraic Riccati equation, and the formula for the corresponding optimal gain matrix, require R to be nonsingular, but the associated linear quadratic optimal problem could have a unique solution even when matrix R is singular, under mild assumptions (see METHOD). The routine SG02AD works accordingly in this case.Specification
SUBROUTINE SG02AD( DICO, JOBB, FACT, UPLO, JOBL, SCAL, SORT, ACC, $ N, M, P, A, LDA, E, LDE, B, LDB, Q, LDQ, R, $ LDR, L, LDL, RCONDU, X, LDX, ALFAR, ALFAI, $ BETA, S, LDS, T, LDT, U, LDU, TOL, IWORK, $ DWORK, LDWORK, BWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER ACC, DICO, FACT, JOBB, JOBL, SCAL, SORT, UPLO INTEGER INFO, IWARN, LDA, LDB, LDE, LDL, LDQ, LDR, LDS, $ LDT, LDU, LDWORK, LDX, M, N, P DOUBLE PRECISION RCONDU, TOL C .. Array Arguments .. LOGICAL BWORK(*) INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), ALFAI(*), ALFAR(*), B(LDB,*), BETA(*), $ DWORK(*), E(LDE,*), L(LDL,*), Q(LDQ,*), $ R(LDR,*), S(LDS,*), T(LDT,*), U(LDU,*), X(LDX,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of Riccati equation to be solved as follows: = 'C': Equation (1), continuous-time case; = 'D': Equation (2), discrete-time case. JOBB CHARACTER*1 Specifies whether or not the matrix G is given, instead of the matrices B and R, as follows: = 'B': B and R are given; = 'G': G is given. FACT CHARACTER*1 Specifies whether or not the matrices Q and/or R (if JOBB = 'B') are factored, as follows: = 'N': Not factored, Q and R are given; = 'C': C is given, and Q = C'C; = 'D': D is given, and R = D'D; = 'B': Both factors C and D are given, Q = C'C, R = D'D. UPLO CHARACTER*1 If JOBB = 'G', or FACT = 'N', specifies which triangle of the matrices G, or Q and R, is stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored. JOBL CHARACTER*1 Specifies whether or not the matrix L is zero, as follows: = 'Z': L is zero; = 'N': L is nonzero. JOBL is not used if JOBB = 'G' and JOBL = 'Z' is assumed. SLICOT Library routine SB02MT should be called just before SG02AD, for obtaining the results when JOBB = 'G' and JOBL = 'N'. SCAL CHARACTER*1 If JOBB = 'B', specifies whether or not a scaling strategy should be used to scale Q, R, and L, as follows: = 'G': General scaling should be used; = 'N': No scaling should be used. SCAL is not used if JOBB = 'G'. SORT CHARACTER*1 Specifies which eigenvalues should be obtained in the top of the generalized Schur form, as follows: = 'S': Stable eigenvalues come first; = 'U': Unstable eigenvalues come first. ACC CHARACTER*1 Specifies whether or not iterative refinement should be used to solve the system of algebraic equations giving the solution matrix X, as follows: = 'R': Use iterative refinement; = 'N': Do not use iterative refinement.Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e., the order of the matrices A, E, Q, and X, and the number of rows of the matrices B and L. N >= 0. M (input) INTEGER The number of system inputs. If JOBB = 'B', M is the order of the matrix R, and the number of columns of the matrix B. M >= 0. M is not used if JOBB = 'G'. P (input) INTEGER The number of system outputs. If FACT = 'C' or 'D' or 'B', P is the number of rows of the matrices C and/or D. P >= 0. Otherwise, P is not used. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the descriptor system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) The leading N-by-N part of this array must contain the matrix E of the descriptor system. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,*) If JOBB = 'B', the leading N-by-M part of this array must contain the input matrix B of the system. If JOBB = 'G', the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the matrix -1 G = BR B'. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). Q (input) DOUBLE PRECISION array, dimension (LDQ,N) If FACT = 'N' or 'D', the leading N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric state weighting matrix Q. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. If FACT = 'C' or 'B', the leading P-by-N part of this array must contain the output matrix C of the system. If JOBB = 'B' and SCAL = 'G', then Q is modified internally, but is restored on exit. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,N) if FACT = 'N' or 'D'; LDQ >= MAX(1,P) if FACT = 'C' or 'B'. R (input) DOUBLE PRECISION array, dimension (LDR,*) If FACT = 'N' or 'C', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric input weighting matrix R. The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') is not referenced. If FACT = 'D' or 'B', the leading P-by-M part of this array must contain the direct transmission matrix D of the system. If JOBB = 'B' and SCAL = 'G', then R is modified internally, but is restored on exit. If JOBB = 'G', this array is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,M) if JOBB = 'B' and FACT = 'N' or 'C'; LDR >= MAX(1,P) if JOBB = 'B' and FACT = 'D' or 'B'; LDR >= 1 if JOBB = 'G'. L (input) DOUBLE PRECISION array, dimension (LDL,*) If JOBL = 'N' and JOBB = 'B', the leading N-by-M part of this array must contain the cross weighting matrix L. If JOBB = 'B' and SCAL = 'G', then L is modified internally, but is restored on exit. If JOBL = 'Z' or JOBB = 'G', this array is not referenced. LDL INTEGER The leading dimension of array L. LDL >= MAX(1,N) if JOBL = 'N' and JOBB = 'B'; LDL >= 1 if JOBL = 'Z' or JOBB = 'G'. RCONDU (output) DOUBLE PRECISION If N > 0 and INFO = 0 or INFO = 7, an estimate of the reciprocal of the condition number (in the 1-norm) of the N-th order system of algebraic equations from which the solution matrix X is obtained. X (output) DOUBLE PRECISION array, dimension (LDX,N) If INFO = 0, the leading N-by-N part of this array contains the solution matrix X of the problem. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N). ALFAR (output) DOUBLE PRECISION array, dimension (2*N) ALFAI (output) DOUBLE PRECISION array, dimension (2*N) BETA (output) DOUBLE PRECISION array, dimension (2*N) The generalized eigenvalues of the 2N-by-2N matrix pair, ordered as specified by SORT (if INFO = 0, or INFO >= 5). For instance, if SORT = 'S', the leading N elements of these arrays contain the closed-loop spectrum of the system. Specifically, lambda(k) = [ALFAR(k)+j*ALFAI(k)]/BETA(k) for k = 1,2,...,N. S (output) DOUBLE PRECISION array, dimension (LDS,*) The leading 2N-by-2N part of this array contains the ordered real Schur form S of the first matrix in the reduced matrix pencil associated to the optimal problem, corresponding to the scaled Q, R, and L, if JOBB = 'B' and SCAL = 'G'. That is, (S S ) ( 11 12) S = ( ), (0 S ) ( 22) where S , S and S are N-by-N matrices. 11 12 22 Array S must have 2*N+M columns if JOBB = 'B', and 2*N columns, otherwise. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,2*N+M) if JOBB = 'B'; LDS >= MAX(1,2*N) if JOBB = 'G'. T (output) DOUBLE PRECISION array, dimension (LDT,2*N) The leading 2N-by-2N part of this array contains the ordered upper triangular form T of the second matrix in the reduced matrix pencil associated to the optimal problem, corresponding to the scaled Q, R, and L, if JOBB = 'B' and SCAL = 'G'. That is, (T T ) ( 11 12) T = ( ), (0 T ) ( 22) where T , T and T are N-by-N matrices. 11 12 22 LDT INTEGER The leading dimension of array T. LDT >= MAX(1,2*N+M) if JOBB = 'B'; LDT >= MAX(1,2*N) if JOBB = 'G'. U (output) DOUBLE PRECISION array, dimension (LDU,2*N) The leading 2N-by-2N part of this array contains the right transformation matrix U which reduces the 2N-by-2N matrix pencil to the ordered generalized real Schur form (S,T). That is, (U U ) ( 11 12) U = ( ), (U U ) ( 21 22) where U , U , U and U are N-by-N matrices. 11 12 21 22 If JOBB = 'B' and SCAL = 'G', then U corresponds to the scaled pencil. If a basis for the stable deflating subspace of the original problem is needed, then the submatrix U must be multiplied by the scaling factor 21 contained in DWORK(4). LDU INTEGER The leading dimension of array U. LDU >= MAX(1,2*N).Tolerances
TOL DOUBLE PRECISION The tolerance to be used to test for near singularity of the original matrix pencil, specifically of the triangular M-by-M factor obtained during the reduction process. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number of that matrix; a matrix whose estimated condition number is less than 1/TOL is considered to be nonsingular. If the user sets TOL <= 0, then a default tolerance, defined by TOLDEF = EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). This parameter is not referenced if JOBB = 'G'.Workspace
IWORK INTEGER array, dimension (LIWORK) LIWORK >= MAX(1,M,2*N) if JOBB = 'B'; LIWORK >= MAX(1,2*N) if JOBB = 'G'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. If JOBB = 'B' and N > 0, DWORK(2) returns the reciprocal of the condition number of the M-by-M bottom right lower triangular matrix obtained while compressing the matrix pencil of order 2N+M to obtain a pencil of order 2N. If ACC = 'R', and INFO = 0 or INFO = 7, DWORK(3) returns the reciprocal pivot growth factor (see SLICOT Library routine MB02PD) for the LU factorization of the coefficient matrix of the system of algebraic equations giving the solution matrix X; if DWORK(3) is much less than 1, then the computed X and RCONDU could be unreliable. If INFO = 0 or INFO = 7, DWORK(4) returns the scaling factor used to scale Q, R, and L. DWORK(4) is set to 1 if JOBB = 'G' or SCAL = 'N'. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(7*(2*N+1)+16,16*N), if JOBB = 'G'; LDWORK >= MAX(7*(2*N+1)+16,16*N,2*N+M,3*M), if JOBB = 'B'. For optimum performance LDWORK should be larger. BWORK LOGICAL array, dimension (2*N)Warning Indicator
IWARN INTEGER = 0: no warning; = 1: the computed solution may be inaccurate due to poor scaling or eigenvalues too close to the boundary of the stability domain (the imaginary axis, if DICO = 'C', or the unit circle, if DICO = 'D').Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the computed extended matrix pencil is singular, possibly due to rounding errors; = 2: if the QZ algorithm failed; = 3: if reordering of the generalized eigenvalues failed; = 4: if after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the generalized Schur form no longer satisfy the stability condition; this could also be caused due to scaling; = 5: if the computed dimension of the solution does not equal N; = 6: if the spectrum is too close to the boundary of the stability domain; = 7: if a singular matrix was encountered during the computation of the solution matrix X.Method
The routine uses a variant of the method of deflating subspaces proposed by van Dooren [1]. See also [2], [3], [4]. It is assumed that E is nonsingular, the triple (E,A,B) is strongly stabilizable and detectable (see [3]); if, in addition, - [ Q L ] R := [ ] >= 0 , [ L' R ] then the pencils discrete-time continuous-time |A 0 B| |E 0 0| |A 0 B| |E 0 0| |Q -E' L| - z |0 -A' 0| , |Q A' L| - s |0 -E' 0| , (3) |L' 0 R| |0 -B' 0| |L' B' R| |0 0 0| are dichotomic, i.e., they have no eigenvalues on the boundary of the stability domain. The above conditions are sufficient for regularity of these pencils. A necessary condition is that rank([ B' L' R']') = m. Under these assumptions the algebraic Riccati equation is known to have a unique non-negative definite solution. The first step in the method of deflating subspaces is to form the extended matrices in (3), of order 2N + M. Next, these pencils are compressed to a form of order 2N (see [1]) lambda x A - B . f f This generalized eigenvalue problem is then solved using the QZ algorithm and the stable deflating subspace Ys is determined. If [Y1'|Y2']' is a basis for Ys, then the required solution is -1 X = Y2 x Y1 .References
[1] Van Dooren, P. A Generalized Eigenvalue Approach for Solving Riccati Equations. SIAM J. Sci. Stat. Comp., 2, pp. 121-135, 1981. [2] Arnold, III, W.F. and Laub, A.J. Generalized Eigenproblem Algorithms and Software for Algebraic Riccati Equations. Proc. IEEE, 72, 1746-1754, 1984. [3] Mehrmann, V. The Autonomous Linear Quadratic Control Problem. Theory and Numerical Solution. Lect. Notes in Control and Information Sciences, vol. 163, Springer-Verlag, Berlin, 1991. [4] Sima, V. Algorithms for Linear-Quadratic Optimization. Pure and Applied Mathematics: A Series of Monographs and Textbooks, vol. 200, Marcel Dekker, Inc., New York, 1996.Numerical Aspects
This routine is particularly suited for systems where the matrix R is ill-conditioned, or even singular.Further Comments
To obtain a stabilizing solution of the algebraic Riccati equations set SORT = 'S'. The routine can also compute the anti-stabilizing solutions of the algebraic Riccati equations, by specifying SORT = 'U'.Example
Program Text
* SG02AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER NMAX2M, NMAX2, NMMAX PARAMETER ( NMAX2M = 2*NMAX+MMAX, NMAX2 = 2*NMAX, $ NMMAX = MAX(NMAX,MMAX) ) INTEGER LDA, LDB, LDE, LDL, LDQ, LDR, LDS, LDT, LDU, LDX PARAMETER ( LDA = NMAX, LDB = NMAX, LDE = NMAX, LDL = NMAX, $ LDQ = MAX(NMAX,PMAX), LDR = MAX(MMAX,PMAX), $ LDS = NMAX2M, LDT = NMAX2M, LDU = NMAX2, $ LDX = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MAX(MMAX,NMAX2) ) INTEGER LDWORK PARAMETER ( LDWORK = MAX(14*NMAX+23,16*NMAX,2*NMAX+MMAX, $ 3*MMAX) ) INTEGER LBWORK PARAMETER ( LBWORK = NMAX2 ) * .. Local Scalars .. DOUBLE PRECISION RCONDU, TOL INTEGER I, INFO, IWARN, J, M, N, P CHARACTER*1 ACC, DICO, FACT, JOBB, JOBL, SCAL, SORT, UPLO LOGICAL LJOBB * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALFAI(NMAX2), ALFAR(NMAX2), $ B(LDB,NMMAX), BETA(NMAX2), DWORK(LDWORK), $ E(LDE,NMAX), L(LDL,MMAX), Q(LDQ,NMAX), $ R(LDR,MMAX), S(LDS,NMAX2M), T(LDT,NMAX2), $ U(LDU,NMAX2), X(LDX,NMAX) INTEGER IWORK(LIWORK) LOGICAL BWORK(LBWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SG02AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, DICO, JOBB, FACT, UPLO, JOBL, $ SCAL, SORT, ACC IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99994 ) M ELSE LJOBB = LSAME( JOBB, 'B' ) IF ( LJOBB ) THEN READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,N ) END IF IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99993 ) P ELSE IF ( LSAME( FACT, 'N' ) .OR. LSAME( FACT, 'D' ) ) THEN READ ( NIN, FMT = * ) $ ( ( Q(I,J), J = 1,N ), I = 1,N ) ELSE READ ( NIN, FMT = * ) $ ( ( Q(I,J), J = 1,N ), I = 1,P ) END IF IF ( LJOBB ) THEN IF ( LSAME( FACT, 'N' ) .OR. LSAME( FACT, 'C' ) ) THEN READ ( NIN, FMT = * ) $ ( ( R(I,J), J = 1,M ), I = 1,M ) ELSE READ ( NIN, FMT = * ) $ ( ( R(I,J), J = 1,M ), I = 1,P ) END IF IF ( LSAME( JOBL, 'N' ) ) $ READ ( NIN, FMT = * ) $ ( ( L(I,J), J = 1,M ), I = 1,N ) END IF * Find the solution matrix X. CALL SG02AD( DICO, JOBB, FACT, UPLO, JOBL, SCAL, SORT, $ ACC, N, M, P, A, LDA, E, LDE, B, LDB, Q, $ LDQ, R, LDR, L, LDL, RCONDU, X, LDX, ALFAR, $ ALFAI, BETA, S, LDS, T, LDT, U, LDU, TOL, $ IWORK, DWORK, LDWORK, BWORK, IWARN, 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 ) ( X(I,J), J = 1,N ) 20 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' SG02AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SG02AD = ',I2) 99997 FORMAT (' The solution matrix X is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' M is out of range.',/' M = ',I5) 99993 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
SG02AD EXAMPLE PROGRAM DATA 2 1 3 0.0 C B B U Z N S N 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0Program Results
SG02AD EXAMPLE PROGRAM RESULTS The solution matrix X is 1.7321 1.0000 1.0000 1.7321
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SG02CV.html 0000664 0000000 0000000 00000021730 14560147231 0020361 0 ustar 00root root 0000000 0000000
Purpose
To compute the residual matrix R for a continuous-time or discrete-time "reduced" Lyapunov equation, using the formulas R = op(A)'*X + X*op(A) + Q, or R = op(A)'*X*op(E) + op(E)'*X*op(A) + Q, in the continuous-time case, or the formulas R = op(A)'*X*op(A) - X + Q, or R = op(A)'*X*op(A) - op(E)'*X*op(E) + Q, in the discrete-time case, where X and Q are symmetric matrices, A is in upper real Schur form, E is upper triangular, and op(W) is op(W) = W or op(W) = W'. Optionally, the Frobenius norms of the product terms defining the denominator of the relative residual are also computed. The norms of Q and X are not computed.Specification
SUBROUTINE SG02CV( DICO, JOB, JOBE, UPLO, TRANS, N, A, LDA, E, $ LDE, X, LDX, R, LDR, NORMS, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOB, JOBE, TRANS, UPLO INTEGER INFO, LDA, LDE, LDR, LDWORK, LDX, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), DWORK(*), E(LDE,*), NORMS(*), $ R(LDR,*), X(LDX,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the Lyapunov equation, as follows: = 'C': continuous-time Lyapunov equation; = 'D': discrete-time Lyapunov equation. JOB CHARACTER*1 Specifies which results must be computed, as follows: = 'R': The matrix R only must be computed; = 'N': The matrix R and the norms must be computed; = 'B': The matrix R and the norms must be computed. JOBE CHARACTER*1 Specifies whether E is a general or an identity matrix, as follows: = 'G': The matrix E is general and is given; = 'I': The matrix E is assumed identity and is not given. UPLO CHARACTER*1 Specifies which triangles of the symmetric matrices X and Q are given, as follows: = 'U': The upper triangular part is given; = 'L': The lower triangular part is given. TRANS CHARACTER*1 Specifies the form of op(W) to be used in the formulas above, as follows: = 'N': op(W) = W; = 'T': op(W) = W'; = 'C': op(W) = W'.Input/Output Parameters
N (input) INTEGER The order of the matrices A, E, Q, X, and R. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N upper part of this array must contain the upper real Schur matrix A. If TRANS = 'N' and (DICO = 'D' or (JOB = 'R' and JOBE = 'G')), the entries 3, 4,..., N of the first column are modified internally, but are restored on exit. Otherwise, the part of this array below the first subdiagonal is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,*) If JOBE = 'G', the leading N-by-N upper triangular part of this array must contain the upper triangular matrix E. The strictly lower triangular part of this array is not referenced. If JOBE = 'I', this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N), if JOBE = 'G'; LDE >= 1, if JOBE = 'I'. X (input/works.) DOUBLE PRECISION array, dimension (LDX,N) On entry, if UPLO = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the symmetric matrix X and the strictly lower triangular part of the array is not referenced. On entry, if UPLO = 'L', the leading N-by-N lower triangular part of this array must contain the lower triangular part of the symmetric matrix X and the strictly upper triangular part of the array is not referenced. If DICO = 'D' or (JOB = 'R' and JOBE = 'G'), the diagonal elements of this array are modified internally, but they are restored on exit. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N). R (input/output) DOUBLE PRECISION array, dimension (LDR,*) On entry, the leading N-by-N upper or lower triangular part (depending on UPLO) of this array must contain the upper or lower triangular part, respectively, of the matrix Q. The other strictly triangular part is not referenced. On exit, the leading N-by-N upper or lower triangular part (depending on UPLO) of this array contains the upper or lower triangular part, respectively, of the matrix R. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). NORMS (output) DOUBLE PRECISION array, dimension (LN) If JOB = 'N' or JOB = 'B', LN = 1 or 2, if (DICO = 'C' or JOBE = 'I'), or (DICO = 'D' and JOBE = 'G'), respectively. If DICO = 'C', NORMS(1) contains the Frobenius norm of the matrix op(A)'*X (or of X*op(A)), if JOBE = 'I', or of the matrix op(A)'*X*op(E) (or of op(E)'*X*op(A)), if JOBE = 'G'. If DICO = 'D', NORMS(1) contains the Frobenius norm of the matrix op(A)'*X*op(A); if JOBE = 'G', NORMS(2) contains the Frobenius norm of the matrix op(E)'*X*op(E). If JOB <> 'N', this array is not referenced.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = -17 or if LDWORK = -2 on input, then DWORK(1) returns the minimum value of LDWORK. On exit, if INFO = 0, or if LDWORK = -1 on input, then DWORK(1) returns the optimal value of LDWORK. LDWORK The length of the array DWORK. LDWORK >= MAX(v,1), with v specified in the following table, where a = 1, if JOBE = 'G'; a = 0, if JOBE = 'I'. DICO JOB v ---------------------------- 'C' 'R' a*N*N 'C' 'N','B' N*N ---------------------------- 'D' 'R' N*N 'D' 'N','B' 2*N*N ---------------------------- If LDWORK = -1, an optimal 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 is issued by XERBLA. If LDWORK = -2, a minimal workspace query is assumed; the routine only calculates the minimal size of the DWORK array, returns this value as the first entry of the DWORK array, and no error message is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix expressions are efficiently evaluated, using symmetry. If JOB = 'N' or JOB = 'B', then: If DICO = 'C', the matrices op(op(A)'*X*op(E)) or op(X*op(A)), are efficiently computed. If DICO = 'D', the matrices op(A)'*X*op(A) and op(E)'*X*op(E), if JOBE = 'G', are efficiently computed. The results are used to evaluate R and the norms. If JOB = 'R', then the needed parts of the intermediate results are obtained and used to evaluate R.Numerical Aspects
The calculations are backward stable. The algorithm requires approximately a*N^3 operations, where ^ denotes the power operator, and a = 1, if DICO = 'C' and JOB <> 'R' and JOBE = 'G'; a = 1/2, otherwise. An "operation" includes a multiplication, an addition, and some address calculations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the residual matrix R for a continuous-time or discrete-time Riccati equation and/or the "closed-loop system" matrix op(C), using the formulas R = op(A)'*X + X*op(A) +/- X*G*X + Q, C = op(A) +/- G*X, or R = op(A)'*X*op(E) + op(E)'*X*op(A) +/- op(E)'*X*G*X*op(E) + Q, C = op(A) +/- G*X*op(E), or R = op(A)'*X*op(E) + op(E)'*X*op(A) +/- H*K + Q, C = op(A) +/- B*K, in the continuous-time case, or the formulas R = op(A)'*X*op(A) - X +/- op(A)'*X*G*X*op(A) + Q, C = op(A) +/- G*X*op(A), or R = op(A)'*X*op(A) - op(E)'*X*op(E) +/- op(A)'*X*G*X*op(A) + Q, C = op(A) +/- G*X*op(A), or R = op(A)'*X*op(A) - op(E)'*X*op(E) +/- H*K + Q, C = op(A) +/- B*K, in the discrete-time case, where X, G, and Q are symmetric matrices, A, E, H, K, B are general matrices, and op(W) is one of op(W) = W or op(W) = W'. _-1 Instead of the symmetric N-by-N matrix G, G = B*R *B', the N-by-M _-1 matrix D, D = B*L , such that G = D*D', may be given on entry. _ _ _ _ The matrix R, with R = L'*L, is a weighting matrix of the optimal _ _ problem, if DICO = 'C', or it is R = B'*X*B + Rd, if DICO = 'D', _ _ _ with Rd a similar weighting matrix; L is a Cholesky factor of R, _ _ if R is positive definite. If R is not positive definite, which may happen in the discrete-time case, a UdU' or LdL' factorization is used to compute the matrices H and K. If M = 0, the residual matrix of a (generalized) Lyapunov or Stein equation is computed. To this end, set JOBG = 'D' and JOB = 'R' (since op(C) = A in this case). Optionally, the quadratic term in the formulas for R is specified as H*K, where H = L + op(E)'*X*B, if DICO = 'C', or H = L + op(A)'*X*B, if DICO = 'D', and _-1 K = R *H', with L an N-by-M matrix. This is useful, e.g., for DICO = 'D', _ _ when L <> 0 and/or Rd is singular, hence R might be numerically indefinite; it might be indefinite in the first iterations of Newton's algorithm. Depending on JOB, part or all of the matrices H, K, and B should be given in such a case. _ If R is positive definite, the quadratic term can be specified as F*F', and the second term in the formulas for C is D*F', where _-1 F = H*L . The matrices F and/or D should be given. This option is not useful when L = 0, unless F and D are available. If DICO = 'C', the computational problem with L <> 0 is equivalent with one with L = 0 after replacing _-1 _-1 A := A - B*R* L', Q := Q - L*R* L'. _ _ These formulas, with R replaced by Rd, can also be used in the _ discrete-time case, if Rd is nonsingular and well-conditioned with respect to inversion. Optionally, the Frobenius norms of the product terms defining the denominator of the relative residual are also computed. The norms of Q and X are not computed.Specification
SUBROUTINE SG02CW( DICO, JOB, JOBE, FLAG, JOBG, UPLO, TRANS, N, M, $ A, LDA, E, LDE, G, LDG, X, LDX, F, LDF, K, LDK, $ XE, LDXE, R, LDR, C, LDC, NORMS, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER DICO, FLAG, JOB, JOBE, JOBG, TRANS, UPLO INTEGER INFO, LDA, LDC, LDE, LDF, LDG, LDK, LDR, LDWORK, $ LDX, LDXE, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), C(LDC,*), DWORK(*), E(LDE,*), $ F(LDF,*), G(LDG,*), K(LDK,*), NORMS(*), $ R(LDR,*), X(LDX,*), XE(LDXE,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the Riccati equation, as follows: = 'C': continuous-time algebraic Riccati equation; = 'D': discrete-time algebraic Riccati equation. JOB CHARACTER*1 Specifies which results must be computed, as follows: = 'A': Both (all) matrices R and C must be computed; = 'R': The matrix R only must be computed; = 'C': The matrix C only must be computed; = 'N': The matrices R and C and the norms must be computed; = 'B': The matrix R and the norms must be computed. JOBE CHARACTER*1 Specifies whether E is a general or an identity matrix, as follows: = 'G': The matrix E is general and is given; = 'I': The matrix E is assumed identity and is not given. FLAG CHARACTER*1 Specifies which sign is used, as follows: = 'P': The plus sign is used; = 'M': The minus sign is used. JOBG CHARACTER*1 Specifies how the quadratic term in the formulas for R is defined, as follows: = 'G': The matrix G is given; = 'D': The matrix D is given; = 'F': The matrix F is given; = 'H': The matrices H and K are given. UPLO CHARACTER*1 Specifies which triangles of the symmetric matrices X, G (if JOBG = 'G'), and Q (if JOB <> 'C') are given, as follows: = 'U': The upper triangular part is given; = 'L': The lower triangular part is given. TRANS CHARACTER*1 Specifies the form of op(W) to be used in the formulas above, as follows: = 'N': op(W) = W; = 'T': op(W) = W'; = 'C': op(W) = W'.Input/Output Parameters
N (input) INTEGER The order of the matrices A, E, Q, X, C and R. N >= 0. M (input) INTEGER If JOBG <> 'G', the number of columns of the matrices D, F, and/or B, H, and K'. M >= 0. If JOBG = 'G', the value of M is meaningless. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,*) If JOBE = 'G' and (JOB <> 'C' or (DICO = 'C' and (JOBG = 'G' or JOBG = 'D'))), the leading N-by-N part of this array must contain the matrix E. If JOBE = 'I' or (JOB = 'C' and (DICO = 'D' or JOBG = 'F' or JOBG = 'H')), this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N), if JOBE = 'G' and (JOB <> 'C' or (DICO = 'C' and (JOBG = 'G' or JOBG = 'D'))); LDE >= 1, if JOBE = 'I' or (JOB = 'C' and (DICO = 'D' or JOBG = 'F' or JOBG = 'H')). G (input/works.) DOUBLE PRECISION array, dimension (LDG,*) If JOBG = 'G', the leading N-by-N upper or lower triangular part (depending on UPLO) of this array must contain the upper or lower triangular part, respectively, of the matrix G. The other strictly triangular part is not referenced. If DICO = 'D', (JOB = 'R' or JOB = 'B'), and JOBG = 'G', the diagonal elements of this array are modified internally, but are restored on exit. If JOBG = 'D' or (JOBG = 'F' and JOB <> 'R' and JOB <> 'B'), the leading N-by-M part of this array must contain the matrix D, so that G = D*D'. If JOBG = 'H' and JOB <> 'R' and JOB <> 'B', the leading N-by-M part of this array must contain the matrix B. If (JOBG = 'F' or JOBG = 'H') and JOB = 'R' or JOB = 'B', this array is not referenced. LDG INTEGER The leading dimension of array G. LDG >= MAX(1,N), if JOBG = 'G' or JOBG = 'D' or (JOB <> 'R' and JOB <> 'B'); LDG >= 1, if (JOBG = 'F' or JOBG = 'H') and (JOB = 'R' or JOB = 'B'). X (input/works.) DOUBLE PRECISION array, dimension (LDX,N) The leading N-by-N part of this array must contain the symmetric matrix X, and it is unchanged on exit. If DICO = 'D', JOBE = 'G' and JOB <> 'C', the diagonal elements of this array are modified internally, but they are restored on exit. The full matrix X should be input if DICO = 'C', JOBE = 'I', and the conditions in the lines of the table below are satisfied JOBG JOB LDWORK ---------------------------------------------- 'F','H' 'A','R' LDWORK < N*N 'G' 'A','R','N' LDWORK < 2*N*N 'G' 'C' LDWORK < N*N 'G' 'B' LDWORK < 3*N*N 'D' 'R' (M<=N, LDWORK < N*N) or (M> N, LDWORK < 3*N*N) 'D' 'A' (M<=N, LDWORK < N*N) or (LDWORK >= N*N and LDWORK < 2*N*N) ---------------------------------------------- For all the other cases, including when the optimal length of the workspace array DWORK is used, only the relevant upper or lower triangular part (depending on UPLO) of this array must be input, and the other strictly triangular part is not referenced. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N). F (input) DOUBLE PRECISION array, dimension (LDF,*) If JOBG = 'F', the leading N-by-M part of this array must contain the matrix F. If JOBG = 'H', the leading N-by-M part of this array must contain the matrix H. If JOBG = 'G' or JOBG = 'D', this array is not referenced. LDF INTEGER The leading dimension of array F. LDF >= MAX(1,N), if JOBG = 'F' or JOBG = 'H'; LDF >= 1, if JOBG = 'G' or JOBG = 'D'. K (input) DOUBLE PRECISION array, dimension (LDK,*) If JOBG = 'H', the leading M-by-N part of this array must contain the matrix K. If JOBG <> 'H', this array is not referenced. LDK INTEGER The leading dimension of array K. LDK >= MAX(1,M), if JOBG = 'H'; LDK >= 1, if JOBG <> 'H'. XE (input) DOUBLE PRECISION array, dimension (LDXE,*) If (JOBG = 'F' or JOBG = 'H'), JOB <> 'C', DICO = 'C', and JOBE = 'G', the leading N-by-N part of this array must contain the matrix product X*E, if TRANS = 'N', or E*X, if TRANS = 'T' or 'C'. If (JOBG = 'F' or JOBG = 'H'), JOB <> 'C', and DICO = 'D', the leading N-by-N part of this array must contain the matrix product X*A, if TRANS = 'N', or A*X, if TRANS = 'T' or 'C'. These matrix products are needed for computing F or H. If JOBG = 'G' or JOBG = 'D' or JOB = 'C' or (DICO = 'C' and JOBE = 'I') this array is not referenced. LDXE INTEGER The leading dimension of array XE. LDXE >= MAX(1,N), if (JOBG = 'F' or JOBG = 'H'), JOB <> 'C', and either DICO = 'C' and JOBE = 'G', or DICO = 'D'; LDXE >= 1, if JOBG = 'G' or JOBG = 'D' or JOB = 'C' or (DICO = 'C' and JOBE = 'I'). R (input/output) DOUBLE PRECISION array, dimension (LDR,*) On entry, if JOB <> 'C', the leading N-by-N upper or lower triangular part (depending on UPLO) of this array must contain the upper or lower triangular part, respectively, of the matrix Q. The other strictly triangular part is not referenced. On exit, if JOB <> 'C' and INFO = 0, the leading N-by-N upper or lower triangular part (depending on UPLO) of this array contains the upper or lower triangular part, respectively, of the matrix R. If JOB = 'C', this array is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N), if JOB <> 'C'; LDR >= 1, if JOB = 'C'. C (output) DOUBLE PRECISION array, dimension (LDC,*) If JOB <> 'R' and JOB <> 'B' and INFO = 0, the leading N-by-N part of this array contains the matrix op(C). If JOB = 'R' or JOB = 'B', this array is not referenced. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,N), if JOB <> 'R' and JOB <> 'B'; LDC >= 1, if JOB = 'R' or JOB = 'B'. NORMS (output) DOUBLE PRECISION array, dimension (LN) If JOB = 'N' or JOB = 'B', LN = 2 or 3, if (DICO = 'C' or JOBE = 'I'), or (DICO = 'D' and JOBE = 'G'), respectively. If DICO = 'C', NORMS(1) contains the Frobenius norm of the matrix op(A)'*X (or of X*op(A)), if JOBE = 'I', or of the matrix op(A)'*X*op(E) (or of op(E)'*X*op(A)), if JOBE = 'G'; NORMS(2) contains the Frobenius norm of the matrix product X*G*X, if JOBE = 'I', or of the matrix product V = op(E)'*X*G*X*op(E), if JOBE = 'G' (for JOBG = 'G' or JOBG = 'D'), or of V = F*F', if JOBG = 'F', or of V = H*K, if JOBG = 'H'. If DICO = 'D', NORMS(1) contains the Frobenius norm of the matrix op(A)'*X*op(A); NORMS(2) contains the Frobenius norm of the matrix product V = op(A)'*X*G*X*op(A), if JOBG = 'G' or JOBG = 'D', or of V = F*F', if JOBG = 'F', or of V = H*K, if JOBG = 'H'; if JOBE = 'G', NORMS(3) contains the Frobenius norm of the matrix product op(E)'*X*op(E). If JOB <> 'N' and JOB <> 'B', this array is not referenced.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = -30, or if LDWORK = -2 on input, then DWORK(1) returns the minimum value of LDWORK. On exit, if INFO = 0, or if LDWORK = -1 on input, then DWORK(1) returns the optimal value of LDWORK. LDWORK The length of the array DWORK. LDWORK >= MAX(v,1), with v specified in the following table, where a = 1, if JOBE = 'G'; a = 0, if JOBE = 'I'. DICO JOBG JOB v ----------------------------------------------- 'C' 'F','H' 'A','C','R' 0 'C' 'F','H' 'N' a*N*N 'C' 'F','H' 'B' N*N 'C' 'G' 'A','C' a*N*N 'C' 'G' 'N','R' (a+1)*N*N 'C' 'G' 'B' (a+2)*N*N 'C' 'D' 'A' N*MIN(M,(a+1)*N) 'C' 'D' 'C' N*MIN(N,M) 'C' 'D' 'N' N*(N+MIN(a*N,M)) 'C' 'D' 'B' N*(N+MIN(N+a*N,M)) 'C' 'D' 'R' N*MIN(a*N+M,(a+2)*N) ----------------------------------------------- 'D' 'F','H' 'A','C' 0 'D' 'F','H' 'N','R' a*N*N 'D' 'F','H' 'B' (a+1)*N*N 'D' 'G' 'A','C' N*N 'D' 'G' 'N','R' 2*N*N 'D' 'G' 'B' 3*N*N 'D' 'D' 'A','N' N*MIN(MAX(N,M),2*N) 'D' 'D' 'B' N*(N+MAX(N,M)) 'D' 'D' 'C' N*MIN(N,M) 'D' 'D' 'R' N*MIN(3*N,N+M) ----------------------------------------------- If LDWORK = -1, an optimal 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 is issued by XERBLA. This evaluation assumes that only the specified triangle of the array X is always used, and the other strict triangle is not referenced. If LDWORK = -2, a minimal workspace query is assumed; the routine only calculates the minimal size of the DWORK array, returns this value as the first entry of the DWORK array, and no error message is issued by XERBLA. This evaluation assumes that full matrix is given in the array X, when needed (see the table at the description of the array X).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The matrix expressions are efficiently evaluated, using symmetry, common matrix subexpressions, and proper order of matrix multiplications. If JOB = 'N' or JOB = 'B', then: If DICO = 'C', the matrices op(op(A)'*X*op(E)) or op(X*op(A)), and V = op(E)'*X*G*X*op(E) or V = F*F' or V = H*K, are efficiently computed. If DICO = 'D', the matrices op(A)'*X*op(A), V = op(A)'*X*G*X*op(A) or V = F*F' or V = H*K, and op(E)'*X*op(E), if JOBE = 'G', are efficiently computed. The results are used to evaluate R, op(C) (if JOB = 'N'), and the norms. If JOB <> 'N', then the needed parts of the intermediate results are obtained and used to evaluate R and/or op(C).Numerical Aspects
The calculations are backward stable. 3 2 The algorithm requires approximately (a+b)N + cN M operations, where, a = 0, if JOBE = 'I', a = 1, if JOBE = 'G' and (DICO = 'C' or (DICO = 'D' and JOB = 'C')), a = 1.5, if JOBE = 'G' and DICO = 'D', and b and c are implicitly defined below. Specifically, the effort is approximately as follows (using ^ to denote the power operator) For DICO = 'C': JOBG JOB C R A, N, B 'G' (a+1)*N^3 (a+2)*N^3 (a+2)*N^3,(a+2.5)*N^3 'D' (a+2)*N^2*M (a+1)*N^3+1.5*N^2*M (a+1)*N^3+2.5*N^2*M 'F','H' N^2*M N^3+0.5*N^2*M N^3+1.5*N^2*M For DICO = 'D': JOBG JOB C R A, N, B 'G' 2*N^3 (a+3 )*N^3 (a+3 )*N^3 'D' 3*N^2*M (a+1.5)*N^3+1.5*N^2*M (a+1.5)*N^3+2.5*N^2*M 'F','H' N^2*M (a+0.5)*N^3+0.5*N^2*M (a+0.5)*N^3+1.5*N^2*M For JOBG <> 'G' and JOB = 'B', the effort reduces by N^2*M in both tables. An "operation" includes a multiplication, an addition, and some address calculations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SG02CX.html 0000664 0000000 0000000 00000026275 14560147231 0020374 0 ustar 00root root 0000000 0000000
Purpose
To find the line search parameter alpha minimizing the Frobenius norm (in a MATLAB-style notation) P(alpha) := norm(R(X+alpha*S), 'fro') = norm((1-alpha)*R(X) +/- alpha^2*V, 'fro'), where R(X) is the residual of a (generalized) continuous-time algebraic Riccati equation 0 = op(A)'*X + X*op(A) +/- X*G*X + Q =: R(X), or 0 = op(A)'*X*op(E) + op(E)'*X*op(A) +/- op(E)'*X*G*X*op(E) + Q =: R(X), V = op(E)'*S*G*S*op(E), and op(W) is either W or W'. The matrix S is the Newton step. _-1 Instead of the symmetric N-by-N matrix G, G = B*R *B', the N-by-M -1 matrix D, D = B*L , such that G = D*D', may be given on entry. _ _ The matrix R, R = L'*L, is a weighting matrix of the optimal problem, and L is its (Cholesky) factor. Optionally, V is specified as V = H*K, or V = F*F', but F or H and K must be evaluated in S. See the SLICOT Library routine SG02CW description for more details.Specification
SUBROUTINE SG02CX( JOBE, FLAG, JOBG, UPLO, TRANS, N, M, E, LDE, R, $ LDR, S, LDS, G, LDG, ALPHA, RNORM, DWORK, $ LDWORK, IWARN, INFO ) C .. Scalar Arguments .. CHARACTER FLAG, JOBE, JOBG, TRANS, UPLO INTEGER INFO, IWARN, LDE, LDG, LDR, LDS, LDWORK, M, N DOUBLE PRECISION ALPHA, RNORM C .. Array Arguments .. DOUBLE PRECISION DWORK(*), E(LDE,*), G(LDG,*), R(LDR,*), S(LDS,*)Arguments
Mode Parameters
JOBE CHARACTER*1 Specifies whether E is a general or an identity matrix, as follows: = 'G': The matrix E is general and is given; = 'I': The matrix E is assumed identity and is not given. FLAG CHARACTER*1 Specifies which sign is used, as follows: = 'P': The plus sign is used; = 'M': The minus sign is used. JOBG CHARACTER*1 Specifies how the matrix product V is defined, as follows: = 'G': The matrix G is given: V = op(E)'*S*G*S*op(E); = 'D': The matrix D is given: V = op(E)'*S*D*D'*S*op(E); = 'F': The matrix F is given: V = F*F'; = 'H': The matrices H and K are given: V = H*K. UPLO CHARACTER*1 Specifies which triangles of the symmetric matrices R, G, if JOBG = 'G', and S, if JOBG = 'G' or JOBG = 'D', are given, as follows: = 'U': The upper triangular part is given; = 'L': The lower triangular part is given. TRANS CHARACTER*1 Specifies the form of op(W) to be used in the matrix multiplication, as follows: = 'N': op(W) = W; = 'T': op(W) = W'; = 'C': op(W) = W'.Input/Output Parameters
N (input) INTEGER The order of the matrices E, R, and S. N >= 0. M (input) INTEGER If JOBG <> 'G', the number of columns of the matrices D, F, or K'. M >= 0. If JOBG = 'G', the value of M is meaningless. E (input) DOUBLE PRECISION array, dimension (LDE,*) If JOBE = 'G' and (JOBG = 'G' or JOBG = 'D'), the leading N-by-N part of this array must contain the matrix E. If JOBE = 'I' or JOBG = 'F' or JOBG = 'H', this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N), if JOBE = 'G' and (JOBG = 'G' or JOBG = 'D'); LDE >= 1, if JOBE = 'I' or JOBG = 'F' or JOBG = 'H'. R (input) DOUBLE PRECISION array, dimension (LDR,N) The leading N-by-N upper or lower triangular part (depending on UPLO) of this array must contain the upper or lower triangular part, respectively, of the matrix R(X), the residual of the algebraic Riccati equation. The other strictly triangular part is not referenced. LDR INTEGER The leading dimension of array R. LDR >= MAX(1,N). S (input) DOUBLE PRECISION array, dimension (LDS,*) If JOBG = 'G' or JOBG = 'D', the leading N-by-N part of this array must contain the symmetric Newton step matrix S. If JOBE = 'I', the full matrix must be given. Otherwise, it is sufficient to input only the triangular part specified by UPLO, and the remaining strictly triangular part is not referenced. If JOBG = 'F', this array is not referenced. If JOBG = 'H', the leading M-by-N part of this array must contain the matrix K. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,N), if JOBG = 'G' or JOBG = 'D'; LDS >= 1, if JOBG = 'F'; LDS >= MAX(1,M), if JOBG = 'H'. G (input/works.) DOUBLE PRECISION array, dimension (LDG,*) If JOBG = 'G', the leading N-by-N upper or lower triangular part (depending on UPLO) of this array must contain the upper or lower triangular part, respectively, of the matrix G. The other strictly triangular part is not referenced. The diagonal elements of this array are modified internally, but are restored on exit. If JOBG = 'D', the leading N-by-M part of this array must contain the matrix D, so that G = D*D'. If JOBG = 'F', the leading N-by-M part of this array must contain the matrix F. If JOBG = 'H', leading N-by-M part of this array must contain the matrix H. LDG INTEGER The leading dimension of array G. LDG >= MAX(1,N). ALPHA (output) DOUBLE PRECISION If INFO = 0, ALPHA contains the real number alpha which minimizes P(alpha) = norm(R(X+alpha*S), 'fro') in the interval [0,2]. If INFO = 1 or IWARN = 2, ALPHA is set equal to 1. RNORM (output) DOUBLE PRECISION On exit, if INFO >= 0, RNORM contains the Frobenius norm of the residual R(X+alpha*S).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if LDWORK = -1 on input, then DWORK(1) returns the optimal value of LDWORK. On exit, if LDWORK = -2 on input or INFO = -19, then DWORK(1) returns the minimal value of LDWORK. On exit, if INFO = 0, the leading N-by-N upper or lower triangular part (depending on UPLO) of this array contains the corresponding triangular part of the matrix V. LDWORK The length of the array DWORK. LDWORK >= N*N + MAX( 2*N*N, 51 ), if JOBG = 'G' and JOBE = 'G'; LDWORK >= N*N + MAX( N*N, 51 ), if JOBG = 'G' and JOBE = 'I', or JOBG = 'F', or JOBG = 'H'; LDWORK >= N*N + MAX( MAX( N*N, 51 ), MIN( 2*N*N, N*M ) ), if JOBG = 'D' and JOBE = 'G'; LDWORK >= N*N + MAX( N*N, N*M, 51 ), if JOBG = 'D' and JOBE = 'I'. For M <= N, the last two formulas simplify to LDWORK >= N*N + MAX( N*N, 51). If LDWORK = -1, an optimal 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 is issued by XERBLA. If LDWORK = -2, a minimal workspace query is assumed; the routine only calculates the minimal size of the DWORK array, returns this value as the first entry of the DWORK array, and no error message is issued by XERBLA.Warning Indicator
IWARN INTEGER = 0: no warnings; = 2: no optimal line search parameter t := alpha in [0,2] was found; t = 1 was set.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -k, the k-th argument had an illegal value; = 1: an error occurred during the call of the SLICOT Library routine MC01XD: the eigenvalues computation for the 3-by-3 (generalized) eigenproblem failed. ALPHA and RNORM are set as specified above.Method
The matrix V is computed with the suitable formula, and used to set up a third order polynomial whose roots in [0,2], if any, are candidates for the solution of the minimum residual problem. The roots of the polynomial are computed by solving an equivalent 3-by-3 (generalized) eigenproblem.References
[1] Benner, P. Contributions to the Numerical Solution of Algebraic Riccati Equations and Related Eigenvalue Problems. Fakultat fur Mathematik, Technische Universitat Chemnitz- Zwickau, D-09107 Chemnitz, Germany, Feb. 1997.Numerical Aspects
The calculations are backward stable. The computational effort is of the order of c*N**2*M operations. Here, M = N, if JOBG = 'G', and the coefficient c varies between 0.5 and 2.5, depending on JOBE and JOBG. (An "operation" includes a multiplication, an addition, and some address calculations.) The computed value of norm(R(X+alpha*S),'fro'), returned in RNORM, could be inaccurate if R(X) is small, since then subtraction cancellation could appear in the updating formula which is used. (This can happen, e.g., when solving a Riccati equation by Newton's method with line search, since then the sequence of R(.) tends to zero.) In such a case, it is better to recompute the residual from the data.Further Comments
The routine does not ckeck if the matrix S is zero, when a quick return with ALPHA = 1 is possible. With suitable input arguments E and G, this routine may also be used for discrete-time algebraic Riccati equations. (Matrix E must be the current closed-loop matrix.)Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SG02ND.html 0000664 0000000 0000000 00000064105 14560147231 0020355 0 ustar 00root root 0000000 0000000
Purpose
To compute the optimal gain matrix K for the problem of optimal control given by -1 K = (R + B'XB) (B'Xop(A) + L') (1) in the discrete-time case and -1 K = R (B'Xop(E) + L') (2) in the continuous-time case, where A, E, B and L are N-by-N, N-by-N, N-by-M, and N-by-M matrices, respectively; R and X are M-by-M and N-by-N symmetric matrices, respectively, and op(W) is either W or W'. Matrix op(K) defines the feedback gain matrix, if op(W) = W, and the estimator matrix, if op(W) = W'. The formulas above are also useful in Newton's algorithms for solving algebraic Riccati equations, when X is the current iterate. Optionally, matrix R may be specified in a factored form, and L may be zero. If R or R + B'XB (for DICO = 'C', or DICO = 'D', respectively), is positive definite, let C be its Cholesky factor (denoted, e.g., C = chol(R), for DICO = 'C'). Optionally, the matrix H, defined by H = op(E)'XB + L, if DICO = 'C', or H = op(A)'XB + L, if DICO = 'D', (3) is returned on exit, besides K; if C exists, the matrix F, defined by FC = H may be optionally returned, instead of K and H. The matrix F or the pair of matrices H and K may be used for computing the residual matrix for an (approximate) solution of an algebraic Riccati equation (see SLICOT Library routine SG02CW).Specification
SUBROUTINE SG02ND( DICO, JOBE, JOB, JOBX, FACT, UPLO, JOBL, TRANS, $ N, M, P, A, LDA, E, LDE, B, LDB, R, LDR, IPIV, $ L, LDL, X, LDX, RNORM, K, LDK, H, LDH, XE, $ LDXE, OUFACT, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, JOB, JOBE, JOBL, JOBX, TRANS, UPLO INTEGER INFO, LDA, LDB, LDE, LDH, LDK, LDL, LDR, LDWORK, $ LDX, LDXE, M, N, P DOUBLE PRECISION RNORM C .. Array Arguments .. INTEGER IPIV(*), IWORK(*), OUFACT(2) DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), E(LDE,*), $ H(LDH,*), K(LDK,*), L(LDL,*), R(LDR,*), $ X(LDX,*), XE(LDXE,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the equation from which K is to be determined, as follows: = 'D': Equation (1), discrete-time case; = 'C': Equation (2), continuous-time case. JOBE CHARACTER*1 Specifies whether E is a general or an identity matrix, as follows: = 'G': The matrix E is general and is given; = 'I': The matrix E is assumed identity and is not given. This parameter is not relevant for DICO = 'D'. JOB CHARACTER*1 Specifies what should be computed, as follows: = 'K': Compute and return the matrix K only; = 'H': Compute and return both matrices H and K; = 'F': Compute the matrix F, if possible; otherwise, compute and return H and K; = 'D': Compute and return both matrices H and K, when B and L have previously been transformed using SLICOT Library routines SB02MT or SB02MX, which returned OUFACT = 1. This is useful for computing K in (2), since then K is the solution of CK = H'. In this case, FACT should be set to 'C', and the array R must contain the Cholesky factor of R + B'XB, if DICO = 'D'; = 'C': Compute and return the matrix F, when B and L have previously been transformed using SB02MT or SB02MX, which returned OUFACT = 1. In this case, FACT should be set to 'C', and the array R must contain the Cholesky factor of R + B'XB, if DICO = 'D'. JOB should not be set to 'F' if FACT = 'U'. JOBX CHARACTER*1 Specifies whether the matrix op(Xop(E)), if DICO = 'C', or op(Xop(A)), if DICO = 'D', must be computed, as follows: = 'C': Compute and return the coresponding matrix; = 'N': Do not compute that matrix. This parameter is not relevant for DICO = 'C' and JOBE = 'I'. FACT CHARACTER*1 Specifies how the matrix R is given (factored or not), as follows: = 'N': Array R contains the matrix R; = 'D': Array R contains a P-by-M matrix D, where R = D'D; = 'C': Array R contains the Cholesky factor of R; = 'U': Array R contains the symmetric indefinite UdU' or LdL' factorization of R. This option is not available for DICO = 'D'. UPLO CHARACTER*1 Specifies which triangle of the possibly factored matrix R (or R + B'XB, on exit) is or should be stored, as follows: = 'U': Upper triangle is stored; = 'L': Lower triangle is stored. JOBL CHARACTER*1 Specifies whether or not the matrix L is zero, as follows: = 'Z': L is zero; = 'N': L is nonzero. TRANS CHARACTER*1 Specifies the form of op(W) to be used in the matrix multiplication, as follows: = 'N': op(W) = W; = 'T': op(W) = W'; = 'C': op(W) = W'.Input/Output Parameters
N (input) INTEGER The order of the matrices A and X. N >= 0. No computations are performed if MIN(N,M) = 0. M (input) INTEGER The order of the matrix R and the number of columns of the matrices B and L. M >= 0. P (input) INTEGER The number of rows of the matrix D. P >= M for DICO = 'C'; P >= 0 for DICO = 'D'. This parameter is relevant only for FACT = 'D'. A (input) DOUBLE PRECISION array, dimension (LDA,N) If DICO = 'D', the leading N-by-N part of this array must contain the state matrix A of the system. If DICO = 'C', this array is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N) if DICO = 'D'; LDA >= 1 if DICO = 'C'. E (input) DOUBLE PRECISION array, dimension (LDE,*) If JOBE = 'G' and DICO = 'C', the leading N-by-N part of this array must contain the matrix E. If JOBE = 'I' or DICO = 'D', this array is not referenced. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N), if JOBE = 'G' and DICO = 'C'; LDE >= 1, if JOBE = 'I' or DICO = 'D'. B (input/worksp.) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input matrix B of the system, transformed by SB02MT or SB02MX, if JOB = 'D' or JOB = 'C'. If DICO = 'D' and FACT = 'D' or 'C', the contents of this array is destroyed. Specifically, if, on exit, OUFACT(2) = 1, this array contains chol(X)*B, and if OUFACT(2) = 2 and INFO < M+2, but INFO >= 0, its trailing part (in the first N rows) contains the submatrix of sqrt(V)*U'B corresponding to the non-negligible, positive eigenvalues of X, where V and U are the matrices with the eigenvalues and eigenvectors of X. Otherwise, B is unchanged on exit. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). R (input/output) DOUBLE PRECISION array, dimension (LDR,M) On entry, if FACT = 'N', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the upper triangular part or lower triangular part, respectively, of the symmetric input weighting matrix R. On entry, if FACT = 'D', the leading P-by-M part of this array must contain the direct transmission matrix D of the system. On entry, if FACT = 'C', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the Cholesky factor of the positive definite input weighting matrix R (as produced by LAPACK routine DPOTRF). On entry, if DICO = 'C' and FACT = 'U', the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array must contain the factors of the UdU' or LdL' factorization, respectively, of the symmetric indefinite input weighting matrix R (as produced by LAPACK routine DSYTRF). The strictly lower triangular part (if UPLO = 'U') or strictly upper triangular part (if UPLO = 'L') of this array is used as workspace (filled in by symmetry with the other strictly triangular part of R, of R+B'XB, or of the result, if DICO = 'C', DICO = 'D' (if FACT = 'N', in both cases), or (DICO = 'D' and (FACT = 'D' or FACT = 'C') and UPLO = 'L'), respectively. On exit, if OUFACT(1) = 1, and INFO = 0 (or INFO = M+1), the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the Cholesky factor of the given input weighting matrix R (for DICO = 'C'), or that of the matrix R + B'XB (for DICO = 'D'). On exit, if OUFACT(1) = 2, and INFO = 0 (or INFO = M+1), the leading M-by-M upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the factors of the UdU' or LdL' factorization, respectively, of the given input weighting matrix (for DICO = 'C'), or that of the matrix R + B'XB (for DICO = 'D' and FACT = 'N'). On exit R is unchanged if FACT = 'U' or N = 0. LDR INTEGER. The leading dimension of the array R. LDR >= MAX(1,M) if FACT <> 'D'; LDR >= MAX(1,M,P) if FACT = 'D'. IPIV (input/output) INTEGER array, dimension (M) On entry, if FACT = 'U', this array must contain details of the interchanges performed and the block structure of the d factor in the UdU' or LdL' factorization of matrix R (as produced by LAPACK routine DSYTRF). On exit, if OUFACT(1) = 2, this array contains details of the interchanges performed and the block structure of the d factor in the UdU' or LdL' factorization of matrix R or R + B'XB, as produced by LAPACK routine DSYTRF. This array is not referenced if FACT = 'D', or FACT = 'C', or N = 0. L (input) DOUBLE PRECISION array, dimension (LDL,M) If JOBL = 'N', the leading N-by-M part of this array must contain the cross weighting matrix L, transformed by SB02MT or SB02MX, if JOB = 'D' or JOB = 'C'. If JOBL = 'Z', this array is not referenced. LDL INTEGER The leading dimension of array L. LDL >= MAX(1,N) if JOBL = 'N'; LDL >= 1 if JOBL = 'Z'. X (input/output) DOUBLE PRECISION array, dimension (LDX,N) On entry, the leading N-by-N part of this array must contain the (approximate) solution matrix X of the algebraic Riccati equation as produced by SLICOT Library routines SB02MD or SB02OD (or SG02CD). Matrix X is assumed non-negative definite if DICO = 'D', FACT <> 'N', JOB <> 'D' and JOB <> 'C'. The full matrix X must be given on input in this case. For minimal workspace, full matrix X must also be given if ((JOBX = 'C', DICO = 'D', FACT = 'N', and M > N), or (JOBX = 'N', ((DICO = 'C' or FACT = 'N'), (DICO = 'D' or JOBE = 'I') or N >= M, or LDWORK < N*N) and (DICO = 'D' or JOBE = 'G' or JOB = 'K'))) and LDWORK < N*M. (Simpler, but more demanding conditions are the following: ((JOBX = 'C', DICO = 'D', FACT = 'N', and M > N), or (JOBX = 'N', (DICO = 'D' or ((DICO = 'C', JOBE = 'G') or JOB = 'K'))), LDWORK < N*N.) For optimal workspace, full matrix X is not needed in any of the cases described above for minimal workspace. On exit, if DICO = 'D', FACT = 'D' or FACT = 'C', and OUFACT(2) = 1, the N-by-N upper triangular part (if UPLO = 'U') or lower triangular part (if UPLO = 'L') of this array contains the Cholesky factor of the given matrix X, which is found to be positive definite. On exit, if DICO = 'D', FACT = 'D' or 'C', OUFACT(2) = 2, and INFO <> M+2 (but INFO >= 0), the leading N-by-N part of this array contains the matrix of orthonormal eigenvectors of X. On exit X is unchanged if DICO = 'C' or FACT = 'N'. LDX INTEGER The leading dimension of array X. LDX >= MAX(1,N). RNORM (input) DOUBLE PRECISION If FACT = 'U', this parameter must contain the 1-norm of the original matrix R (before factoring it). Otherwise, this parameter is not used. K (output) DOUBLE PRECISION array, dimension (LDK,N) If JOB = 'K' or JOB = 'H' or JOB = 'D' or OUFACT(1) = 2, the leading M-by-N part of this array contains the gain matrix K. LDK INTEGER The leading dimension of array K. LDK >= MAX(1,M). H (output) DOUBLE PRECISION array, dimension (LDH,*) If JOB = 'H' or JOB = 'D' or (JOB = 'F' and OUFACT(1) = 2), the leading N-by-M part of this array contains the matrix H. If JOB = 'C' or (JOB = 'F' and OUFACT(1) = 1), the leading N-by-M part of this array contains the matrix F. If JOB = 'K', this array is not referenced. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,N), if JOB <> 'K'; LDH >= 1, if JOB = 'K'. XE (output) DOUBLE PRECISION array, dimension (LDXE,*) If JOBX = 'C', DICO = 'C', and JOBE = 'G', the leading N-by-N part of this array contains the matrix product X*E, if TRANS = 'N', or E*X, if TRANS = 'T' or TRANS = 'C'. If JOBX = 'C' and DICO = 'D', the leading N-by-N part of this array contains the matrix product X*A, if TRANS = 'N', or A*X, if TRANS = 'T' or TRANS = 'C'. These matrix products may be needed for computing the residual matrix for an (approximate) solution of a Riccati equation (see SLICOT Library routine SG02CW). If JOBX = 'N' or (DICO = 'C' and JOBE = 'I'), this array is not referenced. LDXE INTEGER The leading dimension of array XE. LDXE >= MAX(1,N), if JOBX = 'C', and either DICO = 'C' and JOBE = 'G', or DICO = 'D'; LDXE >= 1, if JOBX = 'N' or (DICO = 'C' and JOBE = 'I'). OUFACT (output) INTEGER array, dimension (2) Information about the factorization finally used. OUFACT(1) = 1: Cholesky factorization of R (or R + B'XB) has been used; OUFACT(1) = 2: UdU' (if UPLO = 'U') or LdL' (if UPLO = 'L') factorization of R (or R + B'XB) has been used; OUFACT(2) = 1: Cholesky factorization of X has been used; OUFACT(2) = 2: Spectral factorization of X has been used. The value of OUFACT(2) is not set for DICO = 'C' or for DICO = 'D' and FACT = 'N'. This array is not set if N = 0 or M = 0.Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0 or LDWORK = -1, DWORK(1) returns the optimal value of LDWORK, and for LDWORK set as specified below, DWORK(2) contains the reciprocal condition number of the matrix R (for DICO = 'C') or of R + B'XB (for DICO = 'D'), if FACT = 'N' or FACT = 'U' or OUFACT(1) = 2, or of its Cholesky factor, if FACT = 'C' or FACT = 'D' and OUFACT(1) = 1; DWORK(2) is set to 1 if N = 0. On exit, if LDWORK = -2 on input or INFO = -35, then DWORK(1) returns the minimal value of LDWORK. If on exit INFO = 0, and OUFACT(2) = 2, then DWORK(3),..., DWORK(N+2) contain the eigenvalues of X, in ascending order. LDWORK INTEGER Dimension of working array DWORK. Let a = N, if JOBX = 'N' and (DICO = 'D' or JOBE = 'G'); a = 0, otherwise. Then LDWORK >= max(2,2*M,a) if FACT = 'U'; LDWORK >= max(2,3*M,4*N+1) if FACT = 'D' or (FACT = 'C' and JOB <> 'C' and JOB <> 'D'), DICO = 'D'; LDWORK >= max(2,3*M,a) otherwise. For optimum performance LDWORK should be larger. If LDWORK = -1, an optimal 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 is issued by XERBLA. If LDWORK = -2, a minimal workspace query is assumed; the routine only calculates the minimal size of the DWORK array, returns this value as the first entry of the DWORK array, and no error message is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = i: if the i-th element of the d factor is exactly zero; the UdU' (or LdL') factorization has been completed, but the block diagonal matrix d is exactly singular; = M+1: if the matrix R (if DICO = 'C'), or R + B'XB (if DICO = 'D') is numerically singular (to working precision); = M+2: if one or more of the eigenvalues of X has not converged; = M+3: if the matrix X is indefinite and updating the triangular factorization failed. If INFO > M+1, call the routine again with an appropriate, unfactored matrix R.Method
The (optimal) gain matrix K is obtained as the solution to the system of linear equations (R + B'XB) * K = B'Xop(A) + L' in the discrete-time case and R * K = B'Xop(E) + L' in the continuous-time case, with R replaced by D'D if FACT = 'D'. If FACT = 'N', Cholesky factorization is tried first, but if the coefficient matrix is not positive definite, then UdU' (or LdL') factorization is used. If FACT <> 'N', the factored form of R is taken into account. The discrete-time case then involves updating of a triangular factorization of R (or D'D); Cholesky or symmetric spectral factorization of X is employed to avoid squaring of the condition number of the matrix. When D is given, its QR factorization is determined, and the triangular factor is used as described above.Numerical Aspects
The algorithm consists of numerically stable steps. 3 2 For DICO = 'C' and JOBE = 'I', it requires O(m + mn ) floating 2 point operations if FACT = 'N' and O(mn ) floating point operations, otherwise. For DICO = 'D' or JOBE = 'G', the operation counts are similar, 3 but additional O(n ) floating point operations may be needed in the worst case. These estimates assume that M <= N.Further Comments
NoneExample
Program Text
* SG02ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER NMAX2 PARAMETER ( NMAX2 = 2*NMAX ) INTEGER LDA, LDB, LDC, LDF, LDH, LDL, LDR, LDS, LDT, LDU, $ LDX, LDXE PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, LDL = NMAX, $ LDR = MAX(MMAX,PMAX), LDS = NMAX2+MMAX, $ LDT = NMAX2+MMAX, LDU = NMAX2, LDX = NMAX, $ LDF = MMAX, LDH = NMAX, LDXE = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX+3*MMAX+2, 14*NMAX+23, $ 16*NMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL, RCOND, RNORM INTEGER I, INFO1, INFO2, J, M, N, P CHARACTER*1 DICO, FACT, JOB, JOBB, JOBE, JOBL, JOBX, SORT, $ TRANS, UPLO * .. Local Arrays .. DOUBLE PRECISION AE(LDA,NMAX), ALFAI(2*NMAX), ALFAR(2*NMAX), $ B(LDB,MMAX), BETA(2*NMAX), C(LDC,NMAX), $ DWORK(LDWORK), F(LDF,NMAX), H(LDH,MMAX), $ L(LDL,MMAX), R(LDR,MMAX), S(LDS,NMAX2+MMAX), $ T(LDT,NMAX2), U(LDU,NMAX2), X(LDX,NMAX), $ XE(LDXE,NMAX) INTEGER IPIV(LIWORK), IWORK(LIWORK), OUFACT(2) LOGICAL BWORK(NMAX2) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SG02ND, SB02OD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, DICO, JOBE, JOB, JOBX, FACT, $ JOBL, UPLO, TRANS IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( ( AE(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99991 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) IF ( LSAME( FACT, 'D' ) ) THEN READ ( NIN, FMT = * ) ( ( R(I,J), J = 1,M ), I = 1,P ) ELSE READ ( NIN, FMT = * ) ( ( R(I,J), J = 1,M ), I = 1,M ) END IF IF ( LSAME( JOBL, 'N' ) ) $ READ ( NIN, FMT = * ) ( ( L(I,J), J = 1,M ), I = 1,N ) * Find the solution matrix X. JOBB = 'B' SORT = 'S' CALL SB02OD( DICO, JOBB, 'Both', UPLO, JOBL, SORT, N, M, $ P, AE, LDA, B, LDB, C, LDC, R, LDR, L, LDL, $ RCOND, X, LDX, ALFAR, ALFAI, BETA, S, LDS, $ T, LDT, U, LDU, TOL, IWORK, DWORK, LDWORK, $ BWORK, INFO1 ) * IF ( INFO1.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO1 ELSE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( X(I,J), J = 1,N ) 20 CONTINUE * Compute the optimal feedback matrix F. CALL SG02ND( DICO, JOBE, JOB, JOBX, FACT, UPLO, JOBL, $ TRANS, N, M, P, AE, LDA, AE, LDA, B, LDB, $ R, LDR, IPIV, L, LDL, X, LDX, RNORM, F, $ LDF, H, LDH, XE, LDXE, OUFACT, IWORK, $ DWORK, LDWORK, INFO2 ) * IF ( INFO2.NE.0 ) THEN WRITE ( NOUT, FMT = 99997 ) INFO2 ELSE WRITE ( NOUT, FMT = 99995 ) DO 40 I = 1, M WRITE ( NOUT, FMT = 99994 ) ( F(I,J), J = 1,N ) 40 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' SG02ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SB02OD = ',I2) 99997 FORMAT (' INFO on exit from SG02ND = ',I2) 99996 FORMAT (' The solution matrix X is ') 99995 FORMAT (/' The optimal feedback matrix F is ') 99994 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
SG02ND EXAMPLE PROGRAM DATA 2 1 3 0.0 D I K N N Z U N 2.0 -1.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0Program Results
SG02ND EXAMPLE PROGRAM RESULTS The solution matrix X is 1.0000 0.0000 0.0000 1.0000 The optimal feedback matrix F is 2.0000 -1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SG03AD.html 0000664 0000000 0000000 00000045073 14560147231 0020344 0 ustar 00root root 0000000 0000000
Purpose
To solve for X either the generalized continuous-time Lyapunov equation T T op(A) X op(E) + op(E) X op(A) = SCALE * Y, (1) or the generalized discrete-time Lyapunov equation T T op(A) X op(A) - op(E) X op(E) = SCALE * Y, (2) where op(M) is either M or M**T for M = A, E and the right hand side Y is symmetric. A, E, Y, and the solution X are N-by-N matrices. SCALE is an output scale factor, set to avoid overflow in X. Estimates of the separation and the relative forward error norm are provided.Specification
SUBROUTINE SG03AD( DICO, JOB, FACT, TRANS, UPLO, N, A, LDA, E, $ LDE, Q, LDQ, Z, LDZ, X, LDX, SCALE, SEP, FERR, $ ALPHAR, ALPHAI, BETA, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER DICO, FACT, JOB, TRANS, UPLO DOUBLE PRECISION FERR, SCALE, SEP INTEGER INFO, LDA, LDE, LDQ, LDWORK, LDX, LDZ, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), ALPHAI(*), ALPHAR(*), BETA(*), $ DWORK(*), E(LDE,*), Q(LDQ,*), X(LDX,*), $ Z(LDZ,*) INTEGER IWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies which type of the equation is considered: = 'C': Continuous-time equation (1); = 'D': Discrete-time equation (2). JOB CHARACTER*1 Specifies if the solution is to be computed and if the separation is to be estimated: = 'X': Compute the solution only; = 'S': Estimate the separation only; = 'B': Compute the solution and estimate the separation. FACT CHARACTER*1 Specifies whether the generalized real Schur factorization of the pencil A - lambda * E is supplied on entry or not: = 'N': Factorization is not supplied; = 'F': Factorization is supplied. TRANS CHARACTER*1 Specifies whether the transposed equation is to be solved or not: = 'N': op(A) = A, op(E) = E; = 'T': op(A) = A**T, op(E) = E**T. UPLO CHARACTER*1 Specifies whether the lower or the upper triangle of the array X is needed on input: = 'L': Only the lower triangle is needed on input; = 'U': Only the upper triangle is needed on input.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if FACT = 'F', then the leading N-by-N upper Hessenberg part of this array must contain the generalized Schur factor A_s of the matrix A (see definition (3) in section METHOD). A_s must be an upper quasitriangular matrix. The elements below the upper Hessenberg part of the array A are not referenced. If FACT = 'N', then 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 generalized Schur factor A_s of the matrix A. (A_s is an upper quasitriangular matrix.) LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, if FACT = 'F', then the leading N-by-N upper triangular part of this array must contain the generalized Schur factor E_s of the matrix E (see definition (4) in section METHOD). The elements below the upper triangular part of the array E are not referenced. If FACT = 'N', then the leading N-by-N part of this array must contain the coefficient matrix E of the equation. On exit, the leading N-by-N part of this array contains the generalized Schur factor E_s of the matrix E. (E_s is an upper triangular matrix.) LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, if FACT = 'F', then the leading N-by-N part of this array must contain the orthogonal matrix Q from the generalized Schur factorization (see definitions (3) and (4) in section METHOD). If FACT = 'N', Q need not be set on entry. On exit, the leading N-by-N part of this array contains the orthogonal matrix Q from the generalized Schur factorization. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) On entry, if FACT = 'F', then the leading N-by-N part of this array must contain the orthogonal matrix Z from the generalized Schur factorization (see definitions (3) and (4) in section METHOD). If FACT = 'N', Z need not be set on entry. On exit, the leading N-by-N part of this array contains the orthogonal matrix Z from the generalized Schur factorization. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,N). X (input/output) DOUBLE PRECISION array, dimension (LDX,N) On entry, if JOB = 'B' or 'X', then the leading N-by-N part of this array must contain the right hand side matrix Y of the equation. Either the lower or the upper triangular part of this array is needed (see mode parameter UPLO). If JOB = 'S', X is not referenced. On exit, if JOB = 'B' or 'X', and INFO = 0, 3, or 4, then the leading N-by-N part of this array contains the solution matrix X of the equation. If JOB = 'S', X is not referenced. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in X. (0 < SCALE <= 1) SEP (output) DOUBLE PRECISION If JOB = 'S' or JOB = 'B', and INFO = 0, 3, or 4, then SEP contains an estimate of the separation of the Lyapunov operator. FERR (output) DOUBLE PRECISION If JOB = 'B', and INFO = 0, 3, or 4, then FERR contains an estimated forward error bound for the solution X. If XTRUE is the true solution, FERR estimates the relative error in the computed solution, measured in the Frobenius norm: norm(X - XTRUE) / norm(XTRUE) ALPHAR (output) DOUBLE PRECISION array, dimension (N) ALPHAI (output) DOUBLE PRECISION array, dimension (N) BETA (output) DOUBLE PRECISION array, dimension (N) If FACT = 'N' and INFO = 0, 3, or 4, then (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, are the eigenvalues of the matrix pencil A - lambda * E. If FACT = 'F', ALPHAR, ALPHAI, and BETA are not referenced.Workspace
IWORK INTEGER array, dimension (N**2) IWORK is not referenced if JOB = 'X'. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. The following table contains the minimal work space requirements depending on the choice of JOB and FACT. JOB FACT | LDWORK -------------------+------------------- 'X' 'F' | MAX(1,N) 'X' 'N' | MAX(1,4*N) 'B', 'S' 'F' | MAX(1,2*N**2) 'B', 'S' 'N' | MAX(1,2*N**2,4*N) For optimum performance, LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: FACT = 'F' and the matrix contained in the upper Hessenberg part of the array A is not in upper quasitriangular form; = 2: FACT = 'N' and the pencil A - lambda * E cannot be reduced to generalized Schur form: LAPACK routine DGEGS (or DGGES) has failed to converge; = 3: DICO = 'D' and the pencil A - lambda * E has a pair of reciprocal eigenvalues. That is, lambda_i = 1/lambda_j for some i and j, where lambda_i and lambda_j are eigenvalues of A - lambda * E. Hence, equation (2) is singular; perturbed values were used to solve the equation (but the matrices A and E are unchanged); = 4: DICO = 'C' and the pencil A - lambda * E has a degenerate pair of eigenvalues. That is, lambda_i = -lambda_j for some i and j, where lambda_i and lambda_j are eigenvalues of A - lambda * E. Hence, equation (1) is singular; perturbed values were used to solve the equation (but the matrices A and E are unchanged).Method
A straightforward generalization [3] of the method proposed by Bartels and Stewart [1] is utilized to solve (1) or (2). First the pencil A - lambda * E is reduced to real generalized Schur form A_s - lambda * E_s by means of orthogonal transformations (QZ-algorithm): A_s = Q**T * A * Z (upper quasitriangular) (3) E_s = Q**T * E * Z (upper triangular). (4) If FACT = 'F', this step is omitted. Assuming SCALE = 1 and defining ( Z**T * Y * Z : TRANS = 'N' Y_s = < ( Q**T * Y * Q : TRANS = 'T' ( Q**T * X * Q if TRANS = 'N' X_s = < (5) ( Z**T * X * Z if TRANS = 'T' leads to the reduced Lyapunov equation T T op(A_s) X_s op(E_s) + op(E_s) X_s op(A_s) = Y_s, (6) or T T op(A_s) X_s op(A_s) - op(E_s) X_s op(E_s) = Y_s, (7) which are equivalent to (1) or (2), respectively. The solution X_s of (6) or (7) is computed via block back substitution (if TRANS = 'N') or block forward substitution (if TRANS = 'T'), where the block order is at most 2. (See [1] and [3] for details.) Equation (5) yields the solution matrix X. For fast computation the estimates of the separation and the forward error are gained from (6) or (7) rather than (1) or (2), respectively. We consider (6) and (7) as special cases of the generalized Sylvester equation R * X * S + U * X * V = Y, (8) whose separation is defined as follows sep = sep(R,S,U,V) = min || R * X * S + U * X * V || . ||X|| = 1 F F Equation (8) is equivalent to the system of linear equations K * vec(X) = (kron(S**T,R) + kron(V**T,U)) * vec(X) = vec(Y), where kron is the Kronecker product of two matrices and vec is the mapping that stacks the columns of a matrix. If K is nonsingular then sep = 1 / ||K**(-1)|| . 2 We estimate ||K**(-1)|| by a method devised by Higham [2]. Note that this method yields an estimation for the 1-norm but we use it as an approximation for the 2-norm. Estimates for the forward error norm are provided by FERR = 2 * EPS * ||A_s|| * ||E_s|| / sep F F in the continuous-time case (1) and FERR = EPS * ( ||A_s|| **2 + ||E_s|| **2 ) / sep F F in the discrete-time case (2). The reciprocal condition number, RCOND, of the Lyapunov equation can be estimated by FERR/EPS.References
[1] Bartels, R.H., Stewart, G.W. Solution of the equation A X + X B = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Higham, N.J. FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation. A.C.M. Trans. Math. Soft., vol. 14, no. 4, pp. 381-396, 1988. [3] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
The number of flops required by the routine is given by the following table. Note that we count a single floating point arithmetic operation as one flop. c is an integer number of modest size (say 4 or 5). | FACT = 'F' FACT = 'N' -----------+------------------------------------------ JOB = 'B' | (26+8*c)/3 * N**3 (224+8*c)/3 * N**3 JOB = 'S' | 8*c/3 * N**3 (198+8*c)/3 * N**3 JOB = 'X' | 26/3 * N**3 224/3 * N**3 The algorithm is backward stable if the eigenvalues of the pencil A - lambda * E are real. Otherwise, linear systems of order at most 4 are involved into the computation. These systems are solved by Gauss elimination with complete pivoting. The loss of stability of the Gauss elimination with complete pivoting is rarely encountered in practice. The Lyapunov equation may be very ill-conditioned. In particular, if DICO = 'D' and the pencil A - lambda * E has a pair of almost reciprocal eigenvalues, or DICO = 'C' and the pencil has an almost degenerate pair of eigenvalues, then the Lyapunov equation will be ill-conditioned. Perturbed values were used to solve the equation. Ill-conditioning can be detected by a very small value of the reciprocal condition number RCOND.Further Comments
NoneExample
Program Text
* SG03AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDE, LDQ, LDX, LDZ PARAMETER ( LDA = NMAX, LDE = NMAX, LDQ = NMAX, $ LDX = NMAX, LDZ = NMAX ) INTEGER LIWORK, LDWORK PARAMETER ( LIWORK = NMAX**2, $ LDWORK = MAX( 2*NMAX**2, 4*NMAX ) ) * .. Local Scalars .. CHARACTER*1 DICO, FACT, JOB, TRANS, UPLO DOUBLE PRECISION FERR, SCALE, SEP INTEGER I, INFO, J, N * .. Local Arrays .. INTEGER IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), ALPHAI(NMAX), ALPHAR(NMAX), $ BETA(NMAX), DWORK(LDWORK), E(LDE,NMAX), $ Q(LDQ,NMAX), X(LDX,NMAX), Z(LDZ,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SG03AD * .. Intrinsic Functions .. INTRINSIC MAX * .. 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, DICO, FACT, TRANS, UPLO 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 = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( LSAME ( FACT, 'F' ) ) THEN READ ( NIN, FMT = * ) ( ( Q(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( Z(I,J), J = 1,N ), I = 1,N ) END IF IF ( .NOT.LSAME ( JOB, 'S' ) ) $ READ ( NIN, FMT = * ) ( ( X(I,J), J = 1,N ), I = 1,N ) * Find the solution matrix X and the scalar SEP. CALL SG03AD( DICO, JOB, FACT, TRANS, UPLO, N, A, LDA, E, LDE, $ Q, LDQ, Z, LDZ, X, LDX, SCALE, SEP, FERR, ALPHAR, $ ALPHAI, BETA, IWORK, DWORK, LDWORK, INFO ) IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME ( JOB, 'B' ) .OR. LSAME ( JOB, 'S' ) ) THEN WRITE ( NOUT, FMT = 99997 ) SEP WRITE ( NOUT, FMT = 99996 ) FERR END IF IF ( LSAME ( JOB, 'B' ) .OR. LSAME ( JOB, 'X' ) ) THEN WRITE ( NOUT, FMT = 99995 ) SCALE DO 20 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( X(I,J), J = 1,N ) 20 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' SG03AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SG03AD = ',I2) 99997 FORMAT (' SEP = ',D8.2) 99996 FORMAT (' FERR = ',D8.2) 99995 FORMAT (' SCALE = ',D8.2,//' The solution matrix X is ') 99994 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
SG03AD EXAMPLE PROGRAM DATA 3 B C N N U 3.0 1.0 1.0 1.0 3.0 0.0 1.0 0.0 2.0 1.0 3.0 0.0 3.0 2.0 1.0 1.0 0.0 1.0 -64.0 -73.0 -28.0 0.0 -70.0 -25.0 0.0 0.0 -18.0Program Results
SG03AD EXAMPLE PROGRAM RESULTS SEP = 0.29D+00 FERR = 0.40D-13 SCALE = 0.10D+01 The solution matrix X is -2.0000 -1.0000 0.0000 -1.0000 -3.0000 -1.0000 0.0000 -1.0000 -3.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SG03AX.html 0000664 0000000 0000000 00000011444 14560147231 0020363 0 ustar 00root root 0000000 0000000
Purpose
To solve for X either the reduced generalized discrete-time Lyapunov equation T T A * X * A - E * X * E = SCALE * Y (1) or T T A * X * A - E * X * E = SCALE * Y (2) where the right hand side Y is symmetric. A, E, Y, and the solution X are N-by-N matrices. The pencil A - lambda * E must be in generalized Schur form (A upper quasitriangular, E upper triangular). SCALE is an output scale factor, set to avoid overflow in X.Specification
SUBROUTINE SG03AX( TRANS, N, A, LDA, E, LDE, X, LDX, SCALE, INFO ) C .. Scalar Arguments .. CHARACTER TRANS DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDE, LDX, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), E(LDE,*), X(LDX,*)Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies whether the transposed equation is to be solved or not: = 'N': Solve equation (1); = 'T': Solve equation (2).Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N upper Hessenberg part of this array must contain the quasitriangular matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) The leading N-by-N upper triangular part of this array must contain the matrix E. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). X (input/output) DOUBLE PRECISION array, dimension (LDX,N) On entry, the leading N-by-N part of this array must contain the right hand side matrix Y of the equation. Only the upper triangular part of this matrix need be given. On exit, the leading N-by-N part of this array contains the solution matrix X of the equation. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in X. (0 < SCALE <= 1)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: equation is (almost) singular to working precision; perturbed values were used to solve the equation (but the matrices A and E are unchanged).Method
The solution X of (1) or (2) is computed via block back substitution or block forward substitution, respectively. (See [1] and [2] for details.)References
[1] Bartels, R.H., Stewart, G.W. Solution of the equation A X + X B = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
8/3 * N**3 flops are required by the routine. Note that we count a single floating point arithmetic operation as one flop. The algorithm is backward stable if the eigenvalues of the pencil A - lambda * E are real. Otherwise, linear systems of order at most 4 are involved into the computation. These systems are solved by Gauss elimination with complete pivoting. The loss of stability of the Gauss elimination with complete pivoting is rarely encountered in practice.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X either the reduced generalized continuous-time Lyapunov equation T T A * X * E + E * X * A = SCALE * Y (1) or T T A * X * E + E * X * A = SCALE * Y (2) where the right hand side Y is symmetric. A, E, Y, and the solution X are N-by-N matrices. The pencil A - lambda * E must be in generalized Schur form (A upper quasitriangular, E upper triangular). SCALE is an output scale factor, set to avoid overflow in X.Specification
SUBROUTINE SG03AY( TRANS, N, A, LDA, E, LDE, X, LDX, SCALE, INFO ) C .. Scalar Arguments .. CHARACTER TRANS DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDE, LDX, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), E(LDE,*), X(LDX,*)Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies whether the transposed equation is to be solved or not: = 'N': Solve equation (1); = 'T': Solve equation (2).Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N upper Hessenberg part of this array must contain the quasitriangular matrix A. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) The leading N-by-N upper triangular part of this array must contain the matrix E. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). X (input/output) DOUBLE PRECISION array, dimension (LDX,N) On entry, the leading N-by-N part of this array must contain the right hand side matrix Y of the equation. Only the upper triangular part of this matrix need be given. On exit, the leading N-by-N part of this array contains the solution matrix X of the equation. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in X. (0 < SCALE <= 1)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: equation is (almost) singular to working precision; perturbed values were used to solve the equation (but the matrices A and E are unchanged).Method
The solution X of (1) or (2) is computed via block back substitution or block forward substitution, respectively. (See [1] and [2] for details.)References
[1] Bartels, R.H., Stewart, G.W. Solution of the equation A X + X B = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
8/3 * N**3 flops are required by the routine. Note that we count a single floating point arithmetic operation as one flop. The algorithm is backward stable if the eigenvalues of the pencil A - lambda * E are real. Otherwise, linear systems of order at most 4 are involved into the computation. These systems are solved by Gauss elimination with complete pivoting. The loss of stability of the Gauss elimination with complete pivoting is rarely encountered in practice.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the Cholesky factor U of the matrix X, T X = op(U) * op(U), which is the solution of either the generalized c-stable continuous-time Lyapunov equation T T op(A) * X * op(E) + op(E) * X * op(A) 2 T = - SCALE * op(B) * op(B), (1) or the generalized d-stable discrete-time Lyapunov equation T T op(A) * X * op(A) - op(E) * X * op(E) 2 T = - SCALE * op(B) * op(B), (2) without first finding X and without the need to form the matrix op(B)**T * op(B). op(K) is either K or K**T for K = A, B, E, U. A and E are N-by-N matrices, op(B) is an M-by-N matrix. The resulting matrix U is an N-by-N upper triangular matrix with non-negative entries on its main diagonal. SCALE is an output scale factor set to avoid overflow in U. In the continuous-time case (1) the pencil A - lambda * E must be c-stable (that is, all eigenvalues must have negative real parts). In the discrete-time case (2) the pencil A - lambda * E must be d-stable (that is, the moduli of all eigenvalues must be smaller than one).Specification
SUBROUTINE SG03BD( DICO, FACT, TRANS, N, M, A, LDA, E, LDE, Q, $ LDQ, Z, LDZ, B, LDB, SCALE, ALPHAR, ALPHAI, $ BETA, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDB, LDE, LDQ, LDWORK, LDZ, M, N CHARACTER DICO, FACT, TRANS C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), ALPHAI(*), ALPHAR(*), B(LDB,*), $ BETA(*), DWORK(*), E(LDE,*), Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies which type of the equation is considered: = 'C': Continuous-time equation (1); = 'D': Discrete-time equation (2). FACT CHARACTER*1 Specifies whether the generalized real Schur factorization of the pencil A - lambda * E is supplied on entry or not: = 'N': Factorization is not supplied; = 'F': Factorization is supplied. TRANS CHARACTER*1 Specifies whether the transposed equation is to be solved or not: = 'N': op(A) = A, op(E) = E; = 'T': op(A) = A**T, op(E) = E**T.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The number of rows in the matrix op(B). M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, if FACT = 'F', then the leading N-by-N upper Hessenberg part of this array must contain the generalized Schur factor A_s of the matrix A (see definition (3) in section METHOD). A_s must be an upper quasitriangular matrix. The elements below the upper Hessenberg part of the array A are not referenced. If FACT = 'N', then the leading N-by-N part of this array must contain the matrix A. On exit, if FACT = 'N', the leading N-by-N upper Hessenberg part of this array contains the generalized Schur factor A_s of the matrix A. (A_s is an upper quasitriangular matrix.) If FACT = 'F', the leading N-by-N upper triangular part of this array is unchanged. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, if FACT = 'F', then the leading N-by-N upper triangular part of this array must contain the generalized Schur factor E_s of the matrix E (see definition (4) in section METHOD). E_s must be an upper triangular matrix. The elements below the upper triangular part of the array E are not referenced. If FACT = 'N', then the leading N-by-N part of this array must contain the coefficient matrix E of the equation. On exit, if FACT = 'N', the leading N-by-N upper triangular part of this array contains the generalized Schur factor E_s of the matrix E. (E_s is an upper triangular matrix.) If FACT = 'F', the leading N-by-N upper triangular part of this array is unchanged. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, if FACT = 'F', then the leading N-by-N part of this array must contain the orthogonal matrix Q from the generalized Schur factorization (see definitions (3) and (4) in section METHOD), or an identity matrix (if the original equation has upper triangular matrices A and E). If FACT = 'N', Q need not be set on entry. On exit, if FACT = 'N', the leading N-by-N part of this array contains the orthogonal matrix Q from the generalized Schur factorization. If FACT = 'F', this array is unchanged. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) On entry, if FACT = 'F', then the leading N-by-N part of this array must contain the orthogonal matrix Z from the generalized Schur factorization (see definitions (3) and (4) in section METHOD), or an identity matrix (if the original equation has upper triangular matrices A and E). If FACT = 'N', Z need not be set on entry. On exit, if FACT = 'N', the leading N-by-N part of this array contains the orthogonal matrix Z from the generalized Schur factorization. If FACT = 'F', this array is unchanged. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N1) On entry, if TRANS = 'T', the leading N-by-M part of this array must contain the matrix B and N1 >= MAX(M,N). If TRANS = 'N', the leading M-by-N part of this array must contain the matrix B and N1 >= N. On exit, if INFO = 0, the leading N-by-N part of this array contains the Cholesky factor U of the solution matrix X of the problem, X = op(U)**T * op(U). If M = 0 and N > 0, then U is set to zero. LDB INTEGER The leading dimension of the array B. If TRANS = 'T', LDB >= MAX(1,N). If TRANS = 'N', LDB >= MAX(1,M,N). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in U. 0 < SCALE <= 1. ALPHAR (output) DOUBLE PRECISION array, dimension (N) ALPHAI (output) DOUBLE PRECISION array, dimension (N) BETA (output) DOUBLE PRECISION array, dimension (N) If INFO = 0, 3, 5, 6, or 7, then (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j = 1, ... ,N, are the eigenvalues of the matrix pencil A - lambda * E. All BETA(j) are non-negative numbers. ALPHAR and ALPHAI will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -21, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= MAX(1,4*N,6*N-6), if FACT = 'N'; LDWORK >= MAX(1,2*N,6*N-6), if FACT = 'F'. For good performance, LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the pencil A - lambda * E is (nearly) singular; perturbed values were used to solve the equation (but the reduced (quasi)triangular matrices A and E are unchanged); = 2: FACT = 'F' and the matrix contained in the upper Hessenberg part of the array A is not in upper quasitriangular form; = 3: FACT = 'F' and there is a 2-by-2 block on the main diagonal of the pencil A_s - lambda * E_s whose eigenvalues are not conjugate complex; = 4: FACT = 'N' and the pencil A - lambda * E cannot be reduced to generalized Schur form: LAPACK routine DGEGS (or DGGES) has failed to converge; = 5: DICO = 'C' and the pencil A - lambda * E is not c-stable; = 6: DICO = 'D' and the pencil A - lambda * E is not d-stable; = 7: the LAPACK routine DSYEVX utilized to factorize M3 failed to converge in the discrete-time case (see section METHOD for SLICOT Library routine SG03BU). This error is unlikely to occur.Method
An extension [2] of Hammarling's method [1] to generalized Lyapunov equations is utilized to solve (1) or (2). First the pencil A - lambda * E is reduced to real generalized Schur form A_s - lambda * E_s by means of orthogonal transformations (QZ-algorithm): A_s = Q**T * A * Z (upper quasitriangular), (3) E_s = Q**T * E * Z (upper triangular). (4) If the pencil A - lambda * E has already been factorized prior to calling the routine, however, then the factors A_s, E_s, Q and Z may be supplied and the initial factorization omitted. Depending on the parameters TRANS and M, the N-by-N upper triangular matrix B_s is defined as follows. In any case Q_B is an M-by-M orthogonal matrix, which need not be accumulated. 1. If TRANS = 'N' and M < N, B_s is the upper triangular matrix from the QR-factorization ( Q_B O ) ( B * Z ) ( ) * B_s = ( ), ( O I ) ( O ) where the O's are zero matrices of proper size and I is the identity matrix of order N-M. 2. If TRANS = 'N' and M >= N, B_s is the upper triangular matrix from the (rectangular) QR-factorization ( B_s ) Q_B * ( ) = B * Z, ( O ) where O is the (M-N)-by-N zero matrix. 3. If TRANS = 'T' and M < N, B_s is the upper triangular matrix from the RQ-factorization ( Q_B O ) (B_s O ) * ( ) = ( Q**T * B O ). ( O I ) 4. If TRANS = 'T' and M >= N, B_s is the upper triangular matrix from the (rectangular) RQ-factorization ( B_s O ) * Q_B = Q**T * B, where O is the N-by-(M-N) zero matrix. Assuming SCALE = 1, the transformation of A, E and B described above leads to the reduced continuous-time equation T T op(A_s) op(U_s) op(U_s) op(E_s) T T + op(E_s) op(U_s) op(U_s) op(A_s) T = - op(B_s) op(B_s) (5) or to the reduced discrete-time equation T T op(A_s) op(U_s) op(U_s) op(A_s) T T - op(E_s) op(U_s) op(U_s) op(E_s) T = - op(B_s) op(B_s). (6) For brevity we restrict ourself to equation (5) and the case TRANS = 'N'. The other three cases can be treated in a similar fashion. We use the following partitioning for the matrices A_s, E_s, B_s, and U_s ( A11 A12 ) ( E11 E12 ) A_s = ( ), E_s = ( ), ( 0 A22 ) ( 0 E22 ) ( B11 B12 ) ( U11 U12 ) B_s = ( ), U_s = ( ). (7) ( 0 B22 ) ( 0 U22 ) The size of the (1,1)-blocks is 1-by-1 (iff A_s(2,1) = 0.0) or 2-by-2. We compute U11, U12**T, and U22 in three steps. Step I: From (5) and (7) we get the 1-by-1 or 2-by-2 equation T T T T A11 * U11 * U11 * E11 + E11 * U11 * U11 * A11 T = - B11 * B11. For brevity, details are omitted here. See [2]. The technique for computing U11 is similar to those applied to standard Lyapunov equations in Hammarling's algorithm ([1], section 6). Furthermore, the auxiliary matrices M1 and M2 defined as follows -1 -1 M1 = U11 * A11 * E11 * U11 -1 -1 M2 = B11 * E11 * U11 are computed in a numerically reliable way. Step II: The generalized Sylvester equation T T T T A22 * U12 + E22 * U12 * M1 = T T T T T - B12 * M2 - A12 * U11 - E12 * U11 * M1 is solved for U12**T. Step III: It can be shown that T T T T A22 * U22 * U22 * E22 + E22 * U22 * U22 * A22 = T T - B22 * B22 - y * y (8) holds, where y is defined as T T T T T T y = B12 - ( E12 * U11 + E22 * U12 ) * M2 . If B22_tilde is the square triangular matrix arising from the (rectangular) QR-factorization ( B22_tilde ) ( B22 ) Q_B_tilde * ( ) = ( ), ( O ) ( y**T ) where Q_B_tilde is an orthogonal matrix of order N, then T T T - B22 * B22 - y * y = - B22_tilde * B22_tilde. Replacing the right hand side in (8) by the term - B22_tilde**T * B22_tilde leads to a reduced generalized Lyapunov equation of lower dimension compared to (5). The recursive application of the steps I to III yields the solution U_s of the equation (5). It remains to compute the solution matrix U of the original problem (1) or (2) from the matrix U_s. To this end we transform the solution back (with respect to the transformation that led from (1) to (5) (from (2) to (6)) and apply the QR-factorization (RQ-factorization). The upper triangular solution matrix U is obtained by Q_U * U = U_s * Q**T (if TRANS = 'N'), or U * Q_U = Z * U_s (if TRANS = 'T'), where Q_U is an N-by-N orthogonal matrix. Again, the orthogonal matrix Q_U need not be accumulated.References
[1] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-323, 1982. [2] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
The number of flops required by the routine is given by the following table. Note that we count a single floating point arithmetic operation as one flop. | FACT = 'F' FACT = 'N' ---------+-------------------------------------------------- M <= N | (13*N**3+6*M*N**2 (211*N**3+6*M*N**2 | +6*M**2*N-2*M**3)/3 +6*M**2*N-2*M**3)/3 | M > N | (11*N**3+12*M*N**2)/3 (209*N**3+12*M*N**2)/3Further Comments
The Lyapunov equation may be very ill-conditioned. In particular, if DICO = 'D' and the pencil A - lambda * E has a pair of almost reciprocal eigenvalues, or DICO = 'C' and the pencil has an almost degenerate pair of eigenvalues, then the Lyapunov equation will be ill-conditioned. Perturbed values were used to solve the equation. A condition estimate can be obtained from the routine SG03AD. When setting the error indicator INFO, the routine does not test for near instability in the equation but only for exact instability.Example
Program Text
* SG03BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 20 ) INTEGER LDA, LDB, LDE, LDQ, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDE = NMAX, $ LDQ = NMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, 4*NMAX, 6*NMAX-6 ) ) * .. Local Scalars .. CHARACTER*1 DICO, FACT, TRANS DOUBLE PRECISION SCALE INTEGER I, INFO, J, N, M * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALPHAI(NMAX), ALPHAR(NMAX), $ B(LDB,NMAX), BETA(NMAX), DWORK(LDWORK), $ E(LDE,NMAX), Q(LDQ,NMAX), Z(LDZ,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL SG03BD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, DICO, FACT, TRANS IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE IF ( M.LT.0 .OR. M.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) M ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( FACT, 'F' ) ) THEN READ ( NIN, FMT = * ) ( ( Q(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( Z(I,J), J = 1,N ), I = 1,N ) END IF IF ( LSAME( FACT, 'T' ) ) THEN READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,N ), I = 1,M ) END IF * Find the Cholesky factor U of the solution matrix. CALL SG03BD( DICO, FACT, TRANS, N, M, A, LDA, E, LDE, Q, LDQ, $ Z, LDZ, B, LDB, SCALE, ALPHAR, ALPHAI, BETA, $ DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) SCALE DO 20 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,N ) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' SG03BD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from SG03BD = ',I2) 99997 FORMAT (' SCALE = ',F8.4,//' The Cholesky factor U of the solution $ matrix is') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
SG03BD EXAMPLE PROGRAM DATA 3 1 C N N -1.0 3.0 -4.0 0.0 5.0 -2.0 -4.0 4.0 1.0 2.0 1.0 3.0 2.0 0.0 1.0 4.0 5.0 1.0 2.0 -1.0 7.0Program Results
SG03BD EXAMPLE PROGRAM RESULTS SCALE = 1.0000 The Cholesky factor U of the solution matrix is 1.6003 -0.4418 -0.1523 0.0000 0.6795 -0.2499 0.0000 0.0000 0.2041
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/SG03BR.html 0000664 0000000 0000000 00000004232 14560147231 0020353 0 ustar 00root root 0000000 0000000
Purpose
To compute the parameters for the complex Givens rotation ( C SR+SI*I ) ( XR+XI*I ) ( ZR+ZI*I ) ( ) * ( ) = ( ) ( -SR+SI*I C ) ( YR+YI*I ) ( 0 ) where C, SR, SI, XR, XI, YR, YI, ZR, ZI are real numbers, I is the imaginary unit, I = SQRT(-1), and C**2 + |SR+SI*I|**2 = 1.Specification
SUBROUTINE SG03BR( XR, XI, YR, YI, C, SR, SI, ZR, ZI ) C .. Scalar Arguments .. DOUBLE PRECISION C, SI, SR, XI, XR, YI, YR, ZI, ZRArguments
Input/Output Parameters
XR, XI, (input) DOUBLE PRECISION YR, YI (input) DOUBLE PRECISION The given real scalars XR, XI, YR, YI. C, (output) DOUBLE PRECISION SR, SI, (output) DOUBLE PRECISION ZR, ZI (output) DOUBLE PRECISION The computed real scalars C, SR, SI, ZR, ZI defining the complex Givens rotation and Z = ZR+ZI*I.Numerical Aspects
The subroutine avoids unnecessary overflow.Further Comments
In the interest of speed, this routine does not check the input for errors.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the Cholesky factor U of the matrix X, X = U**H * U or X = U * U**H, which is the solution of the generalized d-stable discrete-time Lyapunov equation H H 2 H A * X * A - E * X * E = - SCALE * B * B, (1) or the conjugate transposed equation H H 2 H A * X * A - E * X * E = - SCALE * B * B , (2) respectively, where A, E, B, and U are complex N-by-N matrices. The Cholesky factor U of the solution is computed without first finding X. The pencil A - lambda * E must be in complex generalized Schur form (A and E are upper triangular and the diagonal elements of E are non-negative real numbers). Moreover, it must be d-stable, i.e., the moduli of its eigenvalues must be less than one. B must be an upper triangular matrix with real non-negative entries on its main diagonal. The resulting matrix U is upper triangular. The entries on its main diagonal are non-negative. SCALE is an output scale factor set to avoid overflow in U.Specification
SUBROUTINE SG03BS( TRANS, N, A, LDA, E, LDE, B, LDB, SCALE, DWORK, $ ZWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANS DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDB, LDE, N C .. Array Arguments .. DOUBLE PRECISION DWORK(*) COMPLEX*16 A(LDA,*), B(LDB,*), E(LDE,*), ZWORK(*)Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies whether equation (1) or equation (2) is to be solved: = 'N': Solve equation (1); = 'C': Solve equation (2).Input/Output Parameters
N (input) INTEGER The order of the matrices. N >= 0. A (input/workspace) COMPLEX*16 array, dimension (LDA,N) The leading N-by-N upper triangular part of this array must contain the triangular matrix A. The lower triangular part is used as workspace, but the diagonal is restored. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/workspace) COMPLEX*16 array, dimension (LDE,N) The leading N-by-N upper triangular part of this array must contain the triangular matrix E. If TRANS = 'N', the strictly lower triangular part is used as workspace. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) COMPLEX*16 array, dimension (LDB,N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix B. On exit, the leading N-by-N upper triangular part of this array contains the solution matrix U. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in U. 0 < SCALE <= 1.Workspace
DWORK DOUBLE PRECISION array, dimension LDWORK, where LDWORK = 0, if N <= 1; LDWORK = MAX(N-1,10), if N > 1. ZWORK COMPLEX*16, dimension MAX(3*N-3,0)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 3: the pencil A - lambda * E is not stable, i.e., there there are eigenvalues outside the open unit circle; = 4: the LAPACK routine ZSTEIN utilized to factorize M3 failed to converge. This error is unlikely to occur.Method
The method used by the routine is an extension of Hammarling's algorithm [1] to generalized Lyapunov equations. The real case is described in [2]. We present the method for solving equation (1). Equation (2) can be treated in a similar fashion. For simplicity, assume SCALE = 1. Since all matrices A, E, B, and U are upper triangular, we use the following partitioning ( A11 A12 ) ( E11 E12 ) A = ( ), E = ( ), ( 0 A22 ) ( 0 E22 ) ( B11 B12 ) ( U11 U12 ) B = ( ), U = ( ), (3) ( 0 B22 ) ( 0 U22 ) where the size of the (1,1)-blocks is 1-by-1. We compute U11, U12**H and U22 in three steps. Step I: From (1) and (3) we get the 1-by-1 equation H H H H H A11 * U11 * U11 * A11 - E11 * U11 * U11 * E11 = -B11 * B11. For brevity, details are omitted here. The technique for computing U11 is similar to those applied to standard Lyapunov equations in Hammarling's algorithm ([1], section 5). Furthermore, the auxiliary scalars M1 and M2 defined as follows M1 = A11 / E11 , M2 = B11 / E11 / U11 , are computed in a numerically reliable way. Step II: We solve for U12**H the linear system of equations, with scaling to prevent overflow, H H H ( M1 * A22 - E22 ) U12 = H H H = - M2 * B12 + U11 * ( E12 - M1 * A12 ) . Step III: One can show that H H H H A22 * U22 * U22 * A22 - E22 * U22 * U22 * E22 = H H - B22 * B22 - y * y (4) holds, where y is defined as follows H H H H y = ( B12 U11 * A12 + A22 * U12 ) * M3EV, where M3EV is a matrix which fulfils ( I - M2*M2 -M2*M1**H ) H M3 = ( ) = M3EV * M3EV . ( -M1*M2 I - M1*M1**H ) M3 is positive semidefinite and its rank is equal to 1. Therefore, a matrix M3EV can be found by solving the Hermitian eigenvalue problem for M3 such that y consists of one column. If B22_tilde is the square triangular matrix arising from the QR-factorization ( B22_tilde ) ( B22 ) Q * ( ) = ( ), ( 0 ) ( y**H ) then H H H - B22 * B22 - y * y = - B22_tilde * B22_tilde. Replacing the right hand side in (4) by the term - B22_tilde**H * B22_tilde leads to a generalized Lyapunov equation like (1), but of dimension N-1. The solution U of the equation (1) can be obtained by recursive application of the steps I to III.References
[1] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-323, 1982. [2] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
The routine requires 2*N**3 flops. Note that we count a single floating point arithmetic operation as one flop.Further Comments
The Lyapunov equation may be very ill-conditioned. In particular, if the pencil A - lambda * E has a pair of almost reciprocal eigenvalues, then the Lyapunov equation will be ill-conditioned. Perturbed values were used to solve the equation. A condition estimate can be obtained from the routine SG03AD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the Cholesky factor U of the matrix X, X = U**H * U or X = U * U**H, which is the solution of the generalized c-stable continuous-time Lyapunov equation H H 2 H A * X * E + E * X * A = - SCALE * B * B, (1) or the conjugate transposed equation H H 2 H A * X * E + E * X * A = - SCALE * B * B , (2) respectively, where A, E, B, and U are complex N-by-N matrices. The Cholesky factor U of the solution is computed without first finding X. The pencil A - lambda * E must be in complex generalized Schur form (A and E are upper triangular and the diagonal elements of E are non-negative real numbers). Moreover, it must be c-stable, i.e., its eigenvalues must have negative real parts. B must be an upper triangular matrix with real non-negative entries on its main diagonal. The resulting matrix U is upper triangular. The entries on its main diagonal are non-negative. SCALE is an output scale factor set to avoid overflow in U.Specification
SUBROUTINE SG03BT( TRANS, N, A, LDA, E, LDE, B, LDB, SCALE, DWORK, $ ZWORK, INFO ) C .. Scalar Arguments .. CHARACTER TRANS DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDB, LDE, N C .. Array Arguments .. DOUBLE PRECISION DWORK(*) COMPLEX*16 A(LDA,*), B(LDB,*), E(LDE,*), ZWORK(*)Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies whether equation (1) or equation (2) is to be solved: = 'N': Solve equation (1); = 'C': Solve equation (2).Input/Output Parameters
N (input) INTEGER The order of the matrices. N >= 0. A (input/workspace) COMPLEX*16 array, dimension (LDA,N) The leading N-by-N upper triangular part of this array must contain the triangular matrix A. The lower triangular part is used as workspace, but the diagonal is restored. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/workspace) COMPLEX*16 array, dimension (LDE,N) The leading N-by-N upper triangular part of this array must contain the triangular matrix E. If TRANS = 'N', the strictly lower triangular part is used as workspace. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) COMPLEX*16 array, dimension (LDB,N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix B. On exit, the leading N-by-N upper triangular part of this array contains the solution matrix U. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in U. 0 < SCALE <= 1.Workspace
DWORK DOUBLE PRECISION array, dimension MAX(N-1,0) ZWORK COMPLEX*16, dimension MAX(3*N-3,0)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 3: the pencil A - lambda * E is not stable, i.e., there is an eigenvalue without a negative real part.Method
The method used by the routine is an extension of Hammarling's algorithm [1] to generalized Lyapunov equations. The real case is described in [2]. We present the method for solving equation (1). Equation (2) can be treated in a similar fashion. For simplicity, assume SCALE = 1. Since all matrices A, E, B, and U are upper triangular, we use the following partitioning ( A11 A12 ) ( E11 E12 ) A = ( ), E = ( ), ( 0 A22 ) ( 0 E22 ) ( B11 B12 ) ( U11 U12 ) B = ( ), U = ( ), (3) ( 0 B22 ) ( 0 U22 ) where the size of the (1,1)-blocks is 1-by-1. We compute U11, U12**H and U22 in three steps. Step I: From (1) and (3) we get the 1-by-1 equation H H H H H A11 * U11 * U11 * E11 + E11 * U11 * U11 * A11 = -B11 * B11. For brevity, details are omitted here. The technique for computing U11 is similar to those applied to standard Lyapunov equations in Hammarling's algorithm ([1], section 5). Furthermore, the auxiliary scalars M1 and M2 defined as follows M1 = A11 / E11 , M2 = B11 / E11 / U11 , are computed in a numerically reliable way. Step II: We solve for U12**H the linear system of equations, with scaling to prevent overflow, H H H ( A22 + M1 * E22 ) U12 = H H H = - M2 * B12 - U11 * ( A12 + M1 * E12 ) . Step III: One can show that H H H H A22 * U22 * U22 * E22 + E22 * U22 * U22 * A22 = H H - B22 * B22 - y * y (4) holds, where y is defined as follows H H H H y = B12 - M2 * ( U11 * E12 + E22 * U12 ). If B22_tilde is the square triangular matrix arising from the QR-factorization ( B22_tilde ) ( B22 ) Q * ( ) = ( ), ( 0 ) ( y**H ) then H H H - B22 * B22 - y * y = - B22_tilde * B22_tilde. Replacing the right hand side in (4) by the term - B22_tilde**H * B22_tilde leads to a generalized Lyapunov equation like (1), but of dimension N-1. The solution U of the equation (1) can be obtained by recursive application of the steps I to III.References
[1] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-323, 1982. [2] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
The routine requires 2*N**3 flops. Note that we count a single floating point arithmetic operation as one flop.Further Comments
The Lyapunov equation may be very ill-conditioned. In particular, if the pencil A - lambda * E has a pair of almost degenerate eigenvalues, then the Lyapunov equation will be ill-conditioned. Perturbed values were used to solve the equation. A condition estimate can be obtained from the routine SG03AD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the Cholesky factor U of the matrix X, X = U**T * U or X = U * U**T, which is the solution of the generalized d-stable discrete-time Lyapunov equation T T 2 T A * X * A - E * X * E = - SCALE * B * B, (1) or the transposed equation T T 2 T A * X * A - E * X * E = - SCALE * B * B , (2) respectively, where A, E, B, and U are real N-by-N matrices. The Cholesky factor U of the solution is computed without first finding X. The pencil A - lambda * E must be in generalized Schur form ( A upper quasitriangular, E upper triangular ). Moreover, it must be d-stable, i.e., the moduli of its eigenvalues must be less than one. B must be an upper triangular matrix with non-negative entries on its main diagonal. The resulting matrix U is upper triangular. The entries on its main diagonal are non-negative. SCALE is an output scale factor set to avoid overflow in U.Specification
SUBROUTINE SG03BU( TRANS, N, A, LDA, E, LDE, B, LDB, SCALE, DWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER TRANS DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDB, LDE, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), E(LDE,*)Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies whether equation (1) or equation (2) is to be solved: = 'N': Solve equation (1); = 'T': Solve equation (2).Input/Output Parameters
N (input) INTEGER The order of the matrices. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N upper Hessenberg part of this array must contain the quasitriangular matrix A. The elements below the upper Hessenberg part are not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) The leading N-by-N upper triangular part of this array must contain the triangular matrix E. The elements below the main diagonal are not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix B. On exit, the leading N-by-N upper triangular part of this array contains the solution matrix U. The elements below the main diagonal are not referenced. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in U. 0 < SCALE <= 1.Workspace
DWORK DOUBLE PRECISION array, dimension (6*N-6)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the generalized Sylvester equation to be solved in step II (see METHOD) is (nearly) singular to working precision; perturbed values were used to solve the equation (but the matrices A and E are unchanged); = 2: the generalized Schur form of the pencil A - lambda * E contains a 2-by-2 main diagonal block whose eigenvalues are not a pair of complex conjugate numbers; = 3: the pencil A - lambda * E is not d-stable, i.e., there are eigenvalues outside the open unit circle; = 4: the LAPACK routine DSYEVX utilized to factorize M3 failed to converge. This error is unlikely to occur.Method
The method [2] used by the routine is an extension of Hammarling's algorithm [1] to generalized Lyapunov equations. We present the method for solving equation (1). Equation (2) can be treated in a similar fashion. For simplicity, assume SCALE = 1. The matrix A is an upper quasitriangular matrix, i.e., it is a block triangular matrix with square blocks on the main diagonal and the block order at most 2. We use the following partitioning for the matrices A, E, B and the solution matrix U ( A11 A12 ) ( E11 E12 ) A = ( ), E = ( ), ( 0 A22 ) ( 0 E22 ) ( B11 B12 ) ( U11 U12 ) B = ( ), U = ( ). (3) ( 0 B22 ) ( 0 U22 ) The size of the (1,1)-blocks is 1-by-1 (iff A(2,1) = 0.0) or 2-by-2. We compute U11, U12**T, and U22 in three steps. Step I: From (1) and (3) we get the 1-by-1 or 2-by-2 equation T T T T A11 * U11 * U11 * A11 - E11 * U11 * U11 * E11 T = - B11 * B11. For brevity, details are omitted here. The technique for computing U11 is similar to those applied to standard Lyapunov equations in Hammarling's algorithm ([1], section 6). Furthermore, the auxiliary matrices M1 and M2 defined as follows -1 -1 M1 = U11 * A11 * E11 * U11 , -1 -1 M2 = B11 * E11 * U11 , are computed in a numerically reliable way. Step II: We solve for U12**T the generalized Sylvester equation T T T T A22 * U12 * M1 - E22 * U12 T T T T T = - B12 * M2 + E12 * U11 - A12 * U11 * M1. Step III: One can show that T T T T A22 * U22 * U22 * A22 - E22 * U22 * U22 * E22 = T T - B22 * B22 - y * y (4) holds, where y is defined as follows T T T T w = A12 * U11 + A22 * U12 , T y = ( B12 w ) * M3EV, where M3EV is a matrix which fulfils ( I-M2*M2**T -M2*M1**T ) T M3 = ( ) = M3EV * M3EV . ( -M1*M2**T I-M1*M1**T ) M3 is positive semidefinite and its rank is equal to the size of U11. Therefore, a matrix M3EV can be found by solving the symmetric eigenvalue problem for M3 such that y consists of either 1 or 2 rows. If B22_tilde is the square triangular matrix arising from the QR-factorization ( B22_tilde ) ( B22 ) Q * ( ) = ( ), ( 0 ) ( y**T ) then T T T - B22 * B22 - y * y = - B22_tilde * B22_tilde. Replacing the right hand side in (4) by the term - B22_tilde**T * B22_tilde leads to a generalized Lyapunov equation of lower dimension compared to (1). The solution U of the equation (1) can be obtained by recursive application of the steps I to III.References
[1] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-323, 1982. [2] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
The routine requires 2*N**3 flops. Note that we count a single floating point arithmetic operation as one flop.Further Comments
The Lyapunov equation may be very ill-conditioned. In particular, if the pencil A - lambda * E has a pair of almost reciprocal eigenvalues, then the Lyapunov equation will be ill-conditioned. Perturbed values were used to solve the equation. A condition estimate can be obtained from the routine SG03AD. When setting the error indicator INFO, the routine does not test for near instability in the equation but only for exact instability.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the Cholesky factor U of the matrix X, X = U**T * U or X = U * U**T, which is the solution of the generalized c-stable continuous-time Lyapunov equation T T 2 T A * X * E + E * X * A = - SCALE * B * B, (1) or the transposed equation T T 2 T A * X * E + E * X * A = - SCALE * B * B , (2) respectively, where A, E, B, and U are real N-by-N matrices. The Cholesky factor U of the solution is computed without first finding X. The pencil A - lambda * E must be in generalized Schur form ( A upper quasitriangular, E upper triangular ). Moreover, it must be c-stable, i.e., its eigenvalues must have negative real parts. B must be an upper triangular matrix with non-negative entries on its main diagonal. The resulting matrix U is upper triangular. The entries on its main diagonal are non-negative. SCALE is an output scale factor set to avoid overflow in U.Specification
SUBROUTINE SG03BV( TRANS, N, A, LDA, E, LDE, B, LDB, SCALE, DWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER TRANS DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDB, LDE, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), E(LDE,*)Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies whether equation (1) or equation (2) is to be solved: = 'N': Solve equation (1); = 'T': Solve equation (2).Input/Output Parameters
N (input) INTEGER The order of the matrices. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N upper Hessenberg part of this array must contain the quasitriangular matrix A. The elements below the upper Hessenberg part are not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,N) The leading N-by-N upper triangular part of this array must contain the triangular matrix E. The elements below the main diagonal are not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,N) On entry, the leading N-by-N upper triangular part of this array must contain the matrix B. On exit, the leading N-by-N upper triangular part of this array contains the solution matrix U. The elements below the main diagonal are not referenced. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in U. 0 < SCALE <= 1.Workspace
DWORK DOUBLE PRECISION array, dimension (6*N-6)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the generalized Sylvester equation to be solved in step II (see METHOD) is (nearly) singular to working precision; perturbed values were used to solve the equation (but the matrices A and E are unchanged); = 2: the generalized Schur form of the pencil A - lambda * E contains a 2-by-2 main diagonal block whose eigenvalues are not a pair of complex conjugate numbers; = 3: the pencil A - lambda * E is not stable, i.e., there is an eigenvalue with zero or positive real part.Method
The method [2] used by the routine is an extension of Hammarling's algorithm [1] to generalized Lyapunov equations. We present the method for solving equation (1). Equation (2) can be treated in a similar fashion. For simplicity, assume SCALE = 1. The matrix A is an upper quasitriangular matrix, i.e., it is a block triangular matrix with square blocks on the main diagonal and the block order at most 2. We use the following partitioning for the matrices A, E, B and the solution matrix U ( A11 A12 ) ( E11 E12 ) A = ( ), E = ( ), ( 0 A22 ) ( 0 E22 ) ( B11 B12 ) ( U11 U12 ) B = ( ), U = ( ). (3) ( 0 B22 ) ( 0 U22 ) The size of the (1,1)-blocks is 1-by-1 (iff A(2,1) = 0.0) or 2-by-2. We compute U11, U12**T, and U22 in three steps. Step I: From (1) and (3) we get the 1-by-1 or 2-by-2 equation T T T T A11 * U11 * U11 * E11 + E11 * U11 * U11 * A11 T = - B11 * B11. For brevity, details are omitted here. The technique for computing U11 is similar to those applied to standard Lyapunov equations in Hammarling's algorithm ([1], section 6). Furthermore, the auxiliary matrices M1 and M2 defined as follows -1 -1 M1 = U11 * A11 * E11 * U11 , -1 -1 M2 = B11 * E11 * U11 , are computed in a numerically reliable way. Step II: We solve for U12**T the generalized Sylvester equation T T T T A22 * U12 + E22 * U12 * M1 T T T T T = - B12 * M2 - A12 * U11 - E12 * U11 * M1. Step III: One can show that T T T T A22 * U22 * U22 * E22 + E22 * U22 * U22 * A22 = T T - B22 * B22 - y * y (4) holds, where y is defined as follows T T T T w = E12 * U11 + E22 * U12 , T T y = B12 - w * M2 . If B22_tilde is the square triangular matrix arising from the QR-factorization ( B22_tilde ) ( B22 ) Q * ( ) = ( ), ( 0 ) ( y**T ) then T T T - B22 * B22 - y * y = - B22_tilde * B22_tilde. Replacing the right hand side in (4) by the term - B22_tilde**T * B22_tilde leads to a generalized Lyapunov equation of lower dimension compared to (1). The solution U of the equation (1) can be obtained by recursive application of the steps I to III.References
[1] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-323, 1982. [2] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
The routine requires 2*N**3 flops. Note that we count a single floating point arithmetic operation as one flop.Further Comments
The Lyapunov equation may be very ill-conditioned. In particular, if the pencil A - lambda * E has a pair of almost degenerate eigenvalues, then the Lyapunov equation will be ill-conditioned. Perturbed values were used to solve the equation. A condition estimate can be obtained from the routine SG03AD. When setting the error indicator INFO, the routine does not test for near instability in the equation but only for exact instability.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X the generalized Sylvester equation T T A * X * C + E * X * D = SCALE * Y, (1) or the transposed equation T T A * X * C + E * X * D = SCALE * Y, (2) where A and E are real M-by-M matrices, C and D are real N-by-N matrices, X and Y are real M-by-N matrices. N is either 1 or 2. The pencil A - lambda * E must be in generalized real Schur form (A upper quasitriangular, E upper triangular). SCALE is an output scale factor, set to avoid overflow in X.Specification
SUBROUTINE SG03BW( TRANS, M, N, A, LDA, C, LDC, E, LDE, D, LDD, X, $ LDX, SCALE, INFO ) C .. Scalar Arguments .. CHARACTER TRANS DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDC, LDD, LDE, LDX, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), C(LDC,*), D(LDD,*), E(LDE,*), X(LDX,*)Arguments
Mode Parameters
TRANS CHARACTER*1 Specifies whether the transposed equation is to be solved or not: = 'N': Solve equation (1); = 'T': Solve equation (2).Input/Output Parameters
M (input) INTEGER The order of the matrices A and E. M >= 0. N (input) INTEGER The order of the matrices C and D. N = 1 or N = 2. A (input) DOUBLE PRECISION array, dimension (LDA,M) The leading M-by-M part of this array must contain the upper quasitriangular matrix A. The elements below the upper Hessenberg part are not referenced. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,M). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading N-by-N part of this array must contain the matrix C. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,N). E (input) DOUBLE PRECISION array, dimension (LDE,M) The leading M-by-M part of this array must contain the upper triangular matrix E. The elements below the main diagonal are not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,M). D (input) DOUBLE PRECISION array, dimension (LDD,N) The leading N-by-N part of this array must contain the matrix D. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,N). X (input/output) DOUBLE PRECISION array, dimension (LDX,N) On entry, the leading M-by-N part of this array must contain the right hand side matrix Y. On exit, the leading M-by-N part of this array contains the solution matrix X. LDX INTEGER The leading dimension of the array X. LDX >= MAX(1,M). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in X. 0 < SCALE <= 1.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the generalized Sylvester equation is (nearly) singular to working precision; perturbed values were used to solve the equation (but the matrices A, C, D, and E are unchanged).Method
The method used by the routine is based on a generalization of the algorithm due to Bartels and Stewart [1]. See also [2] and [3] for details.References
[1] Bartels, R.H., Stewart, G.W. Solution of the equation A X + X B = C. Comm. A.C.M., 15, pp. 820-826, 1972. [2] Gardiner, J.D., Laub, A.J., Amato, J.J., Moler, C.B. Solution of the Sylvester Matrix Equation A X B**T + C X D**T = E. A.C.M. Trans. Math. Soft., vol. 18, no. 2, pp. 223-231, 1992. [3] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
The routine requires about 2 * N * M**2 flops. Note that we count a single floating point arithmetic operation as one flop. The algorithm is backward stable if the eigenvalues of the pencil A - lambda * E are real. Otherwise, linear systems of order at most 4 are involved into the computation. These systems are solved by Gauss elimination with complete pivoting. The loss of stability of the Gauss elimination with complete pivoting is rarely encountered in practice.Further Comments
When near singularity is detected, perturbed values are used to solve the equation (but the given matrices are unchanged).Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To solve for X = op(U)**T * op(U) either the generalized c-stable continuous-time Lyapunov equation T T op(A) * X * op(E) + op(E) * X * op(A) 2 T = - SCALE * op(B) * op(B), (1) or the generalized d-stable discrete-time Lyapunov equation T T op(A) * X * op(A) - op(E) * X * op(E) 2 T = - SCALE * op(B) * op(B), (2) where op(K) is either K or K**T for K = A, B, E, U. The Cholesky factor U of the solution is computed without first finding X. Furthermore, the auxiliary matrices -1 -1 M1 := op(U) * op(A) * op(E) * op(U) -1 -1 M2 := op(B) * op(E) * op(U) are computed in a numerically reliable way. The matrices A, B, E, M1, M2, and U are real 2-by-2 matrices. The pencil A - lambda * E must have a pair of complex conjugate eigenvalues. The eigenvalues must be in the open right half plane (in the continuous-time case) or inside the unit circle (in the discrete-time case). The matrices E and B are upper triangular. The resulting matrix U is upper triangular. The entries on its main diagonal are non-negative. SCALE is an output scale factor set to avoid overflow in U.Specification
SUBROUTINE SG03BX( DICO, TRANS, A, LDA, E, LDE, B, LDB, U, LDU, $ SCALE, M1, LDM1, M2, LDM2, INFO ) C .. Scalar Arguments .. CHARACTER DICO, TRANS DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDB, LDE, LDM1, LDM2, LDU C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), E(LDE,*), M1(LDM1,*), $ M2(LDM2,*), U(LDU,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies whether the continuous-time or the discrete-time equation is to be solved: = 'C': Solve continuous-time equation (1); = 'D': Solve discrete-time equation (2). TRANS CHARACTER*1 Specifies whether the transposed equation is to be solved or not: = 'N': op(K) = K, K = A, B, E, U; = 'T': op(K) = K**T, K = A, B, E, U.Input/Output Parameters
A (input) DOUBLE PRECISION array, dimension (LDA,2) The leading 2-by-2 part of this array must contain the matrix A. LDA INTEGER The leading dimension of the array A. LDA >= 2. E (input) DOUBLE PRECISION array, dimension (LDE,2) The leading 2-by-2 upper triangular part of this array must contain the matrix E. LDE INTEGER The leading dimension of the array E. LDE >= 2. B (input) DOUBLE PRECISION array, dimension (LDB,2) The leading 2-by-2 upper triangular part of this array must contain the matrix B. LDB INTEGER The leading dimension of the array B. LDB >= 2. U (output) DOUBLE PRECISION array, dimension (LDU,2) The leading 2-by-2 part of this array contains the upper triangular matrix U. LDU INTEGER The leading dimension of the array U. LDU >= 2. SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in U. 0 < SCALE <= 1. M1 (output) DOUBLE PRECISION array, dimension (LDM1,2) The leading 2-by-2 part of this array contains the matrix M1. LDM1 INTEGER The leading dimension of the array M1. LDM1 >= 2. M2 (output) DOUBLE PRECISION array, dimension (LDM2,2) The leading 2-by-2 part of this array contains the matrix M2. LDM2 INTEGER The leading dimension of the array M2. LDM2 >= 2.Error Indicator
INFO INTEGER = 0: successful exit; = 2: the eigenvalues of the pencil A - lambda * E are not a pair of complex conjugate numbers; = 3: the eigenvalues of the pencil A - lambda * E are not in the open right half plane (in the continuous- time case) or inside the unit circle (in the discrete-time case); = 4: the LAPACK routine ZSTEIN utilized to factorize M3 (see SLICOT Library routine SG03BS) failed to converge. This error is unlikely to occur.Method
The method used by the routine is based on a generalization of the method due to Hammarling ([1], section 6) for Lyapunov equations of order 2. A more detailed description is given in [2].References
[1] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-323, 1982. [2] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Further Comments
If the solution matrix U is singular, the matrices M1 and M2 are properly set (see [1], equation (6.21)).Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the parameters for the complex Givens rotation ( CR-CI*I SR-SI*I ) ( XR+XI*I ) ( Z ) ( ) * ( ) = ( ), ( -SR-SI*I CR+CI*I ) ( YR+YI*I ) ( 0 ) where CR, CI, SR, SI, XR, XI, YR, YI are real numbers and I is the imaginary unit, I = SQRT(-1). Z is a non-negative real number.Specification
SUBROUTINE SG03BY( XR, XI, YR, YI, CR, CI, SR, SI, Z ) C .. Scalar Arguments .. DOUBLE PRECISION CI, CR, SI, SR, XI, XR, YI, YR, ZArguments
Input/Output Parameters
XR, XI, (input) DOUBLE PRECISION YR, YI (input) DOUBLE PRECISION The given real scalars XR, XI, YR, YI. CR, CI, (output) DOUBLE PRECISION SR, SI, (output) DOUBLE PRECISION Z (output) DOUBLE PRECISION The computed real scalars CR, CI, SR, SI, Z, defining the complex Givens rotation and Z.Numerical Aspects
The subroutine avoids unnecessary overflow.Further Comments
In the interest of speed, this routine does not check the input for errors.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the Cholesky factor U of the matrix X, H X = op(U) * op(U), which is the solution of either the generalized c-stable continuous-time Lyapunov equation H H op(A) * X * op(E) + op(E) * X * op(A) 2 H = - SCALE * op(B) * op(B), (1) or the generalized d-stable discrete-time Lyapunov equation H H op(A) * X * op(A) - op(E) * X * op(E) 2 H = - SCALE * op(B) * op(B), (2) without first finding X and without the need to form the matrix op(B)**H * op(B). op(K) is either K or K**H for K = A, B, E, U. A and E are N-by-N matrices, op(B) is an M-by-N matrix. The resulting matrix U is an N-by-N upper triangular matrix with non-negative entries on its main diagonal. SCALE is an output scale factor set to avoid overflow in U. In the continuous-time case (1) the pencil A - lambda * E must be c-stable (that is, all eigenvalues must have negative real parts). In the discrete-time case (2) the pencil A - lambda * E must be d-stable (that is, the moduli of all eigenvalues must be smaller than one).Specification
SUBROUTINE SG03BZ( DICO, FACT, TRANS, N, M, A, LDA, E, LDE, Q, $ LDQ, Z, LDZ, B, LDB, SCALE, ALPHA, BETA, DWORK, $ ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. DOUBLE PRECISION SCALE INTEGER INFO, LDA, LDB, LDE, LDQ, LDZ, LZWORK, M, N CHARACTER DICO, FACT, TRANS C .. Array Arguments .. COMPLEX*16 A(LDA,*), ALPHA(*), B(LDB,*), BETA(*), E(LDE,*), $ Q(LDQ,*), Z(LDZ,*), ZWORK(*) DOUBLE PRECISION DWORK(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies which type of the equation is considered: = 'C': Continuous-time equation (1); = 'D': Discrete-time equation (2). FACT CHARACTER*1 Specifies whether the generalized (complex) Schur factorization of the pencil A - lambda * E is supplied on entry or not: = 'N': Factorization is not supplied; = 'F': Factorization is supplied. TRANS CHARACTER*1 Specifies whether the conjugate transposed equation is to be solved or not: = 'N': op(A) = A, op(E) = E; = 'C': op(A) = A**H, op(E) = E**H.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The number of rows in the matrix op(B). M >= 0. If M = 0, A and E are unchanged on exit, and Q, Z, ALPHA and BETA are not set. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, if FACT = 'F', then the leading N-by-N upper triangular part of this array must contain the generalized Schur factor A_s of the matrix A (see definition (3) in section METHOD). A_s must be an upper triangular matrix. The elements below the upper triangular part of the array A are used as workspace. If FACT = 'N', then the leading N-by-N part of this array must contain the matrix A. On exit, if FACT = 'N', the leading N-by-N upper triangular part of this array contains the generalized Schur factor A_s of the matrix A. (A_s is an upper triangular matrix.) If FACT = 'F', the leading N-by-N upper triangular part of this array is unchanged. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) COMPLEX*16 array, dimension (LDE,N) On entry, if FACT = 'F', then the leading N-by-N upper triangular part of this array must contain the generalized Schur factor E_s of the matrix E (see definition (4) in section METHOD). E_s must be an upper triangular matrix. The elements below the upper triangular part of the array E are used as workspace. If FACT = 'N', then the leading N-by-N part of this array must contain the coefficient matrix E of the equation. On exit, if FACT = 'N', the leading N-by-N upper triangular part of this array contains the generalized Schur factor E_s of the matrix E. (E_s is an upper triangular matrix.) If FACT = 'F', the leading N-by-N upper triangular part of this array is unchanged. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). Q (input/output) COMPLEX*16 array, dimension (LDQ,N) On entry, if FACT = 'F', then the leading N-by-N part of this array must contain the unitary matrix Q from the generalized Schur factorization (see definitions (3) and (4) in section METHOD), or an identity matrix (if the original equation has upper triangular matrices A and E). If FACT = 'N', Q need not be set on entry. On exit, if FACT = 'N', the leading N-by-N part of this array contains the unitary matrix Q from the generalized Schur factorization. If FACT = 'F', this array is unchanged. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). Z (input/output) COMPLEX*16 array, dimension (LDZ,N) On entry, if FACT = 'F', then the leading N-by-N part of this array must contain the unitary matrix Z from the generalized Schur factorization (see definitions (3) and (4) in section METHOD), or an identity matrix (if the original equation has upper triangular matrices A and E). If FACT = 'N', Z need not be set on entry. On exit, if FACT = 'N', the leading N-by-N part of this array contains the unitary matrix Z from the generalized Schur factorization. If FACT = 'F', this array is unchanged. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,N). B (input/output) COMPLEX*16 array, dimension (LDB,N1) On entry, if TRANS = 'C', the leading N-by-M part of this array must contain the matrix B and N1 >= MAX(M,N). If TRANS = 'N', the leading M-by-N part of this array must contain the matrix B and N1 >= N. On exit, if INFO = 0, the leading N-by-N part of this array contains the Cholesky factor U of the solution matrix X of the problem, X = op(U)**H * op(U). If M = 0 and N > 0, then U is set to zero. LDB INTEGER The leading dimension of the array B. If TRANS = 'C', LDB >= MAX(1,N). If TRANS = 'N', LDB >= MAX(1,M,N). SCALE (output) DOUBLE PRECISION The scale factor set to avoid overflow in U. 0 < SCALE <= 1. ALPHA (output) COMPLEX*16 arrays, dimension (N) BETA If INFO = 0, 5, 6, or 7, then ALPHA(j)/BETA(j), j = 1, ... , N, are the eigenvalues of the matrix pencil A - lambda * E (the diagonals of the complex Schur form). All BETA(j) are non-negative real numbers. ALPHA will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK), where LDWORK = 0, if MIN(M,N) = 0 or FACT = 'F' and N <= 1; else, LDWORK = N-1, if FACT = 'F' and DICO = 'C'; LDWORK = MAX(N-1,10), if FACT = 'F' and DICO = 'D'; LDWORK = 8*N, if FACT = 'N'. ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. On exit, if INFO = -21, ZWORK(1) returns the minimum value of LZWORK. LZWORK INTEGER The dimension of the array ZWORK. LZWORK >= MAX(1,3*N-3,2*N). For good performance, LZWORK should be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 4: FACT = 'N' and the pencil A - lambda * E cannot be reduced to generalized Schur form: LAPACK routine ZGGES has failed to converge; = 5: DICO = 'C' and the pencil A - lambda * E is not c-stable; = 6: DICO = 'D' and the pencil A - lambda * E is not d-stable; = 7: the LAPACK routine ZSTEIN utilized to factorize M3 failed to converge in the discrete-time case (see section METHOD for SLICOT Library routine SG03BS). This error is unlikely to occur.Method
An extension [2] of Hammarling's method [1] to generalized Lyapunov equations is utilized to solve (1) or (2). First the pencil A - lambda * E is reduced to complex generalized Schur form A_s - lambda * E_s by means of unitary transformations (QZ-algorithm): A_s = Q**H * A * Z (upper triangular), (3) E_s = Q**H * E * Z (upper triangular). (4) If the pencil A - lambda * E has already been factorized prior to calling the routine, however, then the factors A_s, E_s, Q and Z may be supplied and the initial factorization omitted. Depending on the parameters TRANS and M, the N-by-N upper triangular matrix B_s is defined as follows. In any case Q_B is an M-by-M unitary matrix, which need not be accumulated. 1. If TRANS = 'N' and M < N, B_s is the upper triangular matrix from the QR-factorization ( Q_B O ) ( B * Z ) ( ) * B_s = ( ), ( O I ) ( O ) where the O's are zero matrices of proper size and I is the identity matrix of order N-M. 2. If TRANS = 'N' and M >= N, B_s is the upper triangular matrix from the (rectangular) QR-factorization ( B_s ) Q_B * ( ) = B * Z, ( O ) where O is the (M-N)-by-N zero matrix. 3. If TRANS = 'C' and M < N, B_s is the upper triangular matrix from the RQ-factorization ( Q_B O ) (B_s O ) * ( ) = ( Q**H * B O ). ( O I ) 4. If TRANS = 'C' and M >= N, B_s is the upper triangular matrix from the (rectangular) RQ-factorization ( B_s O ) * Q_B = Q**H * B, where O is the N-by-(M-N) zero matrix. Assuming SCALE = 1, the transformation of A, E and B described above leads to the reduced continuous-time equation H H op(A_s) op(U_s) op(U_s) op(E_s) H H + op(E_s) op(U_s) op(U_s) op(A_s) H = - op(B_s) op(B_s) (5) or to the reduced discrete-time equation H H op(A_s) op(U_s) op(U_s) op(A_s) H H - op(E_s) op(U_s) op(U_s) op(E_s) H = - op(B_s) op(B_s). (6) For brevity we restrict ourself to equation (5) and the case TRANS = 'N'. The other three cases can be treated in a similar fashion. We use the following partitioning for the matrices A_s, E_s, B_s, and U_s ( A11 A12 ) ( E11 E12 ) A_s = ( ), E_s = ( ), ( 0 A22 ) ( 0 E22 ) ( B11 B12 ) ( U11 U12 ) B_s = ( ), U_s = ( ). (7) ( 0 B22 ) ( 0 U22 ) The size of the (1,1)-blocks is 1-by-1. We compute U11, U12**H, and U22 in three steps. Step I: From (5) and (7) we get the 1-by-1 equation H H H H A11 * U11 * U11 * E11 + E11 * U11 * U11 * A11 H = - B11 * B11. For brevity, details are omitted here. See [2]. The technique for computing U11 is similar to those applied to standard Lyapunov equations in Hammarling's algorithm ([1], section 5). Furthermore, the auxiliary scalars M1 and M2 defined as follows M1 = A11 / E11 , M2 = B11 / E11 / U11 , are computed in a numerically reliable way. Step II: The generalized Sylvester equation H H H H A22 * U12 + E22 * U12 * M1 = H H H H H - B12 * M2 - A12 * U11 - E12 * U11 * M1 is solved for U12**H, as a linear system of order N-1. Step III: It can be shown that H H H H A22 * U22 * U22 * E22 + E22 * U22 * U22 * A22 = H H - B22 * B22 - y * y (8) holds, where y is defined as H H H H H y = B12 - ( E12 * U11 + E22 * U12 ) * M2 . If B22_tilde is the square triangular matrix arising from the (rectangular) QR-factorization ( B22_tilde ) ( B22 ) Q_B_tilde * ( ) = ( ), ( O ) ( y**H ) where Q_B_tilde is a unitary matrix of order N, then H H H - B22 * B22 - y * y = - B22_tilde * B22_tilde. Replacing the right hand side in (8) by the term - B22_tilde**H * B22_tilde leads to a reduced generalized Lyapunov equation like (5), but of dimension N-1. The recursive application of the steps I to III yields the solution U_s of the equation (5). It remains to compute the solution matrix U of the original problem (1) or (2) from the matrix U_s. To this end we transform the solution back (with respect to the transformation that led from (1) to (5) (from (2) to (6)) and apply the QR-factorization (RQ-factorization). The upper triangular solution matrix U is obtained by Q_U * U = U_s * Q**H (if TRANS = 'N'), or U * Q_U = Z * U_s (if TRANS = 'C'), where Q_U is an N-by-N unitary matrix. Again, the unitary matrix Q_U need not be accumulated.References
[1] Hammarling, S.J. Numerical solution of the stable, non-negative definite Lyapunov equation. IMA J. Num. Anal., 2, pp. 303-323, 1982. [2] Penzl, T. Numerical solution of generalized Lyapunov equations. Advances in Comp. Math., vol. 8, pp. 33-48, 1998.Numerical Aspects
The number of flops required by the routine is given by the following table. Note that we count a single floating point arithmetic operation as one flop. | FACT = 'F' FACT = 'N' ---------+-------------------------------------------------- M <= N | (13*N**3+6*M*N**2 (211*N**3+6*M*N**2 | +6*M**2*N-2*M**3)/3 +6*M**2*N-2*M**3)/3 | M > N | (11*N**3+12*M*N**2)/3 (209*N**3+12*M*N**2)/3Further Comments
The Lyapunov equation may be very ill-conditioned. In particular, if DICO = 'D' and the pencil A - lambda * E has a pair of almost reciprocal eigenvalues, or DICO = 'C' and the pencil has an almost degenerate pair of eigenvalues, then the Lyapunov equation will be ill-conditioned. Perturbed values were used to solve the equation. A condition estimate can be obtained from the routine SG03AD.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01ID.html 0000664 0000000 0000000 00000025327 14560147231 0020346 0 ustar 00root root 0000000 0000000
Purpose
To reduce the 1-norm of a system matrix S = ( A B ) ( C 0 ) corresponding to the triple (A,B,C), by balancing. This involves a diagonal similarity transformation inv(D)*A*D applied iteratively to A to make the rows and columns of -1 diag(D,I) * S * diag(D,I) as close in norm as possible. The balancing can be performed optionally on the following particular system matrices S = A, S = ( A B ) or S = ( A ) ( C )Specification
SUBROUTINE TB01ID( JOB, N, M, P, MAXRED, A, LDA, B, LDB, C, LDC, $ SCALE, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER INFO, LDA, LDB, LDC, M, N, P DOUBLE PRECISION MAXRED C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ SCALE( * )Arguments
Mode Parameters
JOB CHARACTER*1 Indicates which matrices are involved in balancing, as follows: = 'A': All matrices are involved in balancing; = 'B': B and A matrices are involved in balancing; = 'C': C and A matrices are involved in balancing; = 'N': B and C matrices are not involved in balancing.Input/Output Parameters
N (input) INTEGER The order of the matrix A, the number of rows of matrix B and the number of columns of matrix C. N represents the dimension of the state vector. N >= 0. M (input) INTEGER. The number of columns of matrix B. M represents the dimension of input vector. M >= 0. P (input) INTEGER. The number of rows of matrix C. P represents the dimension of output vector. P >= 0. MAXRED (input/output) DOUBLE PRECISION On entry, the maximum allowed reduction in the 1-norm of S (in an iteration) if zero rows or columns are encountered. If MAXRED > 0.0, MAXRED must be larger than one (to enable the norm reduction). If MAXRED <= 0.0, then the value 10.0 for MAXRED is used. On exit, if the 1-norm of the given matrix S is non-zero, the ratio between the 1-norm of the given matrix and the 1-norm of the balanced matrix. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the system state matrix A. On exit, the leading N-by-N part of this array contains the balanced matrix inv(D)*A*D. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, if M > 0, the leading N-by-M part of this array must contain the system input matrix B. On exit, if M > 0, the leading N-by-M part of this array contains the balanced matrix inv(D)*B. The array B is not referenced if M = 0. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N) if M > 0. LDB >= 1 if M = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, if P > 0, the leading P-by-N part of this array must contain the system output matrix C. On exit, if P > 0, the leading P-by-N part of this array contains the balanced matrix C*D. The array C is not referenced if P = 0. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). SCALE (output) DOUBLE PRECISION array, dimension (N) The scaling factors applied to S. If D(j) is the scaling factor applied to row and column j, then SCALE(j) = D(j), for j = 1,...,N.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
Balancing consists of applying a diagonal similarity transformation -1 diag(D,I) * S * diag(D,I) to make the 1-norms of each row of the first N rows of S and its corresponding column nearly equal. Information about the diagonal matrix D is returned in the vector SCALE.References
[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.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* TB01ID EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX ) * .. Local Scalars .. CHARACTER*1 JOB INTEGER I, INFO, J, M, N, P DOUBLE PRECISION MAXRED * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ SCALE(NMAX) * .. External Subroutines .. EXTERNAL TB01ID, UD01MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOB, MAXRED 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 ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Balance system matrix S. CALL TB01ID( JOB, N, M, P, MAXRED, A, LDA, B, LDB, C, $ LDC, SCALE, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE CALL UD01MD( N, N, 5, NOUT, A, LDA, $ 'The balanced matrix A', INFO ) IF ( M.GT.0 ) $ CALL UD01MD( N, M, 5, NOUT, B, LDB, $ 'The balanced matrix B', INFO ) IF ( P.GT.0 ) $ CALL UD01MD( P, N, 5, NOUT, C, LDC, $ 'The balanced matrix C', INFO ) CALL UD01MD( 1, N, 5, NOUT, SCALE, 1, $ 'The scaling vector SCALE', INFO ) WRITE ( NOUT, FMT = 99994 ) MAXRED END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01ID EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01ID = ',I2) 99994 FORMAT (/' MAXRED is ',E13.4) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB01ID EXAMPLE PROGRAM DATA 5 2 5 A 0.0 0.0 1.0000e+000 0.0 0.0 0.0 -1.5800e+006 -1.2570e+003 0.0 0.0 0.0 3.5410e+014 0.0 -1.4340e+003 0.0 -5.3300e+011 0.0 0.0 0.0 0.0 1.0000e+000 0.0 0.0 0.0 -1.8630e+004 -1.4820e+000 0.0 0.0 1.1030e+002 0.0 0.0 0.0 0.0 0.0 0.0 8.3330e-003 1.0000e+000 0.0 0.0 0.0 0.0 0.0 0.0 1.0000e+000 0.0 0.0 0.0 0.0 0.0 1.0000e+000 0.0 6.6640e-001 0.0 -6.2000e-013 0.0 0.0 0.0 0.0 -1.0000e-003 1.8960e+006 1.5080e+002Program Results
TB01ID EXAMPLE PROGRAM RESULTS The balanced matrix A ( 5X 5) 1 2 3 4 5 1 0.0000000D+00 0.1000000D+05 0.0000000D+00 0.0000000D+00 0.0000000D+00 2 -0.1580000D+03 -0.1257000D+04 0.0000000D+00 0.0000000D+00 0.0000000D+00 3 0.3541000D+05 0.0000000D+00 -0.1434000D+04 0.0000000D+00 -0.5330000D+03 4 0.0000000D+00 0.0000000D+00 0.0000000D+00 0.0000000D+00 0.1000000D+03 5 0.0000000D+00 0.0000000D+00 0.0000000D+00 -0.1863000D+03 -0.1482000D+01 The balanced matrix B ( 5X 2) 1 2 1 0.0000000D+00 0.0000000D+00 2 0.1103000D+04 0.0000000D+00 3 0.0000000D+00 0.0000000D+00 4 0.0000000D+00 0.0000000D+00 5 0.0000000D+00 0.8333000D+02 The balanced matrix C ( 5X 5) 1 2 3 4 5 1 0.1000000D-04 0.0000000D+00 0.0000000D+00 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 0.0000000D+00 0.1000000D+06 0.0000000D+00 0.0000000D+00 3 0.0000000D+00 0.0000000D+00 0.0000000D+00 0.1000000D-05 0.0000000D+00 4 0.6664000D-05 0.0000000D+00 -0.6200000D-07 0.0000000D+00 0.0000000D+00 5 0.0000000D+00 0.0000000D+00 -0.1000000D+03 0.1896000D+01 0.1508000D-01 The scaling vector SCALE ( 1X 5) 1 2 3 4 5 1 0.1000000D-04 0.1000000D+00 0.1000000D+06 0.1000000D-05 0.1000000D-03 MAXRED is 0.3488E+10
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01IZ.html 0000664 0000000 0000000 00000030576 14560147231 0020376 0 ustar 00root root 0000000 0000000
Purpose
To reduce the 1-norm of a system matrix S = ( A B ) ( C 0 ) corresponding to the triple (A,B,C), by balancing. This involves a diagonal similarity transformation inv(D)*A*D applied iteratively to A to make the rows and columns of -1 diag(D,I) * S * diag(D,I) as close in norm as possible. The balancing can be performed optionally on the following particular system matrices S = A, S = ( A B ) or S = ( A ) ( C )Specification
SUBROUTINE TB01IZ( JOB, N, M, P, MAXRED, A, LDA, B, LDB, C, LDC, $ SCALE, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER INFO, LDA, LDB, LDC, M, N, P DOUBLE PRECISION MAXRED C .. Array Arguments .. COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * ) DOUBLE PRECISION SCALE( * )Arguments
Mode Parameters
JOB CHARACTER*1 Indicates which matrices are involved in balancing, as follows: = 'A': All matrices are involved in balancing; = 'B': B and A matrices are involved in balancing; = 'C': C and A matrices are involved in balancing; = 'N': B and C matrices are not involved in balancing.Input/Output Parameters
N (input) INTEGER The order of the matrix A, the number of rows of matrix B and the number of columns of matrix C. N represents the dimension of the state vector. N >= 0. M (input) INTEGER. The number of columns of matrix B. M represents the dimension of input vector. M >= 0. P (input) INTEGER. The number of rows of matrix C. P represents the dimension of output vector. P >= 0. MAXRED (input/output) DOUBLE PRECISION On entry, the maximum allowed reduction in the 1-norm of S (in an iteration) if zero rows or columns are encountered. If MAXRED > 0.0, MAXRED must be larger than one (to enable the norm reduction). If MAXRED <= 0.0, then the value 10.0 for MAXRED is used. On exit, if the 1-norm of the given matrix S is non-zero, the ratio between the 1-norm of the given matrix and the 1-norm of the balanced matrix. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the system state matrix A. On exit, the leading N-by-N part of this array contains the balanced matrix inv(D)*A*D. LDA INTEGER The leading dimension of the array A. LDA >= max(1,N). B (input/output) COMPLEX*16 array, dimension (LDB,M) On entry, if M > 0, the leading N-by-M part of this array must contain the system input matrix B. On exit, if M > 0, the leading N-by-M part of this array contains the balanced matrix inv(D)*B. The array B is not referenced if M = 0. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N) if M > 0. LDB >= 1 if M = 0. C (input/output) COMPLEX*16 array, dimension (LDC,N) On entry, if P > 0, the leading P-by-N part of this array must contain the system output matrix C. On exit, if P > 0, the leading P-by-N part of this array contains the balanced matrix C*D. The array C is not referenced if P = 0. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). SCALE (output) DOUBLE PRECISION array, dimension (N) The scaling factors applied to S. If D(j) is the scaling factor applied to row and column j, then SCALE(j) = D(j), for j = 1,...,N.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
Balancing consists of applying a diagonal similarity transformation -1 diag(D,I) * S * diag(D,I) to make the 1-norms of each row of the first N rows of S and its corresponding column nearly equal. Information about the diagonal matrix D is returned in the vector SCALE.References
[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.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* TB01IZ EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX ) * .. Local Scalars .. CHARACTER*1 JOB INTEGER I, INFO, J, M, N, P DOUBLE PRECISION MAXRED * .. Local Arrays .. COMPLEX*16 A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX) DOUBLE PRECISION SCALE(NMAX) * .. External Subroutines .. EXTERNAL TB01IZ, UD01MD, UD01MZ * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOB, MAXRED 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 ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Balance system matrix S. CALL TB01IZ( JOB, N, M, P, MAXRED, A, LDA, B, LDB, C, $ LDC, SCALE, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE CALL UD01MZ( N, N, 3, NOUT, A, LDA, $ 'The balanced matrix A', INFO ) IF ( M.GT.0 ) $ CALL UD01MZ( N, M, 3, NOUT, B, LDB, $ 'The balanced matrix B', INFO ) IF ( P.GT.0 ) $ CALL UD01MZ( P, N, 3, NOUT, C, LDC, $ 'The balanced matrix C', INFO ) CALL UD01MD( 1, N, 5, NOUT, SCALE, 1, $ 'The scaling vector SCALE', INFO ) WRITE ( NOUT, FMT = 99994 ) MAXRED END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01IZ EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01IZ = ',I2) 99994 FORMAT (/' MAXRED is ',E13.4) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) 99991 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB01IZ EXAMPLE PROGRAM DATA 5 2 5 A 0.0 (0.0,0.0) (1.0000e+000,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (-1.5800e+006,0.0) (-1.2570e+003,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (3.5410e+014,0.0) (0.0,0.0) (-1.4340e+003,0.0) (0.0,0.0) (-5.3300e+011,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (1.0000e+000,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (-1.8630e+004,0.0) (-1.4820e+000,0.0) (0.0,0.0) (0.0,0.0) (1.1030e+002,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (8.3330e-003,0.0) (1.0000e+000,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (1.0000e+000,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (1.0000e+000,0.0) (0.0,0.0) (6.6640e-001,0.0) (0.0,0.0) (-6.2000e-013,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (0.0,0.0) (-1.0000e-003,0.0) (1.8960e+006,0.0) (1.5080e+002,0.0)Program Results
TB01IZ EXAMPLE PROGRAM RESULTS The balanced matrix A ( 5X 5) 1 2 3 1 0.0000000D+00 +0.0000000D+00i 0.1000000D+05 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 2 -0.1580000D+03 +0.0000000D+00i -0.1257000D+04 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 3 0.3541000D+05 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i -0.1434000D+04 +0.0000000D+00i 4 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 5 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 4 5 1 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 2 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 3 0.0000000D+00 +0.0000000D+00i -0.5330000D+03 +0.0000000D+00i 4 0.0000000D+00 +0.0000000D+00i 0.1000000D+03 +0.0000000D+00i 5 -0.1863000D+03 +0.0000000D+00i -0.1482000D+01 +0.0000000D+00i The balanced matrix B ( 5X 2) 1 2 1 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 2 0.1103000D+04 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 3 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 4 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 5 0.0000000D+00 +0.0000000D+00i 0.8333000D+02 +0.0000000D+00i The balanced matrix C ( 5X 5) 1 2 3 1 0.1000000D-04 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 2 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 0.1000000D+06 +0.0000000D+00i 3 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 4 0.6664000D-05 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i -0.6200000D-07 +0.0000000D+00i 5 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i -0.1000000D+03 +0.0000000D+00i 4 5 1 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 2 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 3 0.1000000D-05 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 4 0.0000000D+00 +0.0000000D+00i 0.0000000D+00 +0.0000000D+00i 5 0.1896000D+01 +0.0000000D+00i 0.1508000D-01 +0.0000000D+00i The scaling vector SCALE ( 1X 5) 1 2 3 4 5 1 0.1000000D-04 0.1000000D+00 0.1000000D+06 0.1000000D-05 0.1000000D-03 MAXRED is 0.3488E+10
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01KD.html 0000664 0000000 0000000 00000032731 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To compute an additive spectral decomposition of the transfer- function matrix of the system (A,B,C) by reducing the system state-matrix A to a block-diagonal form. The system matrices are transformed as A <-- inv(U)*A*U, B <--inv(U)*B and C <-- C*U. The leading diagonal block of the resulting A has eigenvalues in a suitably defined domain of interest.Specification
SUBROUTINE TB01KD( DICO, STDOM, JOBA, N, M, P, ALPHA, A, LDA, B, $ LDB, C, LDC, NDIM, U, LDU, WR, WI, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBA, STDOM INTEGER INFO, LDA, LDB, LDC, LDU, LDWORK, M, N, NDIM, P DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), U(LDU,*), $ WI(*), WR(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system as follows: = 'C': continuous-time system; = 'D': discrete-time system. STDOM CHARACTER*1 Specifies whether the domain of interest is of stability type (left part of complex plane or inside of a circle) or of instability type (right part of complex plane or outside of a circle) as follows: = 'S': stability type domain; = 'U': instability type domain. JOBA CHARACTER*1 Specifies the shape of the state dynamics matrix on entry as follows: = 'S': A is in an upper real Schur form; = 'G': A is a general square dense matrix.Input/Output Parameters
N (input) INTEGER The order of the state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs, or of columns of B. M >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. ALPHA (input) DOUBLE PRECISION. Specifies the boundary of the domain of interest for the eigenvalues of A. For a continuous-time system (DICO = 'C'), ALPHA is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), ALPHA >= 0 represents the boundary value for the moduli of eigenvalues. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the unreduced state dynamics matrix A. If JOBA = 'S' then A must be a matrix in real Schur form. On exit, the leading N-by-N part of this array contains a block diagonal matrix inv(U) * A * U with two diagonal blocks in real Schur form with the elements below the first subdiagonal set to zero. The leading NDIM-by-NDIM block of A has eigenvalues in the domain of interest and the trailing (N-NDIM)-by-(N-NDIM) block has eigenvalues outside the domain of interest. The domain of interest for lambda(A), the eigenvalues of A, is defined by the parameters ALPHA, DICO and STDOM as follows: For a continuous-time system (DICO = 'C'): Real(lambda(A)) < ALPHA if STDOM = 'S'; Real(lambda(A)) > ALPHA if STDOM = 'U'; For a discrete-time system (DICO = 'D'): Abs(lambda(A)) < ALPHA if STDOM = 'S'; Abs(lambda(A)) > ALPHA if STDOM = 'U'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix inv(U) * B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix C * U. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). NDIM (output) INTEGER The number of eigenvalues of A lying inside the domain of interest for eigenvalues. U (output) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array contains the transformation matrix used to reduce A to the block- diagonal form. The first NDIM columns of U span the invariant subspace of A corresponding to the eigenvalues of its leading diagonal block. The last N-NDIM columns of U span the reducing subspace of A corresponding to the eigenvalues of the trailing diagonal block of A. LDU INTEGER The leading dimension of array U. LDU >= max(1,N). WR, WI (output) DOUBLE PRECISION arrays, dimension (N) WR and WI contain the real and imaginary parts, respectively, of the computed eigenvalues of A. The eigenvalues will be in the same order that they appear on the diagonal of the output real Schur form of A. Complex conjugate pairs of eigenvalues will appear consecutively with the eigenvalue having the positive imaginary part first.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LDWORK >= MAX(1,N) if JOBA = 'S'; LDWORK >= MAX(1,3*N) if JOBA = 'G'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the QR algorithm failed to compute all the eigenvalues of A; = 2: a failure occured during the ordering of the real Schur form of A; = 3: the separation of the two diagonal blocks failed because of very close eigenvalues.Method
A similarity transformation U is determined that reduces the system state-matrix A to a block-diagonal form (with two diagonal blocks), so that the leading diagonal block of the resulting A has eigenvalues in a specified domain of the complex plane. The determined transformation is applied to the system (A,B,C) as A <-- inv(U)*A*U, B <-- inv(U)*B and C <-- C*U.References
[1] Safonov, M.G., Jonckheere, E.A., Verma, M., Limebeer, D.J.N. Synthesis of positive real multivariable feedback systems. Int. J. Control, pp. 817-842, 1987.Numerical Aspects
3 The algorithm requires about 14N floating point operations.Further Comments
NoneExample
Program Text
* TB01KD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDU PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDU = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX ) * .. Local Scalars .. CHARACTER*1 DICO, JOBA, STDOM INTEGER I, INFO, J, M, N, NDIM, P DOUBLE PRECISION ALPHA * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), U(LDU,NMAX), WI(NMAX), WR(NMAX) * .. External Subroutines .. EXTERNAL TB01KD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, ALPHA, DICO, STDOM, JOBA IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed ssr for (A,B,C). CALL TB01KD( DICO, STDOM, JOBA, N, M, P, ALPHA, A, LDA, $ B, LDB, C, LDC, NDIM, U, LDU, WR, WI, DWORK, $ LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99987 ) NDIM WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99994 ) WR(I), WI(I) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( U(I,J), J = 1,N ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01KD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01KD = ',I2) 99997 FORMAT (/' The eigenvalues of state dynamics matrix A are ') 99996 FORMAT (/' The transformed state dynamics matrix inv(U)*A*U is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT ( ' (',F8.4,', ',F8.4,' )') 99993 FORMAT (/' The transformed input/state matrix inv(U)*B is ') 99992 FORMAT (/' The transformed state/output matrix C*U is ') 99991 FORMAT (/' The similarity transformation matrix U is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (' The number of eigenvalues in the domain of interest =', $ I5 ) ENDProgram Data
TB01KD EXAMPLE PROGRAM DATA (Continuous system) 5 2 3 -1.0 C U G -0.04165 4.9200 -4.9200 0 0 -1.387944 -3.3300 0 0 0 0.5450 0 0 -0.5450 0 0 0 4.9200 -0.04165 4.9200 0 0 0 -1.387944 -3.3300 0 0 3.3300 0 0 0 0 0 0 3.3300 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0Program Results
TB01KD EXAMPLE PROGRAM RESULTS The number of eigenvalues in the domain of interest = 2 The eigenvalues of state dynamics matrix A are ( -0.7483, 2.9940 ) ( -0.7483, -2.9940 ) ( -1.6858, 2.0311 ) ( -1.6858, -2.0311 ) ( -1.8751, 0.0000 ) The transformed state dynamics matrix inv(U)*A*U is -0.7483 -8.6406 0.0000 0.0000 0.0000 1.0374 -0.7483 0.0000 0.0000 0.0000 0.0000 0.0000 -1.6858 5.5669 0.0000 0.0000 0.0000 -0.7411 -1.6858 0.0000 0.0000 0.0000 0.0000 0.0000 -1.8751 The transformed input/state matrix inv(U)*B is 2.0240 -2.0240 -1.1309 1.1309 -0.8621 -0.8621 2.1912 2.1912 -1.5555 1.5555 The transformed state/output matrix C*U is 0.6864 -0.0987 0.6580 0.2589 0.9650 -0.0471 0.6873 0.0000 0.0000 -0.5609 -0.6864 0.0987 0.6580 0.2589 -0.9650 The similarity transformation matrix U is 0.6864 -0.0987 0.6580 0.2589 0.9650 -0.1665 -0.5041 -0.2589 0.6580 -0.9205 -0.0471 0.6873 0.0000 0.0000 -0.5609 -0.6864 0.0987 0.6580 0.2589 -0.9650 0.1665 0.5041 -0.2589 0.6580 0.9205
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01KX.html 0000664 0000000 0000000 00000013574 14560147231 0020375 0 ustar 00root root 0000000 0000000
Purpose
To compute an additive spectral decomposition of the transfer- function matrix of the system (A,B,C) by reducing the system state-matrix A to a block-diagonal form. It is assumed that A is in a real Schur form, and the leading diagonal block of order NDIM has eigenvalues distinct from those of the trailing diagonal block. The system matrices are transformed as A <-- V*A*U, B <--V*B and C <-- C*U, where V = inv(U), preserving the spectra of the two diagonal blocks.Specification
SUBROUTINE TB01KX( N, M, P, NDIM, A, LDA, B, LDB, C, LDC, U, LDU, $ V, LDV, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDU, LDV, M, N, NDIM, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), U(LDU,*), V(LDV,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs, or of columns of B. M >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. NDIM (input) INTEGER The dimension of the leading diagonal block of A having eigenvalues distinct from those of the trailing diagonal block. 0 <= NDIM <= N. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A in real Schur form. On exit, the leading N-by-N part of this array contains a block diagonal matrix inv(U) * A * U with two diagonal blocks in real Schur form, with the elements below the first subdiagonal set to zero. The leading block has dimension NDIM-by-NDIM. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix inv(U) * B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix C * U. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). U (input/output) DOUBLE PRECISION array, dimension (LDU,N) On entry, the leading N-by-N part of this array must contain an initial transformation matrix U. On exit, the leading N-by-N part of this array contains the transformation matrix used to reduce A to the block- diagonal form. The first NDIM columns of U span the invariant subspace of A corresponding to the eigenvalues of its leading diagonal block. The last N-NDIM columns of U span the reducing subspace of A corresponding to the eigenvalues of the trailing diagonal block of A. LDU INTEGER The leading dimension of the array U. LDU >= max(1,N). V (output) DOUBLE PRECISION array, dimension (LDV,N) The leading N-by-N part of this array contains the inverse of the transformation matrix U used to reduce A to the block-diagonal form. LDV INTEGER The leading dimension of the array V. LDV >= max(1,N).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the separation of the two diagonal blocks failed because of very close eigenvalues.Method
A similarity transformation U is determined that reduces the given system state-matrix A to a block-diagonal form (with two diagonal blocks), so that the eigenvalues of the leading diagonal block of the resulting A are preserved. The determined transformation is applied to the system (A,B,C) as A <-- inv(U)*A*U, B <-- inv(U)*B and C <-- C*U.References
[1] Safonov, M.G., Jonckheere, E.A., Verma, M., Limebeer, D.J.N. Synthesis of positive real multivariable feedback systems. Int. J. Control, pp. 817-842, 1987.Numerical Aspects
3 The algorithm requires about N /2 + NDIM*(N-NDIM)*(2*N+M+P) floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce the system state matrix A to an ordered upper real Schur form by using an orthogonal similarity transformation A <-- U'*A*U and to apply the transformation to the matrices B and C: B <-- U'*B and C <-- C*U. The leading block of the resulting A has eigenvalues in a suitably defined domain of interest.Specification
SUBROUTINE TB01LD( DICO, STDOM, JOBA, N, M, P, ALPHA, A, LDA, B, $ LDB, C, LDC, NDIM, U, LDU, WR, WI, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBA, STDOM INTEGER INFO, LDA, LDB, LDC, LDU, LDWORK, M, N, NDIM, P DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), U(LDU,*), $ WI(*), WR(*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the system as follows: = 'C': continuous-time system; = 'D': discrete-time system. STDOM CHARACTER*1 Specifies whether the domain of interest is of stability type (left part of complex plane or inside of a circle) or of instability type (right part of complex plane or outside of a circle) as follows: = 'S': stability type domain; = 'U': instability type domain. JOBA CHARACTER*1 Specifies the shape of the state dynamics matrix on entry as follows: = 'S': A is in an upper real Schur form; = 'G': A is a general square dense matrix.Input/Output Parameters
N (input) INTEGER The order of the state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs, or of columns of B. M >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. ALPHA (input) DOUBLE PRECISION. Specifies the boundary of the domain of interest for the eigenvalues of A. For a continuous-time system (DICO = 'C'), ALPHA is the boundary value for the real parts of eigenvalues, while for a discrete-time system (DICO = 'D'), ALPHA >= 0 represents the boundary value for the moduli of eigenvalues. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the unreduced state dynamics matrix A. If JOBA = 'S' then A must be a matrix in real Schur form. On exit, the leading N-by-N part of this array contains the ordered real Schur matrix U' * A * U with the elements below the first subdiagonal set to zero. The leading NDIM-by-NDIM part of A has eigenvalues in the domain of interest and the trailing (N-NDIM)-by-(N-NDIM) part has eigenvalues outside the domain of interest. The domain of interest for lambda(A), the eigenvalues of A, is defined by the parameters ALPHA, DICO and STDOM as follows: For a continuous-time system (DICO = 'C'): Real(lambda(A)) < ALPHA if STDOM = 'S'; Real(lambda(A)) > ALPHA if STDOM = 'U'; For a discrete-time system (DICO = 'D'): Abs(lambda(A)) < ALPHA if STDOM = 'S'; Abs(lambda(A)) > ALPHA if STDOM = 'U'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix U' * B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix C * U. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). NDIM (output) INTEGER The number of eigenvalues of A lying inside the domain of interest for eigenvalues. U (output) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array contains the orthogonal transformation matrix used to reduce A to the real Schur form and/or to reorder the diagonal blocks of real Schur form of A. The first NDIM columns of U form an orthogonal basis for the invariant subspace of A corresponding to the first NDIM eigenvalues. LDU INTEGER The leading dimension of array U. LDU >= max(1,N). WR, WI (output) DOUBLE PRECISION arrays, dimension (N) WR and WI contain the real and imaginary parts, respectively, of the computed eigenvalues of A. The eigenvalues will be in the same order that they appear on the diagonal of the output real Schur form of A. Complex conjugate pairs of eigenvalues will appear consecutively with the eigenvalue having the positive imaginary part first.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LDWORK >= MAX(1,N) if JOBA = 'S'; LDWORK >= MAX(1,3*N) if JOBA = 'G'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the QR algorithm failed to compute all the eigenvalues of A; = 2: a failure occured during the ordering of the real Schur form of A.Method
Matrix A is reduced to an ordered upper real Schur form using an orthogonal similarity transformation A <-- U'*A*U. This transformation is determined so that the leading block of the resulting A has eigenvalues in a suitably defined domain of interest. Then, the transformation is applied to the matrices B and C: B <-- U'*B and C <-- C*U.Numerical Aspects
3 The algorithm requires about 14N floating point operations.Further Comments
NoneExample
Program Text
* TB01LD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDU PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDU = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX ) * .. Local Scalars .. CHARACTER*1 DICO, JOBA, STDOM INTEGER I, INFO, J, M, N, NDIM, P DOUBLE PRECISION ALPHA * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), U(LDU,NMAX), WI(NMAX), WR(NMAX) * .. External Subroutines .. EXTERNAL TB01LD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, ALPHA, DICO, STDOM, JOBA IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed ssr for (A,B,C). CALL TB01LD( DICO, STDOM, JOBA, N, M, P, ALPHA, $ A, LDA, B, LDB, C, LDC, NDIM, U, LDU, $ WR, WI, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99987 ) NDIM WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99994 ) WR(I), WI(I) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( U(I,J), J = 1,N ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01LD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01LD = ',I2) 99997 FORMAT (/' The eigenvalues of state dynamics matrix A are ') 99996 FORMAT (/' The transformed state dynamics matrix U''*A*U is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT ( ' (',F8.4,', ',F8.4,' )') 99993 FORMAT (/' The transformed input/state matrix U''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*U is ') 99991 FORMAT (/' The similarity transformation matrix U is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The number of eigenvalues in the domain of interest =', $ I5 ) ENDProgram Data
TB01LD EXAMPLE PROGRAM DATA (Continuous system) 5 2 3 -1.0 C U G -0.04165 4.9200 -4.9200 0 0 -1.387944 -3.3300 0 0 0 0.5450 0 0 -0.5450 0 0 0 4.9200 -0.04165 4.9200 0 0 0 -1.387944 -3.3300 0 0 3.3300 0 0 0 0 0 0 3.3300 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0Program Results
TB01LD EXAMPLE PROGRAM RESULTS The number of eigenvalues in the domain of interest = 2 The eigenvalues of state dynamics matrix A are ( -0.7483, 2.9940 ) ( -0.7483, -2.9940 ) ( -1.6858, 2.0311 ) ( -1.6858, -2.0311 ) ( -1.8751, 0.0000 ) The transformed state dynamics matrix U'*A*U is -0.7483 -8.6406 0.0000 0.0000 1.1745 1.0374 -0.7483 0.0000 0.0000 -2.1164 0.0000 0.0000 -1.6858 5.5669 0.0000 0.0000 0.0000 -0.7411 -1.6858 0.0000 0.0000 0.0000 0.0000 0.0000 -1.8751 The transformed input/state matrix U'*B is -0.5543 0.5543 -1.6786 1.6786 -0.8621 -0.8621 2.1912 2.1912 -1.5555 1.5555 The transformed state/output matrix C*U is 0.6864 -0.0987 0.6580 0.2589 -0.1381 -0.0471 0.6873 0.0000 0.0000 -0.7249 -0.6864 0.0987 0.6580 0.2589 0.1381 The similarity transformation matrix U is 0.6864 -0.0987 0.6580 0.2589 -0.1381 -0.1665 -0.5041 -0.2589 0.6580 -0.4671 -0.0471 0.6873 0.0000 0.0000 -0.7249 -0.6864 0.0987 0.6580 0.2589 0.1381 0.1665 0.5041 -0.2589 0.6580 0.4671
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01MD.html 0000664 0000000 0000000 00000024426 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To reduce the pair (B,A) to upper or lower controller Hessenberg form using (and optionally accumulating) unitary state-space transformations.Specification
SUBROUTINE TB01MD( JOBU, UPLO, N, M, A, LDA, B, LDB, U, LDU, $ DWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBU, UPLO INTEGER INFO, LDA, LDB, LDU, M, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), DWORK(*), U(LDU,*)Arguments
Mode Parameters
JOBU CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix U the unitary state-space transformations for reducing the system, as follows: = 'N': Do not form U; = 'I': U is initialized to the unit matrix and the unitary transformation matrix U is returned; = 'U': The given matrix U is updated by the unitary transformations used in the reduction. UPLO CHARACTER*1 Indicates whether the user wishes the pair (B,A) to be reduced to upper or lower controller Hessenberg form as follows: = 'U': Upper controller Hessenberg form; = 'L': Lower controller Hessenberg form.Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The actual input dimension, i.e. the number of columns of the matrix B. M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state transition matrix A to be transformed. On exit, the leading N-by-N part of this array contains the transformed state transition matrix U' * A * U. The annihilated elements are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B to be transformed. On exit, the leading N-by-M part of this array contains the transformed input matrix U' * B. The annihilated elements are set to zero. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). U (input/output) DOUBLE PRECISION array, dimension (LDU,*) On entry, if JOBU = 'U', then the leading N-by-N part of this array must contain a given matrix U (e.g. from a previous call to another SLICOT routine), and on exit, the leading N-by-N part of this array contains the product of the input matrix U and the state-space transformation matrix which reduces the given pair to controller Hessenberg form. On exit, if JOBU = 'I', then the leading N-by-N part of this array contains the matrix of accumulated unitary similarity transformations which reduces the given pair to controller Hessenberg form. If JOBU = 'N', the array U is not referenced and can be supplied as a dummy array (i.e. set parameter LDU = 1 and declare this array to be U(1,1) in the calling program). LDU INTEGER The leading dimension of array U. If JOBU = 'U' or JOBU = 'I', LDU >= MAX(1,N); if JOBU = 'N', LDU >= 1.Workspace
DWORK DOUBLE PRECISION array, dimension (MAX(N,M-1))Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes a unitary state-space transformation U, which reduces the pair (B,A) to one of the following controller Hessenberg forms: |* . . . *|* . . . . . . *| | . .|. .| | . .|. .| | . .|. .| [U'B|U'AU] = | *|. .| N | |* .| | | . .| | | . .| | | . .| | | * . . *| M N if UPLO = 'U', or |* . . * | | |. . | | |. . | | |. . | | [U'AU|U'B] = |. *| | N |. .|* | |. .|. . | |. .|. . | |. .|. . | |* . . . . . . *|* . . . *| N M if UPLO = 'L'. If M >= N, then the matrix U'B is trapezoidal and U'AU is full. If M = 0, but N > 0, the array A is unchanged on exit.References
[1] Van Dooren, P. and Verhaegen, M.H.G. On the use of unitary state-space transformations. In : Contemporary Mathematics on Linear Algebra and its Role in Systems Theory, 47, AMS, Providence, 1985.Numerical Aspects
The algorithm requires O((N + M) x N**2) operations and is backward stable (see [1]).Further Comments
NoneExample
Program Text
* TB01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX PARAMETER ( NMAX = 20, MMAX = 20 ) INTEGER LDA, LDB, LDU, LDWORK PARAMETER ( LDA = NMAX, LDB = NMAX, LDU = NMAX, $ LDWORK = NMAX ) * .. Local Scalars .. INTEGER I, INFO, J, M, N CHARACTER*1 JOBU, UPLO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), U(LDU,NMAX), $ DWORK(LDWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TB01MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, JOBU, UPLO IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), I = 1,N ), J = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99992 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( LSAME( JOBU, 'U' ) ) $ READ ( NIN, FMT = * ) ( ( U(I,J), J = 1,N ), I = 1,N ) * Reduce the pair (B,A) to controller Hessenberg form. CALL TB01MD( JOBU, UPLO, N, M, A, LDA, B, LDB, U, LDU, $ DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( A(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 80 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,M ) 80 CONTINUE IF ( LSAME( JOBU, 'I' ).OR.LSAME( JOBU, 'U' ) ) THEN WRITE ( NOUT, FMT = 99994 ) DO 100 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( U(I,J), J = 1,N ) 100 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01MD = ',I2) 99997 FORMAT (' The transformed state transition matrix is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The transformed input matrix is ') 99994 FORMAT (/' The transformation matrix that reduces (B,A) to contr', $ 'oller Hessenberg form is ') 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
TB01MD EXAMPLE PROGRAM DATA 6 3 N U 35.0 1.0 6.0 26.0 19.0 24.0 3.0 32.0 7.0 21.0 23.0 25.0 31.0 9.0 2.0 22.0 27.0 20.0 8.0 28.0 33.0 17.0 10.0 15.0 30.0 5.0 34.0 12.0 14.0 16.0 4.0 36.0 29.0 13.0 18.0 11.0 1.0 5.0 11.0 -1.0 4.0 11.0 -5.0 1.0 9.0 -11.0 -4.0 5.0 -19.0 -11.0 -1.0 -29.0 -20.0 -9.0Program Results
TB01MD EXAMPLE PROGRAM RESULTS The transformed state transition matrix is 60.3649 58.8853 5.0480 -5.4406 2.1382 -7.3870 54.5832 33.1865 36.5234 6.3272 -3.1377 8.8154 17.6406 21.4501 -13.5942 0.5417 1.6926 0.0786 -9.0567 10.7202 0.3531 1.5444 -1.2846 24.6407 0.0000 6.8796 -20.1372 -2.6440 2.4983 -21.8071 0.0000 0.0000 0.0000 0.0000 0.0000 27.0000 The transformed input matrix is -16.8819 -8.8260 13.9202 0.0000 13.8240 39.9205 0.0000 0.0000 4.1928 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01ND.html 0000664 0000000 0000000 00000024122 14560147231 0020343 0 ustar 00root root 0000000 0000000
Purpose
To reduce the pair (A,C) to lower or upper observer Hessenberg form using (and optionally accumulating) unitary state-space transformations.Specification
SUBROUTINE TB01ND( JOBU, UPLO, N, P, A, LDA, C, LDC, U, LDU, $ DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDC, LDU, N, P CHARACTER JOBU, UPLO C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), C(LDC,*), DWORK(*), U(LDU,*)Arguments
Mode Parameters
JOBU CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix U the unitary state-space transformations for reducing the system, as follows: = 'N': Do not form U; = 'I': U is initialized to the unit matrix and the unitary transformation matrix U is returned; = 'U': The given matrix U is updated by the unitary transformations used in the reduction. UPLO CHARACTER*1 Indicates whether the user wishes the pair (A,C) to be reduced to upper or lower observer Hessenberg form as follows: = 'U': Upper observer Hessenberg form; = 'L': Lower observer Hessenberg form.Input/Output Parameters
N (input) INTEGER The actual state dimension, i.e. the order of the matrix A. N >= 0. P (input) INTEGER The actual output dimension, i.e. the number of rows of the matrix C. 0 <= P <= N. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state transition matrix A to be transformed. On exit, the leading N-by-N part of this array contains the transformed state transition matrix U' * A * U. The annihilated elements are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C to be transformed. On exit, the leading P-by-N part of this array contains the transformed output matrix C * U. The annihilated elements are set to zero. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). U (input/output) DOUBLE PRECISION array, dimension (LDU,*) On entry, if JOBU = 'U', then the leading N-by-N part of this array must contain a given matrix U (e.g. from a previous call to another SLICOT routine), and on exit, the leading N-by-N part of this array contains the product of the input matrix U and the state-space transformation matrix which reduces the given pair to observer Hessenberg form. On exit, if JOBU = 'I', then the leading N-by-N part of this array contains the matrix of accumulated unitary similarity transformations which reduces the given pair to observer Hessenberg form. If JOBU = 'N', the array U is not referenced and can be supplied as a dummy array (i.e. set parameter LDU = 1 and declare this array to be U(1,1) in the calling program). LDU INTEGER The leading dimension of array U. If JOBU = 'U' or JOBU = 'I', LDU >= MAX(1,N); if JOBU = 'N', LDU >= 1.Workspace
DWORK DOUBLE PRECISION array, dimension (MAX(N,P-1))Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes a unitary state-space transformation U, which reduces the pair (A,C) to one of the following observer Hessenberg forms: N |* . . . . . . *| |. .| |. .| |. .| N |* .| |U'AU| | . .| |----| = | . .| |CU | | * . . . *| ------------------- | * . . *| | . .| P | . .| | *| if UPLO = 'U', or N |* | |. . | |. . | P |* . . * | |CU | ------------------- |----| = |* . . . * | |U'AU| |. . | |. . | |. *| |. .| N |. .| |. .| |* . . . . . . *| if UPLO = 'L'. If P >= N, then the matrix CU is trapezoidal and U'AU is full. If P = 0, but N > 0, the array A is unchanged on exit.References
[1] Van Dooren, P. and Verhaegen, M.H.G. On the use of unitary state-space transformations. In : Contemporary Mathematics on Linear Algebra and its Role in Systems Theory, 47, AMS, Providence, 1985.Numerical Aspects
The algorithm requires O((N + P) x N**2) operations and is backward stable (see [1]).Further Comments
NoneExample
Program Text
* TB01ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, PMAX PARAMETER ( NMAX = 20, PMAX = 20 ) INTEGER LDA, LDC, LDU, LDWORK PARAMETER ( LDA = NMAX, LDC = PMAX, LDU = NMAX, $ LDWORK = NMAX ) * .. Local Scalars .. INTEGER I, INFO, J, N, P CHARACTER*1 JOBU, UPLO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), C(LDC,NMAX), U(LDU,NMAX), $ DWORK(LDWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TB01ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, P, JOBU, UPLO IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99993 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), I = 1,N ), J = 1,N ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99992 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) IF ( LSAME( JOBU, 'U' ) ) $ READ ( NIN, FMT = * ) ( ( U(I,J), J = 1,N ), I = 1,N ) * Reduce the pair (A,C) to observer Hessenberg form. CALL TB01ND( JOBU, UPLO, N, P, A, LDA, C, LDC, U, LDU, $ DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( A(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,N ) 80 CONTINUE IF ( LSAME( JOBU, 'I' ).OR.LSAME( JOBU, 'U' ) ) THEN WRITE ( NOUT, FMT = 99994 ) DO 100 I = 1, N WRITE ( NOUT, FMT = 99996 ) ( U(I,J), J = 1,N ) 100 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01ND = ',I2) 99997 FORMAT (' The transformed state transition matrix is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The transformed output matrix is ') 99994 FORMAT (/' The transformation matrix that reduces (A,C) to obser', $ 'ver Hessenberg form is ') 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB01ND EXAMPLE PROGRAM DATA 5 3 N U 15.0 21.0 -3.0 3.0 9.0 20.0 1.0 2.0 8.0 9.0 4.0 1.0 7.0 13.0 14.0 5.0 6.0 12.0 13.0 -6.0 5.0 11.0 17.0 -7.0 -1.0 7.0 -1.0 3.0 -6.0 -3.0 4.0 5.0 6.0 -2.0 -3.0 9.0 8.0 5.0 2.0 1.0Program Results
TB01ND EXAMPLE PROGRAM RESULTS The transformed state transition matrix is 7.1637 -0.9691 -16.5046 0.2869 0.9205 -2.3285 11.5431 -8.7471 3.4122 -3.7118 -10.5440 -7.6032 -0.3215 3.6571 -0.4335 -3.6845 5.6449 0.5906 -15.6996 17.4267 0.0000 -6.4260 1.5591 14.4317 32.3143 The transformed output matrix is 0.0000 0.0000 7.6585 5.2973 -4.1576 0.0000 0.0000 0.0000 5.8305 -7.4837 0.0000 0.0000 0.0000 0.0000 -13.2288
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01PD.html 0000664 0000000 0000000 00000027151 14560147231 0020352 0 ustar 00root root 0000000 0000000
Purpose
To find a reduced (controllable, observable, or minimal) state- space representation (Ar,Br,Cr) for any original state-space representation (A,B,C). The matrix Ar is in upper block Hessenberg form.Specification
SUBROUTINE TB01PD( JOB, EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, $ NR, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL, JOB INTEGER INFO, LDA, LDB, LDC, LDWORK, M, N, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*)Arguments
Mode Parameters
JOB CHARACTER*1 Indicates whether the user wishes to remove the uncontrollable and/or unobservable parts as follows: = 'M': Remove both the uncontrollable and unobservable parts to get a minimal state-space representation; = 'C': Remove the uncontrollable part only to get a controllable state-space representation; = 'O': Remove the unobservable part only to get an observable state-space representation. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily balance the triplet (A,B,C) as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading NR-by-NR part of this array contains the upper block Hessenberg state dynamics matrix Ar of a minimal, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'M', JOB = 'C', or JOB = 'O', respectively. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M), if JOB = 'C', or (LDB,MAX(M,P)), otherwise. On entry, the leading N-by-M part of this array must contain the original input/state matrix B; if JOB = 'M', or JOB = 'O', the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. On exit, the leading NR-by-M part of this array contains the transformed input/state matrix Br of a minimal, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'M', JOB = 'C', or JOB = 'O', respectively. If JOB = 'C', only the first IWORK(1) rows of B are nonzero. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C; if JOB = 'M', or JOB = 'O', the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. On exit, the leading P-by-NR part of this array contains the transformed state/output matrix Cr of a minimal, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'M', JOB = 'C', or JOB = 'O', respectively. If JOB = 'M', or JOB = 'O', only the last IWORK(1) columns (in the first NR columns) of C are nonzero. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P) if N > 0. LDC >= 1 if N = 0. NR (output) INTEGER The order of the reduced state-space representation (Ar,Br,Cr) of a minimal, controllable, or observable realization for the original system, depending on JOB = 'M', JOB = 'C', or JOB = 'O'.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determination when transforming (A, B, C). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance (determined by the SLICOT routine TB01UD) is used instead.Workspace
IWORK INTEGER array, dimension (N+MAX(M,P)) On exit, if INFO = 0, the first nonzero elements of IWORK(1:N) return the orders of the diagonal blocks of A. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N + MAX(N, 3*M, 3*P)). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
If JOB = 'M', the matrices A and B are operated on by orthogonal similarity transformations (made up of products of Householder transformations) so as to produce an upper block Hessenberg matrix A1 and a matrix B1 with all but its first rank(B) rows zero; this separates out the controllable part of the original system. Applying the same algorithm to the dual of this subsystem, therefore separates out the controllable and observable (i.e. minimal) part of the original system representation, with the final Ar upper block Hessenberg (after using pertransposition). If JOB = 'C', or JOB = 'O', only the corresponding part of the above procedure is applied.References
[1] Van Dooren, P. The Generalized Eigenstructure Problem in Linear System Theory. (Algorithm 1) IEEE Trans. Auto. Contr., AC-26, pp. 111-129, 1981.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
NoneExample
Program Text
* TB01PD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = MAXMP ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX+MAXMP ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX+MAX( NMAX, 3*MAXMP ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N, NR, P CHARACTER JOB, EQUIL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAXMP), C(LDC,NMAX), $ DWORK(LDWORK) INTEGER IWORK(LIWORK) * .. External Subroutines .. EXTERNAL TB01PD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, JOB, EQUIL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find a minimal ssr for (A,B,C). CALL TB01PD( JOB, EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, $ NR, TOL, IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01PD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01PD = ',I2) 99997 FORMAT (' The order of the minimal realization = ',I2) 99996 FORMAT (/' The transformed state dynamics matrix of a minimal re', $ 'alization is ') 99995 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' The transformed input/state matrix of a minimal reali', $ 'zation is ') 99992 FORMAT (/' The transformed state/output matrix of a minimal real', $ 'ization is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB01PD EXAMPLE PROGRAM DATA 3 1 2 0.0 M N 1.0 2.0 0.0 4.0 -1.0 0.0 0.0 0.0 1.0 1.0 0.0 1.0 0.0 1.0 -1.0 0.0 0.0 1.0Program Results
TB01PD EXAMPLE PROGRAM RESULTS The order of the minimal realization = 3 The transformed state dynamics matrix of a minimal realization is 1.0000 -1.4142 1.4142 -2.8284 0.0000 1.0000 2.8284 1.0000 0.0000 The transformed input/state matrix of a minimal realization is -1.0000 0.7071 0.7071 The transformed state/output matrix of a minimal realization is 0.0000 0.0000 -1.4142 0.0000 0.7071 0.7071
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01PX.html 0000664 0000000 0000000 00000034230 14560147231 0020372 0 ustar 00root root 0000000 0000000
Purpose
To find a reduced (controllable, observable, or minimal) state- space representation (Ar,Br,Cr) for any original state-space representation (A,B,C). The matrix Ar is in an upper block Hessenberg staircase form.Specification
SUBROUTINE TB01PX( JOB, EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, $ NR, INFRED, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL, JOB INTEGER INFO, LDA, LDB, LDC, LDWORK, M, N, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INFRED(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*)Arguments
Mode Parameters
JOB CHARACTER*1 Indicates whether the user wishes to remove the uncontrollable and/or unobservable parts as follows: = 'M': Remove both the uncontrollable and unobservable parts to get a minimal state-space representation; = 'C': Remove the uncontrollable part only to get a controllable state-space representation; = 'O': Remove the unobservable part only to get an observable state-space representation. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily balance the triplet (A,B,C) as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, if INFRED(1) >= 0 and/or INFRED(2) >= 0, the leading NR-by-NR part of this array contains the upper block Hessenberg state dynamics matrix Ar of a minimal, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'M', JOB = 'C', or JOB = 'O', respectively. The block structure of the resulting staircase form is contained in the leading INFRED(4) elements of IWORK. If INFRED(1:2) < 0, then A contains the original matrix. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M), if JOB = 'C', or (LDB,MAX(M,P)), otherwise. On entry, the leading N-by-M part of this array must contain the original input/state matrix B; if JOB = 'M', or JOB = 'O', the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. On exit, if INFRED(1) >= 0 and/or INFRED(2) >= 0, the leading NR-by-M part of this array contains the input/state matrix Br of a minimal, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'M', JOB = 'C', or JOB = 'O', respectively. If JOB = 'C', only the first IWORK(1) rows of B are nonzero. If INFRED(1:2) < 0, then B contains the original matrix. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C; if JOB = 'M', or JOB = 'O', the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. On exit, if INFRED(1) >= 0 and/or INFRED(2) >= 0, the leading P-by-NR part of this array contains the state/output matrix Cr of a minimal, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'M', JOB = 'C', or JOB = 'O', respectively. If JOB = 'M', or JOB = 'O', only the last IWORK(1) columns (in the first NR columns) of C are nonzero. If INFRED(1:2) < 0, then C contains the original matrix. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M,P), if N > 0. LDC >= 1, if N = 0. NR (output) INTEGER The order of the reduced state-space representation (Ar,Br,Cr) of a minimal, controllable, or observable realization for the original system, depending on JOB = 'M', JOB = 'C', or JOB = 'O'. INFRED (output) INTEGER array, dimension 4 This array contains information on the performed reduction and on structure of resulting system matrices, as follows: INFRED(k) >= 0 (k = 1 or 2) if Phase k of the reduction (see METHOD) has been performed. In this case, INFRED(k) is the achieved order reduction in Phase k. INFRED(k) < 0 (k = 1 or 2) if Phase k was not performed. This can also appear when Phase k was tried, but did not reduce the order, if enough workspace is provided for saving the system matrices (see LDWORK description). INFRED(3) - the number of nonzero subdiagonals of A. INFRED(4) - the number of blocks in the resulting staircase form at the last performed reduction phase. The block dimensions are contained in the first INFRED(4) elements of IWORK.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming (A, B, C). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance (determined by the SLICOT routine TB01UD) is used instead.Workspace
IWORK INTEGER array, dimension (c*N+MAX(M,P)), where c = 2, if JOB = 'M', and c = 1, otherwise. On exit, if INFO = 0, the first INFRED(4) elements of IWORK return the orders of the diagonal blocks of A. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, and if N > 0, LDWORK >= N + MAX(N, 3*M, 3*P). For optimum performance LDWORK should be larger. If LDWORK >= MAX(1, N + MAX(N, 3*M, 3*P) + N*(N+M+P) ), then more accurate results are to be expected by accepting only those reductions phases (see METHOD), where effective order reduction occurs. This is achieved by saving the system matrices before each phase and restoring them if no order reduction took place in that phase.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The order reduction is performed in two phases: Phase 1: If JOB = 'M' or 'C', the pair (A,B) is reduced by orthogonal similarity transformations to the controllability staircase form (see [1]) and a controllable realization (Ac,Bc,Cc) is extracted. Ac results in an upper block Hessenberg form. Phase 2: If JOB = 'M' or 'O', the same algorithm is applied to the dual of the controllable realization (Ac,Bc,Cc), or to the dual of the original system, respectively, to extract an observable realization (Ar,Br,Cr). If JOB = 'M', the resulting realization is also controllable, and thus minimal. Ar results in an upper block Hessenberg form.References
[1] Van Dooren, P. The Generalized Eigenstructure Problem in Linear System Theory. (Algorithm 1) IEEE Trans. Auto. Contr., AC-26, pp. 111-129, 1981.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
NoneExample
Program Text
* TB01PX EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = MAXMP ) INTEGER LIWORK PARAMETER ( LIWORK = 2*NMAX+MAXMP ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX+MAX( NMAX, 3*MAXMP + $ NMAX*( NMAX+MMAX+PMAX ) ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, M, N, NR, P CHARACTER JOB, EQUIL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAXMP), C(LDC,NMAX), $ DWORK(LDWORK) INTEGER INFRED(4), IWORK(LIWORK) * .. External Subroutines .. EXTERNAL TB01PX * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, JOB, EQUIL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find a minimal ssr for (A,B,C). CALL TB01PX( JOB, EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, $ NR, INFRED, TOL, IWORK, DWORK, LDWORK, INFO) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 60 CONTINUE WRITE ( NOUT, FMT = 99994 ) ( INFRED(I), I = 1,4 ) IF ( INFRED(4).GT.0 ) $ WRITE ( NOUT, FMT = 99991 ) ( IWORK(I), $ I = 1,INFRED(4) ) END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01PX EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01PX = ',I2) 99997 FORMAT (' The order of the minimal realization = ',I2) 99996 FORMAT (/' The transformed state dynamics matrix of a minimal re', $ 'alization is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' Information on the performed reduction is ', 4I5) 99993 FORMAT (/' The transformed input/state matrix of a minimal reali', $ 'zation is ') 99992 FORMAT (/' The transformed state/output matrix of a minimal real', $ 'ization is ') 99991 FORMAT (/' The block dimensions are ',/ 20I5) 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB01PX EXAMPLE PROGRAM DATA 3 1 2 0.0 M N 1.0 2.0 0.0 4.0 -1.0 0.0 0.0 0.0 1.0 1.0 0.0 1.0 0.0 1.0 -1.0 0.0 0.0 1.0Program Results
TB01PX EXAMPLE PROGRAM RESULTS The order of the minimal realization = 3 The transformed state dynamics matrix of a minimal realization is 1.0000 2.0000 0.0000 4.0000 -1.0000 0.0000 0.0000 0.0000 1.0000 The transformed input/state matrix of a minimal realization is 1.0000 0.0000 1.0000 The transformed state/output matrix of a minimal realization is 0.0000 1.0000 -1.0000 0.0000 0.0000 1.0000 Information on the performed reduction is -1 -1 2 0
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01TD.html 0000664 0000000 0000000 00000026205 14560147231 0020355 0 ustar 00root root 0000000 0000000
Purpose
To reduce a given state-space representation (A,B,C,D) to balanced form by means of state permutations and state, input and output scalings.Specification
SUBROUTINE TB01TD( N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, LOW, $ IGH, SCSTAT, SCIN, SCOUT, DWORK, INFO ) C .. Scalar Arguments .. INTEGER IGH, INFO, LDA, LDB, LDC, LDD, LOW, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), SCIN(*), SCOUT(*), SCSTAT(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the state-space representation, i.e. the order of the original state dynamics matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading N-by-N part of this array contains the balanced state dynamics matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, the leading N-by-M part of this array contains the balanced input/state matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, the leading P-by-N part of this array contains the balanced state/output matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original direct transmission matrix D. On exit, the leading P-by-M part of this array contains the scaled direct transmission matrix D. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). LOW (output) INTEGER The index of the lower end of the balanced submatrix of A. IGH (output) INTEGER The index of the upper end of the balanced submatrix of A. SCSTAT (output) DOUBLE PRECISION array, dimension (N) This array contains the information defining the similarity transformations used to permute and balance the state dynamics matrix A, as returned from the LAPACK library routine DGEBAL. SCIN (output) DOUBLE PRECISION array, dimension (M) Contains the scalars used to scale the system inputs so that the columns of the final matrix B have norms roughly equal to the column sums of the balanced matrix A (see FURTHER COMMENTS). The j-th input of the balanced state-space representation is SCIN(j)*(j-th column of the permuted and balanced input/state matrix B). SCOUT (output) DOUBLE PRECISION array, dimension (P) Contains the scalars used to scale the system outputs so that the rows of the final matrix C have norms roughly equal to the row sum of the balanced matrix A. The i-th output of the balanced state-space representation is SCOUT(i)*(i-th row of the permuted and balanced state/ouput matrix C).Workspace
DWORK DOUBLE PRECISION array, dimension (N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Similarity transformations are used to permute the system states and balance the corresponding row and column sum norms of a submatrix of the state dynamics matrix A. These operations are also applied to the input/state matrix B and the system inputs are then scaled (see parameter SCIN) so that the columns of the final matrix B have norms roughly equal to the column sum norm of the balanced matrix A (see FURTHER COMMENTS). The above operations are also applied to the matrix C, and the system outputs are then scaled (see parameter SCOUT) so that the rows of the final matrix C have norms roughly equal to the row sum norm of the balanced matrix A (see FURTHER COMMENTS). Finally, the (I,J)-th element of the direct transmission matrix D is scaled as D(I,J) = D(I,J)*(1.0/SCIN(J))*SCOUT(I), where I = 1,2,...,P and J = 1,2,...,M. Scaling performed to balance the row/column sum norms is by integer powers of the machine base so as to avoid introducing rounding errors.References
[1] Wilkinson, J.H. and Reinsch, C. Handbook for Automatic Computation, (Vol II, Linear Algebra). Springer-Verlag, 1971, (contribution II/11).Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
The columns (rows) of the final matrix B (matrix C) have norms 'roughly' equal to the column (row) sum norm of the balanced matrix A, i.e. size/BASE < abssum <= size where BASE = the base of the arithmetic used on the computer, which can be obtained from the LAPACK Library routine DLAMCH; size = column or row sum norm of the balanced matrix A; abssum = column sum norm of the balanced matrix B or row sum norm of the balanced matrix C. The routine is BASE dependent.Example
Program Text
* TB01TD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX ) * .. Local Scalars .. INTEGER I, INFO, IGH, J, LOW, M, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(NMAX), SCIN(MMAX), $ SCOUT(PMAX), SCSTAT(NMAX) * .. External Subroutines .. EXTERNAL TB01TD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99990 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99989 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Balance the state-space representation (A,B,C,D). CALL TB01TD( N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, $ LOW, IGH, SCSTAT, SCIN, SCOUT, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) LOW, IGH WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 80 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01TD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01TD = ',I2) 99997 FORMAT (' LOW = ',I2,' IGH = ',I2,/) 99996 FORMAT (' The balanced state dynamics matrix A is ') 99995 FORMAT (20(1X,F9.4)) 99994 FORMAT (/' The balanced input/state matrix B is ') 99993 FORMAT (/' The balanced state/output matrix C is ') 99992 FORMAT (/' The scaled direct transmission matrix D is ') 99991 FORMAT (/' N is out of range.',/' N = ',I5) 99990 FORMAT (/' M is out of range.',/' M = ',I5) 99989 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB01TD EXAMPLE PROGRAM DATA 5 2 2 0.0 0.0 1.0 4.0 5.0 50.0 10.0 1.0 0.0 0.0 0.0 0.0 90.0 10.0 0.0 0.0 1.0 1.0 1.0 1.0 100.0 0.0 0.0 0.0 70.0 0.0 2.0 0.0 1.0 2.0 0.0 20.0 100.0 1.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 2.0 1.0 1.0 1.0 1.0 1.0Program Results
TB01TD EXAMPLE PROGRAM RESULTS LOW = 1 IGH = 5 The balanced state dynamics matrix A is 0.0000 0.0000 1.0000 4.0000 40.0000 6.2500 10.0000 0.1250 0.0000 0.0000 0.0000 0.0000 90.0000 10.0000 0.0000 0.0000 8.0000 1.0000 1.0000 8.0000 12.5000 0.0000 0.0000 0.0000 70.0000 The balanced input/state matrix B is 0.0000 0.0000 16.0000 2.5000 0.0000 100.0000 64.0000 1.0000 16.0000 0.0000 The balanced state/output matrix C is 32.0000 0.0000 0.0000 32.0000 0.0000 4.0000 32.0000 0.0000 8.0000 32.0000 The scaled direct transmission matrix D is 2048.0000 32.0000 256.0000 4.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01UD.html 0000664 0000000 0000000 00000035760 14560147231 0020364 0 ustar 00root root 0000000 0000000
Purpose
To find a controllable realization for the linear time-invariant multi-input system dX/dt = A * X + B * U, Y = C * X, where A, B, and C are N-by-N, N-by-M, and P-by-N matrices, respectively, and A and B are reduced by this routine to orthogonal canonical form using (and optionally accumulating) orthogonal similarity transformations, which are also applied to C. Specifically, the system (A, B, C) is reduced to the triplet (Ac, Bc, Cc), where Ac = Z' * A * Z, Bc = Z' * B, Cc = C * Z, with [ Acont * ] [ Bcont ] Ac = [ ], Bc = [ ], [ 0 Auncont ] [ 0 ] and [ A11 A12 . . . A1,p-1 A1p ] [ B1 ] [ A21 A22 . . . A2,p-1 A2p ] [ 0 ] [ 0 A32 . . . A3,p-1 A3p ] [ 0 ] Acont = [ . . . . . . . ], Bc = [ . ], [ . . . . . . ] [ . ] [ . . . . . ] [ . ] [ 0 0 . . . Ap,p-1 App ] [ 0 ] where the blocks B1, A21, ..., Ap,p-1 have full row ranks and p is the controllability index of the pair. The size of the block Auncont is equal to the dimension of the uncontrollable subspace of the pair (A, B).Specification
SUBROUTINE TB01UD( JOBZ, N, M, P, A, LDA, B, LDB, C, LDC, NCONT, $ INDCON, NBLK, Z, LDZ, TAU, TOL, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBZ INTEGER INDCON, INFO, LDA, LDB, LDC, LDWORK, LDZ, M, N, $ NCONT, P DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), TAU(*), $ Z(LDZ,*) INTEGER IWORK(*), NBLK(*)Arguments
Mode Parameters
JOBZ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Z the orthogonal similarity transformations for reducing the system, as follows: = 'N': Do not form Z and do not store the orthogonal transformations; = 'F': Do not form Z, but store the orthogonal transformations in the factored form; = 'I': Z is initialized to the unit matrix and the orthogonal transformation matrix Z is returned.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs, or of columns of B. M >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading NCONT-by-NCONT part contains the upper block Hessenberg state dynamics matrix Acont in Ac, given by Z' * A * Z, of a controllable realization for the original system. The elements below the first block- subdiagonal are set to zero. The leading N-by-N part contains the matrix Ac. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading NCONT-by-M part of this array contains the transformed input matrix Bcont in Bc, given by Z' * B, with all elements but the first block set to zero. The leading N-by-M part contains the matrix Bc. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix Cc, given by C * Z. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). NCONT (output) INTEGER The order of the controllable state-space representation. INDCON (output) INTEGER The controllability index of the controllable part of the system representation. NBLK (output) INTEGER array, dimension (N) The leading INDCON elements of this array contain the the orders of the diagonal blocks of Acont. Z (output) DOUBLE PRECISION array, dimension (LDZ,N) If JOBZ = 'I', then the leading N-by-N part of this array contains the matrix of accumulated orthogonal similarity transformations which reduces the given system to orthogonal canonical form. If JOBZ = 'F', the elements below the diagonal, with the array TAU, represent the orthogonal transformation matrix as a product of elementary reflectors. The transformation matrix can then be obtained by calling the LAPACK Library routine DORGQR. If JOBZ = 'N', the array Z is not referenced and can be supplied as a dummy array (i.e. set parameter LDZ = 1 and declare this array to be Z(1,1) in the calling program). LDZ INTEGER The leading dimension of array Z. If JOBZ = 'I' or JOBZ = 'F', LDZ >= MAX(1,N); if JOBZ = 'N', LDZ >= 1. TAU (output) DOUBLE PRECISION array, dimension (N) The elements of TAU contain the scalar factors of the elementary reflectors used in the reduction of B and A.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determination when transforming (A, B). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N, 3*M, P). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Matrix B is first QR-decomposed and the appropriate orthogonal similarity transformation applied to the matrix A. Leaving the first rank(B) states unchanged, the remaining lower left block of A is then QR-decomposed and the new orthogonal matrix, Q1, is also applied to the right of A to complete the similarity transformation. By continuing in this manner, a completely controllable state-space pair (Acont, Bcont) is found for the given (A, B), where Acont is upper block Hessenberg with each subdiagonal block of full row rank, and Bcont is zero apart from its (independent) first rank(B) rows. All orthogonal transformations determined in this process are also applied to the matrix C, from the right. NOTE that the system controllability indices are easily calculated from the dimensions of the blocks of Acont.References
[1] Konstantinov, M.M., Petkov, P.Hr. and Christov, N.D. Orthogonal Invariants and Canonical Forms for Linear Controllable Systems. Proc. 8th IFAC World Congress, Kyoto, 1, pp. 49-54, 1981. [2] Paige, C.C. Properties of numerical algorithms related to computing controllablity. IEEE Trans. Auto. Contr., AC-26, pp. 130-138, 1981. [3] Petkov, P.Hr., Konstantinov, M.M., Gu, D.W. and Postlethwaite, I. Optimal Pole Assignment Design of Linear Multi-Input Systems. Leicester University, Report 99-11, May 1996.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
If the system matrices A and B are badly scaled, it would be useful to scale them with SLICOT routine TB01ID, before calling the routine.Example
Program Text
* TB01UD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDZ = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX, 3*MMAX, PMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, INDCON, J, M, N, NCONT, P CHARACTER*1 JOBZ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), TAU(NMAX), Z(LDZ,NMAX) INTEGER IWORK(LIWORK), NBLK(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TB01UD, DORGQR * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, JOBZ 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 ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find a controllable ssr for the given system. CALL TB01UD( JOBZ, N, M, P, A, LDA, B, LDB, C, LDC, $ NCONT, INDCON, NBLK, Z, LDZ, TAU, TOL, $ IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NCONT WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NCONT WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NCONT ) 20 CONTINUE WRITE ( NOUT, FMT = 99994 ) ( NBLK(I), I = 1,INDCON ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NCONT WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99987 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NCONT ) 60 CONTINUE WRITE ( NOUT, FMT = 99992 ) INDCON IF ( LSAME( JOBZ, 'F' ) ) $ CALL DORGQR( N, N, N, Z, LDZ, TAU, DWORK, LDWORK, $ INFO ) IF ( LSAME( JOBZ, 'F' ).OR.LSAME( JOBZ, 'I' ) ) THEN WRITE ( NOUT, FMT = 99991 ) DO 80 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 80 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01UD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01UD = ',I2) 99997 FORMAT (' The order of the controllable state-space representati', $ 'on = ',I2) 99996 FORMAT (/' The transformed state dynamics matrix of a controllab', $ 'le realization is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' and the dimensions of its diagonal blocks are ', $ /20(1X,I2)) 99993 FORMAT (/' The transformed input/state matrix B of a controllabl', $ 'e realization is ') 99992 FORMAT (/' The controllability index of the transformed system r', $ 'epresentation = ',I2) 99991 FORMAT (/' The similarity transformation matrix Z is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The transformed output/state matrix C of a controlla', $ 'ble realization is ') ENDProgram Data
TB01UD EXAMPLE PROGRAM DATA 3 2 2 0.0 I -1.0 0.0 0.0 -2.0 -2.0 -2.0 -1.0 0.0 -3.0 1.0 0.0 0.0 0.0 2.0 1.0 0.0 2.0 1.0 1.0 0.0 0.0Program Results
TB01UD EXAMPLE PROGRAM RESULTS The order of the controllable state-space representation = 2 The transformed state dynamics matrix of a controllable realization is -3.0000 2.2361 0.0000 -1.0000 and the dimensions of its diagonal blocks are 2 The transformed input/state matrix B of a controllable realization is 0.0000 -2.2361 1.0000 0.0000 The transformed output/state matrix C of a controllable realization is -2.2361 0.0000 0.0000 1.0000 The controllability index of the transformed system representation = 1 The similarity transformation matrix Z is 0.0000 1.0000 0.0000 -0.8944 0.0000 -0.4472 -0.4472 0.0000 0.8944
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01UX.html 0000664 0000000 0000000 00000020504 14560147231 0020376 0 ustar 00root root 0000000 0000000
Purpose
To compute an orthogonal transformation matrix Z which reduces the N-th order system (A,B,C) to the form ( Ano * ) ( Bno ) Z'*A*Z = ( ) , Z'*B = ( ) , ( 0 Ao ) ( Bo ) C*Z = ( 0 Co ) , where the NOBSV-th order system (Ao,Bo,Co) is observable. The matrix Ano of order N-NOBSV contains the unobservable eigenvalues of A. The pencil ( Ao-lambda*I ) has full column rank NOBSV for all ( Co ) lambda, and is in a staircase form, with _ _ _ _ ( Ak,k Ak,k-1 ... Ak,2 Ak,1 ) ( _ _ _ _ ) ( Ao ) = ( Ak-1,k Ak-1,k-1 ... Ak-1,2 Ak-1,1 ) , (1) ( Co ) ( : : ... _ : _ : ) ( 0 0 ... A1,2 A1,1 ) ( _ ) ( 0 0 ... 0 A0,1 ) _ where Ai-1,i is a CTAU(i-1)-by-CTAU(i) full column rank matrix (with CTAU(0) = P). The orthogonal transformation Z, performed to reduce the system matrices, can be optionally accumulated. The reduced order system (Ao,Bo,Co) has the same transfer-function matrix as the original system (A,B,C).Specification
SUBROUTINE TB01UX( COMPZ, N, M, P, A, LDA, B, LDB, C, LDC, Z, LDZ, $ NOBSV, NLBLCK, CTAU, TOL, IWORK, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPZ INTEGER INFO, LDA, LDB, LDC, LDZ, M, N, NLBLCK, NOBSV, $ P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER CTAU( * ), IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), Z( LDZ, * )Arguments
Mode Parameters
COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned.Input/Output Parameters
N (input) INTEGER The dimension of the system state vector; also the order of the square matrix A, the number of rows of the matrix B and the number of columns of the matrix C. N >= 0. M (input) INTEGER The dimension of system input vector; also the number of columns of the matrix B. M >= 0. P (input) INTEGER The dimension of system output vector; also the number of rows of the matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the N-by-N state matrix A. On exit, the leading N-by-N part of this array contains the transformed state matrix Z'*A*Z, ( Ano * ) Z'*A*Z = ( ) , ( 0 Ao ) where Ao is NOBSV-by-NOBSV and Ano is (N-NOBSV)-by-(N-NOBSV). The matrix ( Ao ) is in the observability staircase ( Co ) form (1). LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) On entry, the leading N-by-M part of this array must contain the N-by-M input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Z'*B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N) if M > 0 or P > 0; LDB >= 1 if M = 0 and P = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z = ( 0 Co ) , where Co is P-by-NOBSV. The matrix ( Ao ) is in the observability staircase ( Co ) form (1). LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,M,P) if N > 0; LDC >= 1 if N = 0. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,*) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z, i.e., the product of the transformations applied to A and C on the right. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'I'. NOBSV (output) INTEGER The order of the reduced matrix Ao, and the number of columns of the reduced matrix Co; also, the order of the observable part of the pair (C, A-lambda*I). NLBLCK (output) INTEGER _ The number k, of full column rank blocks Ai-1,i in the staircase form of the pencil (Ao-lambda*I) (see (1)). ( Co ) CTAU (output) INTEGER array, dimension (N) CTAU(i), for i = 1, ..., NLBLCK, is the column dimension _ of the full column rank block Ai-1,i in the staircase form (1).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming the pair (A,C). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (P) DWORK DOUBLE PRECISION array, dimension (N+MAX(1, N, 3*P, M)) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The subroutine is based on the dual of the reduction algorithms of [1].References
[1] Varga, A. Computation of Irreducible Generalized State-Space Realizations. Kybernetika, vol. 26, pp. 89-106, 1990.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
If the system matrices A and C are badly scaled, it is generally recommendable to scale them with the SLICOT routine TB01ID, before calling TG01UX.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To find a controllable realization for the linear time-invariant multi-input system dX/dt = A * X + B1 * U1 + B2 * U2, Y = C * X, where A, B1, B2 and C are N-by-N, N-by-M1, N-by-M2, and P-by-N matrices, respectively, and A and [B1,B2] are reduced by this routine to orthogonal canonical form using (and optionally accumulating) orthogonal similarity transformations, which are also applied to C. Specifically, the system (A, [B1,B2], C) is reduced to the triplet (Ac, [Bc1,Bc2], Cc), where Ac = Z' * A * Z, [Bc1,Bc2] = Z' * [B1,B2], Cc = C * Z, with [ Acont * ] [ Bcont1, Bcont2 ] Ac = [ ], [Bc1,Bc1] = [ ], [ 0 Auncont ] [ 0 0 ] and [ A11 A12 . . . A1,p-2 A1,p-1 A1p ] [ A21 A22 . . . A2,p-2 A2,p-1 A2p ] [ A31 A32 . . . A3,p-2 A3,p-1 A3p ] [ 0 A42 . . . A4,p-2 A4,p-1 A4p ] Acont = [ . . . . . . . . ], [ . . . . . . . ] [ . . . . . . ] [ 0 0 . . . Ap,p-2 Ap,p-1 App ] [ B11 B12 ] [ 0 B22 ] [ 0 0 ] [ 0 0 ] [Bc1,Bc2] = [ . . ], [ . . ] [ . . ] [ 0 0 ] where the blocks B11, B22, A31, ..., Ap,p-2 have full row ranks and p is the controllability index of the pair (A,[B1,B2]). The size of the block Auncont is equal to the dimension of the uncontrollable subspace of the pair (A,[B1,B2]).Specification
SUBROUTINE TB01UY( JOBZ, N, M1, M2, P, A, LDA, B, LDB, C, LDC, $ NCONT, INDCON, NBLK, Z, LDZ, TAU, TOL, IWORK, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBZ INTEGER INDCON, INFO, LDA, LDB, LDC, LDWORK, LDZ, M1, $ M2, N, NCONT, P DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), TAU(*), $ Z(LDZ,*) INTEGER IWORK(*), NBLK(*)Arguments
Mode Parameters
JOBZ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Z the orthogonal similarity transformations for reducing the system, as follows: = 'N': Do not form Z and do not store the orthogonal transformations; = 'F': Do not form Z, but store the orthogonal transformations in the factored form; = 'I': Z is initialized to the unit matrix and the orthogonal transformation matrix Z is returned.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e., the order of the matrix A. N >= 0. M1 (input) INTEGER The number of system inputs in U1, or of columns of B1. M1 >= 0. M2 (input) INTEGER The number of system inputs in U2, or of columns of B2. M2 >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading N-by-N part of this array contains the transformed state dynamics matrix Ac = Z'*A*Z. The leading NCONT-by-NCONT diagonal block of this matrix, Acont, is the state dynamics matrix of a controllable realization for the original system. The elements below the second block-subdiagonal are set to zero. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M1+M2) On entry, the leading N-by-(M1+M2) part of this array must contain the compound input matrix B = [B1,B2], where B1 is N-by-M1 and B2 is N-by-M2. On exit, the leading N-by-(M1+M2) part of this array contains the transformed compound input matrix [Bc1,Bc2] = Z'*[B1,B2]. The leading NCONT-by-(M1+M2) part of this array, [Bcont1, Bcont2], is the compound input matrix of a controllable realization for the original system. All elements below the first block-diagonal are set to zero. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix Cc, given by C * Z. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). NCONT (output) INTEGER The order of the controllable state-space representation. INDCON (output) INTEGER The controllability index of the controllable part of the system representation. NBLK (output) INTEGER array, dimension (2*N) The leading INDCON elements of this array contain the orders of the diagonal blocks of Acont. INDCON is always an even number, and the INDCON/2 odd and even components of NBLK have decreasing values, respectively. Note that some elements of NBLK can be zero. Z (output) DOUBLE PRECISION array, dimension (LDZ,N) If JOBZ = 'I', then the leading N-by-N part of this array contains the matrix of accumulated orthogonal similarity transformations which reduces the given system to orthogonal canonical form. If JOBZ = 'F', the elements below the diagonal, with the array TAU, represent the orthogonal transformation matrix as a product of elementary reflectors. The transformation matrix can then be obtained by calling the LAPACK Library routine DORGQR. If JOBZ = 'N', the array Z is not referenced and can be supplied as a dummy array (i.e., set parameter LDZ = 1 and declare this array to be Z(1,1) in the calling program). LDZ INTEGER The leading dimension of the array Z. If JOBZ = 'I' or JOBZ = 'F', LDZ >= MAX(1,N); if JOBZ = 'N', LDZ >= 1. TAU (output) DOUBLE PRECISION array, dimension (MIN(N,M1+M2)) The elements of TAU contain the scalar factors of the elementary reflectors used in the reduction of [B1,B2] and A.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming (A, [B1,B2]). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
IWORK INTEGER array, dimension (MAX(M1,M2)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, and LDWORK >= MAX(N, 3*MAX(M1,M2), P), if MIN(N,M1+M2) > 0. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The implemented algorithm [1] represents a specialization of the controllability staircase algorithm of [2] to the special structure of the input matrix B = [B1,B2].References
[1] Varga, A. Reliable algorithms for computing minimal dynamic covers. Proc. CDC'2003, Hawaii, 2003. [2] Varga, A. Numerically stable algorithm for standard controllability form determination. Electronics Letters, vol. 17, pp. 74-75, 1981.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
If the system matrices A and B are badly scaled, it would be useful to scale them with SLICOT routine TB01ID, before calling the routine.Example
Program Text
* TB01UY EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDZ = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = MMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX, 3*MMAX, PMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, INDCON, J, M, M1, M2, N, NCONT, P CHARACTER*1 JOBZ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), TAU(MIN(NMAX,MMAX)), Z(LDZ,NMAX) INTEGER IWORK(LIWORK), NBLK(2*NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DORGQR, TB01UY * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M1, M2, P, TOL, JOBZ M = M1 + M2 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 ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find a controllable ssr for the given system. CALL TB01UY( JOBZ, N, M1, M2, P, A, LDA, B, LDB, C, LDC, $ NCONT, INDCON, NBLK, Z, LDZ, TAU, TOL, $ IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NCONT WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, NCONT WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NCONT ) 20 CONTINUE WRITE ( NOUT, FMT = 99994 ) ( NBLK(I), I = 1,INDCON ) WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NCONT WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99987 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NCONT ) 60 CONTINUE WRITE ( NOUT, FMT = 99992 ) INDCON IF ( LSAME( JOBZ, 'F' ) ) $ CALL DORGQR( N, N, N, Z, LDZ, TAU, DWORK, LDWORK, $ INFO ) IF ( LSAME( JOBZ, 'F' ).OR.LSAME( JOBZ, 'I' ) ) THEN WRITE ( NOUT, FMT = 99991 ) DO 80 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 80 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01UY EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01UY = ',I2) 99997 FORMAT (' The order of the controllable state-space representati', $ 'on = ',I2) 99996 FORMAT (/' The transformed state dynamics matrix of a controllab', $ 'le realization is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' and the dimensions of its diagonal blocks are ', $ /20(1X,I2)) 99993 FORMAT (/' The transformed input/state matrix B of a controllabl', $ 'e realization is ') 99992 FORMAT (/' The controllability index of the transformed system r', $ 'epresentation = ',I2) 99991 FORMAT (/' The similarity transformation matrix Z is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) 99987 FORMAT (/' The transformed output/state matrix C of a controlla', $ 'ble realization is ') ENDProgram Data
TB01UY EXAMPLE PROGRAM DATA 3 1 1 2 0.0 I -1.0 0.0 0.0 -2.0 -2.0 -2.0 -1.0 0.0 -3.0 1.0 0.0 0.0 0.0 2.0 1.0 0.0 2.0 1.0 1.0 0.0 0.0Program Results
TB01UY EXAMPLE PROGRAM RESULTS The order of the controllable state-space representation = 2 The transformed state dynamics matrix of a controllable realization is -1.0000 0.0000 2.2361 -3.0000 and the dimensions of its diagonal blocks are 1 1 The transformed input/state matrix B of a controllable realization is 1.0000 0.0000 0.0000 -2.2361 The transformed output/state matrix C of a controllable realization is 0.0000 -2.2361 1.0000 0.0000 The controllability index of the transformed system representation = 2 The similarity transformation matrix Z is 1.0000 0.0000 0.0000 0.0000 -0.8944 -0.4472 0.0000 -0.4472 0.8944
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01VD.html 0000664 0000000 0000000 00000016143 14560147231 0020357 0 ustar 00root root 0000000 0000000
Purpose
To convert the linear discrete-time system given as (A, B, C, D), with initial state x0, into the output normal form [1], with parameter vector THETA. The matrix A is assumed to be stable. The matrices A, B, C, D and the vector x0 are converted, so that on exit they correspond to the system defined by THETA.Specification
SUBROUTINE TB01VD( APPLY, N, M, L, A, LDA, B, LDB, C, LDC, D, LDD, $ X0, THETA, LTHETA, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER APPLY INTEGER INFO, L, LDA, LDB, LDC, LDD, LDWORK, LTHETA, M, $ N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), THETA(*), X0(*)Arguments
Mode Parameters
APPLY CHARACTER*1 Specifies whether or not the parameter vector should be transformed using a bijective mapping, as follows: = 'A' : apply the bijective mapping to the N vectors in THETA corresponding to the matrices A and C; = 'N' : do not apply the bijective mapping. The transformation performed when APPLY = 'A' allows to get rid of the constraints norm(THETAi) < 1, i = 1:N. A call of the SLICOT Library routine TB01VY associated to a call of TB01VD must use the same value of APPLY.Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the system state matrix A, assumed to be stable. On exit, the leading N-by-N part of this array contains the transformed system state matrix corresponding to the output normal form with parameter vector THETA. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the system input matrix B. On exit, the leading N-by-M part of this array contains the transformed system input matrix corresponding to the output normal form with parameter vector THETA. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading L-by-N part of this array must contain the system output matrix C. On exit, the leading L-by-N part of this array contains the transformed system output matrix corresponding to the output normal form with parameter vector THETA. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,L). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading L-by-M part of this array must contain the system input/output matrix D. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,L). X0 (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the initial state of the system, x0. On exit, this array contains the transformed initial state of the system, corresponding to the output normal form with parameter vector THETA. THETA (output) DOUBLE PRECISION array, dimension (LTHETA) The leading N*(L+M+1)+L*M part of this array contains the parameter vector that defines a system (A, B, C, D, x0) which is equivalent up to a similarity transformation to the system given on entry. The parameters are: THETA(1:N*L) : parameters for A, C; THETA(N*L+1:N*(L+M)) : parameters for B; THETA(N*(L+M)+1:N*(L+M)+L*M) : parameters for D; THETA(N*(L+M)+L*M+1:N*(L+M+1)+L*M): parameters for x0. LTHETA INTEGER The length of array THETA. LTHETA >= N*(L+M+1)+L*M.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N*N*L + N*L + N, N*N + MAX(N*N + N*MAX(N,L) + 6*N + MIN(N,L), N*M)). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the Lyapunov equation A'*Q*A - Q = -scale^2*C'*C could only be solved with scale = 0; = 2: if matrix A is not discrete-time stable; = 3: if the QR algorithm failed to converge for matrix A.Method
The matrices A and C are converted to output normal form. First, the Lyapunov equation A'*Q*A - Q = -scale^2*C'*C, is solved in the Cholesky factor T, T'*T = Q, and then T is used to get the transformation matrix. The matrix B and the initial state x0 are transformed accordingly. Then, the QR factorization of the transposed observability matrix is computed, and the matrix Q is used to further transform the system matrices. The parameters characterizing A and C are finally obtained by applying a set of N orthogonal transformations.References
[1] Peeters, R.L.M., Hanzon, B., and Olivi, M. Balanced realizations of discrete-time stable all-pass systems and the tangential Schur algorithm. Proceedings of the European Control Conference, 31 August - 3 September 1999, Karlsruhe, Germany. Session CP-6, Discrete-time Systems, 1999.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To convert the linear discrete-time system given as its output normal form [1], with parameter vector THETA, into the state-space representation (A, B, C, D), with the initial state x0.Specification
SUBROUTINE TB01VY( APPLY, N, M, L, THETA, LTHETA, A, LDA, B, LDB, $ C, LDC, D, LDD, X0, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER APPLY INTEGER INFO, L, LDA, LDB, LDC, LDD, LDWORK, LTHETA, M, $ N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), THETA(*), X0(*)Arguments
Mode Parameters
APPLY CHARACTER*1 Specifies whether or not the parameter vector should be transformed using a bijective mapping, as follows: = 'A' : apply the bijective mapping to the N vectors in THETA corresponding to the matrices A and C; = 'N' : do not apply the bijective mapping. The transformation performed when APPLY = 'A' allows to get rid of the constraints norm(THETAi) < 1, i = 1:N. A call of the SLICOT Library routine TB01VD associated to a call of TB01VY must use the same value of APPLY.Input/Output Parameters
N (input) INTEGER The order of the system. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. L (input) INTEGER The number of system outputs. L >= 0. THETA (input) DOUBLE PRECISION array, dimension (LTHETA) The leading N*(L+M+1)+L*M part of this array must contain the parameter vector that defines a system (A, B, C, D), with the initial state x0. The parameters are: THETA(1:N*L) : parameters for A, C; THETA(N*L+1:N*(L+M)) : parameters for B; THETA(N*(L+M)+1:N*(L+M)+L*M) : parameters for D; THETA(N*(L+M)+L*M+1:N*(L+M+1)+L*M): parameters for x0. LTHETA INTEGER The length of array THETA. LTHETA >= N*(L+M+1)+L*M. A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array contains the system state matrix corresponding to the output normal form with parameter vector THETA. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (output) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array contains the system input matrix corresponding to the output normal form with parameter vector THETA. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (output) DOUBLE PRECISION array, dimension (LDC,N) The leading L-by-N part of this array contains the system output matrix corresponding to the output normal form with parameter vector THETA. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,L). D (output) DOUBLE PRECISION array, dimension (LDD,M) The leading L-by-M part of this array contains the system input/output matrix corresponding to the output normal form with parameter vector THETA. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,L). X0 (output) DOUBLE PRECISION array, dimension (N) This array contains the initial state of the system, x0, corresponding to the output normal form with parameter vector THETA.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= N*(N+L+1).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The parameters characterizing A and C are used to build N orthogonal transformations, which are then applied to recover these matrices.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To reduce the system state matrix A to an upper real Schur form by using an orthogonal similarity transformation A <-- U'*A*U and to apply the transformation to the matrices B and C: B <-- U'*B and C <-- C*U.Specification
SUBROUTINE TB01WD( N, M, P, A, LDA, B, LDB, C, LDC, U, LDU, $ WR, WI, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDU, LDWORK, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), U(LDU,*), $ WI(*), WR(*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs, or of columns of B. M >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading N-by-N part of this array contains the matrix U' * A * U in real Schur form. The elements below the first subdiagonal are set to zero. Note: A matrix is in real Schur form if it is upper quasi-triangular with 1-by-1 and 2-by-2 blocks. 2-by-2 blocks are standardized in the form [ a b ] [ c a ] where b*c < 0. The eigenvalues of such a block are a +- sqrt(bc). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix U' * B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix C * U. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). U (output) DOUBLE PRECISION array, dimension (LDU,N) The leading N-by-N part of this array contains the orthogonal transformation matrix used to reduce A to the real Schur form. The columns of U are the Schur vectors of matrix A. LDU INTEGER The leading dimension of array U. LDU >= max(1,N). WR, WI (output) DOUBLE PRECISION arrays, dimension (N) WR and WI contain the real and imaginary parts, respectively, of the computed eigenvalues of A. The eigenvalues will be in the same order that they appear on the diagonal of the output real Schur form of A. Complex conjugate pairs of eigenvalues will appear consecutively with the eigenvalue having the positive imaginary part first.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LWORK >= 3*N. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues; elements i+1:N of WR and WI contain those eigenvalues which have converged; U contains the matrix which reduces A to its partially converged Schur form.Method
Matrix A is reduced to a real Schur form using an orthogonal similarity transformation A <- U'*A*U. Then, the transformation is applied to the matrices B and C: B <-- U'*B and C <-- C*U.Numerical Aspects
3 The algorithm requires about 10N floating point operations.Further Comments
NoneExample
Program Text
* TB01WD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDU PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDU = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 3*NMAX ) * .. Local Scalars .. INTEGER I, INFO, J, M, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), U(LDU,NMAX), WI(NMAX), WR(NMAX) * .. External Subroutines .. EXTERNAL TB01WD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed ssr for (A,B,C). CALL TB01WD( N, M, P, A, LDA, B, LDB, C, LDC, U, LDU, $ WR, WI, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, N WRITE ( NOUT, FMT = 99994 ) WR(I), WI(I) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( U(I,J), J = 1,N ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01WD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01WD = ',I2) 99997 FORMAT (' The eigenvalues of state dynamics matrix A are ') 99996 FORMAT (/' The transformed state dynamics matrix U''*A*U is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT ( ' (',F8.4,', ',F8.4,' )') 99993 FORMAT (/' The transformed input/state matrix U''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*U is ') 99991 FORMAT (/' The similarity transformation matrix U is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB01WD EXAMPLE PROGRAM DATA (Continuous system) 5 2 3 -0.04165 4.9200 -4.9200 0 0 -1.387944 -3.3300 0 0 0 0.5450 0 0 -0.5450 0 0 0 4.9200 -0.04165 4.9200 0 0 0 -1.387944 -3.3300 0 0 3.3300 0 0 0 0 0 0 3.3300 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0Program Results
TB01WD EXAMPLE PROGRAM RESULTS The eigenvalues of state dynamics matrix A are ( -0.7483, 2.9940 ) ( -0.7483, -2.9940 ) ( -1.6858, 2.0311 ) ( -1.6858, -2.0311 ) ( -1.8751, 0.0000 ) The transformed state dynamics matrix U'*A*U is -0.7483 -8.6406 0.0000 0.0000 1.1745 1.0374 -0.7483 0.0000 0.0000 -2.1164 0.0000 0.0000 -1.6858 5.5669 0.0000 0.0000 0.0000 -0.7411 -1.6858 0.0000 0.0000 0.0000 0.0000 0.0000 -1.8751 The transformed input/state matrix U'*B is -0.5543 0.5543 -1.6786 1.6786 -0.8621 -0.8621 2.1912 2.1912 -1.5555 1.5555 The transformed state/output matrix C*U is 0.6864 -0.0987 0.6580 0.2589 -0.1381 -0.0471 0.6873 0.0000 0.0000 -0.7249 -0.6864 0.0987 0.6580 0.2589 0.1381 The similarity transformation matrix U is 0.6864 -0.0987 0.6580 0.2589 -0.1381 -0.1665 -0.5041 -0.2589 0.6580 -0.4671 -0.0471 0.6873 0.0000 0.0000 -0.7249 -0.6864 0.0987 0.6580 0.2589 0.1381 0.1665 0.5041 -0.2589 0.6580 0.4671
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01WX.html 0000664 0000000 0000000 00000023757 14560147231 0020415 0 ustar 00root root 0000000 0000000
Purpose
To reduce the system state matrix A to an upper Hessenberg form by using an orthogonal similarity transformation A <-- U'*A*U and to apply the transformation to the matrices B and C: B <-- U'*B and C <-- C*U.Specification
SUBROUTINE TB01WX( COMPU, N, M, P, A, LDA, B, LDB, C, LDC, U, LDU, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPU INTEGER INFO, LDA, LDB, LDC, LDU, LDWORK, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), U(LDU,*)Arguments
Mode Parameters
COMPU CHARACTER*1 = 'N': do not compute U; = 'I': U is initialized to the unit matrix, and the orthogonal matrix U is returned; = 'U': U must contain an orthogonal matrix U1 on entry, and the product U1*U is returned.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e., the order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs, or of columns of B. M >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading N-by-N part of this array contains the matrix U' * A * U in Hessenberg form. The elements below the first subdiagonal are set to zero. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix U' * B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix C * U. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). U (input/output) DOUBLE PRECISION array, dimension (LDU,*) On entry, if COMPU = 'U', the leading N-by-N part of this array must contain the given matrix U1. Otherwise, this array need not be set on input. On exit, if COMPU <> 'N', the leading N-by-N part of this array contains the orthogonal transformation matrix used to reduce A to the Hessenberg form (U1*U if COMPU = 'U'). If COMPU = 'N', this array is not referenced. LDU INTEGER The leading dimension of the array U. LDU >= 1, if COMPU = 'N'; LDU >= max(1,N), if COMPU <> 'N'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, and if N > 0, LDWORK >= N - 1 + MAX(N,M,P). For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Matrix A is reduced to the Hessenberg form using an orthogonal similarity transformation A <- U'*A*U. Then, the transformation is applied to the matrices B and C: B <-- U'*B and C <-- C*U.Numerical Aspects
3 2 The algorithm requires about 5N /3 + N (M+P) floating point 3 operations, if COMPU = 'N'. Otherwise, 2N /3 additional operations are needed.Further Comments
NoneExample
Program Text
* TB01WX EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDU PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDU = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX - 1 + MAX( NMAX, MMAX, PMAX ) ) * .. Local Scalars .. CHARACTER COMPU INTEGER I, INFO, J, M, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), U(LDU,NMAX) * .. External Subroutines .. EXTERNAL TB01WX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, COMPU IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99990 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99989 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1, N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99988 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed ssr for (A,B,C). CALL TB01WX( COMPU, N, M, P, A, LDA, B, LDB, C, LDC, U, $ LDU, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 60 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 70 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( U(I,J), J = 1,N ) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01WX EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01WX = ',I2) 99996 FORMAT (/' The transformed state dynamics matrix U''*A*U is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT ( ' (',F8.4,', ',F8.4,' )') 99993 FORMAT (/' The transformed input/state matrix U''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*U is ') 99991 FORMAT (/' The similarity transformation matrix U is ') 99990 FORMAT (/' N is out of range.',/' N = ',I5) 99989 FORMAT (/' M is out of range.',/' M = ',I5) 99988 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB01WX EXAMPLE PROGRAM DATA (Continuous system) 5 2 3 I -0.04165 4.9200 -4.9200 0 0 -1.387944 -3.3300 0 0 0 0.5450 0 0 -0.5450 0 0 0 4.9200 -0.04165 4.9200 0 0 0 -1.387944 -3.3300 0 0 3.3300 0 0 0 0 0 0 3.3300 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0Program Results
TB01WX EXAMPLE PROGRAM RESULTS The transformed state dynamics matrix U'*A*U is -0.0416 -6.3778 1.4826 -1.9856 1.2630 1.4911 -2.8851 -0.4353 0.8984 -0.5714 0.0000 -2.1254 1.6804 -4.9686 -1.7731 0.0000 0.0000 2.1880 -3.3545 -2.6069 0.0000 0.0000 0.0000 0.7554 -2.1424 The transformed input/state matrix U'*B is 0.0000 0.0000 -3.0996 0.0000 -0.6488 0.0000 0.8689 1.7872 -0.5527 2.8098 The transformed state/output matrix C*U is 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.3655 -0.4962 0.6645 -0.4227 0.0000 0.0000 -0.8461 -0.4498 0.2861 The similarity transformation matrix U is 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.9308 -0.1948 0.2609 -0.1660 0.0000 0.3655 -0.4962 0.6645 -0.4227 0.0000 0.0000 -0.8461 -0.4498 0.2861 0.0000 0.0000 0.0000 0.5367 0.8438
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB01XD.html 0000664 0000000 0000000 00000012207 14560147231 0020356 0 ustar 00root root 0000000 0000000
Purpose
To apply a special transformation to a system given as a triple (A,B,C), A <-- P * A' * P, B <-- P * C', C <-- B' * P, where P is a matrix with 1 on the secondary diagonal, and with 0 in the other entries. Matrix A can be specified as a band matrix. Optionally, matrix D of the system can be transposed. This transformation is actually a special similarity transformation of the dual system.Specification
SUBROUTINE TB01XD( JOBD, N, M, P, KL, KU, A, LDA, B, LDB, C, LDC, $ D, LDD, INFO ) C .. Scalar Arguments .. CHARACTER JOBD INTEGER INFO, KL, KU, LDA, LDB, LDC, LDD, M, N, P C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * )Arguments
Mode Parameters
JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model: = 'D': D is present; = 'Z': D is assumed a zero matrix.Input/Output Parameters
N (input) INTEGER The order of the matrix A, the number of rows of matrix B and the number of columns of matrix C. N represents the dimension of the state vector. N >= 0. M (input) INTEGER. The number of columns of matrix B. M represents the dimension of input vector. M >= 0. P (input) INTEGER. The number of rows of matrix C. P represents the dimension of output vector. P >= 0. KL (input) INTEGER The number of subdiagonals of A to be transformed. MAX( 0, N-1 ) >= KL >= 0. KU (input) INTEGER The number of superdiagonals of A to be transformed. MAX( 0, N-1 ) >= KU >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the system state matrix A. On exit, the leading N-by-N part of this array contains the transformed (pertransposed) matrix P*A'*P. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, the leading N-by-P part of this array contains the dual input/state matrix P*C'. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N) if M > 0 or P > 0. LDB >= 1 if M = 0 and P = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, the leading M-by-N part of this array contains the dual state/output matrix B'*P. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P) if N > 0. LDC >= 1 if N = 0. D (input/output) DOUBLE PRECISION array, dimension (LDD,MAX(M,P)) On entry, if JOBD = 'D', the leading P-by-M part of this array must contain the original direct transmission matrix D. On exit, if JOBD = 'D', the leading M-by-P part of this array contains the transposed direct transmission matrix D'. The array D is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,M,P) if JOBD = 'D'. LDD >= 1 if JOBD = 'Z'.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
The rows and/or columns of the matrices of the triplet (A,B,C) and, optionally, of the matrix D are swapped in a special way.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To apply a special transformation to a system given as a triple (A,B,C), A <-- P * A' * P, B <-- P * C', C <-- B' * P, where P is a matrix with 1 on the secondary diagonal, and with 0 in the other entries. Matrix A can be specified as a band matrix. Optionally, matrix D of the system can be transposed. This transformation is actually a special similarity transformation of the dual system.Specification
SUBROUTINE TB01XZ( JOBD, N, M, P, KL, KU, A, LDA, B, LDB, C, LDC, $ D, LDD, INFO ) C .. Scalar Arguments .. CHARACTER JOBD INTEGER INFO, KL, KU, LDA, LDB, LDC, LDD, M, N, P C .. Array Arguments .. COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * ), $ D( LDD, * )Arguments
Mode Parameters
JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state space model: = 'D': D is present; = 'Z': D is assumed a zero matrix.Input/Output Parameters
N (input) INTEGER The order of the matrix A, the number of rows of matrix B and the number of columns of matrix C. N represents the dimension of the state vector. N >= 0. M (input) INTEGER. The number of columns of matrix B. M represents the dimension of input vector. M >= 0. P (input) INTEGER. The number of rows of matrix C. P represents the dimension of output vector. P >= 0. KL (input) INTEGER The number of subdiagonals of A to be transformed. MAX( 0, N-1 ) >= KL >= 0. KU (input) INTEGER The number of superdiagonals of A to be transformed. MAX( 0, N-1 ) >= KU >= 0. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the system state matrix A. On exit, the leading N-by-N part of this array contains the transformed (pertransposed) matrix P*A'*P. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) COMPLEX*16 array, dimension (LDB,MAX(M,P)) On entry, the leading N-by-M part of this array must contain the original input/state matrix B. On exit, the leading N-by-P part of this array contains the dual input/state matrix P*C'. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N) if M > 0 or P > 0. LDB >= 1 if M = 0 and P = 0. C (input/output) COMPLEX*16 array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C. On exit, the leading M-by-N part of this array contains the dual state/output matrix B'*P. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P) if N > 0. LDC >= 1 if N = 0. D (input/output) COMPLEX*16 array, dimension (LDD,MAX(M,P)) On entry, if JOBD = 'D', the leading P-by-M part of this array must contain the original direct transmission matrix D. On exit, if JOBD = 'D', the leading M-by-P part of this array contains the transposed direct transmission matrix D'. The array D is not referenced if JOBD = 'Z'. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,M,P) if JOBD = 'D'. LDD >= 1 if JOBD = 'Z'.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
The rows and/or columns of the matrices of the triplet (A,B,C) and, optionally, of the matrix D are swapped in a special way.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To apply a special similarity transformation to a system given as a triple (A,B,C), A <-- P * A * P, B <-- P * B, C <-- C * P, where P is a matrix with 1 on the secondary diagonal, and with 0 in the other entries.Specification
SUBROUTINE TB01YD( N, M, P, A, LDA, B, LDB, C, LDC, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, M, N, P C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * )Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A, the number of rows of matrix B and the number of columns of matrix C. N represents the dimension of the state vector. N >= 0. M (input) INTEGER. The number of columns of matrix B. M represents the dimension of input vector. M >= 0. P (input) INTEGER. The number of rows of matrix C. P represents the dimension of output vector. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the system state matrix A. On exit, the leading N-by-N part of this array contains the transformed matrix P*A*P. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the system input matrix B. On exit, the leading N-by-M part of this array contains the transformed matrix P*B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N) if M > 0. LDB >= 1 if M = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the system output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*P. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P).Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
The rows and/or columns of the matrices of the triplet (A,B,C) are swapped in a special way.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To find a controllable realization for the linear time-invariant single-input system dX/dt = A * X + B * U, Y = C * X, where A is an N-by-N matrix, B is an N element vector, C is an P-by-N matrix, and A and B are reduced by this routine to orthogonal canonical form using (and optionally accumulating) orthogonal similarity transformations, which are also applied to C.Specification
SUBROUTINE TB01ZD( JOBZ, N, P, A, LDA, B, C, LDC, NCONT, Z, LDZ, $ TAU, TOL, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBZ INTEGER INFO, LDA, LDC, LDWORK, LDZ, N, NCONT, P DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(*), C(LDC,*), DWORK(*), TAU(*), $ Z(LDZ,*)Arguments
Mode Parameters
JOBZ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Z the orthogonal similarity transformations for reducing the system, as follows: = 'N': Do not form Z and do not store the orthogonal transformations; = 'F': Do not form Z, but store the orthogonal transformations in the factored form; = 'I': Z is initialized to the unit matrix and the orthogonal transformation matrix Z is returned.Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e. the order of the matrix A. N >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading NCONT-by-NCONT upper Hessenberg part of this array contains the canonical form of the state dynamics matrix, given by Z' * A * Z, of a controllable realization for the original system. The elements below the first subdiagonal are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (N) On entry, the original input/state vector B. On exit, the leading NCONT elements of this array contain canonical form of the input/state vector, given by Z' * B, with all elements but B(1) set to zero. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output/state matrix C. On exit, the leading P-by-N part of this array contains the transformed output/state matrix, given by C * Z, and the leading P-by-NCONT part contains the output/state matrix of the controllable realization. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). NCONT (output) INTEGER The order of the controllable state-space representation. Z (output) DOUBLE PRECISION array, dimension (LDZ,N) If JOBZ = 'I', then the leading N-by-N part of this array contains the matrix of accumulated orthogonal similarity transformations which reduces the given system to orthogonal canonical form. If JOBZ = 'F', the elements below the diagonal, with the array TAU, represent the orthogonal transformation matrix as a product of elementary reflectors. The transformation matrix can then be obtained by calling the LAPACK Library routine DORGQR. If JOBZ = 'N', the array Z is not referenced and can be supplied as a dummy array (i.e. set parameter LDZ = 1 and declare this array to be Z(1,1) in the calling program). LDZ INTEGER The leading dimension of array Z. If JOBZ = 'I' or JOBZ = 'F', LDZ >= MAX(1,N); if JOBZ = 'N', LDZ >= 1. TAU (output) DOUBLE PRECISION array, dimension (N) The elements of TAU contain the scalar factors of the elementary reflectors used in the reduction of B and A.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining the controllability of (A,B). If the user sets TOL > 0, then the given value of TOL is used as an absolute tolerance; elements with absolute value less than TOL are considered neglijible. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS*MAX( NORM(A), NORM(B) ) is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N,P). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The Householder matrix which reduces all but the first element of vector B to zero is found and this orthogonal similarity transformation is applied to the matrix A. The resulting A is then reduced to upper Hessenberg form by a sequence of Householder transformations. Finally, the order of the controllable state- space representation (NCONT) is determined by finding the position of the first sub-diagonal element of A which is below an appropriate zero threshold, either TOL or TOLDEF (see parameter TOL); if NORM(B) is smaller than this threshold, NCONT is set to zero, and no computations for reducing the system to orthogonal canonical form are performed. All orthogonal transformations determined in this process are also applied to the matrix C, from the right.References
[1] Konstantinov, M.M., Petkov, P.Hr. and Christov, N.D. Orthogonal Invariants and Canonical Forms for Linear Controllable Systems. Proc. 8th IFAC World Congress, Kyoto, 1, pp. 49-54, 1981. [2] Hammarling, S.J. Notes on the use of orthogonal similarity transformations in control. NPL Report DITC 8/82, August 1982. [3] Paige, C.C Properties of numerical algorithms related to computing controllability. IEEE Trans. Auto. Contr., AC-26, pp. 130-138, 1981.Numerical Aspects
3 The algorithm requires 0(N ) operations and is backward stable.Further Comments
NoneExample
Program Text
* TB01ZD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, PMAX PARAMETER ( NMAX = 20, PMAX = 20 ) INTEGER LDA, LDC, LDZ PARAMETER ( LDA = NMAX, LDC = PMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX, PMAX ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INFO, J, N, NCONT, P CHARACTER*1 JOBZ * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(NMAX), C(LDC,NMAX), DWORK(LDWORK), $ TAU(NMAX), Z(LDZ,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TB01ZD, DORGQR * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read in the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, P, TOL, JOBZ IF ( N.LE.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 = * ) ( B(I), I = 1,N ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99992 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find a controllable realization for the given system. CALL TB01ZD( JOBZ, N, P, A, LDA, B, C, LDC, NCONT, Z, LDZ, $ TAU, TOL, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NCONT DO 20 I = 1, NCONT WRITE ( NOUT, FMT = 99994 ) ( A(I,J), J = 1,NCONT ) 20 CONTINUE WRITE ( NOUT, FMT = 99996 ) ( B(I), I = 1,NCONT ) WRITE ( NOUT, FMT = 99991 ) DO 30 I = 1, P WRITE ( NOUT, FMT = 99994 ) ( C(I,J), J = 1,NCONT ) 30 CONTINUE IF ( LSAME( JOBZ, 'F' ) ) $ CALL DORGQR( N, N, N, Z, LDZ, TAU, DWORK, LDWORK, $ INFO ) IF ( LSAME( JOBZ, 'F' ).OR.LSAME( JOBZ, 'I' ) ) THEN WRITE ( NOUT, FMT = 99995 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( Z(I,J), J = 1,N ) 40 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB01ZD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB01ZD = ',I2) 99997 FORMAT (' The order of the controllable state-space representati', $ 'on = ',I2,//' The state dynamics matrix A of a controlla', $ 'ble realization is ') 99996 FORMAT (/' The input/state vector B of a controllable realizatio', $ 'n is ',/(1X,F8.4)) 99995 FORMAT (/' The similarity transformation matrix Z is ') 99994 FORMAT (20(1X,F8.4)) 99993 FORMAT (/' N is out of range.',/' N = ',I5) 99992 FORMAT (/' P is out of range.',/' P = ',I5) 99991 FORMAT (/' The output/state matrix C of a controllable realizati', $ 'on is ') ENDProgram Data
TB01ZD EXAMPLE PROGRAM DATA 3 2 0.0 I 1.0 2.0 0.0 4.0 -1.0 0.0 0.0 0.0 1.0 1.0 0.0 1.0 0.0 2.0 1.0 1.0 0.0 0.0Program Results
TB01ZD EXAMPLE PROGRAM RESULTS The order of the controllable state-space representation = 3 The state dynamics matrix A of a controllable realization is 1.0000 1.4142 0.0000 2.8284 -1.0000 2.8284 0.0000 1.4142 1.0000 The input/state vector B of a controllable realization is -1.4142 0.0000 0.0000 The output/state matrix C of a controllable realization is -0.7071 -2.0000 0.7071 -0.7071 0.0000 -0.7071 The similarity transformation matrix Z is -0.7071 0.0000 -0.7071 0.0000 -1.0000 0.0000 -0.7071 0.0000 0.7071
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB03AD.html 0000664 0000000 0000000 00000045251 14560147231 0020336 0 ustar 00root root 0000000 0000000
Purpose
To find a relatively prime left polynomial matrix representation inv(P(s))*Q(s) or right polynomial matrix representation Q(s)*inv(P(s)) with the same transfer matrix T(s) as that of a given state-space representation, i.e. inv(P(s))*Q(s) = Q(s)*inv(P(s)) = T(s) = C*inv(s*I-A)*B + D.Specification
SUBROUTINE TB03AD( LERI, EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, $ D, LDD, NR, INDEX, PCOEFF, LDPCO1, LDPCO2, $ QCOEFF, LDQCO1, LDQCO2, VCOEFF, LDVCO1, LDVCO2, $ TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL, LERI INTEGER INFO, LDA, LDB, LDC, LDD, LDPCO1, LDPCO2, $ LDQCO1, LDQCO2, LDVCO1, LDVCO2, LDWORK, M, N, $ NR, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INDEX(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), PCOEFF(LDPCO1,LDPCO2,*), $ QCOEFF(LDQCO1,LDQCO2,*), VCOEFF(LDVCO1,LDVCO2,*)Arguments
Mode Parameters
LERI CHARACTER*1 Indicates whether the left polynomial matrix representation or the right polynomial matrix representation is required as follows: = 'L': A left matrix fraction is required; = 'R': A right matrix fraction is required. EQUIL CHARACTER*1 Specifies whether the user wishes to balance the triplet (A,B,C), before computing a minimal state-space representation, as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
N (input) INTEGER The order of the state-space representation, i.e. the order of the original state dynamics matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading NR-by-NR part of this array contains the upper block Hessenberg state dynamics matrix Amin of a minimal realization for the original system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) On entry, the leading N-by-M part of this array must contain the original input/state matrix B; the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. On exit, the leading NR-by-M part of this array contains the transformed input/state matrix Bmin. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C; the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. On exit, the leading P-by-NR part of this array contains the transformed state/output matrix Cmin. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P). D (input) DOUBLE PRECISION array, dimension (LDD,MAX(M,P)) The leading P-by-M part of this array must contain the original direct transmission matrix D; the remainder of the leading MAX(M,P)-by-MAX(M,P) part is used as internal workspace. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,M,P). NR (output) INTEGER The order of the minimal state-space representation (Amin,Bmin,Cmin). INDEX (output) INTEGER array, dimension (P), if LERI = 'L', or dimension (M), if LERI = 'R'. If LERI = 'L', INDEX(I), I = 1,2,...,P, contains the maximum degree of the polynomials in the I-th row of the denominator matrix P(s) of the left polynomial matrix representation. These elements are ordered so that INDEX(1) >= INDEX(2) >= ... >= INDEX(P). If LERI = 'R', INDEX(I), I = 1,2,...,M, contains the maximum degree of the polynomials in the I-th column of the denominator matrix P(s) of the right polynomial matrix representation. These elements are ordered so that INDEX(1) >= INDEX(2) >= ... >= INDEX(M). PCOEFF (output) DOUBLE PRECISION array, dimension (LDPCO1,LDPCO2,N+1) If LERI = 'L' then porm = P, otherwise porm = M. The leading porm-by-porm-by-kpcoef part of this array contains the coefficients of the denominator matrix P(s), where kpcoef = MAX(INDEX(I)) + 1. PCOEFF(I,J,K) is the coefficient in s**(INDEX(iorj)-K+1) of polynomial (I,J) of P(s), where K = 1,2,...,kpcoef; if LERI = 'L' then iorj = I, otherwise iorj = J. Thus for LERI = 'L', P(s) = diag(s**INDEX(I))*(PCOEFF(.,.,1)+PCOEFF(.,.,2)/s+...). LDPCO1 INTEGER The leading dimension of array PCOEFF. LDPCO1 >= MAX(1,P), if LERI = 'L'; LDPCO1 >= MAX(1,M), if LERI = 'R'. LDPCO2 INTEGER The second dimension of array PCOEFF. LDPCO2 >= MAX(1,P), if LERI = 'L'; LDPCO2 >= MAX(1,M), if LERI = 'R'. QCOEFF (output) DOUBLE PRECISION array, dimension (LDQCO1,LDQCO2,N+1) If LERI = 'L' then porp = M, otherwise porp = P. If LERI = 'L', the leading porm-by-porp-by-kpcoef part of this array contains the coefficients of the numerator matrix Q(s). If LERI = 'R', the leading porp-by-porm-by-kpcoef part of this array contains the coefficients of the numerator matrix Q(s). QCOEFF(I,J,K) is defined as for PCOEFF(I,J,K). LDQCO1 INTEGER The leading dimension of array QCOEFF. LDQCO1 >= MAX(1,P), if LERI = 'L'; LDQCO1 >= MAX(1,M,P), if LERI = 'R'. LDQCO2 INTEGER The second dimension of array QCOEFF. LDQCO2 >= MAX(1,M), if LERI = 'L'; LDQCO2 >= MAX(1,M,P), if LERI = 'R'. VCOEFF (output) DOUBLE PRECISION array, dimension (LDVCO1,LDVCO2,N+1) The leading porm-by-NR-by-kpcoef part of this array contains the coefficients of the intermediate matrix V(s). VCOEFF(I,J,K) is defined as for PCOEFF(I,J,K). LDVCO1 INTEGER The leading dimension of array VCOEFF. LDVCO1 >= MAX(1,P), if LERI = 'L'; LDVCO1 >= MAX(1,M), if LERI = 'R'. LDVCO2 INTEGER The second dimension of array VCOEFF. LDVCO2 >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determination when transforming (A, B, C). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance (determined by the SLICOT routine TB01UD) is used instead.Workspace
IWORK INTEGER array, dimension (N+MAX(M,P)) On exit, if INFO = 0, the first nonzero elements of IWORK(1:N) return the orders of the diagonal blocks of A. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N + MAX(N, 3*M, 3*P), PM*(PM + 2)) where PM = P, if LERI = 'L'; PM = M, if LERI = 'R'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if a singular matrix was encountered during the computation of V(s); = 2: if a singular matrix was encountered during the computation of P(s).Method
The method for a left matrix fraction will be described here: right matrix fractions are dealt with by constructing a left fraction for the dual of the original system. The first step is to obtain, by means of orthogonal similarity transformations, a minimal state-space representation (Amin,Bmin,Cmin,D) for the original system (A,B,C,D), where Amin is lower block Hessenberg with all its superdiagonal blocks upper triangular and Cmin has all but its first rank(C) columns zero. The number and dimensions of the blocks of Amin now immediately yield the row degrees of P(s) with P(s) row proper: furthermore, the P-by-NR polynomial matrix V(s) (playing a similar role to S(s) in Wolovich's Structure Theorem) can be calculated a column block at a time, in reverse order, from Amin. P(s) is then found as if it were the O-th column block of V(s) (using Cmin as well as Amin), while Q(s) = (V(s) * Bmin) + (P(s) * D). Finally, a special similarity transformation is used to put Amin in an upper block Hessenberg form.References
[1] Williams, T.W.C. An Orthogonal Structure Theorem for Linear Systems. Kingston Polytechnic Control Systems Research Group, Internal Report 82/2, July 1982. [2] Patel, R.V. On Computing Matrix Fraction Descriptions and Canonical Forms of Linear Time-Invariant Systems. UMIST Control Systems Centre Report 489, 1980. (Algorithms 1 and 2, extensively modified).Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* TB03AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC, LDD, LDPCO1, LDPCO2, LDQCO1, $ LDQCO2, LDVCO1, LDVCO2, NMAXP1 PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = MAXMP, $ LDD = MAXMP, LDPCO1 = MAXMP, LDPCO2 = MAXMP, $ LDQCO1 = MAXMP, LDQCO2 = MAXMP, LDVCO1 = MAXMP, $ LDVCO2 = NMAX, NMAXP1 = NMAX+1 ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX + MAXMP ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX + MAX( NMAX, 3*MAXMP ), $ MAXMP*( MAXMP + 2 ) ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INDBLK, INFO, J, K, KPCOEF, M, N, NR, P, PORM, $ PORP CHARACTER*1 EQUIL, LERI LOGICAL LLERI * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAXMP), C(LDC,NMAX), $ D(LDD,MAXMP), DWORK(LDWORK), $ PCOEFF(LDPCO1,LDPCO2,NMAXP1), $ QCOEFF(LDQCO1,LDQCO2,NMAXP1), $ VCOEFF(LDVCO1,LDVCO2,NMAXP1) INTEGER INDEX(MAXMP), IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TB03AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, LERI, EQUIL LLERI = LSAME( LERI, 'L' ) IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99987 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99986 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99985 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find the right pmr which is equivalent to the ssr * C*inv(sI-A)*B+D. CALL TB03AD( LERI, EQUIL, N, M, P, A, LDA, B, LDB, C, $ LDC, D, LDD, NR, INDEX, PCOEFF, LDPCO1, $ LDPCO2, QCOEFF, LDQCO1, LDQCO2, VCOEFF, $ LDVCO1, LDVCO2, TOL, IWORK, DWORK, LDWORK, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR DO 20 I = 1, NR WRITE ( NOUT, FMT = 99996 ) ( A(I,J), J = 1,NR ) 20 CONTINUE INDBLK = 0 DO 40 I = 1, N IF ( IWORK(I).NE.0 ) INDBLK = INDBLK + 1 40 CONTINUE WRITE ( NOUT, FMT = 99995 ) ( IWORK(I), I = 1,INDBLK ) WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, NR WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,M ) 60 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,NR ) 80 CONTINUE IF ( LLERI ) THEN PORM = P PORP = M WRITE ( NOUT, FMT = 99992 ) INDBLK ELSE PORM = M PORP = P WRITE ( NOUT, FMT = 99991 ) INDBLK END IF WRITE ( NOUT, FMT = 99990 ) ( INDEX(I), I = 1,PORM ) KPCOEF = 0 DO 100 I = 1, PORM KPCOEF = MAX( KPCOEF, INDEX(I) ) 100 CONTINUE KPCOEF = KPCOEF + 1 WRITE ( NOUT, FMT = 99989 ) DO 140 I = 1, PORM DO 120 J = 1, PORM WRITE ( NOUT, FMT = 99996 ) $ ( PCOEFF(I,J,K), K = 1,KPCOEF ) 120 CONTINUE 140 CONTINUE WRITE ( NOUT, FMT = 99988 ) IF ( LLERI ) THEN DO 180 I = 1, PORM DO 160 J = 1, PORP WRITE ( NOUT, FMT = 99996 ) $ ( QCOEFF(I,J,K), K = 1,KPCOEF ) 160 CONTINUE 180 CONTINUE ELSE DO 220 I = 1, PORP DO 200 J = 1, PORM WRITE ( NOUT, FMT = 99996 ) $ ( QCOEFF(I,J,K), K = 1,KPCOEF ) 200 CONTINUE 220 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TB03AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB03AD = ',I2) 99997 FORMAT (' The order of the minimal state-space representation = ', $ I2,//' The transformed state dynamics matrix of a minimal', $ ' realization is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' and the dimensions of its diagonal blocks are ',/20(I5) $ ) 99994 FORMAT (/' The transformed input/state matrix of a minimal reali', $ 'zation is ') 99993 FORMAT (/' The transformed state/output matrix of a minimal real', $ 'ization is ') 99992 FORMAT (/' The observability index of the transformed minimal sy', $ 'stem representation = ',I2) 99991 FORMAT (/' The controllability index of the transformed minimal ', $ 'system representation = ',I2) 99990 FORMAT (/' INDEX is ',/20(I5)) 99989 FORMAT (/' The denominator matrix P(s) is ') 99988 FORMAT (/' The numerator matrix Q(s) is ') 99987 FORMAT (/' N is out of range.',/' N = ',I5) 99986 FORMAT (/' M is out of range.',/' M = ',I5) 99985 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB03AD EXAMPLE PROGRAM DATA 3 1 2 0.0 R N 1.0 2.0 0.0 4.0 -1.0 0.0 0.0 0.0 1.0 1.0 0.0 1.0 0.0 1.0 -1.0 0.0 0.0 1.0 0.0 1.0Program Results
TB03AD EXAMPLE PROGRAM RESULTS The order of the minimal state-space representation = 3 The transformed state dynamics matrix of a minimal realization is 1.0000 -1.4142 0.0000 -2.8284 -1.0000 2.8284 0.0000 1.4142 1.0000 and the dimensions of its diagonal blocks are 1 1 1 The transformed input/state matrix of a minimal realization is -1.4142 0.0000 0.0000 The transformed state/output matrix of a minimal realization is 0.7071 1.0000 0.7071 -0.7071 0.0000 -0.7071 The controllability index of the transformed minimal system representation = 3 INDEX is 3 The denominator matrix P(s) is 0.1768 -0.1768 -1.5910 1.5910 The numerator matrix Q(s) is 0.0000 -0.1768 0.7071 0.8839 0.1768 0.0000 -1.5910 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB04AD.html 0000664 0000000 0000000 00000042561 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
To find the transfer matrix T(s) of a given state-space representation (A,B,C,D). T(s) is expressed as either row or column polynomial vectors over monic least common denominator polynomials.Specification
SUBROUTINE TB04AD( ROWCOL, N, M, P, A, LDA, B, LDB, C, LDC, D, $ LDD, NR, INDEX, DCOEFF, LDDCOE, UCOEFF, LDUCO1, $ LDUCO2, TOL1, TOL2, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER ROWCOL INTEGER INFO, LDA, LDB, LDC, LDD, LDDCOE, LDUCO1, $ LDUCO2, LDWORK, M, N, NR, P DOUBLE PRECISION TOL1, TOL2 C .. Array Arguments .. INTEGER INDEX(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DCOEFF(LDDCOE,*), DWORK(*), $ UCOEFF(LDUCO1,LDUCO2,*)Arguments
Mode Parameters
ROWCOL CHARACTER*1 Indicates whether the transfer matrix T(s) is required as rows or columns over common denominators as follows: = 'R': T(s) is required as rows over common denominators; = 'C': T(s) is required as columns over common denominators.Input/Output Parameters
N (input) INTEGER The order of the state-space representation, i.e. the order of the original state dynamics matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading NR-by-NR part of this array contains the upper block Hessenberg state dynamics matrix A of a transformed representation for the original system: this is completely controllable if ROWCOL = 'R', or completely observable if ROWCOL = 'C'. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M), if ROWCOL = 'R', and (LDB,MAX(M,P)) if ROWCOL = 'C'. On entry, the leading N-by-M part of this array must contain the original input/state matrix B; if ROWCOL = 'C', the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. On exit, the leading NR-by-M part of this array contains the transformed input/state matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original state/output matrix C; if ROWCOL = 'C', the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. On exit, the leading P-by-NR part of this array contains the transformed state/output matrix C. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P) if ROWCOL = 'R'; LDC >= MAX(1,M,P) if ROWCOL = 'C'. D (input) DOUBLE PRECISION array, dimension (LDD,M), if ROWCOL = 'R', and (LDD,MAX(M,P)) if ROWCOL = 'C'. The leading P-by-M part of this array must contain the original direct transmission matrix D; if ROWCOL = 'C', this array is modified internally, but restored on exit, and the remainder of the leading MAX(M,P)-by-MAX(M,P) part is used as internal workspace. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P) if ROWCOL = 'R'; LDD >= MAX(1,M,P) if ROWCOL = 'C'. NR (output) INTEGER The order of the transformed state-space representation. INDEX (output) INTEGER array, dimension (porm), where porm = P, if ROWCOL = 'R', and porm = M, if ROWCOL = 'C'. The degrees of the denominator polynomials. DCOEFF (output) DOUBLE PRECISION array, dimension (LDDCOE,N+1) The leading porm-by-kdcoef part of this array contains the coefficients of each denominator polynomial, where kdcoef = MAX(INDEX(I)) + 1. DCOEFF(I,K) is the coefficient in s**(INDEX(I)-K+1) of the I-th denominator polynomial, where K = 1,2,...,kdcoef. LDDCOE INTEGER The leading dimension of array DCOEFF. LDDCOE >= MAX(1,P) if ROWCOL = 'R'; LDDCOE >= MAX(1,M) if ROWCOL = 'C'. UCOEFF (output) DOUBLE PRECISION array, dimension (LDUCO1,LDUCO2,N+1) If ROWCOL = 'R' then porp = M, otherwise porp = P. The leading porm-by-porp-by-kdcoef part of this array contains the coefficients of the numerator matrix U(s). UCOEFF(I,J,K) is the coefficient in s**(INDEX(iorj)-K+1) of polynomial (I,J) of U(s), where K = 1,2,...,kdcoef; if ROWCOL = 'R' then iorj = I, otherwise iorj = J. Thus for ROWCOL = 'R', U(s) = diag(s**INDEX(I))*(UCOEFF(.,.,1)+UCOEFF(.,.,2)/s+...). LDUCO1 INTEGER The leading dimension of array UCOEFF. LDUCO1 >= MAX(1,P) if ROWCOL = 'R'; LDUCO1 >= MAX(1,M) if ROWCOL = 'C'. LDUCO2 INTEGER The second dimension of array UCOEFF. LDUCO2 >= MAX(1,M) if ROWCOL = 'R'; LDUCO2 >= MAX(1,P) if ROWCOL = 'C'.Tolerances
TOL1 DOUBLE PRECISION The tolerance to be used in determining the i-th row of T(s), where i = 1,2,...,porm. If the user sets TOL1 > 0, then the given value of TOL1 is used as an absolute tolerance; elements with absolute value less than TOL1 are considered neglijible. If the user sets TOL1 <= 0, then an implicitly computed, default tolerance, defined in the SLICOT Library routine TB01ZD, is used instead. TOL2 DOUBLE PRECISION The tolerance to be used to separate out a controllable subsystem of (A,B,C). If the user sets TOL2 > 0, then the given value of TOL2 is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL2 is considered to be of full rank. If the user sets TOL2 <= 0, then an implicitly computed, default tolerance, defined in the SLICOT Library routine TB01UD, is used instead.Workspace
IWORK INTEGER array, dimension (N+MAX(M,P)) On exit, if INFO = 0, the first nonzero elements of IWORK(1:N) return the orders of the diagonal blocks of A. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N*(N + 1) + MAX(N*MP + 2*N + MAX(N,MP), 3*MP, PM)), where MP = M, PM = P, if ROWCOL = 'R'; MP = P, PM = M, if ROWCOL = 'C'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The method for transfer matrices factorized by rows will be described here: T(s) factorized by columns is dealt with by operating on the dual of the original system. Each row of T(s) is simply a single-output relatively left prime polynomial matrix representation, so can be calculated by applying a simplified version of the Orthogonal Structure Theorem to a minimal state-space representation for the corresponding row of the given system. A minimal state-space representation is obtained using the Orthogonal Canonical Form to first separate out a completely controllable one for the overall system and then, for each row in turn, applying it again to the resulting dual SIMO (single-input multi-output) system. Note that the elements of the transformed matrix A so calculated are individually scaled in a way which guarantees a monic denominator polynomial.References
[1] Williams, T.W.C. An Orthogonal Structure Theorem for Linear Systems. Control Systems Research Group, Kingston Polytechnic, Internal Report 82/2, 1982.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* TB04AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC, LDD, LDDCOE, LDUCO1, LDUCO2, $ NMAXP1 PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = MAXMP, $ LDD = MAXMP, LDDCOE = MAXMP, LDUCO1 = MAXMP, $ LDUCO2 = MAXMP, NMAXP1 = NMAX+1 ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX + MAXMP ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( NMAX + 1 ) + $ MAX( NMAX*MAXMP + 2*NMAX + $ MAX( NMAX, MAXMP ), 3*MAXMP ) ) * .. Local Scalars .. DOUBLE PRECISION TOL1, TOL2 INTEGER I, II, IJ, INDBLK, INFO, J, JJ, KDCOEF, M, N, $ NR, P, PORM, PORP CHARACTER*1 ROWCOL CHARACTER*132 ULINE LOGICAL LROWCO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAXMP), C(LDC,NMAX), $ D(LDD,MAXMP), DCOEFF(LDDCOE,NMAXP1), $ DWORK(LDWORK), UCOEFF(LDUCO1,LDUCO2,NMAXP1) INTEGER INDEX(MAXMP), IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TB04AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL1, TOL2, ROWCOL LROWCO = LSAME( ROWCOL, 'R' ) ULINE(1:20) = ' ' DO 20 I = 21, 132 ULINE(I:I) = '-' 20 CONTINUE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99986 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99985 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99984 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find the transfer matrix T(s) of (A,B,C,D). CALL TB04AD( ROWCOL, N, M, P, A, LDA, B, LDB, C, LDC, D, $ LDD, NR, INDEX, DCOEFF, LDDCOE, UCOEFF, $ LDUCO1, LDUCO2, TOL1, TOL2, IWORK, DWORK, $ LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR DO 40 I = 1, NR WRITE ( NOUT, FMT = 99996 ) ( A(I,J), J = 1,NR ) 40 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 60 I = 1, NR WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,M ) 60 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,NR ) 80 CONTINUE INDBLK = 0 DO 100 I = 1, N IF ( IWORK(I).NE.0 ) INDBLK = INDBLK + 1 100 CONTINUE IF ( LROWCO ) THEN PORM = P PORP = M WRITE ( NOUT, FMT = 99993 ) INDBLK, $ ( IWORK(I), I = 1,INDBLK ) ELSE PORM = M PORP = P WRITE ( NOUT, FMT = 99992 ) INDBLK, $ ( IWORK(I), I = 1,INDBLK ) END IF WRITE ( NOUT, FMT = 99991 ) ( INDEX(I), I = 1,PORM ) WRITE ( NOUT, FMT = 99990 ) KDCOEF = 0 DO 120 I = 1, PORM KDCOEF = MAX( KDCOEF, INDEX(I) ) 120 CONTINUE KDCOEF = KDCOEF + 1 DO 160 II = 1, PORM DO 140 JJ = 1, PORP WRITE ( NOUT, FMT = 99989 ) II, JJ, $ ( UCOEFF(II,JJ,IJ), IJ = 1,KDCOEF ) WRITE ( NOUT, FMT = 99988 ) ULINE(1:7*KDCOEF+21) WRITE ( NOUT, FMT = 99987 ) $ ( DCOEFF(II,IJ), IJ = 1,KDCOEF ) 140 CONTINUE 160 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB04AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB04AD = ',I2) 99997 FORMAT (' The order of the transformed state-space representatio', $ 'n = ',I2,//' The transformed state dynamics matrix A is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The transformed input/state matrix B is ') 99994 FORMAT (/' The transformed state/output matrix C is ') 99993 FORMAT (/' The controllability index of the transformed state-sp', $ 'ace representation = ',I2,//' The dimensions of the diag', $ 'onal blocks of the transformed A are ',/20(I5)) 99992 FORMAT (/' The observability index of the transformed state-spac', $ 'e representation = ',I2,//' The dimensions of the diagon', $ 'al blocks of the transformed A are ',/20(I5)) 99991 FORMAT (/' The degrees of the denominator polynomials are',/20(I5) $ ) 99990 FORMAT (/' The coefficients of polynomials in the transfer matri', $ 'x T(s) are ') 99989 FORMAT (/' element (',I2,',',I2,') is ',20(1X,F6.2)) 99988 FORMAT (1X,A) 99987 FORMAT (20X,20(1X,F6.2)) 99986 FORMAT (/' N is out of range.',/' N = ',I5) 99985 FORMAT (/' M is out of range.',/' M = ',I5) 99984 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB04AD EXAMPLE PROGRAM DATA 3 2 2 0.0 0.0 R -1.0 0.0 0.0 0.0 -2.0 0.0 0.0 0.0 -3.0 0.0 1.0 -1.0 1.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0Program Results
TB04AD EXAMPLE PROGRAM RESULTS The order of the transformed state-space representation = 3 The transformed state dynamics matrix A is -2.5000 -0.2887 -0.4082 -0.2887 -1.5000 -0.7071 -0.4082 -0.7071 -2.0000 The transformed input/state matrix B is -1.4142 -0.7071 0.0000 1.2247 0.0000 0.0000 The transformed state/output matrix C is 0.0000 0.8165 1.1547 0.0000 1.6330 0.5774 The controllability index of the transformed state-space representation = 2 The dimensions of the diagonal blocks of the transformed A are 2 1 The degrees of the denominator polynomials are 2 3 The coefficients of polynomials in the transfer matrix T(s) are element ( 1, 1) is 1.00 5.00 7.00 0.00 ----------------------------- 1.00 5.00 6.00 0.00 element ( 1, 2) is 0.00 1.00 3.00 0.00 ----------------------------- 1.00 5.00 6.00 0.00 element ( 2, 1) is 0.00 0.00 1.00 1.00 ----------------------------- 1.00 6.00 11.00 6.00 element ( 2, 2) is 1.00 8.00 20.00 15.00 ----------------------------- 1.00 6.00 11.00 6.00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB04BD.html 0000664 0000000 0000000 00000036653 14560147231 0020346 0 ustar 00root root 0000000 0000000
Purpose
To compute the transfer function matrix G of a state-space representation (A,B,C,D) of a linear time-invariant multivariable system, using the pole-zeros method. Each element of the transfer function matrix is returned in a cancelled, minimal form, with numerator and denominator polynomials stored either in increasing or decreasing order of the powers of the indeterminate.Specification
SUBROUTINE TB04BD( JOBD, ORDER, EQUIL, N, M, P, MD, A, LDA, B, $ LDB, C, LDC, D, LDD, IGN, LDIGN, IGD, LDIGD, $ GN, GD, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL, JOBD, ORDER DOUBLE PRECISION TOL INTEGER INFO, LDA, LDB, LDC, LDD, LDIGD, LDIGN, LDWORK, $ M, MD, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), GD(*), GN(*) INTEGER IGD(LDIGD,*), IGN(LDIGN,*), IWORK(*)Arguments
Mode Parameters
JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state-space model: = 'D': D is present; = 'Z': D is assumed to be a zero matrix. ORDER CHARACTER*1 Specifies the order in which the polynomial coefficients are stored, as follows: = 'I': Increasing order of powers of the indeterminate; = 'D': Decreasing order of powers of the indeterminate. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration.Input/Output Parameters
N (input) INTEGER The order of the system (A,B,C,D). N >= 0. M (input) INTEGER The number of the system inputs. M >= 0. P (input) INTEGER The number of the system outputs. P >= 0. MD (input) INTEGER The maximum degree of the polynomials in G, plus 1. An upper bound for MD is N+1. MD >= 1. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, if EQUIL = 'S', the leading N-by-N part of this array contains the balanced matrix inv(S)*A*S, as returned by SLICOT Library routine TB01ID. If EQUIL = 'N', this array is unchanged on exit. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the contents of B are destroyed: all elements but those in the first row are set to zero. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, if EQUIL = 'S', the leading P-by-N part of this array contains the balanced matrix C*S, as returned by SLICOT Library routine TB01ID. If EQUIL = 'N', this array is unchanged on exit. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) If JOBD = 'D', the leading P-by-M part of this array must contain the matrix D. If JOBD = 'Z', the array D is not referenced. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P), if JOBD = 'D'; LDD >= 1, if JOBD = 'Z'. IGN (output) INTEGER array, dimension (LDIGN,M) The leading P-by-M part of this array contains the degrees of the numerator polynomials in the transfer function matrix G. Specifically, the (i,j) element of IGN contains the degree of the numerator polynomial of the transfer function G(i,j) from the j-th input to the i-th output. LDIGN INTEGER The leading dimension of array IGN. LDIGN >= max(1,P). IGD (output) INTEGER array, dimension (LDIGD,M) The leading P-by-M part of this array contains the degrees of the denominator polynomials in the transfer function matrix G. Specifically, the (i,j) element of IGD contains the degree of the denominator polynomial of the transfer function G(i,j). LDIGD INTEGER The leading dimension of array IGD. LDIGD >= max(1,P). GN (output) DOUBLE PRECISION array, dimension (P*M*MD) This array contains the coefficients of the numerator polynomials, Num(i,j), of the transfer function matrix G. The polynomials are stored in a column-wise order, i.e., Num(1,1), Num(2,1), ..., Num(P,1), Num(1,2), Num(2,2), ..., Num(P,2), ..., Num(1,M), Num(2,M), ..., Num(P,M); MD memory locations are reserved for each polynomial, hence, the (i,j) polynomial is stored starting from the location ((j-1)*P+i-1)*MD+1. The coefficients appear in increasing or decreasing order of the powers of the indeterminate, according to ORDER. GD (output) DOUBLE PRECISION array, dimension (P*M*MD) This array contains the coefficients of the denominator polynomials, Den(i,j), of the transfer function matrix G. The polynomials are stored in the same way as the numerator polynomials.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining the controllability of a single-input system (A,b) or (A',c'), where b and c' are columns in B and C' (C transposed). If the user sets TOL > 0, then the given value of TOL is used as an absolute tolerance; elements with absolute value less than TOL are considered neglijible. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS*MAX( NORM(A), NORM(bc) ) is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH), and bc denotes the currently used column in B or C' (see METHOD).Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N*(N+P) + MAX( N + MAX( N,P ), N*(2*N+5))) If N >= P, N >= 1, the formula above can be written as LDWORK >= N*(3*N + P + 5). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the QR algorithm failed to converge when trying to compute the zeros of a transfer function; = 2: the QR algorithm failed to converge when trying to compute the poles of a transfer function. The errors INFO = 1 or 2 are unlikely to appear.Method
The routine implements the pole-zero method proposed in [1]. This method is based on an algorithm for computing the transfer function of a single-input single-output (SISO) system. Let (A,b,c,d) be a SISO system. Its transfer function is computed as follows: 1) Find a controllable realization (Ac,bc,cc) of (A,b,c). 2) Find an observable realization (Ao,bo,co) of (Ac,bc,cc). 3) Compute the r eigenvalues of Ao (the poles of (Ao,bo,co)). 4) Compute the zeros of (Ao,bo,co,d). 5) Compute the gain of (Ao,bo,co,d). This algorithm can be implemented using only orthogonal transformations [1]. However, for better efficiency, the implementation in TB04BD uses one elementary transformation in Step 4 and r elementary transformations in Step 5 (to reduce an upper Hessenberg matrix to upper triangular form). These special elementary transformations are numerically stable in practice. In the multi-input multi-output (MIMO) case, the algorithm computes each element (i,j) of the transfer function matrix G, for i = 1 : P, and for j = 1 : M. For efficiency reasons, Step 1 is performed once for each value of j (each column of B). The matrices Ac and Ao result in Hessenberg form.References
[1] Varga, A. and Sima, V. Numerically Stable Algorithm for Transfer Function Matrix Evaluation. Int. J. Control, vol. 33, nr. 6, pp. 1123-1133, 1981.Numerical Aspects
The algorithm is numerically stable in practice and requires about 20*N**3 floating point operations at most, but usually much less.Further Comments
For maximum efficiency of index calculations, GN and GD are implemented as one-dimensional arrays.Example
Program Text
* TB04BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX, MDMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20, $ MDMAX = NMAX + 1 ) INTEGER PMNMAX PARAMETER ( PMNMAX = PMAX*MMAX*MDMAX ) INTEGER LDA, LDB, LDC, LDD, LDIGD, LDIGN PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDIGD = PMAX, LDIGN = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( NMAX + PMAX ) + $ MAX( NMAX + MAX( NMAX, PMAX ), $ NMAX*( 2*NMAX + 5 ) ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, IJ, INFO, J, K, M, MD, N, P CHARACTER*1 JOBD, ORDER, EQUIL CHARACTER*132 ULINE * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), GD(PMNMAX), $ GN(PMNMAX) INTEGER IGD(LDIGD,MMAX), IGN(LDIGN,MMAX), IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TB04BD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, JOBD, ORDER, EQUIL MD = N + 1 ULINE(1:20) = ' ' DO 20 I = 21, 132 ULINE(I:I) = '-' 20 CONTINUE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99990 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99989 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find the transfer matrix T(s) of (A,B,C,D). CALL TB04BD( JOBD, ORDER, EQUIL, N, M, P, MD, A, LDA, B, $ LDB, C, LDC, D, LDD, IGN, LDIGN, IGD, LDIGD, $ GN, GD, TOL, IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( ORDER, 'I' ) ) THEN WRITE ( NOUT, FMT = 99997 ) ELSE WRITE ( NOUT, FMT = 99996 ) END IF WRITE ( NOUT, FMT = 99995 ) DO 60 J = 1, M DO 40 I = 1, P IJ = ( (J-1)*P + I-1 )*MD + 1 WRITE ( NOUT, FMT = 99994 ) I, J, $ ( GN(K), K = IJ,IJ+IGN(I,J) ) WRITE ( NOUT, FMT = 99993 ) $ ULINE(1:7*(IGD(I,J)+1)+21) WRITE ( NOUT, FMT = 99992 ) $ ( GD(K), K = IJ,IJ+IGD(I,J) ) 40 CONTINUE 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB04BD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB04BD = ',I2) 99997 FORMAT (/' The polynomial coefficients appear in increasing', $ ' order'/' of the powers of the indeterminate') 99996 FORMAT (/' The polynomial coefficients appear in decreasing', $ ' order'/' of the powers of the indeterminate') 99995 FORMAT (/' The coefficients of polynomials in the transfer matri', $ 'x T(s) are ') 99994 FORMAT (/' element (',I2,',',I2,') is ',20(1X,F6.2)) 99993 FORMAT (1X,A) 99992 FORMAT (20X,20(1X,F6.2)) 99991 FORMAT (/' N is out of range.',/' N = ',I5) 99990 FORMAT (/' M is out of range.',/' M = ',I5) 99989 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB04BD EXAMPLE PROGRAM DATA 3 2 2 0.0 D I N -1.0 0.0 0.0 0.0 -2.0 0.0 0.0 0.0 -3.0 0.0 1.0 -1.0 1.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0Program Results
TB04BD EXAMPLE PROGRAM RESULTS The polynomial coefficients appear in increasing order of the powers of the indeterminate The coefficients of polynomials in the transfer matrix T(s) are element ( 1, 1) is 7.00 5.00 1.00 ---------------------- 6.00 5.00 1.00 element ( 2, 1) is 1.00 ---------------------- 6.00 5.00 1.00 element ( 1, 2) is 1.00 --------------- 2.00 1.00 element ( 2, 2) is 5.00 5.00 1.00 ---------------------- 2.00 3.00 1.00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB04BV.html 0000664 0000000 0000000 00000013745 14560147231 0020365 0 ustar 00root root 0000000 0000000
Purpose
To separate the strictly proper part G0 from the constant part D of an P-by-M proper transfer function matrix G.Specification
SUBROUTINE TB04BV( ORDER, P, M, MD, IGN, LDIGN, IGD, LDIGD, GN, $ GD, D, LDD, TOL, INFO ) C .. Scalar Arguments .. CHARACTER ORDER DOUBLE PRECISION TOL INTEGER INFO, LDD, LDIGD, LDIGN, M, MD, P C .. Array Arguments .. DOUBLE PRECISION D(LDD,*), GD(*), GN(*) INTEGER IGD(LDIGD,*), IGN(LDIGN,*)Arguments
Mode Parameters
ORDER CHARACTER*1 Specifies the order in which the polynomial coefficients of the transfer function matrix are stored, as follows: = 'I': Increasing order of powers of the indeterminate; = 'D': Decreasing order of powers of the indeterminate.Input/Output Parameters
P (input) INTEGER The number of the system outputs. P >= 0. M (input) INTEGER The number of the system inputs. M >= 0. MD (input) INTEGER The maximum degree of the polynomials in G, plus 1, i.e., MD = MAX(IGD(I,J)) + 1. I,J IGN (input/output) INTEGER array, dimension (LDIGN,M) On entry, the leading P-by-M part of this array must contain the degrees of the numerator polynomials in G: the (i,j) element of IGN must contain the degree of the numerator polynomial of the polynomial ratio G(i,j). On exit, the leading P-by-M part of this array contains the degrees of the numerator polynomials in G0. LDIGN INTEGER The leading dimension of array IGN. LDIGN >= max(1,P). IGD (input) INTEGER array, dimension (LDIGD,M) The leading P-by-M part of this array must contain the degrees of the denominator polynomials in G (and G0): the (i,j) element of IGD contains the degree of the denominator polynomial of the polynomial ratio G(i,j). LDIGD INTEGER The leading dimension of array IGD. LDIGD >= max(1,P). GN (input/output) DOUBLE PRECISION array, dimension (P*M*MD) On entry, this array must contain the coefficients of the numerator polynomials, Num(i,j), of the transfer function matrix G. The polynomials are stored in a column-wise order, i.e., Num(1,1), Num(2,1), ..., Num(P,1), Num(1,2), Num(2,2), ..., Num(P,2), ..., Num(1,M), Num(2,M), ..., Num(P,M); MD memory locations are reserved for each polynomial, hence, the (i,j) polynomial is stored starting from the location ((j-1)*P+i-1)*MD+1. The coefficients appear in increasing or decreasing order of the powers of the indeterminate, according to ORDER. On exit, this array contains the coefficients of the numerator polynomials of the strictly proper part G0 of the transfer function matrix G, stored similarly. GD (input) DOUBLE PRECISION array, dimension (P*M*MD) This array must contain the coefficients of the denominator polynomials, Den(i,j), of the transfer function matrix G. The polynomials are stored as for the numerator polynomials. D (output) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array contains the matrix D. LDD INTEGER The leading dimension of array D. LDD >= max(1,P).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining the degrees of the numerators Num0(i,j) of the strictly proper part of the transfer function matrix G. If the user sets TOL > 0, then the given value of TOL is used as an absolute tolerance; the leading coefficients with absolute value less than TOL are considered neglijible. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = IGN(i,j)*EPS*NORM( Num(i,j) ) is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH), and NORM denotes the infinity norm (the maximum coefficient in absolute value).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the transfer function matrix is not proper; = 2: if a denominator polynomial is null.Method
The (i,j) entry of the real matrix D is zero, if the degree of Num(i,j), IGN(i,j), is less than the degree of Den(i,j), IGD(i,j), and it is given by the ratio of the leading coefficients of Num(i,j) and Den(i,j), if IGN(i,j) is equal to IGD(i,j), for i = 1 : P, and for j = 1 : M.Further Comments
For maximum efficiency of index calculations, GN and GD are implemented as one-dimensional arrays.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the sum of an P-by-M rational matrix G and a real P-by-M matrix D.Specification
SUBROUTINE TB04BW( ORDER, P, M, MD, IGN, LDIGN, IGD, LDIGD, GN, $ GD, D, LDD, INFO ) C .. Scalar Arguments .. CHARACTER ORDER INTEGER INFO, LDD, LDIGD, LDIGN, M, MD, P C .. Array Arguments .. DOUBLE PRECISION D(LDD,*), GD(*), GN(*) INTEGER IGD(LDIGD,*), IGN(LDIGN,*)Arguments
Mode Parameters
ORDER CHARACTER*1 Specifies the order in which the polynomial coefficients of the rational matrix are stored, as follows: = 'I': Increasing order of powers of the indeterminate; = 'D': Decreasing order of powers of the indeterminate.Input/Output Parameters
P (input) INTEGER The number of the system outputs. P >= 0. M (input) INTEGER The number of the system inputs. M >= 0. MD (input) INTEGER The maximum degree of the polynomials in G, plus 1, i.e., MD = MAX(IGN(I,J),IGD(I,J)) + 1. I,J IGN (input/output) INTEGER array, dimension (LDIGN,M) On entry, the leading P-by-M part of this array must contain the degrees of the numerator polynomials in G: the (i,j) element of IGN must contain the degree of the numerator polynomial of the polynomial ratio G(i,j). On exit, the leading P-by-M part of this array contains the degrees of the numerator polynomials in G + D. LDIGN INTEGER The leading dimension of array IGN. LDIGN >= max(1,P). IGD (input) INTEGER array, dimension (LDIGD,M) The leading P-by-M part of this array must contain the degrees of the denominator polynomials in G (and G + D): the (i,j) element of IGD contains the degree of the denominator polynomial of the polynomial ratio G(i,j). LDIGD INTEGER The leading dimension of array IGD. LDIGD >= max(1,P). GN (input/output) DOUBLE PRECISION array, dimension (P*M*MD) On entry, this array must contain the coefficients of the numerator polynomials, Num(i,j), of the rational matrix G. The polynomials are stored in a column-wise order, i.e., Num(1,1), Num(2,1), ..., Num(P,1), Num(1,2), Num(2,2), ..., Num(P,2), ..., Num(1,M), Num(2,M), ..., Num(P,M); MD memory locations are reserved for each polynomial, hence, the (i,j) polynomial is stored starting from the location ((j-1)*P+i-1)*MD+1. The coefficients appear in increasing or decreasing order of the powers of the indeterminate, according to ORDER. On exit, this array contains the coefficients of the numerator polynomials of the rational matrix G + D, stored similarly. GD (input) DOUBLE PRECISION array, dimension (P*M*MD) This array must contain the coefficients of the denominator polynomials, Den(i,j), of the rational matrix G. The polynomials are stored as for the numerator polynomials. D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the matrix D. LDD INTEGER The leading dimension of array D. LDD >= max(1,P).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The (i,j) entry of the real matrix D is added to the (i,j) entry of the matrix G, g(i,j), which is a ratio of two polynomials, for i = 1 : P, and for j = 1 : M. If g(i,j) = 0, it is assumed that its denominator is 1.Numerical Aspects
The algorithm is numerically stable.Further Comments
Often, the rational matrix G is found from a state-space representation (A,B,C), and D corresponds to the direct feedthrough matrix of the system. The sum G + D gives the transfer function matrix of the system (A,B,C,D). For maximum efficiency of index calculations, GN and GD are implemented as one-dimensional arrays.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the gain of a single-input single-output linear system, given its state-space representation (A,b,c,d), and its poles and zeros. The matrix A is assumed to be in an upper Hessenberg form. The gain is computed using the formula -1 IP IZ g = (c*( S0*I - A ) *b + d)*Prod( S0 - Pi )/Prod( S0 - Zi ) , i=1 i=1 (1) where Pi, i = 1 : IP, and Zj, j = 1 : IZ, are the poles and zeros, respectively, and S0 is a real scalar different from all poles and zeros.Specification
SUBROUTINE TB04BX( IP, IZ, A, LDA, B, C, D, PR, PI, ZR, ZI, GAIN, $ IWORK ) C .. Scalar Arguments .. DOUBLE PRECISION D, GAIN INTEGER IP, IZ, LDA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(*), C(*), PI(*), PR(*), ZI(*), $ ZR(*) INTEGER IWORK(*)Arguments
Input/Output Parameters
IP (input) INTEGER The number of the system poles. IP >= 0. IZ (input) INTEGER The number of the system zeros. IZ >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,IP) On entry, the leading IP-by-IP part of this array must contain the state dynamics matrix A in an upper Hessenberg form. The elements below the second diagonal are not referenced. On exit, the leading IP-by-IP upper Hessenberg part of this array contains the LU factorization of the matrix A - S0*I, as computed by SLICOT Library routine MB02SD. LDA INTEGER The leading dimension of array A. LDA >= max(1,IP). B (input/output) DOUBLE PRECISION array, dimension (IP) On entry, this array must contain the system input vector b. On exit, this array contains the solution of the linear system ( A - S0*I )x = b . C (input) DOUBLE PRECISION array, dimension (IP) This array must contain the system output vector c. D (input) DOUBLE PRECISION The variable must contain the system feedthrough scalar d. PR (input) DOUBLE PRECISION array, dimension (IP) This array must contain the real parts of the system poles. Pairs of complex conjugate poles must be stored in consecutive memory locations. PI (input) DOUBLE PRECISION array, dimension (IP) This array must contain the imaginary parts of the system poles. ZR (input) DOUBLE PRECISION array, dimension (IZ) This array must contain the real parts of the system zeros. Pairs of complex conjugate zeros must be stored in consecutive memory locations. ZI (input) DOUBLE PRECISION array, dimension (IZ) This array must contain the imaginary parts of the system zeros. GAIN (output) DOUBLE PRECISION The gain of the linear system (A,b,c,d), given by (1).Workspace
IWORK INTEGER array, dimension (IP) On exit, it contains the pivot indices; for 1 <= i <= IP, row i of the matrix A - S0*I was interchanged with row IWORK(i).Method
The routine implements the method presented in [1]. A suitable value of S0 is chosen based on the system poles and zeros. Then, the LU factorization of the upper Hessenberg, nonsingular matrix A - S0*I is computed and used to solve the linear system in (1).References
[1] Varga, A. and Sima, V. Numerically Stable Algorithm for Transfer Function Matrix Evaluation. Int. J. Control, vol. 33, nr. 6, pp. 1123-1133, 1981.Numerical Aspects
The algorithm is numerically stable in practice and requires O(IP*IP) floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the transfer function matrix G of a state-space representation (A,B,C,D) of a linear time-invariant multivariable system, using the pole-zeros method. The transfer function matrix is returned in a minimal pole-zero-gain form.Specification
SUBROUTINE TB04CD( JOBD, EQUIL, N, M, P, NPZ, A, LDA, B, LDB, C, $ LDC, D, LDD, NZ, LDNZ, NP, LDNP, ZEROSR, $ ZEROSI, POLESR, POLESI, GAINS, LDGAIN, TOL, $ IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL, JOBD DOUBLE PRECISION TOL INTEGER INFO, LDA, LDB, LDC, LDD, LDGAIN, LDNP, LDNZ, $ LDWORK, M, N, NPZ, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), GAINS(LDGAIN,*), POLESI(*), $ POLESR(*), ZEROSI(*), ZEROSR(*) INTEGER IWORK(*), NP(LDNP,*), NZ(LDNZ,*)Arguments
Mode Parameters
JOBD CHARACTER*1 Specifies whether or not a non-zero matrix D appears in the given state-space model: = 'D': D is present; = 'Z': D is assumed to be a zero matrix. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily equilibrate the triplet (A,B,C) as follows: = 'S': perform equilibration (scaling); = 'N': do not perform equilibration.Input/Output Parameters
N (input) INTEGER The order of the system (A,B,C,D). N >= 0. M (input) INTEGER The number of the system inputs. M >= 0. P (input) INTEGER The number of the system outputs. P >= 0. NPZ (input) INTEGER The maximum number of poles or zeros of the single-input single-output channels in the system. An upper bound for NPZ is N. NPZ >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, if EQUIL = 'S', the leading N-by-N part of this array contains the balanced matrix inv(S)*A*S, as returned by SLICOT Library routine TB01ID. If EQUIL = 'N', this array is unchanged on exit. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the contents of B are destroyed: all elements but those in the first row are set to zero. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, if EQUIL = 'S', the leading P-by-N part of this array contains the balanced matrix C*S, as returned by SLICOT Library routine TB01ID. If EQUIL = 'N', this array is unchanged on exit. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) If JOBD = 'D', the leading P-by-M part of this array must contain the matrix D. If JOBD = 'Z', the array D is not referenced. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P), if JOBD = 'D'; LDD >= 1, if JOBD = 'Z'. NZ (output) INTEGER array, dimension (LDNZ,M) The leading P-by-M part of this array contains the numbers of zeros of the elements of the transfer function matrix G. Specifically, the (i,j) element of NZ contains the number of zeros of the transfer function G(i,j) from the j-th input to the i-th output. LDNZ INTEGER The leading dimension of array NZ. LDNZ >= max(1,P). NP (output) INTEGER array, dimension (LDNP,M) The leading P-by-M part of this array contains the numbers of poles of the elements of the transfer function matrix G. Specifically, the (i,j) element of NP contains the number of poles of the transfer function G(i,j). LDNP INTEGER The leading dimension of array NP. LDNP >= max(1,P). ZEROSR (output) DOUBLE PRECISION array, dimension (P*M*NPZ) This array contains the real parts of the zeros of the transfer function matrix G. The real parts of the zeros are stored in a column-wise order, i.e., for the transfer functions (1,1), (2,1), ..., (P,1), (1,2), (2,2), ..., (P,2), ..., (1,M), (2,M), ..., (P,M); NPZ memory locations are reserved for each transfer function, hence, the real parts of the zeros for the (i,j) transfer function are stored starting from the location ((j-1)*P+i-1)*NPZ+1. Pairs of complex conjugate zeros are stored in consecutive memory locations. Note that only the first NZ(i,j) entries are initialized for the (i,j) transfer function. ZEROSI (output) DOUBLE PRECISION array, dimension (P*M*NPZ) This array contains the imaginary parts of the zeros of the transfer function matrix G, stored in a similar way as the real parts of the zeros. POLESR (output) DOUBLE PRECISION array, dimension (P*M*NPZ) This array contains the real parts of the poles of the transfer function matrix G, stored in the same way as the zeros. Note that only the first NP(i,j) entries are initialized for the (i,j) transfer function. POLESI (output) DOUBLE PRECISION array, dimension (P*M*NPZ) This array contains the imaginary parts of the poles of the transfer function matrix G, stored in the same way as the poles. GAINS (output) DOUBLE PRECISION array, dimension (LDGAIN,M) The leading P-by-M part of this array contains the gains of the transfer function matrix G. Specifically, GAINS(i,j) contains the gain of the transfer function G(i,j). LDGAIN INTEGER The leading dimension of array GAINS. LDGAIN >= max(1,P).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining the controllability of a single-input system (A,b) or (A',c'), where b and c' are columns in B and C' (C transposed). If the user sets TOL > 0, then the given value of TOL is used as an absolute tolerance; elements with absolute value less than TOL are considered neglijible. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*EPS*MAX( NORM(A), NORM(bc) ) is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH), and bc denotes the currently used column in B or C' (see METHOD).Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N*(N+P) + MAX( N + MAX( N,P ), N*(2*N+3))) If N >= P, N >= 1, the formula above can be written as LDWORK >= N*(3*N + P + 3). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the QR algorithm failed to converge when trying to compute the zeros of a transfer function; = 2: the QR algorithm failed to converge when trying to compute the poles of a transfer function. The errors INFO = 1 or 2 are unlikely to appear.Method
The routine implements the pole-zero method proposed in [1]. This method is based on an algorithm for computing the transfer function of a single-input single-output (SISO) system. Let (A,b,c,d) be a SISO system. Its transfer function is computed as follows: 1) Find a controllable realization (Ac,bc,cc) of (A,b,c). 2) Find an observable realization (Ao,bo,co) of (Ac,bc,cc). 3) Compute the r eigenvalues of Ao (the poles of (Ao,bo,co)). 4) Compute the zeros of (Ao,bo,co,d). 5) Compute the gain of (Ao,bo,co,d). This algorithm can be implemented using only orthogonal transformations [1]. However, for better efficiency, the implementation in TB04CD uses one elementary transformation in Step 4 and r elementary transformations in Step 5 (to reduce an upper Hessenberg matrix to upper triangular form). These special elementary transformations are numerically stable in practice. In the multi-input multi-output (MIMO) case, the algorithm computes each element (i,j) of the transfer function matrix G, for i = 1 : P, and for j = 1 : M. For efficiency reasons, Step 1 is performed once for each value of j (each column of B). The matrices Ac and Ao result in Hessenberg form.References
[1] Varga, A. and Sima, V. Numerically Stable Algorithm for Transfer Function Matrix Evaluation. Int. J. Control, vol. 33, nr. 6, pp. 1123-1133, 1981.Numerical Aspects
The algorithm is numerically stable in practice and requires about 20*N**3 floating point operations at most, but usually much less.Further Comments
NoneExample
Program Text
* TB04CD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX, NPZMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20, $ NPZMAX = NMAX ) INTEGER PMNMAX PARAMETER ( PMNMAX = PMAX*MMAX*NPZMAX ) INTEGER LDA, LDB, LDC, LDD, LDGAIN, LDNP, LDNZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDGAIN = PMAX, LDNP = PMAX, $ LDNZ = PMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX*( NMAX + PMAX ) + $ MAX( NMAX + MAX( NMAX, PMAX ), $ NMAX*( 2*NMAX + 3 ) ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, IJ, INFO, J, K, M, N, NPZ, P CHARACTER*1 JOBD, EQUIL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), GAINS(LDGAIN,MMAX), $ POLESI(PMNMAX), POLESR(PMNMAX), ZEROSI(PMNMAX), $ ZEROSR(PMNMAX) INTEGER IWORK(LIWORK), NP(LDNP,MMAX), NZ(LDNZ,MMAX) * .. External Subroutines .. EXTERNAL TB04CD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, JOBD, EQUIL NPZ = N IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99990 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find the transfer matrix T(s) of (A,B,C,D) in the * pole-zero-gain form. CALL TB04CD( JOBD, EQUIL, N, M, P, NPZ, A, LDA, B, LDB, $ C, LDC, D, LDD, NZ, LDNZ, NP, LDNP, ZEROSR, $ ZEROSI, POLESR, POLESI, GAINS, LDGAIN, TOL, $ IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 60 J = 1, M DO 40 I = 1, P IJ = ( (J-1)*P + I-1 )*NPZ + 1 IF ( NZ(I,J).EQ.0 ) THEN WRITE ( NOUT, FMT = 99996 ) I, J ELSE WRITE ( NOUT, FMT = 99995 ) I, J, $ ( ZEROSR(K), ZEROSI(K), $ K = IJ,IJ+NZ(I,J)-1 ) END IF WRITE ( NOUT, FMT = 99994 ) I, J, $ ( POLESR(K), POLESI(K), K = IJ,IJ+NP(I,J)-1 ) WRITE ( NOUT, FMT = 99993 ) I, J, ( GAINS(I,J) ) 40 CONTINUE 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB04CD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB04CD = ',I2) 99997 FORMAT (/' The poles, zeros and gains of the transfer matrix', $ ' elements: ') 99996 FORMAT (/' no zeros for element (',I2,',',I2,')') 99995 FORMAT (/' zeros of element (',I2,',',I2,') are ',// $ ' real part imag part '// (2X,F9.4,5X,F9.4)) 99994 FORMAT (/' poles of element (',I2,',',I2,') are ',// $ ' real part imag part '// (2X,F9.4,5X,F9.4)) 99993 FORMAT (/' gain of element (',I2,',',I2,') is ', F9.4) 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' M is out of range.',/' M = ',I5) 99990 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB04CD EXAMPLE PROGRAM DATA 3 2 2 0.0 D N -1.0 0.0 0.0 0.0 -2.0 0.0 0.0 0.0 -3.0 0.0 1.0 -1.0 1.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0Program Results
TB04CD EXAMPLE PROGRAM RESULTS The poles, zeros and gains of the transfer matrix elements: zeros of element ( 1, 1) are real part imag part -2.5000 0.8660 -2.5000 -0.8660 poles of element ( 1, 1) are real part imag part -2.0000 0.0000 -3.0000 0.0000 gain of element ( 1, 1) is 1.0000 no zeros for element ( 2, 1) poles of element ( 2, 1) are real part imag part -2.0000 0.0000 -3.0000 0.0000 gain of element ( 2, 1) is 1.0000 no zeros for element ( 1, 2) poles of element ( 1, 2) are real part imag part -2.0000 0.0000 gain of element ( 1, 2) is 1.0000 zeros of element ( 2, 2) are real part imag part -3.6180 0.0000 -1.3820 0.0000 poles of element ( 2, 2) are real part imag part -1.0000 0.0000 -2.0000 0.0000 gain of element ( 2, 2) is 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TB05AD.html 0000664 0000000 0000000 00000032436 14560147231 0020341 0 ustar 00root root 0000000 0000000
Purpose
To find the complex frequency response matrix (transfer matrix) G(freq) of the state-space representation (A,B,C) given by -1 G(freq) = C * ((freq*I - A) ) * B where A, B and C are real N-by-N, N-by-M and P-by-N matrices respectively and freq is a complex scalar.Specification
SUBROUTINE TB05AD( BALEIG, INITA, N, M, P, FREQ, A, LDA, B, LDB, $ C, LDC, RCOND, G, LDG, EVRE, EVIM, HINVB, $ LDHINV, IWORK, DWORK, LDWORK, ZWORK, LZWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER BALEIG, INITA INTEGER INFO, LDA, LDB, LDC, LDG, LDHINV, LDWORK, $ LZWORK, M, N, P DOUBLE PRECISION RCOND COMPLEX*16 FREQ C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), EVIM(*), $ EVRE(*) COMPLEX*16 ZWORK(*), G(LDG,*), HINVB(LDHINV,*)Arguments
Mode Parameters
BALEIG CHARACTER*1 Determines whether the user wishes to balance matrix A and/or compute its eigenvalues and/or estimate the condition number of the problem as follows: = 'N': The matrix A should not be balanced and neither the eigenvalues of A nor the condition number estimate of the problem are to be calculated; = 'C': The matrix A should not be balanced and only an estimate of the condition number of the problem is to be calculated; = 'B' or 'E' and INITA = 'G': The matrix A is to be balanced and its eigenvalues calculated; = 'A' and INITA = 'G': The matrix A is to be balanced, and its eigenvalues and an estimate of the condition number of the problem are to be calculated. INITA CHARACTER*1 Specifies whether or not the matrix A is already in upper Hessenberg form as follows: = 'G': The matrix A is a general matrix; = 'H': The matrix A is in upper Hessenberg form and neither balancing nor the eigenvalues of A are required. INITA must be set to 'G' for the first call to the routine, unless the matrix A is already in upper Hessenberg form and neither balancing nor the eigenvalues of A are required. Thereafter, it must be set to 'H' for all subsequent calls.Input/Output Parameters
N (input) INTEGER The number of states, i.e. the order of the state transition matrix A. N >= 0. M (input) INTEGER The number of inputs, i.e. the number of columns in the matrix B. M >= 0. P (input) INTEGER The number of outputs, i.e. the number of rows in the matrix C. P >= 0. FREQ (input) COMPLEX*16 The frequency freq at which the frequency response matrix (transfer matrix) is to be evaluated. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state transition matrix A. If INITA = 'G', then, on exit, the leading N-by-N part of this array contains an upper Hessenberg matrix similar to (via an orthogonal matrix consisting of a sequence of Householder transformations) the original state transition matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix B. If INITA = 'G', then, on exit, the leading N-by-M part of this array contains the product of the transpose of the orthogonal transformation matrix used to reduce A to upper Hessenberg form and the original input/state matrix B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. If INITA = 'G', then, on exit, the leading P-by-N part of this array contains the product of the original output/ state matrix C and the orthogonal transformation matrix used to reduce A to upper Hessenberg form. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). RCOND (output) DOUBLE PRECISION If BALEIG = 'C' or BALEIG = 'A', then RCOND contains an estimate of the reciprocal of the condition number of matrix H with respect to inversion (see METHOD). G (output) COMPLEX*16 array, dimension (LDG,M) The leading P-by-M part of this array contains the frequency response matrix G(freq). LDG INTEGER The leading dimension of array G. LDG >= MAX(1,P). EVRE, (output) DOUBLE PRECISION arrays, dimension (N) EVIM If INITA = 'G' and BALEIG = 'B' or 'E' or BALEIG = 'A', then these arrays contain the real and imaginary parts, respectively, of the eigenvalues of the matrix A. Otherwise, these arrays are not referenced. HINVB (output) COMPLEX*16 array, dimension (LDHINV,M) The leading N-by-M part of this array contains the -1 product H B. LDHINV INTEGER The leading dimension of array HINVB. LDHINV >= MAX(1,N).Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N - 1 + MAX(N,M,P)), if INITA = 'G' and BALEIG = 'N', or 'B', or 'E'; LDWORK >= MAX(1, N + MAX(N,M-1,P-1)), if INITA = 'G' and BALEIG = 'C', or 'A'; LDWORK >= MAX(1, 2*N), if INITA = 'H' and BALEIG = 'C', or 'A'; LDWORK >= 1, otherwise. For optimum performance when INITA = 'G' LDWORK should be larger. ZWORK COMPLEX*16 array, dimension (LZWORK) LZWORK INTEGER The length of the array ZWORK. LZWORK >= MAX(1,N*N+2*N), if BALEIG = 'C', or 'A'; LZWORK >= MAX(1,N*N), otherwise.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if more than 30*N iterations are required to isolate all the eigenvalues of the matrix A; the computations are continued; = 2: if either FREQ is too near to an eigenvalue of the matrix A, or RCOND is less than EPS, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Method
The matrix A is first balanced (if BALEIG = 'B' or 'E', or BALEIG = 'A') and then reduced to upper Hessenberg form; the same transformations are applied to the matrix B and the matrix C. The complex Hessenberg matrix H = (freq*I - A) is then used -1 to solve for C * H * B. Depending on the input values of parameters BALEIG and INITA, the eigenvalues of matrix A and the condition number of matrix H with respect to inversion are also calculated.References
[1] Laub, A.J. Efficient Calculation of Frequency Response Matrices from State-Space Models. ACM TOMS, 12, pp. 26-33, 1986.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* TB05AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDG, LDHINV PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, LDG = PMAX, $ LDHINV = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 2*NMAX ) INTEGER LZWORK PARAMETER ( LZWORK = NMAX*( NMAX+2 ) ) * .. Local Scalars .. COMPLEX*16 FREQ DOUBLE PRECISION RCOND INTEGER I, INFO, J, M, N, P CHARACTER*1 BALEIG, INITA LOGICAL LBALBA, LBALEA, LBALEB, LBALEC, LINITA * .. Local Arrays .. COMPLEX*16 G(LDG,MMAX), HINVB(LDHINV,MMAX), ZWORK(LZWORK) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), EVIM(NMAX), EVRE(NMAX) INTEGER IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TB05AD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, FREQ, INITA, BALEIG LBALEC = LSAME( BALEIG, 'C' ) LBALEB = LSAME( BALEIG, 'B' ) .OR. LSAME( BALEIG, 'E' ) LBALEA = LSAME( BALEIG, 'A' ) LBALBA = LBALEB.OR.LBALEA LINITA = LSAME( INITA, 'G' ) IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99992 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99990 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the frequency response matrix of the ssr (A,B,C). CALL TB05AD( BALEIG, INITA, N, M, P, FREQ, A, LDA, B, $ LDB, C, LDC, RCOND, G, LDG, EVRE, EVIM, $ HINVB, LDHINV, IWORK, DWORK, LDWORK, ZWORK, $ LZWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( ( LBALEC ) .OR. ( LBALEA ) ) WRITE ( NOUT, $ FMT = 99997 ) RCOND IF ( ( LINITA ) .AND. ( LBALBA ) ) $ WRITE ( NOUT, FMT = 99996 ) $ ( EVRE(I), EVIM(I), I = 1,N ) WRITE ( NOUT, FMT = 99995 ) DO 20 I = 1, P WRITE ( NOUT, FMT = 99994 ) ( G(I,J), J = 1,M ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99994 ) ( HINVB(I,J), J = 1,M ) 40 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TB05AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TB05AD = ',I2) 99997 FORMAT (' RCOND = ',F4.2) 99996 FORMAT (/' Eigenvalues of the state transmission matrix A are ', $ /(1X,2F7.2,'*j')) 99995 FORMAT (/' The frequency response matrix G(freq) is ') 99994 FORMAT (20(' (',F5.2,',',F5.2,') ',:)) 99993 FORMAT (/' H(inverse)*B is ') 99992 FORMAT (/' N is out of range.',/' N = ',I5) 99991 FORMAT (/' M is out of range.',/' M = ',I5) 99990 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TB05AD EXAMPLE PROGRAM DATA 3 1 2 (0.0,0.5) G A 1.0 2.0 0.0 4.0 -1.0 0.0 0.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 -1.0 0.0 0.0 1.0Program Results
TB05AD EXAMPLE PROGRAM RESULTS RCOND = 0.22 Eigenvalues of the state transmission matrix A are 3.00 0.00*j -3.00 0.00*j 1.00 0.00*j The frequency response matrix G(freq) is ( 0.69, 0.35) (-0.80,-0.40) H(inverse)*B is (-0.11,-0.05) (-0.43, 0.00) (-0.80,-0.40)
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TC01OD.html 0000664 0000000 0000000 00000020563 14560147231 0020352 0 ustar 00root root 0000000 0000000
Purpose
To find the dual right (left) polynomial matrix representation of a given left (right) polynomial matrix representation, where the right and left polynomial matrix representations are of the form Q(s)*inv(P(s)) and inv(P(s))*Q(s) respectively.Specification
SUBROUTINE TC01OD( LERI, M, P, INDLIM, PCOEFF, LDPCO1, LDPCO2, $ QCOEFF, LDQCO1, LDQCO2, INFO ) C .. Scalar Arguments .. CHARACTER LERI INTEGER INFO, INDLIM, LDPCO1, LDPCO2, LDQCO1, LDQCO2, M, $ P C .. Array Arguments .. DOUBLE PRECISION PCOEFF(LDPCO1,LDPCO2,*), QCOEFF(LDQCO1,LDQCO2,*)Arguments
Mode Parameters
LERI CHARACTER*1 Indicates whether a left or right matrix fraction is input as follows: = 'L': A left matrix fraction is input; = 'R': A right matrix fraction is input.Input/Output Parameters
M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. INDLIM (input) INTEGER The highest value of K for which PCOEFF(.,.,K) and QCOEFF(.,.,K) are to be transposed. K = kpcoef + 1, where kpcoef is the maximum degree of the polynomials in P(s). INDLIM >= 1. PCOEFF (input/output) DOUBLE PRECISION array, dimension (LDPCO1,LDPCO2,INDLIM) If LERI = 'L' then porm = P, otherwise porm = M. On entry, the leading porm-by-porm-by-INDLIM part of this array must contain the coefficients of the denominator matrix P(s). PCOEFF(I,J,K) is the coefficient in s**(INDLIM-K) of polynomial (I,J) of P(s), where K = 1,2,...,INDLIM. On exit, the leading porm-by-porm-by-INDLIM part of this array contains the coefficients of the denominator matrix P'(s) of the dual system. LDPCO1 INTEGER The leading dimension of array PCOEFF. LDPCO1 >= MAX(1,P) if LERI = 'L', LDPCO1 >= MAX(1,M) if LERI = 'R'. LDPCO2 INTEGER The second dimension of array PCOEFF. LDPCO2 >= MAX(1,P) if LERI = 'L', LDPCO2 >= MAX(1,M) if LERI = 'R'. QCOEFF (input/output) DOUBLE PRECISION array, dimension (LDQCO1,LDQCO2,INDLIM) On entry, the leading P-by-M-by-INDLIM part of this array must contain the coefficients of the numerator matrix Q(s). QCOEFF(I,J,K) is the coefficient in s**(INDLIM-K) of polynomial (I,J) of Q(s), where K = 1,2,...,INDLIM. On exit, the leading M-by-P-by-INDLIM part of the array contains the coefficients of the numerator matrix Q'(s) of the dual system. LDQCO1 INTEGER The leading dimension of array QCOEFF. LDQCO1 >= MAX(1,M,P). LDQCO2 INTEGER The second dimension of array QCOEFF. LDQCO2 >= MAX(1,M,P).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
If the given M-input/P-output left (right) polynomial matrix representation has numerator matrix Q(s) and denominator matrix P(s), its dual P-input/M-output right (left) polynomial matrix representation simply has numerator matrix Q'(s) and denominator matrix P'(s).References
None.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* TC01OD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, PMAX, INDMAX PARAMETER ( MMAX = 20, PMAX = 20, INDMAX = 20 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDPCO1, LDPCO2, LDQCO1, LDQCO2 PARAMETER ( LDPCO1 = MAXMP, LDPCO2 = MAXMP, $ LDQCO1 = MAXMP, LDQCO2 = MAXMP ) * .. Local Scalars .. INTEGER I, INDLIM, INFO, J, K, M, P, PORM CHARACTER*1 LERI LOGICAL LLERI * .. Local Arrays .. DOUBLE PRECISION PCOEFF(LDPCO1,LDPCO2,INDMAX), $ QCOEFF(LDQCO1,LDQCO2,INDMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TC01OD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, P, INDLIM, LERI LLERI = LSAME( LERI, 'L' ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99994 ) M ELSE IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99993 ) P ELSE IF ( INDLIM.LE.0 .OR. INDLIM.GT.INDMAX ) THEN WRITE ( NOUT, FMT = 99992 ) INDLIM ELSE PORM = P IF ( .NOT.LLERI ) PORM = M READ ( NIN, FMT = * ) $ ( ( ( PCOEFF(I,J,K), K = 1,INDLIM ), J = 1,PORM ), $ I = 1,PORM ) READ ( NIN, FMT = * ) $ ( ( ( QCOEFF(I,J,K), K = 1,INDLIM ), J = 1,M ), I = 1,P ) * Find the dual right pmr of the given left pmr. CALL TC01OD( LERI, M, P, INDLIM, PCOEFF, LDPCO1, LDPCO2, $ QCOEFF, LDQCO1, LDQCO2, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 40 I = 1, PORM DO 20 J = 1, PORM WRITE ( NOUT, FMT = 99996 ) I, J, $ ( PCOEFF(I,J,K), K = 1,INDLIM ) 20 CONTINUE 40 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 80 I = 1, M DO 60 J = 1, P WRITE ( NOUT, FMT = 99996 ) I, J, $ ( QCOEFF(I,J,K), K = 1,INDLIM ) 60 CONTINUE 80 CONTINUE END IF END IF STOP * 99999 FORMAT (' TC01OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TC01OD = ',I2) 99997 FORMAT (' The coefficients of the denominator matrix of the dual', $ ' system are ') 99996 FORMAT (/' element (',I2,',',I2,') is ',20(1X,F6.2)) 99995 FORMAT (//' The coefficients of the numerator matrix of the dual', $ ' system are ') 99994 FORMAT (/' M is out of range.',/' M = ',I5) 99993 FORMAT (/' P is out of range.',/' P = ',I5) 99992 FORMAT (/' INDLIM is out of range.',/' INDLIM = ',I5) ENDProgram Data
TC01OD EXAMPLE PROGRAM DATA 2 2 3 L 2.0 3.0 1.0 4.0 -1.0 -1.0 5.0 7.0 -6.0 3.0 2.0 2.0 6.0 -1.0 5.0 1.0 7.0 5.0 1.0 1.0 1.0 4.0 1.0 -1.0Program Results
TC01OD EXAMPLE PROGRAM RESULTS The coefficients of the denominator matrix of the dual system are element ( 1, 1) is 2.00 3.00 1.00 element ( 1, 2) is 5.00 7.00 -6.00 element ( 2, 1) is 4.00 -1.00 -1.00 element ( 2, 2) is 3.00 2.00 2.00 The coefficients of the numerator matrix of the dual system are element ( 1, 1) is 6.00 -1.00 5.00 element ( 1, 2) is 1.00 1.00 1.00 element ( 2, 1) is 1.00 7.00 5.00 element ( 2, 2) is 4.00 1.00 -1.00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TC04AD.html 0000664 0000000 0000000 00000033626 14560147231 0020343 0 ustar 00root root 0000000 0000000
Purpose
To find a state-space representation (A,B,C,D) with the same transfer matrix T(s) as that of a given left or right polynomial matrix representation, i.e. C*inv(sI-A)*B + D = T(s) = inv(P(s))*Q(s) = Q(s)*inv(P(s)).Specification
SUBROUTINE TC04AD( LERI, M, P, INDEX, PCOEFF, LDPCO1, LDPCO2, $ QCOEFF, LDQCO1, LDQCO2, N, RCOND, A, LDA, B, $ LDB, C, LDC, D, LDD, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER LERI INTEGER INFO, LDA, LDB, LDC, LDD, LDPCO1, LDPCO2, $ LDQCO1, LDQCO2, LDWORK, M, N, P DOUBLE PRECISION RCOND C .. Array Arguments .. INTEGER INDEX(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), PCOEFF(LDPCO1,LDPCO2,*), $ QCOEFF(LDQCO1,LDQCO2,*)Arguments
Mode Parameters
LERI CHARACTER*1 Indicates whether a left polynomial matrix representation or a right polynomial matrix representation is input as follows: = 'L': A left matrix fraction is input; = 'R': A right matrix fraction is input.Input/Output Parameters
M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. INDEX (input) INTEGER array, dimension (MAX(M,P)) If LERI = 'L', INDEX(I), I = 1,2,...,P, must contain the maximum degree of the polynomials in the I-th row of the denominator matrix P(s) of the given left polynomial matrix representation. If LERI = 'R', INDEX(I), I = 1,2,...,M, must contain the maximum degree of the polynomials in the I-th column of the denominator matrix P(s) of the given right polynomial matrix representation. PCOEFF (input) DOUBLE PRECISION array, dimension (LDPCO1,LDPCO2,kpcoef), where kpcoef = MAX(INDEX(I)) + 1. If LERI = 'L' then porm = P, otherwise porm = M. The leading porm-by-porm-by-kpcoef part of this array must contain the coefficients of the denominator matrix P(s). PCOEFF(I,J,K) is the coefficient in s**(INDEX(iorj)-K+1) of polynomial (I,J) of P(s), where K = 1,2,...,kpcoef; if LERI = 'L' then iorj = I, otherwise iorj = J. Thus for LERI = 'L', P(s) = diag(s**INDEX(I))*(PCOEFF(.,.,1)+PCOEFF(.,.,2)/s+...). If LERI = 'R', PCOEFF is modified by the routine but restored on exit. LDPCO1 INTEGER The leading dimension of array PCOEFF. LDPCO1 >= MAX(1,P) if LERI = 'L', LDPCO1 >= MAX(1,M) if LERI = 'R'. LDPCO2 INTEGER The second dimension of array PCOEFF. LDPCO2 >= MAX(1,P) if LERI = 'L', LDPCO2 >= MAX(1,M) if LERI = 'R'. QCOEFF (input) DOUBLE PRECISION array, dimension (LDQCO1,LDQCO2,kpcoef) If LERI = 'L' then porp = M, otherwise porp = P. The leading porm-by-porp-by-kpcoef part of this array must contain the coefficients of the numerator matrix Q(s). QCOEFF(I,J,K) is defined as for PCOEFF(I,J,K). If LERI = 'R', QCOEFF is modified by the routine but restored on exit. LDQCO1 INTEGER The leading dimension of array QCOEFF. LDQCO1 >= MAX(1,P) if LERI = 'L', LDQCO1 >= MAX(1,M,P) if LERI = 'R'. LDQCO2 INTEGER The second dimension of array QCOEFF. LDQCO2 >= MAX(1,M) if LERI = 'L', LDQCO2 >= MAX(1,M,P) if LERI = 'R'. N (output) INTEGER The order of the resulting state-space representation. porm That is, N = SUM INDEX(I). I=1 RCOND (output) DOUBLE PRECISION The estimated reciprocal of the condition number of the leading row (if LERI = 'L') or the leading column (if LERI = 'R') coefficient matrix of P(s). If RCOND is nearly zero, P(s) is nearly row or column non-proper. A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array contains the state dynamics matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) The leading N-by-M part of this array contains the input/state matrix B; the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (output) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array contains the state/output matrix C; the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P). D (output) DOUBLE PRECISION array, dimension (LDD,MAX(M,P)) The leading P-by-M part of this array contains the direct transmission matrix D; the remainder of the leading MAX(M,P)-by-MAX(M,P) part is used as internal workspace. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,M,P).Workspace
IWORK INTEGER array, dimension (2*MAX(M,P)) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,MAX(M,P)*(MAX(M,P)+4)). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if P(s) is not row (if LERI = 'L') or column (if LERI = 'R') proper. Consequently, no state-space representation is calculated.Method
The method for a left matrix fraction will be described here; right matrix fractions are dealt with by obtaining the dual left polynomial matrix representation and constructing an equivalent state-space representation for this. The first step is to check if the denominator matrix P(s) is row proper; if it is not then the routine returns with the Error Indicator (INFO) set to 1. Otherwise, Wolovich's Observable Structure Theorem is used to construct a state-space representation (A,B,C,D) in observable companion form. The sizes of the blocks of matrix A and matrix C here are precisely the row degrees of P(s), while their 'non-trivial' columns are given easily from its coefficients. Similarly, the matrix D is obtained from the leading coefficients of P(s) and of the numerator matrix Q(s), while matrix B is given by the relation Sbar(s)B = Q(s) - P(s)D, where Sbar(s) is a polynomial matrix whose (j,k)(th) element is given by j-u(k-1)-1 ( s , j = u(k-1)+1,u(k-1)+2,....,u(k) Sbar = ( j,k ( 0 , otherwise k u(k) = SUM d , k = 1,2,...,M and d ,d ,...,d are the i=1 i 1 2 M controllability indices. For convenience in solving this, C' and B are initially set up to contain the coefficients of P(s) and Q(s), respectively, stored by rows.References
[1] Wolovich, W.A. Linear Multivariate Systems, (Theorem 4.3.3). Springer-Verlag, 1974.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* TC04AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, PMAX, KPCMAX, NMAX PARAMETER ( MMAX = 5, PMAX = 5, KPCMAX = 5, NMAX = 5 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDPCO1, LDPCO2, LDQCO1, LDQCO2, LDA, LDB, LDC, $ LDD PARAMETER ( LDPCO1 = MAXMP, LDPCO2 = MAXMP, $ LDQCO1 = MAXMP, LDQCO2 = MAXMP, $ LDA = NMAX, LDB = NMAX, LDC = MAXMP, $ LDD = MAXMP ) INTEGER LIWORK PARAMETER ( LIWORK = 2*MAXMP ) INTEGER LDWORK PARAMETER ( LDWORK = ( MAXMP )*( MAXMP+4 ) ) * .. Local Scalars .. DOUBLE PRECISION RCOND INTEGER I, INFO, J, K, KPCOEF, M, N, P, PORM, PORP CHARACTER*1 LERI LOGICAL LLERI * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAXMP), C(LDC,NMAX), $ D(LDD,MAXMP), PCOEFF(LDPCO1,LDPCO2,KPCMAX), $ QCOEFF(LDQCO1,LDQCO2,KPCMAX), DWORK(LDWORK) INTEGER INDEX(MAXMP), IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TC04AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, P, LERI LLERI = LSAME( LERI, 'L' ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99991 ) M ELSE IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99990 ) P ELSE PORM = P IF ( .NOT.LLERI ) PORM = M READ ( NIN, FMT = * ) ( INDEX(I), I = 1,PORM ) PORP = M IF ( .NOT.LLERI ) PORP = P KPCOEF = 0 DO 20 I = 1, PORM KPCOEF = MAX( KPCOEF, INDEX(I) ) 20 CONTINUE KPCOEF = KPCOEF + 1 IF ( KPCOEF.LE.0 .OR. KPCOEF.GT.KPCMAX ) THEN WRITE ( NOUT, FMT = 99989 ) KPCOEF ELSE READ ( NIN, FMT = * ) $ ( ( ( PCOEFF(I,J,K), K = 1,KPCOEF ), J = 1,PORM ), $ I = 1,PORM ) READ ( NIN, FMT = * ) $ ( ( ( QCOEFF(I,J,K), K = 1,KPCOEF ), J = 1,PORP ), $ I = 1,PORM ) * Find a ssr of the given left pmr. CALL TC04AD( LERI, M, P, INDEX, PCOEFF, LDPCO1, LDPCO2, $ QCOEFF, LDQCO1, LDQCO2, N, RCOND, A, LDA, B, $ LDB, C, LDC, D, LDD, IWORK, DWORK, LDWORK, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) N, RCOND WRITE ( NOUT, FMT = 99996 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 60 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 80 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 100 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 100 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' TC04AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TC04AD = ',I2) 99997 FORMAT (' The order of the resulting state-space representation ', $ ' = ',I2,//' RCOND = ',F4.2) 99996 FORMAT (/' The state dynamics matrix A is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' The input/state matrix B is ') 99993 FORMAT (/' The state/output matrix C is ') 99992 FORMAT (/' The direct transmission matrix D is ') 99991 FORMAT (/' M is out of range.',/' M = ',I5) 99990 FORMAT (/' P is out of range.',/' P = ',I5) 99989 FORMAT (/' KPCOEF is out of range.',/' KPCOEF = ',I5) ENDProgram Data
TC04AD EXAMPLE PROGRAM DATA 2 2 L 2 2 2.0 3.0 1.0 4.0 -1.0 -1.0 5.0 7.0 -6.0 3.0 2.0 2.0 6.0 -1.0 5.0 1.0 7.0 5.0 1.0 1.0 1.0 4.0 1.0 -1.0Program Results
TC04AD EXAMPLE PROGRAM RESULTS The order of the resulting state-space representation = 4 RCOND = 0.25 The state dynamics matrix A is 0.0000 0.5714 0.0000 -0.4286 1.0000 1.0000 0.0000 -1.0000 0.0000 -2.0000 0.0000 2.0000 0.0000 0.7857 1.0000 -1.7143 The input/state matrix B is 8.0000 3.8571 4.0000 4.0000 -9.0000 5.0000 4.0000 -5.0714 The state/output matrix C is 0.0000 -0.2143 0.0000 0.2857 0.0000 0.3571 0.0000 -0.1429 The direct transmission matrix D is -1.0000 0.9286 2.0000 -0.2143
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TC05AD.html 0000664 0000000 0000000 00000026406 14560147231 0020342 0 ustar 00root root 0000000 0000000
Purpose
To evaluate the transfer matrix T(s) of a left polynomial matrix representation [T(s) = inv(P(s))*Q(s)] or a right polynomial matrix representation [T(s) = Q(s)*inv(P(s))] at any specified complex frequency s = SVAL. This routine will calculate the standard frequency response matrix at frequency omega if SVAL is supplied as (0.0,omega).Specification
SUBROUTINE TC05AD( LERI, M, P, SVAL, INDEX, PCOEFF, LDPCO1, $ LDPCO2, QCOEFF, LDQCO1, LDQCO2, RCOND, CFREQR, $ LDCFRE, IWORK, DWORK, ZWORK, INFO ) C .. Scalar Arguments .. CHARACTER LERI INTEGER INFO, LDCFRE, LDPCO1, LDPCO2, LDQCO1, LDQCO2, M, $ P DOUBLE PRECISION RCOND COMPLEX*16 SVAL C .. Array Arguments .. INTEGER INDEX(*), IWORK(*) DOUBLE PRECISION DWORK(*), PCOEFF(LDPCO1,LDPCO2,*), $ QCOEFF(LDQCO1,LDQCO2,*) COMPLEX*16 CFREQR(LDCFRE,*), ZWORK(*)Arguments
Mode Parameters
LERI CHARACTER*1 Indicates whether a left polynomial matrix representation or a right polynomial matrix representation is to be used to evaluate the transfer matrix as follows: = 'L': A left matrix fraction is input; = 'R': A right matrix fraction is input.Input/Output Parameters
M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. SVAL (input) COMPLEX*16 The frequency at which the transfer matrix or the frequency respose matrix is to be evaluated. For a standard frequency response set the real part of SVAL to zero. INDEX (input) INTEGER array, dimension (MAX(M,P)) If LERI = 'L', INDEX(I), I = 1,2,...,P, must contain the maximum degree of the polynomials in the I-th row of the denominator matrix P(s) of the given left polynomial matrix representation. If LERI = 'R', INDEX(I), I = 1,2,...,M, must contain the maximum degree of the polynomials in the I-th column of the denominator matrix P(s) of the given right polynomial matrix representation. PCOEFF (input) DOUBLE PRECISION array, dimension (LDPCO1,LDPCO2,kpcoef), where kpcoef = MAX(INDEX(I)) + 1. If LERI = 'L' then porm = P, otherwise porm = M. The leading porm-by-porm-by-kpcoef part of this array must contain the coefficients of the denominator matrix P(s). PCOEFF(I,J,K) is the coefficient in s**(INDEX(iorj)-K+1) of polynomial (I,J) of P(s), where K = 1,2,...,kpcoef; if LERI = 'L' then iorj = I, otherwise iorj = J. Thus for LERI = 'L', P(s) = diag(s**INDEX(I))*(PCOEFF(.,.,1)+PCOEFF(.,.,2)/s+...). If LERI = 'R', PCOEFF is modified by the routine but restored on exit. LDPCO1 INTEGER The leading dimension of array PCOEFF. LDPCO1 >= MAX(1,P) if LERI = 'L', LDPCO1 >= MAX(1,M) if LERI = 'R'. LDPCO2 INTEGER The second dimension of array PCOEFF. LDPCO2 >= MAX(1,P) if LERI = 'L', LDPCO2 >= MAX(1,M) if LERI = 'R'. QCOEFF (input) DOUBLE PRECISION array, dimension (LDQCO1,LDQCO2,kpcoef) If LERI = 'L' then porp = M, otherwise porp = P. The leading porm-by-porp-by-kpcoef part of this array must contain the coefficients of the numerator matrix Q(s). QCOEFF(I,J,K) is defined as for PCOEFF(I,J,K). If LERI = 'R', QCOEFF is modified by the routine but restored on exit. LDQCO1 INTEGER The leading dimension of array QCOEFF. LDQCO1 >= MAX(1,P) if LERI = 'L', LDQCO1 >= MAX(1,M,P) if LERI = 'R'. LDQCO2 INTEGER The second dimension of array QCOEFF. LDQCO2 >= MAX(1,M) if LERI = 'L', LDQCO2 >= MAX(1,M,P) if LERI = 'R'. RCOND (output) DOUBLE PRECISION The estimated reciprocal of the condition number of the denominator matrix P(SVAL). If RCOND is nearly zero, SVAL is approximately a system pole. CFREQR (output) COMPLEX*16 array, dimension (LDCFRE,MAX(M,P)) The leading porm-by-porp part of this array contains the frequency response matrix T(SVAL). LDCFRE INTEGER The leading dimension of array CFREQR. LDCFRE >= MAX(1,P) if LERI = 'L', LDCFRE >= MAX(1,M,P) if LERI = 'R'.Workspace
IWORK INTEGER array, dimension (liwork) where liwork = P, if LERI = 'L', liwork = M, if LERI = 'R'. DWORK DOUBLE PRECISION array, dimension (ldwork) where ldwork = 2*P, if LERI = 'L', ldwork = 2*M, if LERI = 'R'. ZWORK COMPLEX*16 array, dimension (lzwork), where lzwork = P*(P+2), if LERI = 'L', lzwork = M*(M+2), if LERI = 'R'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if P(SVAL) is exactly or nearly singular; no frequency response is calculated.Method
The method for a left matrix fraction will be described here; right matrix fractions are dealt with by obtaining the dual left fraction and calculating its frequency response (see SLICOT Library routine TC01OD). The first step is to calculate the complex value P(SVAL) of the denominator matrix P(s) at the desired frequency SVAL. If P(SVAL) is approximately singular, SVAL is approximately a pole of this system and so the frequency response matrix T(SVAL) is not calculated; in this case, the routine returns with the Error Indicator (INFO) set to 1. Otherwise, the complex value Q(SVAL) of the numerator matrix Q(s) at frequency SVAL is calculated in a similar way to P(SVAL), and the desired response matrix T(SVAL) = inv(P(SVAL))*Q(SVAL) is found by solving the corresponding system of complex linear equations.References
NoneNumerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* TC05AD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, PMAX, KPCMAX PARAMETER ( MMAX = 20, PMAX = 20, KPCMAX = 20 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDCFRE, LDPCO1, LDPCO2, LDQCO1, LDQCO2 PARAMETER ( LDCFRE = MAXMP, LDPCO1 = MAXMP, $ LDPCO2 = MAXMP, LDQCO1 = MAXMP, $ LDQCO2 = MAXMP ) INTEGER LDWORK PARAMETER ( LDWORK = 2*MAXMP ) INTEGER LZWORK PARAMETER ( LZWORK = ( MAXMP )*( MAXMP+2 ) ) * .. Local Scalars .. COMPLEX*16 SVAL DOUBLE PRECISION RCOND INTEGER I, INFO, J, K, KPCOEF, M, P, PORM, PORP CHARACTER*1 LERI LOGICAL LLERI * .. Local Arrays .. COMPLEX*16 CFREQR(LDCFRE,MAXMP), ZWORK(LZWORK) DOUBLE PRECISION DWORK(LDWORK), PCOEFF(LDPCO1,LDPCO2,KPCMAX), $ QCOEFF(LDQCO1,LDQCO2,KPCMAX) INTEGER INDEX(MAXMP), IWORK(MAXMP) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TC05AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, P, SVAL, LERI LLERI = LSAME( LERI, 'L' ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99995 ) M ELSE IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99994 ) P ELSE PORM = P IF ( .NOT.LLERI ) PORM = M READ ( NIN, FMT = * ) ( INDEX(I), I = 1,PORM ) PORP = M IF ( .NOT.LLERI ) PORP = P KPCOEF = 0 DO 20 I = 1, PORM KPCOEF = MAX( KPCOEF, INDEX(I) ) 20 CONTINUE KPCOEF = KPCOEF + 1 IF ( KPCOEF.LE.0 .OR. KPCOEF.GT.KPCMAX ) THEN WRITE ( NOUT, FMT = 99993 ) KPCOEF ELSE READ ( NIN, FMT = * ) $ ( ( ( PCOEFF(I,J,K), K = 1,KPCOEF ), J = 1,PORM ), $ I = 1,PORM ) READ ( NIN, FMT = * ) $ ( ( ( QCOEFF(I,J,K), K = 1,KPCOEF ), J = 1,PORP ), $ I = 1,PORM ) * Find the standard frequency response matrix of left pmr * at 0.5*j. CALL TC05AD( LERI, M, P, SVAL, INDEX, PCOEFF, LDPCO1, $ LDPCO2, QCOEFF, LDQCO1, LDQCO2, RCOND, CFREQR, $ LDCFRE, IWORK, DWORK, ZWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) RCOND DO 40 I = 1, PORM WRITE ( NOUT, FMT = 99996 ) $ ( CFREQR(I,J), J = 1,PORP ) 40 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' TC05AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TC05AD = ',I2) 99997 FORMAT (' RCOND = ',F4.2,//' The frequency response matrix T(SVA', $ 'L) is ') 99996 FORMAT (20(' (',F5.2,',',F5.2,') ',:)) 99995 FORMAT (/' M is out of range.',/' M = ',I5) 99994 FORMAT (/' P is out of range.',/' P = ',I5) 99993 FORMAT (/' KPCOEF is out of range.',/' KPCOEF = ',I5) ENDProgram Data
TC05AD EXAMPLE PROGRAM DATA 2 2 (0.0,0.5) L 2 2 2.0 3.0 1.0 4.0 -1.0 -1.0 5.0 7.0 -6.0 3.0 2.0 2.0 6.0 -1.0 5.0 1.0 7.0 5.0 1.0 1.0 1.0 4.0 1.0 -1.0Program Results
TC05AD EXAMPLE PROGRAM RESULTS RCOND = 0.19 The frequency response matrix T(SVAL) is (-0.25,-0.33) ( 0.26,-0.45) (-1.48, 0.35) (-2.25,-1.11)
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TD03AD.html 0000664 0000000 0000000 00000053266 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To find a relatively prime left or right polynomial matrix representation for a proper transfer matrix T(s) given as either row or column polynomial vectors over common denominator polynomials, possibly with uncancelled common terms.Specification
SUBROUTINE TD03AD( ROWCOL, LERI, EQUIL, M, P, INDEXD, DCOEFF, $ LDDCOE, UCOEFF, LDUCO1, LDUCO2, NR, A, LDA, B, $ LDB, C, LDC, D, LDD, INDEXP, PCOEFF, LDPCO1, $ LDPCO2, QCOEFF, LDQCO1, LDQCO2, VCOEFF, LDVCO1, $ LDVCO2, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL, LERI, ROWCOL INTEGER INFO, LDA, LDB, LDC, LDD, LDDCOE, LDPCO1, $ LDPCO2, LDQCO1, LDQCO2, LDUCO1, LDUCO2, LDVCO1, $ LDVCO2, LDWORK, M, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INDEXD(*), INDEXP(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DCOEFF(LDDCOE,*), DWORK(*), $ PCOEFF(LDPCO1,LDPCO2,*), $ QCOEFF(LDQCO1,LDQCO2,*), $ UCOEFF(LDUCO1,LDUCO2,*), VCOEFF(LDVCO1,LDVCO2,*)Arguments
Mode Parameters
ROWCOL CHARACTER*1 Indicates whether T(s) is to be factorized by rows or by columns as follows: = 'R': T(s) is factorized by rows; = 'C': T(s) is factorized by columns. LERI CHARACTER*1 Indicates whether a left or a right polynomial matrix representation is required as follows: = 'L': A left polynomial matrix representation inv(P(s))*Q(s) is required; = 'R': A right polynomial matrix representation Q(s)*inv(P(s)) is required. EQUIL CHARACTER*1 Specifies whether the user wishes to balance the triplet (A,B,C), before computing a minimal state-space representation, as follows: = 'S': Perform balancing (scaling); = 'N': Do not perform balancing.Input/Output Parameters
M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. INDEXD (input) INTEGER array, dimension (P), if ROWCOL = 'R', or dimension (M), if ROWCOL = 'C'. The leading pormd elements of this array must contain the row degrees of the denominator polynomials in D(s). pormd = P if the transfer matrix T(s) is given as row polynomial vectors over denominator polynomials; pormd = M if the transfer matrix T(s) is given as column polynomial vectors over denominator polynomials. DCOEFF (input) DOUBLE PRECISION array, dimension (LDDCOE,kdcoef), where kdcoef = MAX(INDEXD(I)) + 1. The leading pormd-by-kdcoef part of this array must contain the coefficients of each denominator polynomial. DCOEFF(I,K) is the coefficient in s**(INDEXD(I)-K+1) of the I-th denominator polynomial in D(s), where K = 1,2, ...,kdcoef. LDDCOE INTEGER The leading dimension of array DCOEFF. LDDCOE >= MAX(1,P), if ROWCOL = 'R'; LDDCOE >= MAX(1,M), if ROWCOL = 'C'. UCOEFF (input) DOUBLE PRECISION array, dimension (LDUCO1,LDUCO2,kdcoef) The leading P-by-M-by-kdcoef part of this array must contain the coefficients of the numerator matrix U(s); if ROWCOL = 'C', this array is modified internally but restored on exit, and the remainder of the leading MAX(M,P)-by-MAX(M,P)-by-kdcoef part is used as internal workspace. UCOEFF(I,J,K) is the coefficient in s**(INDEXD(iorj)-K+1) of polynomial (I,J) of U(s), where K = 1,2,...,kdcoef; iorj = I if T(s) is given as row polynomial vectors over denominator polynomials; iorj = J if T(s) is given as column polynomial vectors over denominator polynomials. Thus for ROWCOL = 'R', U(s) = diag(s**INDEXD(I))*(UCOEFF(.,.,1)+UCOEFF(.,.,2)/s+...). LDUCO1 INTEGER The leading dimension of array UCOEFF. LDUCO1 >= MAX(1,P), if ROWCOL = 'R'; LDUCO1 >= MAX(1,M,P), if ROWCOL = 'C'. LDUCO2 INTEGER The second dimension of array UCOEFF. LDUCO2 >= MAX(1,M), if ROWCOL = 'R'; LDUCO2 >= MAX(1,M,P), if ROWCOL = 'C'. NR (output) INTEGER The order of the resulting minimal realization, i.e. the order of the state dynamics matrix A. A (output) DOUBLE PRECISION array, dimension (LDA,N), pormd where N = SUM INDEXD(I) I=1 The leading NR-by-NR part of this array contains the upper block Hessenberg state dynamics matrix A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) The leading NR-by-M part of this array contains the input/state matrix B; the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (output) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-NR part of this array contains the state/output matrix C; the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P). D (output) DOUBLE PRECISION array, dimension (LDD,MAX(M,P)) The leading P-by-M part of this array contains the direct transmission matrix D; the remainder of the leading MAX(M,P)-by-MAX(M,P) part is used as internal workspace. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,M,P). INDEXP (output) INTEGER array, dimension (P), if ROWCOL = 'R', or dimension (M), if ROWCOL = 'C'. The leading pormp elements of this array contain the row (column if ROWCOL = 'C') degrees of the denominator matrix P(s). pormp = P if a left polynomial matrix representation is requested; pormp = M if a right polynomial matrix representation is requested. These elements are ordered so that INDEXP(1) >= INDEXP(2) >= ... >= INDEXP(pormp). PCOEFF (output) DOUBLE PRECISION array, dimension (LDPCO1,LDPCO2,N+1) The leading pormp-by-pormp-by-kpcoef part of this array contains the coefficients of the denominator matrix P(s), where kpcoef = MAX(INDEXP(I)) + 1. PCOEFF(I,J,K) is the coefficient in s**(INDEXP(iorj)-K+1) of polynomial (I,J) of P(s), where K = 1,2,...,kpcoef; iorj = I if a left polynomial matrix representation is requested; iorj = J if a right polynomial matrix representation is requested. Thus for a left polynomial matrix representation, P(s) = diag(s**INDEXP(I))*(PCOEFF(.,.,1)+PCOEFF(.,.,2)/s+...). LDPCO1 INTEGER The leading dimension of array PCOEFF. LDPCO1 >= MAX(1,P), if ROWCOL = 'R'; LDPCO1 >= MAX(1,M), if ROWCOL = 'C'. LDPCO2 INTEGER The second dimension of array PCOEFF. LDPCO2 >= MAX(1,P), if ROWCOL = 'R'; LDPCO2 >= MAX(1,M), if ROWCOL = 'C'. QCOEFF (output) DOUBLE PRECISION array, dimension (LDQCO1,LDQCO2,N+1) The leading pormp-by-pormd-by-kpcoef part of this array contains the coefficients of the numerator matrix Q(s). QCOEFF(I,J,K) is defined as for PCOEFF(I,J,K). LDQCO1 INTEGER The leading dimension of array QCOEFF. If LERI = 'L', LDQCO1 >= MAX(1,PM), where PM = P, if ROWCOL = 'R'; PM = M, if ROWCOL = 'C'. If LERI = 'R', LDQCO1 >= MAX(1,M,P). LDQCO2 INTEGER The second dimension of array QCOEFF. If LERI = 'L', LDQCO2 >= MAX(1,MP), where MP = M, if ROWCOL = 'R'; MP = P, if ROWCOL = 'C'. If LERI = 'R', LDQCO2 >= MAX(1,M,P). VCOEFF (output) DOUBLE PRECISION array, dimension (LDVCO1,LDVCO2,N+1) The leading pormp-by-NR-by-kpcoef part of this array contains the coefficients of the intermediate matrix V(s) as produced by SLICOT Library routine TB03AD. LDVCO1 INTEGER The leading dimension of array VCOEFF. LDVCO1 >= MAX(1,P), if ROWCOL = 'R'; LDVCO1 >= MAX(1,M), if ROWCOL = 'C'. LDVCO2 INTEGER The second dimension of array VCOEFF. LDVCO2 >= MAX(1,N).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determination when transforming (A, B, C). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance (determined by the SLICOT routine TB01UD) is used instead.Workspace
IWORK INTEGER array, dimension (N+MAX(M,P)) On exit, if INFO = 0, the first nonzero elements of IWORK(1:N) return the orders of the diagonal blocks of A. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N + MAX(N, 3*M, 3*P), PM*(PM + 2)) where PM = P, if ROWCOL = 'R'; PM = M, if ROWCOL = 'C'. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i (i <= k = pormd), then i is the first integer I for which ABS( DCOEFF(I,1) ) is so small that the calculations would overflow (see SLICOT Library routine TD03AY); that is, the leading coefficient of a polynomial is nearly zero; no state-space representation or polynomial matrix representation is calculated; = k+1: if a singular matrix was encountered during the computation of V(s); = k+2: if a singular matrix was encountered during the computation of P(s).Method
The method for transfer matrices factorized by rows will be described here; T(s) factorized by columns is dealt with by operating on the dual T'(s). The description for T(s) is actually the left polynomial matrix representation T(s) = inv(D(s))*U(s), where D(s) is diagonal with its (I,I)-th polynomial element of degree INDEXD(I). The first step is to check whether the leading coefficient of any polynomial element of D(s) is approximately zero, if so the routine returns with INFO > 0. Otherwise, Wolovich's Observable Structure Theorem is used to construct a state-space representation in observable companion form which is equivalent to the above polynomial matrix representation. The method is particularly easy here due to the diagonal form of D(s). This state-space representation is not necessarily controllable (as D(s) and U(s) are not necessarily relatively left prime), but it is in theory completely observable; however, its observability matrix may be poorly conditioned, so it is treated as a general state-space representation and SLICOT Library routine TB03AD is used to separate out a minimal realization for T(s) from it by means of orthogonal similarity transformations and then to calculate a relatively prime (left or right) polynomial matrix representation which is equivalent to this.References
[1] Patel, R.V. On Computing Matrix Fraction Descriptions and Canonical Forms of Linear Time-Invariant Systems. UMIST Control Systems Centre Report 489, 1980. [2] Wolovich, W.A. Linear Multivariable Systems, (Theorem 4.3.3). Springer-Verlag, 1974.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* TD03AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, PMAX, KDCMAX, NMAX PARAMETER ( MMAX = 8, PMAX = 8, KDCMAX = 8, NMAX = 8 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC, LDD, LDDCOE, LDPCO1, LDPCO2, $ LDQCO1, LDQCO2, LDUCO1, LDUCO2, LDVCO1, LDVCO2 PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = MAXMP, $ LDD = MAXMP, LDDCOE = MAXMP, $ LDPCO1 = MAXMP, LDPCO2 = MAXMP, $ LDQCO1 = MAXMP, LDQCO2 = MAXMP, $ LDUCO1 = MAXMP, LDUCO2 = MAXMP, $ LDVCO1 = MAXMP, LDVCO2 = NMAX ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX + MAXMP ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( NMAX + MAX( NMAX, 3*MAXMP ), $ MAXMP*( MAXMP + 2 ) ) ) * .. Local Scalars .. DOUBLE PRECISION TOL CHARACTER*1 EQUIL, LERI, ROWCOL INTEGER I, INDBLK, INFO, J, K, KDCOEF, M, MAXINP, N, NR, $ P, PORMD, PORMP * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAXMP), C(LDC,NMAX), $ D(LDD,MAXMP), DCOEFF(LDDCOE,KDCMAX), $ DWORK(LDWORK), PCOEFF(LDPCO1,LDPCO2,NMAX+1), $ QCOEFF(LDQCO1,LDQCO2,NMAX+1), $ UCOEFF(LDUCO1,LDUCO2,KDCMAX), $ VCOEFF(LDVCO1,LDVCO2,NMAX+1) INTEGER INDEXD(MAXMP), INDEXP(MAXMP), IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TD03AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, P, TOL, ROWCOL, LERI, EQUIL IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99986 ) M ELSE IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99985 ) P ELSE PORMD = P IF ( LSAME( ROWCOL, 'C' ) ) PORMD = M PORMP = M IF ( LSAME( LERI, 'R' ) ) PORMP = P READ ( NIN, FMT = * ) ( INDEXD(I), I = 1,PORMD ) * KDCOEF = 0 N = 0 DO 20 I = 1, PORMD KDCOEF = MAX( KDCOEF, INDEXD(I) ) N = N + INDEXD(I) 20 CONTINUE KDCOEF = KDCOEF + 1 * IF ( KDCOEF.LE.0 .OR. KDCOEF.GT.KDCMAX ) THEN WRITE ( NOUT, FMT = 99984 ) KDCOEF ELSE READ ( NIN, FMT = * ) $ ( ( DCOEFF(I,J), J = 1,KDCOEF ), I = 1,PORMD ) READ ( NIN, FMT = * ) $ ( ( ( UCOEFF(I,J,K), K = 1,KDCOEF ), J = 1,M ), I = 1,P ) * Find a relatively prime left pmr for the given transfer * function. CALL TD03AD( ROWCOL, LERI, EQUIL, M, P, INDEXD, DCOEFF, $ LDDCOE, UCOEFF, LDUCO1, LDUCO2, NR, A, LDA, B, $ LDB, C, LDC, D, LDD, INDEXP, PCOEFF, LDPCO1, $ LDPCO2, QCOEFF, LDQCO1, LDQCO2, VCOEFF, LDVCO1, $ LDVCO2, TOL, IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR DO 40 I = 1, NR WRITE ( NOUT, FMT = 99996 ) ( A(I,J), J = 1,NR ) 40 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 60 I = 1, NR WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,M ) 60 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,NR ) 80 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 100 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( D(I,J), J = 1,M ) 100 CONTINUE INDBLK = 0 DO 120 I = 1, N IF ( IWORK(I).NE.0 ) INDBLK = INDBLK + 1 120 CONTINUE IF ( LSAME( LERI, 'L' ) ) THEN WRITE ( NOUT, FMT = 99992 ) INDBLK, $ ( IWORK(I), I = 1,INDBLK ) WRITE ( NOUT, FMT = 99990 ) ( INDEXP(I), I = 1,P ) ELSE WRITE ( NOUT, FMT = 99991 ) INDBLK, $ ( IWORK(I), I = 1,INDBLK ) WRITE ( NOUT, FMT = 99989 ) ( INDEXP(I), I = 1,M ) END IF MAXINP = 0 DO 140 I = 1, PORMP MAXINP = MAX( MAXINP, INDEXP(I) ) 140 CONTINUE MAXINP = MAXINP + 1 WRITE ( NOUT, FMT = 99988 ) DO 180 I = 1, PORMP DO 160 J = 1, PORMP WRITE ( NOUT, FMT = 99996 ) $ ( PCOEFF(I,J,K), K = 1,MAXINP ) 160 CONTINUE 180 CONTINUE WRITE ( NOUT, FMT = 99987 ) DO 220 I = 1, PORMP DO 200 J = 1, PORMD WRITE ( NOUT, FMT = 99996 ) $ ( QCOEFF(I,J,K), K = 1,MAXINP ) 200 CONTINUE 220 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' TD03AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TD03AD = ',I2) 99997 FORMAT (' The order of the resulting minimal realization = ',I2, $ //' The state dynamics matrix A is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The input/state matrix B is ') 99994 FORMAT (/' The state/output matrix C is ') 99993 FORMAT (/' The direct transmission matrix D is ') 99992 FORMAT (/' The observability index of the minimal realization = ', $ I2,//' The dimensions of the diagonal blocks of the state', $ ' dynamics matrix are ',/20(I5)) 99991 FORMAT (/' The controllability index of the minimal realization ', $ '= ',I2,//' The dimensions of the diagonal blocks of the ', $ 'state dynamics matrix are ',/20(I5)) 99990 FORMAT (/' The row degrees of the denominator matrix P(s) are', $ /20(I5)) 99989 FORMAT (/' The column degrees of the denominator matrix P(s) are', $ /20(I5)) 99988 FORMAT (/' The denominator matrix P(s) is ') 99987 FORMAT (/' The numerator matrix Q(s) is ') 99986 FORMAT (/' M is out of range.',/' M = ',I5) 99985 FORMAT (/' P is out of range.',/' P = ',I5) 99984 FORMAT (/' KDCOEF is out of range.',/' KDCOEF = ',I5) ENDProgram Data
TD01ND EXAMPLE PROGRAM DATA 2 2 0.0 R L N 3 3 1.0 6.0 11.0 6.0 1.0 6.0 11.0 6.0 1.0 6.0 12.0 7.0 0.0 1.0 4.0 3.0 0.0 0.0 1.0 1.0 1.0 8.0 20.0 15.0Program Results
TD03AD EXAMPLE PROGRAM RESULTS The order of the resulting minimal realization = 3 The state dynamics matrix A is 0.5000 0.9478 10.1036 0.0000 -1.0000 0.0000 -0.8660 -0.6156 -5.5000 The input/state matrix B is 2.0000 12.5000 0.0000 -5.6273 0.0000 -2.0207 The state/output matrix C is 0.0000 0.0296 -0.5774 0.0000 -0.1481 -0.5774 The direct transmission matrix D is 1.0000 0.0000 0.0000 1.0000 The observability index of the minimal realization = 2 The dimensions of the diagonal blocks of the state dynamics matrix are 2 1 The row degrees of the denominator matrix P(s) are 2 1 The denominator matrix P(s) is 1.6667 4.3333 6.6667 0.3333 5.6667 5.3333 5.6273 5.6273 0.0000 -5.6273 -5.6273 0.0000 The numerator matrix Q(s) is 1.6667 4.3333 8.6667 0.3333 8.0000 16.6667 5.6273 5.6273 0.0000 -5.6273 -11.2546 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TD04AD.html 0000664 0000000 0000000 00000036270 14560147231 0020342 0 ustar 00root root 0000000 0000000
Purpose
To find a minimal state-space representation (A,B,C,D) for a proper transfer matrix T(s) given as either row or column polynomial vectors over denominator polynomials, possibly with uncancelled common terms.Specification
SUBROUTINE TD04AD( ROWCOL, M, P, INDEX, DCOEFF, LDDCOE, UCOEFF, $ LDUCO1, LDUCO2, NR, A, LDA, B, LDB, C, LDC, D, $ LDD, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER ROWCOL INTEGER INFO, LDA, LDB, LDC, LDD, LDDCOE, LDUCO1, $ LDUCO2, LDWORK, M, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INDEX(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DCOEFF(LDDCOE,*), DWORK(*), $ UCOEFF(LDUCO1,LDUCO2,*)Arguments
Mode Parameters
ROWCOL CHARACTER*1 Indicates whether the transfer matrix T(s) is given as rows or columns over common denominators as follows: = 'R': T(s) is given as rows over common denominators; = 'C': T(s) is given as columns over common denominators.Input/Output Parameters
M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. INDEX (input) INTEGER array, dimension (porm), where porm = P, if ROWCOL = 'R', and porm = M, if ROWCOL = 'C'. This array must contain the degrees of the denominator polynomials in D(s). DCOEFF (input) DOUBLE PRECISION array, dimension (LDDCOE,kdcoef), where kdcoef = MAX(INDEX(I)) + 1. The leading porm-by-kdcoef part of this array must contain the coefficients of each denominator polynomial. DCOEFF(I,K) is the coefficient in s**(INDEX(I)-K+1) of the I-th denominator polynomial in D(s), where K = 1,2,...,kdcoef. LDDCOE INTEGER The leading dimension of array DCOEFF. LDDCOE >= MAX(1,P) if ROWCOL = 'R'; LDDCOE >= MAX(1,M) if ROWCOL = 'C'. UCOEFF (input) DOUBLE PRECISION array, dimension (LDUCO1,LDUCO2,kdcoef) The leading P-by-M-by-kdcoef part of this array must contain the numerator matrix U(s); if ROWCOL = 'C', this array is modified internally but restored on exit, and the remainder of the leading MAX(M,P)-by-MAX(M,P)-by-kdcoef part is used as internal workspace. UCOEFF(I,J,K) is the coefficient in s**(INDEX(iorj)-K+1) of polynomial (I,J) of U(s), where K = 1,2,...,kdcoef; if ROWCOL = 'R' then iorj = I, otherwise iorj = J. Thus for ROWCOL = 'R', U(s) = diag(s**INDEX(I))*(UCOEFF(.,.,1)+UCOEFF(.,.,2)/s+...). LDUCO1 INTEGER The leading dimension of array UCOEFF. LDUCO1 >= MAX(1,P) if ROWCOL = 'R'; LDUCO1 >= MAX(1,M,P) if ROWCOL = 'C'. LDUCO2 INTEGER The second dimension of array UCOEFF. LDUCO2 >= MAX(1,M) if ROWCOL = 'R'; LDUCO2 >= MAX(1,M,P) if ROWCOL = 'C'. NR (output) INTEGER The order of the resulting minimal realization, i.e. the order of the state dynamics matrix A. A (output) DOUBLE PRECISION array, dimension (LDA,N), porm where N = SUM INDEX(I). I=1 The leading NR-by-NR part of this array contains the upper block Hessenberg state dynamics matrix A of a minimal realization. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) The leading NR-by-M part of this array contains the input/state matrix B of a minimal realization; the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (output) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-NR part of this array contains the state/output matrix C of a minimal realization; the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P). D (output) DOUBLE PRECISION array, dimension (LDD,M), if ROWCOL = 'R', and (LDD,MAX(M,P)) if ROWCOL = 'C'. The leading P-by-M part of this array contains the direct transmission matrix D; if ROWCOL = 'C', the remainder of the leading MAX(M,P)-by-MAX(M,P) part is used as internal workspace. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P) if ROWCOL = 'R'; LDD >= MAX(1,M,P) if ROWCOL = 'C'.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determination when transforming (A, B, C). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition number (see the description of the argument RCOND in the SLICOT routine MB03OD); a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance (determined by the SLICOT routine TB01UD) is used instead.Workspace
IWORK INTEGER array, dimension (N+MAX(M,P)) On exit, if INFO = 0, the first nonzero elements of IWORK(1:N) return the orders of the diagonal blocks of A. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, N + MAX(N, 3*M, 3*P)). For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, then i is the first integer for which ABS( DCOEFF(I,1) ) is so small that the calculations would overflow (see SLICOT Library routine TD03AY); that is, the leading coefficient of a polynomial is nearly zero; no state-space representation is calculated.Method
The method for transfer matrices factorized by rows will be described here: T(s) factorized by columns is dealt with by operating on the dual T'(s). This description for T(s) is actually the left polynomial matrix representation T(s) = inv(D(s))*U(s), where D(s) is diagonal with its (I,I)-th polynomial element of degree INDEX(I). The first step is to check whether the leading coefficient of any polynomial element of D(s) is approximately zero; if so the routine returns with INFO > 0. Otherwise, Wolovich's Observable Structure Theorem is used to construct a state-space representation in observable companion form which is equivalent to the above polynomial matrix representation. The method is particularly easy here due to the diagonal form of D(s). This state-space representation is not necessarily controllable (as D(s) and U(s) are not necessarily relatively left prime), but it is in theory completely observable; however, its observability matrix may be poorly conditioned, so it is treated as a general state-space representation and SLICOT Library routine TB01PD is then called to separate out a minimal realization from this general state-space representation by means of orthogonal similarity transformations.References
[1] Patel, R.V. Computation of Minimal-Order State-Space Realizations and Observability Indices using Orthogonal Transformations. Int. J. Control, 33, pp. 227-246, 1981. [2] Wolovich, W.A. Linear Multivariable Systems, (Theorem 4.3.3). Springer-Verlag, 1974.Numerical Aspects
3 The algorithm requires 0(N ) operations.Further Comments
NoneExample
Program Text
* TD04AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, PMAX, KDCMAX, NMAX PARAMETER ( MMAX = 10, PMAX = 10, KDCMAX = 10, NMAX = 10 ) INTEGER MAXMP PARAMETER ( MAXMP = MAX( MMAX, PMAX ) ) INTEGER LDDCOE, LDUCO1, LDUCO2, LDA, LDB, LDC, LDD PARAMETER ( LDDCOE = MAXMP, LDUCO1 = MAXMP, $ LDUCO2 = MAXMP, LDA = NMAX, LDB = NMAX, $ LDC = MAXMP, LDD = MAXMP ) INTEGER LIWORK PARAMETER ( LIWORK = NMAX + MAXMP ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX + MAX( NMAX, 3*MAXMP ) ) * .. Local Scalars .. DOUBLE PRECISION TOL INTEGER I, INDBLK, INFO, J, K, KDCOEF, M, N, NR, P, PORM CHARACTER*1 ROWCOL LOGICAL LROWCO * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAXMP), C(LDC,NMAX), $ D(LDD,MAXMP), DCOEFF(LDDCOE,KDCMAX), $ DWORK(LDWORK), UCOEFF(LDUCO1,LDUCO2,KDCMAX) INTEGER INDEX(MAXMP), IWORK(LIWORK) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TD04AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, P, TOL, ROWCOL LROWCO = LSAME( ROWCOL, 'R' ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99990 ) M ELSE IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99989 ) P ELSE PORM = P IF ( .NOT.LROWCO ) PORM = M READ ( NIN, FMT = * ) ( INDEX(I), I = 1,PORM ) * N = 0 KDCOEF = 0 DO 20 I = 1, PORM N = N + INDEX(I) KDCOEF = MAX( KDCOEF, INDEX(I) ) 20 CONTINUE KDCOEF = KDCOEF + 1 * IF ( KDCOEF.LE.0 .OR. KDCOEF.GT.KDCMAX ) THEN WRITE ( NOUT, FMT = 99988 ) KDCOEF ELSE READ ( NIN, FMT = * ) $ ( ( DCOEFF(I,J), J = 1,KDCOEF ), I = 1,PORM ) READ ( NIN, FMT = * ) $ ( ( ( UCOEFF(I,J,K), K = 1,KDCOEF ), J = 1,M ), I = 1,P ) * Find a minimal state-space representation (A,B,C,D). CALL TD04AD( ROWCOL, M, P, INDEX, DCOEFF, LDDCOE, UCOEFF, $ LDUCO1, LDUCO2, NR, A, LDA, B, LDB, C, LDC, D, $ LDD, TOL, IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NR DO 40 I = 1, NR WRITE ( NOUT, FMT = 99996 ) ( A(I,J), J = 1,NR ) 40 CONTINUE WRITE ( NOUT, FMT = 99995 ) DO 60 I = 1, NR WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,M ) 60 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 80 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,NR ) 80 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 100 I = 1, P WRITE ( NOUT, FMT = 99996 ) ( D(I,J), J = 1,M ) 100 CONTINUE INDBLK = 0 DO 120 I = 1, N IF ( IWORK(I).NE.0 ) INDBLK = INDBLK + 1 120 CONTINUE IF ( LROWCO ) THEN WRITE ( NOUT, FMT = 99992 ) INDBLK, $ ( IWORK(I), I = 1,INDBLK ) ELSE WRITE ( NOUT, FMT = 99991 ) INDBLK, $ ( IWORK(I), I = 1,INDBLK ) END IF END IF END IF END IF STOP * 99999 FORMAT (' TD04AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TD04AD = ',I2) 99997 FORMAT (' The order of the minimal realization = ',I2,//' The st', $ 'ate dynamics matrix A of a minimal realization is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' The input/state matrix B of a minimal realization is ') 99994 FORMAT (/' The state/output matrix C of a minimal realization is ' $ ) 99993 FORMAT (/' The direct transmission matrix D is ') 99992 FORMAT (/' The observability index of a minimal state-space repr', $ 'esentation = ',I2,//' The dimensions of the diagonal blo', $ 'cks of the state dynamics matrix are',/20(1X,I2)) 99991 FORMAT (/' The controllability index of a minimal state-space re', $ 'presentation = ',I2,//' The dimensions of the diagonal b', $ 'locks of the state dynamics matrix are',/20(1X,I2)) 99990 FORMAT (/' M is out of range.',/' M = ',I5) 99989 FORMAT (/' P is out of range.',/' P = ',I5) 99988 FORMAT (/' KDCOEF is out of range.',/' KDCOEF = ',I5) ENDProgram Data
TD04AD EXAMPLE PROGRAM DATA 2 2 0.0 R 3 3 1.0 6.0 11.0 6.0 1.0 6.0 11.0 6.0 1.0 6.0 12.0 7.0 0.0 1.0 4.0 3.0 0.0 0.0 1.0 1.0 1.0 8.0 20.0 15.0Program Results
TD04AD EXAMPLE PROGRAM RESULTS The order of the minimal realization = 3 The state dynamics matrix A of a minimal realization is 0.5000 -0.8028 0.9387 4.4047 -2.3380 2.5076 -5.5541 1.6872 -4.1620 The input/state matrix B of a minimal realization is -0.2000 -1.2500 0.0000 -0.6097 0.0000 2.2217 The state/output matrix C of a minimal realization is 0.0000 -0.8679 0.2119 0.0000 0.0000 0.9002 The direct transmission matrix D is 1.0000 0.0000 0.0000 1.0000 The observability index of a minimal state-space representation = 2 The dimensions of the diagonal blocks of the state dynamics matrix are 2 1
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TD05AD.html 0000664 0000000 0000000 00000014541 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
Given a complex valued rational function of frequency (transfer function) G(jW) this routine will calculate its complex value or its magnitude and phase for a specified frequency value.Specification
SUBROUTINE TD05AD( UNITF, OUTPUT, NP1, MP1, W, A, B, VALR, VALI, $ INFO ) C .. Scalar Arguments .. CHARACTER OUTPUT, UNITF INTEGER INFO, MP1, NP1 DOUBLE PRECISION VALI, VALR, W C .. Array Arguments .. DOUBLE PRECISION A(*), B(*)Arguments
Mode Parameters
UNITF CHARACTER*1 Indicates the choice of frequency unit as follows: = 'R': Input frequency W in radians/second; = 'H': Input frequency W in hertz. OUTPUT CHARACTER*1 Indicates the choice of co-ordinates for output as folows: = 'C': Cartesian co-ordinates (output real and imaginary parts of G(jW)); = 'P': Polar co-ordinates (output magnitude and phase of G(jW)).Input/Output Parameters
NP1 (input) INTEGER The order of the denominator + 1, i.e. N + 1. NP1 >= 1. MP1 (input) INTEGER The order of the numerator + 1, i.e. M + 1. MP1 >= 1. W (input) DOUBLE PRECISION The frequency value W for which the transfer function is to be evaluated. A (input) DOUBLE PRECISION array, dimension (NP1) This array must contain the vector of denominator coefficients in ascending order of powers. That is, A(i) must contain the coefficient of (jW)**(i-1) for i = 1, 2,...,NP1. B (input) DOUBLE PRECISION array, dimension (MP1) This array must contain the vector of numerator coefficients in ascending order of powers. That is, B(i) must contain the coefficient of (jW)**(i-1) for i = 1, 2,...,MP1. VALR (output) DOUBLE PRECISION If OUTPUT = 'C', VALR contains the real part of G(jW). If OUTPUT = 'P', VALR contains the magnitude of G(jW) in dBs. VALI (output) DOUBLE PRECISION If OUTPUT = 'C', VALI contains the imaginary part of G(jW). If OUTPUT = 'P', VALI contains the phase of G(jW) in degrees.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: if the frequency value W is a pole of G(jW), or all the coefficients of the A polynomial are zero.Method
By substituting the values of A, B and W in the following formula: B(1)+B(2)*(jW)+B(3)*(jW)**2+...+B(MP1)*(jW)**(MP1-1) G(jW) = ---------------------------------------------------. A(1)+A(2)*(jW)+A(3)*(jW)**2+...+A(NP1)*(jW)**(NP1-1)References
None.Numerical Aspects
The algorithm requires 0(N+M) operations.Further Comments
NoneExample
Program Text
* TD05AD EXAMPLE PROGRAM TEXT. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NP1MAX, MP1MAX PARAMETER ( NP1MAX = 20, MP1MAX = 20 ) * .. Local Scalars .. DOUBLE PRECISION VALI, VALR, W INTEGER I, INFO, MP1, NP1 CHARACTER*1 UNITF, OUTPUT * .. Local Arrays .. DOUBLE PRECISION A(NP1MAX), B(MP1MAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TD05AD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) NP1, MP1, W, UNITF, OUTPUT IF ( NP1.LE.0 .OR. NP1.GT.NP1MAX ) THEN WRITE ( NOUT, FMT = 99995 ) NP1 ELSE READ ( NIN, FMT = * ) ( A(I), I = 1,NP1 ) IF ( MP1.LE.0 .OR. MP1.GT.MP1MAX ) THEN WRITE ( NOUT, FMT = 99994 ) MP1 ELSE READ ( NIN, FMT = * ) ( B(I), I = 1,MP1 ) * Find the real and imaginary parts of G(jW), where * W = 1.0 radian. CALL TD05AD( UNITF, OUTPUT, NP1, MP1, W, A, B, VALR, VALI, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( OUTPUT, 'C' ) ) THEN WRITE ( NOUT, FMT = 99997 ) VALR, VALI ELSE WRITE ( NOUT, FMT = 99996 ) VALR, VALI END IF END IF END IF END IF STOP * 99999 FORMAT (' TD05AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TD05AD = ',I2) 99997 FORMAT (' Complex value of G(jW) = ',F8.4,1X,F8.4,'*j') 99996 FORMAT (' Magnitude of G(jW) = ',F8.4,' dBs, Phase of G(jW) = ', $ F8.4,' degrees ') 99995 FORMAT (/' NP1 is out of range.',/' NP1 = ',I5) 99994 FORMAT (/' MP1 is out of range.',/' MP1 = ',I5) ENDProgram Data
TD05AD EXAMPLE PROGRAM DATA 6 4 1.0 R C 1.0 1.0 0.0 0.0 2.0 1.0 6.0 2.0 3.0 1.0Program Results
TD05AD EXAMPLE PROGRAM RESULTS Complex value of G(jW) = 0.8462 -0.2308*j
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TF01MD.html 0000664 0000000 0000000 00000021466 14560147231 0020356 0 ustar 00root root 0000000 0000000
Purpose
To compute the output sequence of a linear time-invariant open-loop system given by its discrete-time state-space model (A,B,C,D), where A is an N-by-N general matrix. The initial state vector x(1) must be supplied by the user.Specification
SUBROUTINE TF01MD( N, M, P, NY, A, LDA, B, LDB, C, LDC, D, LDD, $ U, LDU, X, Y, LDY, DWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDU, LDY, M, N, NY, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), U(LDU,*), X(*), Y(LDY,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NY (input) INTEGER The number of output vectors y(k) to be computed. NY >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input matrix B of the system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the output matrix C of the system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct link matrix D of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). U (input) DOUBLE PRECISION array, dimension (LDU,NY) The leading M-by-NY part of this array must contain the input vector sequence u(k), for k = 1,2,...,NY. Specifically, the k-th column of U must contain u(k). LDU INTEGER The leading dimension of array U. LDU >= MAX(1,M). X (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the initial state vector x(1) which consists of the N initial states of the system. On exit, this array contains the final state vector x(NY+1) of the N states of the system at instant NY. Y (output) DOUBLE PRECISION array, dimension (LDY,NY) The leading P-by-NY part of this array contains the output vector sequence y(1),y(2),...,y(NY) such that the k-th column of Y contains y(k) (the outputs at instant k), for k = 1,2,...,NY. LDY INTEGER The leading dimension of array Y. LDY >= MAX(1,P).Workspace
DWORK DOUBLE PRECISION array, dimension (N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given an initial state vector x(1), the output vector sequence y(1), y(2),..., y(NY) is obtained via the formulae x(k+1) = A x(k) + B u(k) y(k) = C x(k) + D u(k), where each element y(k) is a vector of length P containing the outputs at instant k and k = 1,2,...,NY.References
[1] Luenberger, D.G. Introduction to Dynamic Systems: Theory, Models and Applications. John Wiley & Sons, New York, 1979.Numerical Aspects
The algorithm requires approximately (N + M) x (N + P) x NY multiplications and additions.Further Comments
NoneExample
Program Text
* TF01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX, NYMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20, NYMAX = 20 ) INTEGER LDA, LDB, LDC, LDD, LDU, LDY PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, LDD = PMAX, $ LDU = MMAX, LDY = PMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX ) * .. Local Scalars .. INTEGER I, INFO, J, K, M, N, NY, P * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), U(LDU,NYMAX), $ X(NMAX), Y(LDY,NYMAX) * .. External Subroutines .. EXTERNAL TF01MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NY IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), I = 1,N ), J = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99992 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), I = 1,P ), J = 1,N ) READ ( NIN, FMT = * ) ( ( D(I,J), I = 1,P ), J = 1,M ) READ ( NIN, FMT = * ) ( X(I), I = 1,N ) IF ( NY.LE.0 .OR. NY.GT.NYMAX ) THEN WRITE ( NOUT, FMT = 99991 ) NY ELSE READ ( NIN, FMT = * ) $ ( ( U(I,J), I = 1,M ), J = 1,NY ) * Compute y(1),...,y(NY) of the given system. CALL TF01MD( N, M, P, NY, A, LDA, B, LDB, C, LDC, D, $ LDD, U, LDU, X, Y, LDY, DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NY DO 20 K = 1, NY WRITE ( NOUT, FMT = 99996 ) K, Y(1,K) WRITE ( NOUT, FMT = 99995 ) ( Y(J,K), J = 2,P ) 20 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TF01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TF01MD = ',I2) 99997 FORMAT (' The output sequence Y(1),...,Y(',I2,') is',/) 99996 FORMAT (' Y(',I2,') : ',F8.4) 99995 FORMAT (9X,F8.4,/) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' P is out of range.',/' P = ',I5) 99991 FORMAT (/' NY is out of range.',/' NY = ',I5) ENDProgram Data
TF01MD EXAMPLE PROGRAM DATA 3 2 2 10 0.0000 -0.0700 0.0150 1.0000 0.8000 -0.1500 0.0000 0.0000 0.5000 0.0000 2.0000 1.0000 -1.0000 -0.1000 1.0000 0.0000 1.0000 0.0000 0.0000 1.0000 0.0000 1.0000 0.5000 0.0000 0.5000 1.0000 1.0000 1.0000 -0.6922 -1.4934 0.3081 -2.7726 2.0039 0.2614 -0.9160 -0.6030 1.2556 0.2951 -1.5734 1.5639 -0.9942 1.8957 0.8988 0.4118 -1.4893 -0.9344 1.2506 -0.0701Program Results
TF01MD EXAMPLE PROGRAM RESULTS The output sequence Y(1),...,Y(10) is Y( 1) : 0.3078 -0.0928 Y( 2) : -1.5125 1.2611 Y( 3) : -1.2577 3.4002 Y( 4) : -0.2947 -0.7060 Y( 5) : -0.5632 5.4532 Y( 6) : -1.0846 1.1846 Y( 7) : -1.2427 2.2286 Y( 8) : 1.8097 -1.9534 Y( 9) : 0.6685 -4.4965 Y(10) : -0.0896 1.1654
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TF01MX.html 0000664 0000000 0000000 00000011371 14560147231 0020374 0 ustar 00root root 0000000 0000000
Purpose
To compute the output sequence of a linear time-invariant open-loop system given by its discrete-time state-space model with an (N+P)-by-(N+M) general system matrix S, ( A B ) S = ( ) . ( C D ) The initial state vector x(1) must be supplied by the user. The input and output trajectories are stored as in the SLICOT Library routine TF01MY.Specification
SUBROUTINE TF01MX( N, M, P, NY, S, LDS, U, LDU, X, Y, LDY, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDS, LDU, LDWORK, LDY, M, N, NY, P C .. Array Arguments .. DOUBLE PRECISION DWORK(*), S(LDS,*), U(LDU,*), X(*), Y(LDY,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NY (input) INTEGER The number of output vectors y(k) to be computed. NY >= 0. S (input) DOUBLE PRECISION array, dimension (LDS,N+M) The leading (N+P)-by-(N+M) part of this array must contain the system matrix S. LDS INTEGER The leading dimension of array S. LDS >= MAX(1,N+P). U (input) DOUBLE PRECISION array, dimension (LDU,M) The leading NY-by-M part of this array must contain the input vector sequence u(k), for k = 1,2,...,NY. Specifically, the k-th row of U must contain u(k)'. LDU INTEGER The leading dimension of array U. LDU >= MAX(1,NY). X (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the initial state vector x(1) which consists of the N initial states of the system. On exit, this array contains the final state vector x(NY+1) of the N states of the system at instant NY+1. Y (output) DOUBLE PRECISION array, dimension (LDY,P) The leading NY-by-P part of this array contains the output vector sequence y(1),y(2),...,y(NY) such that the k-th row of Y contains y(k)' (the outputs at instant k), for k = 1,2,...,NY. LDY INTEGER The leading dimension of array Y. LDY >= MAX(1,NY).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= 0, if MIN(N,P,NY) = 0; otherwise, LDWORK >= N+P, if M = 0; LDWORK >= 2*N+M+P, if M > 0. For better performance, LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given an initial state vector x(1), the output vector sequence y(1), y(2),..., y(NY) is obtained via the formulae ( x(k+1) ) ( x(k) ) ( ) = S ( ) , ( y(k) ) ( u(k) ) where each element y(k) is a vector of length P containing the outputs at instant k, and k = 1,2,...,NY.References
[1] Luenberger, D.G. Introduction to Dynamic Systems: Theory, Models and Applications. John Wiley & Sons, New York, 1979.Numerical Aspects
The algorithm requires approximately (N + M) x (N + P) x NY multiplications and additions.Further Comments
The implementation exploits data locality as much as possible, given the workspace length.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the output sequence of a linear time-invariant open-loop system given by its discrete-time state-space model (A,B,C,D), where A is an N-by-N general matrix. The initial state vector x(1) must be supplied by the user. This routine differs from SLICOT Library routine TF01MD in the way the input and output trajectories are stored.Specification
SUBROUTINE TF01MY( N, M, P, NY, A, LDA, B, LDB, C, LDC, D, LDD, $ U, LDU, X, Y, LDY, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDD, LDU, LDWORK, LDY, M, $ N, NY, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), U(LDU,*), X(*), Y(LDY,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NY (input) INTEGER The number of output vectors y(k) to be computed. NY >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading N-by-N part of this array must contain the state matrix A of the system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input matrix B of the system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the output matrix C of the system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct link matrix D of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). U (input) DOUBLE PRECISION array, dimension (LDU,M) The leading NY-by-M part of this array must contain the input vector sequence u(k), for k = 1,2,...,NY. Specifically, the k-th row of U must contain u(k)'. LDU INTEGER The leading dimension of array U. LDU >= MAX(1,NY). X (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the initial state vector x(1) which consists of the N initial states of the system. On exit, this array contains the final state vector x(NY+1) of the N states of the system at instant NY+1. Y (output) DOUBLE PRECISION array, dimension (LDY,P) The leading NY-by-P part of this array contains the output vector sequence y(1),y(2),...,y(NY) such that the k-th row of Y contains y(k)' (the outputs at instant k), for k = 1,2,...,NY. LDY INTEGER The leading dimension of array Y. LDY >= MAX(1,NY).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N). For better performance, LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given an initial state vector x(1), the output vector sequence y(1), y(2),..., y(NY) is obtained via the formulae x(k+1) = A x(k) + B u(k) y(k) = C x(k) + D u(k), where each element y(k) is a vector of length P containing the outputs at instant k and k = 1,2,...,NY.References
[1] Luenberger, D.G. Introduction to Dynamic Systems: Theory, Models and Applications. John Wiley & Sons, New York, 1979.Numerical Aspects
The algorithm requires approximately (N + M) x (N + P) x NY multiplications and additions.Further Comments
The implementation exploits data locality and uses BLAS 3 operations as much as possible, given the workspace length.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute the output sequence of a linear time-invariant open-loop system given by its discrete-time state-space model (A,B,C,D), where A is an N-by-N upper or lower Hessenberg matrix. The initial state vector x(1) must be supplied by the user.Specification
SUBROUTINE TF01ND( UPLO, N, M, P, NY, A, LDA, B, LDB, C, LDC, D, $ LDD, U, LDU, X, Y, LDY, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER UPLO INTEGER INFO, LDA, LDB, LDC, LDD, LDU, LDY, M, N, NY, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), U(LDU,*), X(*), Y(LDY,*)Arguments
Mode Parameters
UPLO CHARACTER*1 Indicates whether the user wishes to use an upper or lower Hessenberg matrix as follows: = 'U': Upper Hessenberg matrix; = 'L': Lower Hessenberg matrix.Input/Output Parameters
N (input) INTEGER The order of the matrix A. N >= 0. M (input) INTEGER The number of system inputs. M >= 0. P (input) INTEGER The number of system outputs. P >= 0. NY (input) INTEGER The number of output vectors y(k) to be computed. NY >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) If UPLO = 'U', the leading N-by-N upper Hessenberg part of this array must contain the state matrix A of the system. If UPLO = 'L', the leading N-by-N lower Hessenberg part of this array must contain the state matrix A of the system. The remainder of the leading N-by-N part is not referenced. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). B (input) DOUBLE PRECISION array, dimension (LDB,M) The leading N-by-M part of this array must contain the input matrix B of the system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input) DOUBLE PRECISION array, dimension (LDC,N) The leading P-by-N part of this array must contain the output matrix C of the system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). D (input) DOUBLE PRECISION array, dimension (LDD,M) The leading P-by-M part of this array must contain the direct link matrix D of the system. LDD INTEGER The leading dimension of array D. LDD >= MAX(1,P). U (input) DOUBLE PRECISION array, dimension (LDU,NY) The leading M-by-NY part of this array must contain the input vector sequence u(k), for k = 1,2,...,NY. Specifically, the k-th column of U must contain u(k). LDU INTEGER The leading dimension of array U. LDU >= MAX(1,M). X (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the initial state vector x(1) which consists of the N initial states of the system. On exit, this array contains the final state vector x(NY+1) of the N states of the system at instant NY. Y (output) DOUBLE PRECISION array, dimension (LDY,NY) The leading P-by-NY part of this array contains the output vector sequence y(1),y(2),...,y(NY) such that the k-th column of Y contains y(k) (the outputs at instant k), for k = 1,2,...,NY. LDY INTEGER The leading dimension of array Y. LDY >= MAX(1,P).Workspace
DWORK DOUBLE PRECISION array, dimension (N)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Given an initial state vector x(1), the output vector sequence y(1), y(2),..., y(NY) is obtained via the formulae x(k+1) = A x(k) + B u(k) y(k) = C x(k) + D u(k), where each element y(k) is a vector of length P containing the outputs at instant k and k = 1,2,...,NY.References
[1] Luenberger, D.G. Introduction to Dynamic Systems: Theory, Models and Applications. John Wiley & Sons, New York, 1979.Numerical Aspects
The algorithm requires approximately ((N+M)xP + (N/2+M)xN) x NY multiplications and additions.Further Comments
The processing time required by this routine will be approximately half that required by the SLICOT Library routine TF01MD, which treats A as a general matrix.Example
Program Text
* TF01ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX, NYMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20, NYMAX = 20 ) INTEGER LDA, LDB, LDC, LDD, LDU, LDY PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDD = PMAX, LDU = MMAX, LDY = PMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX ) * .. Local Scalars .. CHARACTER*1 UPLO INTEGER I, INFO, J, K, M, N, NY, P * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), U(LDU,NYMAX), $ X(NMAX), Y(LDY,NYMAX) * .. External Subroutines .. EXTERNAL TF01ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, NY, UPLO IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), I = 1,N ), J = 1,N ) IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99993 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M ) IF ( P.LE.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99992 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), I = 1,P ), J = 1,N ) READ ( NIN, FMT = * ) ( ( D(I,J), I = 1,P ), J = 1,M ) READ ( NIN, FMT = * ) ( X(I), I = 1,N ) IF ( NY.LE.0 .OR. NY.GT.NYMAX ) THEN WRITE ( NOUT, FMT = 99991 ) NY ELSE READ ( NIN, FMT = * ) $ ( ( U(I,J), I = 1,M ), J = 1,NY ) * Compute y(1),...,y(NY) of the given system. CALL TF01ND( UPLO, N, M, P, NY, A, LDA, B, LDB, C, $ LDC, D, LDD, U, LDU, X, Y, LDY, DWORK, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) NY DO 20 K = 1, NY WRITE ( NOUT, FMT = 99996 ) K, Y(1,K) WRITE ( NOUT, FMT = 99995 ) ( Y(J,K), J = 2,P ) 20 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TF01ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TF01ND = ',I2) 99997 FORMAT (' The output sequence Y(1),...,Y(',I2,') is',/) 99996 FORMAT (' Y(',I2,') : ',F8.4) 99995 FORMAT (9X,F8.4,/) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' M is out of range.',/' M = ',I5) 99992 FORMAT (/' P is out of range.',/' P = ',I5) 99991 FORMAT (/' NY is out of range.',/' NY = ',I5) ENDProgram Data
TF01ND EXAMPLE PROGRAM DATA 3 2 2 10 U 0.0000 -0.0700 0.0000 1.0000 0.8000 -0.1500 0.0000 0.0000 0.5000 0.0000 2.0000 1.0000 -1.0000 -0.1000 1.0000 0.0000 1.0000 0.0000 0.0000 1.0000 0.0000 1.0000 0.5000 0.0000 0.5000 1.0000 1.0000 1.0000 -0.6922 -1.4934 0.3081 -2.7726 2.0039 0.2614 -0.9160 -0.6030 1.2556 0.2951 -1.5734 1.5639 -0.9942 1.8957 0.8988 0.4118 -1.4893 -0.9344 1.2506 -0.0701Program Results
TF01ND EXAMPLE PROGRAM RESULTS The output sequence Y(1),...,Y(10) is Y( 1) : 0.3078 -0.0928 Y( 2) : -1.5275 1.2611 Y( 3) : -1.3026 3.4002 Y( 4) : -0.3512 -0.7060 Y( 5) : -0.5922 5.4532 Y( 6) : -1.1693 1.1846 Y( 7) : -1.3029 2.2286 Y( 8) : 1.7529 -1.9534 Y( 9) : 0.6793 -4.4965 Y(10) : -0.0349 1.1654
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TF01OD.html 0000664 0000000 0000000 00000015250 14560147231 0020352 0 ustar 00root root 0000000 0000000
Purpose
To construct the block Hankel expansion T of a multivariable parameter sequence M(1),...,M(NR+NC-1), where each parameter M(k) is an NH1-by-NH2 block matrix and k = 1,2,...,(NR+NC-1).Specification
SUBROUTINE TF01OD( NH1, NH2, NR, NC, H, LDH, T, LDT, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDH, LDT, NC, NH1, NH2, NR C .. Array Arguments .. DOUBLE PRECISION H(LDH,*), T(LDT,*)Arguments
Input/Output Parameters
NH1 (input) INTEGER The number of rows in each parameter M(k). NH1 >= 0. NH2 (input) INTEGER The number of columns in each parameter M(k). NH2 >= 0. NR (input) INTEGER The number of parameters required in each column of the block Hankel expansion matrix T. NR >= 0. NC (input) INTEGER The number of parameters required in each row of the block Hankel expansion matrix T. NC >= 0. H (input) DOUBLE PRECISION array, dimension (LDH,(NR+NC-1)*NH2) The leading NH1-by-(NR+NC-1)*NH2 part of this array must contain the multivariable sequence M(k), where k = 1,2, ...,(NR+NC-1). Specifically, each parameter M(k) is an NH1-by-NH2 matrix whose (i,j)-th element must be stored in H(i,(k-1)*NH2+j) for i = 1,2,...,NH1 and j = 1,2,...,NH2. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,NH1). T (output) DOUBLE PRECISION array, dimension (LDT,NH2*NC) The leading NH1*NR-by-NH2*NC part of this array contains the block Hankel expansion of the multivariable sequence M(k). LDT INTEGER The leading dimension of array T. LDT >= MAX(1,NH1*NR).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The NH1-by-NH2 dimensional parameters M(k) of a multivariable sequence are arranged into a matrix T in Hankel form such that | M(1) M(2) M(3) . . . M(NC) | | | | M(2) M(3) M(4) . . . M(NC+1) | T = | . . . . |. | . . . . | | . . . . | | | | M(NR) M(NR+1) M(NR+2) . . . M(NR+NC-1)|References
[1] Johvidov, J.S. Hankel and Toeplitz Matrices and Forms: Algebraic Theory, (translated by G.P.A. Thijsse, I. Gohberg, ed.). Birkhaeuser, Boston, 1982.Numerical Aspects
The time taken is approximately proportional to NH1 x NH2 x NR x NC.Further Comments
NoneExample
Program Text
* TF01OD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NH1MAX, NH2MAX, NRMAX, NCMAX PARAMETER ( NH1MAX = 20, NH2MAX = 20, NRMAX = 20, $ NCMAX = 20 ) INTEGER LDH, LDT PARAMETER ( LDH = NH1MAX, LDT = NH1MAX*NRMAX ) * .. Local Scalars .. INTEGER I, INFO, J, NC, NCT, NH1, NH2, NR, NRT * .. Local Arrays .. DOUBLE PRECISION H(LDH,(NRMAX+NCMAX-1)*NH2MAX), $ T(LDT,NH2MAX*NCMAX) * .. External Subroutines .. EXTERNAL TF01OD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) NH1, NH2, NR, NC IF ( NH1.LE.0 .OR. NH1.GE.NH1MAX ) THEN WRITE ( NOUT, FMT = 99995 ) NH1 ELSE IF ( NH2.LE.0 .OR. NH2.GT.NH2MAX ) THEN WRITE ( NOUT, FMT = 99994 ) NH2 ELSE IF ( NR.LE.0 .OR. NR.GT.NRMAX ) THEN WRITE ( NOUT, FMT = 99993 ) NR ELSE IF ( NC.LE.0 .OR. NC.GT.NCMAX ) THEN WRITE ( NOUT, FMT = 99992 ) NC ELSE READ ( NIN, FMT = * ) $ ( ( H(I,J), I = 1,NH1 ), J = 1,( NR+NC-1 )*NH2 ) * Construct the NRT by NCT block Hankel expansion of M(k). CALL TF01OD( NH1, NH2, NR, NC, H, LDH, T, LDT, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE NRT = NH1*NR NCT = NH2*NC WRITE ( NOUT, FMT = 99997 ) NRT, NCT DO 20 I = 1, NRT WRITE ( NOUT, FMT = 99996 ) ( T(I,J), J = 1,NCT ) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' TF01OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TF01OD = ',I2) 99997 FORMAT (' The ',I2,' by ',I2,' matrix T is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' NH1 is out of range.',/' NH1 = ',I5) 99994 FORMAT (/' NH2 is out of range.',/' NH2 = ',I5) 99993 FORMAT (/' NR is out of range.',/' NR = ',I5) 99992 FORMAT (/' NC is out of range.',/' NC = ',I5) ENDProgram Data
TF01OD EXAMPLE PROGRAM DATA 2 2 3 3 1.0647 -0.4282 -0.4922 -1.2072 -0.3043 0.6883 -0.0926 0.7167 -0.1844 -0.8507 0.4441 -0.0478 0.7195 0.0500 -0.3955 0.5674 1.3387 -0.2801 0.1073 -0.5315Program Results
TF01OD EXAMPLE PROGRAM RESULTS The 6 by 6 matrix T is 1.0647 -0.4922 -0.3043 -0.0926 -0.1844 0.4441 -0.4282 -1.2072 0.6883 0.7167 -0.8507 -0.0478 -0.3043 -0.0926 -0.1844 0.4441 0.7195 -0.3955 0.6883 0.7167 -0.8507 -0.0478 0.0500 0.5674 -0.1844 0.4441 0.7195 -0.3955 1.3387 0.1073 -0.8507 -0.0478 0.0500 0.5674 -0.2801 -0.5315
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TF01PD.html 0000664 0000000 0000000 00000015406 14560147231 0020356 0 ustar 00root root 0000000 0000000
Purpose
To construct the block Toeplitz expansion T of a multivariable parameter sequence M(1),...,M(NR+NC-1), where each parameter M(k) is an NH1-by-NH2 block matrix and k = 1,2,...,(NR+NC-1).Specification
SUBROUTINE TF01PD( NH1, NH2, NR, NC, H, LDH, T, LDT, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDH, LDT, NC, NH1, NH2, NR C .. Array Arguments .. DOUBLE PRECISION H(LDH,*), T(LDT,*)Arguments
Input/Output Parameters
NH1 (input) INTEGER The number of rows in each parameter M(k). NH1 >= 0. NH2 (input) INTEGER The number of columns in each parameter M(k). NH2 >= 0. NR (input) INTEGER The number of parameters required in each column of the block Toeplitz expansion matrix T. NR >= 0. NC (input) INTEGER The number of parameters required in each row of the block Toeplitz expansion matrix T. NC >= 0. H (input) DOUBLE PRECISION array, dimension (LDH,(NR+NC-1)*NH2) The leading NH1-by-(NR+NC-1)*NH2 part of this array must contain the multivariable sequence M(k), where k = 1,2, ...,(NR+NC-1). Specifically, each parameter M(k) is an NH1-by-NH2 matrix whose (i,j)-th element must be stored in H(i,(k-1)*NH2+j) for i = 1,2,...,NH1 and j = 1,2,...,NH2. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,NH1). T (output) DOUBLE PRECISION array, dimension (LDT,NH2*NC) The leading NH1*NR-by-NH2*NC part of this array contains the block Toeplitz expansion of the multivariable sequence M(k). LDT INTEGER The leading dimension of array T. LDT >= MAX(1,NH1*NR).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The NH1-by-NH2 dimensional parameters M(k) of a multivariable sequence are arranged into a matrix T in Toeplitz form such that | M(NC) M(NC-1) M(NC-2) . . . M(1) | | | | M(NC+1) M(NC) M(NC-1) . . . M(2) | T = | . . . . |. | . . . . | | . . . . | | | | M(NR+NC-1) M(NR+NC-2) M(NR+NC-3) . . . M(NR) |References
[1] Johvidov, J.S. Hankel and Toeplitz Matrices and Forms: Algebraic Theory, (translated by G.P.A. Thijsse, I. Gohberg, ed.). Birkhaeuser, Boston, 1982.Numerical Aspects
The time taken is approximately proportional to NH1 x NH2 x NR x NC.Further Comments
NoneExample
Program Text
* TF01PD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NH1MAX, NH2MAX, NRMAX, NCMAX PARAMETER ( NH1MAX = 20, NH2MAX = 20, NRMAX = 20, $ NCMAX = 20 ) INTEGER LDH, LDT PARAMETER ( LDH = NH1MAX, LDT = NH1MAX*NRMAX ) * .. Local Scalars .. INTEGER I, INFO, J, NC, NCT, NH1, NH2, NR, NRT * .. Local Arrays .. DOUBLE PRECISION H(LDH,(NRMAX+NCMAX-1)*NH2MAX), $ T(LDT,NH2MAX*NCMAX) * .. External Subroutines .. EXTERNAL TF01PD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) NH1, NH2, NR, NC IF ( NH1.LE.0 .OR. NH1.GE.NH1MAX ) THEN WRITE ( NOUT, FMT = 99995 ) NH1 ELSE IF ( NH2.LE.0 .OR. NH2.GT.NH2MAX ) THEN WRITE ( NOUT, FMT = 99994 ) NH2 ELSE IF ( NR.LE.0 .OR. NR.GT.NRMAX ) THEN WRITE ( NOUT, FMT = 99993 ) NR ELSE IF ( NC.LE.0 .OR. NC.GT.NCMAX ) THEN WRITE ( NOUT, FMT = 99992 ) NC ELSE READ ( NIN, FMT = * ) $ ( ( H(I,J), I = 1,NH1 ), J = 1,( NR+NC-1 )*NH2 ) * Construct the NRT by NCT block Toeplitz expansion of M(k). CALL TF01PD( NH1, NH2, NR, NC, H, LDH, T, LDT, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE NRT = NH1*NR NCT = NH2*NC WRITE ( NOUT, FMT = 99997 ) NRT, NCT DO 20 I = 1, NRT WRITE ( NOUT, FMT = 99996 ) ( T(I,J), J = 1,NCT ) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' TF01PD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TF01PD = ',I2) 99997 FORMAT (' The ',I2,' by ',I2,' matrix T is ') 99996 FORMAT (20(1X,F8.4)) 99995 FORMAT (/' NH1 is out of range.',/' NH1 = ',I5) 99994 FORMAT (/' NH2 is out of range.',/' NH2 = ',I5) 99993 FORMAT (/' NR is out of range.',/' NR = ',I5) 99992 FORMAT (/' NC is out of range.',/' NC = ',I5) ENDProgram Data
TF01PD EXAMPLE PROGRAM DATA 2 2 3 3 1.0647 -0.4282 -0.4922 -1.2072 -0.3043 0.6883 -0.0926 0.7167 -0.1844 -0.8507 0.4441 -0.0478 0.7195 0.0500 -0.3955 0.5674 1.3387 -0.2801 0.1073 -0.5315Program Results
TF01PD EXAMPLE PROGRAM RESULTS The 6 by 6 matrix T is -0.1844 0.4441 -0.3043 -0.0926 1.0647 -0.4922 -0.8507 -0.0478 0.6883 0.7167 -0.4282 -1.2072 0.7195 -0.3955 -0.1844 0.4441 -0.3043 -0.0926 0.0500 0.5674 -0.8507 -0.0478 0.6883 0.7167 1.3387 0.1073 0.7195 -0.3955 -0.1844 0.4441 -0.2801 -0.5315 0.0500 0.5674 -0.8507 -0.0478
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TF01QD.html 0000664 0000000 0000000 00000023322 14560147231 0020353 0 ustar 00root root 0000000 0000000
Purpose
To compute N Markov parameters M(1), M(2),..., M(N) from a multivariable system whose transfer function matrix G(z) is given.Specification
SUBROUTINE TF01QD( NC, NB, N, IORD, AR, MA, H, LDH, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDH, N, NB, NC C .. Array Arguments .. INTEGER IORD(*) DOUBLE PRECISION AR(*), H(LDH,*), MA(*)Arguments
Input/Output Parameters
NC (input) INTEGER The number of system outputs, i.e. the number of rows in the transfer function matrix G(z). NC >= 0. NB (input) INTEGER The number of system inputs, i.e. the number of columns in the transfer function matrix G(z). NB >= 0. N (input) INTEGER The number of Markov parameters M(k) to be computed. N >= 0. IORD (input) INTEGER array, dimension (NC*NB) This array must contain the order r of the elements of the transfer function matrix G(z), stored row by row. For example, the order of the (i,j)-th element of G(z) is given by IORD((i-1)xNB+j). AR (input) DOUBLE PRECISION array, dimension (NA), where NA = IORD(1) + IORD(2) + ... + IORD(NC*NB). The leading NA elements of this array must contain the denominator coefficients AR(1),...,AR(r) in equation (1) of the (i,j)-th element of the transfer function matrix G(z), stored row by row, i.e. in the order (1,1),(1,2),...,(1,NB), (2,1),(2,2),...,(2,NB), ..., (NC,1),(NC,2),...,(NC,NB). The coefficients must be given in decreasing order of powers of z; the coefficient of the highest order term is assumed to be equal to 1. MA (input) DOUBLE PRECISION array, dimension (NA) The leading NA elements of this array must contain the numerator coefficients MA(1),...,MA(r) in equation (1) of the (i,j)-th element of the transfer function matrix G(z), stored row by row, i.e. in the order (1,1),(1,2),...,(1,NB), (2,1),(2,2),...,(2,NB), ..., (NC,1),(NC,2),...,(NC,NB). The coefficients must be given in decreasing order of powers of z. H (output) DOUBLE PRECISION array, dimension (LDH,N*NB) The leading NC-by-N*NB part of this array contains the multivariable Markov parameter sequence M(k), where each parameter M(k) is an NC-by-NB matrix and k = 1,2,...,N. The Markov parameters are stored such that H(i,(k-1)xNB+j) contains the (i,j)-th element of M(k) for i = 1,2,...,NC and j = 1,2,...,NB. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,NC).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The (i,j)-th element of G(z), defining the particular I/O transfer between output i and input j, has the following form: -1 -2 -r MA(1)z + MA(2)z + ... + MA(r)z G (z) = ----------------------------------------. (1) ij -1 -2 -r 1 + AR(1)z + AR(2)z + ... + AR(r)z The (i,j)-th element of G(z) is defined by its order r, its r moving average coefficients (= numerator) MA(1),...,MA(r) and its r autoregressive coefficients (= denominator) AR(1),...,AR(r). The coefficient of the constant term in the denominator is assumed to be equal to 1. The relationship between the (i,j)-th element of the Markov parameters M(1),M(2),...,M(N) and the corresponding element of the transfer function matrix G(z) is given by: -1 -2 -k G (z) = M (0) + M (1)z + M (2)z + ... + M (k)z + ...(2) ij ij ij ij ij Equating (1) and (2), we find that the relationship between the (i,j)-th element of the Markov parameters M(k) and the ARMA parameters AR(1),...,AR(r) and MA(1),...,MA(r) of the (i,j)-th element of the transfer function matrix G(z) is as follows: M (1) = MA(1), ij k-1 M (k) = MA(k) - SUM AR(p) x M (k-p) for 1 < k <= r and ij p=1 ij r M (k+r) = - SUM AR(p) x M (k+r-p) for k > 0. ij p=1 ij From these expressions the Markov parameters M(k) are computed element by element.References
[1] Luenberger, D.G. Introduction to Dynamic Systems: Theory, Models and Applications. John Wiley & Sons, New York, 1979.Numerical Aspects
The computation of the (i,j)-th element of M(k) requires: (k-1) multiplications and k additions if k <= r; r multiplications and r additions if k > r.Further Comments
NoneExample
Program Text
* TF01QD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, NAMAX, NBMAX, NCMAX PARAMETER ( NMAX = 20, NAMAX = 20, NBMAX = 20, NCMAX = 20 ) INTEGER LDH PARAMETER ( LDH = NCMAX ) * .. Local Scalars .. INTEGER I, INFO, J, K, L, N, NA, NASUM, NB, NC, NL, NORD LOGICAL ERROR * .. Local Arrays .. DOUBLE PRECISION AR(NAMAX), H(LDH,NMAX*NBMAX), MA(NAMAX) INTEGER IORD(NCMAX*NBMAX) * .. External Subroutines .. EXTERNAL TF01QD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, NA, NB, NC IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE IF ( NA.LE.0 .OR. NA.GT.NAMAX ) THEN WRITE ( NOUT, FMT = 99993 ) NA ELSE IF ( NB.LE.0 .OR. NB.GT.NBMAX ) THEN WRITE ( NOUT, FMT = 99992 ) NB ELSE IF ( NC.LE.0 .OR. NC.GT.NCMAX ) THEN WRITE ( NOUT, FMT = 99991 ) NC ELSE ERROR = .FALSE. NL = 0 K = 1 NASUM = 0 DO 40 I = 1, NC DO 20 J = 1, NB READ ( NIN, FMT = * ) NORD NASUM = NASUM + NORD IF ( NA.GE.NASUM ) THEN READ ( NIN, FMT = * ) ( MA(NL+L), L = 1,NORD ) READ ( NIN, FMT = * ) ( AR(NL+L), L = 1,NORD ) IORD(K) = NORD K = K + 1 NL = NL + NORD ELSE WRITE ( NOUT, FMT = 99993 ) NA ERROR = .TRUE. END IF 20 CONTINUE 40 CONTINUE IF ( .NOT. ERROR ) THEN * Compute M(1),...,M(N) from the given transfer function * matrix G(z). CALL TF01QD( NC, NB, N, IORD, AR, MA, H, LDH, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) N DO 80 K = 1, N WRITE ( NOUT, FMT = 99996 ) K, $ ( H(1,(K-1)*NB+J), J = 1,NB ) DO 60 I = 2, NC WRITE ( NOUT, FMT = 99995 ) $ ( H(I,(K-1)*NB+J), J = 1,NB ) 60 CONTINUE 80 CONTINUE END IF END IF END IF STOP * 99999 FORMAT (' TF01QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TF01QD = ',I2) 99997 FORMAT (' The Markov Parameters M(1),...,M(',I1,') are ') 99996 FORMAT (/' M(',I1,') : ',20(1X,F8.4)) 99995 FORMAT (8X,20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' NA is out of range.',/' NA = ',I5) 99992 FORMAT (/' NB is out of range.',/' NB = ',I5) 99991 FORMAT (/' NC is out of range.',/' NC = ',I5) ENDProgram Data
TF01QD EXAMPLE PROGRAM DATA 8 10 2 2 2 1.0 -0.5 0.6 -0.2 1 1.0 -0.8 3 0.5 -0.4 0.3 0.8 0.4 0.1 4 1.0 0.5 -0.5 0.0 -0.8 0.6 0.0 -0.2Program Results
TF01QD EXAMPLE PROGRAM RESULTS The Markov Parameters M(1),...,M(8) are M(1) : 1.0000 1.0000 0.5000 1.0000 M(2) : -1.1000 0.8000 -0.8000 1.3000 M(3) : 0.8600 0.6400 0.7400 -0.0600 M(4) : -0.7360 0.5120 -0.3220 -0.8280 M(5) : 0.6136 0.4096 0.0416 -0.4264 M(6) : -0.5154 0.3277 0.0215 0.4157 M(7) : 0.4319 0.2621 -0.0017 0.5764 M(8) : -0.3622 0.2097 -0.0114 0.0461
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TF01RD.html 0000664 0000000 0000000 00000020145 14560147231 0020354 0 ustar 00root root 0000000 0000000
Purpose
To compute N Markov parameters M(1), M(2),..., M(N) from the parameters (A,B,C) of a linear time-invariant system, where each M(k) is an NC-by-NB matrix and k = 1,2,...,N. All matrices are treated as dense, and hence TF01RD is not intended for large sparse problems.Specification
SUBROUTINE TF01RD( NA, NB, NC, N, A, LDA, B, LDB, C, LDC, H, LDH, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDH, LDWORK, N, NA, NB, NC C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), H(LDH,*)Arguments
Input/Output Parameters
NA (input) INTEGER The order of the matrix A. NA >= 0. NB (input) INTEGER The number of system inputs. NB >= 0. NC (input) INTEGER The number of system outputs. NC >= 0. N (input) INTEGER The number of Markov parameters M(k) to be computed. N >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,NA) The leading NA-by-NA part of this array must contain the state matrix A of the system. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,NA). B (input) DOUBLE PRECISION array, dimension (LDB,NB) The leading NA-by-NB part of this array must contain the input matrix B of the system. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,NA). C (input) DOUBLE PRECISION array, dimension (LDC,NA) The leading NC-by-NA part of this array must contain the output matrix C of the system. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,NC). H (output) DOUBLE PRECISION array, dimension (LDH,N*NB) The leading NC-by-N*NB part of this array contains the multivariable parameters M(k), where each parameter M(k) is an NC-by-NB matrix and k = 1,2,...,N. The Markov parameters are stored such that H(i,(k-1)xNB+j) contains the (i,j)-th element of M(k) for i = 1,2,...,NC and j = 1,2,...,NB. LDH INTEGER The leading dimension of array H. LDH >= MAX(1,NC).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, 2*NA*NC).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
For the linear time-invariant discrete-time system x(k+1) = A x(k) + B u(k) y(k) = C x(k) + D u(k), the transfer function matrix G(z) is given by -1 G(z) = C(zI-A) B + D -1 -2 2 -3 = D + CB z + CAB z + CA B z + ... (1) Using Markov parameters, G(z) can also be written as -1 -2 -3 G(z) = M(0) + M(1)z + M(2)z + M(3)z + ... (2) k-1 Equating (1) and (2), we find that M(0) = D and M(k) = C A B for k > 0, from which the Markov parameters M(1),M(2)...,M(N) are computed.References
[1] Chen, C.T. Introduction to Linear System Theory. H.R.W. Series in Electrical Engineering, Electronics and Systems, Holt, Rinehart and Winston Inc., London, 1970.Numerical Aspects
The algorithm requires approximately (NA + NB) x NA x NC x N multiplications and additions.Further Comments
NoneExample
Program Text
* TF01RD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, NAMAX, NBMAX, NCMAX PARAMETER ( NMAX = 20, NAMAX = 20, NBMAX = 20, NCMAX = 20 ) INTEGER LDA, LDB, LDC, LDH PARAMETER ( LDA = NAMAX, LDB = NAMAX, LDC = NCMAX, $ LDH = NCMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 2*NAMAX*NCMAX ) * .. Local Scalars .. INTEGER I, INFO, J, K, N, NA, NB, NC * .. Local Arrays .. DOUBLE PRECISION A(LDA,NAMAX), B(LDB,NBMAX), C(LDC,NAMAX), $ H(LDH,NMAX*NBMAX), DWORK(LDWORK) * .. External Subroutines .. EXTERNAL TF01RD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, NA, NB, NC IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE IF ( NA.LE.0 .OR. NA.GT.NAMAX ) THEN WRITE ( NOUT, FMT = 99993 ) NA ELSE READ ( NIN, FMT = * ) ( ( A(I,J), I = 1,NA ), J = 1,NA ) IF ( NB.LE.0 .OR. NB.GT.NBMAX ) THEN WRITE ( NOUT, FMT = 99992 ) NB ELSE READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,NA ), J = 1,NB ) IF ( NC.LE.0 .OR. NC.GT.NCMAX ) THEN WRITE ( NOUT, FMT = 99991 ) NC ELSE READ ( NIN, FMT = * ) ( ( C(I,J), I = 1,NC ), J = 1,NA ) * Compute M(1),...,M(N) from the system (A,B,C). CALL TF01RD( NA, NB, NC, N, A, LDA, B, LDB, C, LDC, H, $ LDH, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) N DO 40 K = 1, N WRITE ( NOUT, FMT = 99996 ) K, $ ( H(1,(K-1)*NB+J), J = 1,NB ) DO 20 I = 2, NC WRITE ( NOUT, FMT = 99995 ) $ ( H(I,(K-1)*NB+J), J = 1,NB ) 20 CONTINUE 40 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TF01RD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TF01RD = ',I2) 99997 FORMAT (' The Markov Parameters M(1),...,M(',I1,') are ') 99996 FORMAT (/' M(',I1,') : ',20(1X,F8.4)) 99995 FORMAT (8X,20(1X,F8.4)) 99994 FORMAT (/' N is out of range.',/' N = ',I5) 99993 FORMAT (/' NA is out of range.',/' NA = ',I5) 99992 FORMAT (/' NB is out of range.',/' NB = ',I5) 99991 FORMAT (/' NC is out of range.',/' NC = ',I5) ENDProgram Data
TF01RD EXAMPLE PROGRAM DATA 5 3 2 2 0.000 -0.070 0.015 1.000 0.800 -0.150 0.000 0.000 0.500 0.000 2.000 1.000 -1.000 -0.100 1.000 0.000 1.000 0.000 0.000 1.000 0.000Program Results
TF01RD EXAMPLE PROGRAM RESULTS The Markov Parameters M(1),...,M(5) are M(1) : 1.0000 1.0000 0.0000 -1.0000 M(2) : 0.2000 0.5000 2.0000 -0.1000 M(3) : -0.1100 0.2500 1.6000 -0.0100 M(4) : -0.2020 0.1250 1.1400 -0.0010 M(5) : -0.2039 0.0625 0.8000 -0.0001
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01AD.html 0000664 0000000 0000000 00000032026 14560147231 0020335 0 ustar 00root root 0000000 0000000
Purpose
To balance the matrices of the system pencil S = ( A B ) - lambda ( E 0 ) := Q - lambda Z, ( C 0 ) ( 0 0 ) corresponding to the descriptor triple (A-lambda E,B,C), by balancing. This involves diagonal similarity transformations (Dl*A*Dr - lambda Dl*E*Dr, Dl*B, C*Dr) applied to the system (A-lambda E,B,C) to make the rows and columns of system pencil matrices diag(Dl,I) * S * diag(Dr,I) as close in norm as possible. Balancing may reduce the 1-norms of the matrices of the system pencil S. The balancing can be performed optionally on the following particular system pencils S = A-lambda E, S = ( A-lambda E B ), or S = ( A-lambda E ). ( C )Specification
SUBROUTINE TG01AD( JOB, L, N, M, P, THRESH, A, LDA, E, LDE, $ B, LDB, C, LDC, LSCALE, RSCALE, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER INFO, L, LDA, LDB, LDC, LDE, M, N, P DOUBLE PRECISION THRESH C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), LSCALE( * ), $ RSCALE( * )Arguments
Mode Parameters
JOB CHARACTER*1 Indicates which matrices are involved in balancing, as follows: = 'A': All matrices are involved in balancing; = 'B': B, A and E matrices are involved in balancing; = 'C': C, A and E matrices are involved in balancing; = 'N': B and C matrices are not involved in balancing.Input/Output Parameters
L (input) INTEGER The number of rows of matrices A, B, and E. L >= 0. N (input) INTEGER The number of columns of matrices A, E, and C. N >= 0. M (input) INTEGER The number of columns of matrix B. M >= 0. P (input) INTEGER The number of rows of matrix C. P >= 0. THRESH (input) DOUBLE PRECISION Threshold value for magnitude of elements: elements with magnitude less than or equal to THRESH are ignored for balancing. THRESH >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A. On exit, the leading L-by-N part of this array contains the balanced matrix Dl*A*Dr. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E. On exit, the leading L-by-N part of this array contains the balanced matrix Dl*E*Dr. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the input/state matrix B. On exit, if M > 0, the leading L-by-M part of this array contains the balanced matrix Dl*B. The array B is not referenced if M = 0. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L) if M > 0 or LDB >= 1 if M = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, if P > 0, the leading P-by-N part of this array contains the balanced matrix C*Dr. The array C is not referenced if P = 0. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). LSCALE (output) DOUBLE PRECISION array, dimension (L) The scaling factors applied to S from left. If Dl(j) is the scaling factor applied to row j, then SCALE(j) = Dl(j), for j = 1,...,L. RSCALE (output) DOUBLE PRECISION array, dimension (N) The scaling factors applied to S from right. If Dr(j) is the scaling factor applied to column j, then SCALE(j) = Dr(j), for j = 1,...,N.Workspace
DWORK DOUBLE PRECISION array, dimension (3*(L+N))Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
Balancing consists of applying a diagonal similarity transformation -1 diag(Dl,I) * S * diag(Dr,I) to make the 1-norms of each row of the first L rows of S and its corresponding N columns nearly equal. Information about the diagonal matrices Dl and Dr are returned in the vectors LSCALE and RSCALE, respectively.References
[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. [2] R.C. Ward, R. C. Balancing the generalized eigenvalue problem. SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* TG01AD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, MMAX, PMAX PARAMETER ( LMAX = 20, NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = PMAX, $ LDE = LMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, 3*(LMAX+NMAX ) ) ) * .. Local Scalars .. CHARACTER*1 JOBS INTEGER I, INFO, J, L, M, N, P DOUBLE PRECISION ABCNRM, ENORM, SABCNM, SENORM, THRESH * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), LSCALE(LMAX), $ RSCALE(NMAX) * .. External Functions .. DOUBLE PRECISION DLANGE EXTERNAL DLANGE * .. External Subroutines .. EXTERNAL TG01AD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, M, P, JOBS, THRESH IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99989 ) L ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,L ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Compute norms before scaling ABCNRM = MAX( DLANGE( '1', L, N, A, LDA, DWORK ), $ DLANGE( '1', L, M, B, LDB, DWORK ), $ DLANGE( '1', P, N, C, LDC, DWORK ) ) ENORM = DLANGE( '1', L, N, E, LDE, DWORK ) * Find the transformed descriptor system * (A-lambda E,B,C). CALL TG01AD( JOBS, L, N, M, P, THRESH, A, LDA, E, LDE, $ B, LDB, C, LDC, LSCALE, RSCALE, DWORK, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE SABCNM = MAX( DLANGE( '1', L, N, A, LDA, DWORK ), $ DLANGE( '1', L, M, B, LDB, DWORK ), $ DLANGE( '1', P, N, C, LDC, DWORK ) ) SENORM = DLANGE( '1', L, N, E, LDE, DWORK ) WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) WRITE ( NOUT, FMT = 99995 ) ( LSCALE(I), I = 1,L ) WRITE ( NOUT, FMT = 99990 ) WRITE ( NOUT, FMT = 99995 ) ( RSCALE(J), J = 1,N ) WRITE ( NOUT, FMT = 99994 ) $ ABCNRM, SABCNM, ENORM, SENORM END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01AD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01AD = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Dl*A*Dr is ') 99996 FORMAT (/' The transformed descriptor matrix Dl*E*Dr is ') 99995 FORMAT (20(1X,F9.4)) 99994 FORMAT (/' Norm of [ A B; C 0] =', 1PD10.3/ $ ' Norm of scaled [ A B; C 0] =', 1PD10.3/ $ ' Norm of E =', 1PD10.3/ $ ' Norm of scaled E =', 1PD10.3) 99993 FORMAT (/' The transformed input/state matrix Dl*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Dr is ') 99991 FORMAT (/' The diagonal of left scaling matrix Dl is ') 99990 FORMAT (/' The diagonal of right scaling matrix Dr is ') 99989 FORMAT (/' L is out of range.',/' L = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TG01AD EXAMPLE PROGRAM DATA 4 4 2 2 A 0.0 -1 0 0 0.003 0 0 0.1000 0.02 100 10 0 0.4 0 0 0 0.0 1 0.2 0 0.0 0 1 0 0.01 300 90 6 0.3 0 0 20 0.0 10 0 0 0 0 1000 10000 10000 -0.1 0.0 0.001 0.0 0.0 0.01 -0.001 0.0001Program Results
TG01AD EXAMPLE PROGRAM RESULTS The transformed state dynamics matrix Dl*A*Dr is -1.0000 0.0000 0.0000 0.3000 0.0000 0.0000 1.0000 2.0000 1.0000 0.1000 0.0000 0.4000 0.0000 0.0000 0.0000 0.0000 The transformed descriptor matrix Dl*E*Dr is 1.0000 0.2000 0.0000 0.0000 0.0000 1.0000 0.0000 1.0000 3.0000 0.9000 0.6000 0.3000 0.0000 0.0000 0.2000 0.0000 The transformed input/state matrix Dl*B is 100.0000 0.0000 0.0000 0.0000 0.0000 100.0000 100.0000 100.0000 The transformed state/output matrix C*Dr is -0.0100 0.0000 0.0010 0.0000 0.0000 0.0010 -0.0010 0.0010 The diagonal of left scaling matrix Dl is 10.0000 10.0000 0.1000 0.0100 The diagonal of right scaling matrix Dr is 0.1000 0.1000 1.0000 10.0000 Norm of [ A B; C 0] = 1.100D+04 Norm of scaled [ A B; C 0] = 2.000D+02 Norm of E = 3.010D+02 Norm of scaled E = 4.000D+00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01AZ.html 0000664 0000000 0000000 00000033465 14560147231 0020373 0 ustar 00root root 0000000 0000000
Purpose
To balance the matrices of the system pencil S = ( A B ) - lambda ( E 0 ) := Q - lambda Z, ( C 0 ) ( 0 0 ) corresponding to the descriptor triple (A-lambda E,B,C), by balancing. This involves diagonal similarity transformations (Dl*A*Dr - lambda Dl*E*Dr, Dl*B, C*Dr) applied to the system (A-lambda E,B,C) to make the rows and columns of system pencil matrices diag(Dl,I) * S * diag(Dr,I) as close in norm as possible. Balancing may reduce the 1-norms of the matrices of the system pencil S. The balancing can be performed optionally on the following particular system pencils S = A-lambda E, S = ( A-lambda E B ), or S = ( A-lambda E ). ( C )Specification
SUBROUTINE TG01AZ( JOB, L, N, M, P, THRESH, A, LDA, E, LDE, $ B, LDB, C, LDC, LSCALE, RSCALE, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER INFO, L, LDA, LDB, LDC, LDE, M, N, P DOUBLE PRECISION THRESH C .. Array Arguments .. COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * ), $ E( LDE, * ) DOUBLE PRECISION DWORK( * ), LSCALE( * ), RSCALE( * )Arguments
Mode Parameters
JOB CHARACTER*1 Indicates which matrices are involved in balancing, as follows: = 'A': All matrices are involved in balancing; = 'B': B, A and E matrices are involved in balancing; = 'C': C, A and E matrices are involved in balancing; = 'N': B and C matrices are not involved in balancing.Input/Output Parameters
L (input) INTEGER The number of rows of matrices A, B, and E. L >= 0. N (input) INTEGER The number of columns of matrices A, E, and C. N >= 0. M (input) INTEGER The number of columns of matrix B. M >= 0. P (input) INTEGER The number of rows of matrix C. P >= 0. THRESH (input) DOUBLE PRECISION Threshold value for magnitude of elements: elements with magnitude less than or equal to THRESH are ignored for balancing. THRESH >= 0. The magnitude is computed as the sum of the absolute values of the real and imaginary parts. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A. On exit, the leading L-by-N part of this array contains the balanced matrix Dl*A*Dr. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) COMPLEX*16 array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E. On exit, the leading L-by-N part of this array contains the balanced matrix Dl*E*Dr. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). B (input/output) COMPLEX*16 array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the input/state matrix B. On exit, if M > 0, the leading L-by-M part of this array contains the balanced matrix Dl*B. The array B is not referenced if M = 0. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L) if M > 0 or LDB >= 1 if M = 0. C (input/output) COMPLEX*16 array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, if P > 0, the leading P-by-N part of this array contains the balanced matrix C*Dr. The array C is not referenced if P = 0. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). LSCALE (output) DOUBLE PRECISION array, dimension (L) The scaling factors applied to S from left. If Dl(j) is the scaling factor applied to row j, then SCALE(j) = Dl(j), for j = 1,...,L. RSCALE (output) DOUBLE PRECISION array, dimension (N) The scaling factors applied to S from right. If Dr(j) is the scaling factor applied to column j, then SCALE(j) = Dr(j), for j = 1,...,N.Workspace
DWORK DOUBLE PRECISION array, dimension (3*(L+N))Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
Balancing consists of applying a diagonal similarity transformation -1 diag(Dl,I) * S * diag(Dr,I) to make the 1-norms of each row of the first L rows of S and its corresponding N columns nearly equal. Information about the diagonal matrices Dl and Dr are returned in the vectors LSCALE and RSCALE, respectively.References
[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. [2] R.C. Ward, R. C. Balancing the generalized eigenvalue problem. SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* TG01AZ EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, MMAX, PMAX PARAMETER ( LMAX = 20, NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = PMAX, $ LDE = LMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, 3*(LMAX+NMAX ) ) ) * .. Local Scalars .. CHARACTER*1 JOBS INTEGER I, INFO, J, L, M, N, P DOUBLE PRECISION ABCNRM, ENORM, SABCNM, SENORM, THRESH * .. Local Arrays .. COMPLEX*16 A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ E(LDE,NMAX) DOUBLE PRECISION DWORK(LDWORK), LSCALE(LMAX), RSCALE(NMAX) * .. External Functions .. DOUBLE PRECISION ZLANGE EXTERNAL ZLANGE * .. External Subroutines .. EXTERNAL TG01AZ * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, M, P, JOBS, THRESH IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99989 ) L ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,L ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Compute norms before scaling ABCNRM = MAX( ZLANGE( '1', L, N, A, LDA, DWORK ), $ ZLANGE( '1', L, M, B, LDB, DWORK ), $ ZLANGE( '1', P, N, C, LDC, DWORK ) ) ENORM = ZLANGE( '1', L, N, E, LDE, DWORK ) * Find the transformed descriptor system * (A-lambda E,B,C). CALL TG01AZ( JOBS, L, N, M, P, THRESH, A, LDA, E, LDE, $ B, LDB, C, LDC, LSCALE, RSCALE, DWORK, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE SABCNM = MAX( ZLANGE( '1', L, N, A, LDA, DWORK ), $ ZLANGE( '1', L, M, B, LDB, DWORK ), $ ZLANGE( '1', P, N, C, LDC, DWORK ) ) SENORM = ZLANGE( '1', L, N, E, LDE, DWORK ) WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) WRITE ( NOUT, FMT = 99985 ) ( LSCALE(I), I = 1,L ) WRITE ( NOUT, FMT = 99990 ) WRITE ( NOUT, FMT = 99985 ) ( RSCALE(J), J = 1,N ) WRITE ( NOUT, FMT = 99994 ) $ ABCNRM, SABCNM, ENORM, SENORM END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01AZ EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01AZ = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Dl*A*Dr is ') 99996 FORMAT (/' The transformed descriptor matrix Dl*E*Dr is ') 99995 FORMAT (20(1X,F9.4,SP,F9.4,S,'i ')) 99994 FORMAT (/' Norm of [ A B; C 0] =', 1PD10.3/ $ ' Norm of scaled [ A B; C 0] =', 1PD10.3/ $ ' Norm of E =', 1PD10.3/ $ ' Norm of scaled E =', 1PD10.3) 99993 FORMAT (/' The transformed input/state matrix Dl*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Dr is ') 99991 FORMAT (/' The diagonal of left scaling matrix Dl is ') 99990 FORMAT (/' The diagonal of right scaling matrix Dr is ') 99989 FORMAT (/' L is out of range.',/' L = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) 99985 FORMAT (20(1X,F9.4)) ENDProgram Data
TG01AZ EXAMPLE PROGRAM DATA 4 4 2 2 A 0.0 (-1,0) (0,0) (0,0) (0.003,0) (0,0) (0,0) (0.1000,0) (0.02,0) (100,0) (10,0) (0,0) (0.4,0) (0,0) (0,0) (0,0) (0.0,0) (1,0) (0.2,0) (0,0) (0.0,0) (0,0) (1,0) (0,0) ( 0.01,0) (300,0) (90,0) (6,0) (0.3,0) (0,0) (0,0) (20,0) (0.0,0) (10,0) (0,0) (0,0) (0,0) (0,0) (1000,0) (10000,0) (10000,0) (-0.1,0) (0.0,0) (0.001,0) (0.0,0) (0.0,0) (0.01,0) (-0.001,0) (0.0001,0)Program Results
TG01AZ EXAMPLE PROGRAM RESULTS The transformed state dynamics matrix Dl*A*Dr is -1.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.3000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 1.0000 +0.0000i 2.0000 +0.0000i 1.0000 +0.0000i 0.1000 +0.0000i 0.0000 +0.0000i 0.4000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i The transformed descriptor matrix Dl*E*Dr is 1.0000 +0.0000i 0.2000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 1.0000 +0.0000i 0.0000 +0.0000i 1.0000 +0.0000i 3.0000 +0.0000i 0.9000 +0.0000i 0.6000 +0.0000i 0.3000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.2000 +0.0000i 0.0000 +0.0000i The transformed input/state matrix Dl*B is 100.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 100.0000 +0.0000i 100.0000 +0.0000i 100.0000 +0.0000i The transformed state/output matrix C*Dr is -0.0100 +0.0000i 0.0000 +0.0000i 0.0010 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0010 +0.0000i -0.0010 +0.0000i 0.0010 +0.0000i The diagonal of left scaling matrix Dl is 10.0000 10.0000 0.1000 0.0100 The diagonal of right scaling matrix Dr is 0.1000 0.1000 1.0000 10.0000 Norm of [ A B; C 0] = 1.100D+04 Norm of scaled [ A B; C 0] = 2.000D+02 Norm of E = 3.010D+02 Norm of scaled E = 4.000D+00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01BD.html 0000664 0000000 0000000 00000022547 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To reduce the matrices A and E of the system pencil S = ( A B ) - lambda ( E 0 ) , ( C 0 ) ( 0 0 ) corresponding to the descriptor triple (A-lambda E,B,C), to generalized upper Hessenberg form using orthogonal transformations, Q' * A * Z = H, Q' * E * Z = T, where H is upper Hessenberg, T is upper triangular, Q and Z are orthogonal, and ' means transpose. The corresponding transformations, written compactly as diag(Q',I) * S * diag(Z,I), are also applied to B and C, getting Q' * B and C * Z. The orthogonal matrices Q and Z are determined as products of Givens rotations. They may either be formed explicitly, or they may be postmultiplied into input matrices Q1 and Z1, so that Q1 * A * Z1' = (Q1*Q) * H * (Z1*Z)' Q1 * E * Z1' = (Q1*Q) * T * (Z1*Z)'.Specification
SUBROUTINE TG01BD( JOBE, COMPQ, COMPZ, N, M, P, ILO, IHI, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ, JOBE INTEGER IHI, ILO, INFO, LDA, LDB, LDC, LDE, LDQ, $ LDWORK, LDZ, M, N, P C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
JOBE CHARACTER*1 Specifies whether E is a general square or an upper triangular matrix, as follows: = 'G': E is a general square matrix; = 'U': E is an upper triangular matrix. COMPQ CHARACTER*1 Indicates what should be done with matrix Q, as follows: = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'V': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. COMPZ CHARACTER*1 Indicates what should be done with matrix Z, as follows: = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'V': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.Input/Output Parameters
N (input) INTEGER The order of the matrices A, E, and the number of rows of the matrix B. N >= 0. M (input) INTEGER The number of columns of the matrix B. M >= 0. P (input) INTEGER The number of rows of the matrix C. P >= 0. ILO (input) INTEGER IHI (input) INTEGER It is assumed that A and E are already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI could normally be set by a previous call to LAPACK Library routine DGGBAL; otherwise they should be set to 1 and N, respectively. 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0. If JOBE = 'U', the matrix E is assumed upper triangular. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, the leading N-by-N part of this array contains the upper Hessenberg matrix H = Q' * A * Z. The elements below the first subdiagonal are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the descriptor matrix E. If JOBE = 'U', this matrix is assumed upper triangular. On exit, the leading N-by-N part of this array contains the upper triangular matrix T = Q' * E * Z. The elements below the diagonal are set to zero. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input/state matrix B. On exit, if M > 0, the leading N-by-M part of this array contains the transformed matrix Q' * B. The array B is not referenced if M = 0. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N) if M > 0; LDB >= 1 if M = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, if P > 0, the leading P-by-N part of this array contains the transformed matrix C * Z. The array C is not referenced if P = 0. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) If COMPQ = 'N': Q is not referenced; If COMPQ = 'I': on entry, Q need not be set, and on exit it contains the orthogonal matrix Q, where Q' is the product of the Givens transformations which are applied to A, E, and B on the left; If COMPQ = 'V': on entry, Q must contain an orthogonal matrix Q1, and on exit this is overwritten by Q1*Q. LDQ INTEGER The leading dimension of array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,N), if COMPQ = 'I' or 'V'. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced; If COMPZ = 'I': on entry, Z need not be set, and on exit it contains the orthogonal matrix Z, which is the product of the Givens transformations applied to A, E, and C on the right; If COMPZ = 'V': on entry, Z must contain an orthogonal matrix Z1, and on exit this is overwritten by Z1*Z. LDZ INTEGER The leading dimension of array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'I' or 'V'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) contains the optimal value of LDWORK. LDWORK INTEGER The dimension of the array DWORK. LDWORK >= 1, if JOBE = 'U'; LDWORK >= MAX(1,IHI+1-ILO+MAX(NI,M)), if JOBE = 'G', where NI = N+1-ILO, if COMPQ = 'N', and NI = N, otherwise. For good performance, if JOBE = 'G', LDWORK must generally be larger, LDWORK >= MAX(1,IHI+1-ILO+MAX(NI,M)*NB), where NB is the optimal block size.Error Indicator
INFO INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value.Method
First, this routine computes the QR factorization of E and applies the transformations to A, B, and possibly Q. Then, the routine reduces A to upper Hessenberg form, preserving E triangular, by an unblocked reduction [1], using two sequences of plane rotations applied alternately from the left and from the right. The corresponding transformations may be accumulated and/or applied to the matrices B and C. If JOBE = 'U', the initial reduction of E to upper triangular form is skipped. This routine is a modification and extension of the LAPACK Library routine DGGHRD [2].References
[1] Golub, G.H. and van Loan, C.F. Matrix Computations. Third Edition. M. D. Johns Hopkins University Press, Baltimore, 1996. [2] 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.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01CD.html 0000664 0000000 0000000 00000023663 14560147231 0020346 0 ustar 00root root 0000000 0000000
Purpose
To reduce the descriptor system pair (A-lambda E,B) to the QR-coordinate form by computing an orthogonal transformation matrix Q such that the transformed descriptor system pair (Q'*A-lambda Q'*E, Q'*B) has the descriptor matrix Q'*E in an upper trapezoidal form. The left orthogonal transformations performed to reduce E can be optionally accumulated.Specification
SUBROUTINE TG01CD( COMPQ, L, N, M, A, LDA, E, LDE, B, LDB, Q, LDQ, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ INTEGER INFO, L, LDA, LDB, LDE, LDQ, LDWORK, M, N C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), DWORK( * ), $ E( LDE, * ), Q( LDQ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'U': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned.Input/Output Parameters
L (input) INTEGER The number of rows of matrices A, B, and E. L >= 0. N (input) INTEGER The number of columns of matrices A and E. N >= 0. M (input) INTEGER The number of columns of matrix B. M >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A. On exit, the leading L-by-N part of this array contains the transformed matrix Q'*A. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E. On exit, the leading L-by-N part of this array contains the transformed matrix Q'*E in upper trapezoidal form, i.e. ( E11 ) Q'*E = ( ) , if L >= N , ( 0 ) or Q'*E = ( E11 E12 ), if L < N , where E11 is an MIN(L,N)-by-MIN(L,N) upper triangular matrix. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the input/state matrix B. On exit, the leading L-by-M part of this array contains the transformed matrix Q'*B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L) if M > 0 or LDB >= 1 if M = 0. Q (input/output) DOUBLE PRECISION array, dimension (LDQ,L) If COMPQ = 'N': Q is not referenced. If COMPQ = 'I': on entry, Q need not be set; on exit, the leading L-by-L part of this array contains the orthogonal matrix Q, where Q' is the product of Householder transformations which are applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading L-by-L part of this array must contain an orthogonal matrix Q1; on exit, the leading L-by-L part of this array contains the orthogonal matrix Q1*Q. LDQ INTEGER The leading dimension of array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,L), if COMPQ = 'U' or 'I'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, MIN(L,N) + MAX(L,N,M)). For optimum performance LWORK >= MAX(1, MIN(L,N) + MAX(L,N,M)*NB), where NB is the optimal blocksize.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes the QR factorization of E to reduce it to the upper trapezoidal form. The transformations are also applied to the rest of system matrices A <- Q' * A , B <- Q' * B.Numerical Aspects
The algorithm is numerically backward stable and requires 0( L*L*N ) floating point operations.Further Comments
NoneExample
Program Text
* TG01CD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, MMAX PARAMETER ( LMAX = 20, NMAX = 20, MMAX = 20) INTEGER LDA, LDB, LDE, LDQ PARAMETER ( LDA = LMAX, LDB = LMAX, $ LDE = LMAX, LDQ = LMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MIN(LMAX,NMAX)+MAX(LMAX,NMAX,MMAX) ) * .. Local Scalars .. CHARACTER*1 COMPQ INTEGER I, INFO, J, L, M, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,LMAX) * .. External Subroutines .. EXTERNAL TG01CD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, M COMPQ = 'I' IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99992 ) L ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99990 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,L ) * Find the transformed descriptor system pair * (A-lambda E,B). CALL TG01CD( COMPQ, L, N, M, A, LDA, E, LDE, B, LDB, $ Q, LDQ, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 30 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,L ) 40 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01CD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01CD = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q''*A is ') 99996 FORMAT (/' The transformed descriptor matrix Q''*E is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' The transformed input/state matrix Q''*B is ') 99993 FORMAT (/' The left transformation matrix Q is ') 99992 FORMAT (/' L is out of range.',/' L = ',I5) 99991 FORMAT (/' N is out of range.',/' N = ',I5) 99990 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
TG01CD EXAMPLE PROGRAM DATA 4 4 2 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 1 0 0 0 0 1 1 1Program Results
TG01CD EXAMPLE PROGRAM RESULTS The transformed state dynamics matrix Q'*A is -0.6325 -0.9487 0.0000 -4.7434 -0.8706 -0.2176 -0.7255 -0.3627 -0.5203 -0.1301 0.3902 1.4307 -0.7559 -0.1890 0.5669 2.0788 The transformed descriptor matrix Q'*E is -3.1623 -9.1706 -5.6921 -2.8460 0.0000 -1.3784 -1.3059 -1.3784 0.0000 0.0000 -2.4279 0.0000 0.0000 0.0000 0.0000 0.0000 The transformed input/state matrix Q'*B is -0.3162 -0.9487 0.6529 -0.2176 -0.4336 -0.9538 1.1339 0.3780 The left transformation matrix Q is -0.3162 0.6529 0.3902 0.5669 0.0000 -0.7255 0.3902 0.5669 -0.9487 -0.2176 -0.1301 -0.1890 0.0000 0.0000 -0.8238 0.5669
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01DD.html 0000664 0000000 0000000 00000023526 14560147231 0020345 0 ustar 00root root 0000000 0000000
Purpose
To reduce the descriptor system pair (C,A-lambda E) to the RQ-coordinate form by computing an orthogonal transformation matrix Z such that the transformed descriptor system pair (C*Z,A*Z-lambda E*Z) has the descriptor matrix E*Z in an upper trapezoidal form. The right orthogonal transformations performed to reduce E can be optionally accumulated.Specification
SUBROUTINE TG01DD( COMPZ, L, N, P, A, LDA, E, LDE, C, LDC, Z, LDZ, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPZ INTEGER INFO, L, LDA, LDC, LDE, LDWORK, LDZ, N, P C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), C( LDC, * ), DWORK( * ), $ E( LDE, * ), Z( LDZ, * )Arguments
Mode Parameters
COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'U': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.Input/Output Parameters
L (input) INTEGER The number of rows of matrices A and E. L >= 0. N (input) INTEGER The number of columns of matrices A, E, and C. N >= 0. P (input) INTEGER The number of rows of matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A. On exit, the leading L-by-N part of this array contains the transformed matrix A*Z. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E. On exit, the leading L-by-N part of this array contains the transformed matrix E*Z in upper trapezoidal form, i.e. ( E11 ) E*Z = ( ) , if L >= N , ( R ) or E*Z = ( 0 R ), if L < N , where R is an MIN(L,N)-by-MIN(L,N) upper triangular matrix. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z, which is the product of Householder transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Z1; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z1*Z. LDZ INTEGER The leading dimension of array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'U' or 'I'.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1, MIN(L,N) + MAX(L,N,P)). For optimum performance LWORK >= MAX(1, MIN(L,N) + MAX(L,N,P)*NB), where NB is the optimal blocksize.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes the RQ factorization of E to reduce it the upper trapezoidal form. The transformations are also applied to the rest of system matrices A <- A * Z, C <- C * Z.Numerical Aspects
The algorithm is numerically backward stable and requires 0( L*N*N ) floating point operations.Further Comments
NoneExample
Program Text
* TG01DD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, PMAX PARAMETER ( LMAX = 20, NMAX = 20, PMAX = 20) INTEGER LDA, LDC, LDE, LDZ PARAMETER ( LDA = LMAX, LDC = PMAX, $ LDE = LMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MIN(LMAX,NMAX)+MAX(LMAX,NMAX,PMAX) ) * .. Local Scalars .. CHARACTER*1 COMPZ INTEGER I, INFO, J, L, N, P * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL TG01DD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, P COMPZ = 'I' IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99992 ) L ELSE IF( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99991 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99990 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed descriptor system pair * (A-lambda E,B). CALL TG01DD( COMPZ, L, N, P, A, LDA, E, LDE, C, LDC, $ Z, LDZ, DWORK, LDWORK, INFO ) * IF( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99994 ) DO 30 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 30 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 40 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01DD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01DD = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (/' The transformed input/state matrix C*Z is ') 99993 FORMAT (/' The right transformation matrix Z is ') 99992 FORMAT (/' L is out of range.',/' L = ',I5) 99991 FORMAT (/' N is out of range.',/' N = ',I5) 99990 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TG01DD EXAMPLE PROGRAM DATA 4 4 2 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 -1 0 1 0 0 1 -1 1Program Results
TG01DD EXAMPLE PROGRAM RESULTS The transformed state dynamics matrix A*Z is 0.4082 3.0773 0.6030 0.0000 0.8165 1.7233 0.6030 -1.0000 2.0412 2.8311 2.4121 0.0000 0.0000 0.0000 0.0000 0.0000 The transformed descriptor matrix E*Z is 0.0000 -0.7385 2.1106 0.0000 0.0000 0.7385 1.2060 0.0000 0.0000 0.0000 9.9499 -6.0000 0.0000 0.0000 0.0000 -2.0000 The transformed input/state matrix C*Z is -0.8165 0.4924 -0.3015 -1.0000 0.0000 0.7385 1.2060 1.0000 The right transformation matrix Z is 0.8165 -0.4924 0.3015 0.0000 -0.4082 -0.1231 0.9045 0.0000 0.0000 0.0000 0.0000 -1.0000 0.4082 0.8616 0.3015 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01ED.html 0000664 0000000 0000000 00000035174 14560147231 0020350 0 ustar 00root root 0000000 0000000
Purpose
To compute for the descriptor system (A-lambda E,B,C) the orthogonal transformation matrices Q and Z such that the transformed system (Q'*A*Z-lambda Q'*E*Z, Q'*B, C*Z) is in an SVD (singular value decomposition) coordinate form with the system matrices Q'*A*Z and Q'*E*Z in the form ( A11 A12 ) ( Er 0 ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , ( A21 A22 ) ( 0 0 ) where Er is an invertible diagonal matrix having on the diagonal the decreasingly ordered nonzero singular values of E. Optionally, the A22 matrix can be further reduced to the SVD form ( Ar 0 ) A22 = ( ) , ( 0 0 ) where Ar is an invertible diagonal matrix having on the diagonal the decreasingly ordered nonzero singular values of A22. The left and/or right orthogonal transformations performed to reduce E and A22 are accumulated.Specification
SUBROUTINE TG01ED( JOBA, L, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, Q, LDQ, Z, LDZ, RANKE, RNKA22, TOL, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBA INTEGER INFO, L, LDA, LDB, LDC, LDE, LDQ, LDWORK, $ LDZ, M, N, P, RNKA22, RANKE DOUBLE PRECISION TOL C .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
JOBA CHARACTER*1 = 'N': do not reduce A22; = 'R': reduce A22 to an SVD form.Input/Output Parameters
L (input) INTEGER The number of rows of matrices A, B, and E. L >= 0. N (input) INTEGER The number of columns of matrices A, E, and C. N >= 0. M (input) INTEGER The number of columns of matrix B. M >= 0. P (input) INTEGER The number of rows of matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A. On exit, the leading L-by-N part of this array contains the transformed matrix Q'*A*Z. If JOBA = 'R', this matrix is in the form ( A11 * * ) Q'*A*Z = ( * Ar 0 ) , ( * 0 0 ) where A11 is a RANKE-by-RANKE matrix and Ar is a RNKA22-by-RNKA22 invertible diagonal matrix, with decresingly ordered positive diagonal elements. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E. On exit, the leading L-by-N part of this array contains the transformed matrix Q'*E*Z. ( Er 0 ) Q'*E*Z = ( ) , ( 0 0 ) where Er is a RANKE-by-RANKE invertible diagonal matrix having on the diagonal the decreasingly ordered positive singular values of E. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the input/state matrix B. On exit, the leading L-by-M part of this array contains the transformed matrix Q'*B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L) if M > 0 or LDB >= 1 if M = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). Q (output) DOUBLE PRECISION array, dimension (LDQ,L) The leading L-by-L part of this array contains the orthogonal matrix Q, which is the accumulated product of transformations applied to A, E, and B on the left. LDQ INTEGER The leading dimension of array Q. LDQ >= MAX(1,L). Z (output) DOUBLE PRECISION array, dimension (LDZ,N) The leading N-by-N part of this array contains the orthogonal matrix Z, which is the accumulated product of transformations applied to A, E, and C on the right. LDZ INTEGER The leading dimension of array Z. LDZ >= MAX(1,N). RANKE (output) INTEGER The effective rank of matrix E, and thus also the order of the invertible diagonal submatrix Er. RANKE is computed as the number of singular values of E greater than TOL*SVEMAX, where SVEMAX is the maximum singular value of E. RNKA22 (output) INTEGER If JOBA = 'R', then RNKA22 is the effective rank of matrix A22, and thus also the order of the invertible diagonal submatrix Ar. RNKA22 is computed as the number of singular values of A22 greater than TOL*SVAMAX, where SVAMAX is an estimate of the maximum singular value of A. If JOBA = 'N', then RNKA22 is not referenced.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining the rank of E and of A22. If TOL > 0, then singular values less than TOL*SVMAX are treated as zero, where SVMAX is the maximum singular value of E or an estimate of it for A and E. If TOL <= 0, the default tolerance TOLDEF = EPS*L*N is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,MIN(L,N) + MAX(3*MIN(L,N)+MAX(L,N), 5*MIN(L,N), M, P)).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: the QR algorithm has failed to converge when computing singular value decomposition. In this case INFO specifies how many superdiagonals did not converge. This failure is not likely to occur.Method
The routine computes the singular value decomposition (SVD) of E, in the form ( Er 0 ) E = Q * ( ) * Z' ( 0 0 ) and finds the largest RANKE-by-RANKE leading diagonal submatrix Er whose condition number is less than 1/TOL. RANKE defines thus the effective rank of matrix E. If JOBA = 'R' the same reduction is performed on A22 in the partitioned matrix ( A11 A12 ) Q'*A*Z = ( ) , ( A21 A22 ) to obtain it in the form ( Ar 0 ) A22 = ( ) , ( 0 0 ) with Ar an invertible diagonal matrix. The accumulated transformations are also applied to the rest of matrices B <- Q' * B, C <- C * Z.Numerical Aspects
The algorithm is numerically backward stable and requires 0( L*L*N ) floating point operations.Further Comments
NoneExample
Program Text
* TG01ED EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, MMAX, PMAX PARAMETER ( LMAX = 20, NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = PMAX, $ LDE = LMAX, LDQ = LMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, MIN( LMAX, NMAX ) + $ MAX( MMAX, PMAX, 3*MIN( LMAX, NMAX ) + $ MAX( LMAX, NMAX ), $ 5*MIN( LMAX, NMAX ) ) ) ) * .. Local Scalars .. CHARACTER*1 JOBA INTEGER I, INFO, J, L, M, N, P, RANKE, RNKA22 DOUBLE PRECISION TOL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,LMAX), $ Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL TG01ED * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, M, P, TOL JOBA = 'R' IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99989 ) L ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,L ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed descriptor system * (A-lambda E,B,C). CALL TG01ED( JOBA, L, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, Q, LDQ, Z, LDZ, RANKE, RNKA22, $ TOL, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) RANKE, RNKA22 WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,L ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01ED EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01ED = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q''*A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix Q''*E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Rank of matrix E =', I5/ $ ' Rank of matrix A22 =', I5) 99993 FORMAT (/' The transformed input/state matrix Q''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99989 FORMAT (/' L is out of range.',/' L = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TG01ED EXAMPLE PROGRAM DATA 4 4 2 2 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 1 0 0 0 0 1 1 1 -1 0 1 0 0 1 -1 1Program Results
TG01ED EXAMPLE PROGRAM RESULTS Rank of matrix E = 3 Rank of matrix A22 = 1 The transformed state dynamics matrix Q'*A*Z is 2.1882 -0.8664 -3.5097 -2.1353 -0.4569 -0.2146 1.9802 0.3531 -0.5717 -0.5245 -0.4591 0.4696 -0.4766 -0.5846 2.1414 0.3086 The transformed descriptor matrix Q'*E*Z is 11.8494 0.0000 0.0000 0.0000 0.0000 2.1302 0.0000 0.0000 0.0000 0.0000 1.0270 0.0000 0.0000 0.0000 0.0000 0.0000 The transformed input/state matrix Q'*B is -0.2396 -1.0668 -0.2656 -0.8393 -0.7657 -0.1213 1.1339 0.3780 The transformed state/output matrix C*Z is -0.2499 -1.0573 0.3912 -0.8165 -0.5225 1.3958 0.8825 0.0000 The left transformation matrix Q is -0.1534 0.5377 -0.6049 0.5669 -0.0872 0.2536 0.7789 0.5669 -0.9805 -0.0360 0.0395 -0.1890 -0.0863 -0.8033 -0.1608 0.5669 The right transformation matrix Z is -0.2612 0.2017 -0.4737 0.8165 -0.7780 0.4718 -0.0738 -0.4082 -0.5111 -0.8556 -0.0826 0.0000 -0.2556 0.0684 0.8737 0.4082
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01FD.html 0000664 0000000 0000000 00000042056 14560147231 0020346 0 ustar 00root root 0000000 0000000
Purpose
To compute for the descriptor system (A-lambda E,B,C) the orthogonal transformation matrices Q and Z such that the transformed system (Q'*A*Z-lambda Q'*E*Z, Q'*B, C*Z) is in a SVD-like coordinate form with ( A11 A12 ) ( Er 0 ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , ( A21 A22 ) ( 0 0 ) where Er is an upper triangular invertible matrix. Optionally, the A22 matrix can be further reduced to the form ( Ar X ) A22 = ( ) , ( 0 0 ) with Ar an upper triangular invertible matrix, and X either a full or a zero matrix. The left and/or right orthogonal transformations performed to reduce E and A22 can be optionally accumulated.Specification
SUBROUTINE TG01FD( COMPQ, COMPZ, JOBA, L, N, M, P, A, LDA, E, LDE, $ B, LDB, C, LDC, Q, LDQ, Z, LDZ, RANKE, RNKA22, $ TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ, JOBA INTEGER INFO, L, LDA, LDB, LDC, LDE, LDQ, LDWORK, $ LDZ, M, N, P, RANKE, RNKA22 DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'U': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'U': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned. JOBA CHARACTER*1 = 'N': do not reduce A22; = 'R': reduce A22 to a SVD-like upper triangular form. = 'T': reduce A22 to an upper trapezoidal form.Input/Output Parameters
L (input) INTEGER The number of rows of matrices A, B, and E. L >= 0. N (input) INTEGER The number of columns of matrices A, E, and C. N >= 0. M (input) INTEGER The number of columns of matrix B. M >= 0. P (input) INTEGER The number of rows of matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A. On exit, the leading L-by-N part of this array contains the transformed matrix Q'*A*Z. If JOBA = 'T', this matrix is in the form ( A11 * * ) Q'*A*Z = ( * Ar X ) , ( * 0 0 ) where A11 is a RANKE-by-RANKE matrix and Ar is a RNKA22-by-RNKA22 invertible upper triangular matrix. If JOBA = 'R' then A has the above form with X = 0. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E. On exit, the leading L-by-N part of this array contains the transformed matrix Q'*E*Z. ( Er 0 ) Q'*E*Z = ( ) , ( 0 0 ) where Er is a RANKE-by-RANKE upper triangular invertible matrix. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the input/state matrix B. On exit, the leading L-by-M part of this array contains the transformed matrix Q'*B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L) if M > 0 or LDB >= 1 if M = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,L) If COMPQ = 'N': Q is not referenced. If COMPQ = 'I': on entry, Q need not be set; on exit, the leading L-by-L part of this array contains the orthogonal matrix Q, where Q' is the product of Householder transformations which are applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading L-by-L part of this array must contain an orthogonal matrix Q1; on exit, the leading L-by-L part of this array contains the orthogonal matrix Q1*Q. LDQ INTEGER The leading dimension of array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,L), if COMPQ = 'U' or 'I'. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z, which is the product of Householder transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Z1; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z1*Z. LDZ INTEGER The leading dimension of array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'U' or 'I'. RANKE (output) INTEGER The estimated rank of matrix E, and thus also the order of the invertible upper triangular submatrix Er. RNKA22 (output) INTEGER If JOBA = 'R' or 'T', then RNKA22 is the estimated rank of matrix A22, and thus also the order of the invertible upper triangular submatrix Ar. If JOBA = 'N', then RNKA22 is not referenced.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining the rank of E and of A22. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition numbers of leading submatrices of R or R22 in the QR decompositions E * P = Q * R of E or A22 * P22 = Q22 * R22 of A22. A submatrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = L*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX( 1, N+P, MIN(L,N)+MAX(3*N-1,M,L) ). For optimal performance, LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes a truncated QR factorization with column pivoting of E, in the form ( E11 E12 ) E * P = Q * ( ) ( 0 E22 ) and finds the largest RANKE-by-RANKE leading submatrix E11 whose estimated condition number is less than 1/TOL. RANKE defines thus the rank of matrix E. Further E22, being negligible, is set to zero, and an orthogonal matrix Y is determined such that ( E11 E12 ) = ( Er 0 ) * Y . The overal transformation matrix Z results as Z = P * Y' and the resulting transformed matrices Q'*A*Z and Q'*E*Z have the form ( Er 0 ) ( A11 A12 ) E <- Q'* E * Z = ( ) , A <- Q' * A * Z = ( ) , ( 0 0 ) ( A21 A22 ) where Er is an upper triangular invertible matrix. If JOBA = 'R' the same reduction is performed on A22 to obtain it in the form ( Ar 0 ) A22 = ( ) , ( 0 0 ) with Ar an upper triangular invertible matrix. If JOBA = 'T' then A22 is row compressed using the QR factorization with column pivoting to the form ( Ar X ) A22 = ( ) ( 0 0 ) with Ar an upper triangular invertible matrix. The transformations are also applied to the rest of system matrices B <- Q' * B, C <- C * Z.Numerical Aspects
The algorithm is numerically backward stable and requires 0( L*L*N ) floating point operations.Further Comments
NoneExample
Program Text
* TG01FD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, MMAX, PMAX PARAMETER ( LMAX = 20, NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = PMAX, $ LDE = LMAX, LDQ = LMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, PMAX, $ MIN(LMAX,NMAX)+MAX( 3*NMAX, MMAX, LMAX ) ) ) * .. Local Scalars .. CHARACTER*1 COMPQ, COMPZ, JOBA INTEGER I, INFO, J, L, M, N, P, RANKE, RNKA22 DOUBLE PRECISION TOL * .. Local Arrays .. INTEGER IWORK(NMAX) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,LMAX), $ Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL TG01FD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, M, P, TOL COMPQ = 'I' COMPZ = 'I' JOBA = 'R' IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99989 ) L ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,L ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed descriptor system * (A-lambda E,B,C). CALL TG01FD( COMPQ, COMPZ, JOBA, L, N, M, P, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, $ RANKE, RNKA22, TOL, IWORK, DWORK, LDWORK, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) RANKE, RNKA22 WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,L ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01FD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01FD = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q''*A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix Q''*E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Rank of matrix E =', I5/ $ ' Rank of matrix A22 =', I5) 99993 FORMAT (/' The transformed input/state matrix Q''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99989 FORMAT (/' L is out of range.',/' L = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TG01FD EXAMPLE PROGRAM DATA 4 4 2 2 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 1 0 0 0 0 1 1 1 -1 0 1 0 0 1 -1 1Program Results
TG01FD EXAMPLE PROGRAM RESULTS Rank of matrix E = 3 Rank of matrix A22 = 1 The transformed state dynamics matrix Q'*A*Z is 2.0278 0.1078 3.9062 -2.1571 -0.0980 0.2544 1.6053 -0.1269 0.2713 0.7760 -0.3692 -0.4853 0.0690 -0.5669 -2.1974 0.3086 The transformed descriptor matrix Q'*E*Z is 10.1587 5.8230 1.3021 0.0000 0.0000 -2.4684 -0.1896 0.0000 0.0000 0.0000 1.0338 0.0000 0.0000 0.0000 0.0000 0.0000 The transformed input/state matrix Q'*B is -0.2157 -0.9705 0.3015 0.9516 0.7595 0.0991 1.1339 0.3780 The transformed state/output matrix C*Z is 0.3651 -1.0000 -0.4472 -0.8165 -1.0954 1.0000 -0.8944 0.0000 The left transformation matrix Q is -0.2157 -0.5088 0.6109 0.5669 -0.1078 -0.2544 -0.7760 0.5669 -0.9705 0.1413 -0.0495 -0.1890 0.0000 0.8102 0.1486 0.5669 The right transformation matrix Z is -0.3651 0.0000 0.4472 0.8165 -0.9129 0.0000 0.0000 -0.4082 0.0000 -1.0000 0.0000 0.0000 -0.1826 0.0000 -0.8944 0.4082
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01FZ.html 0000664 0000000 0000000 00000044162 14560147231 0020374 0 ustar 00root root 0000000 0000000
Purpose
To compute for the descriptor system (A-lambda E,B,C) the unitary transformation matrices Q and Z such that the transformed system (Q'*A*Z-lambda Q'*E*Z, Q'*B, C*Z) is in a SVD-like coordinate form with ( A11 A12 ) ( Er 0 ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , ( A21 A22 ) ( 0 0 ) where Er is an upper triangular invertible matrix, and ' denotes the conjugate transpose. Optionally, the A22 matrix can be further reduced to the form ( Ar X ) A22 = ( ) , ( 0 0 ) with Ar an upper triangular invertible matrix, and X either a full or a zero matrix. The left and/or right unitary transformations performed to reduce E and A22 can be optionally accumulated.Specification
SUBROUTINE TG01FZ( COMPQ, COMPZ, JOBA, L, N, M, P, A, LDA, E, LDE, $ B, LDB, C, LDC, Q, LDQ, Z, LDZ, RANKE, RNKA22, $ TOL, IWORK, DWORK, ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ, JOBA INTEGER INFO, L, LDA, LDB, LDC, LDE, LDQ, LDZ, LZWORK, $ M, N, P, RANKE, RNKA22 DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ) COMPLEX*16 A( LDA, * ), B( LDB, * ), C( LDC, * ), $ E( LDE, * ), Q( LDQ, * ), Z( LDZ, * ), $ ZWORK( * ) DOUBLE PRECISION DWORK( * )Arguments
Mode Parameters
COMPQ CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the unitary matrix Q is returned; = 'U': Q must contain a unitary matrix Q1 on entry, and the product Q1*Q is returned. COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the unitary matrix Z is returned; = 'U': Z must contain a unitary matrix Z1 on entry, and the product Z1*Z is returned. JOBA CHARACTER*1 = 'N': do not reduce A22; = 'R': reduce A22 to a SVD-like upper triangular form. = 'T': reduce A22 to an upper trapezoidal form.Input/Output Parameters
L (input) INTEGER The number of rows of matrices A, B, and E. L >= 0. N (input) INTEGER The number of columns of matrices A, E, and C. N >= 0. M (input) INTEGER The number of columns of matrix B. M >= 0. P (input) INTEGER The number of rows of matrix C. P >= 0. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A. On exit, the leading L-by-N part of this array contains the transformed matrix Q'*A*Z. If JOBA = 'T', this matrix is in the form ( A11 * * ) Q'*A*Z = ( * Ar X ) , ( * 0 0 ) where A11 is a RANKE-by-RANKE matrix and Ar is a RNKA22-by-RNKA22 invertible upper triangular matrix. If JOBA = 'R' then A has the above form with X = 0. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) COMPLEX*16 array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E. On exit, the leading L-by-N part of this array contains the transformed matrix Q'*E*Z. ( Er 0 ) Q'*E*Z = ( ) , ( 0 0 ) where Er is a RANKE-by-RANKE upper triangular invertible matrix. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). B (input/output) COMPLEX*16 array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the input/state matrix B. On exit, the leading L-by-M part of this array contains the transformed matrix Q'*B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L) if M > 0 or LDB >= 1 if M = 0. C (input/output) COMPLEX*16 array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). Q (input/output) COMPLEX*16 array, dimension (LDQ,L) If COMPQ = 'N': Q is not referenced. If COMPQ = 'I': on entry, Q need not be set; on exit, the leading L-by-L part of this array contains the unitary matrix Q, where Q' is the product of Householder transformations which are applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading L-by-L part of this array must contain a unitary matrix Q1; on exit, the leading L-by-L part of this array contains the unitary matrix Q1*Q. LDQ INTEGER The leading dimension of array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,L), if COMPQ = 'U' or 'I'. Z (input/output) COMPLEX*16 array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the unitary matrix Z, which is the product of Householder transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain a unitary matrix Z1; on exit, the leading N-by-N part of this array contains the unitary matrix Z1*Z. LDZ INTEGER The leading dimension of array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'U' or 'I'. RANKE (output) INTEGER The estimated rank of matrix E, and thus also the order of the invertible upper triangular submatrix Er. RNKA22 (output) INTEGER If JOBA = 'R' or 'T', then RNKA22 is the estimated rank of matrix A22, and thus also the order of the invertible upper triangular submatrix Ar. If JOBA = 'N', then RNKA22 is not referenced.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining the rank of E and of A22. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for the reciprocal condition numbers of leading submatrices of R or R22 in the QR decompositions E * P = Q * R of E or A22 * P22 = Q22 * R22 of A22. A submatrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = L*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (2*N) ZWORK DOUBLE PRECISION array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. LZWORK INTEGER The length of the array ZWORK. LZWORK >= MAX( 1, N+P, MIN(L,N)+MAX(3*N-1,M,L) ). For optimal performance, LZWORK should be larger. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine computes a truncated QR factorization with column pivoting of E, in the form ( E11 E12 ) E * P = Q * ( ) ( 0 E22 ) and finds the largest RANKE-by-RANKE leading submatrix E11 whose estimated condition number is less than 1/TOL. RANKE defines thus the rank of matrix E. Further E22, being negligible, is set to zero, and a unitary matrix Y is determined such that ( E11 E12 ) = ( Er 0 ) * Y . The overal transformation matrix Z results as Z = P * Y' and the resulting transformed matrices Q'*A*Z and Q'*E*Z have the form ( Er 0 ) ( A11 A12 ) E <- Q'* E * Z = ( ) , A <- Q' * A * Z = ( ) , ( 0 0 ) ( A21 A22 ) where Er is an upper triangular invertible matrix. If JOBA = 'R' the same reduction is performed on A22 to obtain it in the form ( Ar 0 ) A22 = ( ) , ( 0 0 ) with Ar an upper triangular invertible matrix. If JOBA = 'T' then A22 is row compressed using the QR factorization with column pivoting to the form ( Ar X ) A22 = ( ) ( 0 0 ) with Ar an upper triangular invertible matrix. The transformations are also applied to the rest of system matrices B <- Q' * B, C <- C * Z.Numerical Aspects
The algorithm is numerically backward stable and requires 0( L*L*N ) floating point operations.Further Comments
NoneExample
Program Text
* TG01FZ EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, MMAX, PMAX PARAMETER ( LMAX = 20, NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = PMAX, $ LDE = LMAX, LDQ = LMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 2*NMAX ) INTEGER LZWORK PARAMETER ( LZWORK = MAX( 1, NMAX+PMAX, $ MIN(LMAX,NMAX)+MAX( 3*NMAX-1, MMAX, LMAX ) ) ) * .. Local Scalars .. CHARACTER*1 COMPQ, COMPZ, JOBA INTEGER I, INFO, J, L, M, N, P, RANKE, RNKA22 DOUBLE PRECISION TOL * .. Local Arrays .. INTEGER IWORK(NMAX) COMPLEX*16 A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ E(LDE,NMAX), Q(LDQ,LMAX), Z(LDZ,NMAX), $ ZWORK(LZWORK) DOUBLE PRECISION DWORK(LDWORK) * .. External Subroutines .. EXTERNAL TG01FZ * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, M, P, TOL COMPQ = 'I' COMPZ = 'I' JOBA = 'R' IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99989 ) L ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,L ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed descriptor system * (A-lambda E,B,C). CALL TG01FZ( COMPQ, COMPZ, JOBA, L, N, M, P, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, $ RANKE, RNKA22, TOL, IWORK, DWORK, ZWORK, $ LZWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) RANKE, RNKA22 WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,N ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, L WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,L ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01FZ EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01FZ = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q''*A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix Q''*E*Z is ') 99995 FORMAT (20(1X,F8.4,SP,F8.4,S,'i ')) 99994 FORMAT (' Rank of matrix E =', I5/ $ ' Rank of matrix A22 =', I5) 99993 FORMAT (/' The transformed input/state matrix Q''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99989 FORMAT (/' L is out of range.',/' L = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TG01FZ EXAMPLE PROGRAM DATA 4 4 2 2 0.0 (-1,0) (0,0) (0,0) (3,0) (0,0) (0,0) (1,0) (2,0) (1,0) (1,0) (0,0) (4,0) (0,0) (0,0) (0,0) (0,0) (1,0) (2,0) (0,0) (0,0) (0,0) (1,0) (0,0) (1,0) (3,0) (9,0) (6,0) (3,0) (0,0) (0,0) (2,0) (0,0) (1,0) (0,0) (0,0) (0,0) (0,0) (1,0) (1,0) (1,0) (-1,0) (0,0) (1,0) (0,0) (0,0) (1,0) (-1,0) (1,0)Program Results
TG01FZ EXAMPLE PROGRAM RESULTS Rank of matrix E = 3 Rank of matrix A22 = 1 The transformed state dynamics matrix Q'*A*Z is 2.0278 +0.0000i 0.1078 +0.0000i 3.9062 +0.0000i -2.1571 +0.0000i -0.0980 +0.0000i 0.2544 +0.0000i 1.6053 +0.0000i -0.1269 +0.0000i 0.2713 +0.0000i 0.7760 +0.0000i -0.3692 +0.0000i -0.4853 +0.0000i 0.0690 +0.0000i -0.5669 +0.0000i -2.1974 +0.0000i 0.3086 +0.0000i The transformed descriptor matrix Q'*E*Z is 10.1587 +0.0000i 5.8230 +0.0000i 1.3021 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -2.4684 +0.0000i -0.1896 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 1.0338 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i The transformed input/state matrix Q'*B is -0.2157 +0.0000i -0.9705 +0.0000i 0.3015 +0.0000i 0.9516 +0.0000i 0.7595 +0.0000i 0.0991 +0.0000i 1.1339 +0.0000i 0.3780 +0.0000i The transformed state/output matrix C*Z is 0.3651 +0.0000i -1.0000 +0.0000i -0.4472 +0.0000i -0.8165 +0.0000i -1.0954 +0.0000i 1.0000 +0.0000i -0.8944 +0.0000i 0.0000 +0.0000i The left transformation matrix Q is -0.2157 +0.0000i -0.5088 +0.0000i 0.6109 +0.0000i 0.5669 +0.0000i -0.1078 +0.0000i -0.2544 +0.0000i -0.7760 +0.0000i 0.5669 +0.0000i -0.9705 +0.0000i 0.1413 +0.0000i -0.0495 +0.0000i -0.1890 +0.0000i 0.0000 +0.0000i 0.8102 +0.0000i 0.1486 +0.0000i 0.5669 +0.0000i The right transformation matrix Z is -0.3651 +0.0000i 0.0000 +0.0000i 0.4472 +0.0000i 0.8165 +0.0000i -0.9129 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.4082 +0.0000i 0.0000 +0.0000i -1.0000 +0.0000i 0.0000 +0.0000i 0.0000 +0.0000i -0.1826 +0.0000i 0.0000 +0.0000i -0.8944 +0.0000i 0.4082 +0.0000i
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01GD.html 0000664 0000000 0000000 00000035060 14560147231 0020344 0 ustar 00root root 0000000 0000000
Purpose
To find a reduced descriptor representation (Ar-lambda*Er,Br,Cr) without non-dynamic modes for a descriptor representation (A-lambda*E,B,C). Optionally, the reduced descriptor system can be put into a standard form with the leading diagonal block of Er identity.Specification
SUBROUTINE TG01GD( JOBS, L, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, LR, NR, RANKE, INFRED, TOL, $ IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBS INTEGER INFO, INFRED, L, LDA, LDB, LDC, LDD, LDE, $ LDWORK, LR, M, N, NR, P, RANKE DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), $ DWORK(*), E(LDE,*)Arguments
Mode Parameters
JOBS CHARACTER*1 Indicates whether the user wishes to transform the leading diagonal block of Er to an identity matrix, as follows: = 'S': make Er with leading diagonal identity; = 'D': keep Er unreduced or upper triangular.Input/Output Parameters
L (input) INTEGER The number of rows of the matrices A, E, and B; also the number of differential equations. L >= 0. N (input) INTEGER The number of columns of the matrices A, E, and C; also the dimension of descriptor state vector. N >= 0. M (input) INTEGER The number of columns of the matrix B; also the dimension of the input vector. M >= 0. P (input) INTEGER The number of rows of the matrix C. also the dimension of the output vector. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the state dynamics matrix A. On exit, if NR < N, the leading LR-by-NR part of this array contains the reduced order state matrix Ar of a descriptor realization without non-dynamic modes. Array A contains the original state dynamics matrix if INFRED < 0. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the descriptor matrix E. On exit, if INFRED >= 0, the leading LR-by-NR part of this array contains the reduced order descriptor matrix Er of a descriptor realization without non-dynamic modes. In this case, only the leading RANKE-by-RANKE submatrix of Er is nonzero and this submatrix is nonsingular and upper triangular. Array E contains the original descriptor matrix if INFRED < 0. If JOBS = 'S', then the leading RANKE-by-RANKE submatrix results in an identity matrix. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,L). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the input matrix B. On exit, the leading LR-by-M part of this array contains the reduced order input matrix Br of a descriptor realization without non-dynamic modes. Array B contains the original input matrix if INFRED < 0. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,L). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-NR part of this array contains the reduced order output matrix Cr of a descriptor realization without non-dynamic modes. Array C contains the original output matrix if INFRED < 0. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). D (input/output) DOUBLE PRECISION array, dimension (LDD,M) On entry, the leading P-by-M part of this array must contain the original feedthrough matrix D. On exit, the leading P-by-M part of this array contains the feedthrough matrix Dr of a reduced descriptor realization without non-dynamic modes. LDD INTEGER The leading dimension of the array D. LDD >= MAX(1,P). LR (output) INTEGER The number of reduced differential equations. NR (output) INTEGER The dimension of the reduced descriptor state vector. RANKE (output) INTEGER The estimated rank of the matrix E. INFRED (output) INTEGER This parameter contains information on performed reduction and on structure of resulting system matrices, as follows: INFRED >= 0 the reduced system is in an SVD-like coordinate form with Er upper triangular; INFRED is the achieved order reduction. INFRED < 0 no reduction achieved and the original system has been restored.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming (A-lambda*E). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = L*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if MIN(L,N) = 0; otherwise, LDWORK >= MAX( N+P, MIN(L,N)+MAX(3*N-1,M,L) ). If LDWORK >= 2*L*N+L*M+N*P+ MAX( 1, N+P, MIN(L,N)+MAX(3*N-1,M,L) ) then the original matrices are restored if no order reduction is possible. This is achieved by saving system matrices before reduction and restoring them if no order reduction took place. 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. The optimal size does not necessarily include the space needed for saving the original system matrices.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The subroutine elliminates the non-dynamics modes in two steps: Step 1: Reduce the system to the SVD-like coordinate form (Q'*A*Z-lambda*Q'*E*Z, Q'*B, C*Z) , where ( A11 A12 A13 ) ( E11 0 0 ) ( B1 ) Q'*A*Z = ( A21 A22 0 ), Q'*E*Z = ( 0 0 0 ), Q'*B = ( B2 ), ( A31 0 0 ) ( 0 0 0 ) ( B3 ) C*Z = ( C1 C2 C3 ), where E11 and A22 are upper triangular invertible matrices. Step 2: Compute the reduced system as (Ar-lambda*Er,Br,Cr,Dr), where ( A11 - A12*inv(A22)*A21, A13 ) ( E11 0 ) Ar = ( ), Er = ( ), ( A31 0 ) ( 0 0 ) ( B1 - A12*inv(A22)*B2 ) Br = ( ), Cr = ( C1 - C2*inv(A22)*A21, C3 ), ( B3 ) Dr = D - C2*inv(A22)*B2. Step 3: If desired (JOBS = 'S'), reduce the descriptor system to the standard form Ar <- diag(inv(E11),I)*Ar; Br <- diag(inv(E11),I)*Br; Er = diag(I,0). If L = N and LR = NR = RANKE, then if Step 3 is performed, the resulting system is a standard state space system.Numerical Aspects
If L = N, the algorithm requires 0( N**3 ) floating point operations.Further Comments
NoneExample
Program Text
* TG01GD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, MMAX, PMAX PARAMETER ( LMAX = 20, NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDD, LDE PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = PMAX, $ LDD = PMAX, LDE = LMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MIN( LMAX, NMAX ) + $ MAX( 3*NMAX - 1, MMAX, LMAX ) + $ 2*LMAX*NMAX + LMAX*MMAX + PMAX*NMAX ) * .. Local Scalars .. CHARACTER*1 JOBS INTEGER I, INFO, INFRED, J, L, LR, M, N, NR, P, RANKE DOUBLE PRECISION TOL * .. Local Arrays .. INTEGER IWORK(NMAX) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ D(LDD,MMAX), DWORK(LDWORK), E(LDE,NMAX) * .. External Subroutines .. EXTERNAL TG01GD * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) L, N, M, P, JOBS, TOL IF ( L.LT.0 .OR. L.GT.LMAX ) THEN WRITE ( NOUT, FMT = 99989 ) L ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,L ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,L ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,L ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P ) * Find the reduced descriptor system * (A-lambda E,B,C,D). CALL TG01GD( JOBS, L, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, D, LDD, LR, NR, RANKE, INFRED, $ TOL, IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) RANKE WRITE ( NOUT, FMT = 99997 ) DO 10 I = 1, LR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 10 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 20 I = 1, LR WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,NR ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, LR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1,M ) 50 CONTINUE END IF END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01GD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01GD = ',I2) 99997 FORMAT (/' The reduced state dynamics matrix is ') 99996 FORMAT (/' The reduced descriptor matrix is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Rank of matrix E =', I5) 99993 FORMAT (/' The reduced input/state matrix is ') 99992 FORMAT (/' The reduced state/output matrix is ') 99991 FORMAT (/' The transformed feedthrough matrix is ') 99989 FORMAT (/' L is out of range.',/' L = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TG01GD EXAMPLE PROGRAM DATA 4 4 2 2 D 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 1 0 0 0 0 1 1 1 -1 0 1 0 0 1 -1 1 1 0 1 1Program Results
TG01GD EXAMPLE PROGRAM RESULTS Rank of matrix E = 3 The reduced state dynamics matrix is 2.5102 -3.8550 -11.4533 -0.0697 0.0212 0.7015 0.3798 -0.1156 -3.8250 The reduced descriptor matrix is 10.1587 5.8230 1.3021 0.0000 -2.4684 -0.1896 0.0000 0.0000 1.0338 The reduced input/state matrix is 7.7100 1.6714 0.7678 1.1070 2.5428 0.6935 The reduced state/output matrix is 0.5477 -2.5000 -6.2610 -1.0954 1.0000 -0.8944 The transformed feedthrough matrix is 4.0000 1.0000 1.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01HD.html 0000664 0000000 0000000 00000056245 14560147231 0020355 0 ustar 00root root 0000000 0000000
Purpose
To compute orthogonal transformation matrices Q and Z which reduce the N-th order descriptor system (A-lambda*E,B,C) to the form ( Ac * ) ( Ec * ) ( Bc ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , Q'*B = ( ) , ( 0 Anc ) ( 0 Enc ) ( 0 ) C*Z = ( Cc Cnc ) , where the NCONT-th order descriptor system (Ac-lambda*Ec,Bc,Cc) is a finite and/or infinite controllable. The pencil Anc - lambda*Enc is regular of order N-NCONT and contains the uncontrollable finite and/or infinite eigenvalues of the pencil A-lambda*E. For JOBCON = 'C' or 'I', the pencil ( Bc Ec-lambda*Ac ) has full row rank NCONT for all finite lambda and is in a staircase form with _ _ _ _ ( E1,0 E1,1 ... E1,k-1 E1,k ) ( _ _ _ ) ( Bc Ec ) = ( 0 E2,1 ... E2,k-1 E2,k ) , (1) ( ... _ _ ) ( 0 0 ... Ek,k-1 Ek,k ) _ _ _ ( A1,1 ... A1,k-1 A1,k ) ( _ _ ) Ac = ( 0 ... A2,k-1 A2,k ) , (2) ( ... _ ) ( 0 ... 0 Ak,k ) _ where Ei,i-1 is an rtau(i)-by-rtau(i-1) full row rank matrix _ (with rtau(0) = M) and Ai,i is an rtau(i)-by-rtau(i) upper triangular matrix. For JOBCON = 'F', the pencil ( Bc Ac-lambda*Ec ) has full row rank NCONT for all finite lambda and is in a staircase form with _ _ _ _ ( A1,0 A1,1 ... A1,k-1 A1,k ) ( _ _ _ ) ( Bc Ac ) = ( 0 A2,1 ... A2,k-1 A2,k ) , (3) ( ... _ _ ) ( 0 0 ... Ak,k-1 Ak,k ) _ _ _ ( E1,1 ... E1,k-1 E1,k ) ( _ _ ) Ec = ( 0 ... E2,k-1 E2,k ) , (4) ( ... _ ) ( 0 ... 0 Ek,k ) _ where Ai,i-1 is an rtau(i)-by-rtau(i-1) full row rank matrix _ (with rtau(0) = M) and Ei,i is an rtau(i)-by-rtau(i) upper triangular matrix. For JOBCON = 'C', the (N-NCONT)-by-(N-NCONT) regular pencil Anc - lambda*Enc has the form ( Ainc - lambda*Einc * ) Anc - lambda*Enc = ( ) , ( 0 Afnc - lambda*Efnc ) where: 1) the NIUCON-by-NIUCON regular pencil Ainc - lambda*Einc, with Ainc upper triangular and nonsingular, contains the uncontrollable infinite eigenvalues of A - lambda*E; 2) the (N-NCONT-NIUCON)-by-(N-NCONT-NIUCON) regular pencil Afnc - lambda*Efnc, with Efnc upper triangular and nonsingular, contains the uncontrollable finite eigenvalues of A - lambda*E. Note: The significance of the two diagonal blocks can be interchanged by calling the routine with the arguments A and E interchanged. In this case, Ainc - lambda*Einc contains the uncontrollable zero eigenvalues of A - lambda*E, while Afnc - lambda*Efnc contains the uncontrollable nonzero finite and infinite eigenvalues of A - lambda*E. For JOBCON = 'F', the pencil Anc - lambda*Enc has the form Anc - lambda*Enc = Afnc - lambda*Efnc , where the regular pencil Afnc - lambda*Efnc, with Efnc upper triangular and nonsingular, contains the uncontrollable finite eigenvalues of A - lambda*E. For JOBCON = 'I', the pencil Anc - lambda*Enc has the form Anc - lambda*Enc = Ainc - lambda*Einc , where the regular pencil Ainc - lambda*Einc, with Ainc upper triangular and nonsingular, contains the uncontrollable nonzero finite and infinite eigenvalues of A - lambda*E. The left and/or right orthogonal transformations Q and Z performed to reduce the system matrices can be optionally accumulated. The reduced order descriptor system (Ac-lambda*Ec,Bc,Cc) has the same transfer-function matrix as the original system (A-lambda*E,B,C).Specification
SUBROUTINE TG01HD( JOBCON, COMPQ, COMPZ, N, M, P, A, LDA, E, LDE, $ B, LDB, C, LDC, Q, LDQ, Z, LDZ, NCONT, NIUCON, $ NRBLCK, RTAU, TOL, IWORK, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ, JOBCON INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDZ, $ M, N, NCONT, NIUCON, NRBLCK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ), RTAU( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
JOBCON CHARACTER*1 = 'C': separate both finite and infinite uncontrollable eigenvalues; = 'F': separate only finite uncontrollable eigenvalues: = 'I': separate only nonzero finite and infinite uncontrollable eigenvalues. COMPQ CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'U': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'U': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. M (input) INTEGER The dimension of descriptor system input vector; also the number of columns of matrix B. M >= 0. P (input) INTEGER The dimension of descriptor system output vector; also the number of rows of matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the N-by-N state matrix A. On exit, the leading N-by-N part of this array contains the transformed state matrix Q'*A*Z, ( Ac * ) Q'*A*Z = ( ) , ( 0 Anc ) where Ac is NCONT-by-NCONT and Anc is (N-NCONT)-by-(N-NCONT). If JOBCON = 'F', the matrix ( Bc Ac ) is in the controllability staircase form (3). If JOBCON = 'C' or 'I', the submatrix Ac is upper triangular. If JOBCON = 'C', the Anc matrix has the form ( Ainc * ) Anc = ( ) , ( 0 Afnc ) where the NIUCON-by-NIUCON matrix Ainc is nonsingular and upper triangular. If JOBCON = 'I', Anc is nonsingular and upper triangular. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the N-by-N descriptor matrix E. On exit, the leading N-by-N part of this array contains the transformed descriptor matrix Q'*E*Z, ( Ec * ) Q'*E*Z = ( ) , ( 0 Enc ) where Ec is NCONT-by-NCONT and Enc is (N-NCONT)-by-(N-NCONT). If JOBCON = 'C' or 'I', the matrix ( Bc Ec ) is in the controllability staircase form (1). If JOBCON = 'F', the submatrix Ec is upper triangular. If JOBCON = 'C', the Enc matrix has the form ( Einc * ) Enc = ( ) , ( 0 Efnc ) where the NIUCON-by-NIUCON matrix Einc is nilpotent and the (N-NCONT-NIUCON)-by-(N-NCONT-NIUCON) matrix Efnc is nonsingular and upper triangular. If JOBCON = 'F', Enc is nonsingular and upper triangular. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the N-by-M input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix ( Bc ) Q'*B = ( ) , ( 0 ) where Bc is NCONT-by-M. For JOBCON = 'C' or 'I', the matrix ( Bc Ec ) is in the controllability staircase form (1). For JOBCON = 'F', the matrix ( Bc Ac ) is in the controllability staircase form (3). LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) If COMPQ = 'N': Q is not referenced. If COMPQ = 'I': on entry, Q need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Q, where Q' is the product of transformations which are applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Qc; on exit, the leading N-by-N part of this array contains the orthogonal matrix Qc*Q. LDQ INTEGER The leading dimension of array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,N), if COMPQ = 'U' or 'I'. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z, which is the product of transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Zc; on exit, the leading N-by-N part of this array contains the orthogonal matrix Zc*Z. LDZ INTEGER The leading dimension of array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'U' or 'I'. NCONT (output) INTEGER The order of the reduced matrices Ac and Ec, and the number of rows of reduced matrix Bc; also the order of the controllable part of the pair (A-lambda*E,B). NIUCON (output) INTEGER For JOBCON = 'C', the order of the reduced matrices Ainc and Einc; also the number of uncontrollable infinite eigenvalues of the pencil A - lambda*E. For JOBCON = 'F' or 'I', NIUCON has no significance and is set to zero. NRBLCK (output) INTEGER For JOBCON = 'C' or 'I', the number k, of full row rank _ blocks Ei,i in the staircase form of the pencil (Bc Ec-lambda*Ac) (see (1) and (2)). For JOBCON = 'F', the number k, of full row rank blocks _ Ai,i in the staircase form of the pencil (Bc Ac-lambda*Ec) (see (3) and (4)). RTAU (output) INTEGER array, dimension (N) RTAU(i), for i = 1, ..., NRBLCK, is the row dimension of _ _ the full row rank block Ei,i-1 or Ai,i-1 in the staircase form (1) or (3) for JOBCON = 'C' or 'I', or for JOBCON = 'F', respectively.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming (A-lambda*E, B). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (MAX(N,2*M))Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The subroutine is based on the reduction algorithms of [1].References
[1] A. Varga Computation of Irreducible Generalized State-Space Realizations. Kybernetika, vol. 26, pp. 89-106, 1990.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
If the system matrices A, E and B are badly scaled, it is generally recommendable to scale them with the SLICOT routine TG01AD, before calling TG01HD.Example
Program Text
* TG01HD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, MMAX, PMAX PARAMETER ( LMAX = 20, NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = PMAX, $ LDE = LMAX, LDQ = LMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, NMAX, 2*MMAX ) ) * .. Local Scalars .. CHARACTER*1 COMPQ, COMPZ, JOBCO INTEGER I, INFO, J, M, N, NCONT, NIUCON, NRBLCK, P DOUBLE PRECISION TOL * .. Local Arrays .. INTEGER IWORK(MMAX), RTAU(NMAX) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,LMAX), $ Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL TG01HD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, JOBCO COMPQ = 'I' COMPZ = 'I' IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed descriptor system (A-lambda E,B,C). CALL TG01HD( JOBCO, COMPQ, COMPZ, N, M, P, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, $ NCONT, NIUCON, NRBLCK, RTAU, TOL, IWORK, $ DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) NCONT, NIUCON WRITE ( NOUT, FMT = 99985 ) WRITE ( NOUT, FMT = 99984 ) ( RTAU(I), I = 1,NRBLCK ) 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 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,N ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01HD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01HD = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q''*A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix Q''*E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Dimension of controllable part =', I5/ $ ' Number of uncontrollable infinite eigenvalues =', I5) 99993 FORMAT (/' The transformed input/state matrix Q''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99989 FORMAT (/' L is out of range.',/' L = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) 99985 FORMAT (/' The staircase form row dimensions are ' ) 99984 FORMAT (10I5) ENDProgram Data
TG01HD EXAMPLE PROGRAM DATA 7 3 2 0.0 C 2 0 2 0 -1 3 1 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 2 0 -1 3 1 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 -1 0 0 1 3 0 2 0 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 1 0 0 1 0 0 1 0 -1 1 0 -1 1 0Program Results
TG01HD EXAMPLE PROGRAM RESULTS Dimension of controllable part = 3 Number of uncontrollable infinite eigenvalues = 1 The staircase form row dimensions are 2 1 The transformed state dynamics matrix Q'*A*Z is 0.0000 0.0000 0.0000 0.0000 -1.2627 0.4334 0.4666 0.0000 2.0000 0.0000 -3.7417 -0.8520 0.2924 -0.4342 0.0000 0.0000 1.7862 0.3780 -0.2651 -0.7723 0.0000 0.0000 0.0000 0.0000 3.7417 0.8520 -0.2924 0.4342 0.0000 0.0000 0.0000 0.0000 -1.5540 0.5334 0.5742 0.0000 0.0000 0.0000 0.0000 -0.6533 0.2242 0.2414 0.0000 0.0000 0.0000 0.0000 -0.5892 0.2022 0.2177 The transformed descriptor matrix Q'*E*Z is -1.8325 1.0000 2.3752 0.0000 -0.8214 0.2819 1.8016 0.4887 0.0000 0.3770 -0.5345 0.1874 0.5461 0.0000 -0.1728 0.0000 -0.1333 -1.1339 0.1325 0.3861 0.0000 0.0000 0.0000 0.0000 0.0000 0.8520 -0.2924 0.4342 0.0000 0.0000 0.0000 0.0000 -1.0260 -0.1496 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.1937 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 The transformed input/state matrix Q'*B is 1.0000 2.0000 3.0000 2.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The transformed state/output matrix C*Z is 0.0000 1.0000 0.0000 0.0000 -1.2627 0.4334 0.4666 0.3665 0.0000 -0.9803 -1.6036 0.1874 0.5461 0.0000 The left transformation matrix Q is 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.7071 0.0000 0.2740 -0.6519 0.0000 0.0000 0.0000 0.0000 0.0000 0.8304 0.3491 -0.4342 0.0000 0.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.4003 0.1683 0.9008 0.0000 0.0000 0.7071 0.0000 -0.2740 0.6519 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The right transformation matrix Z is 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.6108 0.0000 0.7917 0.0000 0.0000 0.0000 0.0000 0.4887 0.0000 0.3770 -0.5345 0.1874 0.5461 0.0000 0.0000 0.0000 0.0000 0.0000 -0.4107 0.1410 0.9008 0.6108 0.0000 0.4713 0.2673 -0.1874 -0.5461 0.0000 -0.1222 0.0000 -0.0943 -0.8018 -0.1874 -0.5461 0.0000 0.0000 0.0000 0.0000 0.0000 -0.8520 0.2924 -0.4342
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01HU.html 0000664 0000000 0000000 00000033160 14560147231 0020365 0 ustar 00root root 0000000 0000000
Purpose
Given the descriptor system (A-lambda*E,B,C) with the system matrices A, E and B of the form ( A1 X1 ) ( E1 Y1 ) ( B1 B2 ) A = ( ) , E = ( ) , B = ( ) , ( 0 X2 ) ( 0 Y2 ) ( 0 0 ) where - B is an L-by-(M1+M2) matrix, with B1 an N1-by-M1 submatrix, B2 an N1-by-M2 submatrix, - A is an L-by-N matrix, with A1 an N1-by-N1 submatrix, - E is an L-by-N matrix, with E1 an N1-by-N1 submatrix with LBE nonzero sub-diagonals, this routine reduces the pair (A1-lambda*E1,[B1 B2]) to the form Qc'*[B1 B2 A1-lambda*E1 ]*diag(I,Zc) = ( Bc1 Bc2 Ac-lambda*Ec * ) ( ) , ( 0 0 0 Anc-lambda*Enc ) where: 1) the pencil ( Bc1 Bc2 Ac-lambda*Ec ) has full row rank NR for all finite lambda and is in a staircase form with [ A11 A12 . . . A1,p-2 A1,p-1 A1p ] [ A21 A22 . . . A2,p-2 A2,p-1 A2p ] [ A31 A32 . . . A3,p-2 A3,p-1 A3p ] [ 0 A42 . . . A4,p-2 A4,p-1 A4p ] Ac = [ . . . . . . . . ], (1) [ . . . . . . . ] [ . . . . . . ] [ 0 0 . . . Ap,p-2 Ap,p-1 App ] [ A1,-1 A1,0 ] [ 0 A2,0 ] [ 0 0 ] ( E11 E12 ... E1p ) [ 0 0 ] ( 0 E22 ... E2p ) [Bc1 Bc2] = [ . . ], Ec = ( . . . . ), [ . . ] ( . . . . ) [ . . ] ( 0 0 ... Epp ) [ 0 0 ] where the block Ai,i-2 is an rtau(i)-by-rtau(i-2) full row rank matrix (with rtau(-1) = M1, rtau(0) = M2) and Ei,i is an rtau(i)-by-rtau(i) upper triangular matrix. 2) the pencil Anc-lambda*Enc is regular of order N1-NR with Enc upper triangular; this pencil contains the uncontrollable finite eigenvalues of the pencil (A1-lambda*E1). The transformations are applied to the whole matrices A, E, B and C. The left and/or right orthogonal transformations Qc and Zc, performed to reduce the pencil, can be optionally accumulated in the matrices Q and Z, respectively. The reduced order descriptor system (Ac-lambda*Ec,Bc,Cc) has no uncontrollable finite eigenvalues and has the same transfer- function matrix as the original system (A-lambda*E,B,C).Specification
SUBROUTINE TG01HU( COMPQ, COMPZ, L, N, M1, M2, P, N1, LBE, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, NR, $ NRBLCK, RTAU, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ INTEGER INFO, L, LBE, LDA, LDB, LDC, LDE, LDQ, LDWORK, $ LDZ, M1, M2, N, N1, NR, NRBLCK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ), RTAU( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'U': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'U': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.Input/Output Parameters
L (input) INTEGER The number of descriptor state equations; also the number of rows of the matrices A, E and B. L >= 0. N (input) INTEGER The dimension of the descriptor state vector; also the number of columns of the matrices A, E and C. N >= 0. M1 (input) INTEGER The number of system inputs in U1, or of columns of B1. M1 >= 0. M2 (input) INTEGER The number of system inputs in U2, or of columns of B2. M2 >= 0. P (input) INTEGER The dimension of descriptor system output; also the number of rows of the matrix C. P >= 0. N1 (input) INTEGER The order of the subsystem (A1-lambda*E1,B1,C1) to be reduced. MIN(L,N) >= N1 >= 0. LBE (input) INTEGER The number of nonzero sub-diagonals of the submatrix E1. MAX(0,N1-1) >= LBE >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the L-by-N state matrix A in the partitioned form ( A1 X1 ) A = ( ) , ( 0 X2 ) where A1 is N1-by-N1. On exit, the leading L-by-N part of this array contains the transformed state matrix, ( Ac * * ) Qc'*A*diag(Zc,I) = ( 0 Anc * ) , ( 0 0 * ) where Ac is NR-by-NR and Anc is (N1-NR)-by-(N1-NR). The matrix ( Bc Ac ) is in the controllability staircase form (1). LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the L-by-N descriptor matrix E in the partitioned form ( E1 Y1 ) E = ( ) , ( 0 Y2 ) where E1 is an N1-by-N1 matrix with LBE nonzero sub-diagonals. On exit, the leading L-by-N part of this array contains the transformed descriptor matrix ( Ec * * ) Qc'*E*diag(Zc,I) = ( 0 Enc * ) , ( 0 0 * ) where Ec is NR-by-NR and Enc is (N1-NR)-by-(N1-NR). Both Ec and Enc are upper triangular and Enc is nonsingular. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,L). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) with M = M1 + M2. On entry, the leading L-by-M part of this array must contain the L-by-M input matrix B in the partitioned form ( Bi ) B = ( ) , ( 0 ) where Bi is N1-by-M. On exit, the leading L-by-M part of this array contains the transformed input matrix ( Bc ) Qc'*B = ( ) , ( 0 ) where Bc is NR-by-M. The matrix ( Bc Ac ) is in the controllability staircase form (1). LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,L). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Zc. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,L) If COMPQ = 'N': Q is not referenced. If COMPQ = 'I': on entry, Q need not be set; on exit, the leading L-by-L part of this array contains the orthogonal matrix Qc, where Qc' is the product of the transformations applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading L-by-L part of this array must contain an orthogonal matrix Q; on exit, the leading L-by-L part of this array contains the orthogonal matrix Q*Qc. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,L), if COMPQ = 'I' or 'U'. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Zc, i.e., the product of the transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Z; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z*Zc. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'I' or 'U'. NR (output) INTEGER The order of the reduced matrices Ac and Ec, and the number of rows of the reduced matrix Bc; also the order of the controllable part of the pair (B, A-lambda*E). NRBLCK (output) INTEGER The number p, of full row rank blocks Ai,i-2 in the staircase form of the pencil (Bc1 Bc2 Ac-lambda*Ec). RTAU (output) INTEGER array, dimension (2*N1) The leading NRBLCK elements of this array contain the orders of the diagonal blocks of Ac. NRBLCK is always an even number, and the NRBLCK/2 odd and even components of RTAU have decreasing values, respectively. Note that some elements of RTAU can be zero.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming (A-lambda*E, B). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = L*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if MIN(N1,M) = 0; otherwise, LDWORK >= MAX(N1+MAX(L,N,M),2*M), if LBE > 0 and N1 > 2; LDWORK >= MAX(1,L,N,2*M), if LBE = 0 or N1 <= 2. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The implemented algorithm [1] represents a specialization of the controllability staircase algorithm of [2] to the special structure of the input matrix B = [B1,B2].References
[1] Varga, A. Reliable algorithms for computing minimal dynamic covers for descriptor systems. Proc. of MTNS'04, Leuven, Belgium, 2004. [2] Varga, A. Computation of Irreducible Generalized State-Space Realizations. Kybernetika, vol. 26, pp. 89-106, 1990.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N*N1**2 ) floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
Given the descriptor system (A-lambda*E,B,C) with the system matrices A, E and B of the form ( A1 X1 ) ( E1 Y1 ) ( B1 ) A = ( ) , E = ( ) , B = ( ) , ( 0 X2 ) ( 0 Y2 ) ( 0 ) where - B is an L-by-M matrix, with B1 an N1-by-M submatrix - A is an L-by-N matrix, with A1 an N1-by-N1 submatrix - E is an L-by-N matrix, with E1 an N1-by-N1 submatrix with LBE nonzero sub-diagonals, this routine reduces the pair (A1-lambda*E1,B1) to the form Qc'*[B1 A1-lambda*E1]*diag(I,Zc) = ( Bc Ac-lambda*Ec * ) ( ) , ( 0 0 Anc-lambda*Enc ) where: 1) the pencil ( Bc Ac-lambda*Ec ) has full row rank NR for all finite lambda and is in a staircase form with _ _ _ _ ( A1,0 A1,1 ... A1,k-1 A1,k ) ( _ _ _ ) ( Bc Ac ) = ( 0 A2,1 ... A2,k-1 A2,k ) , (1) ( ... _ _ ) ( 0 0 ... Ak,k-1 Ak,k ) _ _ _ ( E1,1 ... E1,k-1 E1,k ) ( _ _ ) Ec = ( 0 ... E2,k-1 E2,k ) , (2) ( ... _ ) ( 0 ... 0 Ek,k ) _ where Ai,i-1 is an rtau(i)-by-rtau(i-1) full row rank _ matrix (with rtau(0) = M) and Ei,i is an rtau(i)-by-rtau(i) upper triangular matrix. 2) the pencil Anc-lambda*Enc is regular of order N1-NR with Enc upper triangular; this pencil contains the uncontrollable finite eigenvalues of the pencil (A1-lambda*E1). The transformations are applied to the whole matrices A, E, B and C. The left and/or right orthogonal transformations Qc and Zc performed to reduce the pencil can be optionally accumulated in the matrices Q and Z, respectively. The reduced order descriptor system (Ac-lambda*Ec,Bc,Cc) has no uncontrollable finite eigenvalues and has the same transfer-function matrix as the original system (A-lambda*E,B,C).Specification
SUBROUTINE TG01HX( COMPQ, COMPZ, L, N, M, P, N1, LBE, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, NR, $ NRBLCK, RTAU, TOL, IWORK, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ INTEGER INFO, L, LBE, LDA, LDB, LDC, LDE, LDQ, LDZ, M, $ N, N1, NR, NRBLCK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ), RTAU( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'U': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'U': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.Input/Output Parameters
L (input) INTEGER The number of descriptor state equations; also the number of rows of matrices A, E and B. L >= 0. N (input) INTEGER The dimension of the descriptor state vector; also the number of columns of matrices A, E and C. N >= 0. M (input) INTEGER The dimension of descriptor system input vector; also the number of columns of matrix B. M >= 0. P (input) INTEGER The dimension of descriptor system output; also the number of rows of matrix C. P >= 0. N1 (input) INTEGER The order of subsystem (A1-lambda*E1,B1,C1) to be reduced. MIN(L,N) >= N1 >= 0. LBE (input) INTEGER The number of nonzero sub-diagonals of submatrix E1. MAX(0,N1-1) >= LBE >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the L-by-N state matrix A in the partitioned form ( A1 X1 ) A = ( ) , ( 0 X2 ) where A1 is N1-by-N1. On exit, the leading L-by-N part of this array contains the transformed state matrix, ( Ac * * ) Qc'*A*Zc = ( 0 Anc * ) , ( 0 0 * ) where Ac is NR-by-NR and Anc is (N1-NR)-by-(N1-NR). The matrix ( Bc Ac ) is in the controllability staircase form (1). LDA INTEGER The leading dimension of array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the L-by-N descriptor matrix E in the partitioned form ( E1 Y1 ) E = ( ) , ( 0 Y2 ) where E1 is N1-by-N1 matrix with LBE nonzero sub-diagonals. On exit, the leading L-by-N part of this array contains the transformed descriptor matrix ( Ec * * ) Qc'*E*Zc = ( 0 Enc * ) , ( 0 0 * ) where Ec is NR-by-NR and Enc is (N1-NR)-by-(N1-NR). Both Ec and Enc are upper triangular and Enc is nonsingular. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,L). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the L-by-M input matrix B in the partitioned form ( B1 ) B = ( ) , ( 0 ) where B1 is N1-by-M. On exit, the leading L-by-M part of this array contains the transformed input matrix ( Bc ) Qc'*B = ( ) , ( 0 ) where Bc is NR-by-M. The matrix ( Bc Ac ) is in the controllability staircase form (1). LDB INTEGER The leading dimension of array B. LDB >= MAX(1,L). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Zc. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,L) If COMPQ = 'N': Q is not referenced. If COMPQ = 'I': on entry, Q need not be set; on exit, the leading L-by-L part of this array contains the orthogonal matrix Qc, where Qc' is the product of transformations which are applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading L-by-L part of this array must contain an orthogonal matrix Q; on exit, the leading L-by-L part of this array contains the orthogonal matrix Q*Qc. LDQ INTEGER The leading dimension of array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,L), if COMPQ = 'U' or 'I'. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Zc, which is the product of transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Z; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z*Zc. LDZ INTEGER The leading dimension of array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'U' or 'I'. NR (output) INTEGER The order of the reduced matrices Ac and Ec, and the number of rows of the reduced matrix Bc; also the order of the controllable part of the pair (B, A-lambda*E). NRBLCK (output) INTEGER _ The number k, of full row rank blocks Ai,i in the staircase form of the pencil (Bc Ac-lambda*Ec) (see (1) and (2)). RTAU (output) INTEGER array, dimension (N1) RTAU(i), for i = 1, ..., NRBLCK, is the row dimension of _ the full row rank block Ai,i-1 in the staircase form (1).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming (A-lambda*E, B). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = L*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (MAX(N,L,2*M))Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The subroutine is based on the reduction algorithm of [1].References
[1] Varga, A. Computation of Irreducible Generalized State-Space Realizations. Kybernetika, vol. 26, pp. 89-106, 1990.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N*N1**2 ) floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
Given the descriptor system (A-lambda*E,B,C) with the system matrices A, E and B of the form ( A1 X1 ) ( E1 Y1 ) ( B1 ) A = ( ) , E = ( ) , B = ( ) , ( 0 X2 ) ( 0 Y2 ) ( 0 ) where - B is an L-by-M matrix, with B1 an N1-by-M submatrix, - A is an L-by-N matrix, with A1 an N1-by-N1 submatrix, - E is an L-by-N matrix, with E1 an N1-by-N1 submatrix with LBE nonzero sub-diagonals, this routine reduces the pair (A1-lambda*E1,B1) to the form Qc'*[ B1 A1-lambda*E1 ]*diag(I,Zc) = ( Bc Ac-lambda*Ec * ) ( ) , ( 0 0 Anc-lambda*Enc ) where: 1) the pencil ( Bc Ac-lambda*Ec ) has full row rank NR for all finite lambda and is in a staircase form with _ _ _ _ ( A1,0 A1,1 ... A1,k-1 A1,k ) ( _ _ _ ) ( Bc Ac ) = ( 0 A2,1 ... A2,k-1 A2,k ) , (1) ( ... _ _ ) ( 0 0 ... Ak,k-1 Ak,k ) _ _ _ ( E1,1 ... E1,k-1 E1,k ) ( _ _ ) Ec = ( 0 ... E2,k-1 E2,k ) , (2) ( ... _ ) ( 0 ... 0 Ek,k ) _ where Ai,i-1 is an rtau(i)-by-rtau(i-1) full row rank _ matrix (with rtau(0) = M) and Ei,i is an rtau(i)-by-rtau(i) upper triangular matrix. 2) the pencil Anc-lambda*Enc is regular of order N1-NR with Enc upper triangular; this pencil contains the uncontrollable finite eigenvalues of the pencil (A1-lambda*E1). The transformations are applied to the whole matrices A, E, B and C. The left and/or right orthogonal transformations Qc and Zc, performed to reduce the pencil, can be optionally accumulated in the matrices Q and Z, respectively. The reduced order descriptor system (Ac-lambda*Ec,Bc,Cc) has no uncontrollable finite eigenvalues and has the same transfer- function matrix as the original system (A-lambda*E,B,C).Specification
SUBROUTINE TG01HY( COMPQ, COMPZ, L, N, M, P, N1, LBE, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, NR, $ NRBLCK, RTAU, TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ INTEGER INFO, L, LBE, LDA, LDB, LDC, LDE, LDQ, LDWORK, $ LDZ, M, N, N1, NR, NRBLCK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IWORK( * ), RTAU( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
COMPQ CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'U': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'U': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.Input/Output Parameters
L (input) INTEGER The number of descriptor state equations; also the number of rows of the matrices A, E and B. L >= 0. N (input) INTEGER The dimension of the descriptor state vector; also the number of columns of the matrices A, E and C. N >= 0. M (input) INTEGER The dimension of descriptor system input vector; also the number of columns of the matrix B. M >= 0. P (input) INTEGER The dimension of descriptor system output; also the number of rows of the matrix C. P >= 0. N1 (input) INTEGER The order of the subsystem (A1-lambda*E1,B1,C1) to be reduced. MIN(L,N) >= N1 >= 0. LBE (input) INTEGER The number of nonzero sub-diagonals of the submatrix E1. MAX(0,N1-1) >= LBE >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading L-by-N part of this array must contain the L-by-N state matrix A in the partitioned form ( A1 X1 ) A = ( ) , ( 0 X2 ) where A1 is N1-by-N1. On exit, the leading L-by-N part of this array contains the transformed state matrix, ( Ac * * ) Qc'*A*diag(Zc,I) = ( 0 Anc * ) , ( 0 0 * ) where Ac is NR-by-NR and Anc is (N1-NR)-by-(N1-NR). The matrix ( Bc Ac ) is in the controllability staircase form (1). LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,L). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading L-by-N part of this array must contain the L-by-N descriptor matrix E in the partitioned form ( E1 Y1 ) E = ( ) , ( 0 Y2 ) where E1 is an N1-by-N1 matrix with LBE nonzero sub-diagonals. On exit, the leading L-by-N part of this array contains the transformed descriptor matrix ( Ec * * ) Qc'*E*diag(Zc,I) = ( 0 Enc * ) , ( 0 0 * ) where Ec is NR-by-NR and Enc is (N1-NR)-by-(N1-NR). Both Ec and Enc are upper triangular. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,L). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading L-by-M part of this array must contain the L-by-M input matrix B in the partitioned form ( B1 ) B = ( ) , ( 0 ) where B1 is N1-by-M. On exit, the leading L-by-M part of this array contains the transformed input matrix ( Bc ) Qc'*B = ( ) , ( 0 ) where Bc is NR-by-M. The matrix ( Bc Ac ) is in the controllability staircase form (1). LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,L). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Zc. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,L) If COMPQ = 'N': Q is not referenced. If COMPQ = 'I': on entry, Q need not be set; on exit, the leading L-by-L part of this array contains the orthogonal matrix Qc, where Qc' is the product of the transformations applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading L-by-L part of this array must contain an orthogonal matrix Q; on exit, the leading L-by-L part of this array contains the orthogonal matrix Q*Qc. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,L), if COMPQ = 'U' or 'I'. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Zc, i.e., the product of the transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Z; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z*Zc. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'U' or 'I'. NR (output) INTEGER The order of the reduced matrices Ac and Ec, and the number of rows of the reduced matrix Bc; also the order of the controllable part of the pair (B, A-lambda*E). NRBLCK (output) INTEGER _ The number k, of full row rank blocks Ai,i in the staircase form of the pencil (Bc Ac-lambda*Ec) (see (1) and (2)). RTAU (output) INTEGER array, dimension (N1) RTAU(i), for i = 1, ..., NRBLCK, is the row dimension of _ the full row rank block Ai,i-1 in the staircase form (1).Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming (A-lambda*E, B). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = L*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (M) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,N,L,2*(M+N1-1)) For good performance, LDWORK should be generally 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The subroutine is based on the reduction algorithm of [1]. If suitable, it uses block algorithms for the reduction of the matrix E and for the corresponding updates of the matrices A, B, and Q. Moreover, for large systems, the row transformations are applied on panels of columns of the matrices A, B, and E.References
[1] Varga, A. Computation of Irreducible Generalized State-Space Realizations. Kybernetika, vol. 26, pp. 89-106, 1990.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N*N1**2 ) floating point operations.Further Comments
If INFO > 0 on entry, that value is used as block size for the block algorithms. Otherwise, the block size is chosen internally.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute orthogonal transformation matrices Q and Z which reduce the N-th order descriptor system (A-lambda*E,B,C) to the form ( Ano * ) ( Eno * ) ( Bno ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , Q'*B = ( ) , ( 0 Ao ) ( 0 Eo ) ( Bo ) C*Z = ( 0 Co ) , where the NOBSV-th order descriptor system (Ao-lambda*Eo,Bo,Co) is a finite and/or infinite observable. The pencil Ano - lambda*Eno is regular of order N-NOBSV and contains the unobservable finite and/or infinite eigenvalues of the pencil A-lambda*E. For JOBOBS = 'O' or 'I', the pencil ( Eo-lambda*Ao ) has full ( Co ) column rank NOBSV for all finite lambda and is in a staircase form with _ _ _ _ ( Ek,k Ek,k-1 ... Ek,2 Ek,1 ) ( _ _ _ _ ) ( Eo ) = ( Ek-1,k Ek-1,k-1 ... Ek-1,2 Ek-1,1 ) , (1) ( Co ) ( ... ... _ _ ) ( 0 0 ... E1,2 E1,1 ) ( _ ) ( 0 0 ... 0 E0,1 ) _ _ _ ( Ak,k ... Ak,2 Ak,1 ) ( ... _ _ ) Ao = ( 0 ... A2,2 A2,1 ) , (2) ( _ ) ( 0 ... 0 A1,1 ) _ where Ei-1,i is a CTAU(i-1)-by-CTAU(i) full column rank matrix _ (with CTAU(0) = P) and Ai,i is a CTAU(i)-by-CTAU(i) upper triangular matrix. For JOBOBS = 'F', the pencil ( Ao-lambda*Eo ) has full ( Co ) column rank NOBSV for all finite lambda and is in a staircase form with _ _ _ _ ( Ak,k Ak,k-1 ... Ak,2 Ak,1 ) ( _ _ _ _ ) ( Ao ) = ( Ak-1,k Ak-1,k-1 ... Ak-1,2 Ak-1,1 ) , (3) ( Co ) ( ... ... _ _ ) ( 0 0 ... A1,2 A1,1 ) ( _ ) ( 0 0 ... 0 A0,1 ) _ _ _ ( Ek,k ... Ek,2 Ek,1 ) ( ... _ _ ) Eo = ( 0 ... E2,2 E2,1 ) , (4) ( _ ) ( 0 ... 0 E1,1 ) _ where Ai-1,i is a CTAU(i-1)-by-CTAU(i) full column rank matrix _ (with CTAU(0) = P) and Ei,i is a CTAU(i)-by-CTAU(i) upper triangular matrix. For JOBOBS = 'O', the (N-NOBSV)-by-(N-NOBSV) regular pencil Ano - lambda*Eno has the form ( Afno - lambda*Efno * ) Ano - lambda*Eno = ( ) , ( 0 Aino - lambda*Eino ) where: 1) the NIUOBS-by-NIUOBS regular pencil Aino - lambda*Eino, with Aino upper triangular and nonsingular, contains the unobservable infinite eigenvalues of A - lambda*E; 2) the (N-NOBSV-NIUOBS)-by-(N-NOBSV-NIUOBS) regular pencil Afno - lambda*Efno, with Efno upper triangular and nonsingular, contains the unobservable finite eigenvalues of A - lambda*E. Note: The significance of the two diagonal blocks can be interchanged by calling the routine with the arguments A and E interchanged. In this case, Aino - lambda*Eino contains the unobservable zero eigenvalues of A - lambda*E, while Afno - lambda*Efno contains the unobservable nonzero finite and infinite eigenvalues of A - lambda*E. For JOBOBS = 'F', the pencil Ano - lambda*Eno has the form Ano - lambda*Eno = Afno - lambda*Efno , where the regular pencil Afno - lambda*Efno, with Efno upper triangular and nonsingular, contains the unobservable finite eigenvalues of A - lambda*E. For JOBOBS = 'I', the pencil Ano - lambda*Eno has the form Ano - lambda*Eno = Aino - lambda*Eino , where the regular pencil Aino - lambda*Eino, with Aino upper triangular and nonsingular, contains the unobservable nonzero finite and infinite eigenvalues of A - lambda*E. The left and/or right orthogonal transformations Q and Z performed to reduce the system matrices can be optionally accumulated. The reduced order descriptor system (Ao-lambda*Eo,Bo,Co) has the same transfer-function matrix as the original system (A-lambda*E,B,C).Specification
SUBROUTINE TG01ID( JOBOBS, COMPQ, COMPZ, N, M, P, A, LDA, E, LDE, $ B, LDB, C, LDC, Q, LDQ, Z, LDZ, NOBSV, NIUOBS, $ NLBLCK, CTAU, TOL, IWORK, DWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ, JOBOBS INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDZ, $ M, N, NIUOBS, NLBLCK, NOBSV, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER CTAU( * ), IWORK( * ) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
JOBOBS CHARACTER*1 = 'O': separate both finite and infinite unobservable eigenvalues; = 'F': separate only finite unobservable eigenvalues; = 'I': separate only nonzero finite and infinite unobservable eigenvalues. COMPQ CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'U': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'U': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. M (input) INTEGER The dimension of descriptor system input vector; also the number of columns of matrix B. M >= 0. P (input) INTEGER The dimension of descriptor system output vector; also the number of rows of matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the N-by-N state matrix A. On exit, the leading N-by-N part of this array contains the transformed state matrix Q'*A*Z, ( Ano * ) Q'*A*Z = ( ) , ( 0 Ao ) where Ao is NOBSV-by-NOBSV and Ano is (N-NOBSV)-by-(N-NOBSV). If JOBOBS = 'F', the matrix ( Ao ) is in the observability ( Co ) staircase form (3). If JOBOBS = 'O' or 'I', the submatrix Ao is upper triangular. If JOBOBS = 'O', the submatrix Ano has the form ( Afno * ) Ano = ( ) , ( 0 Aino ) where the NIUOBS-by-NIUOBS matrix Aino is nonsingular and upper triangular. If JOBOBS = 'I', Ano is nonsingular and upper triangular. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the N-by-N descriptor matrix E. On exit, the leading N-by-N part of this array contains the transformed state matrix Q'*E*Z, ( Eno * ) Q'*E*Z = ( ) , ( 0 Eo ) where Eo is NOBSV-by-NOBSV and Eno is (N-NOBSV)-by-(N-NOBSV). If JOBOBS = 'O' or 'I', the matrix ( Eo ) is in the ( Co ) observability staircase form (1). If JOBOBS = 'F', the submatrix Eo is upper triangular. If JOBOBS = 'O', the Eno matrix has the form ( Efno * ) Eno = ( ) , ( 0 Eino ) where the NIUOBS-by-NIUOBS matrix Eino is nilpotent and the (N-NOBSV-NIUOBS)-by-(N-NOBSV-NIUOBS) matrix Efno is nonsingular and upper triangular. If JOBOBS = 'F', Eno is nonsingular and upper triangular. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,MAX(M,P)) On entry, the leading N-by-M part of this array must contain the N-by-M input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Q'*B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N) if M > 0 or LDB >= 1 if M = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z = ( 0 Co ) , where Co is P-by-NOBSV. If JOBOBS = 'O' or 'I', the matrix ( Eo ) is in the ( Co ) observability staircase form (1). If JOBOBS = 'F', the matrix ( Ao ) is in the observability ( Co ) staircase form (3). LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) If COMPQ = 'N': Q is not referenced. If COMPQ = 'I': on entry, Q need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Q, where Q' is the product of transformations which are applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Qc; on exit, the leading N-by-N part of this array contains the orthogonal matrix Qc*Q. LDQ INTEGER The leading dimension of array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,N), if COMPQ = 'U' or 'I'. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z, which is the product of transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Zc; on exit, the leading N-by-N part of this array contains the orthogonal matrix Zc*Z. LDZ INTEGER The leading dimension of array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'U' or 'I'. NOBSV (output) INTEGER The order of the reduced matrices Ao and Eo, and the number of columns of reduced matrix Co; also the order of observable part of the pair (C, A-lambda*E). NIUOBS (output) INTEGER For JOBOBS = 'O', the order of the reduced matrices Aino and Eino; also the number of unobservable infinite eigenvalues of the pencil A - lambda*E. For JOBOBS = 'F' or 'I', NIUOBS has no significance and is set to zero. NLBLCK (output) INTEGER For JOBOBS = 'O' or 'I', the number k, of full column rank _ blocks Ei-1,i in the staircase form of the pencil (Eo-lambda*Ao) (see (1) and (2)). ( Co ) For JOBOBS = 'F', the number k, of full column rank blocks _ Ai-1,i in the staircase form of the pencil (Ao-lambda*Eo) ( Co ) (see (3) and (4)). CTAU (output) INTEGER array, dimension (N) CTAU(i), for i = 1, ..., NLBLCK, is the column dimension _ _ of the full column rank block Ei-1,i or Ai-1,i in the staircase form (1) or (3) for JOBOBS = 'O' or 'I', or for JOBOBS = 'F', respectively.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming (A'-lambda*E',C')'. If the user sets TOL > 0, then the given value of TOL is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (P) DWORK DOUBLE PRECISION array, dimension (MAX(N,2*P))Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The subroutine is based on the dual of the reduction algorithms of [1].References
[1] A. Varga Computation of Irreducible Generalized State-Space Realizations. Kybernetika, vol. 26, pp. 89-106, 1990.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
If the system matrices A, E and C are badly scaled, it is generally recommendable to scale them with the SLICOT routine TG01AD, before calling TG01ID.Example
Program Text
* TG01ID EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER LMAX, NMAX, MMAX, PMAX PARAMETER ( LMAX = 20, NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER MPMX PARAMETER ( MPMX = MAX( MMAX, PMAX ) ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = LMAX, LDB = LMAX, LDC = MAX(MMAX,PMAX), $ LDE = LMAX, LDQ = LMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = MAX( 1, NMAX, 2*PMAX ) ) * .. Local Scalars .. CHARACTER*1 COMPQ, COMPZ, JOBOBS INTEGER I, INFO, J, M, N, NOBSV, NIUOBS, NLBLCK, P DOUBLE PRECISION TOL * .. Local Arrays .. INTEGER IWORK(MMAX), CTAU(NMAX) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MPMX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,LMAX), $ Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL TG01ID * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, JOBOBS COMPQ = 'I' COMPZ = 'I' IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the transformed descriptor system (A-lambda E,B,C). CALL TG01ID( JOBOBS, COMPQ, COMPZ, N, M, P, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, $ NOBSV, NIUOBS, NLBLCK, CTAU, TOL, IWORK, $ DWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) NOBSV, NIUOBS WRITE ( NOUT, FMT = 99985 ) WRITE ( NOUT, FMT = 99984 ) ( CTAU(I), I = 1,NLBLCK ) 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 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,N ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01ID EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01ID = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q''*A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix Q''*E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Dimension of observable part =', I5/ $ ' Number of unobservable infinite eigenvalues =', I5) 99993 FORMAT (/' The transformed input/state matrix Q''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99989 FORMAT (/' L is out of range.',/' L = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) 99985 FORMAT (/' The staircase form column dimensions are ' ) 99984 FORMAT (10I5) ENDProgram Data
TG01ID EXAMPLE PROGRAM DATA 7 2 3 0.0 O 2 0 0 0 0 0 0 0 1 0 0 0 1 0 2 0 0 2 0 0 0 0 0 1 0 1 0 1 -1 1 0 -1 0 1 0 3 0 0 3 0 0 0 1 0 1 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 3 1 0 0 0 0 1 0 0 0 0 0 1 0 2 0 0 0 0 0 -1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 -1 0 1 1 0 0 -1 0 1 1 0 2 0 0 0 0 0 1 1 0 0 0 0 0 2 0 0 0 0 0 0 3Program Results
TG01ID EXAMPLE PROGRAM RESULTS Dimension of observable part = 3 Number of unobservable infinite eigenvalues = 1 The staircase form column dimensions are 2 1 The transformed state dynamics matrix Q'*A*Z is 0.2177 0.2414 0.5742 0.4342 0.0000 -0.4342 0.4666 0.2022 0.2242 0.5334 -0.2924 -0.7723 0.2924 0.4334 -0.5892 -0.6533 -1.5540 0.8520 -0.2651 -0.8520 -1.2627 0.0000 0.0000 0.0000 3.7417 0.3780 -3.7417 0.0000 0.0000 0.0000 0.0000 0.0000 1.7862 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 2.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 The transformed descriptor matrix Q'*E*Z is 1.0000 0.0000 0.0000 0.4342 0.0000 0.0000 1.8016 0.0000 1.1937 -0.1496 -0.2924 0.3861 0.5461 0.2819 0.0000 0.0000 -1.0260 0.8520 0.1325 0.1874 -0.8214 0.0000 0.0000 0.0000 0.0000 -1.1339 -0.5345 0.0000 0.0000 0.0000 0.0000 0.0000 -0.1333 0.3770 2.3752 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 -0.1728 0.4887 -1.8325 The transformed input/state matrix Q'*B is 0.4666 0.0000 0.4334 0.5461 -1.2627 0.1874 0.0000 -1.6036 0.0000 -0.9803 1.0000 0.0000 0.0000 0.3665 The transformed state/output matrix C*Z is 0.0000 0.0000 0.0000 0.0000 0.0000 2.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 2.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.0000 The left transformation matrix Q is 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.7917 0.0000 -0.6108 0.0000 0.5461 0.1874 -0.5345 0.3770 0.0000 0.4887 0.9008 0.1410 -0.4107 0.0000 0.0000 0.0000 0.0000 0.0000 -0.5461 -0.1874 0.2673 0.4713 0.0000 0.6108 0.0000 -0.5461 -0.1874 -0.8018 -0.0943 0.0000 -0.1222 -0.4342 0.2924 -0.8520 0.0000 0.0000 0.0000 0.0000 The right transformation matrix Z is 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 -0.6519 0.2740 0.0000 0.7071 0.0000 0.0000 -0.4342 0.3491 0.8304 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -1.0000 0.0000 0.0000 0.0000 0.9008 0.1683 0.4003 0.0000 0.0000 0.0000 0.0000 0.0000 0.6519 -0.2740 0.0000 0.7071 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01JD.html 0000664 0000000 0000000 00000045304 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To find a reduced (controllable, observable, or irreducible) descriptor representation (Ar-lambda*Er,Br,Cr) for an original descriptor representation (A-lambda*E,B,C). The pencil Ar-lambda*Er is in an upper block Hessenberg form, with either Ar or Er upper triangular.Specification
SUBROUTINE TG01JD( JOB, SYSTYP, EQUIL, N, M, P, A, LDA, E, LDE, $ B, LDB, C, LDC, NR, INFRED, TOL, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER EQUIL, JOB, SYSTYP INTEGER INFO, LDA, LDB, LDC, LDE, LDWORK, M, N, NR, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER INFRED(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), E(LDE,*)Arguments
Mode Parameters
JOB CHARACTER*1 Indicates whether the user wishes to remove the uncontrollable and/or unobservable parts as follows: = 'I': Remove both the uncontrollable and unobservable parts to get an irreducible descriptor representation; = 'C': Remove the uncontrollable part only to get a controllable descriptor representation; = 'O': Remove the unobservable part only to get an observable descriptor representation. SYSTYP CHARACTER*1 Indicates the type of descriptor system algorithm to be applied according to the assumed transfer-function matrix as follows: = 'R': Rational transfer-function matrix; = 'S': Proper (standard) transfer-function matrix; = 'P': Polynomial transfer-function matrix. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily scale the system (A-lambda*E,B,C) as follows: = 'S': Perform scaling; = 'N': Do not perform scaling.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. M (input) INTEGER The dimension of descriptor system input vector; also the number of columns of matrix B. M >= 0. P (input) INTEGER The dimension of descriptor system output vector; also the number of rows of matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state matrix A. On exit, the leading NR-by-NR part of this array contains the reduced order state matrix Ar of an irreducible, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'I', JOB = 'C', or JOB = 'O', respectively. The matrix Ar is upper triangular if SYSTYP = 'R' or 'P'. If SYSTYP = 'S' and JOB = 'C', the matrix [Br Ar] is in a controllable staircase form (see TG01HD). If SYSTYP = 'S' and JOB = 'I' or 'O', the matrix ( Ar ) ( Cr ) is in an observable staircase form (see TG01HD). The block structure of staircase forms is contained in the leading INFRED(7) elements of IWORK. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the original descriptor matrix E. On exit, the leading NR-by-NR part of this array contains the reduced order descriptor matrix Er of an irreducible, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'I', JOB = 'C', or JOB = 'O', respectively. The resulting Er has INFRED(6) nonzero sub-diagonals. If at least for one k = 1,...,4, INFRED(k) >= 0, then the resulting Er is structured being either upper triangular or block Hessenberg, in accordance to the last performed order reduction phase (see METHOD). The block structure of staircase forms is contained in the leading INFRED(7) elements of IWORK. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M), if JOB = 'C', or (LDB,MAX(M,P)), otherwise. On entry, the leading N-by-M part of this array must contain the original input matrix B; if JOB = 'I', or JOB = 'O', the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. On exit, the leading NR-by-M part of this array contains the reduced input matrix Br of an irreducible, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'I', JOB = 'C', or JOB = 'O', respectively. If JOB = 'C', only the first IWORK(1) rows of B are nonzero. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original output matrix C; if JOB = 'I', or JOB = 'O', the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. On exit, the leading P-by-NR part of this array contains the transformed state/output matrix Cr of an irreducible, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'I', JOB = 'C', or JOB = 'O', respectively. If JOB = 'I', or JOB = 'O', only the last IWORK(1) columns (in the first NR columns) of C are nonzero. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P) if N > 0. LDC >= 1 if N = 0. NR (output) INTEGER The order of the reduced descriptor representation (Ar-lambda*Er,Br,Cr) of an irreducible, controllable, or observable realization for the original system, depending on JOB = 'I', JOB = 'C', or JOB = 'O', respectively. INFRED (output) INTEGER array, dimension 7 This array contains information on performed reduction and on structure of resulting system matrices as follows: INFRED(k) >= 0 (k = 1, 2, 3, or 4) if Phase k of reduction (see METHOD) has been performed. In this case, INFRED(k) is the achieved order reduction in Phase k. INFRED(k) < 0 (k = 1, 2, 3, or 4) if Phase k was not performed. INFRED(5) - the number of nonzero sub-diagonals of A. INFRED(6) - the number of nonzero sub-diagonals of E. INFRED(7) - the number of blocks in the resulting staircase form at last performed reduction phase. The block dimensions are contained in the first INFRED(7) elements of IWORK.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in rank determinations when transforming (A-lambda*E,B,C). If the user sets TOL > 0, then the given value of TOL is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL is considered to be of full rank. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension ((c*N+MAX(M,P)), where c = 2, if JOB = 'I' or SYSTYP = 'R', and c = 1, otherwise. On exit, if INFO = 0, the leading INFRED(7) elements of IWORK contain the orders of the diagonal blocks of Ar-lambda*Er. DWORK DOUBLE PRECISION array, dimension (LDWORK) LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(8*N,2*M,2*P), if EQUIL = 'S'; LDWORK >= MAX(N,2*M,2*P), if EQUIL = 'N'. If LDWORK >= 2*N*N+N*M+N*P+MAX(N,2*M,2*P) then more accurate results are to be expected by performing only those reductions phases (see METHOD), where effective order reduction occurs. This is achieved by saving the system matrices before each phase and restoring them if no order reduction took place.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The subroutine is based on the reduction algorithms of [1]. The order reduction is performed in 4 phases: Phase 1: Eliminate all finite uncontrollable eigenvalues. The resulting matrix ( Br Ar ) is in a controllable staircase form (see SLICOT Library routine TG01HD), and Er is upper triangular. This phase is performed if JOB = 'I' or 'C' and SYSTYP = 'R' or 'S'. Phase 2: Eliminate all infinite and finite nonzero uncontrollable eigenvalues. The resulting matrix ( Br Er ) is in a controllable staircase form (see TG01HD), and Ar is upper triangular. This phase is performed if JOB = 'I' or 'C' and SYSTYP = 'R' or 'P'. Phase 3: Eliminate all finite unobservable eigenvalues. The resulting matrix ( Ar ) is in an observable ( Cr ) staircase form (see SLICOT Library routine TG01ID), and Er is upper triangular. This phase is performed if JOB = 'I' or 'O' and SYSTYP = 'R' or 'S'. Phase 4: Eliminate all infinite and finite nonzero unobservable eigenvalues. The resulting matrix ( Er ) is in an ( Cr ) observable staircase form (see TG01ID), and Ar is upper triangular. This phase is performed if JOB = 'I' or 'O' and SYSTYP = 'R' or 'P'.References
[1] A. Varga Computation of Irreducible Generalized State-Space Realizations. Kybernetika, vol. 26, pp. 89-106, 1990.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
If the pencil (A-lambda*E) has no zero eigenvalues, then an irreducible realization can be computed skipping Phases 1 and 3 by using the setting: JOB = 'I' and SYSTYP = 'P'.Example
Program Text
* TG01JD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDE = NMAX ) INTEGER LDWORK, LIWORK PARAMETER ( LDWORK = MAX( 8*NMAX,2*MMAX,2*PMAX ), $ LIWORK = 2*NMAX + MAX( MMAX, PMAX ) ) * .. Local Scalars .. CHARACTER EQUIL, JOB, SYSTYP INTEGER I, INFO, J, M, N, NR, P DOUBLE PRECISION TOL * .. Local Arrays .. INTEGER INFRED(7), IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX) * .. External Subroutines .. EXTERNAL TG01JD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL, JOB, SYSTYP, EQUIL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the irreducible descriptor system (Ar-lambda Er,Br,Cr). CALL TG01JD( JOB, SYSTYP, EQUIL, N, M, P, A, LDA, E, LDE, $ B, LDB, C, LDC, NR, INFRED, TOL, IWORK, $ DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) NR WRITE ( NOUT, FMT = 99991 ) DO 10 I = 1, 4 IF( INFRED(I).GE.0 ) $ WRITE ( NOUT, FMT = 99990 ) I, INFRED(I) 10 CONTINUE WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 30 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,NR ) 30 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 50 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 50 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01JD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01JD = ',I2) 99997 FORMAT (/' The reduced state dynamics matrix Ar is ') 99996 FORMAT (/' The reduced descriptor matrix Er is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Order of reduced system =', I5 ) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' Achieved order reductions in different phases') 99990 FORMAT (' Phase',I2,':', I3, ' elliminated eigenvalue(s)' ) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TG01JD EXAMPLE PROGRAM DATA 9 2 2 0.0 I R N -2 -3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -2 -3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0 1 -3 0 1 0 2 0 0 1 1 3 0 1 0 0 1Program Results
TG01JD EXAMPLE PROGRAM RESULTS Order of reduced system = 7 Achieved order reductions in different phases Phase 1: 0 elliminated eigenvalue(s) Phase 2: 0 elliminated eigenvalue(s) Phase 3: 2 elliminated eigenvalue(s) Phase 4: 0 elliminated eigenvalue(s) The reduced state dynamics matrix Ar is 1.0000 -0.0393 -0.0980 -0.1066 0.0781 -0.2330 0.0777 0.0000 1.0312 0.2717 0.2609 -0.1533 0.6758 -0.3553 0.0000 0.0000 1.3887 0.6699 -0.4281 1.6389 -0.7615 0.0000 0.0000 0.0000 -1.2147 0.2423 -0.9792 0.4788 0.0000 0.0000 0.0000 0.0000 -1.0545 0.5035 -0.2788 0.0000 0.0000 0.0000 0.0000 0.0000 1.6355 -0.4323 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 The reduced descriptor matrix Er is 0.4100 0.2590 0.5080 -0.3109 0.0705 0.1429 -0.1477 -0.7629 -0.3464 0.0992 -0.3007 0.0619 0.2483 -0.0152 0.1120 -0.2124 -0.4184 -0.1288 0.0569 -0.4213 -0.6182 0.0000 0.1122 -0.0039 0.2771 -0.0758 0.0975 0.3923 0.0000 0.0000 0.3708 -0.4290 0.1006 0.1402 -0.2699 0.0000 0.0000 0.0000 0.0000 0.9458 -0.2211 0.2378 0.0000 0.0000 0.0000 0.5711 0.2648 0.5948 -0.5000 The reduced input/state matrix Br is -0.5597 0.2363 -0.4843 -0.0498 -0.4727 -0.1491 0.1802 1.1574 0.5995 0.1556 -0.1729 -0.3999 0.0000 0.2500 The reduced state/output matrix Cr is 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 4.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.1524 -1.7500
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01JY.html 0000664 0000000 0000000 00000054050 14560147231 0020374 0 ustar 00root root 0000000 0000000
Purpose
To find a reduced (controllable, observable, or irreducible) descriptor representation (Ar-lambda*Er,Br,Cr) for an original descriptor representation (A-lambda*E,B,C). The pencil Ar-lambda*Er is in an upper block Hessenberg form, with either Ar or Er upper triangular.Specification
SUBROUTINE TG01JY( JOB, SYSTYP, EQUIL, CKSING, RESTOR, N, M, P, A, $ LDA, E, LDE, B, LDB, C, LDC, NR, INFRED, TOL, $ IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER CKSING, EQUIL, JOB, RESTOR, SYSTYP INTEGER INFO, LDA, LDB, LDC, LDE, LDWORK, M, N, NR, P C .. Array Arguments .. INTEGER INFRED(*), IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), DWORK(*), $ E(LDE,*), TOL(*)Arguments
Mode Parameters
JOB CHARACTER*1 Indicates whether the user wishes to remove the uncontrollable and/or unobservable parts as follows: = 'I': Remove both the uncontrollable and unobservable parts to get an irreducible descriptor representation; = 'C': Remove the uncontrollable part only to get a controllable descriptor representation; = 'O': Remove the unobservable part only to get an observable descriptor representation. SYSTYP CHARACTER*1 Indicates the type of descriptor system algorithm to be applied according to the assumed transfer-function matrix as follows: = 'R': Rational transfer-function matrix; = 'S': Proper (standard) transfer-function matrix; = 'P': Polynomial transfer-function matrix. EQUIL CHARACTER*1 Specifies whether the user wishes to preliminarily scale the system (A-lambda*E,B,C) as follows: = 'S': Perform scaling; = 'N': Do not perform scaling. CKSING CHARACTER*1 Specifies whether the user wishes to check if the pencil (A-lambda*E) is singular as follows: = 'C': Check singularity; = 'N': Do not check singularity. If the pencil is singular, the reduced system computed for CKSING = 'N' can be wrong. RESTOR CHARACTER*1 Specifies whether the user wishes to save the system matrices before each phase and restore them if no order reduction took place as follows: = 'R': Save and restore; = 'N': Do not save the matrices.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. M (input) INTEGER The dimension of descriptor system input vector; also the number of columns of matrix B. M >= 0. P (input) INTEGER The dimension of descriptor system output vector; also the number of rows of matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state matrix A. On exit, the leading NR-by-NR part of this array contains the reduced order state matrix Ar of an irreducible, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'I', JOB = 'C', or JOB = 'O', respectively. The matrix Ar is upper triangular if SYSTYP = 'P'. If SYSTYP = 'S' and JOB = 'C', the matrix [Br Ar] is in a controllable staircase form (see SLICOT Library routine TG01HD). If SYSTYP = 'S' and JOB = 'I' or 'O', the matrix ( Ar ) ( Cr ) is in an observable staircase form (see TG01HD). The resulting Ar has INFRED(5) nonzero sub-diagonals. The block structure of staircase forms is contained in the leading INFRED(7) elements of IWORK. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the original descriptor matrix E. On exit, the leading NR-by-NR part of this array contains the reduced order descriptor matrix Er of an irreducible, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'I', JOB = 'C', or JOB = 'O', respectively. The resulting Er has INFRED(6) nonzero sub-diagonals. If at least for one k = 1,...,4, INFRED(k) >= 0, then the resulting Er is structured being either upper triangular or block Hessenberg, in accordance to the last performed order reduction phase (see METHOD). The block structure of staircase forms is contained in the leading INFRED(7) elements of IWORK. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M), if JOB = 'C', or (LDB,MAX(M,P)), otherwise. On entry, the leading N-by-M part of this array must contain the original input matrix B; if JOB = 'I', or JOB = 'O', the remainder of the leading N-by-MAX(M,P) part is used as internal workspace. On exit, the leading NR-by-M part of this array contains the reduced input matrix Br of an irreducible, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'I', JOB = 'C', or JOB = 'O', respectively. If JOB = 'C', only the first IWORK(1) rows of B are nonzero. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the original output matrix C; if JOB = 'I', or JOB = 'O', the remainder of the leading MAX(M,P)-by-N part is used as internal workspace. On exit, the leading P-by-NR part of this array contains the transformed state/output matrix Cr of an irreducible, controllable, or observable realization for the original system, depending on the value of JOB, JOB = 'I', JOB = 'C', or JOB = 'O', respectively. If JOB = 'I', or JOB = 'O', only the last IWORK(1) columns (in the first NR columns) of C are nonzero. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,M,P) if N > 0. LDC >= 1 if N = 0. NR (output) INTEGER The order of the reduced descriptor representation (Ar-lambda*Er,Br,Cr) of an irreducible, controllable, or observable realization for the original system, depending on JOB = 'I', JOB = 'C', or JOB = 'O', respectively. INFRED (output) INTEGER array, dimension 7 This array contains information on performed reduction and on structure of resulting system matrices as follows: INFRED(k) >= 0 (k = 1, 2, 3, or 4) if Phase k of reduction (see METHOD) has been performed. In this case, INFRED(k) is the achieved order reduction in Phase k. INFRED(k) < 0 (k = 1, 2, 3, or 4) if Phase k was not performed. INFRED(5) - the number of nonzero sub-diagonals of A. INFRED(6) - the number of nonzero sub-diagonals of E. INFRED(7) - the number of blocks in the resulting staircase form at last performed reduction phase. The block dimensions are contained in the first INFRED(7) elements of IWORK.Tolerances
TOL DOUBLE PRECISION array, dimension 3 TOL(1) is the tolerance to be used in rank determinations when transforming (A-lambda*E,B,C). If the user sets TOL(1) > 0, then the given value of TOL(1) is used as a lower bound for reciprocal condition numbers in rank determinations; a (sub)matrix whose estimated condition number is less than 1/TOL(1) is considered to be of full rank. If the user sets TOL(1) <= 0, then an implicitly computed, default tolerance, defined by TOLDEF1 = N*N*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL(1) < 1. TOL(2) is the tolerance to be used for checking pencil singularity when CKSING = 'C', or singularity of the matrices A and E when CKSING = 'N'. If the user sets TOL(2) > 0, then the given value of TOL(2) is used. If the user sets TOL(2) <= 0, then an implicitly computed, default tolerance, defined by TOLDEF2 = 10*EPS, is used instead. TOL(2) < 1. TOL(3) is the threshold value for magnitude of the matrix elements, if EQUIL = 'S': elements with magnitude less than or equal to TOL(3) are ignored for scaling. If the user sets TOL(3) >= 0, then the given value of TOL(3) is used. If the user sets TOL(3) < 0, then an implicitly computed, default threshold, defined by THRESH = c*EPS, where c = MAX(norm_1(A,E,B,C)) is used instead. TOL(3) = 0 is not always a good choice. TOL(3) < 1. TOL(3) is not used if EQUIL = 'N'.Workspace
IWORK INTEGER array, dimension (2*N+MAX(M,P)) On exit, if INFO = 0, the leading INFRED(7) elements of IWORK contain the orders of the diagonal blocks of Ar-lambda*Er. DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= MAX(1,x,y,8*N), if EQUIL = 'S', LDWORK >= MAX(1,x,y), if EQUIL = 'N', where x = MAX(2*(z+MAX(M,P)+N-1),N*N+4*N), if RESTOR = 'R' x = MAX( 2*(MAX(M,P)+N-1),N*N+4*N), if RESTOR = 'N' y = 2*N*N+10*N+MAX(N,23), if CKSING = 'C', y = 0, if CKSING = 'N', z = 2*N*N+N*M+N*P, if JOB = 'I', z = 0, if JOB <> 'I'. For good performance, LDWORK should be generally larger. If RESTOR = 'R', or LDWORK >= MAX(1,2*N*N+N*M+N*P+2*(MAX(M,P)+N-1), more accurate results are to be expected by considering only those reductions phases (see METHOD), where effective order reduction occurs. This is achieved by saving the system matrices before each phase and restoring them if no order reduction took place. Actually, if JOB = 'I' and RESTOR = 'N', then the saved matrices are those obtained after orthogonally triangularizing the matrix A (if SYSTYP = 'R' or 'P'), or the matrix E (if SYSTYP = 'R' or 'S'). 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. The optimal workspace includes the extra space for improving the accuracy.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the given pencil A - lambda*E is numerically singular and the reduced system is not computed. This error can be returned only if CKSING = 'C'.Method
The subroutine is based on the reduction algorithms of [1], but with a different ordering of the phases. The order reduction is performed in 4 phases: Phase 1: Eliminate all infinite and finite nonzero uncontrollable eigenvalues. The resulting matrix ( Br Er ) is in a controllable staircase form (see TG01HD), and Ar is upper triangular. This phase is performed if JOB = 'I' or 'C' and SYSTYP = 'R' or 'P'. Phase 2: Eliminate all infinite and finite nonzero unobservable eigenvalues. The resulting matrix ( Er ) is in an ( Cr ) observable staircase form (see SLICOT Library routine TG01ID), and Ar is upper triangular. This phase is performed if JOB = 'I' or 'O' and SYSTYP = 'R' or 'P'. Phase 3: Eliminate all finite uncontrollable eigenvalues. The resulting matrix ( Br Ar ) is in a controllable staircase form (see TG01HD), and Er is upper triangular. This phase is performed if JOB = 'I' or 'C' and SYSTYP = 'R' or 'S'. Phase 4: Eliminate all finite unobservable eigenvalues. The resulting matrix ( Ar ) is in an observable ( Cr ) staircase form (see TG01ID), and Er is upper triangular. This phase is performed if JOB = 'I' or 'O' and SYSTYP = 'R' or 'S'. The routine checks the singularity of the matrices A and/or E (depending on JOB and SYSTYP) and skips the unnecessary phases. See FURTHER COMMENTS.References
[1] A. Varga Computation of Irreducible Generalized State-Space Realizations. Kybernetika, vol. 26, pp. 89-106, 1990.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
If the pencil A-lambda*E has no zero eigenvalues, then an irreducible realization is computed skipping Phases 3 and 4 (equivalent to setting: JOB = 'I' and SYSTYP = 'P').Example
Program Text
* TG01JY EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDE = NMAX ) INTEGER LDWORK, LIWORK PARAMETER ( LDWORK = 2*NMAX*NMAX + $ MAX( 2*( NMAX*( NMAX + MMAX + PMAX ) + $ MAX( MMAX, PMAX ) + NMAX - 1 ), $ 10*NMAX + MAX( NMAX, 23 ) ), $ LIWORK = 2*NMAX + MAX( MMAX, PMAX ) ) * .. Local Scalars .. CHARACTER CKSING, EQUIL, JOB, RESTOR, SYSTYP INTEGER I, INFO, J, M, N, NR, P * .. Local Arrays .. INTEGER INFRED(7), IWORK(LIWORK) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), TOL(3) * .. External Subroutines .. EXTERNAL TG01JY * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, TOL(1), TOL(2), TOL(3), JOB, $ SYSTYP, EQUIL, CKSING, RESTOR IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the irreducible descriptor system (Ar-lambda Er,Br,Cr). CALL TG01JY( JOB, SYSTYP, EQUIL, CKSING, RESTOR, N, M, P, $ A, LDA, E, LDE, B, LDB, C, LDC, NR, INFRED, $ TOL, IWORK, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) NR WRITE ( NOUT, FMT = 99991 ) DO 10 I = 1, 4 IF( INFRED(I).GE.0 ) $ WRITE ( NOUT, FMT = 99990 ) I, INFRED(I) 10 CONTINUE WRITE ( NOUT, FMT = 99997 ) DO 20 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NR ) 20 CONTINUE WRITE ( NOUT, FMT = 99996 ) DO 30 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,NR ) 30 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 40 I = 1, NR WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 40 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 50 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,NR ) 50 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01JY EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01JY = ',I2) 99997 FORMAT (/' The reduced state dynamics matrix Ar is ') 99996 FORMAT (/' The reduced descriptor matrix Er is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Order of reduced system =', I5 ) 99993 FORMAT (/' The reduced input/state matrix Br is ') 99992 FORMAT (/' The reduced state/output matrix Cr is ') 99991 FORMAT (/' Achieved order reductions in different phases') 99990 FORMAT (' Phase',I2,':', I3, ' elliminated eigenvalue(s)' ) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) ENDProgram Data
TG01JY EXAMPLE PROGRAM DATA 9 2 2 0.0 0.0 0.0 I R N N N -2 -3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -2 -3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0 1 -3 0 1 0 2 0 0 1 1 3 0 1 0 0 1Program Results
TG01JY EXAMPLE PROGRAM RESULTS Order of reduced system = 7 Achieved order reductions in different phases Phase 1: 0 elliminated eigenvalue(s) Phase 2: 2 elliminated eigenvalue(s) The reduced state dynamics matrix Ar is 1.0000 -0.0393 -0.0980 0.1066 -0.0781 0.2330 -0.0777 0.0000 1.0312 0.2717 -0.2609 0.1533 -0.6758 0.3553 0.0000 0.0000 1.3887 -0.6699 0.4281 -1.6389 0.7615 0.0000 0.0000 0.0000 1.2147 -0.2423 0.9792 -0.4788 0.0000 0.0000 0.0000 0.0000 1.0545 -0.5035 0.2788 0.0000 0.0000 0.0000 0.0000 0.0000 1.6355 -0.4323 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 The reduced descriptor matrix Er is 0.4100 0.2590 0.5080 0.3109 -0.0705 -0.1429 0.1477 -0.7629 -0.3464 0.0992 0.3007 -0.0619 -0.2483 0.0152 0.1120 -0.2124 -0.4184 0.1288 -0.0569 0.4213 0.6182 0.0000 0.1122 -0.0039 -0.2771 0.0758 -0.0975 -0.3923 0.0000 0.0000 0.3708 0.4290 -0.1006 -0.1402 0.2699 0.0000 0.0000 0.0000 0.0000 0.9458 -0.2211 0.2378 0.0000 0.0000 0.0000 0.5711 0.2648 0.5948 -0.5000 The reduced input/state matrix Br is 0.5597 -0.2363 0.4843 0.0498 0.4727 0.1491 -0.1802 -1.1574 -0.5995 -0.1556 -0.1729 -0.3999 0.0000 0.2500 The reduced state/output matrix Cr is 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 4.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.1524 -1.7500
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01KD.html 0000664 0000000 0000000 00000016242 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To compute for a single-input single-output descriptor system, (A, E, B, C), with E upper triangular, a transformed system, (Q'*A*Z, Q'*E*Z, Q'*B, C*Z), via an orthogonal equivalence transformation, so that Q'*B has only the first element nonzero and Q'*E*Z remains upper triangular.Specification
SUBROUTINE TG01KD( JOBE, COMPC, COMPQ, COMPZ, N, A, LDA, E, LDE, $ B, C, INCC, Q, LDQ, Z, LDZ, INFO ) C .. Scalar Arguments .. CHARACTER COMPC, COMPQ, COMPZ, JOBE INTEGER INCC, INFO, LDA, LDE, LDQ, LDZ, N C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(*), C(*), E(LDE,*), Q(LDQ,*), $ Z(LDZ,*)Arguments
Mode Parameters
JOBE CHARACTER*1 Specifies whether E is an upper triangular or an identity matrix, as follows: = 'U': The matrix E is an upper triangular matrix; = 'I': The matrix E is assumed identity and is not given. COMPC CHARACTER*1 Indicates whether the user wishes to transform the system output matrix C, as follows: = 'C': Transform the system output matrix C; = 'N': Do not transform the system output matrix C. COMPQ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Q the orthogonal row transformations, as follows: = 'N': Do not form Q; = 'I': Q is initialized to the unit matrix and the orthogonal transformation matrix Q is returned; = 'U': The given matrix Q is updated by the orthogonal transformations used. COMPZ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Z the orthogonal column transformations, as follows: = 'N': Do not form Z; = 'I': Z is initialized to the unit matrix and the orthogonal transformation matrix Z is returned; = 'U': The given matrix Z is updated by the orthogonal transformations used.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state matrix A. On exit, the leading N-by-N part of this array contains the transformed state matrix Q'*A*Z. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,*) On entry, if JOBE = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the descriptor matrix E. The lower triangular part under the first subdiagonal is not referenced. On exit, if JOBE = 'U', the leading N-by-N upper triangular part of this array contains the upper triangular part of the transformed descriptor matrix, Q'*E*Z. If JOBE = 'I', this array is not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'U'; LDE >= 1, if JOBE = 'I'. B (input/output) DOUBLE PRECISION array, dimension (N) On entry, the leading N part of this array must contain the original input matrix B. On exit, the leading N part of this array contains the transformed input matrix Q'*B with all elements but the first set to zero. C (input/output) DOUBLE PRECISION array, dimension ((N-1)*INCC+1) On entry, if COMPC = 'C', the elements 1, INCC+1, ..., (N-1)*INCC+1 of this array must contain the original output vector C. On exit, if COMPC = 'C', the elements 1, INCC+1, ..., (N-1)*INCC+1 of this array contain the transformed output vector C*Z. If COMPC = 'N', this array is not referenced. INCC INTEGER If COMPC = 'C', the increment between successive values of C. INCC > 0. If COMPC = 'N', INCC is not used. Q (input/output) DOUBLE PRECISION array, dimension (LDQ,*) On entry, if COMPQ = 'U', the leading N-by-N part of this array must contain the given matrix Q1. Otherwise, this array need not be set on input. On exit, if COMPU <> 'N', the leading N-by-N part of this array contains the orthogonal transformation matrix used (Q1*Q if COMPQ = 'U'). If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= max(1,N), if COMPQ <> 'N'. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,*) On entry, if COMPZ = 'U', the leading N-by-N part of this array must contain the given matrix Z1. Otherwise, this array need not be set on input. On exit, if COMPZ <> 'N', the leading N-by-N part of this array contains the orthogonal transformation matrix used (Z1*Z if COMPZ = 'U'). If COMPZ = 'N', this array is not referenced. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= max(1,N), if COMPZ <> 'N'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Givens rotations are used to annihilate the last N-1 elements of B in reverse order, but preserve the form of E.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute for a single-input single-output descriptor system, (A, E, B, C), with E upper triangular, a transformed system, (Q'*A*Z, Q'*E*Z, Q'*B, C*Z), via an orthogonal equivalence transformation, so that Q'*B has only the first element nonzero and Q'*E*Z remains upper triangular.Specification
SUBROUTINE TG01KZ( JOBE, COMPC, COMPQ, COMPZ, N, A, LDA, E, LDE, $ B, C, INCC, Q, LDQ, Z, LDZ, INFO ) C .. Scalar Arguments .. CHARACTER COMPC, COMPQ, COMPZ, JOBE INTEGER INCC, INFO, LDA, LDE, LDQ, LDZ, N C .. Array Arguments .. COMPLEX*16 A(LDA,*), B(*), C(*), E(LDE,*), Q(LDQ,*), $ Z(LDZ,*)Arguments
Mode Parameters
JOBE CHARACTER*1 Specifies whether E is an upper triangular or an identity matrix, as follows: = 'U': The matrix E is an upper triangular matrix; = 'I': The matrix E is assumed identity and is not given. COMPC CHARACTER*1 Indicates whether the user wishes to transform the system output matrix C, as follows: = 'C': Transform the system output matrix C; = 'N': Do not transform the system output matrix C. COMPQ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Q the orthogonal row transformations, as follows: = 'N': Do not form Q; = 'I': Q is initialized to the unit matrix and the orthogonal transformation matrix Q is returned; = 'U': The given matrix Q is updated by the orthogonal transformations used. COMPZ CHARACTER*1 Indicates whether the user wishes to accumulate in a matrix Z the orthogonal column transformations, as follows: = 'N': Do not form Z; = 'I': Z is initialized to the unit matrix and the orthogonal transformation matrix Z is returned; = 'U': The given matrix Z is updated by the orthogonal transformations used.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. A (input/output) COMPLEX*16 array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state matrix A. On exit, the leading N-by-N part of this array contains the transformed state matrix Q'*A*Z. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) COMPLEX*16 array, dimension (LDE,*) On entry, if JOBE = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the descriptor matrix E. The lower triangular part under the first subdiagonal is not referenced. On exit, if JOBE = 'U', the leading N-by-N upper triangular part of this array contains the upper triangular part of the transformed descriptor matrix, Q'*E*Z. If JOBE = 'I', this array is not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'U'; LDE >= 1, if JOBE = 'I'. B (input/output) COMPLEX*16 array, dimension (N) On entry, the leading N part of this array must contain the original input matrix B. On exit, the leading N part of this array contains the transformed input matrix Q'*B with all elements but the first set to zero. C (input/output) COMPLEX*16 array, dimension ((N-1)*INCC+1) On entry, if COMPC = 'C', the elements 1, INCC+1, ..., (N-1)*INCC+1 of this array must contain the original output vector C. On exit, if COMPC = 'C', the elements 1, INCC+1, ..., (N-1)*INCC+1 of this array contain the transformed output vector C*Z. If COMPC = 'N', this array is not referenced. INCC INTEGER If COMPC = 'C', the increment between successive values of C. INCC > 0. If COMPC = 'N', INCC is not used. Q (input/output) COMPLEX*16 array, dimension (LDQ,*) On entry, if COMPQ = 'U', the leading N-by-N part of this array must contain the given matrix Q1. Otherwise, this array need not be set on input. On exit, if COMPU <> 'N', the leading N-by-N part of this array contains the orthogonal transformation matrix used (Q1*Q if COMPQ = 'U'). If COMPQ = 'N', this array is not referenced. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= max(1,N), if COMPQ <> 'N'. Z (input/output) COMPLEX*16 array, dimension (LDZ,*) On entry, if COMPZ = 'U', the leading N-by-N part of this array must contain the given matrix Z1. Otherwise, this array need not be set on input. On exit, if COMPZ <> 'N', the leading N-by-N part of this array contains the orthogonal transformation matrix used (Z1*Z if COMPZ = 'U'). If COMPZ = 'N', this array is not referenced. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= max(1,N), if COMPZ <> 'N'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Givens rotations are used to annihilate the last N-1 elements of B in reverse order, but preserve the form of E.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute orthogonal transformation matrices Q and Z which reduce the regular pole pencil A-lambda*E of the descriptor system (A-lambda*E,B,C) to the form (if JOB = 'F') ( Af * ) ( Ef * ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , (1) ( 0 Ai ) ( 0 Ei ) or to the form (if JOB = 'I') ( Ai * ) ( Ei * ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , (2) ( 0 Af ) ( 0 Ef ) where the subpencil Af-lambda*Ef, with Ef nonsingular and upper triangular, contains the finite eigenvalues, and the subpencil Ai-lambda*Ei, with Ai nonsingular and upper triangular, contains the infinite eigenvalues. The subpencil Ai-lambda*Ei is in a staircase form (see METHOD). If JOBA = 'H', the submatrix Af is further reduced to an upper Hessenberg form.Specification
SUBROUTINE TG01LD( JOB, JOBA, COMPQ, COMPZ, N, M, P, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, NF, ND, $ NIBLCK, IBLCK, TOL, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ, JOB, JOBA INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDWORK, LDZ, M, $ N, ND, NF, NIBLCK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IBLCK( * ), IWORK(*) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
JOB CHARACTER*1 = 'F': perform the finite-infinite separation; = 'I': perform the infinite-finite separation. JOBA CHARACTER*1 = 'H': reduce Af further to an upper Hessenberg form; = 'N': keep Af unreduced. COMPQ CHARACTER*1 = 'N': do not compute Q; = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'U': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. COMPZ CHARACTER*1 = 'N': do not compute Z; = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'U': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.Input/Output Parameters
N (input) INTEGER The number of rows of the matrix B, the number of columns of the matrix C and the order of the square matrices A and E. N >= 0. M (input) INTEGER The number of columns of the matrix B. M >= 0. P (input) INTEGER The number of rows of the matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the N-by-N state matrix A. On exit, the leading N-by-N part of this array contains the transformed state matrix Q'*A*Z, ( Af * ) ( Ai * ) Q'*A*Z = ( ) , or Q'*A*Z = ( ) , ( 0 Ai ) ( 0 Af ) depending on JOB, with Af an NF-by-NF matrix, and Ai an (N-NF)-by-(N-NF) nonsingular and upper triangular matrix. If JOBA = 'H', Af is in an upper Hessenberg form. Otherwise, Af is unreduced. Ai has a block structure as in (3) or (4), where A0,0 is ND-by-ND and Ai,i , for i = 1, ..., NIBLCK, is IBLCK(i)-by-IBLCK(i). LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the N-by-N descriptor matrix E. On exit, the leading N-by-N part of this array contains the transformed descriptor matrix Q'*E*Z, ( Ef * ) ( Ei * ) Q'*E*Z = ( ) , or Q'*E*Z = ( ) , ( 0 Ei ) ( 0 Ef ) depending on JOB, with Ef an NF-by-NF nonsingular matrix, and Ei an (N-NF)-by-(N-NF) nilpotent matrix in an upper block triangular form, as in (3) or (4). LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,K), where K = M if JOB = 'F', and K = MAX(M,P) if JOB = 'I'. On entry, the leading N-by-M part of this array must contain the N-by-M input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Q'*B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,K), where K = P if JOB = 'F', and K = MAX(M,P) if JOB = 'I'. Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) If COMPQ = 'N': Q is not referenced. If COMPQ = 'I': on entry, Q need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Q, where Q' is the product of Householder transformations applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Q1; on exit, the leading N-by-N part of this array contains the orthogonal matrix Q1*Q. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = 'N'; LDQ >= MAX(1,N), if COMPQ = 'I' or 'U'. Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'N': Z is not referenced. If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z, which is the product of Householder transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Z1; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z1*Z. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1, if COMPZ = 'N'; LDZ >= MAX(1,N), if COMPZ = 'I' or 'U'. NF (output) INTEGER. The order of the reduced matrices Af and Ef; also, the number of finite generalized eigenvalues of the pencil A-lambda*E. ND (output) INTEGER. The number of non-dynamic infinite eigenvalues of the pair (A,E). Note: N-ND is the rank of the matrix E. NIBLCK (output) INTEGER If ND > 0, the number of infinite blocks minus one. If ND = 0, then NIBLCK = 0. IBLCK (output) INTEGER array, dimension (N) IBLCK(i) contains the dimension of the i-th block in the staircase form (3) or (4), with i = 1,2, ..., NIBLCK.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR factorization with column pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then an implicitly computed, default tolerance, TOLDEF = N**2*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, and if N > 0, LDWORK >= N + MAX(3*N,M,P). 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the pencil A-lambda*E is not regular.Method
The subroutine is based on the reduction algorithm of [1]. If JOB = 'F', the matrices Ai and Ei have the form ( A0,0 A0,k ... A0,1 ) ( 0 E0,k ... E0,1 ) Ai = ( 0 Ak,k ... Ak,1 ) , Ei = ( 0 0 ... Ek,1 ) ; (3) ( : : . : ) ( : : . : ) ( 0 0 ... A1,1 ) ( 0 0 ... 0 ) if JOB = 'I', the matrices Ai and Ei have the form ( A1,1 ... A1,k A1,0 ) ( 0 ... E1,k E1,0 ) Ai = ( : . : : ) , Ei = ( : . : : ) , (4) ( : ... Ak,k Ak,0 ) ( : ... 0 Ek,0 ) ( 0 ... 0 A0,0 ) ( 0 ... 0 0 ) where Ai,i , for i = 0, 1, ..., k, are nonsingular upper triangular matrices. A0,0 corresponds to the non-dynamic infinite modes of the system.References
[1] Misra, P., Van Dooren, P., and Varga, A. Computation of structural invariants of generalized state-space systems. Automatica, 30, pp. 1921-1936, 1994.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
The number of infinite poles is computed as NIBLCK NINFP = Sum IBLCK(i) = N - ND - NF. i=1 The multiplicities of infinite poles can be computed as follows: there are IBLCK(k)-IBLCK(k+1) infinite poles of multiplicity k, for k = 1, ..., NIBLCK, where IBLCK(NIBLCK+1) = 0. Note that each infinite pole of multiplicity k corresponds to an infinite eigenvalue of multiplicity k+1.Example
Program Text
* TG01LD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDE = NMAX, LDQ = NMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = NMAX+MAX( 3*NMAX, MMAX, PMAX ) ) * .. Local Scalars .. CHARACTER*1 COMPQ, COMPZ, JOB, JOBA INTEGER I, INFO, J, M, N, ND, NF, NIBLCK, P DOUBLE PRECISION TOL * .. Local Arrays .. INTEGER IBLCK(NMAX), IWORK(NMAX) DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,NMAX), $ Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL TG01LD * .. Intrinsic Functions .. INTRINSIC MAX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOB, JOBA, TOL COMPQ = 'I' COMPZ = 'I' IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the reduced descriptor system * (A-lambda E,B,C). CALL TG01LD( JOB, JOBA, COMPQ, COMPZ, N, M, P, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, NF, $ ND, NIBLCK, IBLCK, TOL, IWORK, DWORK, $ LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) NF, ND WRITE ( NOUT, FMT = 99989 ) NIBLCK + 1 IF ( NIBLCK.GT.0 ) THEN WRITE ( NOUT, FMT = 99985 ) $ ( IBLCK(I), I = 1, NIBLCK ) END IF 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 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,N ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01LD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01LD = ',I2) 99997 FORMAT (/' The reduced state dynamics matrix Q''*A*Z is ') 99996 FORMAT (/' The reduced descriptor matrix Q''*E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Order of reduced system =', I5/ $ ' Number of non-dynamic infinite eigenvalues =', I5) 99993 FORMAT (/' The reduced input/state matrix Q''*B is ') 99992 FORMAT (/' The reduced state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99989 FORMAT ( ' Number of infinite blocks = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) 99985 FORMAT ( ' Dimension of the blocks'/20I5) ENDProgram Data
TG01LD EXAMPLE PROGRAM DATA 4 2 2 F N 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 1 0 0 0 0 1 1 1 -1 0 1 0 0 1 -1 1Program Results
TG01LD EXAMPLE PROGRAM RESULTS Order of reduced system = 3 Number of non-dynamic infinite eigenvalues = 1 Number of infinite blocks = 1 The reduced state dynamics matrix Q'*A*Z is 2.4497 -1.3995 0.2397 -4.0023 -0.0680 -0.0030 0.1739 -1.6225 0.3707 0.0161 -0.9482 0.1049 0.0000 0.0000 0.0000 2.2913 The reduced descriptor matrix Q'*E*Z is 9.9139 4.7725 -3.4725 -2.3836 0.0000 -1.2024 2.0137 0.7926 0.0000 0.0000 0.2929 -0.9914 0.0000 0.0000 0.0000 0.0000 The reduced input/state matrix Q'*B is -0.2157 -0.9705 0.3015 0.9516 0.7595 0.0991 1.1339 0.3780 The reduced state/output matrix C*Z is 0.5345 -1.1134 0.3758 0.5774 -1.0690 0.2784 -1.2026 0.5774 The left transformation matrix Q is -0.2157 -0.5088 0.6109 0.5669 -0.1078 -0.2544 -0.7760 0.5669 -0.9705 0.1413 -0.0495 -0.1890 0.0000 0.8102 0.1486 0.5669 The right transformation matrix Z is -0.5345 0.6263 0.4617 -0.3299 -0.8018 -0.5219 -0.2792 -0.0825 0.0000 -0.4871 0.8375 0.2474 -0.2673 0.3132 -0.0859 0.9073
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01LY.html 0000664 0000000 0000000 00000024710 14560147231 0020376 0 ustar 00root root 0000000 0000000
Purpose
To compute orthogonal transformation matrices Q and Z which reduce the regular pole pencil A-lambda*E of the descriptor system (A-lambda*E,B,C), with the A and E matrices in the form ( A11 A12 A13 ) ( E11 0 0 ) A = ( A21 A22 A23 ) , E = ( 0 0 0 ) , (1) ( A31 0 0 ) ( 0 0 0 ) where E11 and A22 are nonsingular and upper triangular matrices, to the form ( Af * ) ( Ef * ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , ( 0 Ai ) ( 0 Ei ) where the subpencil Af-lambda*Ef contains the finite eigenvalues and the subpencil Ai-lambda*Ei contains the infinite eigenvalues. The subpencil Ai-lambda*Ei is in a staircase form with the matrices Ai and Ei of form ( A0,0 A0,k ... A0,1 ) ( 0 E0,k ... E0,1 ) Ai = ( 0 Ak,k ... Ak,1 ) , Ei = ( 0 0 ... Ek,1 ) , (2) ( : : ... : ) ( : : ... : ) ( 0 0 ... A1,1 ) ( 0 0 ... 0 ) where Ai,i, for i = 0, 1, ..., k, are nonsingular upper triangular matrices.Specification
SUBROUTINE TG01LY( COMPQ, COMPZ, N, M, P, RANKE, RNKA22, A, LDA, $ E, LDE, B, LDB, C, LDC, Q, LDQ, Z, LDZ, NF, $ NIBLCK, IBLCK, TOL, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. LOGICAL COMPQ, COMPZ INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDWORK, LDZ, M, $ N, NF, NIBLCK, P, RANKE, RNKA22 DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IBLCK( * ), IWORK(*) DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), $ DWORK( * ), E( LDE, * ), Q( LDQ, * ), $ Z( LDZ, * )Arguments
Mode Parameters
COMPQ LOGICAL Specify the option to accumulate or not the performed left transformations: COMPQ = .FALSE. : do not accumulate the transformations; COMPQ = .TRUE. : accumulate the transformations; in this case, Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. COMPZ LOGICAL Specify the option to accumulate or not the performed right transformations: COMPZ = .FALSE. : do not accumulate the transformations; COMPZ = .TRUE. : accumulate the transformations; in this case, Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.Input/Output Parameters
N (input) INTEGER The number of rows of the matrix B, the number of columns of the matrix C and the order of the square matrices A and E. N >= 0. M (input) INTEGER The number of columns of the matrix B. M >= 0. P (input) INTEGER The number of rows of the matrix C. P >= 0. RANKE (input) INTEGER The rank of the matrix E; also, the order of the upper triangular matrix E11. 0 <= RANKE <= N. RNKA22 (input) DOUBLE PRECISION The order of the nonsingular submatrix A22 of A. 0 <= RNKA22 <= N - RANKE. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the N-by-N state matrix A in the form (1). On exit, the leading N-by-N part of this array contains the transformed state matrix Q'*A*Z, ( Af * ) Q'*A*Z = ( ) , ( 0 Ai ) where Af is NF-by-NF and Ai is (N-NF)-by-(N-NF). The submatrix Ai is in the staircase form (2), where A0,0 is (N-RANKE)-by-(N-RANKE), and Ai,i , for i = 1, ..., NIBLCK is IBLCK(i)-by-IBLCK(i). LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the N-by-N descriptor matrix E in the form (1). On exit, the leading N-by-N part of this array contains the transformed descriptor matrix Q'*E*Z, ( Ef * ) Q'*E*Z = ( ) , ( 0 Ei ) where Ef is an NF-by-NF nonsingular matrix and Ei is an (N-NF)-by-(N-NF) nilpotent matrix in the staircase form (2). LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the N-by-M input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Q'*B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) If COMPQ = .FALSE., Q is not referenced. If COMPQ = .TRUE., on entry, the leading N-by-N part of this array must contain an orthogonal matrix Q1; on exit, the leading N-by-N part of this array contains the orthogonal matrix Q1*Q. LDQ INTEGER The leading dimension of the array Q. LDQ >= 1, if COMPQ = .FALSE.; LDQ >= MAX(1,N), if COMPQ = .TRUE. . Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = .FALSE., Z is not referenced. If COMPZ = .TRUE., on entry, the leading N-by-N part of this array must contain an orthogonal matrix Z1; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z1*Z. LDZ INTEGER The leading dimension of the array Z. LDZ >= 1, if COMPZ = .FALSE.; LDZ >= MAX(1,N), if COMPZ = .TRUE. . NF (output) INTEGER The order of the reduced matrices Af and Ef; also, the number of finite generalized eigenvalues of the pencil A-lambda*E. NIBLCK (output) INTEGER If RANKE < N, the number of infinite blocks minus one. If RANKE = N, NIBLCK = 0. IBLCK (output) INTEGER array, dimension (N) IBLCK(i) contains the dimension of the i-th block in the staircase form (2), where i = 1, 2, ..., NIBLCK.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR factorization with column pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then an implicitly computed, default tolerance, TOLDEF = N**2*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N-RANKE) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, if RANKE = N; otherwise, LDWORK >= MAX(4*(N-RANKE)-1, N-RANKE-RNKA22+MAX(N,M)). For optimal performance, LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the pencil A-lambda*E is not regular.Method
The subroutine is based on the reduction algorithm of [1].References
[1] Misra, P., Van Dooren, P., and Varga, A. Computation of structural invariants of generalized state-space systems. Automatica, 30, pp. 1921-1936, 1994.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
The number of infinite poles is computed as NIBLCK Sum IBLCK(i) = RANKE - NF. i=1 The multiplicities of infinite poles can be computed as follows: there are IBLCK(k)-IBLCK(k+1) infinite poles of multiplicity k, for k = 1, ..., NIBLCK, where IBLCK(NIBLCK+1) = 0. Note that each infinite pole of multiplicity k corresponds to an infinite eigenvalue of multiplicity k+1.Example
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute orthogonal transformation matrices Q and Z which reduce the regular pole pencil A-lambda*E of the descriptor system (A-lambda*E,B,C) to the form (if JOB = 'F') ( Af * ) ( Ef * ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , (1) ( 0 Ai ) ( 0 Ei ) or to the form (if JOB = 'I') ( Ai * ) ( Ei * ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , (2) ( 0 Af ) ( 0 Ef ) where the pair (Af,Ef) is in a generalized real Schur form, with Ef nonsingular and upper triangular and Af in real Schur form. The subpencil Af-lambda*Ef contains the finite eigenvalues. The pair (Ai,Ei) is in a generalized real Schur form with both Ai and Ei upper triangular. The subpencil Ai-lambda*Ei, with Ai nonsingular and Ei nilpotent contains the infinite eigenvalues and is in a block staircase form (see METHOD).Specification
SUBROUTINE TG01MD( JOB, N, M, P, A, LDA, E, LDE, B, LDB, C, LDC, $ ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, NF, ND, $ NIBLCK, IBLCK, TOL, IWORK, DWORK, LDWORK, $ INFO ) C .. Scalar Arguments .. CHARACTER JOB INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDWORK, LDZ, M, $ N, ND, NF, NIBLCK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IBLCK( * ), IWORK(*) DOUBLE PRECISION A(LDA,*), ALPHAI(*), ALPHAR(*), B(LDB,*), $ BETA(*), C(LDC,*), DWORK(*), E(LDE,*), $ Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
JOB CHARACTER*1 = 'F': perform the finite-infinite separation; = 'I': perform the infinite-finite separation.Input/Output Parameters
N (input) INTEGER The number of rows of the matrix B, the number of columns of the matrix C and the order of the square matrices A and E. N >= 0. M (input) INTEGER The number of columns of the matrix B. M >= 0. P (input) INTEGER The number of rows of the matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the N-by-N state matrix A. On exit, the leading N-by-N part of this array contains the transformed state matrix Q'*A*Z in the form ( Af * ) ( Ai * ) ( ) for JOB = 'F', or ( ) for JOB = 'I', ( 0 Ai ) ( 0 Af ) where Af is an NF-by-NF matrix in real Schur form, and Ai is an (N-NF)-by-(N-NF) nonsingular and upper triangular matrix. Ai has a block structure as in (3) or (4), where A0,0 is ND-by-ND and Ai,i , for i = 1, ..., NIBLCK, is IBLCK(i)-by-IBLCK(i). (See METHOD.) LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the N-by-N descriptor matrix E. On exit, the leading N-by-N part of this array contains the transformed descriptor matrix Q'*E*Z in the form ( Ef * ) ( Ei * ) ( ) for JOB = 'F', or ( ) for JOB = 'I', ( 0 Ei ) ( 0 Ef ) where Ef is an NF-by-NF nonsingular and upper triangular matrix, and Ei is an (N-NF)-by-(N-NF) nilpotent matrix in an upper triangular block form as in (3) or (4). LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the N-by-M input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Q'*B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). ALPHAR (output) DOUBLE PRECISION array, dimension (N) ALPHAR(1:NF) will be set to the real parts of the diagonal elements of Af that would result from reducing A and E to the Schur form, and then further reducing both of them to triangular form using unitary transformations, subject to having the diagonal of E positive real. Thus, if Af(j,j) is in a 1-by-1 block (i.e., Af(j+1,j) = Af(j,j+1) = 0), then ALPHAR(j) = Af(j,j). Note that the (real or complex) values (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,NF, are the finite generalized eigenvalues of the matrix pencil A - lambda*E. ALPHAI (output) DOUBLE PRECISION array, dimension (N) ALPHAI(1:NF) will be set to the imaginary parts of the diagonal elements of Af that would result from reducing A and E to Schur form, and then further reducing both of them to triangular form using unitary transformations, subject to having the diagonal of E positive real. Thus, if Af(j,j) is in a 1-by-1 block (see above), then ALPHAI(j) = 0. Note that the (real or complex) values (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,NF, are the finite generalized eigenvalues of the matrix pencil A - lambda*E. BETA (output) DOUBLE PRECISION array, dimension (N) BETA(1:NF) will be set to the (real) diagonal elements of Ef that would result from reducing A and E to Schur form, and then further reducing both of them to triangular form using unitary transformations, subject to having the diagonal of E positive real. Thus, if Af(j,j) is in a 1-by-1 block (see above), then BETA(j) = Ef(j,j). Note that the (real or complex) values (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,NF, are the finite generalized eigenvalues of the matrix pencil A - lambda*E. Q (output) DOUBLE PRECISION array, dimension (LDQ,N) The leading N-by-N part of this array contains the orthogonal matrix Q, which is the accumulated product of the transformations applied to A, E, and B on the left. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). Z (output) DOUBLE PRECISION array, dimension (LDZ,N) The leading N-by-N part of this array contains the orthogonal matrix Z, which is the accumulated product of the transformations applied to A, E, and C on the right. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,N). NF (output) INTEGER The order of the reduced matrices Af and Ef; also, the number of finite generalized eigenvalues of the pencil A-lambda*E. ND (output) INTEGER The number of non-dynamic infinite eigenvalues of the matrix pair (A,E). Note: N-ND is the rank of the matrix E. NIBLCK (output) INTEGER If ND > 0, the number of infinite blocks minus one. If ND = 0, then NIBLCK = 0. IBLCK (output) INTEGER array, dimension (N) IBLCK(i) contains the dimension of the i-th block in the staircase form (3), where i = 1,2,...,NIBLCK.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR factorization with column pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then an implicitly computed, default tolerance TOLDEF = N**2*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, and if N > 0, LDWORK >= 4*N. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the pencil A-lambda*E is not regular; = 2: the QZ iteration did not converge.Method
For the separation of infinite structure, the reduction algorithm of [1] is employed. If JOB = 'F', the matrices Ai and Ei have the form ( A0,0 A0,k ... A0,1 ) ( 0 E0,k ... E0,1 ) Ai = ( 0 Ak,k ... Ak,1 ) , Ei = ( 0 0 ... Ek,1 ) ; (3) ( : : . : ) ( : : . : ) ( 0 0 ... A1,1 ) ( 0 0 ... 0 ) if JOB = 'I' the matrices Ai and Ei have the form ( A1,1 ... A1,k A1,0 ) ( 0 ... E1,k E1,0 ) Ai = ( : . : : ) , Ei = ( : . : : ) , (4) ( : ... Ak,k Ak,0 ) ( : ... 0 Ek,0 ) ( 0 ... 0 A0,0 ) ( 0 ... 0 0 ) where Ai,i, for i = 0, 1, ..., k, are nonsingular upper triangular matrices. A0,0 corresponds to the non-dynamic infinite modes of the system.References
[1] Misra, P., Van Dooren, P., and Varga, A. Computation of structural invariants of generalized state-space systems. Automatica, 30, pp. 1921-1936, 1994.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
The number of infinite poles is computed as NIBLCK NINFP = Sum IBLCK(i) = N - ND - NF. i=1 The multiplicities of infinite poles can be computed as follows: there are IBLCK(k)-IBLCK(k+1) infinite poles of multiplicity k, for k = 1, ..., NIBLCK, where IBLCK(NIBLCK+1) = 0. Note that each infinite pole of multiplicity k corresponds to an infinite eigenvalue of multiplicity k+1.Example
Program Text
* TG01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDE = NMAX, LDQ = NMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 4*NMAX ) * .. Local Scalars .. CHARACTER*1 JOB INTEGER I, INFO, J, M, N, ND, NF, NIBLCK, P DOUBLE PRECISION TOL * .. Local Arrays .. INTEGER IBLCK(NMAX), IWORK(NMAX) DOUBLE PRECISION A(LDA,NMAX), ALPHAI(NMAX), ALPHAR(NMAX), $ B(LDB,MMAX), BETA(NMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,NMAX), $ Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL TG01MD * .. Intrinsic Functions .. INTRINSIC DCMPLX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOB, TOL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the reduced descriptor system * (A-lambda E,B,C). CALL TG01MD( JOB, N, M, P, A, LDA, E, LDE, B, LDB, C, $ LDC, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, $ NF, ND, NIBLCK, IBLCK, TOL, IWORK, DWORK, $ LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) NF, ND WRITE ( NOUT, FMT = 99989 ) NIBLCK + 1 IF ( NIBLCK.GT.0 ) THEN WRITE ( NOUT, FMT = 99985 ) $ ( IBLCK(I), I = 1, NIBLCK ) END IF 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 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,N ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99985 ) DO 70 I = 1, NF WRITE ( NOUT, FMT = 99984 ) $ DCMPLX( ALPHAR(I), ALPHAI(I) )/BETA(I) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01MD = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q''*A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix Q''*E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Order of reduced system =', I5/ $ ' Number of non-dynamic infinite eigenvalues =', I5) 99993 FORMAT (/' The transformed input/state matrix Q''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99989 FORMAT ( ' Number of infinite blocks = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) 99985 FORMAT (/' The finite generalized eigenvalues are '/ $ ' real part imag part ') 99984 FORMAT (1X,F9.4,SP,F9.4,S,'i ') ENDProgram Data
TG01MD EXAMPLE PROGRAM DATA 4 2 2 F 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 1 0 0 0 0 1 1 1 -1 0 1 0 0 1 -1 1Program Results
TG01MD EXAMPLE PROGRAM RESULTS Order of reduced system = 3 Number of non-dynamic infinite eigenvalues = 1 Number of infinite blocks = 1 The transformed state dynamics matrix Q'*A*Z is 1.2803 -2.3613 -0.9025 -3.9982 0.0000 -0.5796 0.8504 0.4350 0.0000 0.0000 0.0000 1.5770 0.0000 0.0000 0.0000 2.2913 The transformed descriptor matrix Q'*E*Z is 9.3142 -4.1463 5.4026 -2.3944 0.0000 0.1594 0.1212 -1.0948 0.0000 0.0000 2.3524 -0.6008 0.0000 0.0000 0.0000 0.0000 The transformed input/state matrix Q'*B is -0.2089 -0.9712 0.6948 -0.0647 -0.4336 -0.9538 1.1339 0.3780 The transformed state/output matrix C*Z is -0.0469 -0.9391 -0.8847 0.5774 -1.0697 0.3620 1.1795 0.5774 The left transformation matrix Q is -0.2089 0.6948 0.3902 0.5669 -0.1148 -0.7163 0.3902 0.5669 -0.9712 -0.0647 -0.1301 -0.1890 0.0000 0.0000 -0.8238 0.5669 The right transformation matrix Z is 0.0469 0.9391 -0.0843 -0.3299 -0.9962 0.0189 -0.0211 -0.0825 0.0000 -0.0000 -0.9689 0.2474 -0.0735 0.3432 0.2317 0.9073 The finite generalized eigenvalues are real part imag part 0.1375 +0.0000i -3.6375 +0.0000i 0.0000 +0.0000i
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01ND.html 0000664 0000000 0000000 00000050303 14560147231 0020350 0 ustar 00root root 0000000 0000000
Purpose
To compute equivalence transformation matrices Q and Z which reduce the regular pole pencil A-lambda*E of the descriptor system (A-lambda*E,B,C) to the form (if JOB = 'F') ( Af 0 ) ( Ef 0 ) Q*A*Z = ( ) , Q*E*Z = ( ) , (1) ( 0 Ai ) ( 0 Ei ) or to the form (if JOB = 'I') ( Ai 0 ) ( Ei 0 ) Q*A*Z = ( ) , Q*E*Z = ( ) , (2) ( 0 Af ) ( 0 Ef ) where the pair (Af,Ef) is in a generalized real Schur form, with Ef nonsingular and upper triangular and Af in real Schur form. The subpencil Af-lambda*Ef contains the finite eigenvalues. The pair (Ai,Ei) is in a generalized real Schur form with both Ai and Ei upper triangular. The subpencil Ai-lambda*Ei, with Ai nonsingular and Ei nilpotent contains the infinite eigenvalues and is in a block staircase form (see METHOD). This decomposition corresponds to an additive decomposition of the transfer-function matrix of the descriptor system as the sum of a proper term and a polynomial term.Specification
SUBROUTINE TG01ND( JOB, JOBT, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, $ NF, ND, NIBLCK, IBLCK, TOL, IWORK, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOB, JOBT INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDWORK, LDZ, M, $ N, ND, NF, NIBLCK, P DOUBLE PRECISION TOL C .. Array Arguments .. INTEGER IBLCK( * ), IWORK(*) DOUBLE PRECISION A(LDA,*), ALPHAR(*), ALPHAI(*), B(LDB,*), $ BETA(*), C(LDC,*), DWORK(*), E(LDE,*), $ Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
JOB CHARACTER*1 = 'F': perform the finite-infinite separation; = 'I': perform the infinite-finite separation. JOBT CHARACTER*1 = 'D': compute the direct transformation matrices; = 'I': compute the inverse transformation matrices inv(Q) and inv(Z).Input/Output Parameters
N (input) INTEGER The number of rows of the matrix B, the number of columns of the matrix C and the order of the square matrices A and E. N >= 0. M (input) INTEGER The number of columns of the matrix B. M >= 0. P (input) INTEGER The number of rows of the matrix C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the N-by-N state matrix A. On exit, the leading N-by-N part of this array contains the transformed state matrix Q*A*Z (if JOBT = 'D') or inv(Q)*A*inv(Z) (if JOBT = 'I') in the form ( Af 0 ) ( Ai 0 ) ( ) for JOB = 'F', or ( ) for JOB = 'I', ( 0 Ai ) ( 0 Af ) where Af is an NF-by-NF matrix in real Schur form, and Ai is an (N-NF)-by-(N-NF) nonsingular and upper triangular matrix. Ai has a block structure as in (3) or (4), where A0,0 is ND-by-ND and Ai,i , for i = 1, ..., NIBLCK, is IBLCK(i)-by-IBLCK(i). (See METHOD.) LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the N-by-N descriptor matrix E. On exit, the leading N-by-N part of this array contains the transformed descriptor matrix Q*E*Z (if JOBT = 'D') or inv(Q)*E*inv(Z) (if JOBT = 'I') in the form ( Ef 0 ) ( Ei 0 ) ( ) for JOB = 'F', or ( ) for JOB = 'I', ( 0 Ei ) ( 0 Ef ) where Ef is an NF-by-NF nonsingular and upper triangular matrix, and Ei is an (N-NF)-by-(N-NF) nilpotent matrix in an upper triangular block form as in (3) or (4). LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the N-by-M input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Q*B (if JOBT = 'D') or inv(Q)*B (if JOBT = 'I'). LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z (if JOBT = 'D') or C*inv(Z) (if JOBT = 'I'). LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). ALPHAR (output) DOUBLE PRECISION array, dimension (N) ALPHAR(1:NF) will be set to the real parts of the diagonal elements of Af that would result from reducing A and E to the Schur form, and then further reducing both of them to triangular form using unitary transformations, subject to having the diagonal of E positive real. Thus, if Af(j,j) is in a 1-by-1 block (i.e., Af(j+1,j) = Af(j,j+1) = 0), then ALPHAR(j) = Af(j,j). Note that the (real or complex) values (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,NF, are the finite generalized eigenvalues of the matrix pencil A - lambda*E. ALPHAI (output) DOUBLE PRECISION array, dimension (N) ALPHAI(1:NF) will be set to the imaginary parts of the diagonal elements of Af that would result from reducing A and E to Schur form, and then further reducing both of them to triangular form using unitary transformations, subject to having the diagonal of E positive real. Thus, if Af(j,j) is in a 1-by-1 block (see above), then ALPHAI(j) = 0. Note that the (real or complex) values (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,NF, are the finite generalized eigenvalues of the matrix pencil A - lambda*E. BETA (output) DOUBLE PRECISION array, dimension (N) BETA(1:NF) will be set to the (real) diagonal elements of Ef that would result from reducing A and E to Schur form, and then further reducing both of them to triangular form using unitary transformations, subject to having the diagonal of E positive real. Thus, if Af(j,j) is in a 1-by-1 block (see above), then BETA(j) = Ef(j,j). Note that the (real or complex) values (ALPHAR(j) + i*ALPHAI(j))/BETA(j), j=1,...,NF, are the finite generalized eigenvalues of the matrix pencil A - lambda*E. Q (output) DOUBLE PRECISION array, dimension (LDQ,N) The leading N-by-N part of this array contains the left transformation matrix Q, if JOBT = 'D', or its inverse inv(Q), if JOBT = 'I'. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). Z (output) DOUBLE PRECISION array, dimension (LDZ,N) The leading N-by-N part of this array contains the right transformation matrix Z, if JOBT = 'D', or its inverse inv(Z), if JOBT = 'I'. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,N). NF (output) INTEGER The order of the reduced matrices Af and Ef; also, the number of finite generalized eigenvalues of the pencil A-lambda*E. ND (output) INTEGER The number of non-dynamic infinite eigenvalues of the matrix pair (A,E). Note: N-ND is the rank of the matrix E. NIBLCK (output) INTEGER If ND > 0, the number of infinite blocks minus one. If ND = 0, then NIBLCK = 0. IBLCK (output) INTEGER array, dimension (N) IBLCK(i) contains the dimension of the i-th block in the staircase form (3), where i = 1,2,...,NIBLCK.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR factorization with column pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then an implicitly computed, default tolerance TOLDEF = N**2*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N+6) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, and if N > 0, LDWORK >= 4*N. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the pencil A-lambda*E is not regular; = 2: the QZ iteration did not converge; = 3: (Af,Ef) and (Ai,Ei) have too close generalized eigenvalues.Method
For the separation of infinite structure, the reduction algorithm of [1] is employed. This separation is achieved by computing orthogonal matrices Q1 and Z1 such that Q1*A*Z1 and Q1*E*Z1 have the form (if JOB = 'F') ( Af Ao ) ( Ef Eo ) Q1*A*Z1 = ( ) , Q1*E*Z1 = ( ) , ( 0 Ai ) ( 0 Ei ) or to the form (if JOB = 'I') ( Ai Ao ) ( Ei Eo ) Q1*A*Z1 = ( ) , Q1*E*Z1 = ( ) . ( 0 Af ) ( 0 Ef ) If JOB = 'F', the matrices Ai and Ei have the form ( A0,0 A0,k ... A0,1 ) ( 0 E0,k ... E0,1 ) Ai = ( 0 Ak,k ... Ak,1 ) , Ei = ( 0 0 ... Ek,1 ) ; (3) ( : : . : ) ( : : . : ) ( 0 0 ... A1,1 ) ( 0 0 ... 0 ) if JOB = 'I' the matrices Ai and Ei have the form ( A1,1 ... A1,k A1,0 ) ( 0 ... E1,k E1,0 ) Ai = ( : . : : ) , Ei = ( : . : : ) , (4) ( : ... Ak,k Ak,0 ) ( : ... 0 Ek,0 ) ( 0 ... 0 A0,0 ) ( 0 ... 0 0 ) where Ai,i, for i = 0, 1, ..., k, are nonsingular upper triangular matrices. A0,0 corresponds to the non-dynamic infinite modes of the system. In a second step, the transformation matrices Q2 and Z2 are determined, of the form ( I -X ) ( I Y ) Q2 = ( ) , Z2 = ( ) ( 0 I ) ( 0 I ) such that with Q = Q2*Q1 and Z = Z1*Z2, Q*A*Z and Q*E*Z are block diagonal as in (1) (if JOB = 'F') or in (2) (if JOB = 'I'). X and Y are computed by solving generalized Sylvester equations. If we partition Q*B and C*Z according to (1) or (2) in the form ( Bf ) and ( Cf Ci ), if JOB = 'F', or ( Bi ) and ( Ci Cf ), if ( Bi ) ( Bf ) JOB = 'I', then (Af-lambda*Ef,Bf,Cf) is the strictly proper part of the original descriptor system and (Ai-lambda*Ei,Bi,Ci) is its polynomial part.References
[1] Misra, P., Van Dooren, P., and Varga, A. Computation of structural invariants of generalized state-space systems. Automatica, 30, pp. 1921-1936, 1994.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
The number of infinite poles is computed as NIBLCK NINFP = Sum IBLCK(i) = N - ND - NF. i=1 The multiplicities of infinite poles can be computed as follows: there are IBLCK(k)-IBLCK(k+1) infinite poles of multiplicity k, for k = 1, ..., NIBLCK, where IBLCK(NIBLCK+1) = 0. Note that each infinite pole of multiplicity k corresponds to an infinite eigenvalue of multiplicity k+1.Example
Program Text
* TG01ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDE = NMAX, LDQ = NMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 4*NMAX ) * .. Local Scalars .. CHARACTER*1 JOB, JOBT INTEGER I, INFO, J, M, N, ND, NF, NIBLCK, P DOUBLE PRECISION TOL * .. Local Arrays .. INTEGER IBLCK(NMAX), IWORK(NMAX+6) DOUBLE PRECISION A(LDA,NMAX), ALPHAI(NMAX), ALPHAR(NMAX), $ B(LDB,MMAX), BETA(NMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,NMAX), $ Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL TG01ND * .. Intrinsic Functions .. INTRINSIC DCMPLX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, JOB, JOBT, TOL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the reduced descriptor system * (A-lambda E,B,C). CALL TG01ND( JOB, JOBT, N, M, P, A, LDA, E, LDE, B, LDB, $ C, LDC, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, $ LDZ, NF, ND, NIBLCK, IBLCK, TOL, IWORK, $ DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) NF, ND WRITE ( NOUT, FMT = 99989 ) NIBLCK + 1 IF ( NIBLCK.GT.0 ) THEN WRITE ( NOUT, FMT = 99985 ) $ ( IBLCK(I), I = 1, NIBLCK ) END IF 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 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,N ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99985 ) DO 70 I = 1, NF WRITE ( NOUT, FMT = 99984 ) $ DCMPLX( ALPHAR(I), ALPHAI(I) )/BETA(I) 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01ND EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01ND = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q*A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix Q*E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Order of reduced system =', I5/ $ ' Number of non-dynamic infinite eigenvalues =', I5) 99993 FORMAT (/' The transformed input/state matrix Q*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99989 FORMAT ( ' Number of infinite blocks = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) 99985 FORMAT (/' The finite generalized eigenvalues are '/ $ ' real part imag part ') 99984 FORMAT (1X,F9.4,SP,F9.4,S,'i ') ENDProgram Data
TG01ND EXAMPLE PROGRAM DATA 4 2 2 F D 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 1 0 0 0 0 1 1 1 -1 0 1 0 0 1 -1 1Program Results
TG01ND EXAMPLE PROGRAM RESULTS Order of reduced system = 3 Number of non-dynamic infinite eigenvalues = 1 Number of infinite blocks = 1 The transformed state dynamics matrix Q*A*Z is 1.2803 -2.3613 -0.9025 0.0000 0.0000 -0.5796 0.8504 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 2.2913 The transformed descriptor matrix Q*E*Z is 9.3142 -4.1463 5.4026 0.0000 0.0000 0.1594 0.1212 0.0000 0.0000 0.0000 2.3524 0.0000 0.0000 0.0000 0.0000 0.0000 The transformed input/state matrix Q*B is 7.7328 1.6760 2.2870 0.4660 -1.2140 -1.2140 1.1339 0.3780 The transformed state/output matrix C*Z is -0.0469 -0.9391 -0.8847 -6.0622 -1.0697 0.3620 1.1795 -0.0000 The left transformation matrix Q is 3.7620 3.8560 -2.2948 3.9708 1.4909 0.0798 -0.3301 0.7961 -0.0000 -0.0000 0.0000 -1.2140 0.5669 0.5669 -0.1890 0.5669 The right transformation matrix Z is 0.0469 0.9391 -0.0843 6.0622 -0.9962 0.0189 -0.0211 -3.0311 0.0000 -0.0000 -0.9689 -0.0000 -0.0735 0.3432 0.2317 3.0311 The finite generalized eigenvalues are real part imag part 0.1375 +0.0000i -3.6375 +0.0000i 0.0000 +0.0000i
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01NX.html 0000664 0000000 0000000 00000016721 14560147231 0020402 0 ustar 00root root 0000000 0000000
Purpose
To compute equivalence transformation matrices Q and Z which reduce the regular pole pencil A-lambda*E of the descriptor system (A-lambda*E,B,C), with (A,E) in a generalized real Schur form, to the block-diagonal form ( A1 0 ) ( E1 0 ) Q*A*Z = ( ) , Q*E*Z = ( ) , (1) ( 0 A2 ) ( 0 E2 ) where the pair (Q*A*Z,Q*E*Z) is in a generalized real Schur form, with (A1,E1) and (A2,E2) having no common generalized eigenvalues. This decomposition corresponds to an additive spectral decomposition of the transfer-function matrix of the descriptor system as the sum of two terms containing the generalized eigenvalues of (A1,E1) and (A2,E2), respectively.Specification
SUBROUTINE TG01NX( JOBT, N, M, P, NDIM, A, LDA, E, LDE, B, LDB, $ C, LDC, Q, LDQ, Z, LDZ, IWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBT INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDZ, M, N, NDIM, $ P C .. Array Arguments .. INTEGER IWORK(*) DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), E(LDE,*), $ Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
JOBT CHARACTER*1 = 'D': compute the direct transformation matrices; = 'I': compute the inverse transformation matrices inv(Q) and inv(Z).Input/Output Parameters
N (input) INTEGER The number of rows of the matrix B, the number of columns of the matrix C and the order of the square matrices A and E. N >= 0. M (input) INTEGER The number of columns of the matrix B. M >= 0. P (input) INTEGER The number of rows of the matrix C. P >= 0. NDIM (input) INTEGER The dimension of the leading diagonal blocks of (A,E) having generalized eigenvalues distinct from those of the trailing diagonal block. 0 <= NDIM <= N. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the N-by-N state matrix A in a real Schur form. On exit, the leading N-by-N part of this array contains the transformed state matrix Q*A*Z (if JOBT = 'D') or inv(Q)*A*inv(Z) (if JOBT = 'I'), in the form (1), where A1 is a NDIM-by-NDIM matrix. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the N-by-N descriptor matrix E in upper triangular form. On exit, the leading N-by-N part of this array contains the transformed descriptor matrix Q*E*Z (if JOBT = 'D') or inv(Q)*E*inv(Z) (if JOBT = 'I'), in the form (1), where E1 is an NDIM-by-NDIM matrix. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the N-by-M input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Q*B (if JOBT = 'D') or inv(Q)*B (if JOBT = 'I'). LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the state/output matrix C. On exit, the leading P-by-N part of this array contains the transformed matrix C*Z (if JOBT = 'D') or C*inv(Z) (if JOBT = 'I'). LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) On entry, the leading N-by-N part of this array contains Q1, the orthogonal left transformation matrix Q used to reduce the pair (A,E) to the generalized real Schur form. On exit, the leading N-by-N part of this array contains the left transformation matrix Q = Q2*Q1, if JOBT = 'D', or its inverse inv(Q), if JOBT = 'I'. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) On entry, the leading N-by-N part of this array contains the orthogonal right transformation matrix Z1 used to reduce the pair (A,E) to the generalized real Schur form. On exit, the leading N-by-N part of this array contains the right transformation matrix Z = Z1*Z2, if JOBT = 'D', or its inverse inv(Z), if JOBT = 'I'. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,N).Workspace
IWORK INTEGER array, dimension (N+6)Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the separation of the two diagonal blocks failed because of very close eigenvalues.Method
For the separation, transformation matrices Q2 and Z2 of the form ( I -X ) ( I Y ) Q2 = ( ) , Z2 = ( ) ( 0 I ) ( 0 I ) are determined, such that Q2*A*Z2 and Q2*E*Z2 are block diagonal as in (1). X and Y are computed by solving generalized Sylvester equations. If we partition Q2*B and C*Z2 according to (1) in the form ( B1 ) ( B2 ) and ( C1 C2 ), then (A1-lambda*E1,B1,C1) and (A2-lambda*E2,B2,C2) represent an additive spectral decomposition of the system transfer-function matrix.References
[1] Kagstrom, B. and Van Dooren, P. Additive decomposition of a transfer function with respect to a specified region. Proc. MTNS Symp., Brussels, 1989.Numerical Aspects
The algorithm is numerically backward stable and requires 0( N**3 ) floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute for a single-input single-output descriptor system, given by the system matrix [ D C ] [ B A - s*E ], with E upper triangular, a transformed system, (Q'*A*Z, Q'*E*Z, Q'*B, C*Z), via an orthogonal equivalence transformation, so that Q'*B has only the first element nonzero and Q'*E*Z remains upper triangular.Specification
SUBROUTINE TG01OA( JOBE, N, DCBA, LDDCBA, E, LDE, INFO ) C .. Scalar Arguments .. CHARACTER JOBE INTEGER INFO, LDDCBA, LDE, N C .. Array Arguments .. DOUBLE PRECISION DCBA(LDDCBA,*), E(LDE,*)Arguments
Mode Parameters
JOBE CHARACTER*1 Specifies whether E is an upper triangular or an identity matrix, as follows: = 'U': The matrix E is an upper triangular matrix; = 'I': The matrix E is assumed identity and is not given.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. DCBA (input/output) DOUBLE PRECISION array, dimension (LDDCBA,N+1) On entry, the leading (N+1)-by-(N+1) part of this array must contain the original system matrices A, B, C, and D, stored as follows [ D C ] [ B A ]. On exit, the leading (N+1)-by-(N+1) part of this array contains the transformed matrices C*Z, Q'*B, and Q'*A*Z, replacing C, B, and A. The scalar D is unchanged. LDDCBA INTEGER The leading dimension of the array DCBA. LDDCBA >= N+1. E (input/output) DOUBLE PRECISION array, dimension (LDE,*) On entry, if JOBE = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the descriptor matrix E. The lower triangular part under the first subdiagonal is not referenced. On exit, if JOBE = 'U', the leading N-by-N upper triangular part of this array contains the upper triangular part of the transformed descriptor matrix, Q'*E*Z. If JOBE = 'I', this array is not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'U'; LDE >= 1, if JOBE = 'I'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Givens rotations are used to annihilate the last N-1 elements of B in reverse order, but preserve the form of E.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute for a single-input single-output descriptor system, given by the system matrix [ D C ] [ B A - s*E ], with E upper triangular, a transformed system, (Q'*A*Z, Q'*E*Z, Q'*B, C*Z), via an orthogonal equivalence transformation, so that Q'*B has only the first element nonzero and Q'*E*Z remains upper triangular. The matrices have complex elements.Specification
SUBROUTINE TG01OB( JOBE, N, DCBA, LDDCBA, E, LDE, INFO ) C .. Scalar Arguments .. CHARACTER JOBE INTEGER INFO, LDDCBA, LDE, N C .. Array Arguments .. COMPLEX*16 DCBA(LDDCBA,*), E(LDE,*)Arguments
Mode Parameters
JOBE CHARACTER*1 Specifies whether E is an upper triangular or an identity matrix, as follows: = 'U': The matrix E is an upper triangular matrix; = 'I': The matrix E is assumed identity and is not given.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. DCBA (input/output) COMPLEX*16 array, dimension (LDDCBA,N+1) On entry, the leading (N+1)-by-(N+1) part of this array must contain the original system matrices A, B, C, and D, stored as follows [ D C ] [ B A ]. On exit, the leading (N+1)-by-(N+1) part of this array contains the transformed matrices C*Z, Q'*B, and Q'*A*Z, replacing C, B, and A. The scalar D is unchanged. LDDCBA INTEGER The leading dimension of the array DCBA. LDDCBA >= N+1. E (input/output) COMPLEX*16 array, dimension (LDE,*) On entry, if JOBE = 'U', the leading N-by-N upper triangular part of this array must contain the upper triangular part of the descriptor matrix E. The lower triangular part under the first subdiagonal is not referenced. On exit, if JOBE = 'U', the leading N-by-N upper triangular part of this array contains the upper triangular part of the transformed descriptor matrix, Q'*E*Z. If JOBE = 'I', this array is not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'U'; LDE >= 1, if JOBE = 'I'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Givens rotations are used to annihilate the last N-1 elements of B in reverse order, but preserve the form of E.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Purpose
To compute for a single-input single-output descriptor system, given by the system matrix [ D C ] [ B A - s*E ], with E nonsingular, a reduced system matrix, [ d c ] [ b a - s*e ], such that d has a "sufficiently" large magnitude.Specification
SUBROUTINE TG01OD( JOBE, N, DCBA, LDDCBA, E, LDE, NZ, G, TOL, $ DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBE INTEGER INFO, LDDCBA, LDWORK, LDE, N, NZ DOUBLE PRECISION G, TOL C .. Array Arguments .. DOUBLE PRECISION DCBA(LDDCBA,*), DWORK(*), E(LDE,*)Arguments
Mode Parameters
JOBE CHARACTER*1 Specifies whether E is a general or an identity matrix, as follows: = 'G': The matrix E is a general matrix; = 'I': The matrix E is assumed identity and is not given.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. DCBA (input/output) DOUBLE PRECISION array, dimension (LDDCBA,N+1) On entry, the leading (N+1)-by-(N+1) part of this array must contain the original system matrices A, B, C, and D, stored as follows [ D C ] [ B A ]. On exit, the leading (NZ+1)-by-(NZ+1) part of this array contains the reduced system matrices a, b, c, and d. LDDCBA INTEGER The leading dimension of the array DCBA. LDDCBA >= N+1. E (input/output) DOUBLE PRECISION array, dimension (LDE,*) On entry, if JOBE = 'G', the leading N-by-N part of this array must contain the nonsingular descriptor matrix E. On exit, if JOBE = 'G', the leading NZ-by-NZ part of this array contains the reduced descriptor matrix e. If JOBE = 'I', this array is not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'G'; LDE >= 1, if JOBE = 'I'. NZ (output) INTEGER The order of the reduced system. G (output) DOUBLE PRECISION The gain of the reduced system.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining if the transformed d has a "sufficiently" large magnitude. If the user sets TOL > 0, then the given value of TOL is used. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = EPS**(3/4), is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. On exit, if INFO = -11, DWORK(1) returns the minimum value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 2*N+1, if JOBE = 'G'; LDWORK >= N+1, if JOBE = 'I'. For good performance when JOBE = 'G', LDWORK should be larger. Specifically, LDWORK >= MAX( N*NB(DGEQRF), (N+1)*NB(DORMQR) ), where NB(X) is the optimal block sizes for the LAPACK Library routine X. 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Householder transformations and Givens rotations are used to process the matrices. If E is a general matrix, it is first triangularized using the QR decomposition, and the triangular form is preserved during the remaining computations.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01OZ.html 0000664 0000000 0000000 00000012701 14560147231 0020377 0 ustar 00root root 0000000 0000000
Purpose
To compute for a single-input single-output descriptor system, given by the system matrix with complex elements [ D C ] [ B A - s*E ], with E nonsingular, a reduced system matrix, [ d c ] [ b a - s*e ], such that d has a "sufficiently" large magnitude.Specification
SUBROUTINE TG01OZ( JOBE, N, DCBA, LDDCBA, E, LDE, NZ, G, TOL, $ ZWORK, LZWORK, INFO ) C .. Scalar Arguments .. CHARACTER JOBE INTEGER INFO, LDDCBA, LDE, LZWORK, N, NZ DOUBLE PRECISION TOL COMPLEX*16 G C .. Array Arguments .. COMPLEX*16 DCBA(LDDCBA,*), E(LDE,*), ZWORK(*)Arguments
Mode Parameters
JOBE CHARACTER*1 Specifies whether E is a general or an identity matrix, as follows: = 'G': The matrix E is a general matrix; = 'I': The matrix E is assumed identity and is not given.Input/Output Parameters
N (input) INTEGER The dimension of the descriptor state vector; also the order of square matrices A and E, the number of rows of matrix B, and the number of columns of matrix C. N >= 0. DCBA (input/output) COMPLEX*16 array, dimension (LDDCBA,N+1) On entry, the leading (N+1)-by-(N+1) part of this array must contain the original system matrices A, B, C, and D, stored as follows [ D C ] [ B A ]. On exit, the leading (NZ+1)-by-(NZ+1) part of this array contains the reduced system matrices a, b, c, and d. LDDCBA INTEGER The leading dimension of the array DCBA. LDDCBA >= N+1. E (input/output) COMPLEX*16 array, dimension (LDE,*) On entry, if JOBE = 'G', the leading N-by-N part of this array must contain the nonsingular descriptor matrix E. On exit, if JOBE = 'G', the leading NZ-by-NZ part of this array contains the reduced descriptor matrix e. If JOBE = 'I', this array is not referenced. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N), if JOBE = 'G'; LDE >= 1, if JOBE = 'I'. NZ (output) INTEGER The order of the reduced system. G (output) COMPLEX*16 The gain of the reduced system.Tolerances
TOL DOUBLE PRECISION The tolerance to be used in determining if the transformed d has a "sufficiently" large magnitude. If the user sets TOL > 0, then the given value of TOL is used. If the user sets TOL <= 0, then an implicitly computed, default tolerance, defined by TOLDEF = EPS**(3/4), is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH).Workspace
ZWORK COMPLEX*16 array, dimension (LZWORK) On exit, if INFO = 0, ZWORK(1) returns the optimal value of LZWORK. On exit, if INFO = -11, ZWORK(1) returns the minimum value of LZWORK. LZWORK INTEGER The length of the array ZWORK. LZWORK >= 2*N+1, if JOBE = 'G'; LZWORK >= N+1, if JOBE = 'I'. For good performance when JOBE = 'G', LZWORK should be larger. Specifically, LZWORK >= MAX( N*NB(ZGEQRF), (N+1)*NB(ZUNMQR) ), where NB(X) is the optimal block sizes for the LAPACK Library routine X. If LZWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the ZWORK array, returns this value as the first entry of the ZWORK array, and no error message related to LZWORK is issued by XERBLA.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
Householder transformations and Givens rotations are used to process the matrices. If E is a general matrix, it is first triangularized using the QR decomposition, and the triangular form is preserved during the remaining computations.Numerical Aspects
The algorithm is numerically backward stable.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01PD.html 0000664 0000000 0000000 00000047112 14560147231 0020356 0 ustar 00root root 0000000 0000000
Purpose
To compute orthogonal transformation matrices Q and Z which reduce the regular pole pencil A-lambda*E of the descriptor system (A-lambda*E,B,C) to the generalized real Schur form with ordered generalized eigenvalues. The pair (A,E) is reduced to the form ( * * * * ) ( * * * * ) ( ) ( ) ( 0 A1 * * ) ( 0 E1 * * ) Q'*A*Z = ( ) , Q'*E*Z = ( ) , ( 0 0 A2 * ) ( 0 0 E2 * ) ( ) ( ) ( 0 0 0 * ) ( 0 0 0 * ) where the subpencil A1-lambda*E1 contains the eigenvalues which belong to a suitably defined domain of interest and the subpencil A2-lambda*E2 contains the eigenvalues which are outside of the domain of interest. If JOBAE = 'S', the pair (A,E) is assumed to be already in a generalized real Schur form and the reduction is performed only on the subpencil A12 - lambda*E12 defined by rows and columns NLOW to NSUP of A - lambda*E.Specification
SUBROUTINE TG01PD( DICO, STDOM, JOBAE, COMPQ, COMPZ, N, M, P, $ NLOW, NSUP, ALPHA, A, LDA, E, LDE, B, LDB, $ C, LDC, Q, LDQ, Z, LDZ, NDIM, ALPHAR, ALPHAI, $ BETA, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER COMPQ, COMPZ, DICO, JOBAE, STDOM INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDWORK, LDZ, M, N, $ NDIM, NLOW, NSUP, P DOUBLE PRECISION ALPHA C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), ALPHAI(*), ALPHAR(*), B(LDB,*), $ BETA(*), C(LDC,*), DWORK(*), E(LDE,*), $ Q(LDQ,*), Z(LDZ,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the descriptor system as follows: = 'C': continuous-time system; = 'D': discrete-time system. STDOM CHARACTER*1 Specifies whether the domain of interest is of stability type (left part of complex plane or inside of a circle) or of instability type (right part of complex plane or outside of a circle) as follows: = 'S': stability type domain; = 'U': instability type domain. JOBAE CHARACTER*1 Specifies the shape of the matrix pair (A,E) on entry as follows: = 'S': (A,E) is in a generalized real Schur form; = 'G': A and E are general square dense matrices. COMPQ CHARACTER*1 = 'I': Q is initialized to the unit matrix, and the orthogonal matrix Q is returned; = 'U': Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned. This option can not be used when JOBAE = 'G'. COMPZ CHARACTER*1 = 'I': Z is initialized to the unit matrix, and the orthogonal matrix Z is returned; = 'U': Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned. This option can not be used when JOBAE = 'G'.Input/Output Parameters
N (input) INTEGER The number of rows of the matrix B, the number of columns of the matrix C, and the order of the square matrices A and E. N >= 0. M (input) INTEGER The number of columns of the matrix B. M >= 0. P (input) INTEGER The number of rows of the matrix C. P >= 0. NLOW, (input) INTEGER NSUP (input) INTEGER NLOW and NSUP specify the boundary indices for the rows and columns of the principal subpencil of A - lambda*E whose diagonal blocks are to be reordered. 0 <= NLOW <= NSUP <= N, if JOBAE = 'S'. NLOW = MIN( 1, N ), NSUP = N, if JOBAE = 'G'. ALPHA (input) DOUBLE PRECISION The boundary of the domain of interest for the generalized eigenvalues of the pair (A,E). For a continuous-time system (DICO = 'C'), ALPHA is the boundary value for the real parts of the generalized eigenvalues, while for a discrete-time system (DICO = 'D'), ALPHA >= 0 represents the boundary value for the moduli of the generalized eigenvalues. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. If JOBAE = 'S' then A must be a matrix in real Schur form. On exit, the leading N-by-N part of this array contains the matrix Q'*A*Z in real Schur form, with the elements below the first subdiagonal set to zero. The leading NDIM-by-NDIM part of the principal subpencil A12 - lambda*E12, defined by A12 := A(NLOW:NSUP,NLOW:NSUP) and E12 := E(NLOW:NSUP,NLOW:NSUP), has generalized eigenvalues in the domain of interest, and the trailing part of this subpencil has generalized eigenvalues outside the domain of interest. The domain of interest for eig(A12,E12), the generalized eigenvalues of the pair (A12,E12), is defined by the parameters ALPHA, DICO and STDOM as follows: For DICO = 'C': Real(eig(A12,E12)) < ALPHA if STDOM = 'S'; Real(eig(A12,E12)) > ALPHA if STDOM = 'U'. For DICO = 'D': Abs(eig(A12,E12)) < ALPHA if STDOM = 'S'; Abs(eig(A12,E12)) > ALPHA if STDOM = 'U'. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the descriptor matrix E. If JOBAE = 'S', then E must be an upper triangular matrix. On exit, the leading N-by-N part of this array contains an upper triangular matrix Q'*E*Z, with the elements below the diagonal set to zero. The leading NDIM-by-NDIM part of the principal subpencil A12 - lambda*E12 (see description of A) has generalized eigenvalues in the domain of interest, and the trailing part of this subpencil has generalized eigenvalues outside the domain of interest. LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Q'*B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix C*Z. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) If COMPQ = 'I': on entry, Q need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Q, where Q' is the product of orthogonal transformations which are applied to A, E, and B on the left. If COMPQ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Q1; on exit, the leading N-by-N part of this array contains the orthogonal matrix Q1*Q. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) If COMPZ = 'I': on entry, Z need not be set; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z, which is the product of orthogonal transformations applied to A, E, and C on the right. If COMPZ = 'U': on entry, the leading N-by-N part of this array must contain an orthogonal matrix Z1; on exit, the leading N-by-N part of this array contains the orthogonal matrix Z1*Z. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,N). NDIM (output) INTEGER The number of generalized eigenvalues of the principal subpencil A12 - lambda*E12 (see description of A) lying inside the domain of interest for eigenvalues. ALPHAR (output) DOUBLE PRECISION array, dimension (N) ALPHAI (output) DOUBLE PRECISION array, dimension (N) BETA (output) DOUBLE PRECISION array, dimension (N) On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, are the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i, and BETA(j), j = 1,...,N, are the diagonals of the complex Schur form (S,T) that would result if the 2-by-2 diagonal blocks of the real Schur form of (A,B) were further reduced to triangular form using 2-by-2 complex unitary transformations. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 8*N+16, if JOBAE = 'G'; LDWORK >= 4*N+16, if JOBAE = 'S'. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the QZ algorithm failed to compute all generalized eigenvalues of the pair (A,E); = 2: a failure occured during the ordering of the generalized real Schur form of the pair (A,E).Method
If JOBAE = 'G', the pair (A,E) is reduced to an ordered generalized real Schur form using an orthogonal equivalence transformation A <-- Q'*A*Z and E <-- Q'*E*Z. This transformation is determined so that the leading diagonal blocks of the resulting pair (A,E) have generalized eigenvalues in a suitably defined domain of interest. Then, the transformations are applied to the matrices B and C: B <-- Q'*B and C <-- C*Z. If JOBAE = 'S', then the diagonal blocks of the subpencil A12 - lambda*E12, defined by A12 := A(NLOW:NSUP,NLOW:NSUP) and E12 := E(NLOW:NSUP,NLOW:NSUP), are reordered using orthogonal equivalence transformations, such that the leading blocks have generalized eigenvalues in a suitably defined domain of interest.Numerical Aspects
3 The algorithm requires about 25N floating point operations.Further Comments
NoneExample
Program Text
* TG01PD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDE = NMAX, LDQ = NMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 8*NMAX+16 ) * .. Local Scalars .. CHARACTER*1 COMPQ, COMPZ, DICO, JOBAE, STDOM INTEGER I, INFO, J, M, N, NDIM, NLOW, NSUP, P DOUBLE PRECISION ALPHA, TOL * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX), ALPHAI(NMAX), ALPHAR(NMAX), $ B(LDB,MMAX), BETA(NMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,NMAX), $ Z(LDZ,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TG01PD * .. Intrinsic Functions .. INTRINSIC DCMPLX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, DICO, STDOM, JOBAE, COMPQ, COMPZ, $ NLOW, NSUP, ALPHA, TOL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) IF ( LSAME( COMPQ, 'U' ) ) $ READ ( NIN, FMT = * ) ( ( Q(I,J), J = 1,N ), I = 1,N ) IF ( LSAME( COMPZ, 'U' ) ) $ READ ( NIN, FMT = * ) ( ( Z(I,J), J = 1,N ), I = 1,N ) * Find the reduced descriptor system * (A-lambda E,B,C). CALL TG01PD( DICO, STDOM, JOBAE, COMPQ, COMPZ, N, M, P, $ NLOW, NSUP, ALPHA, A, LDA, E, LDE, B, LDB, $ C, LDC, Q, LDQ, Z, LDZ, NDIM, ALPHAR, $ ALPHAI, BETA, DWORK, LDWORK, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) NDIM 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 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,N ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99985 ) DO 70 I = 1, N IF ( BETA(I).EQ.ZERO .OR. ALPHAI(I).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99984 ) $ ALPHAR(I)/BETA(I) ELSE WRITE ( NOUT, FMT = 99984 ) $ DCMPLX( ALPHAR(I), ALPHAI(I) )/BETA(I) END IF 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01PD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01PD = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q''*A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix Q''*E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Number of eigenvalues in the domain =', I5) 99993 FORMAT (/' The transformed input/state matrix Q''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) 99985 FORMAT (/' The finite generalized eigenvalues are '/ $ ' real part imag part ') 99984 FORMAT (1X,F9.4,SP,F9.4,S,'i ') ENDProgram Data
TG01PD EXAMPLE PROGRAM DATA 4 2 2 C S G I I 1 4 -1.E-7 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 1 0 0 0 0 1 1 1 -1 0 1 0 0 1 -1 1Program Results
TG01PD EXAMPLE PROGRAM RESULTS Number of eigenvalues in the domain = 1 The transformed state dynamics matrix Q'*A*Z is -1.6311 2.1641 -3.6829 -0.3369 0.0000 0.4550 -1.9033 0.6425 0.0000 0.0000 2.6950 0.6882 0.0000 0.0000 0.0000 0.0000 The transformed descriptor matrix Q'*E*Z is 0.4484 9.6340 -1.2601 -5.6475 0.0000 3.3099 0.6641 -1.4869 0.0000 0.0000 0.0000 -1.3765 0.0000 0.0000 0.0000 2.0000 The transformed input/state matrix Q'*B is 0.0232 -0.9413 -0.7251 -0.2478 0.6882 -0.2294 1.0000 1.0000 The transformed state/output matrix C*Z is -0.8621 0.3754 0.3405 1.0000 -0.1511 -1.1192 0.8513 -1.0000 The left transformation matrix Q is 0.0232 -0.7251 0.6882 0.0000 -0.3369 0.6425 0.6882 0.0000 -0.9413 -0.2478 -0.2294 0.0000 0.0000 0.0000 0.0000 1.0000 The right transformation matrix Z is 0.8621 -0.3754 -0.3405 0.0000 -0.4258 -0.9008 -0.0851 0.0000 0.0000 0.0000 0.0000 1.0000 0.2748 -0.2184 0.9364 0.0000 The finite generalized eigenvalues are real part imag part -3.6375 0.1375 Infinity 0.0000
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01QD.html 0000664 0000000 0000000 00000050325 14560147231 0020357 0 ustar 00root root 0000000 0000000
Purpose
To compute orthogonal transformation matrices Q and Z which reduce the regular pole pencil A-lambda*E of the descriptor system (A-lambda*E,B,C) to the generalized real Schur form with ordered generalized eigenvalues. The pair (A,E) is reduced to the form ( A1 * * ) ( E1 * * ) Q'*A*Z = ( 0 A2 * ) , Q'*E*Z = ( 0 E2 * ) , (1) ( 0 0 A3 ) ( 0 0 E2 ) where the subpencils Ak-lambda*Ek, for k = 1, 2, 3, contain the generalized eigenvalues which belong to certain domains of interest.Specification
SUBROUTINE TG01QD( DICO, STDOM, JOBFI, N, M, P, ALPHA, A, LDA, $ E, LDE, B, LDB, C, LDC, N1, N2, N3, ND, NIBLCK, $ IBLCK, Q, LDQ, Z, LDZ, ALPHAR, ALPHAI, BETA, $ TOL, IWORK, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER DICO, JOBFI, STDOM INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDWORK, LDZ, M, N, $ N1, N2, N3, ND, NIBLCK, P DOUBLE PRECISION ALPHA, TOL C .. Array Arguments .. INTEGER IBLCK( * ), IWORK(*) DOUBLE PRECISION A(LDA,*), ALPHAI(*), ALPHAR(*), B(LDB,*), $ BETA(*), C(LDC,*), DWORK(*), E(LDE,*), Q(LDQ,*), $ Z(LDZ,*)Arguments
Mode Parameters
DICO CHARACTER*1 Specifies the type of the descriptor system as follows: = 'C': continuous-time system; = 'D': discrete-time system. STDOM CHARACTER*1 Specifies the type of the domain of interest for the generalized eigenvalues, as follows: = 'S': stability type domain (i.e., left part of complex plane or inside of a circle); = 'U': instability type domain (i.e., right part of complex plane or outside of a circle); = 'N': whole complex domain, excepting infinity. JOBFI CHARACTER*1 Specifies the type of generalized eigenvalues in the leading diagonal block(s) as follows: = 'F': finite generalized eigenvalues are in the leading diagonal blocks (Af,Ef), and the resulting transformed pair has the form ( Af * ) ( Ef * ) Q'*A*Z = ( ) , Q'*E*Z = ( ) ; ( 0 Ai ) ( 0 Ei ) = 'I': infinite generalized eigenvalues are in the leading diagonal blocks (Ai,Ei), and the resulting transformed pair has the form ( Ai * ) ( Ei * ) Q'*A*Z = ( ) , Q'*E*Z = ( ) . ( 0 Af ) ( 0 Ef )Input/Output Parameters
N (input) INTEGER The number of rows of the matrix B, the number of columns of the matrix C and the order of the square matrices A and E. N >= 0. M (input) INTEGER The number of columns of the matrix B. M >= 0. P (input) INTEGER The number of rows of the matrix C. P >= 0. ALPHA (input) DOUBLE PRECISION The boundary of the domain of interest for the finite generalized eigenvalues of the pair (A,E). For a continuous-time system (DICO = 'C'), ALPHA is the boundary value for the real parts of the generalized eigenvalues, while for a discrete-time system (DICO = 'D'), ALPHA >= 0 represents the boundary value for the moduli of the generalized eigenvalues. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the state dynamics matrix A. On exit, the leading N-by-N part of this array contains the matrix Q'*A*Z in real Schur form, with the elements below the first subdiagonal set to zero. If JOBFI = 'I', the N1-by-N1 pair (A1,E1) contains the infinite spectrum, the N2-by-N2 pair (A2,E2) contains the finite spectrum in the domain of interest, and the N3-by-N3 pair (A3,E3) contains the finite spectrum ouside of the domain of interest. If JOBFI = 'F', the N1-by-N1 pair (A1,E1) contains the finite spectrum in the domain of interest, the N2-by-N2 pair (A2,E2) contains the finite spectrum ouside of the domain of interest, and the N3-by-N3 pair (A3,E3) contains the infinite spectrum. Ai has a block structure as in (2), where A0,0 is ND-by-ND and Ai,i is IBLCK(i)-by-IBLCK(i), for i = 1, ..., NIBLCK. The domain of interest for the pair (Af,Ef), containing the finite generalized eigenvalues, is defined by the parameters ALPHA, DICO and STDOM as follows: For DICO = 'C': Real(eig(Af,Ef)) < ALPHA if STDOM = 'S'; Real(eig(Af,Ef)) > ALPHA if STDOM = 'U'. For DICO = 'D': Abs(eig(Af,Ef)) < ALPHA if STDOM = 'S'; Abs(eig(Af,Ef)) > ALPHA if STDOM = 'U'. LDA INTEGER The leading dimension of the array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the descriptor matrix E. On exit, the leading N-by-N part of this array contains the matrix Q'*E*Z in upper triangular form, with the elements below the diagonal set to zero. Its structure corresponds to the block structure of the matrix Q'*A*Z (see description of A). LDE INTEGER The leading dimension of the array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Q'*B. LDB INTEGER The leading dimension of the array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix C*Z. LDC INTEGER The leading dimension of the array C. LDC >= MAX(1,P). N1 (output) INTEGER N2 (output) INTEGER N3 (output) INTEGER The number of the generalized eigenvalues of the pairs (A1,E1), (A2,E2) and (A3,E3), respectively. ND (output) INTEGER. The number of non-dynamic infinite eigenvalues of the pair (A,E). Note: N-ND is the rank of the matrix E. NIBLCK (output) INTEGER If ND > 0, the number of infinite blocks minus one. If ND = 0, then NIBLCK = 0. IBLCK (output) INTEGER array, dimension (N) IBLCK(i) contains the dimension of the i-th block in the staircase form (2), where i = 1,2,...,NIBLCK. Q (output) DOUBLE PRECISION array, dimension (LDQ,N) The leading N-by-N part of this array contains the orthogonal matrix Q, where Q' is the product of orthogonal transformations applied to A, E, and B on the left. LDQ INTEGER The leading dimension of the array Q. LDQ >= MAX(1,N). Z (output) DOUBLE PRECISION array, dimension (LDZ,N) The leading N-by-N part of this array contains the orthogonal matrix Z, which is the product of orthogonal transformations applied to A, E, and C on the right. LDZ INTEGER The leading dimension of the array Z. LDZ >= MAX(1,N). ALPHAR (output) DOUBLE PRECISION array, dimension (N) ALPHAI (output) DOUBLE PRECISION array, dimension (N) BETA (output) DOUBLE PRECISION array, dimension (N) On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j = 1, ..., N, are the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i, and BETA(j), j = 1, ..., N, are the diagonals of the complex Schur form (S,T) that would result if the 2-by-2 diagonal blocks of the real Schur form of (A,E) were further reduced to triangular form using 2-by-2 complex unitary transformations. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.Tolerances
TOL DOUBLE PRECISION A tolerance used in rank decisions to determine the effective rank, which is defined as the order of the largest leading (or trailing) triangular submatrix in the QR factorization with column pivoting whose estimated condition number is less than 1/TOL. If the user sets TOL <= 0, then an implicitly computed, default tolerance TOLDEF = N**2*EPS, is used instead, where EPS is the machine precision (see LAPACK Library routine DLAMCH). TOL < 1.Workspace
IWORK INTEGER array, dimension (N) DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The length of the array DWORK. LDWORK >= 1, and if N = 0, LDWORK >= 4*N, if STDOM = 'N'; LDWORK >= 4*N+16, if STDOM = 'S' or 'U'. For optimum performance LDWORK should 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.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1: the pencil A-lambda*E is not regular; = 2: the QZ algorithm failed to compute all generalized eigenvalues of the pair (A,E); = 3: a failure occured during the ordering of the generalized real Schur form of the pair (A,E).Method
The separation of the finite and infinite parts is based on the reduction algorithm of [1]. If JOBFI = 'F', the matrices of the pair (Ai,Ei), containing the infinite generalized eigenvalues, have the form ( A0,0 A0,k ... A0,1 ) ( 0 E0,k ... E0,1 ) Ai = ( 0 Ak,k ... Ak,1 ) , Ei = ( 0 0 ... Ek,1 ) ; (2) ( : : . : ) ( : : . : ) ( 0 0 ... A1,1 ) ( 0 0 ... 0 ) if JOBFI = 'I', the matrices Ai and Ei have the form ( A1,1 ... A1,k A1,0 ) ( 0 ... E1,k E1,0 ) Ai = ( : . : : ) , Ei = ( : . : : ) , (3) ( : ... Ak,k Ak,0 ) ( : ... 0 Ek,0 ) ( 0 ... 0 A0,0 ) ( 0 ... 0 0 ) where Ai,i , for i = 0, 1, ..., k, are nonsingular upper triangular matrices, and A0,0 corresponds to the non-dynamic infinite modes of the system.References
[1] Misra, P., Van Dooren, P., and Varga, A. Computation of structural invariants of generalized state-space systems. Automatica, 30, pp. 1921-1936, 1994.Numerical Aspects
3 The algorithm requires about 25N floating point operations.Further Comments
The number of infinite poles is computed as NIBLCK NINFP = Sum IBLCK(i) = N - ND - NF, i=1 where NF is the number of finite generalized eigenvalues. The multiplicities of infinite poles can be computed as follows: there are IBLCK(k)-IBLCK(k+1) infinite poles of multiplicity k, for k = 1, ..., NIBLCK, where IBLCK(NIBLCK+1) = 0. Note that each infinite pole of multiplicity k corresponds to an infinite eigenvalue of multiplicity k+1.Example
Program Text
* TG01QD EXAMPLE PROGRAM TEXT * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX, MMAX, PMAX PARAMETER ( NMAX = 20, MMAX = 20, PMAX = 20 ) INTEGER LDA, LDB, LDC, LDE, LDQ, LDZ PARAMETER ( LDA = NMAX, LDB = NMAX, LDC = PMAX, $ LDE = NMAX, LDQ = NMAX, LDZ = NMAX ) INTEGER LDWORK PARAMETER ( LDWORK = 4*NMAX+16 ) * .. Local Scalars .. CHARACTER*1 DICO, JOBFI, STDOM INTEGER I, INFO, J, M, N, N1, N2, N3, ND, NIBLCK, P DOUBLE PRECISION ALPHA, TOL * .. Local Arrays .. INTEGER IBLCK(NMAX), IWORK(NMAX) DOUBLE PRECISION A(LDA,NMAX), ALPHAI(NMAX), ALPHAR(NMAX), $ B(LDB,MMAX), BETA(NMAX), C(LDC,NMAX), $ DWORK(LDWORK), E(LDE,NMAX), Q(LDQ,NMAX), $ Z(LDZ,NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL TG01QD * .. Intrinsic Functions .. INTRINSIC DCMPLX * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, M, P, DICO, STDOM, JOBFI, ALPHA, TOL IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99988 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N ) READ ( NIN, FMT = * ) ( ( E(I,J), J = 1,N ), I = 1,N ) IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99987 ) M ELSE READ ( NIN, FMT = * ) ( ( B(I,J), J = 1,M ), I = 1,N ) IF ( P.LT.0 .OR. P.GT.PMAX ) THEN WRITE ( NOUT, FMT = 99986 ) P ELSE READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P ) * Find the reduced descriptor system * (A-lambda E,B,C). CALL TG01QD( DICO, STDOM, JOBFI, N, M, P, ALPHA, A, LDA, $ E, LDE, B, LDB, C, LDC, N1, N2, N3, ND, $ NIBLCK, IBLCK, Q, LDQ, Z, LDZ, ALPHAR, $ ALPHAI, BETA, TOL, IWORK, DWORK, LDWORK, $ INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99994 ) N1, N2, N3 WRITE ( NOUT, FMT = 99983 ) ND WRITE ( NOUT, FMT = 99989 ) NIBLCK + 1 IF ( NIBLCK.GT.0 ) THEN WRITE ( NOUT, FMT = 99985 ) $ ( IBLCK(I), I = 1, NIBLCK ) END IF 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 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( E(I,J), J = 1,N ) 20 CONTINUE WRITE ( NOUT, FMT = 99993 ) DO 30 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1,M ) 30 CONTINUE WRITE ( NOUT, FMT = 99992 ) DO 40 I = 1, P WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1,N ) 40 CONTINUE WRITE ( NOUT, FMT = 99991 ) DO 50 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Q(I,J), J = 1,N ) 50 CONTINUE WRITE ( NOUT, FMT = 99990 ) DO 60 I = 1, N WRITE ( NOUT, FMT = 99995 ) ( Z(I,J), J = 1,N ) 60 CONTINUE WRITE ( NOUT, FMT = 99985 ) DO 70 I = 1, N IF ( BETA(I).EQ.ZERO .OR. ALPHAI(I).EQ.ZERO ) THEN WRITE ( NOUT, FMT = 99984 ) $ ALPHAR(I)/BETA(I) ELSE WRITE ( NOUT, FMT = 99984 ) $ DCMPLX( ALPHAR(I), ALPHAI(I) )/BETA(I) END IF 70 CONTINUE END IF END IF END IF END IF STOP * 99999 FORMAT (' TG01QD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from TG01QD = ',I2) 99997 FORMAT (/' The transformed state dynamics matrix Q''*A*Z is ') 99996 FORMAT (/' The transformed descriptor matrix Q''*E*Z is ') 99995 FORMAT (20(1X,F8.4)) 99994 FORMAT (' Number of eigenvalues of the three blocks =', 3I5) 99993 FORMAT (/' The transformed input/state matrix Q''*B is ') 99992 FORMAT (/' The transformed state/output matrix C*Z is ') 99991 FORMAT (/' The left transformation matrix Q is ') 99990 FORMAT (/' The right transformation matrix Z is ') 99989 FORMAT ( ' Number of infinite blocks = ',I5) 99988 FORMAT (/' N is out of range.',/' N = ',I5) 99987 FORMAT (/' M is out of range.',/' M = ',I5) 99986 FORMAT (/' P is out of range.',/' P = ',I5) 99985 FORMAT (/' The finite generalized eigenvalues are '/ $ ' real part imag part ') 99984 FORMAT (1X,F9.4,SP,F9.4,S,'i ') 99983 FORMAT ( ' Number of non-dynamic infinite eigenvalues = ',I5) ENDProgram Data
TG01QD EXAMPLE PROGRAM DATA 4 2 2 C S F -1.E-7 0.0 -1 0 0 3 0 0 1 2 1 1 0 4 0 0 0 0 1 2 0 0 0 1 0 1 3 9 6 3 0 0 2 0 1 0 0 0 0 1 1 1 -1 0 1 0 0 1 -1 1Program Results
TG01QD EXAMPLE PROGRAM RESULTS Number of eigenvalues of the three blocks = 1 2 1 Number of non-dynamic infinite eigenvalues = 1 Number of infinite blocks = 1 The transformed state dynamics matrix Q'*A*Z is 1.6311 2.1641 -0.5848 -3.6517 0.0000 -0.4550 1.0935 1.6851 0.0000 0.0000 0.0000 1.5770 0.0000 0.0000 0.0000 2.2913 The transformed descriptor matrix Q'*E*Z is -0.4484 9.6340 5.1601 -2.6183 0.0000 -3.3099 -1.6050 -0.2756 0.0000 0.0000 2.3524 -0.6008 0.0000 0.0000 0.0000 0.0000 The transformed input/state matrix Q'*B is 0.0232 -0.9413 0.7251 0.2478 -0.4336 -0.9538 1.1339 0.3780 The transformed state/output matrix C*Z is 0.8621 0.3754 -0.8847 0.5774 0.1511 -1.1192 1.1795 0.5774 The left transformation matrix Q is 0.0232 0.7251 0.3902 0.5669 -0.3369 -0.6425 0.3902 0.5669 -0.9413 0.2478 -0.1301 -0.1890 0.0000 0.0000 -0.8238 0.5669 The right transformation matrix Z is -0.8621 -0.3754 -0.0843 -0.3299 0.4258 -0.9008 -0.0211 -0.0825 0.0000 0.0000 -0.9689 0.2474 -0.2748 -0.2184 0.2317 0.9073 The finite generalized eigenvalues are real part imag part -3.6375 0.1375 0.0000 Infinity
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/TG01WD.html 0000664 0000000 0000000 00000015027 14560147231 0020365 0 ustar 00root root 0000000 0000000
Purpose
To reduce the pair (A,E) to a real generalized Schur form by using an orthogonal equivalence transformation (A,E) <-- (Q'*A*Z,Q'*E*Z) and to apply the transformation to the matrices B and C: B <-- Q'*B and C <-- C*Z.Specification
SUBROUTINE TG01WD( N, M, P, A, LDA, E, LDE, B, LDB, C, LDC, $ Q, LDQ, Z, LDZ, ALPHAR, ALPHAI, BETA, DWORK, $ LDWORK, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, LDB, LDC, LDE, LDQ, LDWORK, LDZ, $ M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), ALPHAI(*), ALPHAR(*), B(LDB,*), $ BETA(*), C(LDC,*), DWORK(*), E(LDE,*), $ Q(LDQ,*), Z(LDZ,*)Arguments
Input/Output Parameters
N (input) INTEGER The order of the original state-space representation, i.e., the order of the matrices A and E. N >= 0. M (input) INTEGER The number of system inputs, or of columns of B. M >= 0. P (input) INTEGER The number of system outputs, or of rows of C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading N-by-N part of this array must contain the original state dynamics matrix A. On exit, the leading N-by-N part of this array contains the matrix Q' * A * Z in an upper quasi-triangular form. The elements below the first subdiagonal are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,N). E (input/output) DOUBLE PRECISION array, dimension (LDE,N) On entry, the leading N-by-N part of this array must contain the original descriptor matrix E. On exit, the leading N-by-N part of this array contains the matrix Q' * E * Z in an upper triangular form. The elements below the diagonal are set to zero. LDE INTEGER The leading dimension of array E. LDE >= MAX(1,N). B (input/output) DOUBLE PRECISION array, dimension (LDB,M) On entry, the leading N-by-M part of this array must contain the input matrix B. On exit, the leading N-by-M part of this array contains the transformed input matrix Q' * B. LDB INTEGER The leading dimension of array B. LDB >= MAX(1,N). C (input/output) DOUBLE PRECISION array, dimension (LDC,N) On entry, the leading P-by-N part of this array must contain the output matrix C. On exit, the leading P-by-N part of this array contains the transformed output matrix C * Z. LDC INTEGER The leading dimension of array C. LDC >= MAX(1,P). Q (output) DOUBLE PRECISION array, dimension (LDQ,N) The leading N-by-N part of this array contains the left orthogonal transformation matrix used to reduce (A,E) to the real generalized Schur form. The columns of Q are the left generalized Schur vectors of the pair (A,E). LDQ INTEGER The leading dimension of array Q. LDQ >= max(1,N). Z (output) DOUBLE PRECISION array, dimension (LDZ,N) The leading N-by-N part of this array contains the right orthogonal transformation matrix used to reduce (A,E) to the real generalized Schur form. The columns of Z are the right generalized Schur vectors of the pair (A,E). LDZ INTEGER The leading dimension of array Z. LDZ >= max(1,N). ALPHAR (output) DOUBLE PRECISION array, dimension (N) ALPHAI (output) DOUBLE PRECISION array, dimension (N) BETA (output) DOUBLE PRECISION array, dimension (N) On exit, if INFO = 0, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i, and BETA(j), j=1,...,N, are the diagonals of the complex Schur form that would result if the 2-by-2 diagonal blocks of the real Schur form of (A,E) were further reduced to triangular form using 2-by-2 complex unitary transformations. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) On exit, if INFO = 0, DWORK(1) returns the optimal value of LDWORK. LDWORK INTEGER The dimension of working array DWORK. LDWORK >= 8*N+16. For optimum performance LDWORK should be larger.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; > 0: if INFO = i, the QZ algorithm failed to compute the generalized real Schur form; elements i+1:N of ALPHAR, ALPHAI, and BETA should be correct.Method
The pair (A,E) is reduced to a real generalized Schur form using an orthogonal equivalence transformation (A,E) <-- (Q'*A*Z,Q'*E*Z) and the transformation is applied to the matrices B and C: B <-- Q'*B and C <-- C*Z.Numerical Aspects
3 The algorithm requires about 25N floating point operations.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/UD01BD.html 0000664 0000000 0000000 00000014224 14560147231 0020334 0 ustar 00root root 0000000 0000000
Purpose
To read the coefficients of a matrix polynomial dp-1 dp P(s) = P(0) + P(1) * s + . . . + P(dp-1) * s + P(dp) * s .Specification
SUBROUTINE UD01BD( MP, NP, DP, NIN, P, LDP1, LDP2, INFO ) C .. Scalar Arguments .. INTEGER DP, INFO, LDP1, LDP2, MP, NP, NIN C .. Array Arguments .. DOUBLE PRECISION P(LDP1,LDP2,*)Arguments
Input/Output Parameters
MP (input) INTEGER The number of rows of the matrix polynomial P(s). MP >= 1. NP (input) INTEGER The number of columns of the matrix polynomial P(s). NP >= 1. DP (input) INTEGER The degree of the matrix polynomial P(s). DP >= 0. NIN (input) INTEGER The input channel from which the elements of P(s) are read. NIN >= 0. P (output) DOUBLE PRECISION array, dimension (LDP1,LDP2,DP+1) The leading MP-by-NP-by-(DP+1) part of this array contains the coefficients of the matrix polynomial P(s). Specifically, P(i,j,k) contains the coefficient of s**(k-1) of the polynomial which is the (i,j)-th element of P(s), where i = 1,2,...,MP, j = 1,2,...,NP and k = 1,2,...,DP+1. LDP1 INTEGER The leading dimension of array P. LDP1 >= MP. LDP2 INTEGER The second dimension of array P. LDP2 >= NP.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The coefficients P(i), i = 0, ..., DP, which are MP-by-NP matrices, are read from the input file NIN row by row. Each P(i) must be preceded by a text line. This text line can be used to indicate the coefficient matrices.References
None.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* UD01BD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MPMAX, NPMAX, DPMAX PARAMETER ( MPMAX = 10, NPMAX = 10, DPMAX = 5 ) INTEGER LDP1, LDP2 PARAMETER ( LDP1 = MPMAX, LDP2 = NPMAX ) * .. Local Scalars .. INTEGER DP, INFO, L, MP, NP * .. Local Arrays .. DOUBLE PRECISION P(LDP1,LDP2,DPMAX) * .. External Subroutines .. EXTERNAL UD01BD, UD01ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) MP, NP, DP IF ( MP.LE.0 .OR. MP.GT.MPMAX ) THEN WRITE ( NOUT, FMT = 99994 ) MP ELSE IF ( NP.LE.0 .OR. NP.GT.NPMAX ) THEN WRITE ( NOUT, FMT = 99995 ) NP ELSE IF ( DP.LT.0 .OR. DP.GT.DPMAX ) THEN WRITE ( NOUT, FMT = 99993 ) DP ELSE * Read the coefficients of the matrix polynomial P(s). CALL UD01BD( MP, NP, DP, NIN, P, LDP1, LDP2, INFO ) IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, 99996 ) MP, NP, DP * Write the coefficients of the matrix polynomial P(s). L = 5 CALL UD01ND( MP, NP, DP, L, NOUT, P, LDP1, LDP2, ' P', $ INFO ) IF ( INFO.NE.0 ) $ WRITE ( NOUT, FMT = 99997 ) INFO ELSE WRITE ( NOUT, FMT = 99998 ) INFO END IF END IF STOP * 99999 FORMAT (' UD01BD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from UD01BD = ',I2) 99997 FORMAT (' INFO on exit from UD01ND = ',I2) 99996 FORMAT (' MP =', I2, 2X, ' NP =', I2, 3X, 'DP =', I2) 99995 FORMAT (/' NP is out of range.',/' NP = ',I5) 99994 FORMAT (/' MP is out of range.',/' MP = ',I5) 99993 FORMAT (/' DP is out of range.',/' DP = ',I5) ENDProgram Data
UD01BD EXAMPLE PROGRAM DATA 4 3 2 P0 1.0D-00 0.0D-00 0.0D-00 0.0D-00 2.0D-00 4.0D-00 0.0D-00 4.0D-00 8.0D-00 0.0D-00 6.0D-00 1.2D+01 P1 0.0D-00 1.0D-00 2.0D-00 1.0D-00 0.0D-00 0.0D-00 2.0D-00 0.0D-00 0.0D-00 3.0D-00 0.0D-00 0.0D-00 P2 1.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00Program Results
UD01BD EXAMPLE PROGRAM RESULTS MP = 4 NP = 3 DP = 2 P( 0) ( 4X 3) 1 2 3 1 0.1000000D+01 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 0.2000000D+01 0.4000000D+01 3 0.0000000D+00 0.4000000D+01 0.8000000D+01 4 0.0000000D+00 0.6000000D+01 0.1200000D+02 P( 1) ( 4X 3) 1 2 3 1 0.0000000D+00 0.1000000D+01 0.2000000D+01 2 0.1000000D+01 0.0000000D+00 0.0000000D+00 3 0.2000000D+01 0.0000000D+00 0.0000000D+00 4 0.3000000D+01 0.0000000D+00 0.0000000D+00 P( 2) ( 4X 3) 1 2 3 1 0.1000000D+01 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 0.0000000D+00 0.0000000D+00 3 0.0000000D+00 0.0000000D+00 0.0000000D+00 4 0.0000000D+00 0.0000000D+00 0.0000000D+00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/UD01CD.html 0000664 0000000 0000000 00000015721 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
To read the elements of a sparse matrix polynomial dp-1 dp P(s) = P(0) + P(1) * s + . . . + P(dp-1) * s + P(dp) * s .Specification
SUBROUTINE UD01CD( MP, NP, DP, NIN, P, LDP1, LDP2, INFO ) C .. Scalar Arguments .. INTEGER DP, INFO, LDP1, LDP2, MP, NP, NIN C .. Array Arguments .. DOUBLE PRECISION P(LDP1,LDP2,*)Arguments
Input/Output Parameters
MP (input) INTEGER The number of rows of the matrix polynomial P(s). MP >= 1. NP (input) INTEGER The number of columns of the matrix polynomial P(s). NP >= 1. DP (input) INTEGER The degree of the matrix polynomial P(s). DP >= 0. NIN (input) INTEGER The input channel from which the elements of P(s) are read. NIN >= 0. P (output) DOUBLE PRECISION array, dimension (LDP1,LDP2,DP+1) The leading MP-by-NP-by-(DP+1) part of this array contains the coefficients of the matrix polynomial P(s). Specifically, P(i,j,k) contains the coefficient of s**(k-1) of the polynomial which is the (i,j)-th element of P(s), where i = 1,2,...,MP, j = 1,2,...,NP and k = 1,2,...,DP+1. The not assigned elements are set to zero. LDP1 INTEGER The leading dimension of array P. LDP1 >= MP. LDP2 INTEGER The second dimension of array P. LDP2 >= NP.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1 : if a row index i is read with i < 1 or i > MP or a column index j is read with j < 1 or j > NP or a coefficient degree d is read with d < 0 or d > DP + 1. This is a warning.Method
First, the elements P(i,j,k) with 1 <= i <= MP, 1 <= j <= NP and 1 <= k <= DP + 1 are set to zero. Next the nonzero (polynomial) elements are read from the input file NIN. Each nonzero element is given by the values i, j, d, P(i,j,k), k = 1, ..., d+1, where d is the degree and P(i,j,k) is the coefficient of s**(k-1) in the (i,j)-th element of P(s), i.e., let d P (s) = P (0) + P (1) * s + . . . + P (d) * s i,j i,j i,j i,j be the nonzero (i,j)-th element of the matrix polynomial P(s). Then P(i,j,k) corresponds to coefficient P (k-1), k = 1,...,d+1. i,j For each nonzero element, the values i, j, and d are read as one record of the file NIN, and the values P(i,j,k), k = 1,...,d+1, are read as the following record. The routine terminates after the last line has been read.References
None.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* UD01CD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MPMAX, NPMAX, DPMAX PARAMETER ( MPMAX = 10, NPMAX = 10, DPMAX = 5 ) INTEGER LDP1, LDP2 PARAMETER ( LDP1 = MPMAX, LDP2 = NPMAX ) * .. Local Scalars .. INTEGER DP, INFO, INFO1, L, MP, NP * .. Local Arrays .. DOUBLE PRECISION P(LDP1,LDP2,DPMAX) * .. External Subroutines .. EXTERNAL UD01CD, UD01ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) MP, NP, DP IF ( MP.LE.0 .OR. MP.GT.MPMAX ) THEN WRITE ( NOUT, FMT = 99994 ) MP ELSE IF ( NP.LE.0 .OR. NP.GT.NPMAX ) THEN WRITE ( NOUT, FMT = 99995 ) NP ELSE IF ( DP.LT.0 .OR. DP.GT.DPMAX ) THEN WRITE ( NOUT, FMT = 99993 ) DP ELSE * Read the coefficients of the matrix polynomial P(s). CALL UD01CD( MP, NP, DP, NIN, P, LDP1, LDP2, INFO ) IF ( INFO.GE.0 ) THEN WRITE ( NOUT, 99996 ) MP, NP, DP * Write the coefficients of the matrix polynomial P(s). L = 5 CALL UD01ND( MP, NP, DP, L, NOUT, P, LDP1, LDP2, ' P', $ INFO1 ) IF ( INFO1.NE.0 ) $ WRITE ( NOUT, FMT = 99997 ) INFO1 END IF IF ( INFO.NE.0 ) $ WRITE ( NOUT, FMT = 99998 ) INFO END IF STOP * 99999 FORMAT (' UD01CD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from UD01CD = ',I2) 99997 FORMAT (' INFO on exit from UD01ND = ',I2) 99996 FORMAT (' MP =', I2, 2X, ' NP =', I2, 3X, 'DP =', I2) 99995 FORMAT (/' NP is out of range.',/' NP = ',I5) 99994 FORMAT (/' MP is out of range.',/' MP = ',I5) 99993 FORMAT (/' DP is out of range.',/' DP = ',I5) ENDProgram Data
UD01CD EXAMPLE PROGRAM DATA 4 3 2 1 1 1 1.0 1.0 2 2 2 2.0 0.0 1.0 3 3 2 0.0 3.0 1.0 4 1 0 4.0Program Results
UD01CD EXAMPLE PROGRAM RESULTS MP = 4 NP = 3 DP = 2 P( 0) ( 4X 3) 1 2 3 1 0.1000000D+01 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 0.2000000D+01 0.0000000D+00 3 0.0000000D+00 0.0000000D+00 0.0000000D+00 4 0.4000000D+01 0.0000000D+00 0.0000000D+00 P( 1) ( 4X 3) 1 2 3 1 0.1000000D+01 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 0.0000000D+00 0.0000000D+00 3 0.0000000D+00 0.0000000D+00 0.3000000D+01 4 0.0000000D+00 0.0000000D+00 0.0000000D+00 P( 2) ( 4X 3) 1 2 3 1 0.0000000D+00 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 0.1000000D+01 0.0000000D+00 3 0.0000000D+00 0.0000000D+00 0.1000000D+01 4 0.0000000D+00 0.0000000D+00 0.0000000D+00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/UD01DD.html 0000664 0000000 0000000 00000011672 14560147231 0020342 0 ustar 00root root 0000000 0000000
Purpose
To read the elements of a sparse matrix.Specification
SUBROUTINE UD01DD( M, N, NIN, A, LDA, INFO ) C .. Scalar Arguments .. INTEGER INFO, LDA, M, N, NIN C .. Array Arguments .. DOUBLE PRECISION A(LDA,*)Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0. NIN (input) INTEGER The input channel from which the elements of A are read. NIN >= 0. A (output) DOUBLE PRECISION array, dimension (LDA,N) The leading M-by-N part of this array contains the sparse matrix A. The not assigned elements are set to zero. LDA INTEGER The leading dimension of array A. LDA >= MAX(1,M).Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value; = 1 : if a row index i is read with i < 1 or i > M or a column index j is read with j < 1 or j > N. This is a warning.Method
First, the elements A(i,j) with 1 <= i <= M and 1 <= j <= N are set to zero. Next the nonzero elements are read from the input file NIN. Each line of NIN must contain consecutively the values i, j, A(i,j). The routine terminates after the last line has been read.References
None.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* UD01DD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 10, NMAX = 10 ) INTEGER LDA PARAMETER ( LDA = NMAX ) * .. Local Scalars .. INTEGER INFO, INFO1, M, N * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX) * .. External Subroutines .. EXTERNAL UD01DD, UD01MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N IF ( M.LT.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99994 ) M ELSE IF ( N.LT.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99995 ) N ELSE * Read the coefficients of the matrix polynomial P(s). CALL UD01DD( M, N, NIN, A, LDA, INFO ) IF ( INFO.GE.0 ) THEN * Write the matrix A. CALL UD01MD( M, N, 5, NOUT, A, LDA, ' Matrix A', INFO1 ) IF ( INFO1.NE.0 ) $ WRITE ( NOUT, FMT = 99998 ) INFO1 END IF IF ( INFO.NE.0 ) $ WRITE ( NOUT, FMT = 99997 ) INFO END IF STOP * 99999 FORMAT (' UD01DD EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from UD01MD = ',I2) 99997 FORMAT (' INFO on exit from UD01DD = ',I2) 99995 FORMAT (/' N is out of range.',/' N = ',I5) 99994 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
UD01DD EXAMPLE PROGRAM DATA 6 5 1 1 -1.1 6 1 1.5 2 2 -2.2 6 2 2.5 3 3 -3.3 6 3 3.5 4 4 -4.4 6 4 4.5 5 5 -5.5 6 5 5.5Program Results
UD01DD EXAMPLE PROGRAM RESULTS Matrix A ( 6X 5) 1 2 3 4 5 1 -0.1100000D+01 0.0000000D+00 0.0000000D+00 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 -0.2200000D+01 0.0000000D+00 0.0000000D+00 0.0000000D+00 3 0.0000000D+00 0.0000000D+00 -0.3300000D+01 0.0000000D+00 0.0000000D+00 4 0.0000000D+00 0.0000000D+00 0.0000000D+00 -0.4400000D+01 0.0000000D+00 5 0.0000000D+00 0.0000000D+00 0.0000000D+00 0.0000000D+00 -0.5500000D+01 6 0.1500000D+01 0.2500000D+01 0.3500000D+01 0.4500000D+01 0.5500000D+01
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/UD01MD.html 0000664 0000000 0000000 00000012003 14560147231 0020340 0 ustar 00root root 0000000 0000000
Purpose
To print an M-by-N real matrix A row by row. The elements of A are output to 7 significant figures.Specification
SUBROUTINE UD01MD( M, N, L, NOUT, A, LDA, TEXT, INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDA, M, N, NOUT CHARACTER*(*) TEXT C .. Array Arguments .. DOUBLE PRECISION A(LDA,*)Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of matrix A to be printed. M >= 1. N (input) INTEGER The number of columns of matrix A to be printed. N >= 1. L (input) INTEGER The number of elements of matrix A to be printed per line. 1 <= L <= 5. NOUT (input) INTEGER The output channel to which the results are sent. NOUT >= 0. A (input) DOUBLE PRECISION array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix to be printed. LDA INTEGER The leading dimension of array A. LDA >= M. TEXT (input) CHARACTER*72. Title caption of the matrix to be printed (up to a maximum of 72 characters). For example, TEXT = 'Matrix A'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine first prints the contents of TEXT as a title, followed by the elements of the matrix A such that (i) if N <= L, the leading M-by-N part is printed; (ii) if N = k*L + p (where k,p > 0), then k M-by-L blocks of consecutive columns of A are printed one after another followed by one M-by-p block containing the last p columns of A. Row numbers are printed on the left of each row and a column number appears on top of each column. The routine uses 2 + (k + 1)*(m + 1) lines and 8 + 15*c positions per line where c is the actual number of columns, (i.e. c = L or c = p).References
None.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* UD01MD EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MMAX, NMAX PARAMETER ( MMAX = 20, NMAX = 20 ) INTEGER LDA PARAMETER ( LDA = MMAX ) * .. Local Scalars .. INTEGER I, INFO, J, L, M, N CHARACTER*72 TEXT * .. Local Arrays .. DOUBLE PRECISION A(LDA,NMAX) * .. External Subroutines .. EXTERNAL UD01MD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) M, N, L, TEXT IF ( M.LE.0 .OR. M.GT.MMAX ) THEN WRITE ( NOUT, FMT = 99996 ) M ELSE IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99997 ) N ELSE READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,M ) * Print out the matrix A. CALL UD01MD( M, N, L, NOUT, A, LDA, TEXT, INFO ) IF ( INFO.NE.0 ) WRITE ( NOUT, FMT = 99998 ) INFO END IF STOP * 99999 FORMAT (' UD01MD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from UD01MD = ',I2) 99997 FORMAT (/' N is out of range.',/' N = ',I5) 99996 FORMAT (/' M is out of range.',/' M = ',I5) ENDProgram Data
UD01MD EXAMPLE PROGRAM DATA 4 4 4 'Matrix A' 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0Program Results
UD01MD EXAMPLE PROGRAM RESULTS Matrix A ( 4X 4) 1 2 3 4 1 0.1000000D+01 0.2000000D+01 0.3000000D+01 0.4000000D+01 2 0.5000000D+01 0.6000000D+01 0.7000000D+01 0.8000000D+01 3 0.9000000D+01 0.1000000D+02 0.1100000D+02 0.1200000D+02 4 0.1300000D+02 0.1400000D+02 0.1500000D+02 0.1600000D+02
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/UD01MZ.html 0000664 0000000 0000000 00000006333 14560147231 0020377 0 ustar 00root root 0000000 0000000
Purpose
To print an M-by-N real matrix A row by row. The elements of A are output to 7 significant figures.Specification
SUBROUTINE UD01MZ( M, N, L, NOUT, A, LDA, TEXT, INFO ) C .. Scalar Arguments .. INTEGER INFO, L, LDA, M, N, NOUT CHARACTER*(*) TEXT C .. Array Arguments .. COMPLEX*16 A(LDA,*)Arguments
Input/Output Parameters
M (input) INTEGER The number of rows of matrix A to be printed. M >= 1. N (input) INTEGER The number of columns of matrix A to be printed. N >= 1. L (input) INTEGER The number of elements of matrix A to be printed per line. 1 <= L <= 3. NOUT (input) INTEGER The output channel to which the results are sent. NOUT >= 0. A (input) COMPLEX*16 array, dimension (LDA,N) The leading M-by-N part of this array must contain the matrix to be printed. LDA INTEGER The leading dimension of array A. LDA >= M. TEXT (input) CHARACTER*72. Title caption of the matrix to be printed (up to a maximum of 72 characters). For example, TEXT = 'Matrix A'.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The routine first prints the contents of TEXT as a title, followed by the elements of the matrix A such that (i) if N <= L, the leading M-by-N part is printed; (ii) if N = k*L + p (where k,p > 0), then k M-by-L blocks of consecutive columns of A are printed one after another followed by one M-by-p block containing the last p columns of A. Row numbers are printed on the left of each row and a column number appears on top of each complex column. The routine uses 2 + (k + 1)*(m + 1) lines and 7 + 32*c positions per line where c is the actual number of columns, (i.e. c = L or c = p).References
None.Numerical Aspects
None.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/UD01ND.html 0000664 0000000 0000000 00000016061 14560147231 0020351 0 ustar 00root root 0000000 0000000
Purpose
To print the MP-by-NP coefficient matrices of a matrix polynomial dp-1 dp P(s) = P(0) + P(1) * s + . . . + P(dp-1) * s + P(dp) * s . The elements of the matrices are output to 7 significant figures.Specification
SUBROUTINE UD01ND( MP, NP, DP, L, NOUT, P, LDP1, LDP2, TEXT, $ INFO ) C .. Scalar Arguments .. INTEGER DP, INFO, L, LDP1, LDP2, MP, NP, NOUT CHARACTER*(*) TEXT C .. Array Arguments .. DOUBLE PRECISION P(LDP1,LDP2,*)Arguments
Input/Output Parameters
MP (input) INTEGER The number of rows of the matrix polynomial P(s). MP >= 1. NP (input) INTEGER The number of columns of the matrix polynomial P(s). NP >= 1. DP (input) INTEGER The degree of the matrix polynomial P(s). DP >= 0. L (input) INTEGER The number of elements of the coefficient matrices to be printed per line. 1 <= L <= 5. NOUT (input) INTEGER The output channel to which the results are sent. NOUT >= 0. P (input) DOUBLE PRECISION array, dimension (LDP1,LDP2,DP+1) The leading MP-by-NP-by-(DP+1) part of this array must contain the coefficients of the matrix polynomial P(s). Specifically, P(i,j,k) must contain the coefficient of s**(k-1) of the polynomial which is the (i,j)-th element of P(s), where i = 1,2,...,MP, j = 1,2,...,NP and k = 1,2,...,DP+1. LDP1 INTEGER The leading dimension of array P. LDP1 >= MP. LDP2 INTEGER The second dimension of array P. LDP2 >= NP. TEXT (input) CHARACTER*72 Title caption of the coefficient matrices to be printed. TEXT is followed by the degree of the coefficient matrix, within brackets. If TEXT = ' ', then the coefficient matrices are separated by an empty line.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
For i = 1, 2, ..., DP + 1 the routine first prints the contents of TEXT followed by (i-1) as a title, followed by the elements of the MP-by-NP coefficient matrix P(i) such that (i) if NP < L, then the leading MP-by-NP part is printed; (ii) if NP = k*L + p (where k, p > 0), then k MP-by-L blocks of consecutive columns of P(i) are printed one after another followed by one MP-by-p block containing the last p columns of P(i). Row numbers are printed on the left of each row and a column number on top of each column.References
None.Numerical Aspects
None.Further Comments
NoneExample
Program Text
* UD01ND EXAMPLE PROGRAM TEXT * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER MPMAX, NPMAX, DPMAX PARAMETER ( MPMAX = 10, NPMAX = 10, DPMAX = 5 ) INTEGER LDP1, LDP2 PARAMETER ( LDP1 = MPMAX, LDP2 = NPMAX ) * .. Local Scalars .. INTEGER DP, INFO, L, MP, NP CHARACTER*72 TEXT * .. Local Arrays .. DOUBLE PRECISION P(LDP1,LDP2,DPMAX) * .. External Subroutines .. EXTERNAL UD01BD, UD01ND * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) MP, NP, DP, L, TEXT IF ( MP.LE.0 .OR. MP.GT.MPMAX ) THEN WRITE ( NOUT, FMT = 99994 ) MP ELSE IF ( NP.LE.0 .OR. NP.GT.NPMAX ) THEN WRITE ( NOUT, FMT = 99995 ) NP ELSE IF ( DP.LT.0 .OR. DP.GT.DPMAX ) THEN WRITE ( NOUT, FMT = 99993 ) DP ELSE * Read the coefficients of the matrix polynomial P(s). CALL UD01BD( MP, NP, DP, NIN, P, LDP1, LDP2, INFO ) IF ( INFO.EQ.0 ) THEN WRITE ( NOUT, 99996 ) MP, NP, DP * Write the coefficients of the matrix polynomial P(s). CALL UD01ND( MP, NP, DP, L, NOUT, P, LDP1, LDP2, TEXT, $ INFO ) IF ( INFO.NE.0 ) $ WRITE ( NOUT, FMT = 99998 ) INFO ELSE WRITE ( NOUT, FMT = 99997 ) INFO END IF END IF STOP * 99999 FORMAT (' UD01ND EXAMPLE PROGRAM RESULTS', /1X) 99998 FORMAT (' INFO on exit from UD01ND = ',I2) 99997 FORMAT (' INFO on exit from UD01BD = ',I2) 99996 FORMAT (' MP =', I2, 2X, ' NP =', I2, 3X, 'DP =', I2) 99995 FORMAT (/' NP is out of range.',/' NP = ',I5) 99994 FORMAT (/' MP is out of range.',/' MP = ',I5) 99993 FORMAT (/' DP is out of range.',/' DP = ',I5) ENDProgram Data
UD01ND EXAMPLE PROGRAM DATA 4 3 2 5 P P0 1.0D-00 0.0D-00 0.0D-00 0.0D-00 2.0D-00 4.0D-00 0.0D-00 4.0D-00 8.0D-00 0.0D-00 6.0D-00 1.2D+01 P1 0.0D-00 1.0D-00 2.0D-00 1.0D-00 0.0D-00 0.0D-00 2.0D-00 0.0D-00 0.0D-00 3.0D-00 0.0D-00 0.0D-00 P2 1.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00 0.0D-00Program Results
UD01ND EXAMPLE PROGRAM RESULTS MP = 4 NP = 3 DP = 2 P( 0) ( 4X 3) 1 2 3 1 0.1000000D+01 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 0.2000000D+01 0.4000000D+01 3 0.0000000D+00 0.4000000D+01 0.8000000D+01 4 0.0000000D+00 0.6000000D+01 0.1200000D+02 P( 1) ( 4X 3) 1 2 3 1 0.0000000D+00 0.1000000D+01 0.2000000D+01 2 0.1000000D+01 0.0000000D+00 0.0000000D+00 3 0.2000000D+01 0.0000000D+00 0.0000000D+00 4 0.3000000D+01 0.0000000D+00 0.0000000D+00 P( 2) ( 4X 3) 1 2 3 1 0.1000000D+01 0.0000000D+00 0.0000000D+00 2 0.0000000D+00 0.0000000D+00 0.0000000D+00 3 0.0000000D+00 0.0000000D+00 0.0000000D+00 4 0.0000000D+00 0.0000000D+00 0.0000000D+00
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/UE01MD.html 0000664 0000000 0000000 00000005746 14560147231 0020361 0 ustar 00root root 0000000 0000000
Purpose
To provide an extension of the LAPACK routine ILAENV to machine-specific parameters for SLICOT routines. The default values in this version aim to give good performance on a wide range of computers. For optimal performance, however, the user is advised to modify this routine. Note that an optimized BLAS is a crucial prerequisite for any speed gains. For further details, see ILAENV.Specification
INTEGER FUNCTION UE01MD( ISPEC, NAME, OPTS, N1, N2, N3 ) C .. Scalar Arguments .. CHARACTER*( * ) NAME, OPTS INTEGER ISPEC, N1, N2, N3Function Value
UE01MD INTEGER The function value set according to ISPEC.Arguments
Input/Output Parameters
ISPEC (input) INTEGER Specifies the parameter to be returned as the value of UE01MD, as follows: = 1: the optimal blocksize; if the returned value is 1, an unblocked algorithm will give the best performance; = 2: the minimum block size for which the block routine should be used; if the usable block size is less than this value, an unblocked routine should be used; = 3: the crossover point (in a block routine, for N less than this value, an unblocked routine should be used) = 4: the number of shifts, used in the product eigenvalue routine; = 8: the crossover point for the multishift QR method for product eigenvalue problems. NAME (input) CHARACTER*(*) The name of the calling subroutine, in either upper case or lower case. OPTS (input) CHARACTER*(*) The character options to the subroutine NAME, concatenated into a single character string. N1 (input) INTEGER N2 (input) INTEGER N3 (input) INTEGER Problem dimensions for the subroutine NAME; these may not all be required.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None
Return to index SLICOT-SLICOT-Reference-a037f7e/doc/readme 0000664 0000000 0000000 00000001722 14560147231 0017746 0 ustar 00root root 0000000 0000000 SLICOT Library Subdirectory doc ------------------------------- SLICOT Library Subdirectory doc contains documentation files (*.html) for almost all SLICOT Library routines. Omitted are few auxiliary routines, called by other SLICOT routines, but which seem to have no general use. The documentation conforms to the SLICOT standards. Besides function, arguments, and algorithm description, most documents for user-callable rotines include example programs, which could be easily modified, by copying, pasting, etc., to solve related, specific problems. The documentation files could be viewed individually, or via the provided index files: the main SLICOT Library index (libindex.html), stored in the SLICOT root directory, or the auxiliary, supporting routines index (support.html), stored in the subdirectory doc. The second file is also accessible from the first one. These index files are organized according to the SLICOT Library chapters, sections, and subsections. SLICOT-SLICOT-Reference-a037f7e/doc/support.html 0000664 0000000 0000000 00000125033 14560147231 0021172 0 ustar 00root root 0000000 0000000
AB08NX Construction of a reduced system with input/output matrix Dr of full row rank, preserving transmission zeros AB08NY Construction of a reduced system with input/output matrix Dr of full row rank, preserving transmission zeros (extended variant) AB8NXZ Construction of a reduced system with input/output matrix Dr of full row rank, preserving transmission zeros (complex case)
AB09AX Balance & Truncate model reduction with state matrix in real Schur form AB09BX Singular perturbation approximation based model reduction with state matrix in real Schur form AB09CX Hankel norm approximation based model reduction with state matrix in real Schur form AB09HX Stochastic balancing model reduction of stable systems AB09HY Cholesky factors of the controllability and observability Grammians AB09IX Accuracy enhanced balancing related model reduction AB09IY Cholesky factors of the frequency-weighted controllability and observability Grammians AB09JV State-space representation of a projection of a left weighted transfer-function matrix AB09JW State-space representation of a projection of a right weighted transfer-function matrix AB09JX Check stability/antistability of finite eigenvalues AB09KX Stable projection of V*G*W or conj(V)*G*conj(W)
AB13AX Hankel-norm of a stable system with state matrix in real Schur form AB13DX Maximum singular value of a transfer-function matrix
AG08BY Construction of a reduced system with input/output matrix Dr of full row rank, preserving the finite Smith zeros AG8BYZ Construction of a reduced system with input/output matrix Dr of full row rank, preserving the finite Smith zeros (complex case)
IB01MD Upper triangular factor in QR factorization of a block-Hankel-block matrix IB01MY Upper triangular factor in fast QR factorization of a block-Hankel-block matrix IB01ND Singular value decomposition giving the system order IB01OD Estimating the system order IB01OY User's confirmation of the system order IB01PD Estimating the system matrices and covariances IB01PX Estimating the matrices B and D of a system using Kronecker products IB01PY Estimating the matrices B and D of a system exploiting the structure IB01QD Estimating the initial state and the matrices B and D of a system IB01RD Estimating the initial state of a system
MA01AD Complex square root of a complex number in real arithmetic MA01BD Safely computing the general product of K real scalars MA01BZ Safely computing the general product of K complex scalars MA01CD Safely computing the sign of a sum of two real numbers represented using integer powers of a base MA01DD Approximate symmetric chordal metric for two finite complex numbers MA01DZ Approximate symmetric chordal metric for two, possibly infinite, complex numbers
MA02AD Transpose of a matrix MA02AZ (Conjugate) transpose of a complex matrix MA02BD Reversing the order of rows and/or columns of a matrix MA02BZ Reversing the order of rows and/or columns of a matrix (complex case) MA02CD Pertranspose of the central band of a square matrix MA02CZ Pertranspose of the central band of a square matrix (complex case) MA02DD Pack/unpack the upper or lower triangle of a symmetric matrix MA02ED Construct a triangle of a symmetric matrix, given the other triangle MA02ES Construct a triangle of a skew-symmetric real matrix, given the other triangle MA02EZ Construct a triangle of a (skew-)symmetric/Hermitian complex matrix, given the other triangle MA02FD Hyperbolic plane rotation MA02GD Column interchanges on a real matrix MA02GZ Column interchanges on a complex matrix MA02HD Check if a matrix is a scalar multiple of an identity-like matrix MA02HZ Check if a complex matrix is a scalar multiple of an identity-like matrix MA02ID Matrix 1-, Frobenius, or infinity norms of a skew-Hamiltonian matrix MA02IZ Matrix 1-, Frobenius, or infinity norms of a complex skew-Hamiltonian matrix MA02JD Test if a matrix is an orthogonal symplectic matrix MA02JZ Test if a matrix is a unitary symplectic matrix MA02MD Norms of a real skew-symmetric matrix MA02MZ Norms of a complex skew-symmetric matrix MA02NZ Two rows and columns permutation of a (skew-)symmetric/Hermitian complex matrix MA02OD Number of zero rows of a real (skew-)Hamiltonian matrix MA02OZ Number of zero rows of a complex (skew-)Hamiltonian matrix MA02PD Number of zero rows and columns of a real matrix MA02PZ Number of zero rows and columns of a complex matrix MA02RD Sorting a real vector and rearranging another vector MA02SD Smallest nonzero absolute value of the elements of a real matrix MB01KD Rank 2k operation alpha*A*trans(B) - alpha*B*trans(A) + beta*C, with A and C skew-symmetric matrices MB01LD Computation of matrix expression alpha*R + beta*A*X*trans(A) with skew-symmetric matrices R and X MB01MD Matrix-vector operation alpha*A*x + beta*y, with A a skew-symmetric matrix MB01ND Rank 2 operation alpha*x*trans(y) - alpha*y*trans(x) + A, with A a skew-symmetric matrix MB01SD Rows and/or columns scaling of a matrix MB01SS Symmetric scaling of a symmetric matrix
MB01OC Computation of matrix expression alpha R + beta ( op(H) X + X op(H)' ) with R, X symmetric and H upper Hessenberg MB01OD Computation of matrix expression alpha R + beta ( op(H) X op(E)' + op(E) X op(H)' ) with R, X symmetric, H upper Hessenberg, and E upper triangular MB01OE Computation of matrix expression alpha R + beta ( op(H) op(E)' + op(E) op(H)' ) with R symmetric, H upper Hessenberg, and E upper triangular MB01OH Computation of matrix expression alpha R + beta ( op(H) op(A)' + op(A) op(H)' ) with R symmetric, and A, H upper Hessenberg MB01OO Computation of P or P' with P = op(H) X op(E)' with X symmetric, H upper Hessenberg, and E upper triangular MB01OS Computation of matrix expression P = H X or P = X H, with X symmetric and H upper Hessenberg MB01OT Computation of matrix expression alpha R + beta ( op(E) op(T)' + op(T) op(E)' ) with R symmetric and E, T upper triangular MB01RH Computation of matrix expression alpha R + beta op(H) X op(H)' with R, X symmetric and H upper Hessenberg MB01RT Computation of matrix expression alpha R + beta op(E) X op(E)' with R, X symmetric and E upper triangular MB01RU Computation of matrix expression alpha*R + beta*A*X*trans(A) (MB01RD variant) MB01RW Computation of matrix expression alpha*A*X*trans(A), X symmetric (BLAS 2) MB01RX Computing a triangle of the matrix expressions alpha*R + beta*A*B or alpha*R + beta*B*A MB01RY Computing a triangle of the matrix expressions alpha*R + beta*H*B or alpha*R + beta*B*H, with H an upper Hessenberg matrix MB01UW Computation of matrix expressions alpha*H*A or alpha*A*H, overwritting A, with H an upper Hessenberg matrix MB01VD Kronecker product of two matrices MB01XY Computation of the product U'*U or L*L', with U and L upper and lower triangular matrices (unblock algorithm) SB03OV Construction of a complex plane rotation to annihilate a real number, modifying a complex number SG03BY Computing a complex plane rotation in real arithmetic SG03BR Computing a complex plane rotation in real arithmetic (SG03BY version - adaptation of LAPACK ZLARTG)
MB02CU Bringing the first blocks of a generator in proper form (extended version of MB02CX) MB02CV Applying the MB02CU transformations on other columns / rows of the generator MB02CX Bringing the first blocks of a generator in proper form MB02CY Applying the MB02CX transformations on other columns / rows of the generator MB02NY Separation of a zero singular value of a bidiagonal submatrix MB02QY Minimum-norm least squares solution, given a rank-revealing QR factorization MB02UU Solution of linear equations using LU factorization with complete pivoting MB02UV LU factorization with complete pivoting MB02UW Solution of linear equations of order at most 2 with possible scaling and perturbation of system matrix MB02WD Solution of a positive definite linear system A*x = b, or f(A, x) = b, using conjugate gradient algorithm MB02XD Solution of a set of positive definite linear systems, A'*A*X = B, or f(A)*X = B, using Gaussian elimination MB02YD Solution of the linear system A*x = b, D*x = 0, D diagonal
MB03AD Reducing the first column of a real Wilkinson shift polynomial for a product of matrices to the first unit vector MB03AB Reducing the first column of a real Wilkinson shift polynomial for a product of matrices to the first unit vector (variant with explicit shifts) MB03AE Reducing the first column of a real Wilkinson shift polynomial for a product of matrices to the first unit vector (variant with partial evaluation, Hessenberg factor is the first one) MB03AF Reducing the first column of a real Wilkinson shift polynomial for a product of matrices to the first unit vector (variant, Hessenberg factor is the last one) MB03AG Reducing the first column of a real Wilkinson shift polynomial for a product of matrices to the first unit vector (variant with evaluation, Hessenberg factor is the first one) MB03AH Reducing the first column of a real Wilkinson shift polynomial for a product of matrices to the first unit vector (variant with partial evaluation, Hessenberg factor is the last one) MB03AI Reducing the first column of a real Wilkinson shift polynomial for a product of matrices to the first unit vector (variant with evaluation, Hessenberg factor is the last one) MB03BA Computing maps for Hessenberg index and signature array MB03BB Eigenvalues of a 2-by-2 matrix product via a complex single shifted periodic QZ algorithm MB03BC Product singular value decomposition of K-1 triangular factors of order 2 MB03BD Finding eigenvalues of a generalized matrix product in Hessenberg-triangular form MB03BE Applying iterations of a real single shifted periodic QZ algorithm to a 2-by-2 matrix product MB03BF Applying iterations of a real single shifted periodic QZ algorithm to a 2-by-2 matrix product, with Hessenberg factor the last one MB03BZ Finding eigenvalues of a complex generalized matrix product in Hessenberg-triangular form MB03CD Exchanging eigenvalues of a real 2-by-2, 3-by-3 or 4-by-4 block upper triangular pencil (factored version) MB03CZ Exchanging eigenvalues of a complex 2-by-2 upper triangular pencil (factored version) MB03DD Exchanging eigenvalues of a real 2-by-2, 3-by-3 or 4-by-4 block upper triangular pencil MB03DZ Exchanging eigenvalues of a complex 2-by-2 upper triangular pencil MB03ED Reducing a real 2-by-2 or 4-by-4 block (anti-)diagonal skew-Hamiltonian/Hamiltonian pencil to generalized Schur form and moving eigenvalues with negative real parts to the top (factored version) MB03FD Reducing a real 2-by-2 or 4-by-4 block (anti-)diagonal skew-Hamiltonian/Hamiltonian pencil to generalized Schur form and moving eigenvalues with negative real parts to the top MB03GD Exchanging eigenvalues of a real 2-by-2 or 4-by-4 block upper triangular skew-Hamiltonian/Hamiltonian pencil (factored version) MB03GZ Exchanging eigenvalues of a complex 2-by-2 skew-Hamiltonian/ Hamiltonian pencil in structured Schur form (factored version) MB03HD Exchanging eigenvalues of a real 2-by-2 or 4-by-4 skew-Hamiltonian/ Hamiltonian pencil in structured Schur form MB03HZ Exchanging eigenvalues of a complex 2-by-2 skew-Hamiltonian/ Hamiltonian pencil in structured Schur form MB03ID Moving eigenvalues with negative real parts of a real skew-Hamiltonian/Hamiltonian pencil in structured Schur form to the leading subpencil (factored version) MB03IZ Moving eigenvalues with negative real parts of a complex skew-Hamiltonian/Hamiltonian pencil in structured Schur form to the leading subpencil (factored version) MB03JD Moving eigenvalues with negative real parts of a real skew-Hamiltonian/Hamiltonian pencil in structured Schur form to the leading subpencil MB03JP Moving eigenvalues with negative real parts of a real skew-Hamiltonian/Hamiltonian pencil in structured Schur form to the leading subpencil (applying transformations on panels of columns) MB03JZ Moving eigenvalues with negative real parts of a complex skew-Hamiltonian/Hamiltonian pencil in structured Schur form to the leading subpencil MB3JZP Moving eigenvalues with negative real parts of a complex skew-Hamiltonian/Hamiltonian pencil in structured Schur form to the leading subpencil (applying transformations on panels of columns) MB03KA Moving diagonal blocks at a specified position in a formal matrix product to another position MB03KB Swapping pairs of adjacent diagonal blocks of sizes 1 and/or 2 in a formal matrix product MB03KC Reducing a 2-by-2 formal matrix product to periodic Hessenberg-triangular form MB03KD Reordering the diagonal blocks of a formal matrix product using periodic QZ algorithm MB03KE Solving periodic Sylvester-like equations with matrices of order at most 2 MB03NY The smallest singular value of A - jwI MB03OY Matrix rank determination by incremental condition estimation, during the pivoted QR factorization process MB3OYZ Matrix rank determination by incremental condition estimation, during the pivoted QR factorization process (complex case) MB03PY Matrix rank determination by incremental condition estimation, during the pivoted RQ factorization process (row pivoting) MB3PYZ Matrix rank determination by incremental condition estimation, during the pivoted RQ factorization process (row pivoting, complex case) MB03QV Eigenvalues of an upper quasi-triangular matrix pencil MB03QW Standardization and eigenvalues of a 2-by-2 diagonal block pair of an upper quasi-triangular matrix pencil MB03QX Eigenvalues of an upper quasi-triangular matrix MB03QY Transformation to Schur canonical form of a selected 2-by-2 diagonal block of an upper quasi-triangular matrix MB03RX Reordering the diagonal blocks of a principal submatrix of a real Schur form matrix MB03RY Tentative solution of Sylvester equation -AX + XB = C (A, B in real Schur form) MB03RW Tentative solution of Sylvester equation -AX + XB = C (A, B in complex Schur form) MB03TS Swapping two diagonal blocks of a matrix in (skew-)Hamiltonian canonical Schur form MB03VY Generating orthogonal matrices for reduction to periodic Hessenberg form of a product of matrices MB03WA Swapping two adjacent diagonal blocks in a periodic real Schur canonical form MB03WX Eigenvalues of a product of matrices, T = T_1*T_2*...*T_p, with T_1 upper quasi-triangular and T_2, ..., T_p upper triangular MB03XS Eigenvalues and real skew-Hamiltonian Schur form of a skew-Hamiltonian matrix MB03XU Panel reduction of columns and rows of a real (k+2n)-by-(k+2n) matrix by orthogonal symplectic transformations MB03YA Annihilation of one or two entries on the subdiagonal of a Hessenberg matrix corresponding to zero elements on the diagonal of a triangular matrix MB03YT Periodic Schur factorization of a real 2-by-2 matrix pair (A,B) with B upper triangular MB03ZA Reordering a selected cluster of eigenvalues of a given matrix pair in periodic Schur form MB05MY Computing an orthogonal matrix reducing a matrix to real Schur form T, the eigenvalues, and the upper triangular matrix of right eigenvectors of T MB05OY Restoring a matrix after balancing transformations
MB04CD Reducing a special real block (anti-)diagonal skew-Hamiltonian/ Hamiltonian pencil in factored form to generalized Schur form MB04DB Applying the inverse of a balancing transformation for a real skew-Hamiltonian/Hamiltonian matrix pencil MB4DBZ Applying the inverse of a balancing transformation for a complex skew-Hamiltonian/Hamiltonian matrix pencil MB04DD Balancing a real Hamiltonian matrix MB04DZ Balancing a complex Hamiltonian matrix MB04DI Applying the inverse of a balancing transformation for a real Hamiltonian matrix MB04DS Balancing a real skew-Hamiltonian matrix MB04DY Symplectic scaling of a Hamiltonian matrix MB04HD Reducing a special real block (anti-)diagonal skew-Hamiltonian/ Hamiltonian pencil to generalized Schur form MB04IY Applying the product of elementary reflectors used for QR factorization of a matrix having a lower left zero triangle MB04NY Applying an elementary reflector to a matrix C = ( A B ), from the right, where A has one column MB04OY Applying an elementary reflector to a matrix C = ( A' B' )', from the left, where A has one row MB04OW Rank-one update of a Cholesky factorization for a 2-by-2 block matrix MB04OX Rank-one update of a Cholesky factorization MB04PA Special reduction of a (skew-)Hamiltonian like matrix MB04PU Computation of the Paige/Van Loan (PVL) form of a Hamiltonian matrix (unblocked algorithm) MB04PY Applying an elementary reflector to a matrix from the left or right MB04QB Applying a product of symplectic reflectors and Givens rotations to two general real matrices MB04QC Premultiplying a real matrix with an orthogonal symplectic block reflector MB04QF Forming the triangular block factors of a symplectic block reflector MB04QS Multiplication with a product of symplectic reflectors and Givens rotations MB04QU Applying a product of symplectic reflectors and Givens rotations to two general real matrices (unblocked algorithm) MB04RB Reduction of a skew-Hamiltonian matrix to Paige/Van Loan (PVL) form (blocked version) MB04RU Reduction of a skew-Hamiltonian matrix to Paige/Van Loan (PVL) form (unblocked version) MB04RS Solution of a generalized real Sylvester equation with matrix pairs in generalized real Schur form MB04RV Solution of a generalized complex Sylvester equation with matrix pairs in generalized complex Schur form MB04SU Symplectic QR decomposition of a real 2M-by-N matrix MB04TS Symplectic URV decomposition of a real 2N-by-2N matrix (unblocked version) MB04TU Applying a row-permuted Givens transformation to two row vectors MB04WD Generating an orthogonal basis spanning an isotropic subspace MB04WP Generating an orthogonal symplectic matrix which performed the reduction in MB04PU MB04WR Generating orthogonal symplectic matrices defined as products of symplectic reflectors and Givens rotations MB04WU Generating an orthogonal basis spanning an isotropic subspace (unblocked version) MB04XY Applying Householder transformations for bidiagonalization (stored in factored form) to one or two matrices, from the left MB04YW One QR or QL iteration step onto an unreduced bidiagonal submatrix of a bidiagonal matrix
MC01PY Coefficients of a real polynomial, stored in decreasing order, given its zeros
MC03NX Construction of a pencil sE-A related to a given polynomial matrix
MD03BX QR factorization with column pivoting and error vector transformation MD03BY Finding the Levenberg-Marquardt parameter
NF01AD Computing the output of a Wiener system NF01AY Computing the output of a set of neural networks NF01BD Computing the Jacobian of a Wiener system NF01BP Finding the Levenberg-Marquardt parameter NF01BQ Solution of the linear system J*x = b, D*x = 0, D diagonal NF01BR Solution of the linear system op(R)*x = b, R block upper triangular stored in a compressed form NF01BS QR factorization of a structured Jacobian matrix NF01BU Computing J'*J + c*I, for the Jacobian J given in a compressed form NF01BV Computing J'*J + c*I, for a full Jacobian J (one output variable) NF01BW Matrix-vector product x <-- (J'*J + c*I)*x, for J in a compressed form NF01BX Matrix-vector product x <-- (A'*A + c*I)*x, for a full matrix A NF01BY Computing the Jacobian of the error function for a neural network (for one output variable)
SB01BX Choosing the closest real (complex conjugate) eigenvalue(s) to a given real (complex) value SB01BY Pole placement for systems of order 1 or 2 SB01FY Inner denominator of a right-coprime factorization of an unstable system of order 1 or 2
SB02MU Constructing the 2n-by-2n Hamiltonian or symplectic matrix for linear-quadratic optimization problems SB02RU Constructing the 2n-by-2n Hamiltonian or symplectic matrix for linear-quadratic optimization problems (efficient and accurate version of SB02MU) SB02OY Constructing and compressing the extended Hamiltonian or symplectic matrix pairs for linear-quadratic optimization problems
SB03MV Solving a discrete-time Lyapunov equation for a 2-by-2 matrix SB03MW Solving a continuous-time Lyapunov equation for a 2-by-2 matrix SB03MX Solving a discrete-time Lyapunov equation with matrix A quasi-triangular SB03MY Solving a continuous-time Lyapunov equation with matrix A quasi-triangular SB03OT Solving (for Cholesky factor) stable continuous- or discrete-time Lyapunov equations, with A quasi-triangular and R triangular SB03OS Solving (for Cholesky factor) stable continuous- or discrete-time complex Lyapunov equations, with matrices S and R triangular SB03OU Solving (for Cholesky factor) stable continuous- or discrete-time Lyapunov equations, with A in real Schur form and B rectangular SB03OY Solving (for Cholesky factor) stable 2-by-2 continuous- or discrete-time Lyapunov equations, with matrix A having complex conjugate eigenvalues SB03QX Forward error bound for continuous-time Lyapunov equations SB03QY Separation and Theta norm for continuous-time Lyapunov equations SB03SX Forward error bound for discrete-time Lyapunov equations SB03SY Separation and Theta norm for discrete-time Lyapunov equations
SB03MU Solving a discrete-time Sylvester equation for an m-by-n matrix X, 1 <= m,n <= 2 SB03OR Solving quasi-triangular continuous- or discrete-time Sylvester equations, for an n-by-m matrix X, 1 <= m <= 2 SB04MR Solving a linear algebraic system whose coefficient matrix (stored compactly) has zeros below the second subdiagonal SB04MU Constructing and solving a linear algebraic system whose coefficient matrix (stored compactly) has zeros below the second subdiagonal SB04MW Solving a linear algebraic system whose coefficient matrix (stored compactly) has zeros below the first subdiagonal SB04MY Constructing and solving a linear algebraic system whose coefficient matrix (stored compactly) has zeros below the first subdiagonal SB04NV Constructing right-hand sides for a system of equations in Hessenberg form solved via SB04NX SB04NW Constructing the right-hand side for a system of equations in Hessenberg form solved via SB04NY SB04NX Solving a system of equations in Hessenberg form with two consecutive offdiagonals and two right-hand sides SB04NY Solving a system of equations in Hessenberg form with one offdiagonal and one right-hand side SB04OW Solving a periodic Sylvester equation with matrices in periodic Schur form SB04PX Solving a discrete-time Sylvester equation for matrices of order <= 2 SB04PY Solving a discrete-time Sylvester equation with matrices in Schur form SB04QR Solving a linear algebraic system whose coefficient matrix (stored compactly) has zeros below the third subdiagonal SB04QU Constructing and solving a linear algebraic system whose coefficient matrix (stored compactly) has zeros below the third subdiagonal SB04QY Constructing and solving a linear algebraic system whose coefficient matrix (stored compactly) has zeros below the first subdiagonal (discrete-time case) SB04RV Constructing right-hand sides for a system of equations in Hessenberg form solved via SB04RX SB04RW Constructing the right-hand side for a system of equations in Hessenberg form solved via SB04RY SB04RX Solving a system of equations in Hessenberg form with two consecutive offdiagonals and two right-hand sides (discrete-time case) SB04RY Solving a system of equations in Hessenberg form with one offdiagonal and one right-hand side (discrete-time case)
SB10JD Conversion of a descriptor state-space system into regular state-space form SB10LD Closed-loop system matrices for a system with robust controller SB10PD Normalization of a system for H-infinity controller design SB10QD State feedback and output injection matrices for an H-infinity (sub)optimal state controller (continuous-time) SB10RD H-infinity (sub)optimal controller matrices using state feedback and output injection matrices (continuous-time) SB10SD H2 optimal controller matrices for a normalized discrete-time system SB10TD H2 optimal controller matrices for a discrete-time system SB10UD Normalization of a system for H2 controller design SB10VD State feedback and output injection matrices for an H2 optimal state controller (continuous-time) SB10WD H2 optimal controller matrices using state feedback and output injection matrices (continuous-time) SB10YD Fitting frequency response data with a stable, minimum phase SISO system SB10ZP Transforming a SISO system into a stable and minimum phase one
SB16AY Cholesky factors of the frequency-weighted controllability and observability Grammians for controller reduction SB16CY Cholesky factors of controllability and observability Grammians of coprime factors of a state-feedback controller
SG02CV Computation of residual matrix for a continuous-time or discrete-time reduced Lyapunov equation SG03AX Solving a generalized discrete-time Lyapunov equation with A quasi-triangular and E upper triangular SG03AY Solving a generalized continuous-time Lyapunov equation with A quasi-triangular and E upper triangular SG03BU Solving (for Cholesky factor) stable generalized discrete-time Lyapunov equations with A quasi-triangular, and E, B upper triangular SG03BS Solving (for Cholesky factor) stable generalized discrete-time complex Lyapunov equations with A, E, and B upper triangular SG03BV Solving (for Cholesky factor) stable generalized continuous-time Lyapunov equations with A quasi-triangular, and E, B upper triangular SG03BT Solving (for Cholesky factor) stable generalized continuous-time complex Lyapunov equations with A, E, and B upper triangular SG03BX Solving (for Cholesky factor) stable generalized 2-by-2 Lyapunov equations
SG03BW Solving a generalized Sylvester equation with A quasi-triangular and E upper triangular, for X m-by-n, n = 1 or 2
TB01KX Additive spectral decomposition of the transfer-function matrix of a standard system TB01UX Observable-unobservable decomposition of a standard system TB01VD Conversion of a discrete-time system to output normal form TB01VY Conversion of the output normal form of a discrete-time system to a state-space representation TB01XD Special similarity transformation of the dual state-space system TB01XZ Special similarity transformation of the dual state-space system (complex case) TB01YD Special similarity transformation of a state-space system
TB04BV Strictly proper part of a proper transfer function matrix TB04BW Sum of a rational matrix and a real matrix TB04BX Gain of a SISO linear system, given (A,b,c,d), its poles and zeros
TF01MX Output response of a linear discrete-time system, given a general system matrix (each output is a column of the result) TF01MY Output response of a linear discrete-time system, given the system matrices (each output is a column of the result)
TG01HU Staircase controllability representation of a multi-input descriptor system TG01HX Orthogonal reduction of a descriptor system to a system with the same transfer-function matrix and without uncontrollable finite eigenvalues TG01HY Orthogonal reduction of a descriptor system to a system with the same transfer-function matrix and without uncontrollable finite eigenvalues (blocked version) TG01KD Orthogonal equivalence transformation of a SISO descriptor system with E upper triangular (TG01OA version with more complex interface) TG01KZ Unitary equivalence transformation of a complex SISO descriptor system with E upper triangular (TG01OB version with more complex interface) TG01LY Finite-infinite decomposition of a structured descriptor system TG01NX Block-diagonal decomposition of a descriptor system in generalized real Schur form TG01OA Orthogonal equivalence transformation of a SISO descriptor system with E upper triangular, so that B becomes parallel to the first unit vector and E keeps its structure TG01OB Unitary equivalence transformation of a complex SISO descriptor system with E upper triangular, so that B becomes parallel to the first unit vector and E keeps its structure