*> \brief \b ZBDT02 * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE ZBDT02( M, N, B, LDB, C, LDC, U, LDU, WORK, RWORK, * RESID ) * * .. Scalar Arguments .. * INTEGER LDB, LDC, LDU, M, N * DOUBLE PRECISION RESID * .. * .. Array Arguments .. * DOUBLE PRECISION RWORK( * ) * COMPLEX*16 B( LDB, * ), C( LDC, * ), U( LDU, * ), * $ WORK( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ZBDT02 tests the change of basis C = U**H * B by computing the *> residual *> *> RESID = norm(B - U * C) / ( max(m,n) * norm(B) * EPS ), *> *> where B and C are M by N matrices, U is an M by M orthogonal matrix, *> and EPS is the machine precision. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrices B and C and the order of *> the matrix Q. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrices B and C. *> \endverbatim *> *> \param[in] B *> \verbatim *> B is COMPLEX*16 array, dimension (LDB,N) *> The m by n matrix B. *> \endverbatim *> *> \param[in] LDB *> \verbatim *> LDB is INTEGER *> The leading dimension of the array B. LDB >= max(1,M). *> \endverbatim *> *> \param[in] C *> \verbatim *> C is COMPLEX*16 array, dimension (LDC,N) *> The m by n matrix C, assumed to contain U**H * B. *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> The leading dimension of the array C. LDC >= max(1,M). *> \endverbatim *> *> \param[in] U *> \verbatim *> U is COMPLEX*16 array, dimension (LDU,M) *> The m by m orthogonal matrix U. *> \endverbatim *> *> \param[in] LDU *> \verbatim *> LDU is INTEGER *> The leading dimension of the array U. LDU >= max(1,M). *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is COMPLEX*16 array, dimension (M) *> \endverbatim *> *> \param[out] RWORK *> \verbatim *> RWORK is DOUBLE PRECISION array, dimension (M) *> \endverbatim *> *> \param[out] RESID *> \verbatim *> RESID is DOUBLE PRECISION *> RESID = norm(B - U * C) / ( max(m,n) * norm(B) * EPS ), *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup complex16_eig * * ===================================================================== SUBROUTINE ZBDT02( M, N, B, LDB, C, LDC, U, LDU, WORK, RWORK, $ RESID ) * * -- LAPACK test routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. INTEGER LDB, LDC, LDU, M, N DOUBLE PRECISION RESID * .. * .. Array Arguments .. DOUBLE PRECISION RWORK( * ) COMPLEX*16 B( LDB, * ), C( LDC, * ), U( LDU, * ), $ WORK( * ) * .. * * ====================================================================== * * .. Parameters .. DOUBLE PRECISION ZERO, ONE PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) * .. * .. Local Scalars .. INTEGER J DOUBLE PRECISION BNORM, EPS, REALMN * .. * .. External Functions .. DOUBLE PRECISION DLAMCH, DZASUM, ZLANGE EXTERNAL DLAMCH, DZASUM, ZLANGE * .. * .. External Subroutines .. EXTERNAL ZCOPY, ZGEMV * .. * .. Intrinsic Functions .. INTRINSIC DBLE, DCMPLX, MAX, MIN * .. * .. Executable Statements .. * * Quick return if possible * RESID = ZERO IF( M.LE.0 .OR. N.LE.0 ) $ RETURN REALMN = DBLE( MAX( M, N ) ) EPS = DLAMCH( 'Precision' ) * * Compute norm(B - U * C) * DO 10 J = 1, N CALL ZCOPY( M, B( 1, J ), 1, WORK, 1 ) CALL ZGEMV( 'No transpose', M, M, -DCMPLX( ONE ), U, LDU, $ C( 1, J ), 1, DCMPLX( ONE ), WORK, 1 ) RESID = MAX( RESID, DZASUM( M, WORK, 1 ) ) 10 CONTINUE * * Compute norm of B. * BNORM = ZLANGE( '1', M, N, B, LDB, RWORK ) * IF( BNORM.LE.ZERO ) THEN IF( RESID.NE.ZERO ) $ RESID = ONE / EPS ELSE IF( BNORM.GE.RESID ) THEN RESID = ( RESID / BNORM ) / ( REALMN*EPS ) ELSE IF( BNORM.LT.ONE ) THEN RESID = ( MIN( RESID, REALMN*BNORM ) / BNORM ) / $ ( REALMN*EPS ) ELSE RESID = MIN( RESID / BNORM, REALMN ) / ( REALMN*EPS ) END IF END IF END IF RETURN * * End of ZBDT02 * END