LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
sopgtr.f
Go to the documentation of this file.
00001 *> \brief \b SOPGTR
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download SOPGTR + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sopgtr.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sopgtr.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sopgtr.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE SOPGTR( UPLO, N, AP, TAU, Q, LDQ, WORK, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          UPLO
00025 *       INTEGER            INFO, LDQ, N
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       REAL               AP( * ), Q( LDQ, * ), TAU( * ), WORK( * )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *> SOPGTR generates a real orthogonal matrix Q which is defined as the
00038 *> product of n-1 elementary reflectors H(i) of order n, as returned by
00039 *> SSPTRD using packed storage:
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 triangular packed storage used in previous
00053 *>                 call to SSPTRD;
00054 *>          = 'L': Lower triangular packed storage used in previous
00055 *>                 call to SSPTRD.
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] AP
00065 *> \verbatim
00066 *>          AP is REAL array, dimension (N*(N+1)/2)
00067 *>          The vectors which define the elementary reflectors, as
00068 *>          returned by SSPTRD.
00069 *> \endverbatim
00070 *>
00071 *> \param[in] TAU
00072 *> \verbatim
00073 *>          TAU is REAL array, dimension (N-1)
00074 *>          TAU(i) must contain the scalar factor of the elementary
00075 *>          reflector H(i), as returned by SSPTRD.
00076 *> \endverbatim
00077 *>
00078 *> \param[out] Q
00079 *> \verbatim
00080 *>          Q is REAL array, dimension (LDQ,N)
00081 *>          The N-by-N orthogonal matrix Q.
00082 *> \endverbatim
00083 *>
00084 *> \param[in] LDQ
00085 *> \verbatim
00086 *>          LDQ is INTEGER
00087 *>          The leading dimension of the array Q. LDQ >= max(1,N).
00088 *> \endverbatim
00089 *>
00090 *> \param[out] WORK
00091 *> \verbatim
00092 *>          WORK is REAL array, dimension (N-1)
00093 *> \endverbatim
00094 *>
00095 *> \param[out] INFO
00096 *> \verbatim
00097 *>          INFO is INTEGER
00098 *>          = 0:  successful exit
00099 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00100 *> \endverbatim
00101 *
00102 *  Authors:
00103 *  ========
00104 *
00105 *> \author Univ. of Tennessee 
00106 *> \author Univ. of California Berkeley 
00107 *> \author Univ. of Colorado Denver 
00108 *> \author NAG Ltd. 
00109 *
00110 *> \date November 2011
00111 *
00112 *> \ingroup realOTHERcomputational
00113 *
00114 *  =====================================================================
00115       SUBROUTINE SOPGTR( UPLO, N, AP, TAU, Q, LDQ, WORK, INFO )
00116 *
00117 *  -- LAPACK computational routine (version 3.4.0) --
00118 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00119 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00120 *     November 2011
00121 *
00122 *     .. Scalar Arguments ..
00123       CHARACTER          UPLO
00124       INTEGER            INFO, LDQ, N
00125 *     ..
00126 *     .. Array Arguments ..
00127       REAL               AP( * ), Q( LDQ, * ), TAU( * ), WORK( * )
00128 *     ..
00129 *
00130 *  =====================================================================
00131 *
00132 *     .. Parameters ..
00133       REAL               ZERO, ONE
00134       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00135 *     ..
00136 *     .. Local Scalars ..
00137       LOGICAL            UPPER
00138       INTEGER            I, IINFO, IJ, J
00139 *     ..
00140 *     .. External Functions ..
00141       LOGICAL            LSAME
00142       EXTERNAL           LSAME
00143 *     ..
00144 *     .. External Subroutines ..
00145       EXTERNAL           SORG2L, SORG2R, XERBLA
00146 *     ..
00147 *     .. Intrinsic Functions ..
00148       INTRINSIC          MAX
00149 *     ..
00150 *     .. Executable Statements ..
00151 *
00152 *     Test the input arguments
00153 *
00154       INFO = 0
00155       UPPER = LSAME( UPLO, 'U' )
00156       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00157          INFO = -1
00158       ELSE IF( N.LT.0 ) THEN
00159          INFO = -2
00160       ELSE IF( LDQ.LT.MAX( 1, N ) ) THEN
00161          INFO = -6
00162       END IF
00163       IF( INFO.NE.0 ) THEN
00164          CALL XERBLA( 'SOPGTR', -INFO )
00165          RETURN
00166       END IF
00167 *
00168 *     Quick return if possible
00169 *
00170       IF( N.EQ.0 )
00171      $   RETURN
00172 *
00173       IF( UPPER ) THEN
00174 *
00175 *        Q was determined by a call to SSPTRD with UPLO = 'U'
00176 *
00177 *        Unpack the vectors which define the elementary reflectors and
00178 *        set the last row and column of Q equal to those of the unit
00179 *        matrix
00180 *
00181          IJ = 2
00182          DO 20 J = 1, N - 1
00183             DO 10 I = 1, J - 1
00184                Q( I, J ) = AP( IJ )
00185                IJ = IJ + 1
00186    10       CONTINUE
00187             IJ = IJ + 2
00188             Q( N, J ) = ZERO
00189    20    CONTINUE
00190          DO 30 I = 1, N - 1
00191             Q( I, N ) = ZERO
00192    30    CONTINUE
00193          Q( N, N ) = ONE
00194 *
00195 *        Generate Q(1:n-1,1:n-1)
00196 *
00197          CALL SORG2L( N-1, N-1, N-1, Q, LDQ, TAU, WORK, IINFO )
00198 *
00199       ELSE
00200 *
00201 *        Q was determined by a call to SSPTRD with UPLO = 'L'.
00202 *
00203 *        Unpack the vectors which define the elementary reflectors and
00204 *        set the first row and column of Q equal to those of the unit
00205 *        matrix
00206 *
00207          Q( 1, 1 ) = ONE
00208          DO 40 I = 2, N
00209             Q( I, 1 ) = ZERO
00210    40    CONTINUE
00211          IJ = 3
00212          DO 60 J = 2, N
00213             Q( 1, J ) = ZERO
00214             DO 50 I = J + 1, N
00215                Q( I, J ) = AP( IJ )
00216                IJ = IJ + 1
00217    50       CONTINUE
00218             IJ = IJ + 2
00219    60    CONTINUE
00220          IF( N.GT.1 ) THEN
00221 *
00222 *           Generate Q(2:n,2:n)
00223 *
00224             CALL SORG2R( N-1, N-1, N-1, Q( 2, 2 ), LDQ, TAU, WORK,
00225      $                   IINFO )
00226          END IF
00227       END IF
00228       RETURN
00229 *
00230 *     End of SOPGTR
00231 *
00232       END
 All Files Functions