zpptrs.c
Go to the documentation of this file.
00001 /* zpptrs.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 integer c__1 = 1;
00019 
00020 /* Subroutine */ int zpptrs_(char *uplo, integer *n, integer *nrhs, 
00021         doublecomplex *ap, doublecomplex *b, integer *ldb, integer *info)
00022 {
00023     /* System generated locals */
00024     integer b_dim1, b_offset, i__1;
00025 
00026     /* Local variables */
00027     integer i__;
00028     extern logical lsame_(char *, char *);
00029     logical upper;
00030     extern /* Subroutine */ int ztpsv_(char *, char *, char *, integer *, 
00031             doublecomplex *, doublecomplex *, integer *), xerbla_(char *, integer *);
00032 
00033 
00034 /*  -- LAPACK routine (version 3.2) -- */
00035 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00036 /*     November 2006 */
00037 
00038 /*     .. Scalar Arguments .. */
00039 /*     .. */
00040 /*     .. Array Arguments .. */
00041 /*     .. */
00042 
00043 /*  Purpose */
00044 /*  ======= */
00045 
00046 /*  ZPPTRS solves a system of linear equations A*X = B with a Hermitian */
00047 /*  positive definite matrix A in packed storage using the Cholesky */
00048 /*  factorization A = U**H*U or A = L*L**H computed by ZPPTRF. */
00049 
00050 /*  Arguments */
00051 /*  ========= */
00052 
00053 /*  UPLO    (input) CHARACTER*1 */
00054 /*          = 'U':  Upper triangle of A is stored; */
00055 /*          = 'L':  Lower triangle of A is stored. */
00056 
00057 /*  N       (input) INTEGER */
00058 /*          The order of the 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 /*  AP      (input) COMPLEX*16 array, dimension (N*(N+1)/2) */
00065 /*          The triangular factor U or L from the Cholesky factorization */
00066 /*          A = U**H*U or A = L*L**H, packed columnwise in a linear */
00067 /*          array.  The j-th column of U or L is stored in the array AP */
00068 /*          as follows: */
00069 /*          if UPLO = 'U', AP(i + (j-1)*j/2) = U(i,j) for 1<=i<=j; */
00070 /*          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = L(i,j) for j<=i<=n. */
00071 
00072 /*  B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS) */
00073 /*          On entry, the right hand side matrix B. */
00074 /*          On exit, the solution matrix X. */
00075 
00076 /*  LDB     (input) INTEGER */
00077 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00078 
00079 /*  INFO    (output) INTEGER */
00080 /*          = 0:  successful exit */
00081 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00082 
00083 /*  ===================================================================== */
00084 
00085 /*     .. Local Scalars .. */
00086 /*     .. */
00087 /*     .. External Functions .. */
00088 /*     .. */
00089 /*     .. External Subroutines .. */
00090 /*     .. */
00091 /*     .. Intrinsic Functions .. */
00092 /*     .. */
00093 /*     .. Executable Statements .. */
00094 
00095 /*     Test the input parameters. */
00096 
00097     /* Parameter adjustments */
00098     --ap;
00099     b_dim1 = *ldb;
00100     b_offset = 1 + b_dim1;
00101     b -= b_offset;
00102 
00103     /* Function Body */
00104     *info = 0;
00105     upper = lsame_(uplo, "U");
00106     if (! upper && ! lsame_(uplo, "L")) {
00107         *info = -1;
00108     } else if (*n < 0) {
00109         *info = -2;
00110     } else if (*nrhs < 0) {
00111         *info = -3;
00112     } else if (*ldb < max(1,*n)) {
00113         *info = -6;
00114     }
00115     if (*info != 0) {
00116         i__1 = -(*info);
00117         xerbla_("ZPPTRS", &i__1);
00118         return 0;
00119     }
00120 
00121 /*     Quick return if possible */
00122 
00123     if (*n == 0 || *nrhs == 0) {
00124         return 0;
00125     }
00126 
00127     if (upper) {
00128 
00129 /*        Solve A*X = B where A = U'*U. */
00130 
00131         i__1 = *nrhs;
00132         for (i__ = 1; i__ <= i__1; ++i__) {
00133 
00134 /*           Solve U'*X = B, overwriting B with X. */
00135 
00136             ztpsv_("Upper", "Conjugate transpose", "Non-unit", n, &ap[1], &b[
00137                     i__ * b_dim1 + 1], &c__1);
00138 
00139 /*           Solve U*X = B, overwriting B with X. */
00140 
00141             ztpsv_("Upper", "No transpose", "Non-unit", n, &ap[1], &b[i__ * 
00142                     b_dim1 + 1], &c__1);
00143 /* L10: */
00144         }
00145     } else {
00146 
00147 /*        Solve A*X = B where A = L*L'. */
00148 
00149         i__1 = *nrhs;
00150         for (i__ = 1; i__ <= i__1; ++i__) {
00151 
00152 /*           Solve L*Y = B, overwriting B with X. */
00153 
00154             ztpsv_("Lower", "No transpose", "Non-unit", n, &ap[1], &b[i__ * 
00155                     b_dim1 + 1], &c__1);
00156 
00157 /*           Solve L'*X = Y, overwriting B with X. */
00158 
00159             ztpsv_("Lower", "Conjugate transpose", "Non-unit", n, &ap[1], &b[
00160                     i__ * b_dim1 + 1], &c__1);
00161 /* L20: */
00162         }
00163     }
00164 
00165     return 0;
00166 
00167 /*     End of ZPPTRS */
00168 
00169 } /* zpptrs_ */


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