LAPACK 3.3.0

cgeql2.f

Go to the documentation of this file.
00001       SUBROUTINE CGEQL2( M, N, A, LDA, TAU, WORK, INFO )
00002 *
00003 *  -- LAPACK routine (version 3.2.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     June 2010
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            INFO, LDA, M, N
00010 *     ..
00011 *     .. Array Arguments ..
00012       COMPLEX            A( LDA, * ), TAU( * ), WORK( * )
00013 *     ..
00014 *
00015 *  Purpose
00016 *  =======
00017 *
00018 *  CGEQL2 computes a QL factorization of a complex m by n matrix A:
00019 *  A = Q * L.
00020 *
00021 *  Arguments
00022 *  =========
00023 *
00024 *  M       (input) INTEGER
00025 *          The number of rows of the matrix A.  M >= 0.
00026 *
00027 *  N       (input) INTEGER
00028 *          The number of columns of the matrix A.  N >= 0.
00029 *
00030 *  A       (input/output) COMPLEX array, dimension (LDA,N)
00031 *          On entry, the m by n matrix A.
00032 *          On exit, if m >= n, the lower triangle of the subarray
00033 *          A(m-n+1:m,1:n) contains the n by n lower triangular matrix L;
00034 *          if m <= n, the elements on and below the (n-m)-th
00035 *          superdiagonal contain the m by n lower trapezoidal matrix L;
00036 *          the remaining elements, with the array TAU, represent the
00037 *          unitary matrix Q as a product of elementary reflectors
00038 *          (see Further Details).
00039 *
00040 *  LDA     (input) INTEGER
00041 *          The leading dimension of the array A.  LDA >= max(1,M).
00042 *
00043 *  TAU     (output) COMPLEX array, dimension (min(M,N))
00044 *          The scalar factors of the elementary reflectors (see Further
00045 *          Details).
00046 *
00047 *  WORK    (workspace) COMPLEX array, dimension (N)
00048 *
00049 *  INFO    (output) INTEGER
00050 *          = 0: successful exit
00051 *          < 0: if INFO = -i, the i-th argument had an illegal value
00052 *
00053 *  Further Details
00054 *  ===============
00055 *
00056 *  The matrix Q is represented as a product of elementary reflectors
00057 *
00058 *     Q = H(k) . . . H(2) H(1), where k = min(m,n).
00059 *
00060 *  Each H(i) has the form
00061 *
00062 *     H(i) = I - tau * v * v'
00063 *
00064 *  where tau is a complex scalar, and v is a complex vector with
00065 *  v(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in
00066 *  A(1:m-k+i-1,n-k+i), and tau in TAU(i).
00067 *
00068 *  =====================================================================
00069 *
00070 *     .. Parameters ..
00071       COMPLEX            ONE
00072       PARAMETER          ( ONE = ( 1.0E+0, 0.0E+0 ) )
00073 *     ..
00074 *     .. Local Scalars ..
00075       INTEGER            I, K
00076       COMPLEX            ALPHA
00077 *     ..
00078 *     .. External Subroutines ..
00079       EXTERNAL           CLARF, CLARFG, XERBLA
00080 *     ..
00081 *     .. Intrinsic Functions ..
00082       INTRINSIC          CONJG, MAX, MIN
00083 *     ..
00084 *     .. Executable Statements ..
00085 *
00086 *     Test the input arguments
00087 *
00088       INFO = 0
00089       IF( M.LT.0 ) THEN
00090          INFO = -1
00091       ELSE IF( N.LT.0 ) THEN
00092          INFO = -2
00093       ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
00094          INFO = -4
00095       END IF
00096       IF( INFO.NE.0 ) THEN
00097          CALL XERBLA( 'CGEQL2', -INFO )
00098          RETURN
00099       END IF
00100 *
00101       K = MIN( M, N )
00102 *
00103       DO 10 I = K, 1, -1
00104 *
00105 *        Generate elementary reflector H(i) to annihilate
00106 *        A(1:m-k+i-1,n-k+i)
00107 *
00108          ALPHA = A( M-K+I, N-K+I )
00109          CALL CLARFG( M-K+I, ALPHA, A( 1, N-K+I ), 1, TAU( I ) )
00110 *
00111 *        Apply H(i)' to A(1:m-k+i,1:n-k+i-1) from the left
00112 *
00113          A( M-K+I, N-K+I ) = ONE
00114          CALL CLARF( 'Left', M-K+I, N-K+I-1, A( 1, N-K+I ), 1,
00115      $               CONJG( TAU( I ) ), A, LDA, WORK )
00116          A( M-K+I, N-K+I ) = ALPHA
00117    10 CONTINUE
00118       RETURN
00119 *
00120 *     End of CGEQL2
00121 *
00122       END
 All Files Functions