![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b CQLT02 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 CQLT02( 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 * REAL RESULT( * ), RWORK( * ) 00019 * COMPLEX A( LDA, * ), AF( LDA, * ), L( LDA, * ), 00020 * $ Q( LDA, * ), TAU( * ), WORK( LWORK ) 00021 * .. 00022 * 00023 * 00024 *> \par Purpose: 00025 * ============= 00026 *> 00027 *> \verbatim 00028 *> 00029 *> CQLT02 tests CUNGQL, which generates an m-by-n matrix Q with 00030 *> orthonornmal columns that is defined as the product of k elementary 00031 *> reflectors. 00032 *> 00033 *> Given the QL factorization of an m-by-n matrix A, CQLT02 generates 00034 *> the orthogonal matrix Q defined by the factorization of the last k 00035 *> columns of A; it compares L(m-n+1:m,n-k+1:n) with 00036 *> Q(1:m,m-n+1:m)'*A(1:m,n-k+1:n), and checks that the columns of Q are 00037 *> orthonormal. 00038 *> \endverbatim 00039 * 00040 * Arguments: 00041 * ========== 00042 * 00043 *> \param[in] M 00044 *> \verbatim 00045 *> M is INTEGER 00046 *> The number of rows of the matrix Q to be generated. M >= 0. 00047 *> \endverbatim 00048 *> 00049 *> \param[in] N 00050 *> \verbatim 00051 *> N is INTEGER 00052 *> The number of columns of the matrix Q to be generated. 00053 *> M >= N >= 0. 00054 *> \endverbatim 00055 *> 00056 *> \param[in] K 00057 *> \verbatim 00058 *> K is INTEGER 00059 *> The number of elementary reflectors whose product defines the 00060 *> matrix Q. N >= K >= 0. 00061 *> \endverbatim 00062 *> 00063 *> \param[in] A 00064 *> \verbatim 00065 *> A is COMPLEX array, dimension (LDA,N) 00066 *> The m-by-n matrix A which was factorized by CQLT01. 00067 *> \endverbatim 00068 *> 00069 *> \param[in] AF 00070 *> \verbatim 00071 *> AF is COMPLEX array, dimension (LDA,N) 00072 *> Details of the QL factorization of A, as returned by CGEQLF. 00073 *> See CGEQLF for further details. 00074 *> \endverbatim 00075 *> 00076 *> \param[out] Q 00077 *> \verbatim 00078 *> Q is COMPLEX array, dimension (LDA,N) 00079 *> \endverbatim 00080 *> 00081 *> \param[out] L 00082 *> \verbatim 00083 *> L is COMPLEX array, dimension (LDA,N) 00084 *> \endverbatim 00085 *> 00086 *> \param[in] LDA 00087 *> \verbatim 00088 *> LDA is INTEGER 00089 *> The leading dimension of the arrays A, AF, Q and L. LDA >= M. 00090 *> \endverbatim 00091 *> 00092 *> \param[in] TAU 00093 *> \verbatim 00094 *> TAU is COMPLEX array, dimension (N) 00095 *> The scalar factors of the elementary reflectors corresponding 00096 *> to the QL factorization in AF. 00097 *> \endverbatim 00098 *> 00099 *> \param[out] WORK 00100 *> \verbatim 00101 *> WORK is COMPLEX array, dimension (LWORK) 00102 *> \endverbatim 00103 *> 00104 *> \param[in] LWORK 00105 *> \verbatim 00106 *> LWORK is INTEGER 00107 *> The dimension of the array WORK. 00108 *> \endverbatim 00109 *> 00110 *> \param[out] RWORK 00111 *> \verbatim 00112 *> RWORK is REAL array, dimension (M) 00113 *> \endverbatim 00114 *> 00115 *> \param[out] RESULT 00116 *> \verbatim 00117 *> RESULT is REAL array, dimension (2) 00118 *> The test ratios: 00119 *> RESULT(1) = norm( L - Q'*A ) / ( M * norm(A) * EPS ) 00120 *> RESULT(2) = norm( I - Q'*Q ) / ( M * EPS ) 00121 *> \endverbatim 00122 * 00123 * Authors: 00124 * ======== 00125 * 00126 *> \author Univ. of Tennessee 00127 *> \author Univ. of California Berkeley 00128 *> \author Univ. of Colorado Denver 00129 *> \author NAG Ltd. 00130 * 00131 *> \date November 2011 00132 * 00133 *> \ingroup complex_lin 00134 * 00135 * ===================================================================== 00136 SUBROUTINE CQLT02( M, N, K, A, AF, Q, L, LDA, TAU, WORK, LWORK, 00137 $ RWORK, RESULT ) 00138 * 00139 * -- LAPACK test routine (version 3.4.0) -- 00140 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00141 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00142 * November 2011 00143 * 00144 * .. Scalar Arguments .. 00145 INTEGER K, LDA, LWORK, M, N 00146 * .. 00147 * .. Array Arguments .. 00148 REAL RESULT( * ), RWORK( * ) 00149 COMPLEX A( LDA, * ), AF( LDA, * ), L( LDA, * ), 00150 $ Q( LDA, * ), TAU( * ), WORK( LWORK ) 00151 * .. 00152 * 00153 * ===================================================================== 00154 * 00155 * .. Parameters .. 00156 REAL ZERO, ONE 00157 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 ) 00158 COMPLEX ROGUE 00159 PARAMETER ( ROGUE = ( -1.0E+10, -1.0E+10 ) ) 00160 * .. 00161 * .. Local Scalars .. 00162 INTEGER INFO 00163 REAL ANORM, EPS, RESID 00164 * .. 00165 * .. External Functions .. 00166 REAL CLANGE, CLANSY, SLAMCH 00167 EXTERNAL CLANGE, CLANSY, SLAMCH 00168 * .. 00169 * .. External Subroutines .. 00170 EXTERNAL CGEMM, CHERK, CLACPY, CLASET, CUNGQL 00171 * .. 00172 * .. Intrinsic Functions .. 00173 INTRINSIC CMPLX, MAX, REAL 00174 * .. 00175 * .. Scalars in Common .. 00176 CHARACTER*32 SRNAMT 00177 * .. 00178 * .. Common blocks .. 00179 COMMON / SRNAMC / SRNAMT 00180 * .. 00181 * .. Executable Statements .. 00182 * 00183 * Quick return if possible 00184 * 00185 IF( M.EQ.0 .OR. N.EQ.0 .OR. K.EQ.0 ) THEN 00186 RESULT( 1 ) = ZERO 00187 RESULT( 2 ) = ZERO 00188 RETURN 00189 END IF 00190 * 00191 EPS = SLAMCH( 'Epsilon' ) 00192 * 00193 * Copy the last k columns of the factorization to the array Q 00194 * 00195 CALL CLASET( 'Full', M, N, ROGUE, ROGUE, Q, LDA ) 00196 IF( K.LT.M ) 00197 $ CALL CLACPY( 'Full', M-K, K, AF( 1, N-K+1 ), LDA, 00198 $ Q( 1, N-K+1 ), LDA ) 00199 IF( K.GT.1 ) 00200 $ CALL CLACPY( 'Upper', K-1, K-1, AF( M-K+1, N-K+2 ), LDA, 00201 $ Q( M-K+1, N-K+2 ), LDA ) 00202 * 00203 * Generate the last n columns of the matrix Q 00204 * 00205 SRNAMT = 'CUNGQL' 00206 CALL CUNGQL( M, N, K, Q, LDA, TAU( N-K+1 ), WORK, LWORK, INFO ) 00207 * 00208 * Copy L(m-n+1:m,n-k+1:n) 00209 * 00210 CALL CLASET( 'Full', N, K, CMPLX( ZERO ), CMPLX( ZERO ), 00211 $ L( M-N+1, N-K+1 ), LDA ) 00212 CALL CLACPY( 'Lower', K, K, AF( M-K+1, N-K+1 ), LDA, 00213 $ L( M-K+1, N-K+1 ), LDA ) 00214 * 00215 * Compute L(m-n+1:m,n-k+1:n) - Q(1:m,m-n+1:m)' * A(1:m,n-k+1:n) 00216 * 00217 CALL CGEMM( 'Conjugate transpose', 'No transpose', N, K, M, 00218 $ CMPLX( -ONE ), Q, LDA, A( 1, N-K+1 ), LDA, 00219 $ CMPLX( ONE ), L( M-N+1, N-K+1 ), LDA ) 00220 * 00221 * Compute norm( L - Q'*A ) / ( M * norm(A) * EPS ) . 00222 * 00223 ANORM = CLANGE( '1', M, K, A( 1, N-K+1 ), LDA, RWORK ) 00224 RESID = CLANGE( '1', N, K, L( M-N+1, N-K+1 ), LDA, RWORK ) 00225 IF( ANORM.GT.ZERO ) THEN 00226 RESULT( 1 ) = ( ( RESID / REAL( MAX( 1, M ) ) ) / ANORM ) / EPS 00227 ELSE 00228 RESULT( 1 ) = ZERO 00229 END IF 00230 * 00231 * Compute I - Q'*Q 00232 * 00233 CALL CLASET( 'Full', N, N, CMPLX( ZERO ), CMPLX( ONE ), L, LDA ) 00234 CALL CHERK( 'Upper', 'Conjugate transpose', N, M, -ONE, Q, LDA, 00235 $ ONE, L, LDA ) 00236 * 00237 * Compute norm( I - Q'*Q ) / ( M * EPS ) . 00238 * 00239 RESID = CLANSY( '1', 'Upper', N, L, LDA, RWORK ) 00240 * 00241 RESULT( 2 ) = ( RESID / REAL( MAX( 1, M ) ) ) / EPS 00242 * 00243 RETURN 00244 * 00245 * End of CQLT02 00246 * 00247 END