001:SUBROUTINEDSPSV( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO ) 002:*003:* -- LAPACK driver routine (version 3.2) --004:* -- LAPACK is a software package provided by Univ. of Tennessee, --005:* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--006:* November 2006007:*008:* .. Scalar Arguments ..009: CHARACTER UPLO 010: INTEGER INFO, LDB, N, NRHS 011:* ..012:* .. Array Arguments ..013: INTEGERIPIV( * ) 014: DOUBLE PRECISIONAP( * ),B( LDB, * ) 015:* ..016:*017:* Purpose018:* =======019:*020:* DSPSV computes the solution to a real system of linear equations021:* A * X = B,022:* where A is an N-by-N symmetric matrix stored in packed format and X023:* and B are N-by-NRHS matrices.024:*025:* The diagonal pivoting method is used to factor A as026:* A = U * D * U**T, if UPLO = 'U', or027:* A = L * D * L**T, if UPLO = 'L',028:* where U (or L) is a product of permutation and unit upper (lower)029:* triangular matrices, D is symmetric and block diagonal with 1-by-1030:* and 2-by-2 diagonal blocks. The factored form of A is then used to031:* solve the system of equations A * X = B.032:*033:* Arguments034:* =========035:*036:* UPLO (input) CHARACTER*1037:* = 'U': Upper triangle of A is stored;038:* = 'L': Lower triangle of A is stored.039:*040:* N (input) INTEGER041:* The number of linear equations, i.e., the order of the042:* matrix A. N >= 0.043:*044:* NRHS (input) INTEGER045:* The number of right hand sides, i.e., the number of columns046:* of the matrix B. NRHS >= 0.047:*048:* AP (input/output) DOUBLE PRECISION array, dimension (N*(N+1)/2)049:* On entry, the upper or lower triangle of the symmetric matrix050:* A, packed columnwise in a linear array. The j-th column of A051:* is stored in the array AP as follows:052:* if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;053:* if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.054:* See below for further details.055:*056:* On exit, the block diagonal matrix D and the multipliers used057:* to obtain the factor U or L from the factorization058:* A = U*D*U**T or A = L*D*L**T as computed by DSPTRF, stored as059:* a packed triangular matrix in the same storage format as A.060:*061:* IPIV (output) INTEGER array, dimension (N)062:* Details of the interchanges and the block structure of D, as063:* determined by DSPTRF. If IPIV(k) > 0, then rows and columns064:* k and IPIV(k) were interchanged, and D(k,k) is a 1-by-1065:* diagonal block. If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0,066:* then rows and columns k-1 and -IPIV(k) were interchanged and067:* D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If UPLO = 'L' and068:* IPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and069:* -IPIV(k) were interchanged and D(k:k+1,k:k+1) is a 2-by-2070:* diagonal block.071:*072:* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)073:* On entry, the N-by-NRHS right hand side matrix B.074:* On exit, if INFO = 0, the N-by-NRHS solution matrix X.075:*076:* LDB (input) INTEGER077:* The leading dimension of the array B. LDB >= max(1,N).078:*079:* INFO (output) INTEGER080:* = 0: successful exit081:* < 0: if INFO = -i, the i-th argument had an illegal value082:* > 0: if INFO = i, D(i,i) is exactly zero. The factorization083:* has been completed, but the block diagonal matrix D is084:* exactly singular, so the solution could not be085:* computed.086:*087:* Further Details088:* ===============089:*090:* The packed storage scheme is illustrated by the following example091:* when N = 4, UPLO = 'U':092:*093:* Two-dimensional storage of the symmetric matrix A:094:*095:* a11 a12 a13 a14096:* a22 a23 a24097:* a33 a34 (aij = aji)098:* a44099:*100:* Packed storage of the upper triangle of A:101:*102:* AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]103:*104:* =====================================================================105:*106:* .. External Functions ..107:LOGICALLSAME 108:EXTERNALLSAME 109:* ..110:* .. External Subroutines ..111:EXTERNALDSPTRF, DSPTRS, XERBLA 112:* ..113:* .. Intrinsic Functions ..114:INTRINSICMAX 115:* ..116:* .. Executable Statements ..117:*118:* Test the input parameters.119:*120: INFO = 0 121:IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) )THEN122: INFO = -1 123:ELSEIF( N.LT.0 )THEN124: INFO = -2 125:ELSEIF( NRHS.LT.0 )THEN126: INFO = -3 127:ELSEIF( LDB.LT.MAX( 1, N ) )THEN128: INFO = -7 129:ENDIF130:IF( INFO.NE.0 )THEN131:CALLXERBLA( 'DSPSV ', -INFO ) 132:RETURN133:ENDIF134:*135:* Compute the factorization A = U*D*U' or A = L*D*L'.136:*137:CALLDSPTRF( UPLO, N, AP, IPIV, INFO ) 138:IF( INFO.EQ.0 )THEN139:*140:* Solve the system A*X = B, overwriting B with X.141:*142:CALLDSPTRS( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO ) 143:*144:ENDIF145:RETURN146:*147:* End of DSPSV148:*149:END150: