LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
ssygst.f
Go to the documentation of this file.
00001 *> \brief \b SSYGST
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download SSYGST + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ssygst.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ssygst.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ssygst.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE SSYGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          UPLO
00025 *       INTEGER            INFO, ITYPE, LDA, LDB, N
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       REAL               A( LDA, * ), B( LDB, * )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *> SSYGST reduces a real symmetric-definite generalized eigenproblem
00038 *> to standard form.
00039 *>
00040 *> If ITYPE = 1, the problem is A*x = lambda*B*x,
00041 *> and A is overwritten by inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T)
00042 *>
00043 *> If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
00044 *> B*A*x = lambda*x, and A is overwritten by U*A*U**T or L**T*A*L.
00045 *>
00046 *> B must have been previously factorized as U**T*U or L*L**T by SPOTRF.
00047 *> \endverbatim
00048 *
00049 *  Arguments:
00050 *  ==========
00051 *
00052 *> \param[in] ITYPE
00053 *> \verbatim
00054 *>          ITYPE is INTEGER
00055 *>          = 1: compute inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T);
00056 *>          = 2 or 3: compute U*A*U**T or L**T*A*L.
00057 *> \endverbatim
00058 *>
00059 *> \param[in] UPLO
00060 *> \verbatim
00061 *>          UPLO is CHARACTER*1
00062 *>          = 'U':  Upper triangle of A is stored and B is factored as
00063 *>                  U**T*U;
00064 *>          = 'L':  Lower triangle of A is stored and B is factored as
00065 *>                  L*L**T.
00066 *> \endverbatim
00067 *>
00068 *> \param[in] N
00069 *> \verbatim
00070 *>          N is INTEGER
00071 *>          The order of the matrices A and B.  N >= 0.
00072 *> \endverbatim
00073 *>
00074 *> \param[in,out] A
00075 *> \verbatim
00076 *>          A is REAL array, dimension (LDA,N)
00077 *>          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
00078 *>          N-by-N upper triangular part of A contains the upper
00079 *>          triangular part of the matrix A, and the strictly lower
00080 *>          triangular part of A is not referenced.  If UPLO = 'L', the
00081 *>          leading N-by-N lower triangular part of A contains the lower
00082 *>          triangular part of the matrix A, and the strictly upper
00083 *>          triangular part of A is not referenced.
00084 *>
00085 *>          On exit, if INFO = 0, the transformed matrix, stored in the
00086 *>          same format as A.
00087 *> \endverbatim
00088 *>
00089 *> \param[in] LDA
00090 *> \verbatim
00091 *>          LDA is INTEGER
00092 *>          The leading dimension of the array A.  LDA >= max(1,N).
00093 *> \endverbatim
00094 *>
00095 *> \param[in] B
00096 *> \verbatim
00097 *>          B is REAL array, dimension (LDB,N)
00098 *>          The triangular factor from the Cholesky factorization of B,
00099 *>          as returned by SPOTRF.
00100 *> \endverbatim
00101 *>
00102 *> \param[in] LDB
00103 *> \verbatim
00104 *>          LDB is INTEGER
00105 *>          The leading dimension of the array B.  LDB >= max(1,N).
00106 *> \endverbatim
00107 *>
00108 *> \param[out] INFO
00109 *> \verbatim
00110 *>          INFO is INTEGER
00111 *>          = 0:  successful exit
00112 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00113 *> \endverbatim
00114 *
00115 *  Authors:
00116 *  ========
00117 *
00118 *> \author Univ. of Tennessee 
00119 *> \author Univ. of California Berkeley 
00120 *> \author Univ. of Colorado Denver 
00121 *> \author NAG Ltd. 
00122 *
00123 *> \date November 2011
00124 *
00125 *> \ingroup realSYcomputational
00126 *
00127 *  =====================================================================
00128       SUBROUTINE SSYGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
00129 *
00130 *  -- LAPACK computational routine (version 3.4.0) --
00131 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00132 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00133 *     November 2011
00134 *
00135 *     .. Scalar Arguments ..
00136       CHARACTER          UPLO
00137       INTEGER            INFO, ITYPE, LDA, LDB, N
00138 *     ..
00139 *     .. Array Arguments ..
00140       REAL               A( LDA, * ), B( LDB, * )
00141 *     ..
00142 *
00143 *  =====================================================================
00144 *
00145 *     .. Parameters ..
00146       REAL               ONE, HALF
00147       PARAMETER          ( ONE = 1.0, HALF = 0.5 )
00148 *     ..
00149 *     .. Local Scalars ..
00150       LOGICAL            UPPER
00151       INTEGER            K, KB, NB
00152 *     ..
00153 *     .. External Subroutines ..
00154       EXTERNAL           SSYGS2, SSYMM, SSYR2K, STRMM, STRSM, XERBLA
00155 *     ..
00156 *     .. Intrinsic Functions ..
00157       INTRINSIC          MAX, MIN
00158 *     ..
00159 *     .. External Functions ..
00160       LOGICAL            LSAME
00161       INTEGER            ILAENV
00162       EXTERNAL           LSAME, ILAENV
00163 *     ..
00164 *     .. Executable Statements ..
00165 *
00166 *     Test the input parameters.
00167 *
00168       INFO = 0
00169       UPPER = LSAME( UPLO, 'U' )
00170       IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
00171          INFO = -1
00172       ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00173          INFO = -2
00174       ELSE IF( N.LT.0 ) THEN
00175          INFO = -3
00176       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00177          INFO = -5
00178       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00179          INFO = -7
00180       END IF
00181       IF( INFO.NE.0 ) THEN
00182          CALL XERBLA( 'SSYGST', -INFO )
00183          RETURN
00184       END IF
00185 *
00186 *     Quick return if possible
00187 *
00188       IF( N.EQ.0 )
00189      $   RETURN
00190 *
00191 *     Determine the block size for this environment.
00192 *
00193       NB = ILAENV( 1, 'SSYGST', UPLO, N, -1, -1, -1 )
00194 *
00195       IF( NB.LE.1 .OR. NB.GE.N ) THEN
00196 *
00197 *        Use unblocked code
00198 *
00199          CALL SSYGS2( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
00200       ELSE
00201 *
00202 *        Use blocked code
00203 *
00204          IF( ITYPE.EQ.1 ) THEN
00205             IF( UPPER ) THEN
00206 *
00207 *              Compute inv(U**T)*A*inv(U)
00208 *
00209                DO 10 K = 1, N, NB
00210                   KB = MIN( N-K+1, NB )
00211 *
00212 *                 Update the upper triangle of A(k:n,k:n)
00213 *
00214                   CALL SSYGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
00215      $                         B( K, K ), LDB, INFO )
00216                   IF( K+KB.LE.N ) THEN
00217                      CALL STRSM( 'Left', UPLO, 'Transpose', 'Non-unit',
00218      $                           KB, N-K-KB+1, ONE, B( K, K ), LDB,
00219      $                           A( K, K+KB ), LDA )
00220                      CALL SSYMM( 'Left', UPLO, KB, N-K-KB+1, -HALF,
00221      $                           A( K, K ), LDA, B( K, K+KB ), LDB, ONE,
00222      $                           A( K, K+KB ), LDA )
00223                      CALL SSYR2K( UPLO, 'Transpose', N-K-KB+1, KB, -ONE,
00224      $                            A( K, K+KB ), LDA, B( K, K+KB ), LDB,
00225      $                            ONE, A( K+KB, K+KB ), LDA )
00226                      CALL SSYMM( 'Left', UPLO, KB, N-K-KB+1, -HALF,
00227      $                           A( K, K ), LDA, B( K, K+KB ), LDB, ONE,
00228      $                           A( K, K+KB ), LDA )
00229                      CALL STRSM( 'Right', UPLO, 'No transpose',
00230      $                           'Non-unit', KB, N-K-KB+1, ONE,
00231      $                           B( K+KB, K+KB ), LDB, A( K, K+KB ),
00232      $                           LDA )
00233                   END IF
00234    10          CONTINUE
00235             ELSE
00236 *
00237 *              Compute inv(L)*A*inv(L**T)
00238 *
00239                DO 20 K = 1, N, NB
00240                   KB = MIN( N-K+1, NB )
00241 *
00242 *                 Update the lower triangle of A(k:n,k:n)
00243 *
00244                   CALL SSYGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
00245      $                         B( K, K ), LDB, INFO )
00246                   IF( K+KB.LE.N ) THEN
00247                      CALL STRSM( 'Right', UPLO, 'Transpose', 'Non-unit',
00248      $                           N-K-KB+1, KB, ONE, B( K, K ), LDB,
00249      $                           A( K+KB, K ), LDA )
00250                      CALL SSYMM( 'Right', UPLO, N-K-KB+1, KB, -HALF,
00251      $                           A( K, K ), LDA, B( K+KB, K ), LDB, ONE,
00252      $                           A( K+KB, K ), LDA )
00253                      CALL SSYR2K( UPLO, 'No transpose', N-K-KB+1, KB,
00254      $                            -ONE, A( K+KB, K ), LDA, B( K+KB, K ),
00255      $                            LDB, ONE, A( K+KB, K+KB ), LDA )
00256                      CALL SSYMM( 'Right', UPLO, N-K-KB+1, KB, -HALF,
00257      $                           A( K, K ), LDA, B( K+KB, K ), LDB, ONE,
00258      $                           A( K+KB, K ), LDA )
00259                      CALL STRSM( 'Left', UPLO, 'No transpose',
00260      $                           'Non-unit', N-K-KB+1, KB, ONE,
00261      $                           B( K+KB, K+KB ), LDB, A( K+KB, K ),
00262      $                           LDA )
00263                   END IF
00264    20          CONTINUE
00265             END IF
00266          ELSE
00267             IF( UPPER ) THEN
00268 *
00269 *              Compute U*A*U**T
00270 *
00271                DO 30 K = 1, N, NB
00272                   KB = MIN( N-K+1, NB )
00273 *
00274 *                 Update the upper triangle of A(1:k+kb-1,1:k+kb-1)
00275 *
00276                   CALL STRMM( 'Left', UPLO, 'No transpose', 'Non-unit',
00277      $                        K-1, KB, ONE, B, LDB, A( 1, K ), LDA )
00278                   CALL SSYMM( 'Right', UPLO, K-1, KB, HALF, A( K, K ),
00279      $                        LDA, B( 1, K ), LDB, ONE, A( 1, K ), LDA )
00280                   CALL SSYR2K( UPLO, 'No transpose', K-1, KB, ONE,
00281      $                         A( 1, K ), LDA, B( 1, K ), LDB, ONE, A,
00282      $                         LDA )
00283                   CALL SSYMM( 'Right', UPLO, K-1, KB, HALF, A( K, K ),
00284      $                        LDA, B( 1, K ), LDB, ONE, A( 1, K ), LDA )
00285                   CALL STRMM( 'Right', UPLO, 'Transpose', 'Non-unit',
00286      $                        K-1, KB, ONE, B( K, K ), LDB, A( 1, K ),
00287      $                        LDA )
00288                   CALL SSYGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
00289      $                         B( K, K ), LDB, INFO )
00290    30          CONTINUE
00291             ELSE
00292 *
00293 *              Compute L**T*A*L
00294 *
00295                DO 40 K = 1, N, NB
00296                   KB = MIN( N-K+1, NB )
00297 *
00298 *                 Update the lower triangle of A(1:k+kb-1,1:k+kb-1)
00299 *
00300                   CALL STRMM( 'Right', UPLO, 'No transpose', 'Non-unit',
00301      $                        KB, K-1, ONE, B, LDB, A( K, 1 ), LDA )
00302                   CALL SSYMM( 'Left', UPLO, KB, K-1, HALF, A( K, K ),
00303      $                        LDA, B( K, 1 ), LDB, ONE, A( K, 1 ), LDA )
00304                   CALL SSYR2K( UPLO, 'Transpose', K-1, KB, ONE,
00305      $                         A( K, 1 ), LDA, B( K, 1 ), LDB, ONE, A,
00306      $                         LDA )
00307                   CALL SSYMM( 'Left', UPLO, KB, K-1, HALF, A( K, K ),
00308      $                        LDA, B( K, 1 ), LDB, ONE, A( K, 1 ), LDA )
00309                   CALL STRMM( 'Left', UPLO, 'Transpose', 'Non-unit', KB,
00310      $                        K-1, ONE, B( K, K ), LDB, A( K, 1 ), LDA )
00311                   CALL SSYGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
00312      $                         B( K, K ), LDB, INFO )
00313    40          CONTINUE
00314             END IF
00315          END IF
00316       END IF
00317       RETURN
00318 *
00319 *     End of SSYGST
00320 *
00321       END
 All Files Functions