226 SUBROUTINE chpt21( ITYPE, UPLO, N, KBAND, AP, D, E, U, LDU, VP,
227 $ TAU, WORK, RWORK, RESULT )
235 INTEGER ITYPE, KBAND, LDU, N
238 REAL D( * ), E( * ), RESULT( 2 ), RWORK( * )
239 COMPLEX AP( * ), TAU( * ), U( LDU, * ), VP( * ),
247 parameter( zero = 0.0e+0, one = 1.0e+0, ten = 10.0e+0 )
249 parameter( half = 1.0e+0 / 2.0e+0 )
251 parameter( czero = ( 0.0e+0, 0.0e+0 ),
252 $ cone = ( 1.0e+0, 0.0e+0 ) )
257 INTEGER IINFO, J, JP, JP1, JR, LAP
258 REAL ANORM, ULP, UNFL, WNORM
263 REAL CLANGE, CLANHP, SLAMCH
265 EXTERNAL lsame, clange, clanhp, slamch, cdotc
272 INTRINSIC cmplx, max, min, real
284 lap = ( n*( n+1 ) ) / 2
286 IF( lsame( uplo,
'U' ) )
THEN
294 unfl = slamch(
'Safe minimum' )
295 ulp = slamch(
'Epsilon' )*slamch(
'Base' )
299 IF( itype.LT.1 .OR. itype.GT.3 )
THEN
300 result( 1 ) = ten / ulp
308 IF( itype.EQ.3 )
THEN
311 anorm = max( clanhp(
'1', cuplo, n, ap, rwork ), unfl )
316 IF( itype.EQ.1 )
THEN
320 CALL claset(
'Full', n, n, czero, czero, work, n )
321 CALL ccopy( lap, ap, 1, work, 1 )
324 CALL chpr( cuplo, n, -d( j ), u( 1, j ), 1, work )
327 IF( n.GT.1 .AND. kband.EQ.1 )
THEN
329 CALL chpr2( cuplo, n, -cmplx( e( j ) ), u( 1, j ), 1,
330 $ u( 1, j-1 ), 1, work )
333 wnorm = clanhp(
'1', cuplo, n, work, rwork )
335 ELSE IF( itype.EQ.2 )
THEN
339 CALL claset(
'Full', n, n, czero, czero, work, n )
343 DO 40 j = n - 1, 1, -1
344 jp = ( ( 2*n-j )*( j-1 ) ) / 2
346 IF( kband.EQ.1 )
THEN
347 work( jp+j+1 ) = ( cone-tau( j ) )*e( j )
349 work( jp+jr ) = -tau( j )*e( j )*vp( jp+jr )
353 IF( tau( j ).NE.czero )
THEN
356 CALL chpmv(
'L', n-j, cone, work( jp1+j+1 ),
357 $ vp( jp+j+1 ), 1, czero, work( lap+1 ), 1 )
358 temp = -half*tau( j )*cdotc( n-j, work( lap+1 ), 1,
360 CALL caxpy( n-j, temp, vp( jp+j+1 ), 1, work( lap+1 ),
362 CALL chpr2(
'L', n-j, -tau( j ), vp( jp+j+1 ), 1,
363 $ work( lap+1 ), 1, work( jp1+j+1 ) )
367 work( jp+j ) = d( j )
372 jp = ( j*( j-1 ) ) / 2
374 IF( kband.EQ.1 )
THEN
375 work( jp1+j ) = ( cone-tau( j ) )*e( j )
377 work( jp1+jr ) = -tau( j )*e( j )*vp( jp1+jr )
381 IF( tau( j ).NE.czero )
THEN
384 CALL chpmv(
'U', j, cone, work, vp( jp1+1 ), 1, czero,
386 temp = -half*tau( j )*cdotc( j, work( lap+1 ), 1,
388 CALL caxpy( j, temp, vp( jp1+1 ), 1, work( lap+1 ),
390 CALL chpr2(
'U', j, -tau( j ), vp( jp1+1 ), 1,
391 $ work( lap+1 ), 1, work )
394 work( jp1+j+1 ) = d( j+1 )
399 work( j ) = work( j ) - ap( j )
401 wnorm = clanhp(
'1', cuplo, n, work, rwork )
403 ELSE IF( itype.EQ.3 )
THEN
409 CALL clacpy(
' ', n, n, u, ldu, work, n )
410 CALL cupmtr(
'R', cuplo,
'C', n, n, vp, tau, work, n,
411 $ work( n**2+1 ), iinfo )
412 IF( iinfo.NE.0 )
THEN
413 result( 1 ) = ten / ulp
418 work( ( n+1 )*( j-1 )+1 ) = work( ( n+1 )*( j-1 )+1 ) - cone
421 wnorm = clange(
'1', n, n, work, n, rwork )
424 IF( anorm.GT.wnorm )
THEN
425 result( 1 ) = ( wnorm / anorm ) / ( n*ulp )
427 IF( anorm.LT.one )
THEN
428 result( 1 ) = ( min( wnorm, n*anorm ) / anorm ) / ( n*ulp )
430 result( 1 ) = min( wnorm / anorm, real( n ) ) / ( n*ulp )
438 IF( itype.EQ.1 )
THEN
439 CALL cgemm(
'N',
'C', n, n, n, cone, u, ldu, u, ldu, czero,
443 work( ( n+1 )*( j-1 )+1 ) = work( ( n+1 )*( j-1 )+1 ) - cone
446 result( 2 ) = min( clange(
'1', n, n, work, n, rwork ),
447 $ real( n ) ) / ( n*ulp )
subroutine chpt21(itype, uplo, n, kband, ap, d, e, u, ldu, vp, tau, work, rwork, result)
CHPT21
subroutine caxpy(n, ca, cx, incx, cy, incy)
CAXPY
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine chpmv(uplo, n, alpha, ap, x, incx, beta, y, incy)
CHPMV
subroutine chpr2(uplo, n, alpha, x, incx, y, incy, ap)
CHPR2
subroutine chpr(uplo, n, alpha, x, incx, ap)
CHPR
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine cupmtr(side, uplo, trans, m, n, ap, tau, c, ldc, work, info)
CUPMTR