1: *> \brief \b ZPOTRF2
2: *
3: * =========== DOCUMENTATION ===========
4: *
5: * Online html documentation available at
6: * http://www.netlib.org/lapack/explore-html/
7: *
8: * Definition:
9: * ===========
10: *
11: * RECURSIVE SUBROUTINE ZPOTRF2( UPLO, N, A, LDA, INFO )
12: *
13: * .. Scalar Arguments ..
14: * CHARACTER UPLO
15: * INTEGER INFO, LDA, N
16: * ..
17: * .. Array Arguments ..
18: * COMPLEX*16 A( LDA, * )
19: * ..
20: *
21: *
22: *> \par Purpose:
23: * =============
24: *>
25: *> \verbatim
26: *>
27: *> ZPOTRF2 computes the Cholesky factorization of a Hermitian
28: *> positive definite matrix A using the recursive algorithm.
29: *>
30: *> The factorization has the form
31: *> A = U**H * U, if UPLO = 'U', or
32: *> A = L * L**H, if UPLO = 'L',
33: *> where U is an upper triangular matrix and L is lower triangular.
34: *>
35: *> This is the recursive version of the algorithm. It divides
36: *> the matrix into four submatrices:
37: *>
38: *> [ A11 | A12 ] where A11 is n1 by n1 and A22 is n2 by n2
39: *> A = [ -----|----- ] with n1 = n/2
40: *> [ A21 | A22 ] n2 = n-n1
41: *>
42: *> The subroutine calls itself to factor A11. Update and scale A21
43: *> or A12, update A22 then call itself to factor A22.
44: *>
45: *> \endverbatim
46: *
47: * Arguments:
48: * ==========
49: *
50: *> \param[in] UPLO
51: *> \verbatim
52: *> UPLO is CHARACTER*1
53: *> = 'U': Upper triangle of A is stored;
54: *> = 'L': Lower triangle of A is stored.
55: *> \endverbatim
56: *>
57: *> \param[in] N
58: *> \verbatim
59: *> N is INTEGER
60: *> The order of the matrix A. N >= 0.
61: *> \endverbatim
62: *>
63: *> \param[in,out] A
64: *> \verbatim
65: *> A is COMPLEX*16 array, dimension (LDA,N)
66: *> On entry, the Hermitian matrix A. If UPLO = 'U', the leading
67: *> N-by-N upper triangular part of A contains the upper
68: *> triangular part of the matrix A, and the strictly lower
69: *> triangular part of A is not referenced. If UPLO = 'L', the
70: *> leading N-by-N lower triangular part of A contains the lower
71: *> triangular part of the matrix A, and the strictly upper
72: *> triangular part of A is not referenced.
73: *>
74: *> On exit, if INFO = 0, the factor U or L from the Cholesky
75: *> factorization A = U**H*U or A = L*L**H.
76: *> \endverbatim
77: *>
78: *> \param[in] LDA
79: *> \verbatim
80: *> LDA is INTEGER
81: *> The leading dimension of the array A. LDA >= max(1,N).
82: *> \endverbatim
83: *>
84: *> \param[out] INFO
85: *> \verbatim
86: *> INFO is INTEGER
87: *> = 0: successful exit
88: *> < 0: if INFO = -i, the i-th argument had an illegal value
89: *> > 0: if INFO = i, the leading minor of order i is not
90: *> positive definite, and the factorization could not be
91: *> completed.
92: *> \endverbatim
93: *
94: * Authors:
95: * ========
96: *
97: *> \author Univ. of Tennessee
98: *> \author Univ. of California Berkeley
99: *> \author Univ. of Colorado Denver
100: *> \author NAG Ltd.
101: *
102: *> \ingroup complex16POcomputational
103: *
104: * =====================================================================
105: RECURSIVE SUBROUTINE ZPOTRF2( UPLO, N, A, LDA, INFO )
106: *
107: * -- LAPACK computational routine --
108: * -- LAPACK is a software package provided by Univ. of Tennessee, --
109: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
110: *
111: * .. Scalar Arguments ..
112: CHARACTER UPLO
113: INTEGER INFO, LDA, N
114: * ..
115: * .. Array Arguments ..
116: COMPLEX*16 A( LDA, * )
117: * ..
118: *
119: * =====================================================================
120: *
121: * .. Parameters ..
122: DOUBLE PRECISION ONE, ZERO
123: PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
124: COMPLEX*16 CONE
125: PARAMETER ( CONE = (1.0D+0, 0.0D+0) )
126: * ..
127: * .. Local Scalars ..
128: LOGICAL UPPER
129: INTEGER N1, N2, IINFO
130: DOUBLE PRECISION AJJ
131: * ..
132: * .. External Functions ..
133: LOGICAL LSAME, DISNAN
134: EXTERNAL LSAME, DISNAN
135: * ..
136: * .. External Subroutines ..
137: EXTERNAL ZHERK, ZTRSM, XERBLA
138: * ..
139: * .. Intrinsic Functions ..
140: INTRINSIC MAX, DBLE, SQRT
141: * ..
142: * .. Executable Statements ..
143: *
144: * Test the input parameters
145: *
146: INFO = 0
147: UPPER = LSAME( UPLO, 'U' )
148: IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
149: INFO = -1
150: ELSE IF( N.LT.0 ) THEN
151: INFO = -2
152: ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
153: INFO = -4
154: END IF
155: IF( INFO.NE.0 ) THEN
156: CALL XERBLA( 'ZPOTRF2', -INFO )
157: RETURN
158: END IF
159: *
160: * Quick return if possible
161: *
162: IF( N.EQ.0 )
163: $ RETURN
164: *
165: * N=1 case
166: *
167: IF( N.EQ.1 ) THEN
168: *
169: * Test for non-positive-definiteness
170: *
171: AJJ = DBLE( A( 1, 1 ) )
172: IF( AJJ.LE.ZERO.OR.DISNAN( AJJ ) ) THEN
173: INFO = 1
174: RETURN
175: END IF
176: *
177: * Factor
178: *
179: A( 1, 1 ) = SQRT( AJJ )
180: *
181: * Use recursive code
182: *
183: ELSE
184: N1 = N/2
185: N2 = N-N1
186: *
187: * Factor A11
188: *
189: CALL ZPOTRF2( UPLO, N1, A( 1, 1 ), LDA, IINFO )
190: IF ( IINFO.NE.0 ) THEN
191: INFO = IINFO
192: RETURN
193: END IF
194: *
195: * Compute the Cholesky factorization A = U**H*U
196: *
197: IF( UPPER ) THEN
198: *
199: * Update and scale A12
200: *
201: CALL ZTRSM( 'L', 'U', 'C', 'N', N1, N2, CONE,
202: $ A( 1, 1 ), LDA, A( 1, N1+1 ), LDA )
203: *
204: * Update and factor A22
205: *
206: CALL ZHERK( UPLO, 'C', N2, N1, -ONE, A( 1, N1+1 ), LDA,
207: $ ONE, A( N1+1, N1+1 ), LDA )
208: CALL ZPOTRF2( UPLO, N2, A( N1+1, N1+1 ), LDA, IINFO )
209: IF ( IINFO.NE.0 ) THEN
210: INFO = IINFO + N1
211: RETURN
212: END IF
213: *
214: * Compute the Cholesky factorization A = L*L**H
215: *
216: ELSE
217: *
218: * Update and scale A21
219: *
220: CALL ZTRSM( 'R', 'L', 'C', 'N', N2, N1, CONE,
221: $ A( 1, 1 ), LDA, A( N1+1, 1 ), LDA )
222: *
223: * Update and factor A22
224: *
225: CALL ZHERK( UPLO, 'N', N2, N1, -ONE, A( N1+1, 1 ), LDA,
226: $ ONE, A( N1+1, N1+1 ), LDA )
227: CALL ZPOTRF2( UPLO, N2, A( N1+1, N1+1 ), LDA, IINFO )
228: IF ( IINFO.NE.0 ) THEN
229: INFO = IINFO + N1
230: RETURN
231: END IF
232: END IF
233: END IF
234: RETURN
235: *
236: * End of ZPOTRF2
237: *
238: END
CVSweb interface <joel.bertrand@systella.fr>