LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
cdrvrf4.f
Go to the documentation of this file.
1 *> \brief \b CDRVRF4
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE CDRVRF4( NOUT, NN, NVAL, THRESH, C1, C2, LDC, CRF, A,
12 * + LDA, S_WORK_CLANGE )
13 *
14 * .. Scalar Arguments ..
15 * INTEGER LDA, LDC, NN, NOUT
16 * REAL THRESH
17 * ..
18 * .. Array Arguments ..
19 * INTEGER NVAL( NN )
20 * REAL S_WORK_CLANGE( * )
21 * COMPLEX A( LDA, * ), C1( LDC, * ), C2( LDC, *),
22 * + CRF( * )
23 * ..
24 *
25 *
26 *> \par Purpose:
27 * =============
28 *>
29 *> \verbatim
30 *>
31 *> CDRVRF4 tests the LAPACK RFP routines:
32 *> CHFRK
33 *> \endverbatim
34 *
35 * Arguments:
36 * ==========
37 *
38 *> \param[in] NOUT
39 *> \verbatim
40 *> NOUT is INTEGER
41 *> The unit number for output.
42 *> \endverbatim
43 *>
44 *> \param[in] NN
45 *> \verbatim
46 *> NN is INTEGER
47 *> The number of values of N contained in the vector NVAL.
48 *> \endverbatim
49 *>
50 *> \param[in] NVAL
51 *> \verbatim
52 *> NVAL is INTEGER array, dimension (NN)
53 *> The values of the matrix dimension N.
54 *> \endverbatim
55 *>
56 *> \param[in] THRESH
57 *> \verbatim
58 *> THRESH is REAL
59 *> The threshold value for the test ratios. A result is
60 *> included in the output file if RESULT >= THRESH. To have
61 *> every test ratio printed, use THRESH = 0.
62 *> \endverbatim
63 *>
64 *> \param[out] C1
65 *> \verbatim
66 *> C1 is COMPLEX array, dimension (LDC,NMAX)
67 *> \endverbatim
68 *>
69 *> \param[out] C2
70 *> \verbatim
71 *> C2 is COMPLEX array, dimension (LDC,NMAX)
72 *> \endverbatim
73 *>
74 *> \param[in] LDC
75 *> \verbatim
76 *> LDC is INTEGER
77 *> The leading dimension of the array A. LDA >= max(1,NMAX).
78 *> \endverbatim
79 *>
80 *> \param[out] CRF
81 *> \verbatim
82 *> CRF is COMPLEX array, dimension ((NMAX*(NMAX+1))/2).
83 *> \endverbatim
84 *>
85 *> \param[out] A
86 *> \verbatim
87 *> A is COMPLEX array, dimension (LDA,NMAX)
88 *> \endverbatim
89 *>
90 *> \param[in] LDA
91 *> \verbatim
92 *> LDA is INTEGER
93 *> The leading dimension of the array A. LDA >= max(1,NMAX).
94 *> \endverbatim
95 *>
96 *> \param[out] S_WORK_CLANGE
97 *> \verbatim
98 *> S_WORK_CLANGE is REAL array, dimension (NMAX)
99 *> \endverbatim
100 *
101 * Authors:
102 * ========
103 *
104 *> \author Univ. of Tennessee
105 *> \author Univ. of California Berkeley
106 *> \author Univ. of Colorado Denver
107 *> \author NAG Ltd.
108 *
109 *> \date November 2011
110 *
111 *> \ingroup complex_lin
112 *
113 * =====================================================================
114  SUBROUTINE cdrvrf4( NOUT, NN, NVAL, THRESH, C1, C2, LDC, CRF, A,
115  + lda, s_work_clange )
116 *
117 * -- LAPACK test routine (version 3.4.0) --
118 * -- LAPACK is a software package provided by Univ. of Tennessee, --
119 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
120 * November 2011
121 *
122 * .. Scalar Arguments ..
123  INTEGER LDA, LDC, NN, NOUT
124  REAL THRESH
125 * ..
126 * .. Array Arguments ..
127  INTEGER NVAL( nn )
128  REAL S_WORK_CLANGE( * )
129  COMPLEX A( lda, * ), C1( ldc, * ), C2( ldc, *),
130  + crf( * )
131 * ..
132 *
133 * =====================================================================
134 * ..
135 * .. Parameters ..
136  REAL ZERO, ONE
137  parameter ( zero = 0.0e+0, one = 1.0e+0 )
138  INTEGER NTESTS
139  parameter ( ntests = 1 )
140 * ..
141 * .. Local Scalars ..
142  CHARACTER UPLO, CFORM, TRANS
143  INTEGER I, IFORM, IIK, IIN, INFO, IUPLO, J, K, N,
144  + nfail, nrun, ialpha, itrans
145  REAL ALPHA, BETA, EPS, NORMA, NORMC
146 * ..
147 * .. Local Arrays ..
148  CHARACTER UPLOS( 2 ), FORMS( 2 ), TRANSS( 2 )
149  INTEGER ISEED( 4 ), ISEEDY( 4 )
150  REAL RESULT( ntests )
151 * ..
152 * .. External Functions ..
153  REAL SLAMCH, SLARND, CLANGE
154  COMPLEX CLARND
155  EXTERNAL slamch, slarnd, clange, clarnd
156 * ..
157 * .. External Subroutines ..
158  EXTERNAL cherk, chfrk, ctfttr, ctrttf
159 * ..
160 * .. Intrinsic Functions ..
161  INTRINSIC abs, max
162 * ..
163 * .. Scalars in Common ..
164  CHARACTER*32 SRNAMT
165 * ..
166 * .. Common blocks ..
167  COMMON / srnamc / srnamt
168 * ..
169 * .. Data statements ..
170  DATA iseedy / 1988, 1989, 1990, 1991 /
171  DATA uplos / 'U', 'L' /
172  DATA forms / 'N', 'C' /
173  DATA transs / 'N', 'C' /
174 * ..
175 * .. Executable Statements ..
176 *
177 * Initialize constants and the random number seed.
178 *
179  nrun = 0
180  nfail = 0
181  info = 0
182  DO 10 i = 1, 4
183  iseed( i ) = iseedy( i )
184  10 CONTINUE
185  eps = slamch( 'Precision' )
186 *
187  DO 150 iin = 1, nn
188 *
189  n = nval( iin )
190 *
191  DO 140 iik = 1, nn
192 *
193  k = nval( iin )
194 *
195  DO 130 iform = 1, 2
196 *
197  cform = forms( iform )
198 *
199  DO 120 iuplo = 1, 2
200 *
201  uplo = uplos( iuplo )
202 *
203  DO 110 itrans = 1, 2
204 *
205  trans = transs( itrans )
206 *
207  DO 100 ialpha = 1, 4
208 *
209  IF ( ialpha.EQ. 1) THEN
210  alpha = zero
211  beta = zero
212  ELSE IF ( ialpha.EQ. 1) THEN
213  alpha = one
214  beta = zero
215  ELSE IF ( ialpha.EQ. 1) THEN
216  alpha = zero
217  beta = one
218  ELSE
219  alpha = slarnd( 2, iseed )
220  beta = slarnd( 2, iseed )
221  END IF
222 *
223 * All the parameters are set:
224 * CFORM, UPLO, TRANS, M, N,
225 * ALPHA, and BETA
226 * READY TO TEST!
227 *
228  nrun = nrun + 1
229 *
230  IF ( itrans.EQ.1 ) THEN
231 *
232 * In this case we are NOTRANS, so A is N-by-K
233 *
234  DO j = 1, k
235  DO i = 1, n
236  a( i, j) = clarnd( 4, iseed )
237  END DO
238  END DO
239 *
240  norma = clange( 'I', n, k, a, lda,
241  + s_work_clange )
242 *
243  ELSE
244 *
245 * In this case we are TRANS, so A is K-by-N
246 *
247  DO j = 1,n
248  DO i = 1, k
249  a( i, j) = clarnd( 4, iseed )
250  END DO
251  END DO
252 *
253  norma = clange( 'I', k, n, a, lda,
254  + s_work_clange )
255 *
256  END IF
257 *
258 *
259 * Generate C1 our N--by--N Hermitian matrix.
260 * Make sure C2 has the same upper/lower part,
261 * (the one that we do not touch), so
262 * copy the initial C1 in C2 in it.
263 *
264  DO j = 1, n
265  DO i = 1, n
266  c1( i, j) = clarnd( 4, iseed )
267  c2(i,j) = c1(i,j)
268  END DO
269  END DO
270 *
271 * (See comment later on for why we use CLANGE and
272 * not CLANHE for C1.)
273 *
274  normc = clange( 'I', n, n, c1, ldc,
275  + s_work_clange )
276 *
277  srnamt = 'CTRTTF'
278  CALL ctrttf( cform, uplo, n, c1, ldc, crf,
279  + info )
280 *
281 * call zherk the BLAS routine -> gives C1
282 *
283  srnamt = 'CHERK '
284  CALL cherk( uplo, trans, n, k, alpha, a, lda,
285  + beta, c1, ldc )
286 *
287 * call zhfrk the RFP routine -> gives CRF
288 *
289  srnamt = 'CHFRK '
290  CALL chfrk( cform, uplo, trans, n, k, alpha, a,
291  + lda, beta, crf )
292 *
293 * convert CRF in full format -> gives C2
294 *
295  srnamt = 'CTFTTR'
296  CALL ctfttr( cform, uplo, n, crf, c2, ldc,
297  + info )
298 *
299 * compare C1 and C2
300 *
301  DO j = 1, n
302  DO i = 1, n
303  c1(i,j) = c1(i,j)-c2(i,j)
304  END DO
305  END DO
306 *
307 * Yes, C1 is Hermitian so we could call CLANHE,
308 * but we want to check the upper part that is
309 * supposed to be unchanged and the diagonal that
310 * is supposed to be real -> CLANGE
311 *
312  result(1) = clange( 'I', n, n, c1, ldc,
313  + s_work_clange )
314  result(1) = result(1)
315  + / max( abs( alpha ) * norma * norma
316  + + abs( beta ) * normc, one )
317  + / max( n , 1 ) / eps
318 *
319  IF( result(1).GE.thresh ) THEN
320  IF( nfail.EQ.0 ) THEN
321  WRITE( nout, * )
322  WRITE( nout, fmt = 9999 )
323  END IF
324  WRITE( nout, fmt = 9997 ) 'CHFRK',
325  + cform, uplo, trans, n, k, result(1)
326  nfail = nfail + 1
327  END IF
328 *
329  100 CONTINUE
330  110 CONTINUE
331  120 CONTINUE
332  130 CONTINUE
333  140 CONTINUE
334  150 CONTINUE
335 *
336 * Print a summary of the results.
337 *
338  IF ( nfail.EQ.0 ) THEN
339  WRITE( nout, fmt = 9996 ) 'CHFRK', nrun
340  ELSE
341  WRITE( nout, fmt = 9995 ) 'CHFRK', nfail, nrun
342  END IF
343 *
344  9999 FORMAT( 1x, ' *** Error(s) or Failure(s) while testing CHFRK
345  + ***')
346  9997 FORMAT( 1x, ' Failure in ',a5,', CFORM=''',a1,''',',
347  + ' UPLO=''',a1,''',',' TRANS=''',a1,''',', ' N=',i3,', K =', i3,
348  + ', test=',g12.5)
349  9996 FORMAT( 1x, 'All tests for ',a5,' auxiliary routine passed the ',
350  + 'threshold ( ',i5,' tests run)')
351  9995 FORMAT( 1x, a6, ' auxiliary routine: ',i5,' out of ',i5,
352  + ' tests failed to pass the threshold')
353 *
354  RETURN
355 *
356 * End of CDRVRF4
357 *
358  END
subroutine cdrvrf4(NOUT, NN, NVAL, THRESH, C1, C2, LDC, CRF, A, LDA, S_WORK_CLANGE)
CDRVRF4
Definition: cdrvrf4.f:116
subroutine cherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
CHERK
Definition: cherk.f:175
subroutine ctfttr(TRANSR, UPLO, N, ARF, A, LDA, INFO)
CTFTTR copies a triangular matrix from the rectangular full packed format (TF) to the standard full f...
Definition: ctfttr.f:218
subroutine chfrk(TRANSR, UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C)
CHFRK performs a Hermitian rank-k operation for matrix in RFP format.
Definition: chfrk.f:170
subroutine ctrttf(TRANSR, UPLO, N, A, LDA, ARF, INFO)
CTRTTF copies a triangular matrix from the standard full format (TR) to the rectangular full packed f...
Definition: ctrttf.f:218