File: UD01CD.html

package info (click to toggle)
slicot 5.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,528 kB
  • sloc: fortran: 148,076; makefile: 964; sh: 57
file content (224 lines) | stat: -rw-r--r-- 7,121 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<HTML>
<HEAD><TITLE>UD01CD - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>

<H2><A Name="UD01CD">UD01CD</A></H2>
<H3>
Reading a sparse matrix polynomial
</H3>
<A HREF ="#Specification"><B>[Specification]</B></A>
<A HREF ="#Arguments"><B>[Arguments]</B></A>
<A HREF ="#Method"><B>[Method]</B></A>
<A HREF ="#References"><B>[References]</B></A>
<A HREF ="#Comments"><B>[Comments]</B></A>
<A HREF ="#Example"><B>[Example]</B></A>

<P>
<B><FONT SIZE="+1">Purpose</FONT></B>
<PRE>
  To 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  .

</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
      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,*)

</PRE>
<A name="Arguments"><B><FONT SIZE="+1">Arguments</FONT></B></A>
<P>

</PRE>
<B>Input/Output Parameters</B>
<PRE>
  MP      (input) INTEGER
          The number of rows of the matrix polynomial P(s).
          MP &gt;= 1.

  NP      (input) INTEGER
          The number of columns of the matrix polynomial P(s).
          NP &gt;= 1.

  DP      (input) INTEGER
          The degree of the matrix polynomial P(s).  DP &gt;= 0.

  NIN     (input) INTEGER
          The input channel from which the elements of P(s) are
          read.  NIN &gt;= 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 &gt;= MP.

  LDP2    INTEGER
          The second dimension of array P.  LDP2 &gt;= NP.

</PRE>
<B>Error Indicator</B>
<PRE>
  INFO    INTEGER
          = 0:  successful exit;
          &lt; 0:  if INFO = -i, the i-th argument had an illegal
                value;
          = 1 : if a row index i is read with i &lt; 1 or i &gt; MP or
                a column index j is read with j &lt; 1 or j &gt; NP or
                a coefficient degree d is read with d &lt; 0 or
                d &gt; DP + 1. This is a warning.

</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
  First, the elements P(i,j,k) with 1 &lt;= i &lt;= MP, 1 &lt;= j &lt;= NP and
  1 &lt;= k &lt;= 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.

</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
  None.

</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE>
  None.

</PRE>

<A name="Comments"><B><FONT SIZE="+1">Further Comments</FONT></B></A>
<PRE>
  None
</PRE>

<A name="Example"><B><FONT SIZE="+1">Example</FONT></B></A>
<P>
<B>Program Text</B>
<PRE>
*     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)
      END
</PRE>
<B>Program Data</B>
<PRE>
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.0
</PRE>
<B>Program Results</B>
<PRE>
 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
 
</PRE>

<HR>
<p>
<A HREF=..\libindex.html><B>Return to index</B></A></BODY>
</HTML>