LAPACK 3.3.0

zgesv.f

Go to the documentation of this file.
00001       SUBROUTINE ZGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
00002 *
00003 *  -- LAPACK driver routine (version 3.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            INFO, LDA, LDB, N, NRHS
00010 *     ..
00011 *     .. Array Arguments ..
00012       INTEGER            IPIV( * )
00013       COMPLEX*16         A( LDA, * ), B( LDB, * )
00014 *     ..
00015 *
00016 *  Purpose
00017 *  =======
00018 *
00019 *  ZGESV computes the solution to a complex system of linear equations
00020 *     A * X = B,
00021 *  where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
00022 *
00023 *  The LU decomposition with partial pivoting and row interchanges is
00024 *  used to factor A as
00025 *     A = P * L * U,
00026 *  where P is a permutation matrix, L is unit lower triangular, and U is
00027 *  upper triangular.  The factored form of A is then used to solve the
00028 *  system of equations A * X = B.
00029 *
00030 *  Arguments
00031 *  =========
00032 *
00033 *  N       (input) INTEGER
00034 *          The number of linear equations, i.e., the order of the
00035 *          matrix A.  N >= 0.
00036 *
00037 *  NRHS    (input) INTEGER
00038 *          The number of right hand sides, i.e., the number of columns
00039 *          of the matrix B.  NRHS >= 0.
00040 *
00041 *  A       (input/output) COMPLEX*16 array, dimension (LDA,N)
00042 *          On entry, the N-by-N coefficient matrix A.
00043 *          On exit, the factors L and U from the factorization
00044 *          A = P*L*U; the unit diagonal elements of L are not stored.
00045 *
00046 *  LDA     (input) INTEGER
00047 *          The leading dimension of the array A.  LDA >= max(1,N).
00048 *
00049 *  IPIV    (output) INTEGER array, dimension (N)
00050 *          The pivot indices that define the permutation matrix P;
00051 *          row i of the matrix was interchanged with row IPIV(i).
00052 *
00053 *  B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS)
00054 *          On entry, the N-by-NRHS matrix of right hand side matrix B.
00055 *          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
00056 *
00057 *  LDB     (input) INTEGER
00058 *          The leading dimension of the array B.  LDB >= max(1,N).
00059 *
00060 *  INFO    (output) INTEGER
00061 *          = 0:  successful exit
00062 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00063 *          > 0:  if INFO = i, U(i,i) is exactly zero.  The factorization
00064 *                has been completed, but the factor U is exactly
00065 *                singular, so the solution could not be computed.
00066 *
00067 *  =====================================================================
00068 *
00069 *     .. External Subroutines ..
00070       EXTERNAL           XERBLA, ZGETRF, ZGETRS
00071 *     ..
00072 *     .. Intrinsic Functions ..
00073       INTRINSIC          MAX
00074 *     ..
00075 *     .. Executable Statements ..
00076 *
00077 *     Test the input parameters.
00078 *
00079       INFO = 0
00080       IF( N.LT.0 ) THEN
00081          INFO = -1
00082       ELSE IF( NRHS.LT.0 ) THEN
00083          INFO = -2
00084       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00085          INFO = -4
00086       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00087          INFO = -7
00088       END IF
00089       IF( INFO.NE.0 ) THEN
00090          CALL XERBLA( 'ZGESV ', -INFO )
00091          RETURN
00092       END IF
00093 *
00094 *     Compute the LU factorization of A.
00095 *
00096       CALL ZGETRF( N, N, A, LDA, IPIV, INFO )
00097       IF( INFO.EQ.0 ) THEN
00098 *
00099 *        Solve the system A*X = B, overwriting B with X.
00100 *
00101          CALL ZGETRS( 'No transpose', N, NRHS, A, LDA, IPIV, B, LDB,
00102      $                INFO )
00103       END IF
00104       RETURN
00105 *
00106 *     End of ZGESV
00107 *
00108       END
 All Files Functions