LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE ZPPSV( UPLO, N, NRHS, AP, B, LDB, INFO ) 00002 * 00003 * -- LAPACK driver routine (version 3.3.1) -- 00004 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00005 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00006 * -- April 2011 -- 00007 * 00008 * .. Scalar Arguments .. 00009 CHARACTER UPLO 00010 INTEGER INFO, LDB, N, NRHS 00011 * .. 00012 * .. Array Arguments .. 00013 COMPLEX*16 AP( * ), B( LDB, * ) 00014 * .. 00015 * 00016 * Purpose 00017 * ======= 00018 * 00019 * ZPPSV computes the solution to a complex system of linear equations 00020 * A * X = B, 00021 * where A is an N-by-N Hermitian positive definite matrix stored in 00022 * packed format and X and B are N-by-NRHS matrices. 00023 * 00024 * The Cholesky decomposition is used to factor A as 00025 * A = U**H * U, if UPLO = 'U', or 00026 * A = L * L**H, if UPLO = 'L', 00027 * where U is an upper triangular matrix and L is a lower triangular 00028 * matrix. The factored form of A is then used to solve the system of 00029 * equations A * X = B. 00030 * 00031 * Arguments 00032 * ========= 00033 * 00034 * UPLO (input) CHARACTER*1 00035 * = 'U': Upper triangle of A is stored; 00036 * = 'L': Lower triangle of A is stored. 00037 * 00038 * N (input) INTEGER 00039 * The number of linear equations, i.e., the order of the 00040 * matrix A. N >= 0. 00041 * 00042 * NRHS (input) INTEGER 00043 * The number of right hand sides, i.e., the number of columns 00044 * of the matrix B. NRHS >= 0. 00045 * 00046 * AP (input/output) COMPLEX*16 array, dimension (N*(N+1)/2) 00047 * On entry, the upper or lower triangle of the Hermitian matrix 00048 * A, packed columnwise in a linear array. The j-th column of A 00049 * is stored in the array AP as follows: 00050 * if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; 00051 * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. 00052 * See below for further details. 00053 * 00054 * On exit, if INFO = 0, the factor U or L from the Cholesky 00055 * factorization A = U**H*U or A = L*L**H, in the same storage 00056 * format as A. 00057 * 00058 * B (input/output) COMPLEX*16 array, dimension (LDB,NRHS) 00059 * On entry, the N-by-NRHS right hand side matrix B. 00060 * On exit, if INFO = 0, the N-by-NRHS solution matrix X. 00061 * 00062 * LDB (input) INTEGER 00063 * The leading dimension of the array B. LDB >= max(1,N). 00064 * 00065 * INFO (output) INTEGER 00066 * = 0: successful exit 00067 * < 0: if INFO = -i, the i-th argument had an illegal value 00068 * > 0: if INFO = i, the leading minor of order i of A is not 00069 * positive definite, so the factorization could not be 00070 * completed, and the solution has not been computed. 00071 * 00072 * Further Details 00073 * =============== 00074 * 00075 * The packed storage scheme is illustrated by the following example 00076 * when N = 4, UPLO = 'U': 00077 * 00078 * Two-dimensional storage of the Hermitian matrix A: 00079 * 00080 * a11 a12 a13 a14 00081 * a22 a23 a24 00082 * a33 a34 (aij = conjg(aji)) 00083 * a44 00084 * 00085 * Packed storage of the upper triangle of A: 00086 * 00087 * AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ] 00088 * 00089 * ===================================================================== 00090 * 00091 * .. External Functions .. 00092 LOGICAL LSAME 00093 EXTERNAL LSAME 00094 * .. 00095 * .. External Subroutines .. 00096 EXTERNAL XERBLA, ZPPTRF, ZPPTRS 00097 * .. 00098 * .. Intrinsic Functions .. 00099 INTRINSIC MAX 00100 * .. 00101 * .. Executable Statements .. 00102 * 00103 * Test the input parameters. 00104 * 00105 INFO = 0 00106 IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN 00107 INFO = -1 00108 ELSE IF( N.LT.0 ) THEN 00109 INFO = -2 00110 ELSE IF( NRHS.LT.0 ) THEN 00111 INFO = -3 00112 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN 00113 INFO = -6 00114 END IF 00115 IF( INFO.NE.0 ) THEN 00116 CALL XERBLA( 'ZPPSV ', -INFO ) 00117 RETURN 00118 END IF 00119 * 00120 * Compute the Cholesky factorization A = U**H *U or A = L*L**H. 00121 * 00122 CALL ZPPTRF( UPLO, N, AP, INFO ) 00123 IF( INFO.EQ.0 ) THEN 00124 * 00125 * Solve the system A*X = B, overwriting B with X. 00126 * 00127 CALL ZPPTRS( UPLO, N, NRHS, AP, B, LDB, INFO ) 00128 * 00129 END IF 00130 RETURN 00131 * 00132 * End of ZPPSV 00133 * 00134 END