82 DOUBLE PRECISION RESULT(6)
88 DOUBLE PRECISION,
ALLOCATABLE :: AF(:,:), Q(:,:),
89 $ R(:,:), RWORK(:), WORK( : ), T(:,:),
90 $ CF(:,:), DF(:,:), A(:,:), C(:,:), D(:,:)
93 DOUBLE PRECISION ONE, ZERO
94 parameter( zero = 0.0, one = 1.0 )
97 INTEGER INFO, J, K, L, LWORK
98 DOUBLE PRECISION ANORM, EPS, RESID, CNORM, DNORM
104 DOUBLE PRECISION DLAMCH, DLANGE, DLANSY
106 EXTERNAL dlamch, dlange, dlansy, lsame
112 DATA iseed / 1988, 1989, 1990, 1991 /
114 eps = dlamch(
'Epsilon' )
117 lwork = max(2,l)*max(2,l)*nb
121 ALLOCATE ( a(m,n), af(m,n), q(m,m), r(m,l), rwork(l),
122 $ work(lwork), t(nb,n), c(m,n), cf(m,n),
129 CALL dlarnv( 2, iseed, m, a( 1, j ) )
131 CALL dlacpy(
'Full', m, n, a, m, af, m )
135 CALL dgeqrt( m, n, nb, af, m, t, ldt, work, info )
139 CALL dlaset(
'Full', m, m, zero, one, q, m )
140 CALL dgemqrt(
'R',
'N', m, m, k, nb, af, m, t, ldt, q, m,
145 CALL dlaset(
'Full', m, n, zero, zero, r, m )
146 CALL dlacpy(
'Upper', m, n, af, m, r, m )
150 CALL dgemm(
'T',
'N', m, n, m, -one, q, m, a, m, one, r, m )
151 anorm = dlange(
'1', m, n, a, m, rwork )
152 resid = dlange(
'1', m, n, r, m, rwork )
153 IF( anorm.GT.zero )
THEN
154 result( 1 ) = resid / (eps*max(1,m)*anorm)
161 CALL dlaset(
'Full', m, m, zero, one, r, m )
162 CALL dsyrk(
'U',
'C', m, m, -one, q, m, one, r, m )
163 resid = dlansy(
'1',
'Upper', m, r, m, rwork )
164 result( 2 ) = resid / (eps*max(1,m))
169 CALL dlarnv( 2, iseed, m, c( 1, j ) )
171 cnorm = dlange(
'1', m, n, c, m, rwork)
172 CALL dlacpy(
'Full', m, n, c, m, cf, m )
176 CALL dgemqrt(
'L',
'N', m, n, k, nb, af, m, t, nb, cf, m,
181 CALL dgemm(
'N',
'N', m, n, m, -one, q, m, c, m, one, cf, m )
182 resid = dlange(
'1', m, n, cf, m, rwork )
183 IF( cnorm.GT.zero )
THEN
184 result( 3 ) = resid / (eps*max(1,m)*cnorm)
191 CALL dlacpy(
'Full', m, n, c, m, cf, m )
195 CALL dgemqrt(
'L',
'T', m, n, k, nb, af, m, t, nb, cf, m,
200 CALL dgemm(
'T',
'N', m, n, m, -one, q, m, c, m, one, cf, m )
201 resid = dlange(
'1', m, n, cf, m, rwork )
202 IF( cnorm.GT.zero )
THEN
203 result( 4 ) = resid / (eps*max(1,m)*cnorm)
211 CALL dlarnv( 2, iseed, n, d( 1, j ) )
213 dnorm = dlange(
'1', n, m, d, n, rwork)
214 CALL dlacpy(
'Full', n, m, d, n, df, n )
218 CALL dgemqrt(
'R',
'N', n, m, k, nb, af, m, t, nb, df, n,
223 CALL dgemm(
'N',
'N', n, m, m, -one, d, n, q, m, one, df, n )
224 resid = dlange(
'1', n, m, df, n, rwork )
225 IF( cnorm.GT.zero )
THEN
226 result( 5 ) = resid / (eps*max(1,m)*dnorm)
233 CALL dlacpy(
'Full', n, m, d, n, df, n )
237 CALL dgemqrt(
'R',
'T', n, m, k, nb, af, m, t, nb, df, n,
242 CALL dgemm(
'N',
'T', n, m, m, -one, d, n, q, m, one, df, n )
243 resid = dlange(
'1', n, m, df, n, rwork )
244 IF( cnorm.GT.zero )
THEN
245 result( 6 ) = resid / (eps*max(1,m)*dnorm)
252 DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)