LAPACK 3.12.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches
dlqt05.f
Go to the documentation of this file.
1*> \brief \b DLQT05
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 DLQT05(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*> DQRT05 tests DTPLQT and DTPMLQT.
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*> \ingroup double_lin
77*
78* =====================================================================
79 SUBROUTINE dlqt05(M,N,L,NB,RESULT)
80 IMPLICIT NONE
81*
82* -- LAPACK test routine --
83* -- LAPACK is a software package provided by Univ. of Tennessee, --
84* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
85*
86* .. Scalar Arguments ..
87 INTEGER LWORK, M, N, L, NB, LDT
88* .. Return values ..
89 DOUBLE PRECISION RESULT(6)
90*
91* =====================================================================
92*
93* ..
94* .. Local allocatable arrays
95 DOUBLE PRECISION, ALLOCATABLE :: AF(:,:), Q(:,:),
96 \$ R(:,:), RWORK(:), WORK( : ), T(:,:),
97 \$ CF(:,:), DF(:,:), A(:,:), C(:,:), D(:,:)
98*
99* .. Parameters ..
100 DOUBLE PRECISION ONE, ZERO
101 parameter( zero = 0.0, one = 1.0 )
102* ..
103* .. Local Scalars ..
104 INTEGER INFO, J, K, N2, NP1,i
105 DOUBLE PRECISION ANORM, EPS, RESID, CNORM, DNORM
106* ..
107* .. Local Arrays ..
108 INTEGER ISEED( 4 )
109* ..
110* .. External Functions ..
111 DOUBLE PRECISION DLAMCH, DLANGE, DLANSY
112 LOGICAL LSAME
113 EXTERNAL dlamch, dlange, dlansy, lsame
114* ..
115* .. Data statements ..
116 DATA iseed / 1988, 1989, 1990, 1991 /
117*
118 eps = dlamch( 'Epsilon' )
119 k = m
120 n2 = m+n
121 IF( n.GT.0 ) THEN
122 np1 = m+1
123 ELSE
124 np1 = 1
125 END IF
126 lwork = n2*n2*nb
127*
128* Dynamically allocate all arrays
129*
130 ALLOCATE(a(m,n2),af(m,n2),q(n2,n2),r(n2,n2),rwork(n2),
131 \$ work(lwork),t(nb,m),c(n2,m),cf(n2,m),
132 \$ d(m,n2),df(m,n2) )
133*
134* Put random stuff into A
135*
136 ldt=nb
137 CALL dlaset( 'Full', m, n2, zero, zero, a, m )
138 CALL dlaset( 'Full', nb, m, zero, zero, t, nb )
139 DO j=1,m
140 CALL dlarnv( 2, iseed, m-j+1, a( j, j ) )
141 END DO
142 IF( n.GT.0 ) THEN
143 DO j=1,n-l
144 CALL dlarnv( 2, iseed, m, a( 1, min(n+m,m+1) + j - 1 ) )
145 END DO
146 END IF
147 IF( l.GT.0 ) THEN
148 DO j=1,l
149 CALL dlarnv( 2, iseed, m-j+1, a( j, min(n+m,n+m-l+1)
150 \$ + j - 1 ) )
151 END DO
152 END IF
153*
154* Copy the matrix A to the array AF.
155*
156 CALL dlacpy( 'Full', m, n2, a, m, af, m )
157*
158* Factor the matrix A in the array AF.
159*
160 CALL dtplqt( m,n,l,nb,af,m,af(1,np1),m,t,ldt,work,info)
161*
162* Generate the (M+N)-by-(M+N) matrix Q by applying H to I
163*
164 CALL dlaset( 'Full', n2, n2, zero, one, q, n2 )
165 CALL dgemlqt( 'L', 'N', n2, n2, k, nb, af, m, t, ldt, q, n2,
166 \$ work, info )
167*
168* Copy L
169*
170 CALL dlaset( 'Full', n2, n2, zero, zero, r, n2 )
171 CALL dlacpy( 'Lower', m, n2, af, m, r, n2 )
172*
173* Compute |L - A*Q*T| / |A| and store in RESULT(1)
174*
175 CALL dgemm( 'N', 'T', m, n2, n2, -one, a, m, q, n2, one, r, n2)
176 anorm = dlange( '1', m, n2, a, m, rwork )
177 resid = dlange( '1', m, n2, r, n2, rwork )
178 IF( anorm.GT.zero ) THEN
179 result( 1 ) = resid / (eps*anorm*max(1,n2))
180 ELSE
181 result( 1 ) = zero
182 END IF
183*
184* Compute |I - Q*Q'| and store in RESULT(2)
185*
186 CALL dlaset( 'Full', n2, n2, zero, one, r, n2 )
187 CALL dsyrk( 'U', 'N', n2, n2, -one, q, n2, one, r, n2 )
188 resid = dlansy( '1', 'Upper', n2, r, n2, rwork )
189 result( 2 ) = resid / (eps*max(1,n2))
190*
191* Generate random m-by-n matrix C and a copy CF
192*
193 CALL dlaset( 'Full', n2, m, zero, one, c, n2 )
194 DO j=1,m
195 CALL dlarnv( 2, iseed, n2, c( 1, j ) )
196 END DO
197 cnorm = dlange( '1', n2, m, c, n2, rwork)
198 CALL dlacpy( 'Full', n2, m, c, n2, cf, n2 )
199*
200* Apply Q to C as Q*C
201*
202 CALL dtpmlqt( 'L','N', n,m,k,l,nb,af(1, np1),m,t,ldt,cf,n2,
203 \$ cf(np1,1),n2,work,info)
204*
205* Compute |Q*C - Q*C| / |C|
206*
207 CALL dgemm( 'N', 'N', n2, m, n2, -one, q, n2, c, n2, one, cf, n2 )
208 resid = dlange( '1', n2, m, cf, n2, rwork )
209 IF( cnorm.GT.zero ) THEN
210 result( 3 ) = resid / (eps*max(1,n2)*cnorm)
211 ELSE
212 result( 3 ) = zero
213 END IF
214
215*
216* Copy C into CF again
217*
218 CALL dlacpy( 'Full', n2, m, c, n2, cf, n2 )
219*
220* Apply Q to C as QT*C
221*
222 CALL dtpmlqt( 'L','T',n,m,k,l,nb,af(1,np1),m,t,ldt,cf,n2,
223 \$ cf(np1,1),n2,work,info)
224*
225* Compute |QT*C - QT*C| / |C|
226*
227 CALL dgemm('T','N',n2,m,n2,-one,q,n2,c,n2,one,cf,n2)
228 resid = dlange( '1', n2, m, cf, n2, rwork )
229
230 IF( cnorm.GT.zero ) THEN
231 result( 4 ) = resid / (eps*max(1,n2)*cnorm)
232 ELSE
233 result( 4 ) = zero
234 END IF
235*
236* Generate random m-by-n matrix D and a copy DF
237*
238 DO j=1,n2
239 CALL dlarnv( 2, iseed, m, d( 1, j ) )
240 END DO
241 dnorm = dlange( '1', m, n2, d, m, rwork)
242 CALL dlacpy( 'Full', m, n2, d, m, df, m )
243*
244* Apply Q to D as D*Q
245*
246 CALL dtpmlqt('R','N',m,n,k,l,nb,af(1,np1),m,t,ldt,df,m,
247 \$ df(1,np1),m,work,info)
248*
249* Compute |D*Q - D*Q| / |D|
250*
251 CALL dgemm('N','N',m,n2,n2,-one,d,m,q,n2,one,df,m)
252 resid = dlange('1',m, n2,df,m,rwork )
253 IF( cnorm.GT.zero ) THEN
254 result( 5 ) = resid / (eps*max(1,n2)*dnorm)
255 ELSE
256 result( 5 ) = zero
257 END IF
258*
259* Copy D into DF again
260*
261 CALL dlacpy('Full',m,n2,d,m,df,m )
262*
263* Apply Q to D as D*QT
264*
265 CALL dtpmlqt('R','T',m,n,k,l,nb,af(1,np1),m,t,ldt,df,m,
266 \$ df(1,np1),m,work,info)
267
268*
269* Compute |D*QT - D*QT| / |D|
270*
271 CALL dgemm( 'N', 'T', m, n2, n2, -one, d, m, q, n2, one, df, m )
272 resid = dlange( '1', m, n2, df, m, rwork )
273 IF( cnorm.GT.zero ) THEN
274 result( 6 ) = resid / (eps*max(1,n2)*dnorm)
275 ELSE
276 result( 6 ) = zero
277 END IF
278*
279* Deallocate all arrays
280*
281 DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
282 RETURN
283 END
subroutine dlqt05(m, n, l, nb, result)
DLQT05
Definition dlqt05.f:80
subroutine dgemlqt(side, trans, m, n, k, mb, v, ldv, t, ldt, c, ldc, work, info)
DGEMLQT
Definition dgemlqt.f:168
subroutine dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
DGEMM
Definition dgemm.f:188
subroutine dsyrk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
DSYRK
Definition dsyrk.f:169
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
Definition dlacpy.f:103
subroutine dlarnv(idist, iseed, n, x)
DLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition dlarnv.f:97
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition dlaset.f:110
subroutine dtplqt(m, n, l, mb, a, lda, b, ldb, t, ldt, work, info)
DTPLQT
Definition dtplqt.f:189
subroutine dtpmlqt(side, trans, m, n, k, l, mb, v, ldv, t, ldt, a, lda, b, ldb, work, info)
DTPMLQT
Definition dtpmlqt.f:214