zppsv.c
Go to the documentation of this file.
00001 /* zppsv.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 zppsv_(char *uplo, integer *n, integer *nrhs, 
00017         doublecomplex *ap, doublecomplex *b, integer *ldb, integer *info)
00018 {
00019     /* System generated locals */
00020     integer b_dim1, b_offset, i__1;
00021 
00022     /* Local variables */
00023     extern logical lsame_(char *, char *);
00024     extern /* Subroutine */ int xerbla_(char *, integer *), zpptrf_(
00025             char *, integer *, doublecomplex *, integer *), zpptrs_(
00026             char *, integer *, integer *, doublecomplex *, doublecomplex *, 
00027             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 /*  ZPPSV computes the solution to a complex system of linear equations */
00043 /*     A * X = B, */
00044 /*  where A is an N-by-N Hermitian positive definite matrix stored in */
00045 /*  packed format and X and B are N-by-NRHS matrices. */
00046 
00047 /*  The Cholesky decomposition is used to factor A as */
00048 /*     A = U**H* U,  if UPLO = 'U', or */
00049 /*     A = L * L**H,  if UPLO = 'L', */
00050 /*  where U is an upper triangular matrix and L is a lower triangular */
00051 /*  matrix.  The factored form of A is then used to solve the system of */
00052 /*  equations A * X = B. */
00053 
00054 /*  Arguments */
00055 /*  ========= */
00056 
00057 /*  UPLO    (input) CHARACTER*1 */
00058 /*          = 'U':  Upper triangle of A is stored; */
00059 /*          = 'L':  Lower triangle of A is stored. */
00060 
00061 /*  N       (input) INTEGER */
00062 /*          The number of linear equations, i.e., the order of the */
00063 /*          matrix A.  N >= 0. */
00064 
00065 /*  NRHS    (input) INTEGER */
00066 /*          The number of right hand sides, i.e., the number of columns */
00067 /*          of the matrix B.  NRHS >= 0. */
00068 
00069 /*  AP      (input/output) COMPLEX*16 array, dimension (N*(N+1)/2) */
00070 /*          On entry, the upper or lower triangle of the Hermitian matrix */
00071 /*          A, packed columnwise in a linear array.  The j-th column of A */
00072 /*          is stored in the array AP as follows: */
00073 /*          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; */
00074 /*          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. */
00075 /*          See below for further details. */
00076 
00077 /*          On exit, if INFO = 0, the factor U or L from the Cholesky */
00078 /*          factorization A = U**H*U or A = L*L**H, in the same storage */
00079 /*          format as A. */
00080 
00081 /*  B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS) */
00082 /*          On entry, the N-by-NRHS right hand side matrix B. */
00083 /*          On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
00084 
00085 /*  LDB     (input) INTEGER */
00086 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00087 
00088 /*  INFO    (output) INTEGER */
00089 /*          = 0:  successful exit */
00090 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00091 /*          > 0:  if INFO = i, the leading minor of order i of A is not */
00092 /*                positive definite, so the factorization could not be */
00093 /*                completed, and the solution has not been computed. */
00094 
00095 /*  Further Details */
00096 /*  =============== */
00097 
00098 /*  The packed storage scheme is illustrated by the following example */
00099 /*  when N = 4, UPLO = 'U': */
00100 
00101 /*  Two-dimensional storage of the Hermitian matrix A: */
00102 
00103 /*     a11 a12 a13 a14 */
00104 /*         a22 a23 a24 */
00105 /*             a33 a34     (aij = conjg(aji)) */
00106 /*                 a44 */
00107 
00108 /*  Packed storage of the upper triangle of A: */
00109 
00110 /*  AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ] */
00111 
00112 /*  ===================================================================== */
00113 
00114 /*     .. External Functions .. */
00115 /*     .. */
00116 /*     .. External Subroutines .. */
00117 /*     .. */
00118 /*     .. Intrinsic Functions .. */
00119 /*     .. */
00120 /*     .. Executable Statements .. */
00121 
00122 /*     Test the input parameters. */
00123 
00124     /* Parameter adjustments */
00125     --ap;
00126     b_dim1 = *ldb;
00127     b_offset = 1 + b_dim1;
00128     b -= b_offset;
00129 
00130     /* Function Body */
00131     *info = 0;
00132     if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00133         *info = -1;
00134     } else if (*n < 0) {
00135         *info = -2;
00136     } else if (*nrhs < 0) {
00137         *info = -3;
00138     } else if (*ldb < max(1,*n)) {
00139         *info = -6;
00140     }
00141     if (*info != 0) {
00142         i__1 = -(*info);
00143         xerbla_("ZPPSV ", &i__1);
00144         return 0;
00145     }
00146 
00147 /*     Compute the Cholesky factorization A = U'*U or A = L*L'. */
00148 
00149     zpptrf_(uplo, n, &ap[1], info);
00150     if (*info == 0) {
00151 
00152 /*        Solve the system A*X = B, overwriting B with X. */
00153 
00154         zpptrs_(uplo, n, nrhs, &ap[1], &b[b_offset], ldb, info);
00155 
00156     }
00157     return 0;
00158 
00159 /*     End of ZPPSV */
00160 
00161 } /* zppsv_ */


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