BB03AD

Benchmark examples of (generalized) continuous-time Lyapunov equations

[Specification] [Arguments] [Method] [References] [Comments] [Example]

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
  None

Further Comments
  None
Example

Program Text

C     BB03AD EXAMPLE PROGRAM TEXT
C     Copyright (c) 2002-2017 NICONET e.V.
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
      END
Program Data
BB03AD EXAMPLE PROGRAM DATA
N
4 1
2
.15D1
.15D1
1
5
Program 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