00001 /* zposv.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 zposv_(char *uplo, integer *n, integer *nrhs, 00017 doublecomplex *a, integer *lda, doublecomplex *b, integer *ldb, 00018 integer *info) 00019 { 00020 /* System generated locals */ 00021 integer a_dim1, a_offset, b_dim1, b_offset, i__1; 00022 00023 /* Local variables */ 00024 extern logical lsame_(char *, char *); 00025 extern /* Subroutine */ int xerbla_(char *, integer *), zpotrf_( 00026 char *, integer *, doublecomplex *, integer *, integer *), 00027 zpotrs_(char *, integer *, integer *, doublecomplex *, integer *, 00028 doublecomplex *, integer *, integer *); 00029 00030 00031 /* -- LAPACK driver routine (version 3.2) -- */ 00032 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00033 /* November 2006 */ 00034 00035 /* .. Scalar Arguments .. */ 00036 /* .. */ 00037 /* .. Array Arguments .. */ 00038 /* .. */ 00039 00040 /* Purpose */ 00041 /* ======= */ 00042 00043 /* ZPOSV computes the solution to a complex system of linear equations */ 00044 /* A * X = B, */ 00045 /* where A is an N-by-N Hermitian positive definite matrix and X and B */ 00046 /* are N-by-NRHS matrices. */ 00047 00048 /* The Cholesky decomposition is used to factor A as */ 00049 /* A = U**H* U, if UPLO = 'U', or */ 00050 /* A = L * L**H, if UPLO = 'L', */ 00051 /* where U is an upper triangular matrix and L is a lower triangular */ 00052 /* matrix. The factored form of A is then used to solve the system of */ 00053 /* equations A * X = B. */ 00054 00055 /* Arguments */ 00056 /* ========= */ 00057 00058 /* UPLO (input) CHARACTER*1 */ 00059 /* = 'U': Upper triangle of A is stored; */ 00060 /* = 'L': Lower triangle of A is stored. */ 00061 00062 /* N (input) INTEGER */ 00063 /* The number of linear equations, i.e., the order of the */ 00064 /* matrix A. N >= 0. */ 00065 00066 /* NRHS (input) INTEGER */ 00067 /* The number of right hand sides, i.e., the number of columns */ 00068 /* of the matrix B. NRHS >= 0. */ 00069 00070 /* A (input/output) COMPLEX*16 array, dimension (LDA,N) */ 00071 /* On entry, the Hermitian matrix A. If UPLO = 'U', the leading */ 00072 /* N-by-N upper triangular part of A contains the upper */ 00073 /* triangular part of the matrix A, and the strictly lower */ 00074 /* triangular part of A is not referenced. If UPLO = 'L', the */ 00075 /* leading N-by-N lower triangular part of A contains the lower */ 00076 /* triangular part of the matrix A, and the strictly upper */ 00077 /* triangular part of A is not referenced. */ 00078 00079 /* On exit, if INFO = 0, the factor U or L from the Cholesky */ 00080 /* factorization A = U**H*U or A = L*L**H. */ 00081 00082 /* LDA (input) INTEGER */ 00083 /* The leading dimension of the array A. LDA >= max(1,N). */ 00084 00085 /* B (input/output) COMPLEX*16 array, dimension (LDB,NRHS) */ 00086 /* On entry, the N-by-NRHS right hand side matrix B. */ 00087 /* On exit, if INFO = 0, the N-by-NRHS solution matrix X. */ 00088 00089 /* LDB (input) INTEGER */ 00090 /* The leading dimension of the array B. LDB >= max(1,N). */ 00091 00092 /* INFO (output) INTEGER */ 00093 /* = 0: successful exit */ 00094 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00095 /* > 0: if INFO = i, the leading minor of order i of A is not */ 00096 /* positive definite, so the factorization could not be */ 00097 /* completed, and the solution has not been computed. */ 00098 00099 /* ===================================================================== */ 00100 00101 /* .. External Functions .. */ 00102 /* .. */ 00103 /* .. External Subroutines .. */ 00104 /* .. */ 00105 /* .. Intrinsic Functions .. */ 00106 /* .. */ 00107 /* .. Executable Statements .. */ 00108 00109 /* Test the input parameters. */ 00110 00111 /* Parameter adjustments */ 00112 a_dim1 = *lda; 00113 a_offset = 1 + a_dim1; 00114 a -= a_offset; 00115 b_dim1 = *ldb; 00116 b_offset = 1 + b_dim1; 00117 b -= b_offset; 00118 00119 /* Function Body */ 00120 *info = 0; 00121 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) { 00122 *info = -1; 00123 } else if (*n < 0) { 00124 *info = -2; 00125 } else if (*nrhs < 0) { 00126 *info = -3; 00127 } else if (*lda < max(1,*n)) { 00128 *info = -5; 00129 } else if (*ldb < max(1,*n)) { 00130 *info = -7; 00131 } 00132 if (*info != 0) { 00133 i__1 = -(*info); 00134 xerbla_("ZPOSV ", &i__1); 00135 return 0; 00136 } 00137 00138 /* Compute the Cholesky factorization A = U'*U or A = L*L'. */ 00139 00140 zpotrf_(uplo, n, &a[a_offset], lda, info); 00141 if (*info == 0) { 00142 00143 /* Solve the system A*X = B, overwriting B with X. */ 00144 00145 zpotrs_(uplo, n, nrhs, &a[a_offset], lda, &b[b_offset], ldb, info); 00146 00147 } 00148 return 0; 00149 00150 /* End of ZPOSV */ 00151 00152 } /* zposv_ */