3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * RECURSIVE SUBROUTINE SPOTRF2( UPLO, N, A, LDA, INFO )
13 * .. Scalar Arguments ..
15 * INTEGER INFO, LDA, N
17 * .. Array Arguments ..
27 *> SPOTRF2 computes the Cholesky factorization of a real symmetric
28 *> positive definite matrix A using the recursive algorithm.
30 *> The factorization has the form
31 *> A = U**T * U, if UPLO = 'U', or
32 *> A = L * L**T, if UPLO = 'L',
33 *> where U is an upper triangular matrix and L is lower triangular.
35 *> This is the recursive version of the algorithm. It divides
36 *> the matrix into four submatrices:
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
42 *> The subroutine calls itself to factor A11. Update and scale A21
43 *> or A12, update A22 then call itself to factor A22.
52 *> UPLO is CHARACTER*1
53 *> = 'U': Upper triangle of A is stored;
54 *> = 'L': Lower triangle of A is stored.
60 *> The order of the matrix A. N >= 0.
65 *> A is REAL array, dimension (LDA,N)
66 *> On entry, the symmetric 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.
74 *> On exit, if INFO = 0, the factor U or L from the Cholesky
75 *> factorization A = U**T*U or A = L*L**T.
81 *> The leading dimension of the array A. LDA >= max(1,N).
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
97 *> \author Univ. of Tennessee
98 *> \author Univ. of California Berkeley
99 *> \author Univ. of Colorado Denver
102 *> \date November 2015
104 *> \ingroup realPOcomputational
106 * =====================================================================
107 RECURSIVE SUBROUTINE SPOTRF2( UPLO, N, A, LDA, INFO )
109 * -- LAPACK computational routine (version 3.6.0) --
110 * -- LAPACK is a software package provided by Univ. of Tennessee, --
111 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
114 * .. Scalar Arguments ..
118 * .. Array Arguments ..
122 * =====================================================================
126 PARAMETER ( ONE = 1.0E+0, ZERO=0.0E+0 )
128 * .. Local Scalars ..
130 INTEGER N1, N2, IINFO
132 * .. External Functions ..
133 LOGICAL LSAME, SISNAN
134 EXTERNAL LSAME, SISNAN
136 * .. External Subroutines ..
137 EXTERNAL SGEMM, SSYRK, XERBLA
139 * .. Intrinsic Functions ..
142 * .. Executable Statements ..
144 * Test the input parameters
147 UPPER = LSAME( UPLO, 'U' )
148 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
150 ELSE IF( N.LT.0 ) THEN
152 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
156 CALL XERBLA( 'SPOTRF2', -INFO )
160 * Quick return if possible
169 * Test for non-positive-definiteness
171 IF( A( 1, 1 ).LE.ZERO.OR.SISNAN( A( 1, 1 ) ) ) THEN
178 A( 1, 1 ) = SQRT( A( 1, 1 ) )
188 CALL SPOTRF2( UPLO, N1, A( 1, 1 ), LDA, IINFO )
189 IF ( IINFO.NE.0 ) THEN
194 * Compute the Cholesky factorization A = U**T*U
198 * Update and scale A12
200 CALL STRSM( 'L', 'U', 'T', 'N', N1, N2, ONE,
201 $ A( 1, 1 ), LDA, A( 1, N1+1 ), LDA )
203 * Update and factor A22
205 CALL SSYRK( UPLO, 'T', N2, N1, -ONE, A( 1, N1+1 ), LDA,
206 $ ONE, A( N1+1, N1+1 ), LDA )
207 CALL SPOTRF2( UPLO, N2, A( N1+1, N1+1 ), LDA, IINFO )
208 IF ( IINFO.NE.0 ) THEN
213 * Compute the Cholesky factorization A = L*L**T
217 * Update and scale A21
219 CALL STRSM( 'R', 'L', 'T', 'N', N2, N1, ONE,
220 $ A( 1, 1 ), LDA, A( N1+1, 1 ), LDA )
222 * Update and factor A22
224 CALL SSYRK( UPLO, 'N', N2, N1, -ONE, A( N1+1, 1 ), LDA,
225 $ ONE, A( N1+1, N1+1 ), LDA )
226 CALL SPOTRF2( UPLO, N2, A( N1+1, N1+1 ), LDA, IINFO )
227 IF ( IINFO.NE.0 ) THEN