LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
ssygst.f
Go to the documentation of this file.
1 *> \brief \b SSYGST
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download SSYGST + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ssygst.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ssygst.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ssygst.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE SSYGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
22 *
23 * .. Scalar Arguments ..
24 * CHARACTER UPLO
25 * INTEGER INFO, ITYPE, LDA, LDB, N
26 * ..
27 * .. Array Arguments ..
28 * REAL A( LDA, * ), B( LDB, * )
29 * ..
30 *
31 *
32 *> \par Purpose:
33 * =============
34 *>
35 *> \verbatim
36 *>
37 *> SSYGST reduces a real symmetric-definite generalized eigenproblem
38 *> to standard form.
39 *>
40 *> If ITYPE = 1, the problem is A*x = lambda*B*x,
41 *> and A is overwritten by inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T)
42 *>
43 *> If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
44 *> B*A*x = lambda*x, and A is overwritten by U*A*U**T or L**T*A*L.
45 *>
46 *> B must have been previously factorized as U**T*U or L*L**T by SPOTRF.
47 *> \endverbatim
48 *
49 * Arguments:
50 * ==========
51 *
52 *> \param[in] ITYPE
53 *> \verbatim
54 *> ITYPE is INTEGER
55 *> = 1: compute inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T);
56 *> = 2 or 3: compute U*A*U**T or L**T*A*L.
57 *> \endverbatim
58 *>
59 *> \param[in] UPLO
60 *> \verbatim
61 *> UPLO is CHARACTER*1
62 *> = 'U': Upper triangle of A is stored and B is factored as
63 *> U**T*U;
64 *> = 'L': Lower triangle of A is stored and B is factored as
65 *> L*L**T.
66 *> \endverbatim
67 *>
68 *> \param[in] N
69 *> \verbatim
70 *> N is INTEGER
71 *> The order of the matrices A and B. N >= 0.
72 *> \endverbatim
73 *>
74 *> \param[in,out] A
75 *> \verbatim
76 *> A is REAL array, dimension (LDA,N)
77 *> On entry, the symmetric matrix A. If UPLO = 'U', the leading
78 *> N-by-N upper triangular part of A contains the upper
79 *> triangular part of the matrix A, and the strictly lower
80 *> triangular part of A is not referenced. If UPLO = 'L', the
81 *> leading N-by-N lower triangular part of A contains the lower
82 *> triangular part of the matrix A, and the strictly upper
83 *> triangular part of A is not referenced.
84 *>
85 *> On exit, if INFO = 0, the transformed matrix, stored in the
86 *> same format as A.
87 *> \endverbatim
88 *>
89 *> \param[in] LDA
90 *> \verbatim
91 *> LDA is INTEGER
92 *> The leading dimension of the array A. LDA >= max(1,N).
93 *> \endverbatim
94 *>
95 *> \param[in] B
96 *> \verbatim
97 *> B is REAL array, dimension (LDB,N)
98 *> The triangular factor from the Cholesky factorization of B,
99 *> as returned by SPOTRF.
100 *> \endverbatim
101 *>
102 *> \param[in] LDB
103 *> \verbatim
104 *> LDB is INTEGER
105 *> The leading dimension of the array B. LDB >= max(1,N).
106 *> \endverbatim
107 *>
108 *> \param[out] INFO
109 *> \verbatim
110 *> INFO is INTEGER
111 *> = 0: successful exit
112 *> < 0: if INFO = -i, the i-th argument had an illegal value
113 *> \endverbatim
114 *
115 * Authors:
116 * ========
117 *
118 *> \author Univ. of Tennessee
119 *> \author Univ. of California Berkeley
120 *> \author Univ. of Colorado Denver
121 *> \author NAG Ltd.
122 *
123 *> \date November 2011
124 *
125 *> \ingroup realSYcomputational
126 *
127 * =====================================================================
128  SUBROUTINE ssygst( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
129 *
130 * -- LAPACK computational routine (version 3.4.0) --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
133 * November 2011
134 *
135 * .. Scalar Arguments ..
136  CHARACTER UPLO
137  INTEGER INFO, ITYPE, LDA, LDB, N
138 * ..
139 * .. Array Arguments ..
140  REAL A( lda, * ), B( ldb, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  REAL ONE, HALF
147  parameter ( one = 1.0, half = 0.5 )
148 * ..
149 * .. Local Scalars ..
150  LOGICAL UPPER
151  INTEGER K, KB, NB
152 * ..
153 * .. External Subroutines ..
154  EXTERNAL ssygs2, ssymm, ssyr2k, strmm, strsm, xerbla
155 * ..
156 * .. Intrinsic Functions ..
157  INTRINSIC max, min
158 * ..
159 * .. External Functions ..
160  LOGICAL LSAME
161  INTEGER ILAENV
162  EXTERNAL lsame, ilaenv
163 * ..
164 * .. Executable Statements ..
165 *
166 * Test the input parameters.
167 *
168  info = 0
169  upper = lsame( uplo, 'U' )
170  IF( itype.LT.1 .OR. itype.GT.3 ) THEN
171  info = -1
172  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
173  info = -2
174  ELSE IF( n.LT.0 ) THEN
175  info = -3
176  ELSE IF( lda.LT.max( 1, n ) ) THEN
177  info = -5
178  ELSE IF( ldb.LT.max( 1, n ) ) THEN
179  info = -7
180  END IF
181  IF( info.NE.0 ) THEN
182  CALL xerbla( 'SSYGST', -info )
183  RETURN
184  END IF
185 *
186 * Quick return if possible
187 *
188  IF( n.EQ.0 )
189  $ RETURN
190 *
191 * Determine the block size for this environment.
192 *
193  nb = ilaenv( 1, 'SSYGST', uplo, n, -1, -1, -1 )
194 *
195  IF( nb.LE.1 .OR. nb.GE.n ) THEN
196 *
197 * Use unblocked code
198 *
199  CALL ssygs2( itype, uplo, n, a, lda, b, ldb, info )
200  ELSE
201 *
202 * Use blocked code
203 *
204  IF( itype.EQ.1 ) THEN
205  IF( upper ) THEN
206 *
207 * Compute inv(U**T)*A*inv(U)
208 *
209  DO 10 k = 1, n, nb
210  kb = min( n-k+1, nb )
211 *
212 * Update the upper triangle of A(k:n,k:n)
213 *
214  CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
215  $ b( k, k ), ldb, info )
216  IF( k+kb.LE.n ) THEN
217  CALL strsm( 'Left', uplo, 'Transpose', 'Non-unit',
218  $ kb, n-k-kb+1, one, b( k, k ), ldb,
219  $ a( k, k+kb ), lda )
220  CALL ssymm( 'Left', uplo, kb, n-k-kb+1, -half,
221  $ a( k, k ), lda, b( k, k+kb ), ldb, one,
222  $ a( k, k+kb ), lda )
223  CALL ssyr2k( uplo, 'Transpose', n-k-kb+1, kb, -one,
224  $ a( k, k+kb ), lda, b( k, k+kb ), ldb,
225  $ one, a( k+kb, k+kb ), lda )
226  CALL ssymm( 'Left', uplo, kb, n-k-kb+1, -half,
227  $ a( k, k ), lda, b( k, k+kb ), ldb, one,
228  $ a( k, k+kb ), lda )
229  CALL strsm( 'Right', uplo, 'No transpose',
230  $ 'Non-unit', kb, n-k-kb+1, one,
231  $ b( k+kb, k+kb ), ldb, a( k, k+kb ),
232  $ lda )
233  END IF
234  10 CONTINUE
235  ELSE
236 *
237 * Compute inv(L)*A*inv(L**T)
238 *
239  DO 20 k = 1, n, nb
240  kb = min( n-k+1, nb )
241 *
242 * Update the lower triangle of A(k:n,k:n)
243 *
244  CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
245  $ b( k, k ), ldb, info )
246  IF( k+kb.LE.n ) THEN
247  CALL strsm( 'Right', uplo, 'Transpose', 'Non-unit',
248  $ n-k-kb+1, kb, one, b( k, k ), ldb,
249  $ a( k+kb, k ), lda )
250  CALL ssymm( 'Right', uplo, n-k-kb+1, kb, -half,
251  $ a( k, k ), lda, b( k+kb, k ), ldb, one,
252  $ a( k+kb, k ), lda )
253  CALL ssyr2k( uplo, 'No transpose', n-k-kb+1, kb,
254  $ -one, a( k+kb, k ), lda, b( k+kb, k ),
255  $ ldb, one, a( k+kb, k+kb ), lda )
256  CALL ssymm( 'Right', uplo, n-k-kb+1, kb, -half,
257  $ a( k, k ), lda, b( k+kb, k ), ldb, one,
258  $ a( k+kb, k ), lda )
259  CALL strsm( 'Left', uplo, 'No transpose',
260  $ 'Non-unit', n-k-kb+1, kb, one,
261  $ b( k+kb, k+kb ), ldb, a( k+kb, k ),
262  $ lda )
263  END IF
264  20 CONTINUE
265  END IF
266  ELSE
267  IF( upper ) THEN
268 *
269 * Compute U*A*U**T
270 *
271  DO 30 k = 1, n, nb
272  kb = min( n-k+1, nb )
273 *
274 * Update the upper triangle of A(1:k+kb-1,1:k+kb-1)
275 *
276  CALL strmm( 'Left', uplo, 'No transpose', 'Non-unit',
277  $ k-1, kb, one, b, ldb, a( 1, k ), lda )
278  CALL ssymm( 'Right', uplo, k-1, kb, half, a( k, k ),
279  $ lda, b( 1, k ), ldb, one, a( 1, k ), lda )
280  CALL ssyr2k( uplo, 'No transpose', k-1, kb, one,
281  $ a( 1, k ), lda, b( 1, k ), ldb, one, a,
282  $ lda )
283  CALL ssymm( 'Right', uplo, k-1, kb, half, a( k, k ),
284  $ lda, b( 1, k ), ldb, one, a( 1, k ), lda )
285  CALL strmm( 'Right', uplo, 'Transpose', 'Non-unit',
286  $ k-1, kb, one, b( k, k ), ldb, a( 1, k ),
287  $ lda )
288  CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
289  $ b( k, k ), ldb, info )
290  30 CONTINUE
291  ELSE
292 *
293 * Compute L**T*A*L
294 *
295  DO 40 k = 1, n, nb
296  kb = min( n-k+1, nb )
297 *
298 * Update the lower triangle of A(1:k+kb-1,1:k+kb-1)
299 *
300  CALL strmm( 'Right', uplo, 'No transpose', 'Non-unit',
301  $ kb, k-1, one, b, ldb, a( k, 1 ), lda )
302  CALL ssymm( 'Left', uplo, kb, k-1, half, a( k, k ),
303  $ lda, b( k, 1 ), ldb, one, a( k, 1 ), lda )
304  CALL ssyr2k( uplo, 'Transpose', k-1, kb, one,
305  $ a( k, 1 ), lda, b( k, 1 ), ldb, one, a,
306  $ lda )
307  CALL ssymm( 'Left', uplo, kb, k-1, half, a( k, k ),
308  $ lda, b( k, 1 ), ldb, one, a( k, 1 ), lda )
309  CALL strmm( 'Left', uplo, 'Transpose', 'Non-unit', kb,
310  $ k-1, one, b( k, k ), ldb, a( k, 1 ), lda )
311  CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
312  $ b( k, k ), ldb, info )
313  40 CONTINUE
314  END IF
315  END IF
316  END IF
317  RETURN
318 *
319 * End of SSYGST
320 *
321  END
subroutine strsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
STRSM
Definition: strsm.f:183
subroutine ssygs2(ITYPE, UPLO, N, A, LDA, B, LDB, INFO)
SSYGS2 reduces a symmetric definite generalized eigenproblem to standard form, using the factorizatio...
Definition: ssygs2.f:129
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine strmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
STRMM
Definition: strmm.f:179
subroutine ssyr2k(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SSYR2K
Definition: ssyr2k.f:194
subroutine ssygst(ITYPE, UPLO, N, A, LDA, B, LDB, INFO)
SSYGST
Definition: ssygst.f:129
subroutine ssymm(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SSYMM
Definition: ssymm.f:191