LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zlqt01.f
Go to the documentation of this file.
00001 *> \brief \b ZLQT01
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 ZLQT01( 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 *> ZLQT01 tests ZGELQF, which computes the LQ factorization of an m-by-n
00030 *> matrix A, and partially tests ZUNGLQ which forms the n-by-n
00031 *> orthogonal matrix Q.
00032 *>
00033 *> ZLQT01 compares L with A*Q', 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 LQ factorization of A, as returned by ZGELQF.
00061 *>          See ZGELQF for further details.
00062 *> \endverbatim
00063 *>
00064 *> \param[out] Q
00065 *> \verbatim
00066 *>          Q is COMPLEX*16 array, dimension (LDA,N)
00067 *>          The n-by-n 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 L.
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 ZGELQF.
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 (max(M,N))
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 - A*Q' ) / ( N * norm(A) * EPS )
00110 *>          RESULT(2) = norm( I - Q*Q' ) / ( N * 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 ZLQT01( 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           ZGELQF, ZGEMM, ZHERK, ZLACPY, ZLASET, ZUNGLQ
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 = 'ZGELQF'
00183       CALL ZGELQF( M, N, AF, LDA, TAU, WORK, LWORK, INFO )
00184 *
00185 *     Copy details of Q
00186 *
00187       CALL ZLASET( 'Full', N, N, ROGUE, ROGUE, Q, LDA )
00188       IF( N.GT.1 )
00189      $   CALL ZLACPY( 'Upper', M, N-1, AF( 1, 2 ), LDA, Q( 1, 2 ), LDA )
00190 *
00191 *     Generate the n-by-n matrix Q
00192 *
00193       SRNAMT = 'ZUNGLQ'
00194       CALL ZUNGLQ( N, N, MINMN, Q, LDA, TAU, WORK, LWORK, INFO )
00195 *
00196 *     Copy L
00197 *
00198       CALL ZLASET( 'Full', M, N, DCMPLX( ZERO ), DCMPLX( ZERO ), L,
00199      $             LDA )
00200       CALL ZLACPY( 'Lower', M, N, AF, LDA, L, LDA )
00201 *
00202 *     Compute L - A*Q'
00203 *
00204       CALL ZGEMM( 'No transpose', 'Conjugate transpose', M, N, N,
00205      $            DCMPLX( -ONE ), A, LDA, Q, LDA, DCMPLX( ONE ), L,
00206      $            LDA )
00207 *
00208 *     Compute norm( L - Q'*A ) / ( N * norm(A) * EPS ) .
00209 *
00210       ANORM = ZLANGE( '1', M, N, A, LDA, RWORK )
00211       RESID = ZLANGE( '1', M, N, L, LDA, RWORK )
00212       IF( ANORM.GT.ZERO ) THEN
00213          RESULT( 1 ) = ( ( RESID / DBLE( MAX( 1, N ) ) ) / ANORM ) / EPS
00214       ELSE
00215          RESULT( 1 ) = ZERO
00216       END IF
00217 *
00218 *     Compute I - Q*Q'
00219 *
00220       CALL ZLASET( 'Full', N, N, DCMPLX( ZERO ), DCMPLX( ONE ), L, LDA )
00221       CALL ZHERK( 'Upper', 'No transpose', N, N, -ONE, Q, LDA, ONE, L,
00222      $            LDA )
00223 *
00224 *     Compute norm( I - Q*Q' ) / ( N * EPS ) .
00225 *
00226       RESID = ZLANSY( '1', 'Upper', N, L, LDA, RWORK )
00227 *
00228       RESULT( 2 ) = ( RESID / DBLE( MAX( 1, N ) ) ) / EPS
00229 *
00230       RETURN
00231 *
00232 *     End of ZLQT01
00233 *
00234       END
 All Files Functions