LAPACK 3.3.1
Linear Algebra PACKage

zhst01.f

Go to the documentation of this file.
00001       SUBROUTINE ZHST01( N, ILO, IHI, A, LDA, H, LDH, Q, LDQ, WORK,
00002      $                   LWORK, RWORK, RESULT )
00003 *
00004 *  -- LAPACK test routine (version 3.1) --
00005 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            IHI, ILO, LDA, LDH, LDQ, LWORK, N
00010 *     ..
00011 *     .. Array Arguments ..
00012       DOUBLE PRECISION   RESULT( 2 ), RWORK( * )
00013       COMPLEX*16         A( LDA, * ), H( LDH, * ), Q( LDQ, * ),
00014      $                   WORK( LWORK )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  ZHST01 tests the reduction of a general matrix A to upper Hessenberg
00021 *  form:  A = Q*H*Q'.  Two test ratios are computed;
00022 *
00023 *  RESULT(1) = norm( A - Q*H*Q' ) / ( norm(A) * N * EPS )
00024 *  RESULT(2) = norm( I - Q'*Q ) / ( N * EPS )
00025 *
00026 *  The matrix Q is assumed to be given explicitly as it would be
00027 *  following ZGEHRD + ZUNGHR.
00028 *
00029 *  In this version, ILO and IHI are not used, but they could be used
00030 *  to save some work if this is desired.
00031 *
00032 *  Arguments
00033 *  =========
00034 *
00035 *  N       (input) INTEGER
00036 *          The order of the matrix A.  N >= 0.
00037 *
00038 *  ILO     (input) INTEGER
00039 *  IHI     (input) INTEGER
00040 *          A is assumed to be upper triangular in rows and columns
00041 *          1:ILO-1 and IHI+1:N, so Q differs from the identity only in
00042 *          rows and columns ILO+1:IHI.
00043 *
00044 *  A       (input) COMPLEX*16 array, dimension (LDA,N)
00045 *          The original n by n matrix A.
00046 *
00047 *  LDA     (input) INTEGER
00048 *          The leading dimension of the array A.  LDA >= max(1,N).
00049 *
00050 *  H       (input) COMPLEX*16 array, dimension (LDH,N)
00051 *          The upper Hessenberg matrix H from the reduction A = Q*H*Q'
00052 *          as computed by ZGEHRD.  H is assumed to be zero below the
00053 *          first subdiagonal.
00054 *
00055 *  LDH     (input) INTEGER
00056 *          The leading dimension of the array H.  LDH >= max(1,N).
00057 *
00058 *  Q       (input) COMPLEX*16 array, dimension (LDQ,N)
00059 *          The orthogonal matrix Q from the reduction A = Q*H*Q' as
00060 *          computed by ZGEHRD + ZUNGHR.
00061 *
00062 *  LDQ     (input) INTEGER
00063 *          The leading dimension of the array Q.  LDQ >= max(1,N).
00064 *
00065 *  WORK    (workspace) COMPLEX*16 array, dimension (LWORK)
00066 *
00067 *  LWORK   (input) INTEGER
00068 *          The length of the array WORK.  LWORK >= 2*N*N.
00069 *
00070 *  RWORK   (workspace) DOUBLE PRECISION array, dimension (N)
00071 *
00072 *  RESULT  (output) DOUBLE PRECISION array, dimension (2)
00073 *          RESULT(1) = norm( A - Q*H*Q' ) / ( norm(A) * N * EPS )
00074 *          RESULT(2) = norm( I - Q'*Q ) / ( N * EPS )
00075 *
00076 *  =====================================================================
00077 *
00078 *     .. Parameters ..
00079       DOUBLE PRECISION   ONE, ZERO
00080       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
00081 *     ..
00082 *     .. Local Scalars ..
00083       INTEGER            LDWORK
00084       DOUBLE PRECISION   ANORM, EPS, OVFL, SMLNUM, UNFL, WNORM
00085 *     ..
00086 *     .. External Functions ..
00087       DOUBLE PRECISION   DLAMCH, ZLANGE
00088       EXTERNAL           DLAMCH, ZLANGE
00089 *     ..
00090 *     .. External Subroutines ..
00091       EXTERNAL           DLABAD, ZGEMM, ZLACPY, ZUNT01
00092 *     ..
00093 *     .. Intrinsic Functions ..
00094       INTRINSIC          DCMPLX, MAX, MIN
00095 *     ..
00096 *     .. Executable Statements ..
00097 *
00098 *     Quick return if possible
00099 *
00100       IF( N.LE.0 ) THEN
00101          RESULT( 1 ) = ZERO
00102          RESULT( 2 ) = ZERO
00103          RETURN
00104       END IF
00105 *
00106       UNFL = DLAMCH( 'Safe minimum' )
00107       EPS = DLAMCH( 'Precision' )
00108       OVFL = ONE / UNFL
00109       CALL DLABAD( UNFL, OVFL )
00110       SMLNUM = UNFL*N / EPS
00111 *
00112 *     Test 1:  Compute norm( A - Q*H*Q' ) / ( norm(A) * N * EPS )
00113 *
00114 *     Copy A to WORK
00115 *
00116       LDWORK = MAX( 1, N )
00117       CALL ZLACPY( ' ', N, N, A, LDA, WORK, LDWORK )
00118 *
00119 *     Compute Q*H
00120 *
00121       CALL ZGEMM( 'No transpose', 'No transpose', N, N, N,
00122      $            DCMPLX( ONE ), Q, LDQ, H, LDH, DCMPLX( ZERO ),
00123      $            WORK( LDWORK*N+1 ), LDWORK )
00124 *
00125 *     Compute A - Q*H*Q'
00126 *
00127       CALL ZGEMM( 'No transpose', 'Conjugate transpose', N, N, N,
00128      $            DCMPLX( -ONE ), WORK( LDWORK*N+1 ), LDWORK, Q, LDQ,
00129      $            DCMPLX( ONE ), WORK, LDWORK )
00130 *
00131       ANORM = MAX( ZLANGE( '1', N, N, A, LDA, RWORK ), UNFL )
00132       WNORM = ZLANGE( '1', N, N, WORK, LDWORK, RWORK )
00133 *
00134 *     Note that RESULT(1) cannot overflow and is bounded by 1/(N*EPS)
00135 *
00136       RESULT( 1 ) = MIN( WNORM, ANORM ) / MAX( SMLNUM, ANORM*EPS ) / N
00137 *
00138 *     Test 2:  Compute norm( I - Q'*Q ) / ( N * EPS )
00139 *
00140       CALL ZUNT01( 'Columns', N, N, Q, LDQ, WORK, LWORK, RWORK,
00141      $             RESULT( 2 ) )
00142 *
00143       RETURN
00144 *
00145 *     End of ZHST01
00146 *
00147       END
 All Files Functions