1 /*  -- translated by f2c (version 20191129).
2    You must link the resulting object file with libf2c:
3 	on Microsoft Windows system, link with libf2c.lib;
4 	on Linux or Unix systems, link with .../path/to/libf2c.a -lm
5 	or, if you install libf2c.a in a standard place, with -lf2c -lm
6 	-- in that order, at the end of the command line, as in
7 		cc *.o -lf2c -lm
8 	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
9 
10 		http://www.netlib.org/f2c/libf2c.zip
11 */
12 
13 #include "f2c.h"
14 
15 /* > \brief <b> DGESV computes the solution to system of linear equations A * X = B for GE matrices</b>
16 
17     =========== DOCUMENTATION ===========
18 
19    Online html documentation available at
20               http://www.netlib.org/lapack/explore-html/
21 
22    > \htmlonly
23    > Download DGESV + dependencies
24    > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgesv.f
25 ">
26    > [TGZ]</a>
27    > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgesv.f
28 ">
29    > [ZIP]</a>
30    > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgesv.f
31 ">
32    > [TXT]</a>
33    > \endhtmlonly
34 
35     Definition:
36     ===========
37 
38          SUBROUTINE DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
39 
40          INTEGER            INFO, LDA, LDB, N, NRHS
41          INTEGER            IPIV( * )
42          DOUBLE PRECISION   A( LDA, * ), B( LDB, * )
43 
44 
45    > \par Purpose:
46     =============
47    >
48    > \verbatim
49    >
50    > DGESV computes the solution to a real system of linear equations
51    >    A * X = B,
52    > where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
53    >
54    > The LU decomposition with partial pivoting and row interchanges is
55    > used to factor A as
56    >    A = P * L * U,
57    > where P is a permutation matrix, L is unit lower triangular, and U is
58    > upper triangular.  The factored form of A is then used to solve the
59    > system of equations A * X = B.
60    > \endverbatim
61 
62     Arguments:
63     ==========
64 
65    > \param[in] N
66    > \verbatim
67    >          N is INTEGER
68    >          The number of linear equations, i.e., the order of the
69    >          matrix A.  N >= 0.
70    > \endverbatim
71    >
72    > \param[in] NRHS
73    > \verbatim
74    >          NRHS is INTEGER
75    >          The number of right hand sides, i.e., the number of columns
76    >          of the matrix B.  NRHS >= 0.
77    > \endverbatim
78    >
79    > \param[in,out] A
80    > \verbatim
81    >          A is DOUBLE PRECISION array, dimension (LDA,N)
82    >          On entry, the N-by-N coefficient matrix A.
83    >          On exit, the factors L and U from the factorization
84    >          A = P*L*U; the unit diagonal elements of L are not stored.
85    > \endverbatim
86    >
87    > \param[in] LDA
88    > \verbatim
89    >          LDA is INTEGER
90    >          The leading dimension of the array A.  LDA >= max(1,N).
91    > \endverbatim
92    >
93    > \param[out] IPIV
94    > \verbatim
95    >          IPIV is INTEGER array, dimension (N)
96    >          The pivot indices that define the permutation matrix P;
97    >          row i of the matrix was interchanged with row IPIV(i).
98    > \endverbatim
99    >
100    > \param[in,out] B
101    > \verbatim
102    >          B is DOUBLE PRECISION array, dimension (LDB,NRHS)
103    >          On entry, the N-by-NRHS matrix of right hand side matrix B.
104    >          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
105    > \endverbatim
106    >
107    > \param[in] LDB
108    > \verbatim
109    >          LDB is INTEGER
110    >          The leading dimension of the array B.  LDB >= max(1,N).
111    > \endverbatim
112    >
113    > \param[out] INFO
114    > \verbatim
115    >          INFO is INTEGER
116    >          = 0:  successful exit
117    >          < 0:  if INFO = -i, the i-th argument had an illegal value
118    >          > 0:  if INFO = i, U(i,i) is exactly zero.  The factorization
119    >                has been completed, but the factor U is exactly
120    >                singular, so the solution could not be computed.
121    > \endverbatim
122 
123     Authors:
124     ========
125 
126    > \author Univ. of Tennessee
127    > \author Univ. of California Berkeley
128    > \author Univ. of Colorado Denver
129    > \author NAG Ltd.
130 
131    > \date November 2011
132 
133    > \ingroup doubleGEsolve
134 
135     =====================================================================
igraphdgesv_(integer * n,integer * nrhs,doublereal * a,integer * lda,integer * ipiv,doublereal * b,integer * ldb,integer * info)136    Subroutine */ int igraphdgesv_(integer *n, integer *nrhs, doublereal *a, integer
137 	*lda, integer *ipiv, doublereal *b, integer *ldb, integer *info)
138 {
139     /* System generated locals */
140     integer a_dim1, a_offset, b_dim1, b_offset, i__1;
141 
142     /* Local variables */
143     extern /* Subroutine */ int igraphdgetrf_(integer *, integer *, doublereal *,
144 	    integer *, integer *, integer *), igraphxerbla_(char *, integer *,
145 	    ftnlen), igraphdgetrs_(char *, integer *, integer *, doublereal *,
146 	    integer *, integer *, doublereal *, integer *, integer *);
147 
148 
149 /*  -- LAPACK driver routine (version 3.4.0) --
150     -- LAPACK is a software package provided by Univ. of Tennessee,    --
151     -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
152        November 2011
153 
154 
155     =====================================================================
156 
157 
158        Test the input parameters.
159 
160        Parameter adjustments */
161     a_dim1 = *lda;
162     a_offset = 1 + a_dim1;
163     a -= a_offset;
164     --ipiv;
165     b_dim1 = *ldb;
166     b_offset = 1 + b_dim1;
167     b -= b_offset;
168 
169     /* Function Body */
170     *info = 0;
171     if (*n < 0) {
172 	*info = -1;
173     } else if (*nrhs < 0) {
174 	*info = -2;
175     } else if (*lda < max(1,*n)) {
176 	*info = -4;
177     } else if (*ldb < max(1,*n)) {
178 	*info = -7;
179     }
180     if (*info != 0) {
181 	i__1 = -(*info);
182 	igraphxerbla_("DGESV ", &i__1, (ftnlen)6);
183 	return 0;
184     }
185 
186 /*     Compute the LU factorization of A. */
187 
188     igraphdgetrf_(n, n, &a[a_offset], lda, &ipiv[1], info);
189     if (*info == 0) {
190 
191 /*        Solve the system A*X = B, overwriting B with X. */
192 
193 	igraphdgetrs_("No transpose", n, nrhs, &a[a_offset], lda, &ipiv[1], &b[
194 		b_offset], ldb, info);
195     }
196     return 0;
197 
198 /*     End of DGESV */
199 
200 } /* igraphdgesv_ */
201 
202