LAPACK  3.5.0
LAPACK: Linear Algebra PACKage
zqrt05.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine zqrt05 (M, N, L, NB, RESULT)
 ZQRT05 More...
 

Function/Subroutine Documentation

subroutine zqrt05 ( integer  M,
integer  N,
integer  L,
integer  NB,
double precision, dimension(6)  RESULT 
)

ZQRT05

Purpose:
 ZQRT05 tests ZTPQRT and ZTPMQRT.
Parameters
[in]M
          M is INTEGER
          Number of rows in lower part of the test matrix.
[in]N
          N is INTEGER
          Number of columns in test matrix.
[in]L
          L is INTEGER
          The number of rows of the upper trapezoidal part the
          lower test matrix.  0 <= L <= M.
[in]NB
          NB is INTEGER
          Block size of test matrix.  NB <= N.
[out]RESULT
          RESULT is DOUBLE PRECISION array, dimension (6)
          Results of each of the six tests below.

          RESULT(1) = | A - Q R |
          RESULT(2) = | I - Q^H Q |
          RESULT(3) = | Q C - Q C |
          RESULT(4) = | Q^H C - Q^H C |
          RESULT(5) = | C Q - C Q | 
          RESULT(6) = | C Q^H - C Q^H |
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
April 2012

Definition at line 82 of file zqrt05.f.

