LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dgesv.f
Go to the documentation of this file.
00001 *> \brief <b> DGESV computes the solution to system of linear equations A * X = B for GE matrices</b>
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download DGESV + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgesv.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgesv.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgesv.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       INTEGER            INFO, LDA, LDB, N, NRHS
00025 *       ..
00026 *       .. Array Arguments ..
00027 *       INTEGER            IPIV( * )
00028 *       DOUBLE PRECISION   A( LDA, * ), B( LDB, * )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *> DGESV computes the solution to a real system of linear equations
00038 *>    A * X = B,
00039 *> where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
00040 *>
00041 *> The LU decomposition with partial pivoting and row interchanges is
00042 *> used to factor A as
00043 *>    A = P * L * U,
00044 *> where P is a permutation matrix, L is unit lower triangular, and U is
00045 *> upper triangular.  The factored form of A is then used to solve the
00046 *> system of equations A * X = B.
00047 *> \endverbatim
00048 *
00049 *  Arguments:
00050 *  ==========
00051 *
00052 *> \param[in] N
00053 *> \verbatim
00054 *>          N is INTEGER
00055 *>          The number of linear equations, i.e., the order of the
00056 *>          matrix A.  N >= 0.
00057 *> \endverbatim
00058 *>
00059 *> \param[in] NRHS
00060 *> \verbatim
00061 *>          NRHS is INTEGER
00062 *>          The number of right hand sides, i.e., the number of columns
00063 *>          of the matrix B.  NRHS >= 0.
00064 *> \endverbatim
00065 *>
00066 *> \param[in,out] A
00067 *> \verbatim
00068 *>          A is DOUBLE PRECISION array, dimension (LDA,N)
00069 *>          On entry, the N-by-N coefficient matrix A.
00070 *>          On exit, the factors L and U from the factorization
00071 *>          A = P*L*U; the unit diagonal elements of L are not stored.
00072 *> \endverbatim
00073 *>
00074 *> \param[in] LDA
00075 *> \verbatim
00076 *>          LDA is INTEGER
00077 *>          The leading dimension of the array A.  LDA >= max(1,N).
00078 *> \endverbatim
00079 *>
00080 *> \param[out] IPIV
00081 *> \verbatim
00082 *>          IPIV is INTEGER array, dimension (N)
00083 *>          The pivot indices that define the permutation matrix P;
00084 *>          row i of the matrix was interchanged with row IPIV(i).
00085 *> \endverbatim
00086 *>
00087 *> \param[in,out] B
00088 *> \verbatim
00089 *>          B is DOUBLE PRECISION array, dimension (LDB,NRHS)
00090 *>          On entry, the N-by-NRHS matrix of right hand side matrix B.
00091 *>          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
00092 *> \endverbatim
00093 *>
00094 *> \param[in] LDB
00095 *> \verbatim
00096 *>          LDB is INTEGER
00097 *>          The leading dimension of the array B.  LDB >= max(1,N).
00098 *> \endverbatim
00099 *>
00100 *> \param[out] INFO
00101 *> \verbatim
00102 *>          INFO is INTEGER
00103 *>          = 0:  successful exit
00104 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00105 *>          > 0:  if INFO = i, U(i,i) is exactly zero.  The factorization
00106 *>                has been completed, but the factor U is exactly
00107 *>                singular, so the solution could not be computed.
00108 *> \endverbatim
00109 *
00110 *  Authors:
00111 *  ========
00112 *
00113 *> \author Univ. of Tennessee 
00114 *> \author Univ. of California Berkeley 
00115 *> \author Univ. of Colorado Denver 
00116 *> \author NAG Ltd. 
00117 *
00118 *> \date November 2011
00119 *
00120 *> \ingroup doubleGEsolve
00121 *
00122 *  =====================================================================
00123       SUBROUTINE DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
00124 *
00125 *  -- LAPACK driver routine (version 3.4.0) --
00126 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00127 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00128 *     November 2011
00129 *
00130 *     .. Scalar Arguments ..
00131       INTEGER            INFO, LDA, LDB, N, NRHS
00132 *     ..
00133 *     .. Array Arguments ..
00134       INTEGER            IPIV( * )
00135       DOUBLE PRECISION   A( LDA, * ), B( LDB, * )
00136 *     ..
00137 *
00138 *  =====================================================================
00139 *
00140 *     .. External Subroutines ..
00141       EXTERNAL           DGETRF, DGETRS, XERBLA
00142 *     ..
00143 *     .. Intrinsic Functions ..
00144       INTRINSIC          MAX
00145 *     ..
00146 *     .. Executable Statements ..
00147 *
00148 *     Test the input parameters.
00149 *
00150       INFO = 0
00151       IF( N.LT.0 ) THEN
00152          INFO = -1
00153       ELSE IF( NRHS.LT.0 ) THEN
00154          INFO = -2
00155       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00156          INFO = -4
00157       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00158          INFO = -7
00159       END IF
00160       IF( INFO.NE.0 ) THEN
00161          CALL XERBLA( 'DGESV ', -INFO )
00162          RETURN
00163       END IF
00164 *
00165 *     Compute the LU factorization of A.
00166 *
00167       CALL DGETRF( N, N, A, LDA, IPIV, INFO )
00168       IF( INFO.EQ.0 ) THEN
00169 *
00170 *        Solve the system A*X = B, overwriting B with X.
00171 *
00172          CALL DGETRS( 'No transpose', N, NRHS, A, LDA, IPIV, B, LDB,
00173      $                INFO )
00174       END IF
00175       RETURN
00176 *
00177 *     End of DGESV
00178 *
00179       END
 All Files Functions