LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zgeqrs.f
Go to the documentation of this file.
00001 *> \brief \b ZGEQRS
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 ZGEQRS( M, N, NRHS, A, LDA, TAU, B, LDB, WORK, LWORK,
00012 *                          INFO )
00013 * 
00014 *       .. Scalar Arguments ..
00015 *       INTEGER            INFO, LDA, LDB, LWORK, M, N, NRHS
00016 *       ..
00017 *       .. Array Arguments ..
00018 *       COMPLEX*16         A( LDA, * ), B( LDB, * ), TAU( * ),
00019 *      $                   WORK( LWORK )
00020 *       ..
00021 *  
00022 *
00023 *> \par Purpose:
00024 *  =============
00025 *>
00026 *> \verbatim
00027 *>
00028 *> Solve the least squares problem
00029 *>     min || A*X - B ||
00030 *> using the QR factorization
00031 *>     A = Q*R
00032 *> computed by ZGEQRF.
00033 *> \endverbatim
00034 *
00035 *  Arguments:
00036 *  ==========
00037 *
00038 *> \param[in] M
00039 *> \verbatim
00040 *>          M is INTEGER
00041 *>          The number of rows of the matrix A.  M >= 0.
00042 *> \endverbatim
00043 *>
00044 *> \param[in] N
00045 *> \verbatim
00046 *>          N is INTEGER
00047 *>          The number of columns of the matrix A.  M >= N >= 0.
00048 *> \endverbatim
00049 *>
00050 *> \param[in] NRHS
00051 *> \verbatim
00052 *>          NRHS is INTEGER
00053 *>          The number of columns of B.  NRHS >= 0.
00054 *> \endverbatim
00055 *>
00056 *> \param[in] A
00057 *> \verbatim
00058 *>          A is COMPLEX*16 array, dimension (LDA,N)
00059 *>          Details of the QR factorization of the original matrix A as
00060 *>          returned by ZGEQRF.
00061 *> \endverbatim
00062 *>
00063 *> \param[in] LDA
00064 *> \verbatim
00065 *>          LDA is INTEGER
00066 *>          The leading dimension of the array A.  LDA >= M.
00067 *> \endverbatim
00068 *>
00069 *> \param[in] TAU
00070 *> \verbatim
00071 *>          TAU is COMPLEX*16 array, dimension (N)
00072 *>          Details of the orthogonal matrix Q.
00073 *> \endverbatim
00074 *>
00075 *> \param[in,out] B
00076 *> \verbatim
00077 *>          B is COMPLEX*16 array, dimension (LDB,NRHS)
00078 *>          On entry, the m-by-nrhs right hand side matrix B.
00079 *>          On exit, the n-by-nrhs solution matrix X.
00080 *> \endverbatim
00081 *>
00082 *> \param[in] LDB
00083 *> \verbatim
00084 *>          LDB is INTEGER
00085 *>          The leading dimension of the array B. LDB >= M.
00086 *> \endverbatim
00087 *>
00088 *> \param[out] WORK
00089 *> \verbatim
00090 *>          WORK is COMPLEX*16 array, dimension (LWORK)
00091 *> \endverbatim
00092 *>
00093 *> \param[in] LWORK
00094 *> \verbatim
00095 *>          LWORK is INTEGER
00096 *>          The length of the array WORK.  LWORK must be at least NRHS,
00097 *>          and should be at least NRHS*NB, where NB is the block size
00098 *>          for this environment.
00099 *> \endverbatim
00100 *>
00101 *> \param[out] INFO
00102 *> \verbatim
00103 *>          INFO is INTEGER
00104 *>          = 0: successful exit
00105 *>          < 0: if INFO = -i, the i-th argument had an illegal value
00106 *> \endverbatim
00107 *
00108 *  Authors:
00109 *  ========
00110 *
00111 *> \author Univ. of Tennessee 
00112 *> \author Univ. of California Berkeley 
00113 *> \author Univ. of Colorado Denver 
00114 *> \author NAG Ltd. 
00115 *
00116 *> \date November 2011
00117 *
00118 *> \ingroup complex16_lin
00119 *
00120 *  =====================================================================
00121       SUBROUTINE ZGEQRS( M, N, NRHS, A, LDA, TAU, B, LDB, WORK, LWORK,
00122      $                   INFO )
00123 *
00124 *  -- LAPACK test routine (version 3.4.0) --
00125 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00126 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00127 *     November 2011
00128 *
00129 *     .. Scalar Arguments ..
00130       INTEGER            INFO, LDA, LDB, LWORK, M, N, NRHS
00131 *     ..
00132 *     .. Array Arguments ..
00133       COMPLEX*16         A( LDA, * ), B( LDB, * ), TAU( * ),
00134      $                   WORK( LWORK )
00135 *     ..
00136 *
00137 *  =====================================================================
00138 *
00139 *     .. Parameters ..
00140       COMPLEX*16         ONE
00141       PARAMETER          ( ONE = ( 1.0D+0, 0.0D+0 ) )
00142 *     ..
00143 *     .. External Subroutines ..
00144       EXTERNAL           XERBLA, ZTRSM, ZUNMQR
00145 *     ..
00146 *     .. Intrinsic Functions ..
00147       INTRINSIC          MAX
00148 *     ..
00149 *     .. Executable Statements ..
00150 *
00151 *     Test the input arguments.
00152 *
00153       INFO = 0
00154       IF( M.LT.0 ) THEN
00155          INFO = -1
00156       ELSE IF( N.LT.0 .OR. N.GT.M ) THEN
00157          INFO = -2
00158       ELSE IF( NRHS.LT.0 ) THEN
00159          INFO = -3
00160       ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
00161          INFO = -5
00162       ELSE IF( LDB.LT.MAX( 1, M ) ) THEN
00163          INFO = -8
00164       ELSE IF( LWORK.LT.1 .OR. LWORK.LT.NRHS .AND. M.GT.0 .AND. N.GT.0 )
00165      $          THEN
00166          INFO = -10
00167       END IF
00168       IF( INFO.NE.0 ) THEN
00169          CALL XERBLA( 'ZGEQRS', -INFO )
00170          RETURN
00171       END IF
00172 *
00173 *     Quick return if possible
00174 *
00175       IF( N.EQ.0 .OR. NRHS.EQ.0 .OR. M.EQ.0 )
00176      $   RETURN
00177 *
00178 *     B := Q' * B
00179 *
00180       CALL ZUNMQR( 'Left', 'Conjugate transpose', M, NRHS, N, A, LDA,
00181      $             TAU, B, LDB, WORK, LWORK, INFO )
00182 *
00183 *     Solve R*X = B(1:n,:)
00184 *
00185       CALL ZTRSM( 'Left', 'Upper', 'No transpose', 'Non-unit', N, NRHS,
00186      $            ONE, A, LDA, B, LDB )
00187 *
00188       RETURN
00189 *
00190 *     End of ZGEQRS
00191 *
00192       END
 All Files Functions