LAPACK  3.7.0
LAPACK: Linear Algebra PACKage
clqt05.f
Go to the documentation of this file.
1 *> \brief \b CLQT05
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 CLQT05(M,N,L,NB,RESULT)
12 *
13 * .. Scalar Arguments ..
14 * INTEGER LWORK, M, N, L, NB, LDT
15 * .. Return values ..
16 * DOUBLE PRECISION RESULT(6)
17 *
18 *
19 *> \par Purpose:
20 * =============
21 *>
22 *> \verbatim
23 *>
24 *> CQRT05 tests CTPLQT and CTPMLQT.
25 *> \endverbatim
26 *
27 * Arguments:
28 * ==========
29 *
30 *> \param[in] M
31 *> \verbatim
32 *> M is INTEGER
33 *> Number of rows in lower part of the test matrix.
34 *> \endverbatim
35 *>
36 *> \param[in] N
37 *> \verbatim
38 *> N is INTEGER
39 *> Number of columns in test matrix.
40 *> \endverbatim
41 *>
42 *> \param[in] L
43 *> \verbatim
44 *> L is INTEGER
45 *> The number of rows of the upper trapezoidal part the
46 *> lower test matrix. 0 <= L <= M.
47 *> \endverbatim
48 *>
49 *> \param[in] NB
50 *> \verbatim
51 *> NB is INTEGER
52 *> Block size of test matrix. NB <= N.
53 *> \endverbatim
54 *>
55 *> \param[out] RESULT
56 *> \verbatim
57 *> RESULT is DOUBLE PRECISION array, dimension (6)
58 *> Results of each of the six tests below.
59 *>
60 *> RESULT(1) = | A - Q R |
61 *> RESULT(2) = | I - Q^H Q |
62 *> RESULT(3) = | Q C - Q C |
63 *> RESULT(4) = | Q^H C - Q^H C |
64 *> RESULT(5) = | C Q - C Q |
65 *> RESULT(6) = | C Q^H - C Q^H |
66 *> \endverbatim
67 *
68 * Authors:
69 * ========
70 *
71 *> \author Univ. of Tennessee
72 *> \author Univ. of California Berkeley
73 *> \author Univ. of Colorado Denver
74 *> \author NAG Ltd.
75 *
76 *> \date April 2012
77 *
78 *> \ingroup double_lin
79 *
80 * =====================================================================
81  SUBROUTINE clqt05(M,N,L,NB,RESULT)
82  IMPLICIT NONE
83 *
84 * -- LAPACK test routine (version 3.7.0) --
85 * -- LAPACK is a software package provided by Univ. of Tennessee, --
86 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
87 * April 2012
88 *
89 * .. Scalar Arguments ..
90  INTEGER LWORK, M, N, L, NB, LDT
91 * .. Return values ..
92  REAL RESULT(6)
93 *
94 * =====================================================================
95 *
96 * ..
97 * .. Local allocatable arrays
98  COMPLEX, ALLOCATABLE :: AF(:,:), Q(:,:),
99  $ r(:,:), rwork(:), work( : ), t(:,:),
100  $ cf(:,:), df(:,:), a(:,:), c(:,:), d(:,:)
101 *
102 * .. Parameters ..
103  REAL ZERO
104  COMPLEX ONE, CZERO
105  parameter( zero = 0.0, one = (1.0,0.0), czero=(0.0,0.0) )
106 * ..
107 * .. Local Scalars ..
108  INTEGER INFO, J, K, N2, NP1,i
109  REAL ANORM, EPS, RESID, CNORM, DNORM
110 * ..
111 * .. Local Arrays ..
112  INTEGER ISEED( 4 )
113 * ..
114 * .. External Functions ..
115  REAL SLAMCH
116  REAL CLANGE, CLANSY
117  LOGICAL LSAME
118  EXTERNAL slamch, clange, clansy, lsame
119 * ..
120 * .. Data statements ..
121  DATA iseed / 1988, 1989, 1990, 1991 /
122 *
123  eps = slamch( 'Epsilon' )
124  k = m
125  n2 = m+n
126  IF( n.GT.0 ) THEN
127  np1 = m+1
128  ELSE
129  np1 = 1
130  END IF
131  lwork = n2*n2*nb
132 *
133 * Dynamically allocate all arrays
134 *
135  ALLOCATE(a(m,n2),af(m,n2),q(n2,n2),r(n2,n2),rwork(n2),
136  $ work(lwork),t(nb,m),c(n2,m),cf(n2,m),
137  $ d(m,n2),df(m,n2) )
138 *
139 * Put random stuff into A
140 *
141  ldt=nb
142  CALL claset( 'Full', m, n2, czero, czero, a, m )
143  CALL claset( 'Full', nb, m, czero, czero, t, nb )
144  DO j=1,m
145  CALL clarnv( 2, iseed, m-j+1, a( j, j ) )
146  END DO
147  IF( n.GT.0 ) THEN
148  DO j=1,n-l
149  CALL clarnv( 2, iseed, m, a( 1, min(n+m,m+1) + j - 1 ) )
150  END DO
151  END IF
152  IF( l.GT.0 ) THEN
153  DO j=1,l
154  CALL clarnv( 2, iseed, m-j+1, a( j, min(n+m,n+m-l+1)
155  $ + j - 1 ) )
156  END DO
157  END IF
158 *
159 * Copy the matrix A to the array AF.
160 *
161  CALL clacpy( 'Full', m, n2, a, m, af, m )
162 *
163 * Factor the matrix A in the array AF.
164 *
165  CALL ctplqt( m,n,l,nb,af,m,af(1,np1),m,t,ldt,work,info)
166 *
167 * Generate the (M+N)-by-(M+N) matrix Q by applying H to I
168 *
169  CALL claset( 'Full', n2, n2, czero, one, q, n2 )
170  CALL cgemlqt( 'L', 'N', n2, n2, k, nb, af, m, t, ldt, q, n2,
171  $ work, info )
172 *
173 * Copy L
174 *
175  CALL claset( 'Full', n2, n2, czero, czero, r, n2 )
176  CALL clacpy( 'Lower', m, n2, af, m, r, n2 )
177 *
178 * Compute |L - A*Q*C| / |A| and store in RESULT(1)
179 *
180  CALL cgemm( 'N', 'C', m, n2, n2, -one, a, m, q, n2, one, r, n2)
181  anorm = clange( '1', m, n2, a, m, rwork )
182  resid = clange( '1', m, n2, r, n2, rwork )
183  IF( anorm.GT.zero ) THEN
184  result( 1 ) = resid / (eps*anorm*max(1,n2))
185  ELSE
186  result( 1 ) = zero
187  END IF
188 *
189 * Compute |I - Q*Q'| and store in RESULT(2)
190 *
191  CALL claset( 'Full', n2, n2, czero, one, r, n2 )
192  CALL cherk( 'U', 'N', n2, n2, REAL(-ONE), Q, N2, REAL(ONE),
193  $ r, n2 )
194  resid = clansy( '1', 'Upper', n2, r, n2, rwork )
195  result( 2 ) = resid / (eps*max(1,n2))
196 *
197 * Generate random m-by-n matrix C and a copy CF
198 *
199  CALL claset( 'Full', n2, m, czero, one, c, n2 )
200  DO j=1,m
201  CALL clarnv( 2, iseed, n2, c( 1, j ) )
202  END DO
203  cnorm = clange( '1', n2, m, c, n2, rwork)
204  CALL clacpy( 'Full', n2, m, c, n2, cf, n2 )
205 *
206 * Apply Q to C as Q*C
207 *
208  CALL ctpmlqt( 'L','N', n,m,k,l,nb,af(1, np1),m,t,ldt,cf,n2,
209  $ cf(np1,1),n2,work,info)
210 *
211 * Compute |Q*C - Q*C| / |C|
212 *
213  CALL cgemm( 'N', 'N', n2, m, n2, -one, q, n2, c, n2, one, cf, n2 )
214  resid = clange( '1', n2, m, cf, n2, rwork )
215  IF( cnorm.GT.zero ) THEN
216  result( 3 ) = resid / (eps*max(1,n2)*cnorm)
217  ELSE
218  result( 3 ) = zero
219  END IF
220 
221 *
222 * Copy C into CF again
223 *
224  CALL clacpy( 'Full', n2, m, c, n2, cf, n2 )
225 *
226 * Apply Q to C as QT*C
227 *
228  CALL ctpmlqt( 'L','C',n,m,k,l,nb,af(1,np1),m,t,ldt,cf,n2,
229  $ cf(np1,1),n2,work,info)
230 *
231 * Compute |QT*C - QT*C| / |C|
232 *
233  CALL cgemm('C','N',n2,m,n2,-one,q,n2,c,n2,one,cf,n2)
234  resid = clange( '1', n2, m, cf, n2, rwork )
235 
236  IF( cnorm.GT.zero ) THEN
237  result( 4 ) = resid / (eps*max(1,n2)*cnorm)
238  ELSE
239  result( 4 ) = zero
240  END IF
241 *
242 * Generate random m-by-n matrix D and a copy DF
243 *
244  DO j=1,n2
245  CALL clarnv( 2, iseed, m, d( 1, j ) )
246  END DO
247  dnorm = clange( '1', m, n2, d, m, rwork)
248  CALL clacpy( 'Full', m, n2, d, m, df, m )
249 *
250 * Apply Q to D as D*Q
251 *
252  CALL ctpmlqt('R','N',m,n,k,l,nb,af(1,np1),m,t,ldt,df,m,
253  $ df(1,np1),m,work,info)
254 *
255 * Compute |D*Q - D*Q| / |D|
256 *
257  CALL cgemm('N','N',m,n2,n2,-one,d,m,q,n2,one,df,m)
258  resid = clange('1',m, n2,df,m,rwork )
259  IF( cnorm.GT.zero ) THEN
260  result( 5 ) = resid / (eps*max(1,n2)*dnorm)
261  ELSE
262  result( 5 ) = zero
263  END IF
264 *
265 * Copy D into DF again
266 *
267  CALL clacpy('Full',m,n2,d,m,df,m )
268 *
269 * Apply Q to D as D*QT
270 *
271  CALL ctpmlqt('R','C',m,n,k,l,nb,af(1,np1),m,t,ldt,df,m,
272  $ df(1,np1),m,work,info)
273 
274 *
275 * Compute |D*QT - D*QT| / |D|
276 *
277  CALL cgemm( 'N', 'C', m, n2, n2, -one, d, m, q, n2, one, df, m )
278  resid = clange( '1', m, n2, df, m, rwork )
279  IF( cnorm.GT.zero ) THEN
280  result( 6 ) = resid / (eps*max(1,n2)*dnorm)
281  ELSE
282  result( 6 ) = zero
283  END IF
284 *
285 * Deallocate all arrays
286 *
287  DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
288  RETURN
289  END
subroutine ctpmlqt(SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT, A, LDA, B, LDB, WORK, INFO)
Definition: ctpmlqt.f:201
subroutine ctplqt(M, N, L, MB, A, LDA, B, LDB, T, LDT, WORK, INFO)
Definition: ctplqt.f:174
subroutine claset(UPLO, M, N, ALPHA, BETA, A, LDA)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: claset.f:108
subroutine clarnv(IDIST, ISEED, N, X)
CLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition: clarnv.f:101
subroutine cherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
CHERK
Definition: cherk.f:175
subroutine clqt05(M, N, L, NB, RESULT)
CLQT05
Definition: clqt05.f:82
subroutine cgemlqt(SIDE, TRANS, M, N, K, MB, V, LDV, T, LDT, C, LDC, WORK, INFO)
Definition: cgemlqt.f:153
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:105
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:189