87 INTEGER LWORK, M, N, L, NB, LDT
95 REAL,
ALLOCATABLE :: AF(:,:), Q(:,:),
96 $ R(:,:), RWORK(:), WORK( : ), T(:,:),
97 $ CF(:,:), DF(:,:), A(:,:), C(:,:), D(:,:)
101 parameter( zero = 0.0, one = 1.0 )
104 INTEGER INFO, J, K, M2, NP1
105 REAL ANORM, EPS, RESID, CNORM, DNORM
118 EXTERNAL slamch, slange, slansy, lsame
121 DATA iseed / 1988, 1989, 1990, 1991 /
123 eps = slamch(
'Epsilon' )
135 ALLOCATE(a(m2,n),af(m2,n),q(m2,m2),r(m2,m2),rwork(m2),
136 $ work(lwork),t(nb,n),c(m2,n),cf(m2,n),
142 CALL slaset(
'Full', m2, n, zero, zero, a, m2 )
143 CALL slaset(
'Full', nb, n, zero, zero, t, nb )
145 CALL slarnv( 2, iseed, j, a( 1, j ) )
149 CALL slarnv( 2, iseed, m-l, a( n+1, j ) )
154 CALL slarnv( 2, iseed, min(j,l), a( n+m-l+1, j ) )
160 CALL slacpy(
'Full', m2, n, a, m2, af, m2 )
164 CALL stpqrt( m,n,l,nb,af,m2,af(np1,1),m2,t,ldt,work,info)
168 CALL slaset(
'Full', m2, m2, zero, one, q, m2 )
169 CALL sgemqrt(
'R',
'N', m2, m2, k, nb, af, m2, t, ldt, q, m2,
174 CALL slaset(
'Full', m2, n, zero, zero, r, m2 )
175 CALL slacpy(
'Upper', m2, n, af, m2, r, m2 )
179 CALL sgemm(
'T',
'N', m2, n, m2, -one, q, m2, a, m2, one, r, m2 )
180 anorm = slange(
'1', m2, n, a, m2, rwork )
181 resid = slange(
'1', m2, n, r, m2, rwork )
182 IF( anorm.GT.zero )
THEN
183 result( 1 ) = resid / (eps*anorm*max(1,m2))
190 CALL slaset(
'Full', m2, m2, zero, one, r, m2 )
191 CALL ssyrk(
'U',
'C', m2, m2, -one, q, m2, one,
193 resid = slansy(
'1',
'Upper', m2, r, m2, rwork )
194 result( 2 ) = resid / (eps*max(1,m2))
199 CALL slarnv( 2, iseed, m2, c( 1, j ) )
201 cnorm = slange(
'1', m2, n, c, m2, rwork)
202 CALL slacpy(
'Full', m2, n, c, m2, cf, m2 )
206 CALL stpmqrt(
'L',
'N', m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,
207 $ m2,cf(np1,1),m2,work,info)
211 CALL sgemm(
'N',
'N', m2, n, m2, -one, q,m2,c,m2,one,cf,m2)
212 resid = slange(
'1', m2, n, cf, m2, rwork )
213 IF( cnorm.GT.zero )
THEN
214 result( 3 ) = resid / (eps*max(1,m2)*cnorm)
221 CALL slacpy(
'Full', m2, n, c, m2, cf, m2 )
225 CALL stpmqrt(
'L',
'T',m,n,k,l,nb,af(np1,1),m2,t,ldt,cf,m2,
226 $ cf(np1,1),m2,work,info)
230 CALL sgemm(
'T',
'N',m2,n,m2,-one,q,m2,c,m2,one,cf,m2)
231 resid = slange(
'1', m2, n, cf, m2, rwork )
232 IF( cnorm.GT.zero )
THEN
233 result( 4 ) = resid / (eps*max(1,m2)*cnorm)
241 CALL slarnv( 2, iseed, n, d( 1, j ) )
243 dnorm = slange(
'1', n, m2, d, n, rwork)
244 CALL slacpy(
'Full', n, m2, d, n, df, n )
248 CALL stpmqrt(
'R',
'N',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
249 $ df(1,np1),n,work,info)
253 CALL sgemm(
'N',
'N',n,m2,m2,-one,d,n,q,m2,one,df,n)
254 resid = slange(
'1',n, m2,df,n,rwork )
255 IF( cnorm.GT.zero )
THEN
256 result( 5 ) = resid / (eps*max(1,m2)*dnorm)
263 CALL slacpy(
'Full',n,m2,d,n,df,n )
267 CALL stpmqrt(
'R',
'T',n,m,n,l,nb,af(np1,1),m2,t,ldt,df,n,
268 $ df(1,np1),n,work,info)
273 CALL sgemm(
'N',
'T', n, m2, m2, -one, d, n, q, m2, one, df, n )
274 resid = slange(
'1', n, m2, df, n, rwork )
275 IF( cnorm.GT.zero )
THEN
276 result( 6 ) = resid / (eps*max(1,m2)*dnorm)
283 DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
subroutine sgemqrt(side, trans, m, n, k, nb, v, ldv, t, ldt, c, ldc, work, info)
SGEMQRT
subroutine ssyrk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
SSYRK
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
subroutine slarnv(idist, iseed, n, x)
SLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine slaset(uplo, m, n, alpha, beta, a, lda)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine stpmqrt(side, trans, m, n, k, l, nb, v, ldv, t, ldt, a, lda, b, ldb, work, info)
STPMQRT
subroutine stpqrt(m, n, l, nb, a, lda, b, ldb, t, ldt, work, info)
STPQRT
subroutine sqrt05(m, n, l, nb, result)
SQRT05