LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
cspsv.f
Go to the documentation of this file.
00001 *> \brief <b> CSPSV computes the solution to system of linear equations A * X = B for OTHER matrices</b>
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download CSPSV + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cspsv.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cspsv.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cspsv.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE CSPSV( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          UPLO
00025 *       INTEGER            INFO, LDB, N, NRHS
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       INTEGER            IPIV( * )
00029 *       COMPLEX            AP( * ), B( LDB, * )
00030 *       ..
00031 *  
00032 *
00033 *> \par Purpose:
00034 *  =============
00035 *>
00036 *> \verbatim
00037 *>
00038 *> CSPSV computes the solution to a complex system of linear equations
00039 *>    A * X = B,
00040 *> where A is an N-by-N symmetric matrix stored in packed format and X
00041 *> and B are N-by-NRHS matrices.
00042 *>
00043 *> The diagonal pivoting method is used to factor A as
00044 *>    A = U * D * U**T,  if UPLO = 'U', or
00045 *>    A = L * D * L**T,  if UPLO = 'L',
00046 *> where U (or L) is a product of permutation and unit upper (lower)
00047 *> triangular matrices, D is symmetric and block diagonal with 1-by-1
00048 *> and 2-by-2 diagonal blocks.  The factored form of A is then used to
00049 *> solve the system of equations A * X = B.
00050 *> \endverbatim
00051 *
00052 *  Arguments:
00053 *  ==========
00054 *
00055 *> \param[in] UPLO
00056 *> \verbatim
00057 *>          UPLO is CHARACTER*1
00058 *>          = 'U':  Upper triangle of A is stored;
00059 *>          = 'L':  Lower triangle of A is stored.
00060 *> \endverbatim
00061 *>
00062 *> \param[in] N
00063 *> \verbatim
00064 *>          N is INTEGER
00065 *>          The number of linear equations, i.e., the order of the
00066 *>          matrix A.  N >= 0.
00067 *> \endverbatim
00068 *>
00069 *> \param[in] NRHS
00070 *> \verbatim
00071 *>          NRHS is INTEGER
00072 *>          The number of right hand sides, i.e., the number of columns
00073 *>          of the matrix B.  NRHS >= 0.
00074 *> \endverbatim
00075 *>
00076 *> \param[in,out] AP
00077 *> \verbatim
00078 *>          AP is COMPLEX array, dimension (N*(N+1)/2)
00079 *>          On entry, the upper or lower triangle of the symmetric matrix
00080 *>          A, packed columnwise in a linear array.  The j-th column of A
00081 *>          is stored in the array AP as follows:
00082 *>          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
00083 *>          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
00084 *>          See below for further details.
00085 *>
00086 *>          On exit, the block diagonal matrix D and the multipliers used
00087 *>          to obtain the factor U or L from the factorization
00088 *>          A = U*D*U**T or A = L*D*L**T as computed by CSPTRF, stored as
00089 *>          a packed triangular matrix in the same storage format as A.
00090 *> \endverbatim
00091 *>
00092 *> \param[out] IPIV
00093 *> \verbatim
00094 *>          IPIV is INTEGER array, dimension (N)
00095 *>          Details of the interchanges and the block structure of D, as
00096 *>          determined by CSPTRF.  If IPIV(k) > 0, then rows and columns
00097 *>          k and IPIV(k) were interchanged, and D(k,k) is a 1-by-1
00098 *>          diagonal block.  If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0,
00099 *>          then rows and columns k-1 and -IPIV(k) were interchanged and
00100 *>          D(k-1:k,k-1:k) is a 2-by-2 diagonal block.  If UPLO = 'L' and
00101 *>          IPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and
00102 *>          -IPIV(k) were interchanged and D(k:k+1,k:k+1) is a 2-by-2
00103 *>          diagonal block.
00104 *> \endverbatim
00105 *>
00106 *> \param[in,out] B
00107 *> \verbatim
00108 *>          B is COMPLEX array, dimension (LDB,NRHS)
00109 *>          On entry, the N-by-NRHS right hand side matrix B.
00110 *>          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
00111 *> \endverbatim
00112 *>
00113 *> \param[in] LDB
00114 *> \verbatim
00115 *>          LDB is INTEGER
00116 *>          The leading dimension of the array B.  LDB >= max(1,N).
00117 *> \endverbatim
00118 *>
00119 *> \param[out] INFO
00120 *> \verbatim
00121 *>          INFO is INTEGER
00122 *>          = 0:  successful exit
00123 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00124 *>          > 0:  if INFO = i, D(i,i) is exactly zero.  The factorization
00125 *>                has been completed, but the block diagonal matrix D is
00126 *>                exactly singular, so the solution could not be
00127 *>                computed.
00128 *> \endverbatim
00129 *
00130 *  Authors:
00131 *  ========
00132 *
00133 *> \author Univ. of Tennessee 
00134 *> \author Univ. of California Berkeley 
00135 *> \author Univ. of Colorado Denver 
00136 *> \author NAG Ltd. 
00137 *
00138 *> \date November 2011
00139 *
00140 *> \ingroup complexOTHERsolve
00141 *
00142 *> \par Further Details:
00143 *  =====================
00144 *>
00145 *> \verbatim
00146 *>
00147 *>  The packed storage scheme is illustrated by the following example
00148 *>  when N = 4, UPLO = 'U':
00149 *>
00150 *>  Two-dimensional storage of the symmetric matrix A:
00151 *>
00152 *>     a11 a12 a13 a14
00153 *>         a22 a23 a24
00154 *>             a33 a34     (aij = aji)
00155 *>                 a44
00156 *>
00157 *>  Packed storage of the upper triangle of A:
00158 *>
00159 *>  AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
00160 *> \endverbatim
00161 *>
00162 *  =====================================================================
00163       SUBROUTINE CSPSV( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO )
00164 *
00165 *  -- LAPACK driver routine (version 3.4.0) --
00166 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00167 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00168 *     November 2011
00169 *
00170 *     .. Scalar Arguments ..
00171       CHARACTER          UPLO
00172       INTEGER            INFO, LDB, N, NRHS
00173 *     ..
00174 *     .. Array Arguments ..
00175       INTEGER            IPIV( * )
00176       COMPLEX            AP( * ), B( LDB, * )
00177 *     ..
00178 *
00179 *  =====================================================================
00180 *
00181 *     .. External Functions ..
00182       LOGICAL            LSAME
00183       EXTERNAL           LSAME
00184 *     ..
00185 *     .. External Subroutines ..
00186       EXTERNAL           CSPTRF, CSPTRS, XERBLA
00187 *     ..
00188 *     .. Intrinsic Functions ..
00189       INTRINSIC          MAX
00190 *     ..
00191 *     .. Executable Statements ..
00192 *
00193 *     Test the input parameters.
00194 *
00195       INFO = 0
00196       IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00197          INFO = -1
00198       ELSE IF( N.LT.0 ) THEN
00199          INFO = -2
00200       ELSE IF( NRHS.LT.0 ) THEN
00201          INFO = -3
00202       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00203          INFO = -7
00204       END IF
00205       IF( INFO.NE.0 ) THEN
00206          CALL XERBLA( 'CSPSV ', -INFO )
00207          RETURN
00208       END IF
00209 *
00210 *     Compute the factorization A = U*D*U**T or A = L*D*L**T.
00211 *
00212       CALL CSPTRF( UPLO, N, AP, IPIV, INFO )
00213       IF( INFO.EQ.0 ) THEN
00214 *
00215 *        Solve the system A*X = B, overwriting B with X.
00216 *
00217          CALL CSPTRS( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO )
00218 *
00219       END IF
00220       RETURN
00221 *
00222 *     End of CSPSV
00223 *
00224       END
 All Files Functions