zgesv.c
Go to the documentation of this file.
00001 /* zgesv.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Subroutine */ int zgesv_(integer *n, integer *nrhs, doublecomplex *a, 
00017         integer *lda, integer *ipiv, doublecomplex *b, integer *ldb, integer *
00018         info)
00019 {
00020     /* System generated locals */
00021     integer a_dim1, a_offset, b_dim1, b_offset, i__1;
00022 
00023     /* Local variables */
00024     extern /* Subroutine */ int xerbla_(char *, integer *), zgetrf_(
00025             integer *, integer *, doublecomplex *, integer *, integer *, 
00026             integer *), zgetrs_(char *, integer *, integer *, doublecomplex *, 
00027              integer *, integer *, doublecomplex *, integer *, integer *);
00028 
00029 
00030 /*  -- LAPACK driver routine (version 3.2) -- */
00031 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00032 /*     November 2006 */
00033 
00034 /*     .. Scalar Arguments .. */
00035 /*     .. */
00036 /*     .. Array Arguments .. */
00037 /*     .. */
00038 
00039 /*  Purpose */
00040 /*  ======= */
00041 
00042 /*  ZGESV computes the solution to a complex system of linear equations */
00043 /*     A * X = B, */
00044 /*  where A is an N-by-N matrix and X and B are N-by-NRHS matrices. */
00045 
00046 /*  The LU decomposition with partial pivoting and row interchanges is */
00047 /*  used to factor A as */
00048 /*     A = P * L * U, */
00049 /*  where P is a permutation matrix, L is unit lower triangular, and U is */
00050 /*  upper triangular.  The factored form of A is then used to solve the */
00051 /*  system of equations A * X = B. */
00052 
00053 /*  Arguments */
00054 /*  ========= */
00055 
00056 /*  N       (input) INTEGER */
00057 /*          The number of linear equations, i.e., the order of the */
00058 /*          matrix A.  N >= 0. */
00059 
00060 /*  NRHS    (input) INTEGER */
00061 /*          The number of right hand sides, i.e., the number of columns */
00062 /*          of the matrix B.  NRHS >= 0. */
00063 
00064 /*  A       (input/output) COMPLEX*16 array, dimension (LDA,N) */
00065 /*          On entry, the N-by-N coefficient matrix A. */
00066 /*          On exit, the factors L and U from the factorization */
00067 /*          A = P*L*U; the unit diagonal elements of L are not stored. */
00068 
00069 /*  LDA     (input) INTEGER */
00070 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00071 
00072 /*  IPIV    (output) INTEGER array, dimension (N) */
00073 /*          The pivot indices that define the permutation matrix P; */
00074 /*          row i of the matrix was interchanged with row IPIV(i). */
00075 
00076 /*  B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS) */
00077 /*          On entry, the N-by-NRHS matrix of right hand side matrix B. */
00078 /*          On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
00079 
00080 /*  LDB     (input) INTEGER */
00081 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00082 
00083 /*  INFO    (output) INTEGER */
00084 /*          = 0:  successful exit */
00085 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00086 /*          > 0:  if INFO = i, U(i,i) is exactly zero.  The factorization */
00087 /*                has been completed, but the factor U is exactly */
00088 /*                singular, so the solution could not be computed. */
00089 
00090 /*  ===================================================================== */
00091 
00092 /*     .. External Subroutines .. */
00093 /*     .. */
00094 /*     .. Intrinsic Functions .. */
00095 /*     .. */
00096 /*     .. Executable Statements .. */
00097 
00098 /*     Test the input parameters. */
00099 
00100     /* Parameter adjustments */
00101     a_dim1 = *lda;
00102     a_offset = 1 + a_dim1;
00103     a -= a_offset;
00104     --ipiv;
00105     b_dim1 = *ldb;
00106     b_offset = 1 + b_dim1;
00107     b -= b_offset;
00108 
00109     /* Function Body */
00110     *info = 0;
00111     if (*n < 0) {
00112         *info = -1;
00113     } else if (*nrhs < 0) {
00114         *info = -2;
00115     } else if (*lda < max(1,*n)) {
00116         *info = -4;
00117     } else if (*ldb < max(1,*n)) {
00118         *info = -7;
00119     }
00120     if (*info != 0) {
00121         i__1 = -(*info);
00122         xerbla_("ZGESV ", &i__1);
00123         return 0;
00124     }
00125 
00126 /*     Compute the LU factorization of A. */
00127 
00128     zgetrf_(n, n, &a[a_offset], lda, &ipiv[1], info);
00129     if (*info == 0) {
00130 
00131 /*        Solve the system A*X = B, overwriting B with X. */
00132 
00133         zgetrs_("No transpose", n, nrhs, &a[a_offset], lda, &ipiv[1], &b[
00134                 b_offset], ldb, info);
00135     }
00136     return 0;
00137 
00138 /*     End of ZGESV */
00139 
00140 } /* zgesv_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:34