212 SUBROUTINE zhet21( ITYPE, UPLO, N, KBAND, A, LDA, D, E, U, LDU, V,
213 $ LDV, TAU, WORK, RWORK, RESULT )
221 INTEGER ITYPE, KBAND, LDA, LDU, LDV, N
224 DOUBLE PRECISION D( * ), E( * ), RESULT( 2 ), RWORK( * )
225 COMPLEX*16 A( LDA, * ), TAU( * ), U( LDU, * ),
226 $ v( ldv, * ), work( * )
232 DOUBLE PRECISION ZERO, ONE, TEN
233 parameter( zero = 0.0d+0, one = 1.0d+0, ten = 10.0d+0 )
234 COMPLEX*16 CZERO, CONE
235 parameter( czero = ( 0.0d+0, 0.0d+0 ),
236 $ cone = ( 1.0d+0, 0.0d+0 ) )
241 INTEGER IINFO, J, JCOL, JR, JROW
242 DOUBLE PRECISION ANORM, ULP, UNFL, WNORM
247 DOUBLE PRECISION DLAMCH, ZLANGE, ZLANHE
248 EXTERNAL lsame, dlamch, zlange, zlanhe
255 INTRINSIC dble, dcmplx, max, min
265 IF( lsame( uplo,
'U' ) )
THEN
273 unfl = dlamch(
'Safe minimum' )
274 ulp = dlamch(
'Epsilon' )*dlamch(
'Base' )
278 IF( itype.LT.1 .OR. itype.GT.3 )
THEN
279 result( 1 ) = ten / ulp
287 IF( itype.EQ.3 )
THEN
290 anorm = max( zlanhe(
'1', cuplo, n, a, lda, rwork ), unfl )
295 IF( itype.EQ.1 )
THEN
299 CALL zlaset(
'Full', n, n, czero, czero, work, n )
300 CALL zlacpy( cuplo, n, n, a, lda, work, n )
303 CALL zher( cuplo, n, -d( j ), u( 1, j ), 1, work, n )
306 IF( n.GT.1 .AND. kband.EQ.1 )
THEN
308 CALL zher2( cuplo, n, -dcmplx( e( j ) ), u( 1, j ), 1,
309 $ u( 1, j+1 ), 1, work, n )
312 wnorm = zlanhe(
'1', cuplo, n, work, n, rwork )
314 ELSE IF( itype.EQ.2 )
THEN
318 CALL zlaset(
'Full', n, n, czero, czero, work, n )
321 work( n**2 ) = d( n )
322 DO 40 j = n - 1, 1, -1
323 IF( kband.EQ.1 )
THEN
324 work( ( n+1 )*( j-1 )+2 ) = ( cone-tau( j ) )*e( j )
326 work( ( j-1 )*n+jr ) = -tau( j )*e( j )*v( jr, j )
332 CALL zlarfy(
'L', n-j, v( j+1, j ), 1, tau( j ),
333 $ work( ( n+1 )*j+1 ), n, work( n**2+1 ) )
335 work( ( n+1 )*( j-1 )+1 ) = d( j )
340 IF( kband.EQ.1 )
THEN
341 work( ( n+1 )*j ) = ( cone-tau( j ) )*e( j )
343 work( j*n+jr ) = -tau( j )*e( j )*v( jr, j+1 )
349 CALL zlarfy(
'U', j, v( 1, j+1 ), 1, tau( j ), work, n,
352 work( ( n+1 )*j+1 ) = d( j+1 )
359 work( jrow+n*( jcol-1 ) ) = work( jrow+n*( jcol-1 ) )
364 work( jrow+n*( jcol-1 ) ) = work( jrow+n*( jcol-1 ) )
369 wnorm = zlanhe(
'1', cuplo, n, work, n, rwork )
371 ELSE IF( itype.EQ.3 )
THEN
377 CALL zlacpy(
' ', n, n, u, ldu, work, n )
379 CALL zunm2r(
'R',
'C', n, n-1, n-1, v( 2, 1 ), ldv, tau,
380 $ work( n+1 ), n, work( n**2+1 ), iinfo )
382 CALL zunm2l(
'R',
'C', n, n-1, n-1, v( 1, 2 ), ldv, tau,
383 $ work, n, work( n**2+1 ), iinfo )
385 IF( iinfo.NE.0 )
THEN
386 result( 1 ) = ten / ulp
391 work( ( n+1 )*( j-1 )+1 ) = work( ( n+1 )*( j-1 )+1 ) - cone
394 wnorm = zlange(
'1', n, n, work, n, rwork )
397 IF( anorm.GT.wnorm )
THEN
398 result( 1 ) = ( wnorm / anorm ) / ( n*ulp )
400 IF( anorm.LT.one )
THEN
401 result( 1 ) = ( min( wnorm, n*anorm ) / anorm ) / ( n*ulp )
403 result( 1 ) = min( wnorm / anorm, dble( n ) ) / ( n*ulp )
411 IF( itype.EQ.1 )
THEN
412 CALL zgemm(
'N',
'C', n, n, n, cone, u, ldu, u, ldu, czero,
416 work( ( n+1 )*( j-1 )+1 ) = work( ( n+1 )*( j-1 )+1 ) - cone
419 result( 2 ) = min( zlange(
'1', n, n, work, n, rwork ),
420 $ dble( n ) ) / ( n*ulp )
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
subroutine zher2(uplo, n, alpha, x, incx, y, incy, a, lda)
ZHER2
subroutine zher(uplo, n, alpha, x, incx, a, lda)
ZHER
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlarfy(uplo, n, v, incv, tau, c, ldc, work)
ZLARFY
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 zunm2l(side, trans, m, n, k, a, lda, tau, c, ldc, work, info)
ZUNM2L multiplies a general matrix by the unitary matrix from a QL factorization determined by cgeqlf...
subroutine zunm2r(side, trans, m, n, k, a, lda, tau, c, ldc, work, info)
ZUNM2R multiplies a general matrix by the unitary matrix from a QR factorization determined by cgeqrf...
subroutine zhet21(itype, uplo, n, kband, a, lda, d, e, u, ldu, v, ldv, tau, work, rwork, result)
ZHET21