1 /* ./src_f77/dppsv.f -- translated by f2c (version 20030320).
2    You must link the resulting object file with the libraries:
3 	-lf2c -lm   (in that order)
4 */
5 
6 #include <punc/vf2c.h>
7 
dppsv_(char * uplo,integer * n,integer * nrhs,doublereal * ap,doublereal * b,integer * ldb,integer * info,ftnlen uplo_len)8 /* Subroutine */ int dppsv_(char *uplo, integer *n, integer *nrhs, doublereal
9 	*ap, doublereal *b, integer *ldb, integer *info, ftnlen uplo_len)
10 {
11     /* System generated locals */
12     integer b_dim1, b_offset, i__1;
13 
14     /* Local variables */
15     extern logical lsame_(char *, char *, ftnlen, ftnlen);
16     extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen), dpptrf_(
17 	    char *, integer *, doublereal *, integer *, ftnlen), dpptrs_(char
18 	    *, integer *, integer *, doublereal *, doublereal *, integer *,
19 	    integer *, ftnlen);
20 
21 
22 /*  -- LAPACK driver routine (version 3.0) -- */
23 /*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
24 /*     Courant Institute, Argonne National Lab, and Rice University */
25 /*     March 31, 1993 */
26 
27 /*     .. Scalar Arguments .. */
28 /*     .. */
29 /*     .. Array Arguments .. */
30 /*     .. */
31 
32 /*  Purpose */
33 /*  ======= */
34 
35 /*  DPPSV computes the solution to a real system of linear equations */
36 /*     A * X = B, */
37 /*  where A is an N-by-N symmetric positive definite matrix stored in */
38 /*  packed format and X and B are N-by-NRHS matrices. */
39 
40 /*  The Cholesky decomposition is used to factor A as */
41 /*     A = U**T* U,  if UPLO = 'U', or */
42 /*     A = L * L**T,  if UPLO = 'L', */
43 /*  where U is an upper triangular matrix and L is a lower triangular */
44 /*  matrix.  The factored form of A is then used to solve the system of */
45 /*  equations A * X = B. */
46 
47 /*  Arguments */
48 /*  ========= */
49 
50 /*  UPLO    (input) CHARACTER*1 */
51 /*          = 'U':  Upper triangle of A is stored; */
52 /*          = 'L':  Lower triangle of A is stored. */
53 
54 /*  N       (input) INTEGER */
55 /*          The number of linear equations, i.e., the order of the */
56 /*          matrix A.  N >= 0. */
57 
58 /*  NRHS    (input) INTEGER */
59 /*          The number of right hand sides, i.e., the number of columns */
60 /*          of the matrix B.  NRHS >= 0. */
61 
62 /*  AP      (input/output) DOUBLE PRECISION array, dimension (N*(N+1)/2) */
63 /*          On entry, the upper or lower triangle of the symmetric matrix */
64 /*          A, packed columnwise in a linear array.  The j-th column of A */
65 /*          is stored in the array AP as follows: */
66 /*          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; */
67 /*          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. */
68 /*          See below for further details. */
69 
70 /*          On exit, if INFO = 0, the factor U or L from the Cholesky */
71 /*          factorization A = U**T*U or A = L*L**T, in the same storage */
72 /*          format as A. */
73 
74 /*  B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
75 /*          On entry, the N-by-NRHS right hand side matrix B. */
76 /*          On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
77 
78 /*  LDB     (input) INTEGER */
79 /*          The leading dimension of the array B.  LDB >= max(1,N). */
80 
81 /*  INFO    (output) INTEGER */
82 /*          = 0:  successful exit */
83 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
84 /*          > 0:  if INFO = i, the leading minor of order i of A is not */
85 /*                positive definite, so the factorization could not be */
86 /*                completed, and the solution has not been computed. */
87 
88 /*  Further Details */
89 /*  =============== */
90 
91 /*  The packed storage scheme is illustrated by the following example */
92 /*  when N = 4, UPLO = 'U': */
93 
94 /*  Two-dimensional storage of the symmetric matrix A: */
95 
96 /*     a11 a12 a13 a14 */
97 /*         a22 a23 a24 */
98 /*             a33 a34     (aij = conjg(aji)) */
99 /*                 a44 */
100 
101 /*  Packed storage of the upper triangle of A: */
102 
103 /*  AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ] */
104 
105 /*  ===================================================================== */
106 
107 /*     .. External Functions .. */
108 /*     .. */
109 /*     .. External Subroutines .. */
110 /*     .. */
111 /*     .. Intrinsic Functions .. */
112 /*     .. */
113 /*     .. Executable Statements .. */
114 
115 /*     Test the input parameters. */
116 
117     /* Parameter adjustments */
118     --ap;
119     b_dim1 = *ldb;
120     b_offset = 1 + b_dim1;
121     b -= b_offset;
122 
123     /* Function Body */
124     *info = 0;
125     if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (
126 	    ftnlen)1, (ftnlen)1)) {
127 	*info = -1;
128     } else if (*n < 0) {
129 	*info = -2;
130     } else if (*nrhs < 0) {
131 	*info = -3;
132     } else if (*ldb < max(1,*n)) {
133 	*info = -6;
134     }
135     if (*info != 0) {
136 	i__1 = -(*info);
137 	xerbla_("DPPSV ", &i__1, (ftnlen)6);
138 	return 0;
139     }
140 
141 /*     Compute the Cholesky factorization A = U'*U or A = L*L'. */
142 
143     dpptrf_(uplo, n, &ap[1], info, (ftnlen)1);
144     if (*info == 0) {
145 
146 /*        Solve the system A*X = B, overwriting B with X. */
147 
148 	dpptrs_(uplo, n, nrhs, &ap[1], &b[b_offset], ldb, info, (ftnlen)1);
149 
150     }
151     return 0;
152 
153 /*     End of DPPSV */
154 
155 } /* dppsv_ */
156 
157