87 INTEGER LWORK, M, N, L, NB, LDT
89 DOUBLE PRECISION RESULT(6)
95 COMPLEX*16,
ALLOCATABLE :: AF(:,:), Q(:,:),
96 $ R(:,:), WORK( : ), T(:,:),
97 $ CF(:,:), DF(:,:), A(:,:), C(:,:), D(:,:)
98 DOUBLE PRECISION,
ALLOCATABLE :: RWORK(:)
101 DOUBLE PRECISION ZERO
102 COMPLEX*16 ONE, CZERO
103 parameter( zero = 0.0, one = (1.0,0.0), czero=(0.0,0.0) )
106 INTEGER INFO, J, K, M2, NP1
107 DOUBLE PRECISION ANORM, EPS, RESID, CNORM, DNORM
113 DOUBLE PRECISION DLAMCH
114 DOUBLE PRECISION ZLANGE, ZLANSY
116 EXTERNAL dlamch, zlange, zlansy, lsame
119 DATA iseed / 1988, 1989, 1990, 1991 /
121 eps = dlamch(
'Epsilon' )
133 ALLOCATE(a(m2,n),af(m2,n),q(m2,m2),r(m2,m2),rwork(m2),
134 $ work(lwork),t(nb,n),c(m2,n),cf(m2,n),
140 CALL zlaset(
'Full', m2, n, czero, czero, a, m2 )
141 CALL zlaset(
'Full', nb, n, czero, czero, t, nb )
143 CALL zlarnv( 2, iseed, j, a( 1, j ) )
147 CALL zlarnv( 2, iseed, m-l, a( min(n+m,n+1), j ) )
152 CALL zlarnv( 2, iseed, min(j,l), a( min(n+m,n+m-l+1), j ) )
158 CALL zlacpy(
'Full', m2, n, a, m2, af, m2 )
162 CALL ztpqrt( m,n,l,nb,af,m2,af(np1,1),m2,t,ldt,work,info)
166 CALL zlaset(
'Full', m2, m2, czero, one, q, m2 )
167 CALL zgemqrt(
'R',
'N', m2, m2, k, nb, af, m2, t, ldt, q, m2,
172 CALL zlaset(
'Full', m2, n, czero, czero, r, m2 )
173 CALL zlacpy(
'Upper', m2, n, af, m2, r, m2 )
177 CALL zgemm(
'C',
'N', m2, n, m2, -one, q, m2, a, m2, one, r, m2 )
178 anorm = zlange(
'1', m2, n, a, m2, rwork )
179 resid = zlange(
'1', m2, n, r, m2, rwork )
180 IF( anorm.GT.zero )
THEN
181 result( 1 ) = resid / (eps*anorm*max(1,m2))
188 CALL zlaset(
'Full', m2, m2, czero, one, r, m2 )
189 CALL zherk(
'U',
'C', m2, m2, dreal(-one), q, m2, dreal(one),
191 resid = zlansy(
'1',
'Upper', m2, r, m2, rwork )
192 result( 2 ) = resid / (eps*max(1,m2))
197 CALL zlarnv( 2, iseed, m2, c( 1, j ) )
199 cnorm = zlange(
'1', m2, n, c, m2, rwork)
200 CALL zlacpy(
'Full', m2, n, c, m2, cf, m2 )
204 CALL ztpmqrt(
'L',
'N', m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,m2,
205 $ cf(np1,1),m2,work,info)
209 CALL zgemm(
'N',
'N', m2, n, m2, -one, q, m2, c, m2, one, cf, m2 )
210 resid = zlange(
'1', m2, n, cf, m2, rwork )
211 IF( cnorm.GT.zero )
THEN
212 result( 3 ) = resid / (eps*max(1,m2)*cnorm)
219 CALL zlacpy(
'Full', m2, n, c, m2, cf, m2 )
223 CALL ztpmqrt(
'L',
'C',m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,m2,
224 $ cf(np1,1),m2,work,info)
228 CALL zgemm(
'C',
'N',m2,n,m2,-one,q,m2,c,m2,one,cf,m2)
229 resid = zlange(
'1', m2, n, cf, m2, rwork )
230 IF( cnorm.GT.zero )
THEN
231 result( 4 ) = resid / (eps*max(1,m2)*cnorm)
239 CALL zlarnv( 2, iseed, n, d( 1, j ) )
241 dnorm = zlange(
'1', n, m2, d, n, rwork)
242 CALL zlacpy(
'Full', n, m2, d, n, df, n )
246 CALL ztpmqrt(
'R',
'N',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
247 $ df(1,np1),n,work,info)
251 CALL zgemm(
'N',
'N',n,m2,m2,-one,d,n,q,m2,one,df,n)
252 resid = zlange(
'1',n, m2,df,n,rwork )
253 IF( cnorm.GT.zero )
THEN
254 result( 5 ) = resid / (eps*max(1,m2)*dnorm)
261 CALL zlacpy(
'Full',n,m2,d,n,df,n )
265 CALL ztpmqrt(
'R',
'C',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
266 $ df(1,np1),n,work,info)
271 CALL zgemm(
'N',
'C', n, m2, m2, -one, d, n, q, m2, one, df, n )
272 resid = zlange(
'1', n, m2, df, n, rwork )
273 IF( cnorm.GT.zero )
THEN
274 result( 6 ) = resid / (eps*max(1,m2)*dnorm)
281 DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
subroutine zgemqrt(side, trans, m, n, k, nb, v, ldv, t, ldt, c, ldc, work, info)
ZGEMQRT
subroutine zherk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
ZHERK
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlarnv(idist, iseed, n, x)
ZLARNV returns a vector of random numbers from a uniform or normal distribution.
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.
subroutine ztpmqrt(side, trans, m, n, k, l, nb, v, ldv, t, ldt, a, lda, b, ldb, work, info)
ZTPMQRT
subroutine ztpqrt(m, n, l, nb, a, lda, b, ldb, t, ldt, work, info)
ZTPQRT
subroutine zqrt05(m, n, l, nb, result)
ZQRT05