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