82 DOUBLE PRECISION RESULT(6)
88 DOUBLE PRECISION,
ALLOCATABLE :: AF(:,:), Q(:,:),
89 $ L(:,:), 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, LL, 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,ll)*max(2,ll)*nb
121 ALLOCATE ( a(m,n), af(m,n), q(n,n), l(ll,n), rwork(ll),
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 dgelqt( m, n, nb, af, m, t, ldt, work, info )
139 CALL dlaset(
'Full', n, n, zero, one, q, n )
140 CALL dgemlqt(
'R',
'N', n, n, k, nb, af, m, t, ldt, q, n,
145 CALL dlaset(
'Full', m, n, zero, zero, l, ll )
146 CALL dlacpy(
'Lower', m, n, af, m, l, ll )
150 CALL dgemm(
'N',
'T', m, n, n, -one, a, m, q, n, one, l, ll )
151 anorm = dlange(
'1', m, n, a, m, rwork )
152 resid = dlange(
'1', m, n, l, ll, rwork )
153 IF( anorm.GT.zero )
THEN
154 result( 1 ) = resid / (eps*max(1,m)*anorm)
161 CALL dlaset(
'Full', n, n, zero, one, l, ll )
162 CALL dsyrk(
'U',
'C', n, n, -one, q, n, one, l, ll )
163 resid = dlansy(
'1',
'Upper', n, l, ll, rwork )
164 result( 2 ) = resid / (eps*max(1,n))
169 CALL dlarnv( 2, iseed, n, d( 1, j ) )
171 dnorm = dlange(
'1', n, m, d, n, rwork)
172 CALL dlacpy(
'Full', n, m, d, n, df, n )
176 CALL dgemlqt(
'L',
'N', n, m, k, nb, af, m, t, nb, df, n,
181 CALL dgemm(
'N',
'N', n, m, n, -one, q, n, d, n, one, df, n )
182 resid = dlange(
'1', n, m, df, n, rwork )
183 IF( dnorm.GT.zero )
THEN
184 result( 3 ) = resid / (eps*max(1,m)*dnorm)
191 CALL dlacpy(
'Full', n, m, d, n, df, n )
195 CALL dgemlqt(
'L',
'T', n, m, k, nb, af, m, t, nb, df, n,
200 CALL dgemm(
'T',
'N', n, m, n, -one, q, n, d, n, one, df, n )
201 resid = dlange(
'1', n, m, df, n, rwork )
202 IF( dnorm.GT.zero )
THEN
203 result( 4 ) = resid / (eps*max(1,m)*dnorm)
211 CALL dlarnv( 2, iseed, m, c( 1, j ) )
213 cnorm = dlange(
'1', m, n, c, m, rwork)
214 CALL dlacpy(
'Full', m, n, c, m, cf, m )
218 CALL dgemlqt(
'R',
'N', m, n, k, nb, af, m, t, nb, cf, m,
223 CALL dgemm(
'N',
'N', m, n, n, -one, c, m, q, n, one, cf, m )
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', m, n, c, m, cf, m )
237 CALL dgemlqt(
'R',
'T', m, n, k, nb, af, m, t, nb, cf, m,
242 CALL dgemm(
'N',
'T', m, n, n, -one, c, m, q, n, one, cf, m )
243 resid = dlange(
'1', m, n, cf, m, rwork )
244 IF( cnorm.GT.zero )
THEN
245 result( 6 ) = resid / (eps*max(1,m)*dnorm)
252 DEALLOCATE ( a, af, q, l, rwork, work, t, c, d, cf, df)
subroutine dlqt04(m, n, nb, result)
DLQT04
subroutine dgelqt(m, n, mb, a, lda, t, ldt, work, info)
DGELQT
subroutine dgemlqt(side, trans, m, n, k, mb, v, ldv, t, ldt, c, ldc, work, info)
DGEMLQT
subroutine dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
DGEMM
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.