LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zlqt02.f
Go to the documentation of this file.
00001 *> \brief \b ZLQT02
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *  Definition:
00009 *  ===========
00010 *
00011 *       SUBROUTINE ZLQT02( M, N, K, A, AF, Q, L, LDA, TAU, WORK, LWORK,
00012 *                          RWORK, RESULT )
00013 * 
00014 *       .. Scalar Arguments ..
00015 *       INTEGER            K, LDA, LWORK, M, N
00016 *       ..
00017 *       .. Array Arguments ..
00018 *       DOUBLE PRECISION   RESULT( * ), RWORK( * )
00019 *       COMPLEX*16         A( LDA, * ), AF( LDA, * ), L( LDA, * ),
00020 *      $                   Q( LDA, * ), TAU( * ), WORK( LWORK )
00021 *       ..
00022 *  
00023 *
00024 *> \par Purpose:
00025 *  =============
00026 *>
00027 *> \verbatim
00028 *>
00029 *> ZLQT02 tests ZUNGLQ, which generates an m-by-n matrix Q with
00030 *> orthonornmal rows that is defined as the product of k elementary
00031 *> reflectors.
00032 *>
00033 *> Given the LQ factorization of an m-by-n matrix A, ZLQT02 generates
00034 *> the orthogonal matrix Q defined by the factorization of the first k
00035 *> rows of A; it compares L(1:k,1:m) with A(1:k,1:n)*Q(1:m,1:n)', and
00036 *> checks that the rows of Q are orthonormal.
00037 *> \endverbatim
00038 *
00039 *  Arguments:
00040 *  ==========
00041 *
00042 *> \param[in] M
00043 *> \verbatim
00044 *>          M is INTEGER
00045 *>          The number of rows of the matrix Q to be generated.  M >= 0.
00046 *> \endverbatim
00047 *>
00048 *> \param[in] N
00049 *> \verbatim
00050 *>          N is INTEGER
00051 *>          The number of columns of the matrix Q to be generated.
00052 *>          N >= M >= 0.
00053 *> \endverbatim
00054 *>
00055 *> \param[in] K
00056 *> \verbatim
00057 *>          K is INTEGER
00058 *>          The number of elementary reflectors whose product defines the
00059 *>          matrix Q. M >= K >= 0.
00060 *> \endverbatim
00061 *>
00062 *> \param[in] A
00063 *> \verbatim
00064 *>          A is COMPLEX*16 array, dimension (LDA,N)
00065 *>          The m-by-n matrix A which was factorized by ZLQT01.
00066 *> \endverbatim
00067 *>
00068 *> \param[in] AF
00069 *> \verbatim
00070 *>          AF is COMPLEX*16 array, dimension (LDA,N)
00071 *>          Details of the LQ factorization of A, as returned by ZGELQF.
00072 *>          See ZGELQF for further details.
00073 *> \endverbatim
00074 *>
00075 *> \param[out] Q
00076 *> \verbatim
00077 *>          Q is COMPLEX*16 array, dimension (LDA,N)
00078 *> \endverbatim
00079 *>
00080 *> \param[out] L
00081 *> \verbatim
00082 *>          L is COMPLEX*16 array, dimension (LDA,M)
00083 *> \endverbatim
00084 *>
00085 *> \param[in] LDA
00086 *> \verbatim
00087 *>          LDA is INTEGER
00088 *>          The leading dimension of the arrays A, AF, Q and L. LDA >= N.
00089 *> \endverbatim
00090 *>
00091 *> \param[in] TAU
00092 *> \verbatim
00093 *>          TAU is COMPLEX*16 array, dimension (M)
00094 *>          The scalar factors of the elementary reflectors corresponding
00095 *>          to the LQ factorization in AF.
00096 *> \endverbatim
00097 *>
00098 *> \param[out] WORK
00099 *> \verbatim
00100 *>          WORK is COMPLEX*16 array, dimension (LWORK)
00101 *> \endverbatim
00102 *>
00103 *> \param[in] LWORK
00104 *> \verbatim
00105 *>          LWORK is INTEGER
00106 *>          The dimension of the array WORK.
00107 *> \endverbatim
00108 *>
00109 *> \param[out] RWORK
00110 *> \verbatim
00111 *>          RWORK is DOUBLE PRECISION array, dimension (M)
00112 *> \endverbatim
00113 *>
00114 *> \param[out] RESULT
00115 *> \verbatim
00116 *>          RESULT is DOUBLE PRECISION array, dimension (2)
00117 *>          The test ratios:
00118 *>          RESULT(1) = norm( L - A*Q' ) / ( N * norm(A) * EPS )
00119 *>          RESULT(2) = norm( I - Q*Q' ) / ( N * EPS )
00120 *> \endverbatim
00121 *
00122 *  Authors:
00123 *  ========
00124 *
00125 *> \author Univ. of Tennessee 
00126 *> \author Univ. of California Berkeley 
00127 *> \author Univ. of Colorado Denver 
00128 *> \author NAG Ltd. 
00129 *
00130 *> \date November 2011
00131 *
00132 *> \ingroup complex16_lin
00133 *
00134 *  =====================================================================
00135       SUBROUTINE ZLQT02( M, N, K, A, AF, Q, L, LDA, TAU, WORK, LWORK,
00136      $                   RWORK, RESULT )
00137 *
00138 *  -- LAPACK test routine (version 3.4.0) --
00139 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00140 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00141 *     November 2011
00142 *
00143 *     .. Scalar Arguments ..
00144       INTEGER            K, LDA, LWORK, M, N
00145 *     ..
00146 *     .. Array Arguments ..
00147       DOUBLE PRECISION   RESULT( * ), RWORK( * )
00148       COMPLEX*16         A( LDA, * ), AF( LDA, * ), L( LDA, * ),
00149      $                   Q( LDA, * ), TAU( * ), WORK( LWORK )
00150 *     ..
00151 *
00152 *  =====================================================================
00153 *
00154 *     .. Parameters ..
00155       DOUBLE PRECISION   ZERO, ONE
00156       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00157       COMPLEX*16         ROGUE
00158       PARAMETER          ( ROGUE = ( -1.0D+10, -1.0D+10 ) )
00159 *     ..
00160 *     .. Local Scalars ..
00161       INTEGER            INFO
00162       DOUBLE PRECISION   ANORM, EPS, RESID
00163 *     ..
00164 *     .. External Functions ..
00165       DOUBLE PRECISION   DLAMCH, ZLANGE, ZLANSY
00166       EXTERNAL           DLAMCH, ZLANGE, ZLANSY
00167 *     ..
00168 *     .. External Subroutines ..
00169       EXTERNAL           ZGEMM, ZHERK, ZLACPY, ZLASET, ZUNGLQ
00170 *     ..
00171 *     .. Intrinsic Functions ..
00172       INTRINSIC          DBLE, DCMPLX, MAX
00173 *     ..
00174 *     .. Scalars in Common ..
00175       CHARACTER*32       SRNAMT
00176 *     ..
00177 *     .. Common blocks ..
00178       COMMON             / SRNAMC / SRNAMT
00179 *     ..
00180 *     .. Executable Statements ..
00181 *
00182       EPS = DLAMCH( 'Epsilon' )
00183 *
00184 *     Copy the first k rows of the factorization to the array Q
00185 *
00186       CALL ZLASET( 'Full', M, N, ROGUE, ROGUE, Q, LDA )
00187       CALL ZLACPY( 'Upper', K, N-1, AF( 1, 2 ), LDA, Q( 1, 2 ), LDA )
00188 *
00189 *     Generate the first n columns of the matrix Q
00190 *
00191       SRNAMT = 'ZUNGLQ'
00192       CALL ZUNGLQ( M, N, K, Q, LDA, TAU, WORK, LWORK, INFO )
00193 *
00194 *     Copy L(1:k,1:m)
00195 *
00196       CALL ZLASET( 'Full', K, M, DCMPLX( ZERO ), DCMPLX( ZERO ), L,
00197      $             LDA )
00198       CALL ZLACPY( 'Lower', K, M, AF, LDA, L, LDA )
00199 *
00200 *     Compute L(1:k,1:m) - A(1:k,1:n) * Q(1:m,1:n)'
00201 *
00202       CALL ZGEMM( 'No transpose', 'Conjugate transpose', K, M, N,
00203      $            DCMPLX( -ONE ), A, LDA, Q, LDA, DCMPLX( ONE ), L,
00204      $            LDA )
00205 *
00206 *     Compute norm( L - A*Q' ) / ( N * norm(A) * EPS ) .
00207 *
00208       ANORM = ZLANGE( '1', K, N, A, LDA, RWORK )
00209       RESID = ZLANGE( '1', K, M, L, LDA, RWORK )
00210       IF( ANORM.GT.ZERO ) THEN
00211          RESULT( 1 ) = ( ( RESID / DBLE( MAX( 1, N ) ) ) / ANORM ) / EPS
00212       ELSE
00213          RESULT( 1 ) = ZERO
00214       END IF
00215 *
00216 *     Compute I - Q*Q'
00217 *
00218       CALL ZLASET( 'Full', M, M, DCMPLX( ZERO ), DCMPLX( ONE ), L, LDA )
00219       CALL ZHERK( 'Upper', 'No transpose', M, N, -ONE, Q, LDA, ONE, L,
00220      $            LDA )
00221 *
00222 *     Compute norm( I - Q*Q' ) / ( N * EPS ) .
00223 *
00224       RESID = ZLANSY( '1', 'Upper', M, L, LDA, RWORK )
00225 *
00226       RESULT( 2 ) = ( RESID / DBLE( MAX( 1, N ) ) ) / EPS
00227 *
00228       RETURN
00229 *
00230 *     End of ZLQT02
00231 *
00232       END
 All Files Functions