1 SUBROUTINE ZPBSTF( UPLO, N, KD, AB, LDAB, INFO )
2 *
3 * -- LAPACK routine (version 3.2) --
4 * -- LAPACK is a software package provided by Univ. of Tennessee, --
5 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
6 * November 2006
7 *
8 * .. Scalar Arguments ..
9 CHARACTER UPLO
10 INTEGER INFO, KD, LDAB, N
11 * ..
12 * .. Array Arguments ..
13 COMPLEX*16 AB( LDAB, * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * ZPBSTF computes a split Cholesky factorization of a complex
20 * Hermitian positive definite band matrix A.
21 *
22 * This routine is designed to be used in conjunction with ZHBGST.
23 *
24 * The factorization has the form A = S**H*S where S is a band matrix
25 * of the same bandwidth as A and the following structure:
26 *
27 * S = ( U )
28 * ( M L )
29 *
30 * where U is upper triangular of order m = (n+kd)/2, and L is lower
31 * triangular of order n-m.
32 *
33 * Arguments
34 * =========
35 *
36 * UPLO (input) CHARACTER*1
37 * = 'U': Upper triangle of A is stored;
38 * = 'L': Lower triangle of A is stored.
39 *
40 * N (input) INTEGER
41 * The order of the matrix A. N >= 0.
42 *
43 * KD (input) INTEGER
44 * The number of superdiagonals of the matrix A if UPLO = 'U',
45 * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
46 *
47 * AB (input/output) COMPLEX*16 array, dimension (LDAB,N)
48 * On entry, the upper or lower triangle of the Hermitian band
49 * matrix A, stored in the first kd+1 rows of the array. The
50 * j-th column of A is stored in the j-th column of the array AB
51 * as follows:
52 * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
53 * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
54 *
55 * On exit, if INFO = 0, the factor S from the split Cholesky
56 * factorization A = S**H*S. See Further Details.
57 *
58 * LDAB (input) INTEGER
59 * The leading dimension of the array AB. LDAB >= KD+1.
60 *
61 * INFO (output) INTEGER
62 * = 0: successful exit
63 * < 0: if INFO = -i, the i-th argument had an illegal value
64 * > 0: if INFO = i, the factorization could not be completed,
65 * because the updated element a(i,i) was negative; the
66 * matrix A is not positive definite.
67 *
68 * Further Details
69 * ===============
70 *
71 * The band storage scheme is illustrated by the following example, when
72 * N = 7, KD = 2:
73 *
74 * S = ( s11 s12 s13 )
75 * ( s22 s23 s24 )
76 * ( s33 s34 )
77 * ( s44 )
78 * ( s53 s54 s55 )
79 * ( s64 s65 s66 )
80 * ( s75 s76 s77 )
81 *
82 * If UPLO = 'U', the array AB holds:
83 *
84 * on entry: on exit:
85 *
86 * * * a13 a24 a35 a46 a57 * * s13 s24 s53**H s64**H s75**H
87 * * a12 a23 a34 a45 a56 a67 * s12 s23 s34 s54**H s65**H s76**H
88 * a11 a22 a33 a44 a55 a66 a77 s11 s22 s33 s44 s55 s66 s77
89 *
90 * If UPLO = 'L', the array AB holds:
91 *
92 * on entry: on exit:
93 *
94 * a11 a22 a33 a44 a55 a66 a77 s11 s22 s33 s44 s55 s66 s77
95 * a21 a32 a43 a54 a65 a76 * s12**H s23**H s34**H s54 s65 s76 *
96 * a31 a42 a53 a64 a64 * * s13**H s24**H s53 s64 s75 * *
97 *
98 * Array elements marked * are not used by the routine; s12**H denotes
99 * conjg(s12); the diagonal elements of S are real.
100
101 *
102 * =====================================================================
103 *
104 * .. Parameters ..
105 DOUBLE PRECISION ONE, ZERO
106 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
107 * ..
108 * .. Local Scalars ..
109 LOGICAL UPPER
110 INTEGER J, KLD, KM, M
111 DOUBLE PRECISION AJJ
112 * ..
113 * .. External Functions ..
114 LOGICAL LSAME
115 EXTERNAL LSAME
116 * ..
117 * .. External Subroutines ..
118 EXTERNAL XERBLA, ZDSCAL, ZHER, ZLACGV
119 * ..
120 * .. Intrinsic Functions ..
121 INTRINSIC DBLE, MAX, MIN, SQRT
122 * ..
123 * .. Executable Statements ..
124 *
125 * Test the input parameters.
126 *
127 INFO = 0
128 UPPER = LSAME( UPLO, 'U' )
129 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
130 INFO = -1
131 ELSE IF( N.LT.0 ) THEN
132 INFO = -2
133 ELSE IF( KD.LT.0 ) THEN
134 INFO = -3
135 ELSE IF( LDAB.LT.KD+1 ) THEN
136 INFO = -5
137 END IF
138 IF( INFO.NE.0 ) THEN
139 CALL XERBLA( 'ZPBSTF', -INFO )
140 RETURN
141 END IF
142 *
143 * Quick return if possible
144 *
145 IF( N.EQ.0 )
146 $ RETURN
147 *
148 KLD = MAX( 1, LDAB-1 )
149 *
150 * Set the splitting point m.
151 *
152 M = ( N+KD ) / 2
153 *
154 IF( UPPER ) THEN
155 *
156 * Factorize A(m+1:n,m+1:n) as L**H*L, and update A(1:m,1:m).
157 *
158 DO 10 J = N, M + 1, -1
159 *
160 * Compute s(j,j) and test for non-positive-definiteness.
161 *
162 AJJ = DBLE( AB( KD+1, J ) )
163 IF( AJJ.LE.ZERO ) THEN
164 AB( KD+1, J ) = AJJ
165 GO TO 50
166 END IF
167 AJJ = SQRT( AJJ )
168 AB( KD+1, J ) = AJJ
169 KM = MIN( J-1, KD )
170 *
171 * Compute elements j-km:j-1 of the j-th column and update the
172 * the leading submatrix within the band.
173 *
174 CALL ZDSCAL( KM, ONE / AJJ, AB( KD+1-KM, J ), 1 )
175 CALL ZHER( 'Upper', KM, -ONE, AB( KD+1-KM, J ), 1,
176 $ AB( KD+1, J-KM ), KLD )
177 10 CONTINUE
178 *
179 * Factorize the updated submatrix A(1:m,1:m) as U**H*U.
180 *
181 DO 20 J = 1, M
182 *
183 * Compute s(j,j) and test for non-positive-definiteness.
184 *
185 AJJ = DBLE( AB( KD+1, J ) )
186 IF( AJJ.LE.ZERO ) THEN
187 AB( KD+1, J ) = AJJ
188 GO TO 50
189 END IF
190 AJJ = SQRT( AJJ )
191 AB( KD+1, J ) = AJJ
192 KM = MIN( KD, M-J )
193 *
194 * Compute elements j+1:j+km of the j-th row and update the
195 * trailing submatrix within the band.
196 *
197 IF( KM.GT.0 ) THEN
198 CALL ZDSCAL( KM, ONE / AJJ, AB( KD, J+1 ), KLD )
199 CALL ZLACGV( KM, AB( KD, J+1 ), KLD )
200 CALL ZHER( 'Upper', KM, -ONE, AB( KD, J+1 ), KLD,
201 $ AB( KD+1, J+1 ), KLD )
202 CALL ZLACGV( KM, AB( KD, J+1 ), KLD )
203 END IF
204 20 CONTINUE
205 ELSE
206 *
207 * Factorize A(m+1:n,m+1:n) as L**H*L, and update A(1:m,1:m).
208 *
209 DO 30 J = N, M + 1, -1
210 *
211 * Compute s(j,j) and test for non-positive-definiteness.
212 *
213 AJJ = DBLE( AB( 1, J ) )
214 IF( AJJ.LE.ZERO ) THEN
215 AB( 1, J ) = AJJ
216 GO TO 50
217 END IF
218 AJJ = SQRT( AJJ )
219 AB( 1, J ) = AJJ
220 KM = MIN( J-1, KD )
221 *
222 * Compute elements j-km:j-1 of the j-th row and update the
223 * trailing submatrix within the band.
224 *
225 CALL ZDSCAL( KM, ONE / AJJ, AB( KM+1, J-KM ), KLD )
226 CALL ZLACGV( KM, AB( KM+1, J-KM ), KLD )
227 CALL ZHER( 'Lower', KM, -ONE, AB( KM+1, J-KM ), KLD,
228 $ AB( 1, J-KM ), KLD )
229 CALL ZLACGV( KM, AB( KM+1, J-KM ), KLD )
230 30 CONTINUE
231 *
232 * Factorize the updated submatrix A(1:m,1:m) as U**H*U.
233 *
234 DO 40 J = 1, M
235 *
236 * Compute s(j,j) and test for non-positive-definiteness.
237 *
238 AJJ = DBLE( AB( 1, J ) )
239 IF( AJJ.LE.ZERO ) THEN
240 AB( 1, J ) = AJJ
241 GO TO 50
242 END IF
243 AJJ = SQRT( AJJ )
244 AB( 1, J ) = AJJ
245 KM = MIN( KD, M-J )
246 *
247 * Compute elements j+1:j+km of the j-th column and update the
248 * trailing submatrix within the band.
249 *
250 IF( KM.GT.0 ) THEN
251 CALL ZDSCAL( KM, ONE / AJJ, AB( 2, J ), 1 )
252 CALL ZHER( 'Lower', KM, -ONE, AB( 2, J ), 1,
253 $ AB( 1, J+1 ), KLD )
254 END IF
255 40 CONTINUE
256 END IF
257 RETURN
258 *
259 50 CONTINUE
260 INFO = J
261 RETURN
262 *
263 * End of ZPBSTF
264 *
265 END
2 *
3 * -- LAPACK routine (version 3.2) --
4 * -- LAPACK is a software package provided by Univ. of Tennessee, --
5 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
6 * November 2006
7 *
8 * .. Scalar Arguments ..
9 CHARACTER UPLO
10 INTEGER INFO, KD, LDAB, N
11 * ..
12 * .. Array Arguments ..
13 COMPLEX*16 AB( LDAB, * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * ZPBSTF computes a split Cholesky factorization of a complex
20 * Hermitian positive definite band matrix A.
21 *
22 * This routine is designed to be used in conjunction with ZHBGST.
23 *
24 * The factorization has the form A = S**H*S where S is a band matrix
25 * of the same bandwidth as A and the following structure:
26 *
27 * S = ( U )
28 * ( M L )
29 *
30 * where U is upper triangular of order m = (n+kd)/2, and L is lower
31 * triangular of order n-m.
32 *
33 * Arguments
34 * =========
35 *
36 * UPLO (input) CHARACTER*1
37 * = 'U': Upper triangle of A is stored;
38 * = 'L': Lower triangle of A is stored.
39 *
40 * N (input) INTEGER
41 * The order of the matrix A. N >= 0.
42 *
43 * KD (input) INTEGER
44 * The number of superdiagonals of the matrix A if UPLO = 'U',
45 * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
46 *
47 * AB (input/output) COMPLEX*16 array, dimension (LDAB,N)
48 * On entry, the upper or lower triangle of the Hermitian band
49 * matrix A, stored in the first kd+1 rows of the array. The
50 * j-th column of A is stored in the j-th column of the array AB
51 * as follows:
52 * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
53 * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
54 *
55 * On exit, if INFO = 0, the factor S from the split Cholesky
56 * factorization A = S**H*S. See Further Details.
57 *
58 * LDAB (input) INTEGER
59 * The leading dimension of the array AB. LDAB >= KD+1.
60 *
61 * INFO (output) INTEGER
62 * = 0: successful exit
63 * < 0: if INFO = -i, the i-th argument had an illegal value
64 * > 0: if INFO = i, the factorization could not be completed,
65 * because the updated element a(i,i) was negative; the
66 * matrix A is not positive definite.
67 *
68 * Further Details
69 * ===============
70 *
71 * The band storage scheme is illustrated by the following example, when
72 * N = 7, KD = 2:
73 *
74 * S = ( s11 s12 s13 )
75 * ( s22 s23 s24 )
76 * ( s33 s34 )
77 * ( s44 )
78 * ( s53 s54 s55 )
79 * ( s64 s65 s66 )
80 * ( s75 s76 s77 )
81 *
82 * If UPLO = 'U', the array AB holds:
83 *
84 * on entry: on exit:
85 *
86 * * * a13 a24 a35 a46 a57 * * s13 s24 s53**H s64**H s75**H
87 * * a12 a23 a34 a45 a56 a67 * s12 s23 s34 s54**H s65**H s76**H
88 * a11 a22 a33 a44 a55 a66 a77 s11 s22 s33 s44 s55 s66 s77
89 *
90 * If UPLO = 'L', the array AB holds:
91 *
92 * on entry: on exit:
93 *
94 * a11 a22 a33 a44 a55 a66 a77 s11 s22 s33 s44 s55 s66 s77
95 * a21 a32 a43 a54 a65 a76 * s12**H s23**H s34**H s54 s65 s76 *
96 * a31 a42 a53 a64 a64 * * s13**H s24**H s53 s64 s75 * *
97 *
98 * Array elements marked * are not used by the routine; s12**H denotes
99 * conjg(s12); the diagonal elements of S are real.
100
101 *
102 * =====================================================================
103 *
104 * .. Parameters ..
105 DOUBLE PRECISION ONE, ZERO
106 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
107 * ..
108 * .. Local Scalars ..
109 LOGICAL UPPER
110 INTEGER J, KLD, KM, M
111 DOUBLE PRECISION AJJ
112 * ..
113 * .. External Functions ..
114 LOGICAL LSAME
115 EXTERNAL LSAME
116 * ..
117 * .. External Subroutines ..
118 EXTERNAL XERBLA, ZDSCAL, ZHER, ZLACGV
119 * ..
120 * .. Intrinsic Functions ..
121 INTRINSIC DBLE, MAX, MIN, SQRT
122 * ..
123 * .. Executable Statements ..
124 *
125 * Test the input parameters.
126 *
127 INFO = 0
128 UPPER = LSAME( UPLO, 'U' )
129 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
130 INFO = -1
131 ELSE IF( N.LT.0 ) THEN
132 INFO = -2
133 ELSE IF( KD.LT.0 ) THEN
134 INFO = -3
135 ELSE IF( LDAB.LT.KD+1 ) THEN
136 INFO = -5
137 END IF
138 IF( INFO.NE.0 ) THEN
139 CALL XERBLA( 'ZPBSTF', -INFO )
140 RETURN
141 END IF
142 *
143 * Quick return if possible
144 *
145 IF( N.EQ.0 )
146 $ RETURN
147 *
148 KLD = MAX( 1, LDAB-1 )
149 *
150 * Set the splitting point m.
151 *
152 M = ( N+KD ) / 2
153 *
154 IF( UPPER ) THEN
155 *
156 * Factorize A(m+1:n,m+1:n) as L**H*L, and update A(1:m,1:m).
157 *
158 DO 10 J = N, M + 1, -1
159 *
160 * Compute s(j,j) and test for non-positive-definiteness.
161 *
162 AJJ = DBLE( AB( KD+1, J ) )
163 IF( AJJ.LE.ZERO ) THEN
164 AB( KD+1, J ) = AJJ
165 GO TO 50
166 END IF
167 AJJ = SQRT( AJJ )
168 AB( KD+1, J ) = AJJ
169 KM = MIN( J-1, KD )
170 *
171 * Compute elements j-km:j-1 of the j-th column and update the
172 * the leading submatrix within the band.
173 *
174 CALL ZDSCAL( KM, ONE / AJJ, AB( KD+1-KM, J ), 1 )
175 CALL ZHER( 'Upper', KM, -ONE, AB( KD+1-KM, J ), 1,
176 $ AB( KD+1, J-KM ), KLD )
177 10 CONTINUE
178 *
179 * Factorize the updated submatrix A(1:m,1:m) as U**H*U.
180 *
181 DO 20 J = 1, M
182 *
183 * Compute s(j,j) and test for non-positive-definiteness.
184 *
185 AJJ = DBLE( AB( KD+1, J ) )
186 IF( AJJ.LE.ZERO ) THEN
187 AB( KD+1, J ) = AJJ
188 GO TO 50
189 END IF
190 AJJ = SQRT( AJJ )
191 AB( KD+1, J ) = AJJ
192 KM = MIN( KD, M-J )
193 *
194 * Compute elements j+1:j+km of the j-th row and update the
195 * trailing submatrix within the band.
196 *
197 IF( KM.GT.0 ) THEN
198 CALL ZDSCAL( KM, ONE / AJJ, AB( KD, J+1 ), KLD )
199 CALL ZLACGV( KM, AB( KD, J+1 ), KLD )
200 CALL ZHER( 'Upper', KM, -ONE, AB( KD, J+1 ), KLD,
201 $ AB( KD+1, J+1 ), KLD )
202 CALL ZLACGV( KM, AB( KD, J+1 ), KLD )
203 END IF
204 20 CONTINUE
205 ELSE
206 *
207 * Factorize A(m+1:n,m+1:n) as L**H*L, and update A(1:m,1:m).
208 *
209 DO 30 J = N, M + 1, -1
210 *
211 * Compute s(j,j) and test for non-positive-definiteness.
212 *
213 AJJ = DBLE( AB( 1, J ) )
214 IF( AJJ.LE.ZERO ) THEN
215 AB( 1, J ) = AJJ
216 GO TO 50
217 END IF
218 AJJ = SQRT( AJJ )
219 AB( 1, J ) = AJJ
220 KM = MIN( J-1, KD )
221 *
222 * Compute elements j-km:j-1 of the j-th row and update the
223 * trailing submatrix within the band.
224 *
225 CALL ZDSCAL( KM, ONE / AJJ, AB( KM+1, J-KM ), KLD )
226 CALL ZLACGV( KM, AB( KM+1, J-KM ), KLD )
227 CALL ZHER( 'Lower', KM, -ONE, AB( KM+1, J-KM ), KLD,
228 $ AB( 1, J-KM ), KLD )
229 CALL ZLACGV( KM, AB( KM+1, J-KM ), KLD )
230 30 CONTINUE
231 *
232 * Factorize the updated submatrix A(1:m,1:m) as U**H*U.
233 *
234 DO 40 J = 1, M
235 *
236 * Compute s(j,j) and test for non-positive-definiteness.
237 *
238 AJJ = DBLE( AB( 1, J ) )
239 IF( AJJ.LE.ZERO ) THEN
240 AB( 1, J ) = AJJ
241 GO TO 50
242 END IF
243 AJJ = SQRT( AJJ )
244 AB( 1, J ) = AJJ
245 KM = MIN( KD, M-J )
246 *
247 * Compute elements j+1:j+km of the j-th column and update the
248 * trailing submatrix within the band.
249 *
250 IF( KM.GT.0 ) THEN
251 CALL ZDSCAL( KM, ONE / AJJ, AB( 2, J ), 1 )
252 CALL ZHER( 'Lower', KM, -ONE, AB( 2, J ), 1,
253 $ AB( 1, J+1 ), KLD )
254 END IF
255 40 CONTINUE
256 END IF
257 RETURN
258 *
259 50 CONTINUE
260 INFO = J
261 RETURN
262 *
263 * End of ZPBSTF
264 *
265 END