1* Copyright (c) 2013 Samuel Halliday
2* Copyright (c) 1992-2011 The University of Tennessee and The University
3* of Tennessee Research Foundation. All rights
4* reserved.
5* Copyright (c) 2000-2011 The University of California Berkeley. All
6* rights reserved.
7* Copyright (c) 2006-2011 The University of Colorado Denver. All rights
8* reserved.
9*
10* $COPYRIGHT$
11*
12* Additional copyrights may follow
13*
14* $HEADER$
15*
16* Redistribution and use in source and binary forms, with or without
17* modification, are permitted provided that the following conditions are
18* met:
19*
20* - Redistributions of source code must retain the above copyright
21* notice, this list of conditions and the following disclaimer.
22*
23* - Redistributions in binary form must reproduce the above copyright
24* notice, this list of conditions and the following disclaimer listed
25* in this license in the documentation and/or other materials
26* provided with the distribution.
27*
28* - Neither the name of the copyright holders nor the names of its
29* contributors may be used to endorse or promote products derived from
30* this software without specific prior written permission.
31*
32* The copyright holders provide no reassurances that the source code
33* provided does not infringe any patent, copyright, or any other
34* intellectual property rights of third parties. The copyright holders
35* disclaim any liability to any recipient for claims brought against
36* recipient by any third party for infringement of that parties
37* intellectual property rights.
38*
39* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
40* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
41* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
42* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
43* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
45* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
46* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
47* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
48* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
49* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50
51*> \brief <b> DGESV computes the solution to system of linear equations A * X = B for GE matrices</b>
52*
53* =========== DOCUMENTATION ===========
54*
55* Online html documentation available at
56* http://www.netlib.org/lapack/explore-html/
57*
58*> \htmlonly
59*> Download DGESV + dependencies
60*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgesv.f">
61*> [TGZ]</a>
62*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgesv.f">
63*> [ZIP]</a>
64*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgesv.f">
65*> [TXT]</a>
66*> \endhtmlonly
67*
68* Definition:
69* ===========
70*
71* SUBROUTINE DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
72*
73* .. Scalar Arguments ..
74* INTEGER INFO, LDA, LDB, N, NRHS
75* ..
76* .. Array Arguments ..
77* INTEGER IPIV( * )
78* DOUBLE PRECISION A( LDA, * ), B( LDB, * )
79* ..
80*
81*
82*> \par Purpose:
83* =============
84*>
85*> \verbatim
86*>
87*> DGESV computes the solution to a real system of linear equations
88*> A * X = B,
89*> where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
90*>
91*> The LU decomposition with partial pivoting and row interchanges is
92*> used to factor A as
93*> A = P * L * U,
94*> where P is a permutation matrix, L is unit lower triangular, and U is
95*> upper triangular. The factored form of A is then used to solve the
96*> system of equations A * X = B.
97*> \endverbatim
98*
99* Arguments:
100* ==========
101*
102*> \param[in] N
103*> \verbatim
104*> N is INTEGER
105*> The number of linear equations, i.e., the order of the
106*> matrix A. N >= 0.
107*> \endverbatim
108*>
109*> \param[in] NRHS
110*> \verbatim
111*> NRHS is INTEGER
112*> The number of right hand sides, i.e., the number of columns
113*> of the matrix B. NRHS >= 0.
114*> \endverbatim
115*>
116*> \param[in,out] A
117*> \verbatim
118*> A is DOUBLE PRECISION array, dimension (LDA,N)
119*> On entry, the N-by-N coefficient matrix A.
120*> On exit, the factors L and U from the factorization
121*> A = P*L*U; the unit diagonal elements of L are not stored.
122*> \endverbatim
123*>
124*> \param[in] LDA
125*> \verbatim
126*> LDA is INTEGER
127*> The leading dimension of the array A. LDA >= max(1,N).
128*> \endverbatim
129*>
130*> \param[out] IPIV
131*> \verbatim
132*> IPIV is INTEGER array, dimension (N)
133*> The pivot indices that define the permutation matrix P;
134*> row i of the matrix was interchanged with row IPIV(i).
135*> \endverbatim
136*>
137*> \param[in,out] B
138*> \verbatim
139*> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
140*> On entry, the N-by-NRHS matrix of right hand side matrix B.
141*> On exit, if INFO = 0, the N-by-NRHS solution matrix X.
142*> \endverbatim
143*>
144*> \param[in] LDB
145*> \verbatim
146*> LDB is INTEGER
147*> The leading dimension of the array B. LDB >= max(1,N).
148*> \endverbatim
149*>
150*> \param[out] INFO
151*> \verbatim
152*> INFO is INTEGER
153*> = 0: successful exit
154*> < 0: if INFO = -i, the i-th argument had an illegal value
155*> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
156*> has been completed, but the factor U is exactly
157*> singular, so the solution could not be computed.
158*> \endverbatim
159*
160* Authors:
161* ========
162*
163*> \author Univ. of Tennessee
164*> \author Univ. of California Berkeley
165*> \author Univ. of Colorado Denver
166*> \author NAG Ltd.
167*
168*> \date November 2011
169*
170*> \ingroup doubleGEsolve
171*
172* =====================================================================
173 SUBROUTINE DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
174*
175* -- LAPACK driver routine (version 3.4.0) --
176* -- LAPACK is a software package provided by Univ. of Tennessee, --
177* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
178* November 2011
179*
180* .. Scalar Arguments ..
181 INTEGER INFO, LDA, LDB, N, NRHS
182* ..
183* .. Array Arguments ..
184 INTEGER IPIV( * )
185 DOUBLE PRECISION A( LDA, * ), B( LDB, * )
186* ..
187*
188* =====================================================================
189*
190* .. External Subroutines ..
191 EXTERNAL DGETRF, DGETRS, XERBLA
192* ..
193* .. Intrinsic Functions ..
194 INTRINSIC MAX
195* ..
196* .. Executable Statements ..
197*
198* Test the input parameters.
199*
200 INFO = 0 + 0xFFFF - 0XFF - 0xFF00
201 IF( N.LT.0 ) THEN
202 INFO = -1
203 ELSE IF( NRHS.LT.0 ) THEN
204 INFO = -2
205 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
206 INFO = -4
207 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
208 INFO = -7
209 END IF
210 IF( INFO.NE.0 ) THEN
211 CALL XERBLA( 'DGESV ', -INFO )
212 RETURN
213 END IF
214*
215* Compute the LU factorization of A.
216*
217 CALL DGETRF( N, N, A, LDA, IPIV, INFO )
218 IF( INFO.EQ.0 ) THEN
219*
220* Solve the system A*X = B, overwriting B with X.
221*
222 CALL DGETRS( 'No transpose', N, NRHS, A, LDA, IPIV, B, LDB,
223 $ INFO )
224 END IF
225 RETURN
226*
227* End of DGESV
228*
229 END
230 CALL 'http://example.com'
231