3 /* Table of constant values */
5 static doublereal c_b9 = 1.;
7 /* Subroutine */ int dpotrs_(char *uplo, integer *n, integer *nrhs,
8 doublereal *a, integer *lda, doublereal *b, integer *ldb, integer *
11 /* System generated locals */
12 integer a_dim1, a_offset, b_dim1, b_offset, i__1;
15 extern logical lsame_(char *, char *);
16 extern /* Subroutine */ int dtrsm_(char *, char *, char *, char *,
17 integer *, integer *, doublereal *, doublereal *, integer *,
18 doublereal *, integer *);
20 extern /* Subroutine */ int xerbla_(char *, integer *);
23 /* -- LAPACK routine (version 3.1) -- */
24 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
27 /* .. Scalar Arguments .. */
29 /* .. Array Arguments .. */
35 /* DPOTRS solves a system of linear equations A*X = B with a symmetric */
36 /* positive definite matrix A using the Cholesky factorization */
37 /* A = U**T*U or A = L*L**T computed by DPOTRF. */
42 /* UPLO (input) CHARACTER*1 */
43 /* = 'U': Upper triangle of A is stored; */
44 /* = 'L': Lower triangle of A is stored. */
46 /* N (input) INTEGER */
47 /* The order of the matrix A. N >= 0. */
49 /* NRHS (input) INTEGER */
50 /* The number of right hand sides, i.e., the number of columns */
51 /* of the matrix B. NRHS >= 0. */
53 /* A (input) DOUBLE PRECISION array, dimension (LDA,N) */
54 /* The triangular factor U or L from the Cholesky factorization */
55 /* A = U**T*U or A = L*L**T, as computed by DPOTRF. */
57 /* LDA (input) INTEGER */
58 /* The leading dimension of the array A. LDA >= max(1,N). */
60 /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
61 /* On entry, the right hand side matrix B. */
62 /* On exit, the solution matrix X. */
64 /* LDB (input) INTEGER */
65 /* The leading dimension of the array B. LDB >= max(1,N). */
67 /* INFO (output) INTEGER */
68 /* = 0: successful exit */
69 /* < 0: if INFO = -i, the i-th argument had an illegal value */
71 /* ===================================================================== */
73 /* .. Parameters .. */
75 /* .. Local Scalars .. */
77 /* .. External Functions .. */
79 /* .. External Subroutines .. */
81 /* .. Intrinsic Functions .. */
83 /* .. Executable Statements .. */
85 /* Test the input parameters. */
87 /* Parameter adjustments */
89 a_offset = 1 + a_dim1;
92 b_offset = 1 + b_dim1;
97 upper = lsame_(uplo, "U");
98 if (! upper && ! lsame_(uplo, "L")) {
102 } else if (*nrhs < 0) {
104 } else if (*lda < max(1,*n)) {
106 } else if (*ldb < max(1,*n)) {
111 xerbla_("DPOTRS", &i__1);
115 /* Quick return if possible */
117 if (*n == 0 || *nrhs == 0) {
123 /* Solve A*X = B where A = U'*U. */
125 /* Solve U'*X = B, overwriting B with X. */
127 dtrsm_("Left", "Upper", "Transpose", "Non-unit", n, nrhs, &c_b9, &a[
128 a_offset], lda, &b[b_offset], ldb);
130 /* Solve U*X = B, overwriting B with X. */
132 dtrsm_("Left", "Upper", "No transpose", "Non-unit", n, nrhs, &c_b9, &
133 a[a_offset], lda, &b[b_offset], ldb);
136 /* Solve A*X = B where A = L*L'. */
138 /* Solve L*X = B, overwriting B with X. */
140 dtrsm_("Left", "Lower", "No transpose", "Non-unit", n, nrhs, &c_b9, &
141 a[a_offset], lda, &b[b_offset], ldb);
143 /* Solve L'*X = B, overwriting B with X. */
145 dtrsm_("Left", "Lower", "Transpose", "Non-unit", n, nrhs, &c_b9, &a[
146 a_offset], lda, &b[b_offset], ldb);