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, M2, NP1
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(m2,n),af(m2,n),q(m2,m2),r(m2,m2),rwork(m2),
131 $ work(lwork),t(nb,n),c(m2,n),cf(m2,n),
137 CALL dlaset(
'Full', m2, n, zero, zero, a, m2 )
138 CALL dlaset(
'Full', nb, n, zero, zero, t, nb )
140 CALL dlarnv( 2, iseed, j, a( 1, j ) )
144 CALL dlarnv( 2, iseed, m-l, a( min(n+m,n+1), j ) )
149 CALL dlarnv( 2, iseed, min(j,l), a( min(n+m,n+m-l+1), j ) )
155 CALL dlacpy(
'Full', m2, n, a, m2, af, m2 )
159 CALL dtpqrt( m,n,l,nb,af,m2,af(np1,1),m2,t,ldt,work,info)
163 CALL dlaset(
'Full', m2, m2, zero, one, q, m2 )
164 CALL dgemqrt(
'R',
'N', m2, m2, k, nb, af, m2, t, ldt, q, m2,
169 CALL dlaset(
'Full', m2, n, zero, zero, r, m2 )
170 CALL dlacpy(
'Upper', m2, n, af, m2, r, m2 )
174 CALL dgemm(
'T',
'N', m2, n, m2, -one, q, m2, a, m2, one, r, m2 )
175 anorm = dlange(
'1', m2, n, a, m2, rwork )
176 resid = dlange(
'1', m2, n, r, m2, rwork )
177 IF( anorm.GT.zero )
THEN
178 result( 1 ) = resid / (eps*anorm*max(1,m2))
185 CALL dlaset(
'Full', m2, m2, zero, one, r, m2 )
186 CALL dsyrk(
'U',
'C', m2, m2, -one, q, m2, one, r, m2 )
187 resid = dlansy(
'1',
'Upper', m2, r, m2, rwork )
188 result( 2 ) = resid / (eps*max(1,m2))
193 CALL dlarnv( 2, iseed, m2, c( 1, j ) )
195 cnorm = dlange(
'1', m2, n, c, m2, rwork)
196 CALL dlacpy(
'Full', m2, n, c, m2, cf, m2 )
200 CALL dtpmqrt(
'L',
'N', m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,m2,
201 $ cf(np1,1),m2,work,info)
205 CALL dgemm(
'N',
'N', m2, n, m2, -one, q, m2, c, m2, one, cf, m2 )
206 resid = dlange(
'1', m2, n, cf, m2, rwork )
207 IF( cnorm.GT.zero )
THEN
208 result( 3 ) = resid / (eps*max(1,m2)*cnorm)
215 CALL dlacpy(
'Full', m2, n, c, m2, cf, m2 )
219 CALL dtpmqrt(
'L',
'T',m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,m2,
220 $ cf(np1,1),m2,work,info)
224 CALL dgemm(
'T',
'N',m2,n,m2,-one,q,m2,c,m2,one,cf,m2)
225 resid = dlange(
'1', m2, n, cf, m2, rwork )
226 IF( cnorm.GT.zero )
THEN
227 result( 4 ) = resid / (eps*max(1,m2)*cnorm)
235 CALL dlarnv( 2, iseed, n, d( 1, j ) )
237 dnorm = dlange(
'1', n, m2, d, n, rwork)
238 CALL dlacpy(
'Full', n, m2, d, n, df, n )
242 CALL dtpmqrt(
'R',
'N',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
243 $ df(1,np1),n,work,info)
247 CALL dgemm(
'N',
'N',n,m2,m2,-one,d,n,q,m2,one,df,n)
248 resid = dlange(
'1',n, m2,df,n,rwork )
249 IF( cnorm.GT.zero )
THEN
250 result( 5 ) = resid / (eps*max(1,m2)*dnorm)
257 CALL dlacpy(
'Full',n,m2,d,n,df,n )
261 CALL dtpmqrt(
'R',
'T',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
262 $ df(1,np1),n,work,info)
267 CALL dgemm(
'N',
'T', n, m2, m2, -one, d, n, q, m2, one, df, n )
268 resid = dlange(
'1', n, m2, df, n, rwork )
269 IF( cnorm.GT.zero )
THEN
270 result( 6 ) = resid / (eps*max(1,m2)*dnorm)
277 DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
subroutine dqrt05(m, n, l, nb, result)
DQRT05
subroutine dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
DGEMM
subroutine dgemqrt(side, trans, m, n, k, nb, v, ldv, t, ldt, c, ldc, work, info)
DGEMQRT
subroutine dsyrk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
DSYRK
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlarnv(idist, iseed, n, x)
DLARNV returns a vector of random numbers from a uniform or normal distribution.
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.
subroutine dtpmqrt(side, trans, m, n, k, l, nb, v, ldv, t, ldt, a, lda, b, ldb, work, info)
DTPMQRT
subroutine dtpqrt(m, n, l, nb, a, lda, b, ldb, t, ldt, work, info)
DTPQRT