1      SUBROUTINE STIMPP( LINE, NN, NVAL, NNS, NSVAL, LA, TIMMIN, A, B,
2     $                   IWORK, RESLTS, LDR1, LDR2, LDR3, NOUT )
3*
4*  -- LAPACK timing routine (version 3.0) --
5*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
6*     Courant Institute, Argonne National Lab, and Rice University
7*     March 31, 1993
8*
9*     .. Scalar Arguments ..
10      CHARACTER*80       LINE
11      INTEGER            LA, LDR1, LDR2, LDR3, NN, NNS, NOUT
12      REAL               TIMMIN
13*     ..
14*     .. Array Arguments ..
15      INTEGER            IWORK( * ), NSVAL( * ), NVAL( * )
16      REAL               A( * ), B( * ), RESLTS( LDR1, LDR2, LDR3, * )
17*     ..
18*
19*  Purpose
20*  =======
21*
22*  STIMPP times SPPTRF, -TRS, and -TRI.
23*
24*  Arguments
25*  =========
26*
27*  LINE    (input) CHARACTER*80
28*          The input line that requested this routine.  The first six
29*          characters contain either the name of a subroutine or a
30*          generic path name.  The remaining characters may be used to
31*          specify the individual routines to be timed.  See ATIMIN for
32*          a full description of the format of the input line.
33*
34*  NN      (input) INTEGER
35*          The number of values of N contained in the vector NVAL.
36*
37*  NVAL    (input) INTEGER array, dimension (NN)
38*          The values of the matrix size N.
39*
40*  NNS     (input) INTEGER
41*          The number of values of NRHS contained in the vector NSVAL.
42*
43*  NSVAL   (input) INTEGER array, dimension (NNS)
44*          The values of the number of right hand sides NRHS.
45*
46*  LA      (input) INTEGER
47*          The size of the arrays A, B, and C.
48*
49*  TIMMIN  (input) REAL
50*          The minimum time a subroutine will be timed.
51*
52*  A       (workspace) REAL array, dimension (LA)
53*
54*  B       (workspace) REAL array, dimension (LA)
55*
56*  IWORK   (workspace) INTEGER array, dimension (NMAX)
57*          where NMAX is the maximum value of N permitted.
58*
59*  RESLTS  (output) REAL array, dimension
60*                   (LDR1,LDR2,LDR3,NSUBS)
61*          The timing results for each subroutine over the relevant
62*          values of N.
63*
64*  LDR1    (input) INTEGER
65*          The first dimension of RESLTS.  LDR1 >= max(4,NNB).
66*
67*  LDR2    (input) INTEGER
68*          The second dimension of RESLTS.  LDR2 >= max(1,NN).
69*
70*  LDR3    (input) INTEGER
71*          The third dimension of RESLTS.  LDR3 >= 2.
72*
73*  NOUT    (input) INTEGER
74*          The unit number for output.
75*
76*  =====================================================================
77*
78*     .. Parameters ..
79      INTEGER            NSUBS
80      PARAMETER          ( NSUBS = 3 )
81*     ..
82*     .. Local Scalars ..
83      CHARACTER          UPLO
84      CHARACTER*3        PATH
85      CHARACTER*6        CNAME
86      INTEGER            I, IC, ICL, IN, INFO, ISUB, IUPLO, LDA, LDB,
87     $                   MAT, N, NRHS
88      REAL               OPS, S1, S2, TIME, UNTIME
89*     ..
90*     .. Local Arrays ..
91      LOGICAL            TIMSUB( NSUBS )
92      CHARACTER          UPLOS( 2 )
93      CHARACTER*6        SUBNAM( NSUBS )
94      INTEGER            LAVAL( 1 )
95*     ..
96*     .. External Functions ..
97      LOGICAL            LSAME
98      REAL               SECOND, SMFLOP, SOPLA
99      EXTERNAL           LSAME, SECOND, SMFLOP, SOPLA
100*     ..
101*     .. External Subroutines ..
102      EXTERNAL           ATIMCK, ATIMIN, SCOPY, SPPTRF, SPPTRI, SPPTRS,
103     $                   SPRTBL, STIMMG
104*     ..
105*     .. Intrinsic Functions ..
106      INTRINSIC          MOD, REAL
107*     ..
108*     .. Data statements ..
109      DATA               UPLOS / 'U', 'L' /
110      DATA               SUBNAM / 'SPPTRF', 'SPPTRS', 'SPPTRI' /
111*     ..
112*     .. Executable Statements ..
113*
114*     Extract the timing request from the input line.
115*
116      PATH( 1: 1 ) = 'Single precision'
117      PATH( 2: 3 ) = 'PP'
118      CALL ATIMIN( PATH, LINE, NSUBS, SUBNAM, TIMSUB, NOUT, INFO )
119      IF( INFO.NE.0 )
120     $   GO TO 120
121*
122*     Check that N*(N+1)/2 <= LA for the input values.
123*
124      CNAME = LINE( 1: 6 )
125      LAVAL( 1 ) = LA
126      CALL ATIMCK( 4, CNAME, NN, NVAL, 1, LAVAL, NOUT, INFO )
127      IF( INFO.GT.0 ) THEN
128         WRITE( NOUT, FMT = 9999 )CNAME
129         GO TO 120
130      END IF
131*
132*     Do first for UPLO = 'U', then for UPLO = 'L'
133*
134      DO 90 IUPLO = 1, 2
135         UPLO = UPLOS( IUPLO )
136         IF( LSAME( UPLO, 'U' ) ) THEN
137            MAT = 4
138         ELSE
139            MAT = -4
140         END IF
141*
142*        Do for each value of N in NVAL.
143*
144         DO 80 IN = 1, NN
145            N = NVAL( IN )
146            LDA = N*( N+1 ) / 2
147*
148*           Time SPPTRF
149*
150            IF( TIMSUB( 1 ) ) THEN
151               CALL STIMMG( MAT, N, N, A, LDA, 0, 0 )
152               IC = 0
153               S1 = SECOND( )
154   10          CONTINUE
155               CALL SPPTRF( UPLO, N, A, INFO )
156               S2 = SECOND( )
157               TIME = S2 - S1
158               IC = IC + 1
159               IF( TIME.LT.TIMMIN ) THEN
160                  CALL STIMMG( MAT, N, N, A, LDA, 0, 0 )
161                  GO TO 10
162               END IF
163*
164*              Subtract the time used in STIMMG.
165*
166               ICL = 1
167               S1 = SECOND( )
168   20          CONTINUE
169               S2 = SECOND( )
170               UNTIME = S2 - S1
171               ICL = ICL + 1
172               IF( ICL.LE.IC ) THEN
173                  CALL STIMMG( MAT, N, N, A, LDA, 0, 0 )
174                  GO TO 20
175               END IF
176*
177               TIME = ( TIME-UNTIME ) / REAL( IC )
178               OPS = SOPLA( 'SPPTRF', N, N, 0, 0, 0 )
179               RESLTS( 1, IN, IUPLO, 1 ) = SMFLOP( OPS, TIME, INFO )
180*
181            ELSE
182               IC = 0
183               CALL STIMMG( MAT, N, N, A, LDA, 0, 0 )
184            END IF
185*
186*           Generate another matrix and factor it using SPPTRF so
187*           that the factored form can be used in timing the other
188*           routines.
189*
190            IF( IC.NE.1 )
191     $         CALL SPPTRF( UPLO, N, A, INFO )
192*
193*           Time SPPTRI
194*
195            IF( TIMSUB( 3 ) ) THEN
196               CALL SCOPY( LDA, A, 1, B, 1 )
197               IC = 0
198               S1 = SECOND( )
199   30          CONTINUE
200               CALL SPPTRI( UPLO, N, B, INFO )
201               S2 = SECOND( )
202               TIME = S2 - S1
203               IC = IC + 1
204               IF( TIME.LT.TIMMIN ) THEN
205                  CALL SCOPY( LDA, A, 1, B, 1 )
206                  GO TO 30
207               END IF
208*
209*              Subtract the time used in SLACPY.
210*
211               ICL = 1
212               S1 = SECOND( )
213   40          CONTINUE
214               S2 = SECOND( )
215               UNTIME = S2 - S1
216               ICL = ICL + 1
217               IF( ICL.LE.IC ) THEN
218                  CALL SCOPY( LDA, A, 1, B, 1 )
219                  GO TO 40
220               END IF
221*
222               TIME = ( TIME-UNTIME ) / REAL( IC )
223               OPS = SOPLA( 'SPPTRI', N, N, 0, 0, 0 )
224               RESLTS( 1, IN, IUPLO, 3 ) = SMFLOP( OPS, TIME, INFO )
225            END IF
226*
227*           Time SPPTRS
228*
229            IF( TIMSUB( 2 ) ) THEN
230               DO 70 I = 1, NNS
231                  NRHS = NSVAL( I )
232                  LDB = N
233                  IF( MOD( LDB, 2 ).EQ.0 )
234     $               LDB = LDB + 1
235                  CALL STIMMG( 0, N, NRHS, B, LDB, 0, 0 )
236                  IC = 0
237                  S1 = SECOND( )
238   50             CONTINUE
239                  CALL SPPTRS( UPLO, N, NRHS, A, B, LDB, INFO )
240                  S2 = SECOND( )
241                  TIME = S2 - S1
242                  IC = IC + 1
243                  IF( TIME.LT.TIMMIN ) THEN
244                     CALL STIMMG( 0, N, NRHS, B, LDB, 0, 0 )
245                     GO TO 50
246                  END IF
247*
248*                 Subtract the time used in STIMMG.
249*
250                  ICL = 1
251                  S1 = SECOND( )
252   60             CONTINUE
253                  S2 = SECOND( )
254                  UNTIME = S2 - S1
255                  ICL = ICL + 1
256                  IF( ICL.LE.IC ) THEN
257                     CALL STIMMG( 0, N, NRHS, B, LDB, 0, 0 )
258                     GO TO 60
259                  END IF
260*
261                  TIME = ( TIME-UNTIME ) / REAL( IC )
262                  OPS = SOPLA( 'SPPTRS', N, NRHS, 0, 0, 0 )
263                  RESLTS( I, IN, IUPLO, 2 ) = SMFLOP( OPS, TIME, INFO )
264   70          CONTINUE
265            END IF
266   80    CONTINUE
267   90 CONTINUE
268*
269*     Print tables of results for each timed routine.
270*
271      DO 110 ISUB = 1, NSUBS
272         IF( .NOT.TIMSUB( ISUB ) )
273     $      GO TO 110
274         WRITE( NOUT, FMT = 9998 )SUBNAM( ISUB )
275         DO 100 IUPLO = 1, 2
276            WRITE( NOUT, FMT = 9997 )SUBNAM( ISUB ), UPLOS( IUPLO )
277            IF( ISUB.EQ.1 ) THEN
278               CALL SPRTBL( ' ', 'N', 1, LAVAL, NN, NVAL, 1,
279     $                      RESLTS( 1, 1, IUPLO, 1 ), LDR1, LDR2, NOUT )
280            ELSE IF( ISUB.EQ.2 ) THEN
281               CALL SPRTBL( 'NRHS', 'N', NNS, NSVAL, NN, NVAL, 1,
282     $                      RESLTS( 1, 1, IUPLO, 2 ), LDR1, LDR2, NOUT )
283            ELSE IF( ISUB.EQ.3 ) THEN
284               CALL SPRTBL( ' ', 'N', 1, LAVAL, NN, NVAL, 1,
285     $                      RESLTS( 1, 1, IUPLO, 3 ), LDR1, LDR2, NOUT )
286            END IF
287  100    CONTINUE
288  110 CONTINUE
289  120 CONTINUE
290 9999 FORMAT( 1X, A6, ' timing run not attempted', / )
291 9998 FORMAT( / ' *** Speed of ', A6, ' in megaflops ***', / )
292 9997 FORMAT( 5X, A6, ' with UPLO = ''', A1, '''', / )
293      RETURN
294*
295*     End of STIMPP
296*
297      END
298