81 SUBROUTINE ztsqr01(TSSW, M, N, MB, NB, RESULT)
92 DOUBLE PRECISION RESULT(6)
98 COMPLEX*16,
ALLOCATABLE :: AF(:,:), Q(:,:),
99 $ R(:,:), WORK( : ), T(:),
100 $ CF(:,:), DF(:,:), A(:,:), C(:,:), D(:,:), LQ(:,:)
101 DOUBLE PRECISION,
ALLOCATABLE :: RWORK(:)
104 DOUBLE PRECISION ZERO
105 COMPLEX*16 ONE, CZERO
106 parameter( zero = 0.0, one = (1.0,0.0), czero=(0.0,0.0) )
109 LOGICAL TESTZEROS, TS
110 INTEGER INFO, J, K, L, LWORK, TSIZE, MNB
111 DOUBLE PRECISION ANORM, EPS, RESID, CNORM, DNORM
115 COMPLEX*16 TQUERY( 5 ), WORKQUERY( 1 )
118 DOUBLE PRECISION DLAMCH, ZLANGE, ZLANSY
121 EXTERNAL dlamch, zlange, zlansy, lsame, ilaenv
129 COMMON / srnamc / srnamt
132 DATA iseed / 1988, 1989, 1990, 1991 /
136 ts = lsame(tssw,
'TS')
142 eps = dlamch(
'Epsilon' )
150 ALLOCATE ( a(m,n), af(m,n), q(l,l), r(m,l), rwork(l),
152 $ d(n,m), df(n,m), lq(l,n) )
157 CALL zlarnv( 2, iseed, m, a( 1, j ) )
162 CALL zlarnv( 2, iseed, m/2, a( m/4, j ) )
166 CALL zlacpy(
'Full', m, n, a, m, af, m )
172 CALL zgeqr( m, n, af, m, tquery, -1, workquery, -1, info )
173 tsize = int( tquery( 1 ) )
174 lwork = int( workquery( 1 ) )
175 CALL zgemqr(
'L',
'N', m, m, k, af, m, tquery, tsize, cf, m,
176 $ workquery, -1, info)
177 lwork = max( lwork, int( workquery( 1 ) ) )
178 CALL zgemqr(
'L',
'N', m, n, k, af, m, tquery, tsize, cf, m,
179 $ workquery, -1, info)
180 lwork = max( lwork, int( workquery( 1 ) ) )
181 CALL zgemqr(
'L',
'C', m, n, k, af, m, tquery, tsize, cf, m,
182 $ workquery, -1, info)
183 lwork = max( lwork, int( workquery( 1 ) ) )
184 CALL zgemqr(
'R',
'N', n, m, k, af, m, tquery, tsize, df, n,
185 $ workquery, -1, info)
186 lwork = max( lwork, int( workquery( 1 ) ) )
187 CALL zgemqr(
'R',
'C', n, m, k, af, m, tquery, tsize, df, n,
188 $ workquery, -1, info)
189 lwork = max( lwork, int( workquery( 1 ) ) )
190 ALLOCATE ( t( tsize ) )
191 ALLOCATE ( work( lwork ) )
193 CALL zgeqr( m, n, af, m, t, tsize, work, lwork, info )
197 CALL zlaset(
'Full', m, m, czero, one, q, m )
199 CALL zgemqr(
'L',
'N', m, m, k, af, m, t, tsize, q, m,
200 $ work, lwork, info )
204 CALL zlaset(
'Full', m, n, czero, czero, r, m )
205 CALL zlacpy(
'Upper', m, n, af, m, r, m )
209 CALL zgemm(
'C',
'N', m, n, m, -one, q, m, a, m, one, r, m )
210 anorm = zlange(
'1', m, n, a, m, rwork )
211 resid = zlange(
'1', m, n, r, m, rwork )
212 IF( anorm.GT.zero )
THEN
213 result( 1 ) = resid / (eps*max(1,m)*anorm)
220 CALL zlaset(
'Full', m, m, czero, one, r, m )
221 CALL zherk(
'U',
'C', m, m, dreal(-one), q, m, dreal(one), r, m )
222 resid = zlansy(
'1',
'Upper', m, r, m, rwork )
223 result( 2 ) = resid / (eps*max(1,m))
228 CALL zlarnv( 2, iseed, m, c( 1, j ) )
230 cnorm = zlange(
'1', m, n, c, m, rwork)
231 CALL zlacpy(
'Full', m, n, c, m, cf, m )
236 CALL zgemqr(
'L',
'N', m, n, k, af, m, t, tsize, cf, m,
241 CALL zgemm(
'N',
'N', m, n, m, -one, q, m, c, m, one, cf, m )
242 resid = zlange(
'1', m, n, cf, m, rwork )
243 IF( cnorm.GT.zero )
THEN
244 result( 3 ) = resid / (eps*max(1,m)*cnorm)
251 CALL zlacpy(
'Full', m, n, c, m, cf, m )
256 CALL zgemqr(
'L',
'C', m, n, k, af, m, t, tsize, cf, m,
261 CALL zgemm(
'C',
'N', m, n, m, -one, q, m, c, m, one, cf, m )
262 resid = zlange(
'1', m, n, cf, m, rwork )
263 IF( cnorm.GT.zero )
THEN
264 result( 4 ) = resid / (eps*max(1,m)*cnorm)
272 CALL zlarnv( 2, iseed, n, d( 1, j ) )
274 dnorm = zlange(
'1', n, m, d, n, rwork)
275 CALL zlacpy(
'Full', n, m, d, n, df, n )
280 CALL zgemqr(
'R',
'N', n, m, k, af, m, t, tsize, df, n,
285 CALL zgemm(
'N',
'N', n, m, m, -one, d, n, q, m, one, df, n )
286 resid = zlange(
'1', n, m, df, n, rwork )
287 IF( dnorm.GT.zero )
THEN
288 result( 5 ) = resid / (eps*max(1,m)*dnorm)
295 CALL zlacpy(
'Full', n, m, d, n, df, n )
299 CALL zgemqr(
'R',
'C', n, m, k, af, m, t, tsize, df, n,
304 CALL zgemm(
'N',
'C', n, m, m, -one, d, n, q, m, one, df, n )
305 resid = zlange(
'1', n, m, df, n, rwork )
306 IF( cnorm.GT.zero )
THEN
307 result( 6 ) = resid / (eps*max(1,m)*dnorm)
315 CALL zgelq( m, n, af, m, tquery, -1, workquery, -1, info )
316 tsize = int( tquery( 1 ) )
317 lwork = int( workquery( 1 ) )
318 CALL zgemlq(
'R',
'N', n, n, k, af, m, tquery, tsize, q, n,
319 $ workquery, -1, info )
320 lwork = max( lwork, int( workquery( 1 ) ) )
321 CALL zgemlq(
'L',
'N', n, m, k, af, m, tquery, tsize, df, n,
322 $ workquery, -1, info)
323 lwork = max( lwork, int( workquery( 1 ) ) )
324 CALL zgemlq(
'L',
'C', n, m, k, af, m, tquery, tsize, df, n,
325 $ workquery, -1, info)
326 lwork = max( lwork, int( workquery( 1 ) ) )
327 CALL zgemlq(
'R',
'N', m, n, k, af, m, tquery, tsize, cf, m,
328 $ workquery, -1, info)
329 lwork = max( lwork, int( workquery( 1 ) ) )
330 CALL zgemlq(
'R',
'C', m, n, k, af, m, tquery, tsize, cf, m,
331 $ workquery, -1, info)
332 lwork = max( lwork, int( workquery( 1 ) ) )
333 ALLOCATE ( t( tsize ) )
334 ALLOCATE ( work( lwork ) )
336 CALL zgelq( m, n, af, m, t, tsize, work, lwork, info )
341 CALL zlaset(
'Full', n, n, czero, one, q, n )
343 CALL zgemlq(
'R',
'N', n, n, k, af, m, t, tsize, q, n,
344 $ work, lwork, info )
348 CALL zlaset(
'Full', m, n, czero, czero, lq, l )
349 CALL zlacpy(
'Lower', m, n, af, m, lq, l )
353 CALL zgemm(
'N',
'C', m, n, n, -one, a, m, q, n, one, lq, l )
354 anorm = zlange(
'1', m, n, a, m, rwork )
355 resid = zlange(
'1', m, n, lq, l, rwork )
356 IF( anorm.GT.zero )
THEN
357 result( 1 ) = resid / (eps*max(1,n)*anorm)
364 CALL zlaset(
'Full', n, n, czero, one, lq, l )
365 CALL zherk(
'U',
'C', n, n, dreal(-one), q, n, dreal(one), lq, l)
366 resid = zlansy(
'1',
'Upper', n, lq, l, rwork )
367 result( 2 ) = resid / (eps*max(1,n))
372 CALL zlarnv( 2, iseed, n, d( 1, j ) )
374 dnorm = zlange(
'1', n, m, d, n, rwork)
375 CALL zlacpy(
'Full', n, m, d, n, df, n )
379 CALL zgemlq(
'L',
'N', n, m, k, af, m, t, tsize, df, n,
384 CALL zgemm(
'N',
'N', n, m, n, -one, q, n, d, n, one, df, n )
385 resid = zlange(
'1', n, m, df, n, rwork )
386 IF( dnorm.GT.zero )
THEN
387 result( 3 ) = resid / (eps*max(1,n)*dnorm)
394 CALL zlacpy(
'Full', n, m, d, n, df, n )
398 CALL zgemlq(
'L',
'C', n, m, k, af, m, t, tsize, df, n,
403 CALL zgemm(
'C',
'N', n, m, n, -one, q, n, d, n, one, df, n )
404 resid = zlange(
'1', n, m, df, n, rwork )
405 IF( dnorm.GT.zero )
THEN
406 result( 4 ) = resid / (eps*max(1,n)*dnorm)
414 CALL zlarnv( 2, iseed, m, c( 1, j ) )
416 cnorm = zlange(
'1', m, n, c, m, rwork)
417 CALL zlacpy(
'Full', m, n, c, m, cf, m )
421 CALL zgemlq(
'R',
'N', m, n, k, af, m, t, tsize, cf, m,
426 CALL zgemm(
'N',
'N', m, n, n, -one, c, m, q, n, one, cf, m )
427 resid = zlange(
'1', n, m, df, n, rwork )
428 IF( cnorm.GT.zero )
THEN
429 result( 5 ) = resid / (eps*max(1,n)*cnorm)
436 CALL zlacpy(
'Full', m, n, c, m, cf, m )
440 CALL zgemlq(
'R',
'C', m, n, k, af, m, t, tsize, cf, m,
445 CALL zgemm(
'N',
'C', m, n, n, -one, c, m, q, n, one, cf, m )
446 resid = zlange(
'1', m, n, cf, m, rwork )
447 IF( cnorm.GT.zero )
THEN
448 result( 6 ) = resid / (eps*max(1,n)*cnorm)
457 DEALLOCATE ( a, af, q, r, rwork, work, t, c, d, cf, df)
subroutine zgelq(m, n, a, lda, t, tsize, work, lwork, info)
ZGELQ
subroutine zgemlq(side, trans, m, n, k, a, lda, t, tsize, c, ldc, work, lwork, info)
ZGEMLQ
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
subroutine zgemqr(side, trans, m, n, k, a, lda, t, tsize, c, ldc, work, lwork, info)
ZGEMQR
subroutine zgeqr(m, n, a, lda, t, tsize, work, lwork, info)
ZGEQR
subroutine zherk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
ZHERK
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlarnv(idist, iseed, n, x)
ZLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine ztsqr01(tssw, m, n, mb, nb, result)
ZTSQR01