001:SUBROUTINEZSPSV( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO ) 002:*003:* -- LAPACK driver routine (version 3.2) --004:* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..005:* November 2006006:*007:* .. Scalar Arguments ..008: CHARACTER UPLO 009: INTEGER INFO, LDB, N, NRHS 010:* ..011:* .. Array Arguments ..012: INTEGERIPIV( * ) 013: COMPLEX*16AP( * ),B( LDB, * ) 014:* ..015:*016:* Purpose017:* =======018:*019:* ZSPSV computes the solution to a complex system of linear equations020:* A * X = B,021:* where A is an N-by-N symmetric matrix stored in packed format and X022:* and B are N-by-NRHS matrices.023:*024:* The diagonal pivoting method is used to factor A as025:* A = U * D * U**T, if UPLO = 'U', or026:* A = L * D * L**T, if UPLO = 'L',027:* where U (or L) is a product of permutation and unit upper (lower)028:* triangular matrices, D is symmetric and block diagonal with 1-by-1029:* and 2-by-2 diagonal blocks. The factored form of A is then used to030:* solve the system of equations A * X = B.031:*032:* Arguments033:* =========034:*035:* UPLO (input) CHARACTER*1036:* = 'U': Upper triangle of A is stored;037:* = 'L': Lower triangle of A is stored.038:*039:* N (input) INTEGER040:* The number of linear equations, i.e., the order of the041:* matrix A. N >= 0.042:*043:* NRHS (input) INTEGER044:* The number of right hand sides, i.e., the number of columns045:* of the matrix B. NRHS >= 0.046:*047:* AP (input/output) COMPLEX*16 array, dimension (N*(N+1)/2)048:* On entry, the upper or lower triangle of the symmetric matrix049:* A, packed columnwise in a linear array. The j-th column of A050:* is stored in the array AP as follows:051:* if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;052:* if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.053:* See below for further details.054:*055:* On exit, the block diagonal matrix D and the multipliers used056:* to obtain the factor U or L from the factorization057:* A = U*D*U**T or A = L*D*L**T as computed by ZSPTRF, stored as058:* a packed triangular matrix in the same storage format as A.059:*060:* IPIV (output) INTEGER array, dimension (N)061:* Details of the interchanges and the block structure of D, as062:* determined by ZSPTRF. If IPIV(k) > 0, then rows and columns063:* k and IPIV(k) were interchanged, and D(k,k) is a 1-by-1064:* diagonal block. If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0,065:* then rows and columns k-1 and -IPIV(k) were interchanged and066:* D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If UPLO = 'L' and067:* IPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and068:* -IPIV(k) were interchanged and D(k:k+1,k:k+1) is a 2-by-2069:* diagonal block.070:*071:* B (input/output) COMPLEX*16 array, dimension (LDB,NRHS)072:* On entry, the N-by-NRHS right hand side matrix B.073:* On exit, if INFO = 0, the N-by-NRHS solution matrix X.074:*075:* LDB (input) INTEGER076:* The leading dimension of the array B. LDB >= max(1,N).077:*078:* INFO (output) INTEGER079:* = 0: successful exit080:* < 0: if INFO = -i, the i-th argument had an illegal value081:* > 0: if INFO = i, D(i,i) is exactly zero. The factorization082:* has been completed, but the block diagonal matrix D is083:* exactly singular, so the solution could not be084:* computed.085:*086:* Further Details087:* ===============088:*089:* The packed storage scheme is illustrated by the following example090:* when N = 4, UPLO = 'U':091:*092:* Two-dimensional storage of the symmetric matrix A:093:*094:* a11 a12 a13 a14095:* a22 a23 a24096:* a33 a34 (aij = aji)097:* a44098:*099:* Packed storage of the upper triangle of A:100:*101:* AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]102:*103:* =====================================================================104:*105:* .. External Functions ..106:LOGICALLSAME 107:EXTERNALLSAME 108:* ..109:* .. External Subroutines ..110:EXTERNALXERBLA, ZSPTRF, ZSPTRS 111:* ..112:* .. Intrinsic Functions ..113:INTRINSICMAX 114:* ..115:* .. Executable Statements ..116:*117:* Test the input parameters.118:*119: INFO = 0 120:IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) )THEN121: INFO = -1 122:ELSEIF( N.LT.0 )THEN123: INFO = -2 124:ELSEIF( NRHS.LT.0 )THEN125: INFO = -3 126:ELSEIF( LDB.LT.MAX( 1, N ) )THEN127: INFO = -7 128:ENDIF129:IF( INFO.NE.0 )THEN130:CALLXERBLA( 'ZSPSV ', -INFO ) 131:RETURN132:ENDIF133:*134:* Compute the factorization A = U*D*U' or A = L*D*L'.135:*136:CALLZSPTRF( UPLO, N, AP, IPIV, INFO ) 137:IF( INFO.EQ.0 )THEN138:*139:* Solve the system A*X = B, overwriting B with X.140:*141:CALLZSPTRS( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO ) 142:*143:ENDIF144:RETURN145:*146:* End of ZSPSV147:*148:END149: