LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dorgtr.f
Go to the documentation of this file.
00001 *> \brief \b DORGTR
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download DORGTR + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dorgtr.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dorgtr.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dorgtr.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE DORGTR( UPLO, N, A, LDA, TAU, WORK, LWORK, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          UPLO
00025 *       INTEGER            INFO, LDA, LWORK, N
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       DOUBLE PRECISION   A( LDA, * ), TAU( * ), WORK( * )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *> DORGTR generates a real orthogonal matrix Q which is defined as the
00038 *> product of n-1 elementary reflectors of order N, as returned by
00039 *> DSYTRD:
00040 *>
00041 *> if UPLO = 'U', Q = H(n-1) . . . H(2) H(1),
00042 *>
00043 *> if UPLO = 'L', Q = H(1) H(2) . . . H(n-1).
00044 *> \endverbatim
00045 *
00046 *  Arguments:
00047 *  ==========
00048 *
00049 *> \param[in] UPLO
00050 *> \verbatim
00051 *>          UPLO is CHARACTER*1
00052 *>          = 'U': Upper triangle of A contains elementary reflectors
00053 *>                 from DSYTRD;
00054 *>          = 'L': Lower triangle of A contains elementary reflectors
00055 *>                 from DSYTRD.
00056 *> \endverbatim
00057 *>
00058 *> \param[in] N
00059 *> \verbatim
00060 *>          N is INTEGER
00061 *>          The order of the matrix Q. N >= 0.
00062 *> \endverbatim
00063 *>
00064 *> \param[in,out] A
00065 *> \verbatim
00066 *>          A is DOUBLE PRECISION array, dimension (LDA,N)
00067 *>          On entry, the vectors which define the elementary reflectors,
00068 *>          as returned by DSYTRD.
00069 *>          On exit, the N-by-N orthogonal matrix Q.
00070 *> \endverbatim
00071 *>
00072 *> \param[in] LDA
00073 *> \verbatim
00074 *>          LDA is INTEGER
00075 *>          The leading dimension of the array A. LDA >= max(1,N).
00076 *> \endverbatim
00077 *>
00078 *> \param[in] TAU
00079 *> \verbatim
00080 *>          TAU is DOUBLE PRECISION array, dimension (N-1)
00081 *>          TAU(i) must contain the scalar factor of the elementary
00082 *>          reflector H(i), as returned by DSYTRD.
00083 *> \endverbatim
00084 *>
00085 *> \param[out] WORK
00086 *> \verbatim
00087 *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
00088 *>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
00089 *> \endverbatim
00090 *>
00091 *> \param[in] LWORK
00092 *> \verbatim
00093 *>          LWORK is INTEGER
00094 *>          The dimension of the array WORK. LWORK >= max(1,N-1).
00095 *>          For optimum performance LWORK >= (N-1)*NB, where NB is
00096 *>          the optimal blocksize.
00097 *>
00098 *>          If LWORK = -1, then a workspace query is assumed; the routine
00099 *>          only calculates the optimal size of the WORK array, returns
00100 *>          this value as the first entry of the WORK array, and no error
00101 *>          message related to LWORK is issued by XERBLA.
00102 *> \endverbatim
00103 *>
00104 *> \param[out] INFO
00105 *> \verbatim
00106 *>          INFO is INTEGER
00107 *>          = 0:  successful exit
00108 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00109 *> \endverbatim
00110 *
00111 *  Authors:
00112 *  ========
00113 *
00114 *> \author Univ. of Tennessee 
00115 *> \author Univ. of California Berkeley 
00116 *> \author Univ. of Colorado Denver 
00117 *> \author NAG Ltd. 
00118 *
00119 *> \date November 2011
00120 *
00121 *> \ingroup doubleOTHERcomputational
00122 *
00123 *  =====================================================================
00124       SUBROUTINE DORGTR( UPLO, N, A, LDA, TAU, WORK, LWORK, INFO )
00125 *
00126 *  -- LAPACK computational routine (version 3.4.0) --
00127 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00128 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00129 *     November 2011
00130 *
00131 *     .. Scalar Arguments ..
00132       CHARACTER          UPLO
00133       INTEGER            INFO, LDA, LWORK, N
00134 *     ..
00135 *     .. Array Arguments ..
00136       DOUBLE PRECISION   A( LDA, * ), TAU( * ), WORK( * )
00137 *     ..
00138 *
00139 *  =====================================================================
00140 *
00141 *     .. Parameters ..
00142       DOUBLE PRECISION   ZERO, ONE
00143       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00144 *     ..
00145 *     .. Local Scalars ..
00146       LOGICAL            LQUERY, UPPER
00147       INTEGER            I, IINFO, J, LWKOPT, NB
00148 *     ..
00149 *     .. External Functions ..
00150       LOGICAL            LSAME
00151       INTEGER            ILAENV
00152       EXTERNAL           LSAME, ILAENV
00153 *     ..
00154 *     .. External Subroutines ..
00155       EXTERNAL           DORGQL, DORGQR, XERBLA
00156 *     ..
00157 *     .. Intrinsic Functions ..
00158       INTRINSIC          MAX
00159 *     ..
00160 *     .. Executable Statements ..
00161 *
00162 *     Test the input arguments
00163 *
00164       INFO = 0
00165       LQUERY = ( LWORK.EQ.-1 )
00166       UPPER = LSAME( UPLO, 'U' )
00167       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00168          INFO = -1
00169       ELSE IF( N.LT.0 ) THEN
00170          INFO = -2
00171       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00172          INFO = -4
00173       ELSE IF( LWORK.LT.MAX( 1, N-1 ) .AND. .NOT.LQUERY ) THEN
00174          INFO = -7
00175       END IF
00176 *
00177       IF( INFO.EQ.0 ) THEN
00178          IF( UPPER ) THEN
00179             NB = ILAENV( 1, 'DORGQL', ' ', N-1, N-1, N-1, -1 )
00180          ELSE
00181             NB = ILAENV( 1, 'DORGQR', ' ', N-1, N-1, N-1, -1 )
00182          END IF
00183          LWKOPT = MAX( 1, N-1 )*NB
00184          WORK( 1 ) = LWKOPT
00185       END IF
00186 *
00187       IF( INFO.NE.0 ) THEN
00188          CALL XERBLA( 'DORGTR', -INFO )
00189          RETURN
00190       ELSE IF( LQUERY ) THEN
00191          RETURN
00192       END IF
00193 *
00194 *     Quick return if possible
00195 *
00196       IF( N.EQ.0 ) THEN
00197          WORK( 1 ) = 1
00198          RETURN
00199       END IF
00200 *
00201       IF( UPPER ) THEN
00202 *
00203 *        Q was determined by a call to DSYTRD with UPLO = 'U'
00204 *
00205 *        Shift the vectors which define the elementary reflectors one
00206 *        column to the left, and set the last row and column of Q to
00207 *        those of the unit matrix
00208 *
00209          DO 20 J = 1, N - 1
00210             DO 10 I = 1, J - 1
00211                A( I, J ) = A( I, J+1 )
00212    10       CONTINUE
00213             A( N, J ) = ZERO
00214    20    CONTINUE
00215          DO 30 I = 1, N - 1
00216             A( I, N ) = ZERO
00217    30    CONTINUE
00218          A( N, N ) = ONE
00219 *
00220 *        Generate Q(1:n-1,1:n-1)
00221 *
00222          CALL DORGQL( N-1, N-1, N-1, A, LDA, TAU, WORK, LWORK, IINFO )
00223 *
00224       ELSE
00225 *
00226 *        Q was determined by a call to DSYTRD with UPLO = 'L'.
00227 *
00228 *        Shift the vectors which define the elementary reflectors one
00229 *        column to the right, and set the first row and column of Q to
00230 *        those of the unit matrix
00231 *
00232          DO 50 J = N, 2, -1
00233             A( 1, J ) = ZERO
00234             DO 40 I = J + 1, N
00235                A( I, J ) = A( I, J-1 )
00236    40       CONTINUE
00237    50    CONTINUE
00238          A( 1, 1 ) = ONE
00239          DO 60 I = 2, N
00240             A( I, 1 ) = ZERO
00241    60    CONTINUE
00242          IF( N.GT.1 ) THEN
00243 *
00244 *           Generate Q(2:n,2:n)
00245 *
00246             CALL DORGQR( N-1, N-1, N-1, A( 2, 2 ), LDA, TAU, WORK,
00247      $                   LWORK, IINFO )
00248          END IF
00249       END IF
00250       WORK( 1 ) = LWKOPT
00251       RETURN
00252 *
00253 *     End of DORGTR
00254 *
00255       END
 All Files Functions