## UD01ND

### Printing a matrix polynomial

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

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

      None

Example

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)
          END

Program 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-00

Program 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