00001 /* cptsv.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 cptsv_(integer *n, integer *nrhs, real *d__, complex *e, 00017 complex *b, integer *ldb, integer *info) 00018 { 00019 /* System generated locals */ 00020 integer b_dim1, b_offset, i__1; 00021 00022 /* Local variables */ 00023 extern /* Subroutine */ int xerbla_(char *, integer *), cpttrf_( 00024 integer *, real *, complex *, integer *), cpttrs_(char *, integer 00025 *, integer *, real *, complex *, complex *, integer *, integer *); 00026 00027 00028 /* -- LAPACK routine (version 3.2) -- */ 00029 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00030 /* November 2006 */ 00031 00032 /* .. Scalar Arguments .. */ 00033 /* .. */ 00034 /* .. Array Arguments .. */ 00035 /* .. */ 00036 00037 /* Purpose */ 00038 /* ======= */ 00039 00040 /* CPTSV computes the solution to a complex system of linear equations */ 00041 /* A*X = B, where A is an N-by-N Hermitian positive definite tridiagonal */ 00042 /* matrix, and X and B are N-by-NRHS matrices. */ 00043 00044 /* A is factored as A = L*D*L**H, and the factored form of A is then */ 00045 /* used to solve the system of equations. */ 00046 00047 /* Arguments */ 00048 /* ========= */ 00049 00050 /* N (input) INTEGER */ 00051 /* The order of the matrix A. N >= 0. */ 00052 00053 /* NRHS (input) INTEGER */ 00054 /* The number of right hand sides, i.e., the number of columns */ 00055 /* of the matrix B. NRHS >= 0. */ 00056 00057 /* D (input/output) REAL array, dimension (N) */ 00058 /* On entry, the n diagonal elements of the tridiagonal matrix */ 00059 /* A. On exit, the n diagonal elements of the diagonal matrix */ 00060 /* D from the factorization A = L*D*L**H. */ 00061 00062 /* E (input/output) COMPLEX array, dimension (N-1) */ 00063 /* On entry, the (n-1) subdiagonal elements of the tridiagonal */ 00064 /* matrix A. On exit, the (n-1) subdiagonal elements of the */ 00065 /* unit bidiagonal factor L from the L*D*L**H factorization of */ 00066 /* A. E can also be regarded as the superdiagonal of the unit */ 00067 /* bidiagonal factor U from the U**H*D*U factorization of A. */ 00068 00069 /* B (input/output) COMPLEX array, dimension (LDB,NRHS) */ 00070 /* On entry, the N-by-NRHS right hand side matrix B. */ 00071 /* On exit, if INFO = 0, the N-by-NRHS solution matrix X. */ 00072 00073 /* LDB (input) INTEGER */ 00074 /* The leading dimension of the array B. LDB >= max(1,N). */ 00075 00076 /* INFO (output) INTEGER */ 00077 /* = 0: successful exit */ 00078 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00079 /* > 0: if INFO = i, the leading minor of order i is not */ 00080 /* positive definite, and the solution has not been */ 00081 /* computed. The factorization has not been completed */ 00082 /* unless i = N. */ 00083 00084 /* ===================================================================== */ 00085 00086 /* .. External Subroutines .. */ 00087 /* .. */ 00088 /* .. Intrinsic Functions .. */ 00089 /* .. */ 00090 /* .. Executable Statements .. */ 00091 00092 /* Test the input parameters. */ 00093 00094 /* Parameter adjustments */ 00095 --d__; 00096 --e; 00097 b_dim1 = *ldb; 00098 b_offset = 1 + b_dim1; 00099 b -= b_offset; 00100 00101 /* Function Body */ 00102 *info = 0; 00103 if (*n < 0) { 00104 *info = -1; 00105 } else if (*nrhs < 0) { 00106 *info = -2; 00107 } else if (*ldb < max(1,*n)) { 00108 *info = -6; 00109 } 00110 if (*info != 0) { 00111 i__1 = -(*info); 00112 xerbla_("CPTSV ", &i__1); 00113 return 0; 00114 } 00115 00116 /* Compute the L*D*L' (or U'*D*U) factorization of A. */ 00117 00118 cpttrf_(n, &d__[1], &e[1], info); 00119 if (*info == 0) { 00120 00121 /* Solve the system A*X = B, overwriting B with X. */ 00122 00123 cpttrs_("Lower", n, nrhs, &d__[1], &e[1], &b[b_offset], ldb, info); 00124 } 00125 return 0; 00126 00127 /* End of CPTSV */ 00128 00129 } /* cptsv_ */