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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:33