LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dormtr.f
Go to the documentation of this file.
00001 *> \brief \b DORMTR
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download DORMTR + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dormtr.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dormtr.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dormtr.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE DORMTR( SIDE, UPLO, TRANS, M, N, A, LDA, TAU, C, LDC,
00022 *                          WORK, LWORK, INFO )
00023 * 
00024 *       .. Scalar Arguments ..
00025 *       CHARACTER          SIDE, TRANS, UPLO
00026 *       INTEGER            INFO, LDA, LDC, LWORK, M, N
00027 *       ..
00028 *       .. Array Arguments ..
00029 *       DOUBLE PRECISION   A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
00030 *       ..
00031 *  
00032 *
00033 *> \par Purpose:
00034 *  =============
00035 *>
00036 *> \verbatim
00037 *>
00038 *> DORMTR overwrites the general real M-by-N matrix C with
00039 *>
00040 *>                 SIDE = 'L'     SIDE = 'R'
00041 *> TRANS = 'N':      Q * C          C * Q
00042 *> TRANS = 'T':      Q**T * C       C * Q**T
00043 *>
00044 *> where Q is a real orthogonal matrix of order nq, with nq = m if
00045 *> SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
00046 *> nq-1 elementary reflectors, as returned by DSYTRD:
00047 *>
00048 *> if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
00049 *>
00050 *> if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
00051 *> \endverbatim
00052 *
00053 *  Arguments:
00054 *  ==========
00055 *
00056 *> \param[in] SIDE
00057 *> \verbatim
00058 *>          SIDE is CHARACTER*1
00059 *>          = 'L': apply Q or Q**T from the Left;
00060 *>          = 'R': apply Q or Q**T from the Right.
00061 *> \endverbatim
00062 *>
00063 *> \param[in] UPLO
00064 *> \verbatim
00065 *>          UPLO is CHARACTER*1
00066 *>          = 'U': Upper triangle of A contains elementary reflectors
00067 *>                 from DSYTRD;
00068 *>          = 'L': Lower triangle of A contains elementary reflectors
00069 *>                 from DSYTRD.
00070 *> \endverbatim
00071 *>
00072 *> \param[in] TRANS
00073 *> \verbatim
00074 *>          TRANS is CHARACTER*1
00075 *>          = 'N':  No transpose, apply Q;
00076 *>          = 'T':  Transpose, apply Q**T.
00077 *> \endverbatim
00078 *>
00079 *> \param[in] M
00080 *> \verbatim
00081 *>          M is INTEGER
00082 *>          The number of rows of the matrix C. M >= 0.
00083 *> \endverbatim
00084 *>
00085 *> \param[in] N
00086 *> \verbatim
00087 *>          N is INTEGER
00088 *>          The number of columns of the matrix C. N >= 0.
00089 *> \endverbatim
00090 *>
00091 *> \param[in] A
00092 *> \verbatim
00093 *>          A is DOUBLE PRECISION array, dimension
00094 *>                               (LDA,M) if SIDE = 'L'
00095 *>                               (LDA,N) if SIDE = 'R'
00096 *>          The vectors which define the elementary reflectors, as
00097 *>          returned by DSYTRD.
00098 *> \endverbatim
00099 *>
00100 *> \param[in] LDA
00101 *> \verbatim
00102 *>          LDA is INTEGER
00103 *>          The leading dimension of the array A.
00104 *>          LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'.
00105 *> \endverbatim
00106 *>
00107 *> \param[in] TAU
00108 *> \verbatim
00109 *>          TAU is DOUBLE PRECISION array, dimension
00110 *>                               (M-1) if SIDE = 'L'
00111 *>                               (N-1) if SIDE = 'R'
00112 *>          TAU(i) must contain the scalar factor of the elementary
00113 *>          reflector H(i), as returned by DSYTRD.
00114 *> \endverbatim
00115 *>
00116 *> \param[in,out] C
00117 *> \verbatim
00118 *>          C is DOUBLE PRECISION array, dimension (LDC,N)
00119 *>          On entry, the M-by-N matrix C.
00120 *>          On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
00121 *> \endverbatim
00122 *>
00123 *> \param[in] LDC
00124 *> \verbatim
00125 *>          LDC is INTEGER
00126 *>          The leading dimension of the array C. LDC >= max(1,M).
00127 *> \endverbatim
00128 *>
00129 *> \param[out] WORK
00130 *> \verbatim
00131 *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
00132 *>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
00133 *> \endverbatim
00134 *>
00135 *> \param[in] LWORK
00136 *> \verbatim
00137 *>          LWORK is INTEGER
00138 *>          The dimension of the array WORK.
00139 *>          If SIDE = 'L', LWORK >= max(1,N);
00140 *>          if SIDE = 'R', LWORK >= max(1,M).
00141 *>          For optimum performance LWORK >= N*NB if SIDE = 'L', and
00142 *>          LWORK >= M*NB if SIDE = 'R', where NB is the optimal
00143 *>          blocksize.
00144 *>
00145 *>          If LWORK = -1, then a workspace query is assumed; the routine
00146 *>          only calculates the optimal size of the WORK array, returns
00147 *>          this value as the first entry of the WORK array, and no error
00148 *>          message related to LWORK is issued by XERBLA.
00149 *> \endverbatim
00150 *>
00151 *> \param[out] INFO
00152 *> \verbatim
00153 *>          INFO is INTEGER
00154 *>          = 0:  successful exit
00155 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00156 *> \endverbatim
00157 *
00158 *  Authors:
00159 *  ========
00160 *
00161 *> \author Univ. of Tennessee 
00162 *> \author Univ. of California Berkeley 
00163 *> \author Univ. of Colorado Denver 
00164 *> \author NAG Ltd. 
00165 *
00166 *> \date November 2011
00167 *
00168 *> \ingroup doubleOTHERcomputational
00169 *
00170 *  =====================================================================
00171       SUBROUTINE DORMTR( SIDE, UPLO, TRANS, M, N, A, LDA, TAU, C, LDC,
00172      $                   WORK, LWORK, INFO )
00173 *
00174 *  -- LAPACK computational routine (version 3.4.0) --
00175 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00176 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00177 *     November 2011
00178 *
00179 *     .. Scalar Arguments ..
00180       CHARACTER          SIDE, TRANS, UPLO
00181       INTEGER            INFO, LDA, LDC, LWORK, M, N
00182 *     ..
00183 *     .. Array Arguments ..
00184       DOUBLE PRECISION   A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
00185 *     ..
00186 *
00187 *  =====================================================================
00188 *
00189 *     .. Local Scalars ..
00190       LOGICAL            LEFT, LQUERY, UPPER
00191       INTEGER            I1, I2, IINFO, LWKOPT, MI, NB, NI, NQ, NW
00192 *     ..
00193 *     .. External Functions ..
00194       LOGICAL            LSAME
00195       INTEGER            ILAENV
00196       EXTERNAL           LSAME, ILAENV
00197 *     ..
00198 *     .. External Subroutines ..
00199       EXTERNAL           DORMQL, DORMQR, XERBLA
00200 *     ..
00201 *     .. Intrinsic Functions ..
00202       INTRINSIC          MAX
00203 *     ..
00204 *     .. Executable Statements ..
00205 *
00206 *     Test the input arguments
00207 *
00208       INFO = 0
00209       LEFT = LSAME( SIDE, 'L' )
00210       UPPER = LSAME( UPLO, 'U' )
00211       LQUERY = ( LWORK.EQ.-1 )
00212 *
00213 *     NQ is the order of Q and NW is the minimum dimension of WORK
00214 *
00215       IF( LEFT ) THEN
00216          NQ = M
00217          NW = N
00218       ELSE
00219          NQ = N
00220          NW = M
00221       END IF
00222       IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
00223          INFO = -1
00224       ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00225          INFO = -2
00226       ELSE IF( .NOT.LSAME( TRANS, 'N' ) .AND. .NOT.LSAME( TRANS, 'T' ) )
00227      $          THEN
00228          INFO = -3
00229       ELSE IF( M.LT.0 ) THEN
00230          INFO = -4
00231       ELSE IF( N.LT.0 ) THEN
00232          INFO = -5
00233       ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN
00234          INFO = -7
00235       ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
00236          INFO = -10
00237       ELSE IF( LWORK.LT.MAX( 1, NW ) .AND. .NOT.LQUERY ) THEN
00238          INFO = -12
00239       END IF
00240 *
00241       IF( INFO.EQ.0 ) THEN
00242          IF( UPPER ) THEN
00243             IF( LEFT ) THEN
00244                NB = ILAENV( 1, 'DORMQL', SIDE // TRANS, M-1, N, M-1,
00245      $              -1 )
00246             ELSE
00247                NB = ILAENV( 1, 'DORMQL', SIDE // TRANS, M, N-1, N-1,
00248      $              -1 )
00249             END IF
00250          ELSE
00251             IF( LEFT ) THEN
00252                NB = ILAENV( 1, 'DORMQR', SIDE // TRANS, M-1, N, M-1,
00253      $              -1 )
00254             ELSE
00255                NB = ILAENV( 1, 'DORMQR', SIDE // TRANS, M, N-1, N-1,
00256      $              -1 )
00257             END IF
00258          END IF
00259          LWKOPT = MAX( 1, NW )*NB
00260          WORK( 1 ) = LWKOPT
00261       END IF
00262 *
00263       IF( INFO.NE.0 ) THEN
00264          CALL XERBLA( 'DORMTR', -INFO )
00265          RETURN
00266       ELSE IF( LQUERY ) THEN
00267          RETURN
00268       END IF
00269 *
00270 *     Quick return if possible
00271 *
00272       IF( M.EQ.0 .OR. N.EQ.0 .OR. NQ.EQ.1 ) THEN
00273          WORK( 1 ) = 1
00274          RETURN
00275       END IF
00276 *
00277       IF( LEFT ) THEN
00278          MI = M - 1
00279          NI = N
00280       ELSE
00281          MI = M
00282          NI = N - 1
00283       END IF
00284 *
00285       IF( UPPER ) THEN
00286 *
00287 *        Q was determined by a call to DSYTRD with UPLO = 'U'
00288 *
00289          CALL DORMQL( SIDE, TRANS, MI, NI, NQ-1, A( 1, 2 ), LDA, TAU, C,
00290      $                LDC, WORK, LWORK, IINFO )
00291       ELSE
00292 *
00293 *        Q was determined by a call to DSYTRD with UPLO = 'L'
00294 *
00295          IF( LEFT ) THEN
00296             I1 = 2
00297             I2 = 1
00298          ELSE
00299             I1 = 1
00300             I2 = 2
00301          END IF
00302          CALL DORMQR( SIDE, TRANS, MI, NI, NQ-1, A( 2, 1 ), LDA, TAU,
00303      $                C( I1, I2 ), LDC, WORK, LWORK, IINFO )
00304       END IF
00305       WORK( 1 ) = LWKOPT
00306       RETURN
00307 *
00308 *     End of DORMTR
00309 *
00310       END
 All Files Functions