3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SSPGST + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sspgst.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sspgst.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sspgst.f">
21 * SUBROUTINE SSPGST( ITYPE, UPLO, N, AP, BP, INFO )
23 * .. Scalar Arguments ..
25 * INTEGER INFO, ITYPE, N
27 * .. Array Arguments ..
28 * REAL AP( * ), BP( * )
37 *> SSPGST reduces a real symmetric-definite generalized eigenproblem
38 *> to standard form, using packed storage.
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)
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.
46 *> B must have been previously factorized as U**T*U or L*L**T by SPPTRF.
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.
61 *> UPLO is CHARACTER*1
62 *> = 'U': Upper triangle of A is stored and B is factored as
64 *> = 'L': Lower triangle of A is stored and B is factored as
71 *> The order of the matrices A and B. N >= 0.
76 *> AP is REAL array, dimension (N*(N+1)/2)
77 *> On entry, the upper or lower triangle of the symmetric matrix
78 *> A, packed columnwise in a linear array. The j-th column of A
79 *> is stored in the array AP as follows:
80 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
81 *> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
83 *> On exit, if INFO = 0, the transformed matrix, stored in the
89 *> BP is REAL array, dimension (N*(N+1)/2)
90 *> The triangular factor from the Cholesky factorization of B,
91 *> stored in the same format as A, as returned by SPPTRF.
97 *> = 0: successful exit
98 *> < 0: if INFO = -i, the i-th argument had an illegal value
104 *> \author Univ. of Tennessee
105 *> \author Univ. of California Berkeley
106 *> \author Univ. of Colorado Denver
109 *> \date November 2011
111 *> \ingroup realOTHERcomputational
113 * =====================================================================
114 SUBROUTINE SSPGST( ITYPE, UPLO, N, AP, BP, INFO )
116 * -- LAPACK computational routine (version 3.4.0) --
117 * -- LAPACK is a software package provided by Univ. of Tennessee, --
118 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
121 * .. Scalar Arguments ..
123 INTEGER INFO, ITYPE, N
125 * .. Array Arguments ..
126 REAL AP( * ), BP( * )
129 * =====================================================================
133 PARAMETER ( ONE = 1.0, HALF = 0.5 )
135 * .. Local Scalars ..
137 INTEGER J, J1, J1J1, JJ, K, K1, K1K1, KK
138 REAL AJJ, AKK, BJJ, BKK, CT
140 * .. External Subroutines ..
141 EXTERNAL SAXPY, SSCAL, SSPMV, SSPR2, STPMV, STPSV,
144 * .. External Functions ..
149 * .. Executable Statements ..
151 * Test the input parameters.
154 UPPER = LSAME( UPLO, 'U' )
155 IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
157 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
159 ELSE IF( N.LT.0 ) THEN
163 CALL XERBLA( 'SSPGST', -INFO )
167 IF( ITYPE.EQ.1 ) THEN
170 * Compute inv(U**T)*A*inv(U)
172 * J1 and JJ are the indices of A(1,j) and A(j,j)
179 * Compute the j-th column of the upper triangle of A
182 CALL STPSV( UPLO, 'Transpose', 'Nonunit', J, BP,
184 CALL SSPMV( UPLO, J-1, -ONE, AP, BP( J1 ), 1, ONE,
186 CALL SSCAL( J-1, ONE / BJJ, AP( J1 ), 1 )
187 AP( JJ ) = ( AP( JJ )-SDOT( J-1, AP( J1 ), 1, BP( J1 ),
192 * Compute inv(L)*A*inv(L**T)
194 * KK and K1K1 are the indices of A(k,k) and A(k+1,k+1)
198 K1K1 = KK + N - K + 1
200 * Update the lower triangle of A(k:n,k:n)
207 CALL SSCAL( N-K, ONE / BKK, AP( KK+1 ), 1 )
209 CALL SAXPY( N-K, CT, BP( KK+1 ), 1, AP( KK+1 ), 1 )
210 CALL SSPR2( UPLO, N-K, -ONE, AP( KK+1 ), 1,
211 $ BP( KK+1 ), 1, AP( K1K1 ) )
212 CALL SAXPY( N-K, CT, BP( KK+1 ), 1, AP( KK+1 ), 1 )
213 CALL STPSV( UPLO, 'No transpose', 'Non-unit', N-K,
214 $ BP( K1K1 ), AP( KK+1 ), 1 )
224 * K1 and KK are the indices of A(1,k) and A(k,k)
231 * Update the upper triangle of A(1:k,1:k)
235 CALL STPMV( UPLO, 'No transpose', 'Non-unit', K-1, BP,
238 CALL SAXPY( K-1, CT, BP( K1 ), 1, AP( K1 ), 1 )
239 CALL SSPR2( UPLO, K-1, ONE, AP( K1 ), 1, BP( K1 ), 1,
241 CALL SAXPY( K-1, CT, BP( K1 ), 1, AP( K1 ), 1 )
242 CALL SSCAL( K-1, BKK, AP( K1 ), 1 )
243 AP( KK ) = AKK*BKK**2
249 * JJ and J1J1 are the indices of A(j,j) and A(j+1,j+1)
253 J1J1 = JJ + N - J + 1
255 * Compute the j-th column of the lower triangle of A
259 AP( JJ ) = AJJ*BJJ + SDOT( N-J, AP( JJ+1 ), 1,
261 CALL SSCAL( N-J, BJJ, AP( JJ+1 ), 1 )
262 CALL SSPMV( UPLO, N-J, ONE, AP( J1J1 ), BP( JJ+1 ), 1,
263 $ ONE, AP( JJ+1 ), 1 )
264 CALL STPMV( UPLO, 'Transpose', 'Non-unit', N-J+1,
265 $ BP( JJ ), AP( JJ ), 1 )