KTH framework for Nek5000 toolboxes; testing version  0.0.1
dgesv.f
Go to the documentation of this file.
1  SUBROUTINE dgesv( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
2 *
3 * -- LAPACK driver routine (version 3.0) --
4 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5 * Courant Institute, Argonne National Lab, and Rice University
6 * March 31, 1993
7 *
8 * .. Scalar Arguments ..
9  INTEGER INFO, LDA, LDB, N, NRHS
10 * ..
11 * .. Array Arguments ..
12  INTEGER IPIV( * )
13  DOUBLE PRECISION A( LDA, * ), B( LDB, * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * DGESV computes the solution to a real system of linear equations
20 * A * X = B,
21 * where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
22 *
23 * The LU decomposition with partial pivoting and row interchanges is
24 * used to factor A as
25 * A = P * L * U,
26 * where P is a permutation matrix, L is unit lower triangular, and U is
27 * upper triangular. The factored form of A is then used to solve the
28 * system of equations A * X = B.
29 *
30 * Arguments
31 * =========
32 *
33 * N (input) INTEGER
34 * The number of linear equations, i.e., the order of the
35 * matrix A. N >= 0.
36 *
37 * NRHS (input) INTEGER
38 * The number of right hand sides, i.e., the number of columns
39 * of the matrix B. NRHS >= 0.
40 *
41 * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
42 * On entry, the N-by-N coefficient matrix A.
43 * On exit, the factors L and U from the factorization
44 * A = P*L*U; the unit diagonal elements of L are not stored.
45 *
46 * LDA (input) INTEGER
47 * The leading dimension of the array A. LDA >= max(1,N).
48 *
49 * IPIV (output) INTEGER array, dimension (N)
50 * The pivot indices that define the permutation matrix P;
51 * row i of the matrix was interchanged with row IPIV(i).
52 *
53 * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
54 * On entry, the N-by-NRHS matrix of right hand side matrix B.
55 * On exit, if INFO = 0, the N-by-NRHS solution matrix X.
56 *
57 * LDB (input) INTEGER
58 * The leading dimension of the array B. LDB >= max(1,N).
59 *
60 * INFO (output) INTEGER
61 * = 0: successful exit
62 * < 0: if INFO = -i, the i-th argument had an illegal value
63 * > 0: if INFO = i, U(i,i) is exactly zero. The factorization
64 * has been completed, but the factor U is exactly
65 * singular, so the solution could not be computed.
66 *
67 * =====================================================================
68 *
69 * .. External Subroutines ..
70  EXTERNAL dgetrf, dgetrs, xerbla
71 * ..
72 * .. Intrinsic Functions ..
73  INTRINSIC max
74 * ..
75 * .. Executable Statements ..
76 *
77 * Test the input parameters.
78 *
79  info = 0
80  IF( n.LT.0 ) THEN
81  info = -1
82  ELSE IF( nrhs.LT.0 ) THEN
83  info = -2
84  ELSE IF( lda.LT.max( 1, n ) ) THEN
85  info = -4
86  ELSE IF( ldb.LT.max( 1, n ) ) THEN
87  info = -7
88  END IF
89  IF( info.NE.0 ) THEN
90  CALL xerbla( 'DGESV ', -info )
91  RETURN
92  END IF
93 *
94 * Compute the LU factorization of A.
95 *
96  CALL dgetrf( n, n, a, lda, ipiv, info )
97  IF( info.EQ.0 ) THEN
98 *
99 * Solve the system A*X = B, overwriting B with X.
100 *
101  CALL dgetrs( 'No transpose', n, nrhs, a, lda, ipiv, b, ldb,
102  $ info )
103  END IF
104  RETURN
105 *
106 * End of DGESV
107 *
108  END
subroutine dgesv(N, NRHS, A, LDA, IPIV, B, LDB, INFO)
Definition: dgesv.f:2
subroutine dgetrf(M, N, A, LDA, IPIV, INFO)
Definition: dgetrf.f:2
subroutine dgetrs(TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
Definition: dgetrs.f:2
subroutine xerbla(SRNAME, INFO)
Definition: xerbla.f:2