3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DGETRS + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgetrs.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgetrs.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgetrs.f">
21 * SUBROUTINE DGETRS( TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO )
23 * .. Scalar Arguments ..
25 * INTEGER INFO, LDA, LDB, N, NRHS
27 * .. Array Arguments ..
29 * DOUBLE PRECISION A( LDA, * ), B( LDB, * )
38 *> DGETRS solves a system of linear equations
39 *> A * X = B or A**T * X = B
40 *> with a general N-by-N matrix A using the LU factorization computed
49 *> TRANS is CHARACTER*1
50 *> Specifies the form of the system of equations:
51 *> = 'N': A * X = B (No transpose)
52 *> = 'T': A**T* X = B (Transpose)
53 *> = 'C': A**T* X = B (Conjugate transpose = Transpose)
59 *> The order of the matrix A. N >= 0.
65 *> The number of right hand sides, i.e., the number of columns
66 *> of the matrix B. NRHS >= 0.
71 *> A is DOUBLE PRECISION array, dimension (LDA,N)
72 *> The factors L and U from the factorization A = P*L*U
73 *> as computed by DGETRF.
79 *> The leading dimension of the array A. LDA >= max(1,N).
84 *> IPIV is INTEGER array, dimension (N)
85 *> The pivot indices from DGETRF; for 1<=i<=N, row i of the
86 *> matrix was interchanged with row IPIV(i).
91 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
92 *> On entry, the right hand side matrix B.
93 *> On exit, the solution matrix X.
99 *> The leading dimension of the array B. LDB >= max(1,N).
105 *> = 0: successful exit
106 *> < 0: if INFO = -i, the i-th argument had an illegal value
112 *> \author Univ. of Tennessee
113 *> \author Univ. of California Berkeley
114 *> \author Univ. of Colorado Denver
117 *> \date November 2011
119 *> \ingroup doubleGEcomputational
121 * =====================================================================
122 SUBROUTINE DGETRS( TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO )
124 * -- LAPACK computational routine (version 3.4.0) --
125 * -- LAPACK is a software package provided by Univ. of Tennessee, --
126 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
129 * .. Scalar Arguments ..
131 INTEGER INFO, LDA, LDB, N, NRHS
133 * .. Array Arguments ..
135 DOUBLE PRECISION A( LDA, * ), B( LDB, * )
138 * =====================================================================
142 PARAMETER ( ONE = 1.0D+0 )
144 * .. Local Scalars ..
147 * .. External Functions ..
151 * .. External Subroutines ..
152 EXTERNAL DLASWP, DTRSM, XERBLA
154 * .. Intrinsic Functions ..
157 * .. Executable Statements ..
159 * Test the input parameters.
162 NOTRAN = LSAME( TRANS, 'N' )
163 IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'T' ) .AND. .NOT.
164 $ LSAME( TRANS, 'C' ) ) THEN
166 ELSE IF( N.LT.0 ) THEN
168 ELSE IF( NRHS.LT.0 ) THEN
170 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
172 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
176 CALL XERBLA( 'DGETRS', -INFO )
180 * Quick return if possible
182 IF( N.EQ.0 .OR. NRHS.EQ.0 )
189 * Apply row interchanges to the right hand sides.
191 CALL DLASWP( NRHS, B, LDB, 1, N, IPIV, 1 )
193 * Solve L*X = B, overwriting B with X.
195 CALL DTRSM( 'Left', 'Lower', 'No transpose', 'Unit', N, NRHS,
196 $ ONE, A, LDA, B, LDB )
198 * Solve U*X = B, overwriting B with X.
200 CALL DTRSM( 'Left', 'Upper', 'No transpose', 'Non-unit', N,
201 $ NRHS, ONE, A, LDA, B, LDB )
204 * Solve A**T * X = B.
206 * Solve U**T *X = B, overwriting B with X.
208 CALL DTRSM( 'Left', 'Upper', 'Transpose', 'Non-unit', N, NRHS,
209 $ ONE, A, LDA, B, LDB )
211 * Solve L**T *X = B, overwriting B with X.
213 CALL DTRSM( 'Left', 'Lower', 'Transpose', 'Unit', N, NRHS, ONE,
216 * Apply row interchanges to the solution vectors.
218 CALL DLASWP( NRHS, B, LDB, 1, N, IPIV, -1 )