3 /* Table of constant values */
5 static integer c__1 = 1;
6 static integer c_n1 = -1;
7 static doublereal c_b13 = -1.;
8 static doublereal c_b14 = 1.;
10 /* Subroutine */ int dpotrf_(char *uplo, integer *n, doublereal *a, integer *
13 /* System generated locals */
14 integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
18 extern /* Subroutine */ int dgemm_(char *, char *, integer *, integer *,
19 integer *, doublereal *, doublereal *, integer *, doublereal *,
20 integer *, doublereal *, doublereal *, integer *);
21 extern logical lsame_(char *, char *);
22 extern /* Subroutine */ int dtrsm_(char *, char *, char *, char *,
23 integer *, integer *, doublereal *, doublereal *, integer *,
24 doublereal *, integer *);
26 extern /* Subroutine */ int dsyrk_(char *, char *, integer *, integer *,
27 doublereal *, doublereal *, integer *, doublereal *, doublereal *,
28 integer *), dpotf2_(char *, integer *,
29 doublereal *, integer *, integer *), xerbla_(char *,
31 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
32 integer *, integer *);
35 /* -- LAPACK routine (version 3.1) -- */
36 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
39 /* .. Scalar Arguments .. */
41 /* .. Array Arguments .. */
47 /* DPOTRF computes the Cholesky factorization of a real symmetric */
48 /* positive definite matrix A. */
50 /* The factorization has the form */
51 /* A = U**T * U, if UPLO = 'U', or */
52 /* A = L * L**T, if UPLO = 'L', */
53 /* where U is an upper triangular matrix and L is lower triangular. */
55 /* This is the block version of the algorithm, calling Level 3 BLAS. */
60 /* UPLO (input) CHARACTER*1 */
61 /* = 'U': Upper triangle of A is stored; */
62 /* = 'L': Lower triangle of A is stored. */
64 /* N (input) INTEGER */
65 /* The order of the matrix A. N >= 0. */
67 /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
68 /* On entry, the symmetric matrix A. If UPLO = 'U', the leading */
69 /* N-by-N upper triangular part of A contains the upper */
70 /* triangular part of the matrix A, and the strictly lower */
71 /* triangular part of A is not referenced. If UPLO = 'L', the */
72 /* leading N-by-N lower triangular part of A contains the lower */
73 /* triangular part of the matrix A, and the strictly upper */
74 /* triangular part of A is not referenced. */
76 /* On exit, if INFO = 0, the factor U or L from the Cholesky */
77 /* factorization A = U**T*U or A = L*L**T. */
79 /* LDA (input) INTEGER */
80 /* The leading dimension of the array A. LDA >= max(1,N). */
82 /* INFO (output) INTEGER */
83 /* = 0: successful exit */
84 /* < 0: if INFO = -i, the i-th argument had an illegal value */
85 /* > 0: if INFO = i, the leading minor of order i is not */
86 /* positive definite, and the factorization could not be */
89 /* ===================================================================== */
91 /* .. Parameters .. */
93 /* .. Local Scalars .. */
95 /* .. External Functions .. */
97 /* .. External Subroutines .. */
99 /* .. Intrinsic Functions .. */
101 /* .. Executable Statements .. */
103 /* Test the input parameters. */
105 /* Parameter adjustments */
107 a_offset = 1 + a_dim1;
112 upper = lsame_(uplo, "U");
113 if (! upper && ! lsame_(uplo, "L")) {
117 } else if (*lda < max(1,*n)) {
122 xerbla_("DPOTRF", &i__1);
126 /* Quick return if possible */
132 /* Determine the block size for this environment. */
134 nb = ilaenv_(&c__1, "DPOTRF", uplo, n, &c_n1, &c_n1, &c_n1);
135 if (nb <= 1 || nb >= *n) {
137 /* Use unblocked code. */
139 dpotf2_(uplo, n, &a[a_offset], lda, info);
142 /* Use blocked code. */
146 /* Compute the Cholesky factorization A = U'*U. */
150 for (j = 1; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
152 /* Update and factorize the current diagonal block and test */
153 /* for non-positive-definiteness. */
156 i__3 = nb, i__4 = *n - j + 1;
159 dsyrk_("Upper", "Transpose", &jb, &i__3, &c_b13, &a[j *
160 a_dim1 + 1], lda, &c_b14, &a[j + j * a_dim1], lda);
161 dpotf2_("Upper", &jb, &a[j + j * a_dim1], lda, info);
167 /* Compute the current block row. */
169 i__3 = *n - j - jb + 1;
171 dgemm_("Transpose", "No transpose", &jb, &i__3, &i__4, &
172 c_b13, &a[j * a_dim1 + 1], lda, &a[(j + jb) *
173 a_dim1 + 1], lda, &c_b14, &a[j + (j + jb) *
175 i__3 = *n - j - jb + 1;
176 dtrsm_("Left", "Upper", "Transpose", "Non-unit", &jb, &
177 i__3, &c_b14, &a[j + j * a_dim1], lda, &a[j + (j
178 + jb) * a_dim1], lda);
185 /* Compute the Cholesky factorization A = L*L'. */
189 for (j = 1; i__1 < 0 ? j >= i__2 : j <= i__2; j += i__1) {
191 /* Update and factorize the current diagonal block and test */
192 /* for non-positive-definiteness. */
195 i__3 = nb, i__4 = *n - j + 1;
198 dsyrk_("Lower", "No transpose", &jb, &i__3, &c_b13, &a[j +
199 a_dim1], lda, &c_b14, &a[j + j * a_dim1], lda);
200 dpotf2_("Lower", &jb, &a[j + j * a_dim1], lda, info);
206 /* Compute the current block column. */
208 i__3 = *n - j - jb + 1;
210 dgemm_("No transpose", "Transpose", &i__3, &jb, &i__4, &
211 c_b13, &a[j + jb + a_dim1], lda, &a[j + a_dim1],
212 lda, &c_b14, &a[j + jb + j * a_dim1], lda);
213 i__3 = *n - j - jb + 1;
214 dtrsm_("Right", "Lower", "Transpose", "Non-unit", &i__3, &
215 jb, &c_b14, &a[j + j * a_dim1], lda, &a[j + jb +
225 *info = *info + j - 1;