3 /* Table of constant values */
5 static integer c__1 = 1;
6 static doublereal c_b10 = -1.;
7 static doublereal c_b12 = 1.;
9 /* Subroutine */ int dpotf2_(char *uplo, integer *n, doublereal *a, integer *
12 /* System generated locals */
13 integer a_dim1, a_offset, i__1, i__2, i__3;
16 /* Builtin functions */
17 double sqrt(doublereal);
22 extern doublereal ddot_(integer *, doublereal *, integer *, doublereal *,
24 extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *,
26 extern logical lsame_(char *, char *);
27 extern /* Subroutine */ int dgemv_(char *, integer *, integer *,
28 doublereal *, doublereal *, integer *, doublereal *, integer *,
29 doublereal *, doublereal *, integer *);
31 extern /* Subroutine */ int xerbla_(char *, integer *);
34 /* -- LAPACK routine (version 3.1) -- */
35 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
38 /* .. Scalar Arguments .. */
40 /* .. Array Arguments .. */
46 /* DPOTF2 computes the Cholesky factorization of a real symmetric */
47 /* positive definite matrix A. */
49 /* The factorization has the form */
50 /* A = U' * U , if UPLO = 'U', or */
51 /* A = L * L', if UPLO = 'L', */
52 /* where U is an upper triangular matrix and L is lower triangular. */
54 /* This is the unblocked version of the algorithm, calling Level 2 BLAS. */
59 /* UPLO (input) CHARACTER*1 */
60 /* Specifies whether the upper or lower triangular part of the */
61 /* symmetric matrix A is stored. */
62 /* = 'U': Upper triangular */
63 /* = 'L': Lower triangular */
65 /* N (input) INTEGER */
66 /* The order of the matrix A. N >= 0. */
68 /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
69 /* On entry, the symmetric matrix A. If UPLO = 'U', the leading */
70 /* n by n upper triangular part of A contains the upper */
71 /* triangular part of the matrix A, and the strictly lower */
72 /* triangular part of A is not referenced. If UPLO = 'L', the */
73 /* leading n by n lower triangular part of A contains the lower */
74 /* triangular part of the matrix A, and the strictly upper */
75 /* triangular part of A is not referenced. */
77 /* On exit, if INFO = 0, the factor U or L from the Cholesky */
78 /* factorization A = U'*U or A = L*L'. */
80 /* LDA (input) INTEGER */
81 /* The leading dimension of the array A. LDA >= max(1,N). */
83 /* INFO (output) INTEGER */
84 /* = 0: successful exit */
85 /* < 0: if INFO = -k, the k-th argument had an illegal value */
86 /* > 0: if INFO = k, the leading minor of order k is not */
87 /* positive definite, and the factorization could not be */
90 /* ===================================================================== */
92 /* .. Parameters .. */
94 /* .. Local Scalars .. */
96 /* .. External Functions .. */
98 /* .. External Subroutines .. */
100 /* .. Intrinsic Functions .. */
102 /* .. Executable Statements .. */
104 /* Test the input parameters. */
106 /* Parameter adjustments */
108 a_offset = 1 + a_dim1;
113 upper = lsame_(uplo, "U");
114 if (! upper && ! lsame_(uplo, "L")) {
118 } else if (*lda < max(1,*n)) {
123 xerbla_("DPOTF2", &i__1);
127 /* Quick return if possible */
135 /* Compute the Cholesky factorization A = U'*U. */
138 for (j = 1; j <= i__1; ++j) {
140 /* Compute U(J,J) and test for non-positive-definiteness. */
143 ajj = a[j + j * a_dim1] - ddot_(&i__2, &a[j * a_dim1 + 1], &c__1,
144 &a[j * a_dim1 + 1], &c__1);
146 a[j + j * a_dim1] = ajj;
150 a[j + j * a_dim1] = ajj;
152 /* Compute elements J+1:N of row J. */
157 dgemv_("Transpose", &i__2, &i__3, &c_b10, &a[(j + 1) * a_dim1
158 + 1], lda, &a[j * a_dim1 + 1], &c__1, &c_b12, &a[j + (
159 j + 1) * a_dim1], lda);
162 dscal_(&i__2, &d__1, &a[j + (j + 1) * a_dim1], lda);
168 /* Compute the Cholesky factorization A = L*L'. */
171 for (j = 1; j <= i__1; ++j) {
173 /* Compute L(J,J) and test for non-positive-definiteness. */
176 ajj = a[j + j * a_dim1] - ddot_(&i__2, &a[j + a_dim1], lda, &a[j
179 a[j + j * a_dim1] = ajj;
183 a[j + j * a_dim1] = ajj;
185 /* Compute elements J+1:N of column J. */
190 dgemv_("No transpose", &i__2, &i__3, &c_b10, &a[j + 1 +
191 a_dim1], lda, &a[j + a_dim1], lda, &c_b12, &a[j + 1 +
195 dscal_(&i__2, &d__1, &a[j + 1 + j * a_dim1], &c__1);