82  IMPLICIT NONE
83 *
84 * -- LAPACK test routine (version 3.4.1) --
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  DOUBLE PRECISION result(6)
93 *
94 * =====================================================================
95 *
96 * ..
97 * .. Local allocatable arrays
98  COMPLEX*16, ALLOCATABLE :: af(:,:), q(:,:),
99  $ r(:,:), rwork(:), work( : ), t(:,:),
100  $ cf(:,:), df(:,:), a(:,:), c(:,:), d(:,:)
101 *
102 * .. Parameters ..
103  DOUBLE PRECISION zero
104  COMPLEX*16 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, m2, np1
109  DOUBLE PRECISION anorm, eps, resid, cnorm, dnorm
110 * ..
111 * .. Local Arrays ..
112  INTEGER iseed( 4 )
113 * ..
114 * .. External Functions ..
115  DOUBLE PRECISION dlamch
116  DOUBLE PRECISION zlange, zlansy
117  LOGICAL lsame
118  EXTERNAL dlamch, zlange, zlansy, lsame
119 * ..
120 * .. Data statements ..
121  DATA iseed / 1988, 1989, 1990, 1991 /
122 *
123  eps = dlamch( 'Epsilon' )
124  k = n
125  m2 = m+n
126  IF( m.GT.0 ) THEN
127  np1 = n+1
128  ELSE
129  np1 = 1
130  END IF
131  lwork = m2*m2*nb
132 *
133 * Dynamically allocate all arrays
134 *
135  ALLOCATE(a(m2,n),af(m2,n),q(m2,m2),r(m2,m2),rwork(m2),
136  $ work(lwork),t(nb,n),c(m2,n),cf(m2,n),
137  $ d(n,m2),df(n,m2) )
138 *
139 * Put random stuff into A
140 *
141  ldt=nb
142  CALL zlaset( 'Full', m2, n, czero, czero, a, m2 )
143  CALL zlaset( 'Full', nb, n, czero, czero, t, nb )
144  DO j=1,n
145  CALL zlarnv( 2, iseed, j, a( 1, j ) )
146  END DO
147  IF( m.GT.0 ) THEN
148  DO j=1,n
149  CALL zlarnv( 2, iseed, m-l, a( min(n+m,n+1), j ) )
150  END DO
151  END IF
152  IF( l.GT.0 ) THEN
153  DO j=1,n
154  CALL zlarnv( 2, iseed, min(j,l), a( min(n+m,n+m-l+1), j ) )
155  END DO
156  END IF
157 *
158 * Copy the matrix A to the array AF.
159 *
160  CALL zlacpy( 'Full', m2, n, a, m2, af, m2 )
161 *
162 * Factor the matrix A in the array AF.
163 *
164  CALL ztpqrt( m,n,l,nb,af,m2,af(np1,1),m2,t,ldt,work,info)
165 *
166 * Generate the (M+N)-by-(M+N) matrix Q by applying H to I
167 *
168  CALL zlaset( 'Full', m2, m2, czero, one, q, m2 )
169  CALL zgemqrt( 'R', 'N', m2, m2, k, nb, af, m2, t, ldt, q, m2,
170  $ work, info )
171 *
172 * Copy R
173 *
174  CALL zlaset( 'Full', m2, n, czero, czero, r, m2 )
175  CALL zlacpy( 'Upper', m2, n, af, m2, r, m2 )
176 *
177 * Compute |R - Q'*A| / |A| and store in RESULT(1)
178 *
179  CALL zgemm( 'C', 'N', m2, n, m2, -one, q, m2, a, m2, one, r, m2 )
180  anorm = zlange( '1', m2, n, a, m2, rwork )
181  resid = zlange( '1', m2, n, r, m2, rwork )
182  IF( anorm.GT.zero ) THEN
183  result( 1 ) = resid / (eps*anorm*max(1,m2))
184  ELSE
185  result( 1 ) = zero
186  END IF
187 *
188 * Compute |I - Q'*Q| and store in RESULT(2)
189 *
190  CALL zlaset( 'Full', m2, m2, czero, one, r, m2 )
191  CALL zherk( 'U', 'C', m2, m2, dreal(-one), q, m2, dreal(one),
192  $ r, m2 )
193  resid = zlansy( '1', 'Upper', m2, r, m2, rwork )
194  result( 2 ) = resid / (eps*max(1,m2))
195 *
196 * Generate random m-by-n matrix C and a copy CF
197 *
198  DO j=1,n
199  CALL zlarnv( 2, iseed, m2, c( 1, j ) )
200  END DO
201  cnorm = zlange( '1', m2, n, c, m2, rwork)
202  CALL zlacpy( 'Full', m2, n, c, m2, cf, m2 )
203 *
204 * Apply Q to C as Q*C
205 *
206  CALL ztpmqrt( 'L','N', m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,m2,
207  $ cf(np1,1),m2,work,info)
208 *
209 * Compute |Q*C - Q*C| / |C|
210 *
211  CALL zgemm( 'N', 'N', m2, n, m2, -one, q, m2, c, m2, one, cf, m2 )
212  resid = zlange( '1', m2, n, cf, m2, rwork )
213  IF( cnorm.GT.zero ) THEN
214  result( 3 ) = resid / (eps*max(1,m2)*cnorm)
215  ELSE
216  result( 3 ) = zero
217  END IF
218 *
219 * Copy C into CF again
220 *
221  CALL zlacpy( 'Full', m2, n, c, m2, cf, m2 )
222 *
223 * Apply Q to C as QT*C
224 *
225  CALL ztpmqrt( 'L','C',m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,m2,
226  $ cf(np1,1),m2,work,info)
227 *
228 * Compute |QT*C - QT*C| / |C|
229 *
230  CALL zgemm('C','N',m2,n,m2,-one,q,m2,c,m2,one,cf,m2)
231  resid = zlange( '1', m2, n, cf, m2, rwork )
232  IF( cnorm.GT.zero ) THEN
233  result( 4 ) = resid / (eps*max(1,m2)*cnorm)
234  ELSE
235  result( 4 ) = zero
236  END IF
237 *
238 * Generate random n-by-m matrix D and a copy DF
239 *
240  DO j=1,m2
241  CALL zlarnv( 2, iseed, n, d( 1, j ) )
242  END DO
243  dnorm = zlange( '1', n, m2, d, n, rwork)
244  CALL zlacpy( 'Full', n, m2, d, n, df, n )
245 *
246 * Apply Q to D as D*Q
247 *
248  CALL ztpmqrt('R','N',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
249  $ df(1,np1),n,work,info)
250 *
251 * Compute |D*Q - D*Q| / |D|
252 *
253  CALL zgemm('N','N',n,m2,m2,-one,d,n,q,m2,one,df,n)
254  resid = zlange('1',n, m2,df,n,rwork )
255  IF( cnorm.GT.zero ) THEN
256  result( 5 ) = resid / (eps*max(1,m2)*dnorm)
257  ELSE
258  result( 5 ) = zero
259  END IF
260 *
261 * Copy D into DF again
262 *
263  CALL zlacpy('Full',n,m2,d,n,df,n )
264 *
265 * Apply Q to D as D*QT
266 *
267  CALL ztpmqrt('R','C',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
268  $ df(1,np1),n,work,info)
269 
270 *
271 * Compute |D*QT - D*QT| / |D|
272 *
273  CALL zgemm( 'N', 'C', n, m2, m2, -one, d, n, q, m2, one, df, n )
274  resid = zlange( '1', n, m2, df, n, rwork )
275  IF( cnorm.GT.zero ) THEN
276  result( 6 ) = resid / (eps*max(1,m2)*dnorm)
277  ELSE
278  result( 6 ) = zero
279  END IF
280 *
281 * Deallocate all arrays
282 *
283  DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
284  RETURN
subroutine zherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
ZHERK
Definition: zherk.f:175
double precision function zlansy(NORM, UPLO, N, A, LDA, WORK)
ZLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex symmetric matrix.
Definition: zlansy.f:125
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:105
subroutine zgemqrt(SIDE, TRANS, M, N, K, NB, V, LDV, T, LDT, C, LDC, WORK, INFO)
ZGEMQRT
Definition: zgemqrt.f:170
subroutine zgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
ZGEMM
Definition: zgemm.f:189
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine zlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: zlaset.f:108
subroutine zlarnv(IDIST, ISEED, N, X)
ZLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition: zlarnv.f:101
double precision function zlange(NORM, M, N, A, LDA, WORK)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: zlange.f:117
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine ztpqrt(M, N, L, NB, A, LDA, B, LDB, T, LDT, WORK, INFO)
ZTPQRT
Definition: ztpqrt.f:191
subroutine ztpmqrt(SIDE, TRANS, M, N, K, L, NB, V, LDV, T, LDT, A, LDA, B, LDB, WORK, INFO)
ZTPMQRT
Definition: ztpmqrt.f:218

Here is the call graph for this function:

Here is the caller graph for this function: