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, N2, NP1,i
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(m,n2),af(m,n2),q(n2,n2),r(n2,n2),rwork(n2),
134 $ work(lwork),t(nb,m),c(n2,m),cf(n2,m),
140 CALL zlaset(
'Full', m, n2, czero, czero, a, m )
141 CALL zlaset(
'Full', nb, m, czero, czero, t, nb )
143 CALL zlarnv( 2, iseed, m-j+1, a( j, j ) )
147 CALL zlarnv( 2, iseed, m, a( 1, min(n+m,m+1) + j - 1 ) )
152 CALL zlarnv( 2, iseed, m-j+1, a( j, min(n+m,n+m-l+1)
159 CALL zlacpy(
'Full', m, n2, a, m, af, m )
163 CALL ztplqt( m,n,l,nb,af,m,af(1,np1),m,t,ldt,work,info)
167 CALL zlaset(
'Full', n2, n2, czero, one, q, n2 )
168 CALL zgemlqt(
'L',
'N', n2, n2, k, nb, af, m, t, ldt, q, n2,
173 CALL zlaset(
'Full', n2, n2, czero, czero, r, n2 )
174 CALL zlacpy(
'Lower', m, n2, af, m, r, n2 )
178 CALL zgemm(
'N',
'C', m, n2, n2, -one, a, m, q, n2, one, r, n2)
179 anorm = zlange(
'1', m, n2, a, m, rwork )
180 resid = zlange(
'1', m, n2, r, n2, rwork )
181 IF( anorm.GT.zero )
THEN
182 result( 1 ) = resid / (eps*anorm*max(1,n2))
189 CALL zlaset(
'Full', n2, n2, czero, one, r, n2 )
190 CALL zherk(
'U',
'N', n2, n2, dreal(-one), q, n2, dreal(one),
192 resid = zlansy(
'1',
'Upper', n2, r, n2, rwork )
193 result( 2 ) = resid / (eps*max(1,n2))
197 CALL zlaset(
'Full', n2, m, czero, one, c, n2 )
199 CALL zlarnv( 2, iseed, n2, c( 1, j ) )
201 cnorm = zlange(
'1', n2, m, c, n2, rwork)
202 CALL zlacpy(
'Full', n2, m, c, n2, cf, n2 )
206 CALL ztpmlqt(
'L',
'N', n,m,k,l,nb,af(1, np1),m,t,ldt,cf,n2,
207 $ cf(np1,1),n2,work,info)
211 CALL zgemm(
'N',
'N', n2, m, n2, -one, q, n2, c, n2, one, cf, n2 )
212 resid = zlange(
'1', n2, m, cf, n2, rwork )
213 IF( cnorm.GT.zero )
THEN
214 result( 3 ) = resid / (eps*max(1,n2)*cnorm)
222 CALL zlacpy(
'Full', n2, m, c, n2, cf, n2 )
226 CALL ztpmlqt(
'L',
'C',n,m,k,l,nb,af(1,np1),m,t,ldt,cf,n2,
227 $ cf(np1,1),n2,work,info)
231 CALL zgemm(
'C',
'N',n2,m,n2,-one,q,n2,c,n2,one,cf,n2)
232 resid = zlange(
'1', n2, m, cf, n2, rwork )
234 IF( cnorm.GT.zero )
THEN
235 result( 4 ) = resid / (eps*max(1,n2)*cnorm)
243 CALL zlarnv( 2, iseed, m, d( 1, j ) )
245 dnorm = zlange(
'1', m, n2, d, m, rwork)
246 CALL zlacpy(
'Full', m, n2, d, m, df, m )
250 CALL ztpmlqt(
'R',
'N',m,n,k,l,nb,af(1,np1),m,t,ldt,df,m,
251 $ df(1,np1),m,work,info)
255 CALL zgemm(
'N',
'N',m,n2,n2,-one,d,m,q,n2,one,df,m)
256 resid = zlange(
'1',m, n2,df,m,rwork )
257 IF( cnorm.GT.zero )
THEN
258 result( 5 ) = resid / (eps*max(1,n2)*dnorm)
265 CALL zlacpy(
'Full',m,n2,d,m,df,m )
269 CALL ztpmlqt(
'R',
'C',m,n,k,l,nb,af(1,np1),m,t,ldt,df,m,
270 $ df(1,np1),m,work,info)
275 CALL zgemm(
'N',
'C', m, n2, n2, -one, d, m, q, n2, one, df, m )
276 resid = zlange(
'1', m, n2, df, m, rwork )
277 IF( cnorm.GT.zero )
THEN
278 result( 6 ) = resid / (eps*max(1,n2)*dnorm)
285 DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
subroutine zgemlqt(side, trans, m, n, k, mb, v, ldv, t, ldt, c, ldc, work, info)
ZGEMLQT
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
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 ztplqt(m, n, l, mb, a, lda, b, ldb, t, ldt, work, info)
ZTPLQT
subroutine ztpmlqt(side, trans, m, n, k, l, mb, v, ldv, t, ldt, a, lda, b, ldb, work, info)
ZTPMLQT
subroutine zlqt05(m, n, l, nb, result)
ZLQT05