zpotrs.c
Go to the documentation of this file.
00001 /* zpotrs.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 /* Table of constant values */
00017 
00018 static doublecomplex c_b1 = {1.,0.};
00019 
00020 /* Subroutine */ int zpotrs_(char *uplo, integer *n, integer *nrhs, 
00021         doublecomplex *a, integer *lda, doublecomplex *b, integer *ldb, 
00022         integer *info)
00023 {
00024     /* System generated locals */
00025     integer a_dim1, a_offset, b_dim1, b_offset, i__1;
00026 
00027     /* Local variables */
00028     extern logical lsame_(char *, char *);
00029     logical upper;
00030     extern /* Subroutine */ int ztrsm_(char *, char *, char *, char *, 
00031             integer *, integer *, doublecomplex *, doublecomplex *, integer *, 
00032              doublecomplex *, integer *), 
00033             xerbla_(char *, integer *);
00034 
00035 
00036 /*  -- LAPACK routine (version 3.2) -- */
00037 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00038 /*     November 2006 */
00039 
00040 /*     .. Scalar Arguments .. */
00041 /*     .. */
00042 /*     .. Array Arguments .. */
00043 /*     .. */
00044 
00045 /*  Purpose */
00046 /*  ======= */
00047 
00048 /*  ZPOTRS solves a system of linear equations A*X = B with a Hermitian */
00049 /*  positive definite matrix A using the Cholesky factorization */
00050 /*  A = U**H*U or A = L*L**H computed by ZPOTRF. */
00051 
00052 /*  Arguments */
00053 /*  ========= */
00054 
00055 /*  UPLO    (input) CHARACTER*1 */
00056 /*          = 'U':  Upper triangle of A is stored; */
00057 /*          = 'L':  Lower triangle of A is stored. */
00058 
00059 /*  N       (input) INTEGER */
00060 /*          The order of the matrix A.  N >= 0. */
00061 
00062 /*  NRHS    (input) INTEGER */
00063 /*          The number of right hand sides, i.e., the number of columns */
00064 /*          of the matrix B.  NRHS >= 0. */
00065 
00066 /*  A       (input) COMPLEX*16 array, dimension (LDA,N) */
00067 /*          The triangular factor U or L from the Cholesky factorization */
00068 /*          A = U**H*U or A = L*L**H, as computed by ZPOTRF. */
00069 
00070 /*  LDA     (input) INTEGER */
00071 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00072 
00073 /*  B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS) */
00074 /*          On entry, the right hand side matrix B. */
00075 /*          On exit, the solution matrix X. */
00076 
00077 /*  LDB     (input) INTEGER */
00078 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00079 
00080 /*  INFO    (output) INTEGER */
00081 /*          = 0:  successful exit */
00082 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00083 
00084 /*  ===================================================================== */
00085 
00086 /*     .. Parameters .. */
00087 /*     .. */
00088 /*     .. Local Scalars .. */
00089 /*     .. */
00090 /*     .. External Functions .. */
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     b_dim1 = *ldb;
00105     b_offset = 1 + b_dim1;
00106     b -= b_offset;
00107 
00108     /* Function Body */
00109     *info = 0;
00110     upper = lsame_(uplo, "U");
00111     if (! upper && ! lsame_(uplo, "L")) {
00112         *info = -1;
00113     } else if (*n < 0) {
00114         *info = -2;
00115     } else if (*nrhs < 0) {
00116         *info = -3;
00117     } else if (*lda < max(1,*n)) {
00118         *info = -5;
00119     } else if (*ldb < max(1,*n)) {
00120         *info = -7;
00121     }
00122     if (*info != 0) {
00123         i__1 = -(*info);
00124         xerbla_("ZPOTRS", &i__1);
00125         return 0;
00126     }
00127 
00128 /*     Quick return if possible */
00129 
00130     if (*n == 0 || *nrhs == 0) {
00131         return 0;
00132     }
00133 
00134     if (upper) {
00135 
00136 /*        Solve A*X = B where A = U'*U. */
00137 
00138 /*        Solve U'*X = B, overwriting B with X. */
00139 
00140         ztrsm_("Left", "Upper", "Conjugate transpose", "Non-unit", n, nrhs, &
00141                 c_b1, &a[a_offset], lda, &b[b_offset], ldb);
00142 
00143 /*        Solve U*X = B, overwriting B with X. */
00144 
00145         ztrsm_("Left", "Upper", "No transpose", "Non-unit", n, nrhs, &c_b1, &
00146                 a[a_offset], lda, &b[b_offset], ldb);
00147     } else {
00148 
00149 /*        Solve A*X = B where A = L*L'. */
00150 
00151 /*        Solve L*X = B, overwriting B with X. */
00152 
00153         ztrsm_("Left", "Lower", "No transpose", "Non-unit", n, nrhs, &c_b1, &
00154                 a[a_offset], lda, &b[b_offset], ldb);
00155 
00156 /*        Solve L'*X = B, overwriting B with X. */
00157 
00158         ztrsm_("Left", "Lower", "Conjugate transpose", "Non-unit", n, nrhs, &
00159                 c_b1, &a[a_offset], lda, &b[b_offset], ldb);
00160     }
00161 
00162     return 0;
00163 
00164 /*     End of ZPOTRS */
00165 
00166 } /* zpotrs_ */


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