87 INTEGER LWORK, M, N, L, NB, LDT
89 DOUBLE PRECISION RESULT(6)
95 DOUBLE PRECISION,
ALLOCATABLE :: AF(:,:), Q(:,:),
96 $ R(:,:), RWORK(:), WORK( : ), T(:,:),
97 $ CF(:,:), DF(:,:), A(:,:), C(:,:), D(:,:)
100 DOUBLE PRECISION ONE, ZERO
101 parameter( zero = 0.0, one = 1.0 )
104 INTEGER INFO, J, K, N2, NP1,i
105 DOUBLE PRECISION ANORM, EPS, RESID, CNORM, DNORM
111 DOUBLE PRECISION DLAMCH, DLANGE, DLANSY
113 EXTERNAL dlamch, dlange, dlansy, lsame
116 DATA iseed / 1988, 1989, 1990, 1991 /
118 eps = dlamch(
'Epsilon' )
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),
137 CALL dlaset(
'Full', m, n2, zero, zero, a, m )
138 CALL dlaset(
'Full', nb, m, zero, zero, t, nb )
140 CALL dlarnv( 2, iseed, m-j+1, a( j, j ) )
144 CALL dlarnv( 2, iseed, m, a( 1, min(n+m,m+1) + j - 1 ) )
149 CALL dlarnv( 2, iseed, m-j+1, a( j, min(n+m,n+m-l+1)
156 CALL dlacpy(
'Full', m, n2, a, m, af, m )
160 CALL dtplqt( m,n,l,nb,af,m,af(1,np1),m,t,ldt,work,info)
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,
170 CALL dlaset(
'Full', n2, n2, zero, zero, r, n2 )
171 CALL dlacpy(
'Lower', m, n2, af, m, r, n2 )
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))
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))
193 CALL dlaset(
'Full', n2, m, zero, one, c, n2 )
195 CALL dlarnv( 2, iseed, n2, c( 1, j ) )
197 cnorm = dlange(
'1', n2, m, c, n2, rwork)
198 CALL dlacpy(
'Full', n2, m, c, n2, cf, n2 )
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)
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)
218 CALL dlacpy(
'Full', n2, m, c, n2, cf, n2 )
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)
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 )
230 IF( cnorm.GT.zero )
THEN
231 result( 4 ) = resid / (eps*max(1,n2)*cnorm)
239 CALL dlarnv( 2, iseed, m, d( 1, j ) )
241 dnorm = dlange(
'1', m, n2, d, m, rwork)
242 CALL dlacpy(
'Full', m, n2, d, m, df, m )
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)
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)
261 CALL dlacpy(
'Full',m,n2,d,m,df,m )
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)
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)
281 DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)