3 /* Subroutine */ int dgesv_(integer *n, integer *nrhs, doublereal *a, integer
4 *lda, integer *ipiv, doublereal *b, integer *ldb, integer *info)
6 /* System generated locals */
7 integer a_dim1, a_offset, b_dim1, b_offset, i__1;
10 extern /* Subroutine */ int dgetrf_(integer *, integer *, doublereal *,
11 integer *, integer *, integer *), xerbla_(char *, integer *), dgetrs_(char *, integer *, integer *, doublereal *,
12 integer *, integer *, doublereal *, integer *, integer *);
15 /* -- LAPACK driver routine (version 3.1) -- */
16 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
19 /* .. Scalar Arguments .. */
21 /* .. Array Arguments .. */
27 /* DGESV computes the solution to a real system of linear equations */
29 /* where A is an N-by-N matrix and X and B are N-by-NRHS matrices. */
31 /* The LU decomposition with partial pivoting and row interchanges is */
32 /* used to factor A as */
34 /* where P is a permutation matrix, L is unit lower triangular, and U is */
35 /* upper triangular. The factored form of A is then used to solve the */
36 /* system of equations A * X = B. */
41 /* N (input) INTEGER */
42 /* The number of linear equations, i.e., the order of the */
43 /* matrix A. N >= 0. */
45 /* NRHS (input) INTEGER */
46 /* The number of right hand sides, i.e., the number of columns */
47 /* of the matrix B. NRHS >= 0. */
49 /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
50 /* On entry, the N-by-N coefficient matrix A. */
51 /* On exit, the factors L and U from the factorization */
52 /* A = P*L*U; the unit diagonal elements of L are not stored. */
54 /* LDA (input) INTEGER */
55 /* The leading dimension of the array A. LDA >= max(1,N). */
57 /* IPIV (output) INTEGER array, dimension (N) */
58 /* The pivot indices that define the permutation matrix P; */
59 /* row i of the matrix was interchanged with row IPIV(i). */
61 /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
62 /* On entry, the N-by-NRHS matrix of right hand side matrix B. */
63 /* On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
65 /* LDB (input) INTEGER */
66 /* The leading dimension of the array B. LDB >= max(1,N). */
68 /* INFO (output) INTEGER */
69 /* = 0: successful exit */
70 /* < 0: if INFO = -i, the i-th argument had an illegal value */
71 /* > 0: if INFO = i, U(i,i) is exactly zero. The factorization */
72 /* has been completed, but the factor U is exactly */
73 /* singular, so the solution could not be computed. */
75 /* ===================================================================== */
77 /* .. External Subroutines .. */
79 /* .. Intrinsic Functions .. */
81 /* .. Executable Statements .. */
83 /* Test the input parameters. */
85 /* Parameter adjustments */
87 a_offset = 1 + a_dim1;
91 b_offset = 1 + b_dim1;
98 } else if (*nrhs < 0) {
100 } else if (*lda < max(1,*n)) {
102 } else if (*ldb < max(1,*n)) {
107 xerbla_("DGESV ", &i__1);
111 /* Compute the LU factorization of A. */
113 dgetrf_(n, n, &a[a_offset], lda, &ipiv[1], info);
116 /* Solve the system A*X = B, overwriting B with X. */
118 dgetrs_("No transpose", n, nrhs, &a[a_offset], lda, &ipiv[1], &b[
119 b_offset], ldb, info);