LAPACK 3.3.1
Linear Algebra PACKage

sgeql2.f

Go to the documentation of this file.
00001       SUBROUTINE SGEQL2( M, N, A, LDA, TAU, WORK, INFO )
00002 *
00003 *  -- LAPACK routine (version 3.3.1) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *  -- April 2011                                                      --
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            INFO, LDA, M, N
00010 *     ..
00011 *     .. Array Arguments ..
00012       REAL               A( LDA, * ), TAU( * ), WORK( * )
00013 *     ..
00014 *
00015 *  Purpose
00016 *  =======
00017 *
00018 *  SGEQL2 computes a QL factorization of a real 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) REAL 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 *          orthogonal 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) REAL array, dimension (min(M,N))
00044 *          The scalar factors of the elementary reflectors (see Further
00045 *          Details).
00046 *
00047 *  WORK    (workspace) REAL 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**T
00063 *
00064 *  where tau is a real scalar, and v is a real 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       REAL               ONE
00072       PARAMETER          ( ONE = 1.0E+0 )
00073 *     ..
00074 *     .. Local Scalars ..
00075       INTEGER            I, K
00076       REAL               AII
00077 *     ..
00078 *     .. External Subroutines ..
00079       EXTERNAL           SLARF, SLARFG, XERBLA
00080 *     ..
00081 *     .. Intrinsic Functions ..
00082       INTRINSIC          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( 'SGEQL2', -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          CALL SLARFG( M-K+I, A( M-K+I, N-K+I ), A( 1, N-K+I ), 1,
00109      $                TAU( I ) )
00110 *
00111 *        Apply H(i) to A(1:m-k+i,1:n-k+i-1) from the left
00112 *
00113          AII = A( M-K+I, N-K+I )
00114          A( M-K+I, N-K+I ) = ONE
00115          CALL SLARF( 'Left', M-K+I, N-K+I-1, A( 1, N-K+I ), 1, TAU( I ),
00116      $               A, LDA, WORK )
00117          A( M-K+I, N-K+I ) = AII
00118    10 CONTINUE
00119       RETURN
00120 *
00121 *     End of SGEQL2
00122 *
00123       END
 All Files Functions